1
0
Fork 0
mirror of https://github.com/kkapsner/CanvasBlocker synced 2025-07-04 20:46:39 +02:00

Remove code duplications and cleanup

This commit is contained in:
kkapsner 2019-12-10 15:07:22 +01:00
parent 8e414becf0
commit 32f9ea7447
9 changed files with 58 additions and 117 deletions

View file

@ -12,7 +12,7 @@
scope = require.register("./modifiedNavigatorAPI", {});
}
const {checkerWrapper} = require("./modifiedAPIFunctions");
const {checkerWrapper, setGetterProperties, getStatusByFlag} = require("./modifiedAPIFunctions");
const navigator = require("./navigator");
scope.changedGetters = navigator.allProperties.map(function(property){
@ -38,15 +38,9 @@
};
});
function getStatus(obj, status, prefs){
status = Object.create(status);
status.active = prefs("protectNavigator", status.url);
return status;
}
scope.changedGetters.forEach(function(changedGetter){
changedGetter.type = "readout";
changedGetter.getStatus = getStatus;
changedGetter.api = "navigator";
setGetterProperties(scope.changedGetters, {
type: "readout",
getStatus: getStatusByFlag("protectNavigator"),
api: "navigator"
});
}());