Update drive userscript (#714)

This commit is contained in:
Calvin Montgomery 2017-11-15 22:27:31 -08:00
parent 875337d9a6
commit 85169fbb56
4 changed files with 18 additions and 5 deletions

View file

@ -1,3 +1,11 @@
2017-11-15
==========
The Google Drive userscript has been updated due to breaking changes in
Greasemonkey 4.0. Remember to generate the script by running:
$ npm run generate-userscript "Your Site Name" http://your-site.example.com/r/*
2017-11-05 2017-11-05
========== ==========

View file

@ -3,11 +3,13 @@
// @namespace gdcytube // @namespace gdcytube
// @description Play Google Drive videos on {SITENAME} // @description Play Google Drive videos on {SITENAME}
// {INCLUDE_BLOCK} // {INCLUDE_BLOCK}
// @require https://greasemonkey.github.io/gm4-polyfill/gm4-polyfill.js
// @grant unsafeWindow // @grant unsafeWindow
// @grant GM_xmlhttpRequest // @grant GM_xmlhttpRequest
// @grant GM.xmlHttpRequest
// @connect docs.google.com // @connect docs.google.com
// @run-at document-end // @run-at document-end
// @version 1.3.0 // @version 1.4.0
// ==/UserScript== // ==/UserScript==
try { try {
@ -56,7 +58,7 @@ try {
+ '&hl=en'; + '&hl=en';
debug('Fetching ' + url); debug('Fetching ' + url);
GM_xmlhttpRequest({ GM.xmlHttpRequest({
method: 'GET', method: 'GET',
url: url, url: url,
onload: function (res) { onload: function (res) {
@ -100,6 +102,9 @@ try {
error.reason = 'HTTP_ONERROR'; error.reason = 'HTTP_ONERROR';
return cb(error); return cb(error);
} }
}).catch(function (error) {
error.reason = 'GM.xmlHttpRequest error';
return cb(error);
}); });
} }
@ -204,7 +209,7 @@ try {
unsafeWindow.console.log('Initialized userscript Google Drive player'); unsafeWindow.console.log('Initialized userscript Google Drive player');
unsafeWindow.hasDriveUserscript = true; unsafeWindow.hasDriveUserscript = true;
unsafeWindow.driveUserscriptVersion = '1.3'; unsafeWindow.driveUserscriptVersion = '1.4';
} catch (error) { } catch (error) {
unsafeWindow.console.error(error); unsafeWindow.console.error(error);
} }

View file

@ -2,7 +2,7 @@
"author": "Calvin Montgomery", "author": "Calvin Montgomery",
"name": "CyTube", "name": "CyTube",
"description": "Online media synchronizer and chat", "description": "Online media synchronizer and chat",
"version": "3.51.3", "version": "3.51.4",
"repository": { "repository": {
"url": "http://github.com/calzoneman/sync" "url": "http://github.com/calzoneman/sync"
}, },

View file

@ -3247,7 +3247,7 @@ function maybePromptToUpgradeUserscript() {
return; return;
} }
var currentVersion = [1, 3]; var currentVersion = [1, 4];
var userscriptVersion = window.driveUserscriptVersion; var userscriptVersion = window.driveUserscriptVersion;
if (!userscriptVersion) { if (!userscriptVersion) {
userscriptVersion = '1.0'; userscriptVersion = '1.0';