1
0
mirror of https://github.com/kkapsner/CanvasBlocker synced 2024-11-11 07:38:58 +01:00

url specific values can be added by hitting enter in the input

This commit is contained in:
kkapsner 2018-10-15 08:53:07 +02:00
parent dae401acf8
commit 16b4bbcab3
2 changed files with 12 additions and 6 deletions

View File

@ -222,17 +222,23 @@
footCell.colSpan = 3; footCell.colSpan = 3;
let newInput = document.createElement("input"); let newInput = document.createElement("input");
newInput.title = browser.i18n.getMessage("inputURL"); newInput.title = browser.i18n.getMessage("inputURL");
footCell.appendChild(newInput); const addURLSetting = function(){
let footPlus = document.createElement("span");
footPlus.classList.add("add");
footPlus.textContent = "+";
footPlus.addEventListener("click", function(){
var url = newInput.value.trim(); var url = newInput.value.trim();
if (url){ if (url){
setting.set(setting.get(url), url); setting.set(setting.get(url), url);
newInput.value = ""; newInput.value = "";
} }
};
newInput.addEventListener("keypress", function(event){
if ([10, 13].indexOf(event.keyCode) !== -1){
addURLSetting();
}
}); });
footCell.appendChild(newInput);
let footPlus = document.createElement("span");
footPlus.classList.add("add");
footPlus.textContent = "+";
footPlus.addEventListener("click", addURLSetting);
footCell.appendChild(footPlus); footCell.appendChild(footPlus);
footRow.appendChild(footCell); footRow.appendChild(footCell);
foot.appendChild(footRow); foot.appendChild(footRow);

View File

@ -3,7 +3,7 @@ Version 0.5.6:
- -
new features: new features:
- - url specific values can be added by hitting enter in the input
fixes: fixes:
- -