feat: added property new-tab to type: search

This commit is contained in:
ralphocdol
2024-06-09 21:18:56 +08:00
parent b83bf9bc09
commit 06b21e3d27
5 changed files with 11 additions and 1 deletions

View File

@@ -120,6 +120,7 @@ function setupSearchboxes() {
const inputElement = widget.getElementsByClassName("search-input")[0];
const bangElement = widget.getElementsByClassName("search-bang")[0];
const bangs = widget.querySelectorAll(".search-bangs > input");
const newTab = widget.getElementsByTagName("new-tab")[0].innerHTML === "true";
const bangsMap = {};
const kbdElement = widget.getElementsByTagName("kbd")[0];
let currentBang = null;
@@ -154,7 +155,7 @@ function setupSearchboxes() {
const url = searchUrlTemplate.replace("!QUERY!", encodeURIComponent(query));
if (event.ctrlKey) {
if (newTab && !event.ctrlKey || !newTab && event.ctrlKey) {
window.open(url, '_blank').focus();
} else {
window.location.href = url;