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("./modifiedScreenAPI", {});
}
const {checkerWrapper} = require("./modifiedAPIFunctions");
const {checkerWrapper, setGetterProperties, getStatusByFlag} = require("./modifiedAPIFunctions");
const physical = {
width: Math.round(window.screen.width * window.devicePixelRatio),
@ -280,15 +280,9 @@
},
];
function getStatus(obj, status, prefs){
status = Object.create(status);
status.active = prefs("protectScreen", status.url);
return status;
}
scope.changedGetters.forEach(function(changedGetter){
changedGetter.type = "readout";
changedGetter.getStatus = getStatus;
changedGetter.api = "screen";
setGetterProperties(scope.changedGetters, {
type: "readout",
getStatus: getStatusByFlag("protectScreen"),
api: "screen"
});
}());