1
0
Fork 0
mirror of https://github.com/kkapsner/CanvasBlocker synced 2025-07-03 12:06:31 +02:00

Added setting to controll to save notification details

Fixes #236
This commit is contained in:
kkapsner 2018-09-11 23:54:59 +02:00
parent 1a066de2fd
commit 5e5011f208
16 changed files with 556 additions and 90 deletions

View file

@ -57,13 +57,30 @@
}
});
};
scope.modalChoice = function modalChoice(messageText, choices){
message("open modal choice");
return new Promise(function(resolve, reject){
document.body.innerHTML = "";
document.body.className = "modal";
document.body.appendChild(document.createTextNode(messageText));
choices.forEach(function(choice){
const button = document.createElement("button");
button.addEventListener("click", function(){
resolve(choice.value || choice);
message("modal choice closed with value", choice.value || choice);
});
button.appendChild(document.createTextNode(choice.text || choice));
document.body.appendChild(button);
});
});
};
scope.modalPrompt = function modalPrompt(messageText, defaultValue){
message("open modal prompt");
return new Promise(function(resolve, reject){
document.body.innerHTML = "";
document.body.className = "modal";
document.body.appendChild(document.createTextNode(messageText));
var input = document.createElement("input");
input.value = defaultValue;