From e002d09d2b6b2317fec6caa8836b20e6709c5da3 Mon Sep 17 00:00:00 2001 From: Jinwei Zhao Date: Mon, 4 Apr 2016 14:00:39 +0800 Subject: jinwei.me --- .../jinweiclarkchao.github.io/assets/stuff.js | 34 ++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 deprecated/jinweiclarkchao.github.io/assets/stuff.js (limited to 'deprecated/jinweiclarkchao.github.io/assets/stuff.js') 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 @@ +// Generated by CoffeeScript 1.8.0 +var load, putImages; + +$(document).on("keydown", function(e) { + if (e.keyCode === 39 && $("#js-next-post").length) { + $("#js-next-post").click(); + } + if (e.keyCode === 37 && $("#js-previous-post").length) { + return $("#js-previous-post").click(); + } +}); + +$(document).on("click", "a[id]", function(e) { + return _gaq.push(["_trackEvent", "Clicks", "clicked on " + e.target.id]); +}); + +$(document).on("click", "a:not([id])", function(e) { + return _gaq.push(["_trackEvent", "Clicks", "clicked on " + $(this).text()]); +}); + +load = function() { + return $(".img img").on("load", function() { + return $(this).closest(".img").addClass("show"); + }); +}; + +putImages = function(pics) { + var box, pic; + pic = pics[Math.floor(Math.random() * pics.length)]; + box = $(".instagram"); + box.html(""); + box.append(""); + return load(); +}; -- cgit v1.2.3