Created
January 27, 2019 13:56
-
-
Save msikma/e483f2308ef286c6210f52b90fb55acb 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
// ==UserScript== | |
// @name iSakura TV - Auto next program | |
// @namespace http://webtv.jptvpro.net/ | |
// @version 0.1 | |
// @description Automatically activates the next program when your current one finishes playing. | |
// @author Michiel Sikma <[email protected]> | |
// @match http://webtv.jptvpro.net/play.html | |
// @grant none | |
// ==/UserScript== | |
const noop = () => {} | |
function log(msg) { | |
console.log('%c' + msg, 'background: #ffdd00'); | |
} | |
(function() { | |
'use strict'; | |
log('AutoNext: script initializing'); | |
// This page loads the main page in an <iframe> and kickstarts it. | |
// The actual video player resides in isakura/main.html. | |
const currPage = String(window.location.pathname) | |
const isPlayPage = currPage.endsWith('play.html') | |
log('AutoNext: current page: ' + currPage) | |
if (isPlayPage) { | |
// Remove the limitation of being able to use the stream on one client only. | |
const removeCheckSinglePlay = setInterval(function() { | |
if (window.tvplayer.checkSinglePlay) { | |
window.tvplayer.checkSinglePlay = noop | |
log('AutoNext: removed tvplayer.checkSinglePlay()') | |
clearInterval(removeCheckSinglePlay); | |
} | |
}, 500); | |
} | |
else { | |
log('AutoNext: unknown page'); | |
} | |
log('AutoNext: script finished initializing.') | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment