mirror of
https://github.com/kkapsner/CanvasBlocker
synced 2025-01-03 10:31:54 +01:00
parent
f5699a1bf3
commit
eff86ce4ed
@ -47,3 +47,9 @@ div {
|
||||
mask-size: 100%;
|
||||
display: inline-block;
|
||||
}
|
||||
|
||||
.search {
|
||||
box-sizing: border-box;
|
||||
padding-left: calc(0.5em + 19px + 0.25em);
|
||||
cursor: initial;
|
||||
}
|
@ -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)
|
||||
));
|
||||
}
|
||||
});
|
||||
});
|
||||
}());
|
@ -148,7 +148,7 @@
|
||||
!browser.pageAction.openPopup
|
||||
){
|
||||
browser.tabs.create({
|
||||
url: browser.extension.getURL("options/options.html?" + reason)
|
||||
url: browser.extension.getURL("options/options.html?notice=" + reason)
|
||||
});
|
||||
}
|
||||
}
|
||||
|
@ -57,13 +57,16 @@
|
||||
window.setTimeout(() => node.focus(), 1);
|
||||
let lastResults = [];
|
||||
node.addEventListener("input", function(){
|
||||
this.search();
|
||||
});
|
||||
node.search = function(){
|
||||
const search = this.value;
|
||||
const results = search? scope.search(search): [];
|
||||
searchListeners.forEach(function(callback){
|
||||
callback({search, results, lastResults});
|
||||
});
|
||||
lastResults = results;
|
||||
});
|
||||
};
|
||||
return node;
|
||||
};
|
||||
scope.on = function(callback){
|
||||
|
@ -12,6 +12,7 @@
|
||||
const settingsDisplay = require("./settingsDisplay");
|
||||
const search = require("./search");
|
||||
const settingStrings = require("./settingStrings");
|
||||
const searchParameters = new URLSearchParams(window.location.search);
|
||||
|
||||
var callbacks = {
|
||||
showReleaseNotes: function(){
|
||||
@ -118,8 +119,8 @@
|
||||
introduction.textContent = browser.i18n.getMessage("optionsIntroduction");
|
||||
head.appendChild(introduction);
|
||||
|
||||
if (window.location.search){
|
||||
let noticeName = window.location.search.substr(1).trim() + "Notice";
|
||||
if (searchParameters.has("notice")){
|
||||
let noticeName = searchParameters.get("notice") + "Notice";
|
||||
let notice = browser.i18n.getMessage(noticeName);
|
||||
if (notice){
|
||||
let bookmarkingNotice = document.createElement("div");
|
||||
@ -174,16 +175,20 @@
|
||||
document.body.appendChild(table);
|
||||
|
||||
const displayHidden = settings.getDefinition(settingsDisplay.displayHidden);
|
||||
const searchInput = search.init();
|
||||
table.appendChild(
|
||||
optionsGui.createThead(
|
||||
displayHidden,
|
||||
search.init()
|
||||
searchInput
|
||||
)
|
||||
);
|
||||
const searchOnly = window.location.search === "?searchOnly";
|
||||
const searchOnly = searchParameters.has("searchOnly");
|
||||
if (searchOnly){
|
||||
document.body.classList.add("searching");
|
||||
}
|
||||
if (searchParameters.has("search")){
|
||||
searchInput.value = searchParameters.get("search");
|
||||
}
|
||||
search.on(function({search, results, lastResults}){
|
||||
lastResults.forEach(function(node){
|
||||
node.classList.remove("found");
|
||||
@ -412,4 +417,6 @@
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
searchInput.search();
|
||||
}());
|
||||
|
@ -4,6 +4,7 @@ Version 0.5.5:
|
||||
|
||||
new features:
|
||||
- added settings sanitation page
|
||||
- added search field to browser action popup
|
||||
|
||||
fixes:
|
||||
- Google images did not work for some users
|
||||
|
Loading…
x
Reference in New Issue
Block a user