Skip to content

Instantly share code, notes, and snippets.

@fa7ad
Created Nov 24, 2017
Embed
What would you like to do?
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