Created
November 24, 2017 14:41
-
-
Save fa7ad/14d46e1e8a16f84f6ef6f102fbee73aa to your computer and use it in GitHub Desktop.
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
reset = (cb, interval, timer) -> | |
if timer then clearInterval timer | |
setInterval cb, interval | |
window.jQuery.noConflict() ($) -> | |
console.info '[sonarr-mpv]', 'Modifying page...' | |
findTargets = reset modTargets, 1000, findTargets | |
modtargets = -> | |
noEl = true | |
$ '.fc-event.success, .episode-title-cell.renderable' | |
.each -> | |
$ @ | |
.off 'click' | |
.on 'click', (e) => | |
setTimeout addMpvLink, 1000 | |
noEl = false | |
if noEl | |
do addMpvLink | |
console.warn '[sonarr-mpv]', 'No supported targets on this page' | |
findTargets = reset modTargets, 4816, findTargets | |
addMpvLink = -> | |
$ '.episode-file-info tbody .renderable.string-cell' | |
.css 'color', '#00AAFA' | |
.css 'cursor', 'pointer' | |
.css 'transition', 'all ease-in 900ms' | |
.off 'click' | |
.on 'click', (e) -> | |
do e.preventDefault | |
self = $ @ | |
self.css 'color', 'purple' | |
setTimeout -> | |
self.css('color', '#00aafa') | |
, 3000 | |
window.location.replace "mpv://#{self.text().trim()}" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment