Skip to content
Snippets Groups Projects
Commit db6df6dd authored by Eugen Rochko's avatar Eugen Rochko
Browse files

Only load JS on homepage, no other page uses it

parent 57583f3f
No related branches found
No related tags found
No related merge requests found
......@@ -14,4 +14,3 @@
//= require jquery_ujs
//= require components
//= require cable
//= require mastodon-logo
defaultClass = 'mastodon-shape'
pieces = [
'path#mastodon-tusk-front, path#mastodon-tusk-back',
'path#mastodon-nose',
'path#mastodon-cheek',
'path#mastodon-forehead',
'path#mastodon-backhead',
'path#mastodon-ear',
]
pieceIndex = 0
firstPiece = pieces[0]
currentTimer = null
delay = 100
runs = 0
stop_at_run = 1
clearHighlights = ->
$(".#{defaultClass}.highlight").attr('class', defaultClass)
start = ->
clearHighlights()
pieceIndex = 0
runs = 0
pieces.reverse() unless pieces[0] == firstPiece
clearInterval(currentTimer) if currentTimer
currentTimer = setInterval(work, delay)
stop = ->
clearInterval(currentTimer)
clearHighlights()
work = ->
clearHighlights()
$(pieces[pieceIndex]).attr('class', "#{defaultClass} highlight")
if pieceIndex == pieces.length - 1
pieceIndex = 0
pieces.reverse()
runs++
else
pieceIndex++
if runs == stop_at_run
stop()
$(document).on 'turbolinks:load', ->
setTimeout(start, 100)
- content_for :header_tags do
= javascript_include_tag 'application'
= react_component 'Mastodon', default_props, class: 'app-holder', prerender: false
......@@ -6,7 +6,6 @@
= "#{yield(:page_title)} - " if content_for?(:page_title)
Mastodon
= stylesheet_link_tag 'application', media: 'all'
= javascript_include_tag 'application'
= csrf_meta_tags
= yield :header_tags
%body{ class: @body_classes }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment