aboutsummaryrefslogtreecommitdiffstats
path: root/syte-pelican/static/js/components/dribbble.js
diff options
context:
space:
mode:
authorSamrat Man Singh <samratmansingh@gmail.com>2012-07-07 08:28:26 +0545
committerSamrat Man Singh <samratmansingh@gmail.com>2012-07-07 08:28:26 +0545
commit705357519b7345422a003d8970d1f396579d91b2 (patch)
treeed3cf3a3bfbc65252417ac9125d55080a45cb192 /syte-pelican/static/js/components/dribbble.js
parent3ba3e785dc4d84a069622d9138761ff7967c7316 (diff)
downloadpelican-themes-705357519b7345422a003d8970d1f396579d91b2.tar.gz
Add syte-pelican, a theme based on Syte
Diffstat (limited to 'syte-pelican/static/js/components/dribbble.js')
-rw-r--r--syte-pelican/static/js/components/dribbble.js53
1 files changed, 53 insertions, 0 deletions
diff --git a/syte-pelican/static/js/components/dribbble.js b/syte-pelican/static/js/components/dribbble.js
new file mode 100644
index 0000000..7c2ed59
--- /dev/null
+++ b/syte-pelican/static/js/components/dribbble.js
@@ -0,0 +1,53 @@
+
+function setupDribbble(url, el) {
+ var href = el.href;
+
+ if ($('#dribbble-profile').length > 0) {
+ window.location = href;
+ return;
+ }
+
+ var params = url.attr('path').split('/').filter(function(w) {
+ if (w.length)
+ return true;
+ return false;
+ })
+
+ if (params.length == 1) {
+ var username = params[0];
+
+ var spinner = new Spinner(spin_opts).spin();
+ $('#dribbble-link').append(spinner.el);
+
+ require(["json!/dribbble/" + username, "text!templates/dribbble-view.html"],
+ function(dribbble_data, dribbble_view) {
+ if (dribbble_data.message || dribbble_data.length == 0) {
+ window.location = href;
+ return;
+ }
+
+ var template = Handlebars.compile(dribbble_view);
+
+ var user = dribbble_data.shots[0].player;
+ user.following_count = numberWithCommas(user.following_count);
+ user.followers_count = numberWithCommas(user.followers_count);
+ user.likes_count = numberWithCommas(user.likes_count);
+
+ var template_data = {
+ "user": user,
+ "shots": dribbble_data.shots
+ }
+
+ $(template(template_data)).modal().on('hidden', function () {
+ $(this).remove();
+ adjustSelection('home-link');
+ })
+
+ spinner.stop();
+ });
+
+ return;
+ }
+
+ window.location = href;
+}