Skip to content

Commit d08e17c

Browse files
committed
Update searchJumper.user.js
1 parent fb608e0 commit d08e17c

1 file changed

Lines changed: 15 additions & 9 deletions

File tree

SearchJumper/searchJumper.user.js

Lines changed: 15 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
// @name:zh-TW 搜尋醬
55
// @name:ja 検索ちゃん - SearchJumper
66
// @namespace hoothin
7-
// @version 1.6.23.88.64
7+
// @version 1.6.24.88.64
88
// @description Assistant for switching search engines. Jump to any search engine quickly, can also search anything (selected text / image / link) on any engine with a simple right click or a variety of menus and shortcuts.
99
// @description:zh-CN 高效搜索引擎辅助增强,在搜索时一键切换各大搜索引擎,支持任意页面右键划词搜索与全面自定义
1010
// @description:zh-TW 高效搜尋引擎輔助增强,在搜尋時一鍵切換各大搜尋引擎,支持任意頁面右鍵劃詞搜尋與全面自定義
@@ -4504,15 +4504,15 @@
45044504
}
45054505
}
45064506

4507-
async searchBySiteName(siteName, e) {
4507+
async searchBySiteName(siteName, e, selfTab) {
45084508
for (let [siteBtn, siteData] of this.allSiteBtns) {
45094509
if (siteBtn.dataset.name == siteName) {
45104510
await this.siteSetUrl(siteBtn, {altKey: e.altKey, ctrlKey: e.ctrlKey, shiftKey: e.shiftKey, metaKey: e.metaKey});
45114511
let isPage = /^(https?|ftp):/.test(siteBtn.href);
45124512
if (isPage) {
4513-
siteBtn.setAttribute("target", "_blank");
4513+
siteBtn.setAttribute("target", selfTab ? "_self" : "_blank");
45144514
}
4515-
if (!isPage) {
4515+
if (!isPage || selfTab) {
45164516
siteBtn.click();
45174517
} else {
45184518
_GM_openInTab(siteBtn.href, {active: true});
@@ -4782,12 +4782,12 @@
47824782
//Search in page
47834783

47844784
let expandTypeHandler = e => {
4785-
let typeEle = this.searchJumperExpand.parentNode;
4785+
let typeEle = self.searchJumperExpand.parentNode;
47864786
if (!typeEle || !typeEle.classList.contains('not-expand')) return;
47874787
typeEle.classList.remove('not-expand');
4788-
let leftRight = this.con.classList.contains("search-jumper-left") ||
4789-
this.con.classList.contains("search-jumper-right");
4790-
typeEle.removeChild(this.searchJumperExpand);
4788+
let leftRight = self.con.classList.contains("search-jumper-left") ||
4789+
self.con.classList.contains("search-jumper-right");
4790+
typeEle.removeChild(self.searchJumperExpand);
47914791
let scrollSize = Math.max(typeEle.scrollWidth, typeEle.scrollHeight) + 5 + "px";
47924792
if (leftRight) {
47934793
typeEle.style.height = scrollSize;
@@ -4796,7 +4796,9 @@
47964796
typeEle.style.width = scrollSize;
47974797
typeEle.style.height = "";
47984798
}
4799+
self.bar.style.pointerEvents = "none";
47994800
setTimeout(() => {
4801+
self.bar.style.pointerEvents = "";
48004802
self.checkScroll();
48014803
}, 251);
48024804
}, showTimer;
@@ -11386,7 +11388,11 @@
1138611388
try {
1138711389
hash = decodeURIComponent(hash);
1138811390
} catch (e) {}
11389-
searchBar.searchJumperInputKeyWords.value = hash;
11391+
hash = hash.replace(/\\&/g, "◎SJ").split("&");
11392+
searchBar.searchJumperInputKeyWords.value = hash[0].replace(/◎SJ/g, "&");
11393+
if (hash.length >= 2 && searchBar.searchJumperInputKeyWords.value) {
11394+
searchBar.searchBySiteName(hash[1].replace(/◎SJ/g, "&"), {}, !!hash[2]);
11395+
}
1139011396
}
1139111397
getBody(document).style.cssText = `
1139211398
zoom: 1;

0 commit comments

Comments
 (0)