| Left: | ||
| Right: |
| LEFT | RIGHT |
|---|---|
| 1 importAll("filterClasses", this); | 1 importAll("filterClasses", this); |
| 2 importAll("subscriptionClasses", this); | 2 importAll("subscriptionClasses", this); |
| 3 importAll("filterStorage", this); | 3 importAll("filterStorage", this); |
| 4 importAll("elemHide", this); | 4 importAll("elemHide", this); |
| 5 importAll("filterListener", this); | 5 importAll("filterListener", this); |
| 6 importAll("filterNotifier", this); | 6 importAll("filterNotifier", this); |
| 7 importAll("matcher", this); | 7 importAll("matcher", this); |
| 8 importAll("synchronizer", this); | 8 importAll("synchronizer", this); |
| 9 | 9 |
| 10 // Some types cannot be distinguished | 10 // Some types cannot be distinguished |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 44 delete localStorage.specialCaseYouTube; | 44 delete localStorage.specialCaseYouTube; |
| 45 if ("experimental" in localStorage) | 45 if ("experimental" in localStorage) |
| 46 delete localStorage.experimental; | 46 delete localStorage.experimental; |
| 47 } | 47 } |
| 48 | 48 |
| 49 // Upgrade options before we do anything else. | 49 // Upgrade options before we do anything else. |
| 50 setDefaultOptions(); | 50 setDefaultOptions(); |
| 51 | 51 |
| 52 /** | 52 /** |
| 53 * Checks whether a page is whitelisted. | 53 * Checks whether a page is whitelisted. |
| 54 * @param url {String} | 54 * @param {String} url |
| 55 * @param {String} [type] content type to be checked, default is "DOCUMENT" | |
| 55 * @return {Filter} filter that matched the URL or null if not whitelisted | 56 * @return {Filter} filter that matched the URL or null if not whitelisted |
| 56 */ | 57 */ |
| 57 function isWhitelisted(url, type) | 58 function isWhitelisted(url, type) |
|
Felix Dahlke
2012/09/18 13:23:14
The new type parameter isn't documented above.
| |
| 58 { | 59 { |
| 59 // Ignore fragment identifier | 60 // Ignore fragment identifier |
| 60 var index = url.indexOf("#"); | 61 var index = url.indexOf("#"); |
| 61 if (index >= 0) | 62 if (index >= 0) |
| 62 url = url.substring(0, index); | 63 url = url.substring(0, index); |
| 63 | 64 |
| 64 var result = defaultMatcher.matchesAny(url, type || "DOCUMENT", extractHostFro mURL(url), false); | 65 var result = defaultMatcher.matchesAny(url, type || "DOCUMENT", extractHostFro mURL(url), false); |
| 65 return (result instanceof WhitelistFilter ? result : null); | 66 return (result instanceof WhitelistFilter ? result : null); |
| 66 } | 67 } |
| 67 | 68 |
| (...skipping 288 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 356 case "get-settings": | 357 case "get-settings": |
| 357 var hostDomain = null; | 358 var hostDomain = null; |
| 358 var selectors = null; | 359 var selectors = null; |
| 359 | 360 |
| 360 // HACK: We don't know which frame sent us the message, try to find it | 361 // HACK: We don't know which frame sent us the message, try to find it |
| 361 // in webRequest's frame data. | 362 // in webRequest's frame data. |
| 362 var tabId = -1; | 363 var tabId = -1; |
| 363 var frameId = -1; | 364 var frameId = -1; |
| 364 if (sender.tab) | 365 if (sender.tab) |
| 365 { | 366 { |
| 366 var tabId = sender.tab.id; | 367 tabId = sender.tab.id; |
|
Felix Dahlke
2012/09/18 13:23:14
You're redeclaring tabId here.
| |
| 367 if (tabId in frames) | 368 if (tabId in frames) |
|
Felix Dahlke
2012/09/18 13:23:14
I don't think this statement is necessary here. Th
Wladimir Palant
2012/09/18 15:12:11
Yes, I don't usually rely on this and generally av
| |
| 368 { | 369 { |
| 369 for (var f in frames[tabId]) | 370 for (var f in frames[tabId]) |
| 370 { | 371 { |
| 371 if (getFrameUrl(tabId, f) == request.frameUrl) | 372 if (getFrameUrl(tabId, f) == request.frameUrl) |
| 372 { | 373 { |
| 373 frameId = f; | 374 frameId = f; |
| 374 break; | 375 break; |
| 375 } | 376 } |
| 376 } | 377 } |
| 377 } | 378 } |
| (...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 486 refreshIconAndContextMenu(windows[i].tabs[j]); | 487 refreshIconAndContextMenu(windows[i].tabs[j]); |
| 487 }); | 488 }); |
| 488 | 489 |
| 489 // Update icon if a tab changes location | 490 // Update icon if a tab changes location |
| 490 chrome.tabs.onUpdated.addListener(function(tabId, changeInfo, tab) | 491 chrome.tabs.onUpdated.addListener(function(tabId, changeInfo, tab) |
| 491 { | 492 { |
| 492 chrome.tabs.sendRequest(tabId, {reqtype: "clickhide-deactivate"}) | 493 chrome.tabs.sendRequest(tabId, {reqtype: "clickhide-deactivate"}) |
| 493 if(changeInfo.status == "loading") | 494 if(changeInfo.status == "loading") |
| 494 refreshIconAndContextMenu(tab); | 495 refreshIconAndContextMenu(tab); |
| 495 }); | 496 }); |
| LEFT | RIGHT |