Skip to content

Commit de0aaeb

Browse files
committed
Update searchJumper.user.js
1 parent d79b35f commit de0aaeb

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

searchJumper.user.js

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2743,7 +2743,7 @@
27432743
}
27442744
#search-jumper-tileInput {
27452745
display: none;
2746-
opacity: 0.3;
2746+
opacity: 0.1;
27472747
user-select: all;
27482748
background-color: #212022;
27492749
color: #adadad;
@@ -10173,6 +10173,7 @@
1017310173
}
1017410174
let host = location.host;
1017510175
let href = location.href;
10176+
let targetName;
1017610177
let customReplaceSingle = (str, key, value, after) => {
1017710178
if (str.indexOf(key + "[") !== -1) {
1017810179
let multiMatch = str.match(keyToReg(key, "", "\\[(.*?)(\\|(.+))?\\]")), valueArr;
@@ -10215,6 +10216,7 @@
1021510216
let keywordsU = "", keywordsL = "", keywordsR = "", keywordsSC = "", keywordsTC = "";
1021610217
let customReplaceKeywords = str => {
1021710218
let _str = str;
10219+
_str = customReplaceSingle(_str, "%n", targetName);
1021810220
_str = customReplaceSingle(_str, "%su", keywordsU);
1021910221
_str = customReplaceSingle(_str, "%sl", keywordsL);
1022010222
_str = customReplaceSingle(_str, "%sr", showTips ? keywordsR.replace(/\n/g, "【SearchJumperBreak】") : keywordsR);
@@ -10362,7 +10364,7 @@
1036210364
ele.dataset.url = tempUrl.replace(/%e\b/g, document.characterSet).replace(/%c\b/g, (isMobile?"mobile":"pc"));
1036310365
}
1036410366
let targetUrl = '', targetLink = '';
10365-
let targetName = inputString || document.title;
10367+
targetName = inputString || document.title;
1036610368
let imgBase64 = '', resultUrl = customVariable(ele.dataset.url);
1036710369
if (targetElement && targetElement.nodeName) {
1036810370
targetUrl = targetElement.href || (targetElement.parentNode && targetElement.parentNode.href) || '';
@@ -10615,7 +10617,7 @@
1061510617
let pairArr = pair.split("SJ^PARAM");
1061610618
if (pairArr.length === 2) {
1061710619
let k = pairArr[0];
10618-
let v = customReplaceKeywords(pairArr[1].replace(/\\([\=&])/g, "$1").replace(/%e\b/g, document.characterSet).replace(/%i\b/g, imgBase64).replace(/%c\b/g, (isMobile?"mobile":"pc")).replace(/%U\b/g, encodeURIComponent(href)).replace(/%υ\b/g, encodeURIComponent(encodeURIComponent(href))).replace(/%h\b/g, _host).replace(/%T\b/g, encodeURIComponent(targetUrl)).replace(/%τ\b/g, encodeURIComponent(encodeURIComponent(targetUrl))).replace(/%b\b/g, targetBaseUrl).replace(/%B\b/g, encodeURIComponent(targetBaseUrl)).replace(/%β\b/g, encodeURIComponent(encodeURIComponent(targetBaseUrl))).replace(/%n\b/g, targetName));
10620+
let v = customReplaceKeywords(pairArr[1].replace(/\\([\=&])/g, "$1").replace(/%e\b/g, document.characterSet).replace(/%i\b/g, imgBase64).replace(/%c\b/g, (isMobile?"mobile":"pc")).replace(/%U\b/g, encodeURIComponent(href)).replace(/%υ\b/g, encodeURIComponent(encodeURIComponent(href))).replace(/%h\b/g, _host).replace(/%T\b/g, encodeURIComponent(targetUrl)).replace(/%τ\b/g, encodeURIComponent(encodeURIComponent(targetUrl))).replace(/%b\b/g, targetBaseUrl).replace(/%B\b/g, encodeURIComponent(targetBaseUrl)).replace(/%β\b/g, encodeURIComponent(encodeURIComponent(targetBaseUrl))));
1061910621
v = customReplaceSingle(v, "%t", targetUrl);
1062010622
v = customReplaceSingle(v, "%u", href);
1062110623
postParams.push([k, v]);
@@ -10638,7 +10640,7 @@
1063810640
resultUrl = customReplaceSingle(resultUrl, "%h", _host);
1063910641
resultUrl = customReplaceSingle(resultUrl, "%t", targetUrl);
1064010642
resultUrl = customReplaceSingle(resultUrl, "%u", href);
10641-
resultUrl = customReplaceKeywords(resultUrl.replace(/%U\b/g, encodeURIComponent(href)).replace(/%υ\b/g, encodeURIComponent(encodeURIComponent(href))).replace(/%T\b/g, encodeURIComponent(targetUrl)).replace(/%τ\b/g, encodeURIComponent(encodeURIComponent(targetUrl))).replace(/%b\b/g, targetBaseUrl).replace(/%B\b/g, encodeURIComponent(targetBaseUrl)).replace(/%β\b/g, encodeURIComponent(encodeURIComponent(targetBaseUrl))).replace(/%n\b/g, targetName));
10643+
resultUrl = customReplaceKeywords(resultUrl.replace(/%U\b/g, encodeURIComponent(href)).replace(/%υ\b/g, encodeURIComponent(encodeURIComponent(href))).replace(/%T\b/g, encodeURIComponent(targetUrl)).replace(/%τ\b/g, encodeURIComponent(encodeURIComponent(targetUrl))).replace(/%b\b/g, targetBaseUrl).replace(/%B\b/g, encodeURIComponent(targetBaseUrl)).replace(/%β\b/g, encodeURIComponent(encodeURIComponent(targetBaseUrl))));
1064210644
if (openInNewTab && /^(https?|ftp):/.test(resultUrl)) {
1064310645
ele.setAttribute("target", "_blank");
1064410646
ele.dataset.target = 1;
@@ -10796,6 +10798,7 @@
1079610798
if (window.getSelection().toString()) {
1079710799
target = targetElement || ele;
1079810800
} else target = getBody(document);
10801+
self.tileInput.parentNode && self.tileInput.parentNode.removeChild(self.tileInput);
1079910802
}
1080010803
self.tipsPos(target, i18n('copyOver'));
1080110804
clearTimeout(self.hideTips);

0 commit comments

Comments
 (0)