Skip to content

Instantly share code, notes, and snippets.

@msikma
Created January 27, 2019 13:56
Show Gist options
  • Save msikma/e483f2308ef286c6210f52b90fb55acb to your computer and use it in GitHub Desktop.
Save msikma/e483f2308ef286c6210f52b90fb55acb to your computer and use it in GitHub Desktop.
// ==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 <michiel@sikma.org>
// @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