Merge branch 'master' into 'master'

Master: Fix for Chrome/Tampermonkey.  Adding in the script eval from the ubo logic last second broke things.

See merge request !7
This commit is contained in:
Hugo Xu 2017-05-29 04:15:42 +00:00
commit a98f889f66

View File

@ -105,7 +105,7 @@ var a = (function(win) {
} else { } else {
forceDrop(txt); forceDrop(txt);
} }
} else if (scriptDropMode === 1) { } else if (injectMode === 1) {
forceEval(txt); forceEval(txt);
} else { } else {
forceDrop(txt); forceDrop(txt);
@ -319,7 +319,7 @@ var a = (function(win) {
} catch(err) { } catch(err) {
console.error("AAK failed to define property ${name}!"); console.error("AAK failed to define property ${name}!");
} }
`); `, this.scriptInjectMode.drop);
} }
else { else {
@ -552,7 +552,7 @@ var a = (function(win) {
} catch (err) { } } catch (err) { }
} }
}); });
const onInsertHandler = function (insertedNode) { const onInsertHandler = (insertedNode) => {
if (insertedNode.nodeName === "DIV" && if (insertedNode.nodeName === "DIV" &&
insertedNode.id && insertedNode.id &&
insertedNode.id.length === 4 && insertedNode.id.length === 4 &&
@ -839,7 +839,7 @@ var a = (function(win) {
this.addScript(` this.addScript(`
window.addEventListener("${event}", window.${funcName}, ${capture}); window.addEventListener("${event}", window.${funcName}, ${capture});
delete window.${funcName}; delete window.${funcName};
`); `, this.scriptInjectMode.drop);
} else { } else {
this.win.addEventListener(event, func, capture); this.win.addEventListener(event, func, capture);
} }
@ -980,6 +980,12 @@ var a = (function(win) {
} }
}, },
scriptInjectMode: {
default: 0,
eval: 1,
drop: 2
},
/** /**
* The unsafe window's setInterval. * The unsafe window's setInterval.
* @property setInterval * @property setInterval
@ -1005,7 +1011,7 @@ var a = (function(win) {
this.addScript(` this.addScript(`
window.${name} = ${valFunctionName}(); window.${name} = ${valFunctionName}();
delete ${valFunctionName}; delete ${valFunctionName};
`); `, this.scriptInjectMode.drop);
} }
else { else {
let original = this.win; let original = this.win;