mirror of
https://github.com/kkapsner/CanvasBlocker
synced 2025-07-03 12:06:31 +02:00
Improved design of the page action display.
This commit is contained in:
parent
03bf34d092
commit
ae0763cfe6
14 changed files with 614 additions and 13 deletions
|
@ -39,8 +39,17 @@
|
|||
scope.createActionButtons = function createActionButtons(container, actions, data){
|
||||
actions.forEach(function(action, i){
|
||||
var button = document.createElement("button");
|
||||
button.className = action.name;
|
||||
button.textContent = browser.i18n.getMessage(action.name);
|
||||
button.className = action.name + " action";
|
||||
button.title = browser.i18n.getMessage(action.name);
|
||||
if (action.isIcon || action.icon){
|
||||
button.classList.add("isIcon");
|
||||
var img = document.createElement("img");
|
||||
button.appendChild(img);
|
||||
img.src = "../icons/" + (action.icon || `pageAction-${action.name}.svg`);
|
||||
}
|
||||
else {
|
||||
button.textContent = button.title;
|
||||
}
|
||||
button.addEventListener("click", action.callback.bind(undefined, data));
|
||||
container.appendChild(button);
|
||||
if (i % 3 === 2){
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue