mirror of
https://github.com/kkapsner/CanvasBlocker
synced 2025-07-04 20:46:39 +02:00
parent
895c7a36d7
commit
03524fd789
7 changed files with 59 additions and 0 deletions
|
@ -41,6 +41,12 @@
|
|||
return;
|
||||
}
|
||||
}
|
||||
if (data["canvasBlocker-clear-container-rnd"]){
|
||||
persistentRndStorage.clearContainerData(data["canvasBlocker-clear-container-rnd"]);
|
||||
if (keys.length === 1){
|
||||
return;
|
||||
}
|
||||
}
|
||||
notice("pass the message to the tabs");
|
||||
browser.tabs.query({}).then(function(tabs){
|
||||
tabs.forEach(function(tab){
|
||||
|
|
20
lib/modal.js
20
lib/modal.js
|
@ -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);
|
||||
});
|
||||
};
|
||||
}());
|
Loading…
Add table
Add a link
Reference in a new issue