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

Added linting for consistent-return

This commit is contained in:
kkapsner 2019-12-01 01:25:39 +01:00
parent 635cdf8061
commit 1aff68d802
10 changed files with 43 additions and 42 deletions

View file

@ -89,6 +89,26 @@
return window.screen;
}
function fakeWidth(args, check){
const {prefs, notify, window, original} = check;
const originalValue = original.apply(this, window.Array.from(args));
const returnValue = Math.round(getScreenDimensions(prefs, window).width);
if (originalValue !== returnValue){
notify("fakedScreenReadout");
}
return returnValue;
}
function fakeHeight(args, check){
const {prefs, notify, window, original} = check;
const originalValue = original.apply(this, window.Array.from(args));
const returnValue = Math.round(getScreenDimensions(prefs, window).height);
if (originalValue !== returnValue){
notify("fakedScreenReadout");
}
return returnValue;
}
scope.changedGetters = [
{
objectGetters: [function(window){return window.Screen && window.Screen.prototype;}],
@ -96,15 +116,7 @@
getterGenerator: function(checker){
const temp = {
get width(){
return checkerWrapper(checker, this, arguments, function(args, check){
const {prefs, notify, window, original} = check;
const originalValue = original.apply(this, window.Array.from(args));
const returnValue = Math.round(getScreenDimensions(prefs, window).width);
if (originalValue !== returnValue){
notify("fakedScreenReadout");
}
return returnValue;
});
return checkerWrapper(checker, this, arguments, fakeWidth);
}
};
return Object.getOwnPropertyDescriptor(temp, "width").get;
@ -116,15 +128,7 @@
getterGenerator: function(checker){
const temp = {
get height(){
return checkerWrapper(checker, this, arguments, function(args, check){
const {prefs, notify, window, original} = check;
const originalValue = original.apply(this, window.Array.from(args));
const returnValue = Math.round(getScreenDimensions(prefs, window).height);
if (originalValue !== returnValue){
notify("fakedScreenReadout");
}
return returnValue;
});
return checkerWrapper(checker, this, arguments, fakeHeight);
}
};
return Object.getOwnPropertyDescriptor(temp, "height").get;
@ -136,15 +140,7 @@
getterGenerator: function(checker){
const temp = {
get availWidth(){
return checkerWrapper(checker, this, arguments, function(args, check){
const {prefs, notify, window, original} = check;
const originalValue = original.apply(this, window.Array.from(args));
const returnValue = Math.round(getScreenDimensions(prefs, window).width);
if (originalValue !== returnValue){
notify("fakedScreenReadout");
}
return returnValue;
});
return checkerWrapper(checker, this, arguments, fakeWidth);
}
};
return Object.getOwnPropertyDescriptor(temp, "availWidth").get;
@ -156,15 +152,7 @@
getterGenerator: function(checker){
const temp = {
get availHeight(){
return checkerWrapper(checker, this, arguments, function(args, check){
const {prefs, notify, window, original} = check;
const originalValue = original.apply(this, window.Array.from(args));
const returnValue = Math.round(getScreenDimensions(prefs, window).height);
if (originalValue !== returnValue){
notify("fakedScreenReadout");
}
return returnValue;
});
return checkerWrapper(checker, this, arguments, fakeHeight);
}
};
return Object.getOwnPropertyDescriptor(temp, "availHeight").get;