diff options
Diffstat (limited to 'deprecated/jinweiclarkchao.github.io/assets/stuff.js')
-rw-r--r-- | deprecated/jinweiclarkchao.github.io/assets/stuff.js | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/deprecated/jinweiclarkchao.github.io/assets/stuff.js b/deprecated/jinweiclarkchao.github.io/assets/stuff.js new file mode 100644 index 0000000..a1c8ebc --- /dev/null +++ b/deprecated/jinweiclarkchao.github.io/assets/stuff.js | |||
@@ -0,0 +1,34 @@ | |||
1 | // Generated by CoffeeScript 1.8.0 | ||
2 | var load, putImages; | ||
3 | |||
4 | $(document).on("keydown", function(e) { | ||
5 | if (e.keyCode === 39 && $("#js-next-post").length) { | ||
6 | $("#js-next-post").click(); | ||
7 | } | ||
8 | if (e.keyCode === 37 && $("#js-previous-post").length) { | ||
9 | return $("#js-previous-post").click(); | ||
10 | } | ||
11 | }); | ||
12 | |||
13 | $(document).on("click", "a[id]", function(e) { | ||
14 | return _gaq.push(["_trackEvent", "Clicks", "clicked on " + e.target.id]); | ||
15 | }); | ||
16 | |||
17 | $(document).on("click", "a:not([id])", function(e) { | ||
18 | return _gaq.push(["_trackEvent", "Clicks", "clicked on " + $(this).text()]); | ||
19 | }); | ||
20 | |||
21 | load = function() { | ||
22 | return $(".img img").on("load", function() { | ||
23 | return $(this).closest(".img").addClass("show"); | ||
24 | }); | ||
25 | }; | ||
26 | |||
27 | putImages = function(pics) { | ||
28 | var box, pic; | ||
29 | pic = pics[Math.floor(Math.random() * pics.length)]; | ||
30 | box = $(".instagram"); | ||
31 | box.html(""); | ||
32 | box.append("<a target='_blank' href='" + pic.link + "' class=img><img src='" + pic.images.low_resolution.url + "'></div>"); | ||
33 | return load(); | ||
34 | }; | ||