Pārlūkot izejas kodu

Fix anchor links

simov 9 gadi atpakaļ
vecāks
revīzija
c50510f0e7
1 mainītis faili ar 5 papildinājumiem un 5 dzēšanām
  1. 5 5
      background/background.js

+ 5 - 5
background/background.js

@@ -68,21 +68,21 @@ chrome.tabs.onUpdated.addListener((id, info, tab) => {
     parallel([
       (done) => {
         chrome.tabs.executeScript(id, {
-          code: 'JSON.stringify(location)',
+          code: 'JSON.stringify({location, state: window.state})',
           runAt: 'document_start'
-        }, (location) => {
+        }, (res) => {
           if (chrome.runtime.lastError) {
             done(new Error('Origin not allowed'))
             return
           }
           try {
-            location = JSON.parse(location)
+            res = JSON.parse(res)
           }
           catch (err) {
             done(new Error('JSON parse error'))
             return
           }
-          done(null, {location})
+          done(null, res)
         })
       },
       (done) => {
@@ -95,7 +95,7 @@ chrome.tabs.onUpdated.addListener((id, info, tab) => {
       if (!res.origins[res.location.origin]) { // v2.2 -> v2.3
         return
       }
-      if (new RegExp(res.origins[res.location.origin]).test(res.location.href)) {
+      if (!res.state && new RegExp(res.origins[res.location.origin]).test(res.location.href)) {
         chrome.tabs.executeScript(id, {
           code: [
             'document.querySelector("pre").style.visibility = "hidden"',