diff --git a/github/monkey.js b/github/monkey.js index 8be4f44..8df2511 100644 --- a/github/monkey.js +++ b/github/monkey.js @@ -12,7 +12,7 @@ * @sourceURL https://github.com/XIU2/UserScript/blob/master/GithubEnhanced-High-Speed-Download.user.js */ document.addEventListener("DOMContentLoaded", () => { - const DS_init = window.__ds_global__['DS_init'] + const DS_init = (window.__ds_global__ || {})['DS_init'] if (typeof DS_init === 'function') { console.log("ds_github_monkey_2.5.20: do DS_init") DS_init({"name":"Github 增强 - 高速下载","icon":"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAMAAABEpIrGAAAABGdBTUEAALGPC/xhBQAAAAFzUkdCAK7OHOkAAACEUExURUxpcRgWFhsYGBgWFhcWFh8WFhoYGBgWFiUlJRcVFRkWFhgVFRgWFhgVFRsWFhgWFigeHhkWFv////////////r6+h4eHv///xcVFfLx8SMhIUNCQpSTk/r6+jY0NCknJ97e3ru7u+fn51BOTsPCwqGgoISDg6empmpoaK2srNDQ0FhXV3eXcCcAAAAXdFJOUwCBIZXMGP70BuRH2Ze/LpIMUunHkpQR34sfygAAAVpJREFUOMt1U+magjAMDAVb5BDU3W25b9T1/d9vaYpQKDs/rF9nSNJkArDA9ezQZ8wPbc8FE6eAiQUsOO1o19JolFibKCdHGHC0IJezOMD5snx/yE+KOYYr42fPSufSZyazqDoseTPw4lGJNOu6LBXVUPBG3lqYAOv/5ZwnNUfUifzBt8gkgfgINmjxOpgqUA147QWNaocLniqq3QsSVbQHNp45N/BAwoYQz9oUJEiE4GMGfoBSMj5gjeWRIMMqleD/CAzUHFqTLyjOA5zjNnwa4UCEZ2YK3khEcBXHjVBtEFeIZ6+NxYbPqWp1DLKV42t6Ujn2ydyiPi9nX0TTNAkVVZ/gozsl6FbrktkwaVvL2TRK0C8Ca7Hck7f5OBT6FFbLATkL2ugV0tm0RLM9fedDvhWstl8Wp9AFDjFX7yOY/lJrv8AkYuz7fuP8dv9izCYH+x3/LBnj9fYPBTpJDNzX+7cAAAAASUVORK5CYII="}); @@ -20,17 +20,17 @@ document.addEventListener("DOMContentLoaded", () => { console.log("ds_github_2.5.20: has no DS_init") } - if (!(window.__ds_global__.GM_getValue || (() => true))("ds_enabled", true)) { + if (!((window.__ds_global__ || {}).GM_getValue || (() => true))("ds_enabled", true)) { console.log("ds_github_monkey_2.5.20: disabled") return } - const GM_registerMenuCommand = window.__ds_global__['GM_registerMenuCommand'] || (() => {}); - const GM_unregisterMenuCommand = window.__ds_global__['GM_unregisterMenuCommand'] || (() => {}); - const GM_openInTab = window.__ds_global__['GM_openInTab'] || (() => {}); - const GM_getValue = window.__ds_global__['GM_getValue'] || (() => {}); - const GM_setValue = window.__ds_global__['GM_setValue'] || (() => {}); - const GM_notification = window.__ds_global__['GM_notification'] || (() => {}); + const GM_registerMenuCommand = (window.__ds_global__ || {})['GM_registerMenuCommand'] || (() => {}); + const GM_unregisterMenuCommand = (window.__ds_global__ || {})['GM_unregisterMenuCommand'] || (() => {}); + const GM_openInTab = (window.__ds_global__ || {})['GM_openInTab'] || (() => {}); + const GM_getValue = (window.__ds_global__ || {})['GM_getValue'] || (() => {}); + const GM_setValue = (window.__ds_global__ || {})['GM_setValue'] || (() => {}); + const GM_notification = (window.__ds_global__ || {})['GM_notification'] || (() => {}); (function() { 'use strict';