diff options
author | Jinwei Zhao <[email protected]> | 2016-06-07 11:02:39 +0800 |
---|---|---|
committer | Jinwei Zhao <[email protected]> | 2017-01-13 15:07:46 +0800 |
commit | efb8867c8eb5d87b36e596f50119740cb3b27a73 (patch) | |
tree | 2d8d6a0cccdb1ae6ce9b0533fcfc665392519efe /js | |
parent | 219a02188797aedc5f141ce2d0a04a7661b75186 (diff) | |
download | jinwei.me-efb8867c8eb5d87b36e596f50119740cb3b27a73.tar.gz |
clean up
Diffstat (limited to 'js')
-rwxr-xr-x | js/portfolio.js | 32 |
1 files changed, 0 insertions, 32 deletions
diff --git a/js/portfolio.js b/js/portfolio.js deleted file mode 100755 index f1ab1fb..0000000 --- a/js/portfolio.js +++ /dev/null | |||
@@ -1,32 +0,0 @@ | |||
1 | var sleep = function(ms, callback) { | ||
2 | setTimeout(function() { | ||
3 | callback() | ||
4 | }, ms) | ||
5 | }, | ||
6 | favthings = ["raspberrypi", "Linux", "Let's Encrypt", "Ingress", "Computer Vision", | ||
7 | "Machine Learning"], | ||
8 | removeClass = function(el, className) { | ||
9 | el.classList ? el.classList.remove(className) : el.className = | ||
10 | el.className.replace(new RegExp("(^|\\b)" + className.split(" ").join("|") + "(\\b|$)", | ||
11 | "gi"), " ") | ||
12 | }, | ||
13 | addClass = function(el, className) { | ||
14 | el.classList ? el.classList.add(className) : el.className += " " + className | ||
15 | }, | ||
16 | i = 0, | ||
17 | nextThing = function(thing) { | ||
18 | i < favthings.length - 1 ? i++ : i = 0, removeClass(thing, "slideInDown"), | ||
19 | addClass(thing, "slideOutUp"), sleep(700, function() { | ||
20 | thing.innerHTML = favthings[i], removeClass(thing, "slideOutUp"), | ||
21 | addClass(thing, "slideInDown") | ||
22 | }) | ||
23 | }; | ||
24 | document.addEventListener("DOMContentLoaded", function() { | ||
25 | var thing = document.querySelectorAll(".favthing")[0]; | ||
26 | setTimeout(function() { | ||
27 | nextThing(thing) | ||
28 | }, 1e3), setInterval(function() { | ||
29 | nextThing(thing) | ||
30 | }, 4e3) | ||
31 | }); | ||
32 | |||