mirror of
https://github.com/kkapsner/CanvasBlocker
synced 2025-04-18 08:08:28 +02:00
parent
a8611230b1
commit
f85303065c
@ -41,56 +41,59 @@
|
|||||||
var changedFunction = changedFunctions[name];
|
var changedFunction = changedFunctions[name];
|
||||||
if (changedFunction.getStatus(undefined, siteStatus).active){
|
if (changedFunction.getStatus(undefined, siteStatus).active){
|
||||||
(Array.isArray(changedFunction.object)? changedFunction.object: [changedFunction.object]).forEach(function(object){
|
(Array.isArray(changedFunction.object)? changedFunction.object: [changedFunction.object]).forEach(function(object){
|
||||||
var original = window.wrappedJSObject[object].prototype[name];
|
var constructor = window.wrappedJSObject[object];
|
||||||
|
if (constructor){
|
||||||
|
var original = constructor.prototype[name];
|
||||||
|
|
||||||
Object.defineProperty(
|
Object.defineProperty(
|
||||||
window.wrappedJSObject[object].prototype,
|
constructor.prototype,
|
||||||
name,
|
name,
|
||||||
{
|
{
|
||||||
enumerable: true,
|
enumerable: true,
|
||||||
configureable: false,
|
configureable: false,
|
||||||
get: function(){
|
get: function(){
|
||||||
var url = getURL(window);
|
var url = getURL(window);
|
||||||
if (!url){
|
if (!url){
|
||||||
return undef;
|
return undef;
|
||||||
}
|
}
|
||||||
var error = new Error();
|
var error = new Error();
|
||||||
if (checkStack(error.stack)){
|
if (checkStack(error.stack)){
|
||||||
return original;
|
return original;
|
||||||
}
|
}
|
||||||
var funcStatus = changedFunction.getStatus(this, siteStatus);
|
var funcStatus = changedFunction.getStatus(this, siteStatus);
|
||||||
|
|
||||||
if (funcStatus.active){
|
if (funcStatus.active){
|
||||||
if (funcStatus.mode === "ask"){
|
if (funcStatus.mode === "ask"){
|
||||||
funcStatus.mode = ask({window: window, type: changedFunction.type, canvas: this, errorStack: error.stack});
|
funcStatus.mode = ask({window: window, type: changedFunction.type, canvas: this, errorStack: error.stack});
|
||||||
|
}
|
||||||
|
switch (funcStatus.mode){
|
||||||
|
case "allow":
|
||||||
|
return original;
|
||||||
|
case "fake":
|
||||||
|
setRandomSupplyByType(prefs("rng"));
|
||||||
|
var fake = changedFunction.fakeGenerator(prefs, function(messageId){
|
||||||
|
notify({url, errorStack: error.stack, messageId});
|
||||||
|
}, original);
|
||||||
|
switch (fake){
|
||||||
|
case true:
|
||||||
|
return original;
|
||||||
|
case false:
|
||||||
|
return undef;
|
||||||
|
default:
|
||||||
|
return exportFunction(fake, window.wrappedJSObject);
|
||||||
|
}
|
||||||
|
//case "block":
|
||||||
|
default:
|
||||||
|
return undef;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
switch (funcStatus.mode){
|
else {
|
||||||
case "allow":
|
return original;
|
||||||
return original;
|
|
||||||
case "fake":
|
|
||||||
setRandomSupplyByType(prefs("rng"));
|
|
||||||
var fake = changedFunction.fakeGenerator(prefs, function(messageId){
|
|
||||||
notify({url, errorStack: error.stack, messageId});
|
|
||||||
}, original);
|
|
||||||
switch (fake){
|
|
||||||
case true:
|
|
||||||
return original;
|
|
||||||
case false:
|
|
||||||
return undef;
|
|
||||||
default:
|
|
||||||
return exportFunction(fake, window.wrappedJSObject);
|
|
||||||
}
|
|
||||||
//case "block":
|
|
||||||
default:
|
|
||||||
return undef;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
|
||||||
return original;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
);
|
||||||
);
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
Loading…
x
Reference in New Issue
Block a user