Browse Source

Fixed regexp

Brendan Abolivier 8 years ago
parent
commit
7b7cf782e3
2 changed files with 5 additions and 5 deletions
  1. 3
    4
      eventPage.js
  2. 2
    1
      popup.js

+ 3
- 4
eventPage.js View File

1
-sites_url = "sites.json"
1
+sites_url = "https://raw.githubusercontent.com/babolivier/collateral-freedom/master/sites.json"
2
 sites = {}
2
 sites = {}
3
 
3
 
4
 function getSitesAndMirrors() {
4
 function getSitesAndMirrors() {
5
-    $.getJSON("http://host.brendanabolivier.com/files/56bf24564ab24.json")
6
-                    .done(function(data) { chrome.storage.local.set({"sites": data}) })
5
+    $.getJSON(sites_url).done(function(data) { chrome.storage.local.set({"sites": data}) })
7
 }
6
 }
8
 
7
 
9
 function getCurrentTabUrl(callback) {
8
 function getCurrentTabUrl(callback) {
49
     getCurrentTabUrl(function(url) {
48
     getCurrentTabUrl(function(url) {
50
         chrome.storage.local.get("sites", function(sites){
49
         chrome.storage.local.get("sites", function(sites){
51
             sites = sites.sites
50
             sites = sites.sites
52
-            if(url.match(/:\/\/(.+)\//)[1] in sites) {
51
+            if(url.match(/:\/\/([^\/]+)\//)[1] in sites) {
53
                 chrome.browserAction.setIcon({path: 'icon-red.png'})
52
                 chrome.browserAction.setIcon({path: 'icon-red.png'})
54
             }
53
             }
55
             else {
54
             else {

+ 2
- 1
popup.js View File

31
 getCurrentTabUrl(function(url) {
31
 getCurrentTabUrl(function(url) {
32
     chrome.storage.local.get("sites", function(sites){
32
     chrome.storage.local.get("sites", function(sites){
33
         sites = sites.sites
33
         sites = sites.sites
34
-        domain = url.match(/:\/\/(.+)\//)[1]
34
+        domain = url.match(/:\/\/([^\/]+)\//)[1]
35
+        console.log(domain)
35
         if(domain in sites) {
36
         if(domain in sites) {
36
             proxies = sites[url.match(/:\/\/(.+)\//)[1]]
37
             proxies = sites[url.match(/:\/\/(.+)\//)[1]]
37
             $("#mirror").css("display", "block")
38
             $("#mirror").css("display", "block")