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:
parent
8e414becf0
commit
32f9ea7447
9 changed files with 58 additions and 117 deletions
|
@ -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"
|
||||
});
|
||||
}());
|
Loading…
Add table
Add a link
Reference in a new issue