Last active
February 15, 2022 19:37
-
-
Save derjanb/1d490a4a0986aa3fd429968c9375899d to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(() => { | |
if (typeof GM_info != 'object' || GM_info.scriptHandler != 'Tampermonkey' || GM_info.version != '4.14') return; | |
const u_getValue = typeof GM_getValue == 'function' ? GM_getValue : undefined; | |
const d_getValue = typeof GM == 'object' ? GM.getValue : undefined; | |
if (u_getValue) { | |
GM_getValue = this.GM_getValue = (...args) => { | |
const v = u_getValue(...args); | |
return JSON.parse(JSON.stringify(v)); | |
} | |
} | |
if (d_getValue) { | |
const opd = Object.getOwnPropertyDescriptors(GM); | |
this.GM = GM = {}; | |
Object.keys(opd).forEach(k => { | |
if (k == 'getValue') { | |
GM.getValue = (...args) => { | |
return d_getValue(...args).then(v => JSON.parse(JSON.stringify(v))); | |
} | |
} else { | |
Object.defineProperty(GM, k, opd[k]); | |
} | |
}); | |
} | |
if (typeof unsafeWindow != 'undefined') { | |
const o = {}; | |
const d = Object.getOwnPropertyDescriptors(o.__proto__); | |
Object.keys(d).forEach(k => window[k] = o[k]); | |
window.Uint8Array = unsafeWindow.Uint8Array; | |
} | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment