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

Added tool to clear persistent rng for a specific container

Fixes #368
This commit is contained in:
kkapsner 2019-06-14 10:45:34 +02:00
parent 895c7a36d7
commit 03524fd789
7 changed files with 59 additions and 0 deletions

View file

@ -118,6 +118,8 @@
window.addEventListener("scroll", positionDialog);
window.addEventListener("resize", positionDialog);
}
return container;
}
scope.confirm = function(text, parent){
@ -128,4 +130,22 @@
], parent);
});
};
scope.select = function(text, options, parent){
return new Promise(function(resolve, reject){
const select = document.createElement("select");
options.forEach(function(option){
const optionNode = document.createElement("option");
optionNode.text = option.name;
optionNode.object = option.object;
select.appendChild(optionNode);
});
const container = openDialog(text, [
{text: extension.getTranslation("cancel"), default: true, callback: ()=>reject(false)},
{text: extension.getTranslation("OK"), focused: true, callback: ()=>resolve(select.options[select.selectedIndex].object)}
], parent);
container.querySelector(".text").insertAdjacentElement("afterend", select);
});
};
}());