mirror of
https://github.com/kkapsner/CanvasBlocker
synced 2025-07-15 14:09:36 +02:00
Added preference to control rng type.
This commit is contained in:
parent
447ff54222
commit
1b2c4cb487
9 changed files with 233 additions and 126 deletions
|
@ -5,10 +5,22 @@
|
|||
(function(){
|
||||
"use strict";
|
||||
|
||||
const {changedFunctions} = require("./modifiedAPI");
|
||||
const {changedFunctions, setRandomSupply} = require("./modifiedAPI");
|
||||
const randomSupplies = require("./randomSupplies");
|
||||
setRandomSupply(randomSupplies.nonPersistent);
|
||||
var apiNames = Object.keys(changedFunctions);
|
||||
var undef;
|
||||
|
||||
function setRandomSupplyByType(type){
|
||||
switch (type){
|
||||
case "persistent":
|
||||
setRandomSupply(randomSupplies.persistent);
|
||||
break;
|
||||
default:
|
||||
setRandomSupply(randomSupplies.nonPersistent);
|
||||
}
|
||||
}
|
||||
exports.setRandomSupplyByType = setRandomSupplyByType;
|
||||
exports.intercept = function intercept({subject: window}, {check, ask, notify, prefs}){
|
||||
apiNames.forEach(function(name){
|
||||
var changedFunction = changedFunctions[name];
|
||||
|
@ -34,8 +46,8 @@
|
|||
case "allow":
|
||||
return original;
|
||||
case "fake":
|
||||
setRandomSupplyByType(prefs("rng"));
|
||||
if (changedFunction.fake){
|
||||
|
||||
return changedFunction.fake;
|
||||
}
|
||||
else {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue