From a56f0d5b10ca3a3637922925a0d0ffa93f605bd7 Mon Sep 17 00:00:00 2001 From: Calvin Montgomery Date: Fri, 3 Mar 2017 23:39:38 -0800 Subject: [PATCH] Adjust google drive userscript prompt --- package.json | 2 +- player/gdrive-player.coffee | 4 +--- player/gdrive-youtube.coffee | 7 +++---- www/js/player.js | 8 +++----- 4 files changed, 8 insertions(+), 13 deletions(-) diff --git a/package.json b/package.json index ddd39c52..739c4e46 100644 --- a/package.json +++ b/package.json @@ -2,7 +2,7 @@ "author": "Calvin Montgomery", "name": "CyTube", "description": "Online media synchronizer and chat", - "version": "3.30.3", + "version": "3.30.4", "repository": { "url": "http://github.com/calzoneman/sync" }, diff --git a/player/gdrive-player.coffee b/player/gdrive-player.coffee index 895424f4..043695af 100644 --- a/player/gdrive-player.coffee +++ b/player/gdrive-player.coffee @@ -6,7 +6,7 @@ window.GoogleDrivePlayer = class GoogleDrivePlayer extends VideoJSPlayer super(data) load: (data) -> - if not window.hasDriveUserscript and not data.meta.direct + if not window.hasDriveUserscript window.promptToInstallDriveUserscript() else if window.hasDriveUserscript window.maybePromptToUpgradeUserscript() @@ -31,5 +31,3 @@ window.GoogleDrivePlayer = class GoogleDrivePlayer extends VideoJSPlayer jitter: 500 }) , Math.random() * 1000) - else - super(data) diff --git a/player/gdrive-youtube.coffee b/player/gdrive-youtube.coffee index bb463150..cab77613 100644 --- a/player/gdrive-youtube.coffee +++ b/player/gdrive-youtube.coffee @@ -112,9 +112,8 @@ window.promptToInstallDriveUserscript = -> alertBox.className = 'alert alert-info' alertBox.innerHTML = """ Due to continual breaking changes making it increasingly difficult to -maintain Google Drive support, you can now install a userscript that -simplifies the code and has better compatibility. In the future, the -old player will be removed.""" +maintain Google Drive support, Google Drive now requires installing +a userscript in order to play the video.""" alertBox.appendChild(document.createElement('br')) infoLink = document.createElement('a') infoLink.className = 'btn btn-info' @@ -129,4 +128,4 @@ old player will be removed.""" closeButton.onclick = -> alertBox.parentNode.removeChild(alertBox) alertBox.insertBefore(closeButton, alertBox.firstChild) - document.getElementById('videowrap').appendChild(alertBox) + removeOld($('
').append(alertBox)) diff --git a/www/js/player.js b/www/js/player.js index b4d8f257..f9daea01 100644 --- a/www/js/player.js +++ b/www/js/player.js @@ -679,7 +679,7 @@ } GoogleDrivePlayer.prototype.load = function(data) { - if (!window.hasDriveUserscript && !data.meta.direct) { + if (!window.hasDriveUserscript) { window.promptToInstallDriveUserscript(); } else if (window.hasDriveUserscript) { window.maybePromptToUpgradeUserscript(); @@ -709,8 +709,6 @@ }); }; })(this), Math.random() * 1000); - } else { - return GoogleDrivePlayer.__super__.load.call(this, data); } }; @@ -1453,7 +1451,7 @@ alertBox = document.createElement('div'); alertBox.id = 'prompt-install-drive-userscript'; alertBox.className = 'alert alert-info'; - alertBox.innerHTML = "Due to continual breaking changes making it increasingly difficult to\nmaintain Google Drive support, you can now install a userscript that\nsimplifies the code and has better compatibility. In the future, the\nold player will be removed."; + alertBox.innerHTML = "Due to continual breaking changes making it increasingly difficult to\nmaintain Google Drive support, Google Drive now requires installing\na userscript in order to play the video."; alertBox.appendChild(document.createElement('br')); infoLink = document.createElement('a'); infoLink.className = 'btn btn-info'; @@ -1468,7 +1466,7 @@ return alertBox.parentNode.removeChild(alertBox); }; alertBox.insertBefore(closeButton, alertBox.firstChild); - return document.getElementById('videowrap').appendChild(alertBox); + return removeOld($('
').append(alertBox)); }; window.HLSPlayer = HLSPlayer = (function(superClass) {