|
4 | 4 | // @name:zh-TW 搜尋醬 |
5 | 5 | // @name:ja 検索ちゃん - SearchJumper |
6 | 6 | // @namespace hoothin |
7 | | -// @version 1.6.23.88.64 |
| 7 | +// @version 1.6.24.88.64 |
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 高效搜尋引擎輔助增强,在搜尋時一鍵切換各大搜尋引擎,支持任意頁面右鍵劃詞搜尋與全面自定義 |
|
4504 | 4504 | } |
4505 | 4505 | } |
4506 | 4506 |
|
4507 | | - async searchBySiteName(siteName, e) { |
| 4507 | + async searchBySiteName(siteName, e, selfTab) { |
4508 | 4508 | for (let [siteBtn, siteData] of this.allSiteBtns) { |
4509 | 4509 | if (siteBtn.dataset.name == siteName) { |
4510 | 4510 | await this.siteSetUrl(siteBtn, {altKey: e.altKey, ctrlKey: e.ctrlKey, shiftKey: e.shiftKey, metaKey: e.metaKey}); |
4511 | 4511 | let isPage = /^(https?|ftp):/.test(siteBtn.href); |
4512 | 4512 | if (isPage) { |
4513 | | - siteBtn.setAttribute("target", "_blank"); |
| 4513 | + siteBtn.setAttribute("target", selfTab ? "_self" : "_blank"); |
4514 | 4514 | } |
4515 | | - if (!isPage) { |
| 4515 | + if (!isPage || selfTab) { |
4516 | 4516 | siteBtn.click(); |
4517 | 4517 | } else { |
4518 | 4518 | _GM_openInTab(siteBtn.href, {active: true}); |
|
4782 | 4782 | //Search in page |
4783 | 4783 |
|
4784 | 4784 | let expandTypeHandler = e => { |
4785 | | - let typeEle = this.searchJumperExpand.parentNode; |
| 4785 | + let typeEle = self.searchJumperExpand.parentNode; |
4786 | 4786 | if (!typeEle || !typeEle.classList.contains('not-expand')) return; |
4787 | 4787 | 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); |
4791 | 4791 | let scrollSize = Math.max(typeEle.scrollWidth, typeEle.scrollHeight) + 5 + "px"; |
4792 | 4792 | if (leftRight) { |
4793 | 4793 | typeEle.style.height = scrollSize; |
|
4796 | 4796 | typeEle.style.width = scrollSize; |
4797 | 4797 | typeEle.style.height = ""; |
4798 | 4798 | } |
| 4799 | + self.bar.style.pointerEvents = "none"; |
4799 | 4800 | setTimeout(() => { |
| 4801 | + self.bar.style.pointerEvents = ""; |
4800 | 4802 | self.checkScroll(); |
4801 | 4803 | }, 251); |
4802 | 4804 | }, showTimer; |
|
11386 | 11388 | try { |
11387 | 11389 | hash = decodeURIComponent(hash); |
11388 | 11390 | } 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 | + } |
11390 | 11396 | } |
11391 | 11397 | getBody(document).style.cssText = ` |
11392 | 11398 | zoom: 1; |
|
0 commit comments