1
0
Fork 0
mirror of https://github.com/kkapsner/CanvasBlocker synced 2025-07-04 12:36:37 +02:00

Added search field to browser page popup

Fixes #268
This commit is contained in:
kkapsner 2018-10-09 12:59:53 +02:00
parent f5699a1bf3
commit eff86ce4ed
6 changed files with 40 additions and 7 deletions

View file

@ -46,4 +46,10 @@ div {
background-color: currentColor;
mask-size: 100%;
display: inline-block;
}
.search {
box-sizing: border-box;
padding-left: calc(0.5em + 19px + 0.25em);
cursor: initial;
}

View file

@ -79,5 +79,21 @@
actionButton.addEventListener("click", action.action);
actions.appendChild(actionButton);
});
var search = document.createElement("input");
search.placeholder = browser.i18n.getMessage("search");
search.className = "search action";
actions.appendChild(search);
search.focus();
search.addEventListener("keyup", function(event){
if ([10, 13].indexOf(event.keyCode) !== -1){
window.open(browser.extension.getURL(
"options/options.html" +
"?search=" +
encodeURIComponent(this.value)
));
}
});
});
}());