fix: tampermonkey script on Chrome

fixes: #121
This commit is contained in:
Xmader 2021-05-11 17:02:32 -04:00
parent 7a397e068f
commit 30514e9507
No known key found for this signature in database
GPG Key ID: A20B97FB9EB730E4
1 changed files with 8 additions and 7 deletions

View File

@ -30,11 +30,10 @@ function getRandL () {
// script loader
new Promise(resolve => {
const d = new Image()
document.body.prepend(d)
resolve(d)
}).then(d => {
const stackN = 10
const id = '' + Math.random();
w[id] = resolve;
const stackN = 9
let loaderIntro = ''
for (let i = 0; i < stackN; i++) {
loaderIntro += `(function ${getRandL()}(){`
@ -42,10 +41,12 @@ new Promise(resolve => {
const loaderOutro = '})()'.repeat(stackN)
const mockUrl = "https://c.amazon-adsystem.com/aax2/apstag.js"
Function(`${loaderIntro}const d=new Image();window['${id}'](d);delete window['${id}'];document.body.prepend(d)${loaderOutro}//# sourceURL=${mockUrl}`)()
}).then(d => {
d.style.display = 'none';
d.src = 'data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==';
d.once = false;
d.setAttribute('onload', `const self=this;${loaderIntro}if(self.once)return;self.once=true;self.remove();const GM=window['${gmId}'];delete window['${gmId}'];(` + function a () {
d.setAttribute('onload', `if(this.once)return;this.once=true;this.remove();const GM=window['${gmId}'];delete window['${gmId}'];(` + function a () {
/** script code here */
}.toString() + `)()${loaderOutro}//# sourceURL=${mockUrl}`)})
}.toString() + ')()')})