From ba9fbea1a1e36d905103f8a51657fdca272113f8 Mon Sep 17 00:00:00 2001 From: Calvin Montgomery Date: Mon, 15 Aug 2016 21:09:43 -0700 Subject: [PATCH] Minor fixes/cleanup --- gdrive-userscript/cytube-google-drive.user.js | 5 +---- player/update.coffee | 2 +- www/js/data.js | 3 +-- www/js/player.js | 2 +- 4 files changed, 4 insertions(+), 8 deletions(-) diff --git a/gdrive-userscript/cytube-google-drive.user.js b/gdrive-userscript/cytube-google-drive.user.js index 6add91fa..cc70a457 100644 --- a/gdrive-userscript/cytube-google-drive.user.js +++ b/gdrive-userscript/cytube-google-drive.user.js @@ -11,10 +11,6 @@ // ==/UserScript== (function () { - if (!unsafeWindow.enableCyTubeGoogleDriveUserscript) { - return; - } - function debug(message) { if (!unsafeWindow.enableCyTubeGoogleDriveUserscriptDebug) { return; @@ -152,4 +148,5 @@ unsafeWindow.GoogleDrivePlayer = GoogleDrivePlayer; unsafeWindow.console.log('Initialized userscript Google Drive player'); + unsafeWindow.hasDriveUserscript = true; })(); diff --git a/player/update.coffee b/player/update.coffee index 20b528cb..291fe81f 100644 --- a/player/update.coffee +++ b/player/update.coffee @@ -32,7 +32,7 @@ window.loadMediaPlayer = (data) -> console.error e else if data.type is 'gd' try - if data.meta.html5hack + if data.meta.html5hack or window.hasDriveUserscript window.PLAYER = new window.GoogleDrivePlayer(data) else window.PLAYER = new GoogleDriveYouTubePlayer(data) diff --git a/www/js/data.js b/www/js/data.js index 8a38b061..75acd277 100644 --- a/www/js/data.js +++ b/www/js/data.js @@ -217,5 +217,4 @@ function eraseCookie(name) { /* to be implemented in callbacks.js */ function setupCallbacks() { } -window.enableCyTubeGoogleDriveUserscript = true; -window.enableCyTubeGoogleDriveUserscriptDebug = true; +window.enableCyTubeGoogleDriveUserscriptDebug = getOrDefault("cytube_drive_debug", false); diff --git a/www/js/player.js b/www/js/player.js index 395dd53c..ec972b8f 100644 --- a/www/js/player.js +++ b/www/js/player.js @@ -1358,7 +1358,7 @@ } } else if (data.type === 'gd') { try { - if (data.meta.html5hack) { + if (data.meta.html5hack || window.hasDriveUserscript) { return window.PLAYER = new window.GoogleDrivePlayer(data); } else { return window.PLAYER = new GoogleDriveYouTubePlayer(data);