mirror of
https://github.com/kkapsner/CanvasBlocker
synced 2025-07-04 04:26:35 +02:00
Simplified require and further linting.
This commit is contained in:
parent
01c1145e28
commit
dcb878392e
15 changed files with 86 additions and 78 deletions
|
@ -18,7 +18,6 @@
|
|||
setRandomSupply(randomSupplies.nonPersistent);
|
||||
var apiNames = Object.keys(changedFunctions);
|
||||
var undef;
|
||||
var exportFunction = require("chrome").Cu.exportFunction;
|
||||
function setRandomSupplyByType(type){
|
||||
switch (type){
|
||||
case "persistent":
|
||||
|
@ -86,6 +85,29 @@
|
|||
}
|
||||
var funcStatus = changedFunction.getStatus(this, siteStatus);
|
||||
|
||||
function notifyCallback(messageId){
|
||||
notify({
|
||||
url,
|
||||
errorStack: error.stack,
|
||||
messageId,
|
||||
timestamp: new Date(),
|
||||
functionName: name,
|
||||
dataURL:
|
||||
prefs("storeImageForInspection") &&
|
||||
prefs("showNotifications")?
|
||||
(
|
||||
this instanceof HTMLCanvasElement?
|
||||
this.toDataURL():
|
||||
(
|
||||
this.canvas instanceof HTMLCanvasElement?
|
||||
this.canvas.toDataURL():
|
||||
false
|
||||
)
|
||||
):
|
||||
false
|
||||
});
|
||||
}
|
||||
|
||||
if (funcStatus.active){
|
||||
if (funcStatus.mode === "ask"){
|
||||
funcStatus.mode = ask({
|
||||
|
@ -100,28 +122,12 @@
|
|||
return original;
|
||||
case "fake":
|
||||
setRandomSupplyByType(prefs("rng"));
|
||||
var fake = changedFunction.fakeGenerator(prefs, function(messageId){
|
||||
notify({
|
||||
url,
|
||||
errorStack: error.stack,
|
||||
messageId,
|
||||
timestamp: new Date(),
|
||||
functionName: name,
|
||||
dataURL:
|
||||
prefs("storeImageForInspection") &&
|
||||
prefs("showNotifications")?
|
||||
(
|
||||
this instanceof HTMLCanvasElement?
|
||||
this.toDataURL():
|
||||
(
|
||||
this.canvas instanceof HTMLCanvasElement?
|
||||
this.canvas.toDataURL():
|
||||
false
|
||||
)
|
||||
):
|
||||
false
|
||||
});
|
||||
}, window, original);
|
||||
var fake = changedFunction.fakeGenerator(
|
||||
prefs,
|
||||
notifyCallback,
|
||||
window,
|
||||
original
|
||||
);
|
||||
switch (fake){
|
||||
case true:
|
||||
return original;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue