mirror of
https://github.com/kkapsner/CanvasBlocker
synced 2025-01-30 23:38:47 +01:00
Switched from prompt() to inputs.
This commit is contained in:
parent
9e27dedb4b
commit
74863d3c98
@ -94,6 +94,14 @@ input[type=""], input[type="text"], input[type="number"], select {
|
||||
}
|
||||
.urlValues table .reset, .urlValues table .add, .urlValues table .url {
|
||||
cursor: pointer;
|
||||
margin: 0 0.2em;
|
||||
}
|
||||
.urlValues table .url {
|
||||
min-width: 4em;
|
||||
}
|
||||
.urlValues table .urlInput {
|
||||
padding: 1px;
|
||||
margin: -1px;
|
||||
}
|
||||
.urlValues .collapser {
|
||||
position: absolute;
|
||||
|
@ -148,13 +148,17 @@
|
||||
let footRow = document.createElement("tr");
|
||||
let footCell = document.createElement("td");
|
||||
footCell.colSpan = 3;
|
||||
let newInput = document.createElement("input");
|
||||
newInput.title = browser.i18n.getMessage("inputURL");
|
||||
footCell.appendChild(newInput);
|
||||
let footPlus = document.createElement("span");
|
||||
footPlus.classList.add("add");
|
||||
footPlus.textContent = "+";
|
||||
footPlus.addEventListener("click", function(){
|
||||
var url = prompt(browser.i18n.getMessage("inputURL")).trim();
|
||||
var url = newInput.value.trim();
|
||||
if (url){
|
||||
setting.set(setting.get(url), url);
|
||||
newInput.value = "";
|
||||
}
|
||||
});
|
||||
footCell.appendChild(footPlus);
|
||||
@ -170,11 +174,24 @@
|
||||
let urlCell = document.createElement("td");
|
||||
urlCell.classList.add("url");
|
||||
urlCell.addEventListener("click", function(){
|
||||
var url = prompt(browser.i18n.getMessage("inputURL"), entry.url).trim();
|
||||
if (url){
|
||||
entry.url = url;
|
||||
setting.urlContainer.refresh();
|
||||
}
|
||||
var input = document.createElement("input");
|
||||
input.classList.add("urlInput");
|
||||
input.style.width = urlCell.clientWidth + "px";
|
||||
input.style.height = urlCell.clientHeight + "px";
|
||||
urlCell.innerHTML = "";
|
||||
urlCell.appendChild(input);
|
||||
input.title = browser.i18n.getMessage("inputURL");
|
||||
input.value = entry.url;
|
||||
input.focus();
|
||||
input.addEventListener("blur", function(){
|
||||
var url = input.value.trim();
|
||||
if (url){
|
||||
entry.url = url;
|
||||
setting.urlContainer.refresh();
|
||||
}
|
||||
urlCell.removeChild(input);
|
||||
urlCell.textContent = entry.url;
|
||||
});
|
||||
});
|
||||
urlCell.textContent = entry.url;
|
||||
row.appendChild(urlCell);
|
||||
|
Loading…
x
Reference in New Issue
Block a user