|
4 | 4 | // @name:zh-TW 搜尋醬 |
5 | 5 | // @name:ja 検索ちゃん - SearchJumper |
6 | 6 | // @namespace hoothin |
7 | | -// @version 1.6.6.54.8 |
| 7 | +// @version 1.6.6.54.9 |
8 | 8 | // @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. |
9 | 9 | // @description:zh-CN 高效搜索引擎辅助增强,在搜索时一键切换各大搜索引擎,支持任意页面右键划词搜索与全面自定义 |
10 | 10 | // @description:zh-TW 高效搜尋引擎輔助增强,在搜尋時一鍵切換各大搜尋引擎,支持任意頁面右鍵劃詞搜尋與全面自定義 |
|
1032 | 1032 | } else if (typeof GM != 'undefined' && typeof GM.info != 'undefined') { |
1033 | 1033 | _GM_info = GM.info; |
1034 | 1034 | } else { |
1035 | | - _GM_info = { script:1 }; |
| 1035 | + _GM_info = { script: {} }; |
1036 | 1036 | } |
1037 | 1037 | var _unsafeWindow = (typeof unsafeWindow == 'undefined') ? window : unsafeWindow; |
1038 | 1038 | if (_unsafeWindow.searchJumperInited) return; |
|
2792 | 2792 | return false; |
2793 | 2793 | }); |
2794 | 2794 | wordSpan.oncontextmenu = e => { |
2795 | | - event.preventDefault(); |
| 2795 | + e.preventDefault(); |
2796 | 2796 | }; |
2797 | 2797 | wordSpan.addEventListener('dblclick', e => { |
2798 | 2798 | e.stopPropagation(); |
|
5725 | 5725 | let ele = document.createElement("a"); |
5726 | 5726 | ele.setAttribute("ref", "noopener noreferrer"); |
5727 | 5727 | let name = data.name; |
| 5728 | + let urlMatch = data.match; |
5728 | 5729 | let pointer = !isBookmark && /^\[/.test(data.url); |
5729 | 5730 | if (pointer) { |
5730 | 5731 | ele.dataset.pointer = true; |
|
5818 | 5819 | } |
5819 | 5820 | ele.dataset.inPagePost = (data.url.indexOf("#p{") != -1) ? 't' : 'f'; |
5820 | 5821 | 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)) { |
5827 | 5828 | ele.dataset.current = true; |
5828 | 5829 | } |
5829 | 5830 | } else if (!pointer && data.url.indexOf(location.hostname) != -1) { |
|
8056 | 8057 |
|
8057 | 8058 | function initConfig() { |
8058 | 8059 | if (isInConfigPage()) { |
8059 | | - var sendMessageTimer, received = false; |
| 8060 | + let sendMessageTimer, received = false; |
8060 | 8061 | let loadConfig = () => { |
8061 | 8062 | sendMessageTimer = setTimeout(() => { |
8062 | 8063 | if (!received) { |
|
8065 | 8066 | }, 50); |
8066 | 8067 | window.postMessage({ |
8067 | 8068 | searchData: searchData, |
| 8069 | + version: _GM_info.script.version || 0, |
8068 | 8070 | command: 'loadConfig' |
8069 | 8071 | }, '*'); |
8070 | 8072 | } |
|
0 commit comments