diff options
author | Jacob Schatz <jschatz1@gmail.com> | 2016-07-21 17:33:24 -0400 |
---|---|---|
committer | Jacob Schatz <jschatz1@gmail.com> | 2016-07-21 17:33:24 -0400 |
commit | d2cb058ac9c63a07d0153701ad79bece21ba94ad (patch) | |
tree | 9e650208f7ce1935d77aca34e3486e13a08da8e8 /app/assets/javascripts/logo.js | |
parent | 95c4825a456a4d1df8dba1def8735203368356c9 (diff) | |
download | gitlab-ce-to_vanilla.tar.gz |
Initial commit of coffee to jsto_vanilla
Diffstat (limited to 'app/assets/javascripts/logo.js')
-rw-r--r-- | app/assets/javascripts/logo.js | 55 |
1 files changed, 55 insertions, 0 deletions
diff --git a/app/assets/javascripts/logo.js b/app/assets/javascripts/logo.js new file mode 100644 index 00000000000..bd693ab35b8 --- /dev/null +++ b/app/assets/javascripts/logo.js @@ -0,0 +1,55 @@ +// Generated by CoffeeScript 1.10.0 +(function() { + var clearHighlights, currentTimer, defaultClass, delay, firstPiece, pieceIndex, pieces, start, stop, work; + + Turbolinks.enableProgressBar(); + + defaultClass = 'tanuki-shape'; + + pieces = ['path#tanuki-right-cheek', 'path#tanuki-right-eye, path#tanuki-right-ear', 'path#tanuki-nose', 'path#tanuki-left-eye, path#tanuki-left-ear', 'path#tanuki-left-cheek']; + + pieceIndex = 0; + + firstPiece = pieces[0]; + + currentTimer = null; + + delay = 150; + + clearHighlights = function() { + return $("." + defaultClass + ".highlight").attr('class', defaultClass); + }; + + start = function() { + clearHighlights(); + pieceIndex = 0; + if (pieces[0] !== firstPiece) { + pieces.reverse(); + } + if (currentTimer) { + clearInterval(currentTimer); + } + return currentTimer = setInterval(work, delay); + }; + + stop = function() { + clearInterval(currentTimer); + return clearHighlights(); + }; + + work = function() { + clearHighlights(); + $(pieces[pieceIndex]).attr('class', defaultClass + " highlight"); + if (pieceIndex === pieces.length - 1) { + pieceIndex = 0; + return pieces.reverse(); + } else { + return pieceIndex++; + } + }; + + $(document).on('page:fetch', start); + + $(document).on('page:change', stop); + +}).call(this); |