LEFT | RIGHT |
1 var backgroundPage = chrome.extension.getBackgroundPage(); | 1 var backgroundPage = chrome.extension.getBackgroundPage(); |
2 var require = backgroundPage.require; | 2 var require = backgroundPage.require; |
3 var Prefs = require("prefs").Prefs; | 3 var Prefs = require("prefs").Prefs; |
4 var Utils = require("utils").Utils; | 4 var Utils = require("utils").Utils; |
5 | 5 var Filter = require("filterClasses").Filter; |
6 function extractBaseUrl(url) | |
7 { | |
8 return url.split("/").slice(0, 3).join("/"); | |
9 } | |
10 | 6 |
11 function openSharePopup(url) | 7 function openSharePopup(url) |
12 { | 8 { |
13 var iframe = document.getElementById("share-popup"); | 9 var iframe = document.getElementById("share-popup"); |
14 var glassPane = document.getElementById("glass-pane"); | 10 var glassPane = document.getElementById("glass-pane"); |
15 var popupMessageReceived = false; | 11 var popupMessageReceived = false; |
16 | 12 |
17 var popupMessageListener = function(event) | 13 var popupMessageListener = function(event) |
18 { | 14 { |
19 if (event.origin !== extractBaseUrl(url)) | 15 var originFilter = Filter.fromText("||adblockplus.org^"); |
| 16 if (!originFilter.matches(event.origin, "OTHER", null, null)) |
20 return; | 17 return; |
21 | 18 |
22 iframe.width = event.data.width; | 19 iframe.width = event.data.width; |
23 iframe.height = event.data.height; | 20 iframe.height = event.data.height; |
24 popupMessageReceived = true; | 21 popupMessageReceived = true; |
25 window.removeEventListener("message", popupMessageListener); | 22 window.removeEventListener("message", popupMessageListener); |
26 }; | 23 }; |
27 window.addEventListener("message", popupMessageListener, false); | 24 window.addEventListener("message", popupMessageListener, false); |
28 | 25 |
29 var popupLoadListener = function() | 26 var popupLoadListener = function() |
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
119 } | 116 } |
120 } | 117 } |
121 } | 118 } |
122 | 119 |
123 function getDocLink(page, anchor) | 120 function getDocLink(page, anchor) |
124 { | 121 { |
125 return Prefs.documentation_link | 122 return Prefs.documentation_link |
126 .replace(/%LINK%/g, page) | 123 .replace(/%LINK%/g, page) |
127 .replace(/%LANG%/g, Utils.appLocale) + (anchor ? "#" + anchor : ""
); | 124 .replace(/%LANG%/g, Utils.appLocale) + (anchor ? "#" + anchor : ""
); |
128 } | 125 } |
LEFT | RIGHT |