2016-02-29 04:47:22 -05:00
|
|
|
Turbolinks.enableProgressBar();
|
2016-01-02 15:32:40 -05:00
|
|
|
|
|
|
|
defaultClass = 'tanuki-shape'
|
|
|
|
pieces = [
|
2016-01-02 19:57:21 -05:00
|
|
|
'path#tanuki-right-cheek',
|
2016-01-04 14:54:56 -05:00
|
|
|
'path#tanuki-right-eye, path#tanuki-right-ear',
|
|
|
|
'path#tanuki-nose',
|
|
|
|
'path#tanuki-left-eye, path#tanuki-left-ear',
|
|
|
|
'path#tanuki-left-cheek',
|
2016-01-02 15:32:40 -05:00
|
|
|
]
|
2016-01-04 15:18:04 -05:00
|
|
|
pieceIndex = 0
|
2016-01-02 19:57:21 -05:00
|
|
|
firstPiece = pieces[0]
|
2016-01-04 15:18:04 -05:00
|
|
|
|
|
|
|
currentTimer = null
|
|
|
|
delay = 150
|
2016-01-02 15:32:40 -05:00
|
|
|
|
|
|
|
clearHighlights = ->
|
2016-01-04 14:57:11 -05:00
|
|
|
$(".#{defaultClass}.highlight").attr('class', defaultClass)
|
2016-01-02 15:32:40 -05:00
|
|
|
|
|
|
|
start = ->
|
|
|
|
clearHighlights()
|
2016-01-04 15:18:04 -05:00
|
|
|
pieceIndex = 0
|
2016-01-02 19:57:21 -05:00
|
|
|
pieces.reverse() unless pieces[0] == firstPiece
|
2016-01-11 18:37:20 -05:00
|
|
|
clearInterval(currentTimer) if currentTimer
|
2016-01-04 15:18:04 -05:00
|
|
|
currentTimer = setInterval(work, delay)
|
2016-01-02 15:32:40 -05:00
|
|
|
|
|
|
|
stop = ->
|
2016-01-04 15:18:04 -05:00
|
|
|
clearInterval(currentTimer)
|
2016-01-02 15:32:40 -05:00
|
|
|
clearHighlights()
|
|
|
|
|
2016-01-04 15:18:04 -05:00
|
|
|
work = ->
|
|
|
|
clearHighlights()
|
|
|
|
$(pieces[pieceIndex]).attr('class', "#{defaultClass} highlight")
|
|
|
|
|
|
|
|
# If we hit the last piece, reset the index and then reverse the array to
|
|
|
|
# get a nice back-and-forth sweeping look
|
|
|
|
if pieceIndex == pieces.length - 1
|
|
|
|
pieceIndex = 0
|
|
|
|
pieces.reverse()
|
|
|
|
else
|
|
|
|
pieceIndex++
|
|
|
|
|
|
|
|
$(document).on('page:fetch', start)
|
|
|
|
$(document).on('page:change', stop)
|
2016-02-03 12:18:55 -05:00
|
|
|
|
|
|
|
$ ->
|
2016-02-06 18:18:34 -05:00
|
|
|
# Make logo clickable as part of a workaround for Safari visited
|
|
|
|
# link behaviour (See !2690).
|
2016-02-03 12:18:55 -05:00
|
|
|
$('#logo').on 'click', ->
|
2016-06-10 13:01:16 -04:00
|
|
|
Turbolinks.visit('/')
|