Last active
September 13, 2018 13:48
-
-
Save jhickman/a8db4c013047efc8f4985372b3cbf200 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
// | |
// Hulu.plist | |
// BeardedSpice | |
// | |
// Created by Justin Hickman on 2018-09-13. | |
// | |
// strategy/site notes | |
// - favorite, not implemented on this site | |
// - next/prev uses the fastforward and rewind button elements click() event this will do the 10 second skipping. | |
// - track info uses first and second line elements as well as the network logo (currently disabled) | |
// - The logo is diabled because Hulu doesn't update the metadata properly. If new video doesn't have an image, it keeps the old one. | |
BSStrategy = { | |
version:1, | |
displayName:"Hulu", | |
accepts: { | |
method: "predicateOnTab", | |
format:"%K LIKE[c] '*hulu.com/*'", | |
args: ["URL"] | |
}, | |
isPlaying:function () { | |
var v=document.querySelector('video'); | |
return v && ! v.paused; | |
}, | |
toggle:function () { | |
var v=document.querySelector('video'); | |
if (v) {v.paused ? v.play() : v.pause();} | |
}, | |
next: function () { | |
var ffButton=document.querySelector('.controls__fastforward-button'); | |
ffButton.click(); | |
}, | |
favorite: function () {}, | |
previous: function () { | |
var rwButton=document.querySelector('.controls__rewind-button'); | |
rwButton.click(); | |
}, | |
pause:function () { | |
var v=document.querySelector('video'); | |
v && v.pause(); | |
}, | |
trackInfo: function () { | |
var firstLine=document.querySelector('.metadata-area__first-line'); | |
var secondLine=document.querySelector('.metadata-area__second-line'); | |
var logo=document.querySelector('.metadata-area__network-logo'); | |
return { | |
'album': firstLine ? firstLine.innerText : '', | |
'track': secondLine ? secondLine.innerText : '', | |
'image': '#', | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment