Skip to content

Commit de3feab

Browse files
committed
Update searchJumper.user.js
1 parent a6fbc6b commit de3feab

1 file changed

Lines changed: 12 additions & 10 deletions

File tree

SearchJumper/searchJumper.user.js

Lines changed: 12 additions & 10 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.6.54.8
7+
// @version 1.6.6.54.9
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 高效搜尋引擎輔助增强,在搜尋時一鍵切換各大搜尋引擎,支持任意頁面右鍵劃詞搜尋與全面自定義
@@ -1032,7 +1032,7 @@
10321032
} else if (typeof GM != 'undefined' && typeof GM.info != 'undefined') {
10331033
_GM_info = GM.info;
10341034
} else {
1035-
_GM_info = { script:1 };
1035+
_GM_info = { script: {} };
10361036
}
10371037
var _unsafeWindow = (typeof unsafeWindow == 'undefined') ? window : unsafeWindow;
10381038
if (_unsafeWindow.searchJumperInited) return;
@@ -2792,7 +2792,7 @@
27922792
return false;
27932793
});
27942794
wordSpan.oncontextmenu = e => {
2795-
event.preventDefault();
2795+
e.preventDefault();
27962796
};
27972797
wordSpan.addEventListener('dblclick', e => {
27982798
e.stopPropagation();
@@ -5725,6 +5725,7 @@
57255725
let ele = document.createElement("a");
57265726
ele.setAttribute("ref", "noopener noreferrer");
57275727
let name = data.name;
5728+
let urlMatch = data.match;
57285729
let pointer = !isBookmark && /^\[/.test(data.url);
57295730
if (pointer) {
57305731
ele.dataset.pointer = true;
@@ -5818,12 +5819,12 @@
58185819
}
58195820
ele.dataset.inPagePost = (data.url.indexOf("#p{") != -1) ? 't' : 'f';
58205821
let inPagePost = ele.dataset.inPagePost === 't';
5821-
if (!isBookmark && (!currentSite || data.hideNotMatch) && window.top == window.self) {
5822-
if (data.match === '0') {
5823-
ele.style.display = 'none';
5824-
ele.classList.add("notmatch");
5825-
} else if (data.match) {
5826-
if (new RegExp(data.match).test(location.href)) {
5822+
if (urlMatch === '0') {
5823+
ele.style.display = 'none';
5824+
ele.classList.add("notmatch");
5825+
} else if (!isBookmark && (!currentSite || data.hideNotMatch) && window.top == window.self) {
5826+
if (urlMatch) {
5827+
if (new RegExp(urlMatch).test(location.href)) {
58275828
ele.dataset.current = true;
58285829
}
58295830
} else if (!pointer && data.url.indexOf(location.hostname) != -1) {
@@ -8056,7 +8057,7 @@
80568057

80578058
function initConfig() {
80588059
if (isInConfigPage()) {
8059-
var sendMessageTimer, received = false;
8060+
let sendMessageTimer, received = false;
80608061
let loadConfig = () => {
80618062
sendMessageTimer = setTimeout(() => {
80628063
if (!received) {
@@ -8065,6 +8066,7 @@
80658066
}, 50);
80668067
window.postMessage({
80678068
searchData: searchData,
8069+
version: _GM_info.script.version || 0,
80688070
command: 'loadConfig'
80698071
}, '*');
80708072
}

0 commit comments

Comments
 (0)