Created
June 20, 2016 08:16
-
-
Save KiitoX/ac1706e3d0f8b65605d9f6f3c8968d44 to your computer and use it in GitHub Desktop.
lyrics.js snippet, additional css and settings code not included
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(...) | |
const scrollHandler = (state) => { | |
const lyricsP = $('#lyrics p'); | |
if (state) { // enable auto scroll | |
lyricsP.attr('scroll', true); | |
animate = true; | |
timeHandler(remote.getGlobal('PlaybackAPI').data.time); | |
// reset scroll to proper place | |
} else { // disable auto scroll | |
lyricsP.removeAttr('scroll'); | |
animate = false; | |
clearTimeout(animationTimer); | |
lyricsP.stop(); | |
// stop scroll | |
} | |
}; | |
// run once to set up | |
scrollHandler(Settings.get('scrollLyrics', true)); | |
// triggered on settings toggle | |
Emitter.on('settings:set:scrollLyrics', (e, arg) => scrollHandler(arg)); | |
(...) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment