Skip to content

Commit

Permalink
main.js: put all the code into wrapper
Browse files Browse the repository at this point in the history
so no need to mess with unsafeWindow
  • Loading branch information
johndoe committed Oct 14, 2019
1 parent 7c06a58 commit 7fa2e32
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions main.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
// @run-at document-end
// ==/UserScript==

@@PLUGINSTART@@
window.script_info = plugin_info;

// REPLACE ORIG SITE ///////////////////////////////////////////////////
if(document.getElementsByTagName('html')[0].getAttribute('itemscope') != null)
Expand All @@ -20,8 +22,7 @@ document.body.onload = function() {};
//originally code here parsed the <Script> tags from the page to find the one that defined the PLAYER object
//however, that's already been executed, so we can just access PLAYER - no messing around needed!

var PLAYER = window.PLAYER || (unsafeWindow && unsafeWindow.PLAYER);
if (typeof(PLAYER)!="object" || typeof(PLAYER.nickname) != "string") {
if (!window.PLAYER || !PLAYER.nickname) {
// page doesn’t have a script tag with player information.
if(document.getElementById('header_email')) {
// however, we are logged in.
Expand Down Expand Up @@ -90,9 +91,6 @@ document.body.innerHTML = ''
// avoid error by stock JS
+ '<div id="play_button"></div>';

@@PLUGINSTART@@
window.script_info = plugin_info;

// CONFIG OPTIONS ////////////////////////////////////////////////////
window.REFRESH = 30; // refresh view every 30s (base time)
window.ZOOM_LEVEL_ADJ = 5; // add 5 seconds per zoom level
Expand Down

0 comments on commit 7fa2e32

Please sign in to comment.