shawenguan 2 years ago
parent
commit
bab3142e79
1 changed files with 6 additions and 4 deletions
  1. 6 4
      Scripts/tghelper/tgLinksHelper.js

+ 6 - 4
Scripts/tghelper/tgLinksHelper.js

@@ -4,7 +4,8 @@ let htmlText = $response.body || '';
 let regex = /<div class="tgme_page_action">\s*<a class="tgme_action_button_new shine" href="([\S]+)">([^<]+)<\/a>\s*<\/div>/;
 let matches = htmlText.match(regex);
 if (matches) {
-    let isTgToNcgNotify = lk.getVal('lkTgToNcgNotify', '');
+    let tgToNcgNotifyFlag = lk.getVal('lkTgToNcgNotifyFlag', 'true');
+    tgToNcgNotifyFlag = lk.isEmpty(tgToNcgNotifyFlag) ? true : JSON.parse(tgToNcgNotifyFlag);
 
     let mContent = matches[0];
     let originalHref = matches[1];
@@ -19,12 +20,13 @@ if (matches) {
 
     rHtmlText = rHtmlText.replace(/if\s*\(true\)\s*\{/, 'if (false) {');
 
-    rHtmlText = rHtmlText.replace(/var\s*protoUrl\s*=\s*"([\S]+)"/, 'var protoUrl=null');
+    rHtmlText = rHtmlText.replace(/var\s*protoUrl\s*=\s*"([\S]+);"/, 'var protoUrl=null;');
 
     htmlText = rHtmlText;
-    console.log(htmlText);
 
-    if(!lk.isEmpty(isTgToNcgNotify)){
+    // console.log(htmlText);
+
+    if(tgToNcgNotifyFlag){
         lk.msg('', '在"Nicegram"中打开?', newHref);
     }
 }