1
0
Fork 0
mirror of https://github.com/kkapsner/CanvasBlocker synced 2025-07-15 14:09:36 +02:00

Changed library functions that may work in both types.

Added helper scripts for webExtension.
This commit is contained in:
kkapsner 2017-06-25 22:22:17 +02:00
parent 6c3b27e7e4
commit 4ea073132d
6 changed files with 190 additions and 97 deletions

View file

@ -5,6 +5,15 @@
(function(){
"use strict";
var scope;
if ((typeof exports) !== "undefined"){
scope = exports;
}
else {
window.scope.intercept = {};
scope = window.scope.intercept;
}
const {changedFunctions, setRandomSupply} = require("./modifiedAPI");
const randomSupplies = require("./randomSupplies");
setRandomSupply(randomSupplies.nonPersistent);
@ -20,7 +29,7 @@
setRandomSupply(randomSupplies.nonPersistent);
}
}
exports.setRandomSupplyByType = setRandomSupplyByType;
scope.setRandomSupplyByType = setRandomSupplyByType;
function getURL(window){
if (!window.location.href || window.location.href === "about:blank"){
@ -34,7 +43,7 @@
return window.location.href;
}
exports.intercept = function intercept({subject: window}, {check, checkStack, ask, notify, prefs}){
scope.intercept = function intercept({subject: window}, {check, checkStack, ask, notify, prefs}){
var siteStatus = check({url: getURL(window)});
if (siteStatus.mode !== "allow"){
apiNames.forEach(function(name){
@ -51,7 +60,7 @@
{
enumerable: true,
configureable: false,
get: function(){
get: exportFunction(function()
var url = getURL(window);
if (!url){
return undef;
@ -90,7 +99,7 @@
else {
return original;
}
}
}, window)
}
);
}