LEFT | RIGHT |
1 /* | 1 /* |
2 * This Source Code is subject to the terms of the Mozilla Public License | 2 * This Source Code is subject to the terms of the Mozilla Public License |
3 * version 2.0 (the "License"). You can obtain a copy of the License at | 3 * version 2.0 (the "License"). You can obtain a copy of the License at |
4 * http://mozilla.org/MPL/2.0/. | 4 * http://mozilla.org/MPL/2.0/. |
5 */ | 5 */ |
6 | 6 |
7 let {Prefs} = require("prefs"); | 7 let {Prefs} = require("prefs"); |
8 | 8 |
9 let domainData; | 9 let domainData; |
10 let nodeData; | 10 let nodeData; |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
78 this.getRowProperties(row); | 78 this.getRowProperties(row); |
79 } | 79 } |
80 | 80 |
81 /********************* | 81 /********************* |
82 * General functions * | 82 * General functions * |
83 *********************/ | 83 *********************/ |
84 | 84 |
85 function init() | 85 function init() |
86 { | 86 { |
87 nodeData = window.arguments[0]; | 87 nodeData = window.arguments[0]; |
88 let domain = window.arguments[1]; | 88 let host = window.arguments[1]; |
89 | 89 |
90 // Check whether element hiding group is disabled | 90 // Check whether element hiding group is disabled |
91 let subscription = AdblockPlus.getSubscription("~eh~"); | 91 let subscription = AdblockPlus.getSubscription("~eh~"); |
92 if (subscription && subscription.disabled) | 92 if (subscription && subscription.disabled) |
93 { | 93 { |
94 let warning = document.getElementById("groupDisabledWarning"); | 94 let warning = document.getElementById("groupDisabledWarning"); |
95 if (/\?1\?/.test(warning.textContent)) | 95 if (/\?1\?/.test(warning.textContent)) |
96 warning.textContent = warning.textContent.replace(/\?1\?/g, subscription.t
itle); | 96 warning.textContent = warning.textContent.replace(/\?1\?/g, subscription.t
itle); |
97 warning.hidden = false; | 97 warning.hidden = false; |
98 } | 98 } |
(...skipping 28 matching lines...) Expand all Loading... |
127 switch (Prefs.composer_defaultDomain) | 127 switch (Prefs.composer_defaultDomain) |
128 { | 128 { |
129 case 0: | 129 case 0: |
130 selectedDomain = ""; | 130 selectedDomain = ""; |
131 break; | 131 break; |
132 case 1: | 132 case 1: |
133 try | 133 try |
134 { | 134 { |
135 // EffectiveTLDService will throw for IP addresses, just go to the next
case then | 135 // EffectiveTLDService will throw for IP addresses, just go to the next
case then |
136 let effectiveTLD = Cc["@mozilla.org/network/effective-tld-service;1"].ge
tService(Ci.nsIEffectiveTLDService); | 136 let effectiveTLD = Cc["@mozilla.org/network/effective-tld-service;1"].ge
tService(Ci.nsIEffectiveTLDService); |
137 selectedDomain = effectiveTLD.getPublicSuffixFromHost(domain); | 137 selectedDomain = effectiveTLD.getPublicSuffixFromHost(host); |
138 break; | 138 break; |
139 } catch (e) {} | 139 } catch (e) {} |
140 case 2: | 140 case 2: |
141 try | 141 try |
142 { | 142 { |
143 // EffectiveTLDService will throw for IP addresses, just go to the next
case then | 143 // EffectiveTLDService will throw for IP addresses, just go to the next
case then |
144 let effectiveTLD = Cc["@mozilla.org/network/effective-tld-service;1"].ge
tService(Ci.nsIEffectiveTLDService); | 144 let effectiveTLD = Cc["@mozilla.org/network/effective-tld-service;1"].ge
tService(Ci.nsIEffectiveTLDService); |
145 selectedDomain = effectiveTLD.getBaseDomainFromHost(domain); | 145 selectedDomain = effectiveTLD.getBaseDomainFromHost(host); |
146 break; | 146 break; |
147 } catch (e) {} | 147 } catch (e) {} |
148 case 3: | 148 case 3: |
149 selectedDomain = domain.replace(/^www\./, ""); | 149 selectedDomain = host.replace(/^www\./, ""); |
150 break; | 150 break; |
151 default: | 151 default: |
152 selectedDomain = domain; | 152 selectedDomain = host; |
153 break; | 153 break; |
154 } | 154 } |
155 domainData = {value: domain, selected: selectedDomain}; | 155 domainData = {value: host, selected: selectedDomain}; |
156 | 156 |
157 fillDomains(domainData); | 157 fillDomains(domainData); |
158 fillNodes(nodeData); | 158 fillNodes(nodeData); |
159 setAdvancedMode(document.documentElement.getAttribute("advancedMode") == "true
"); | 159 setAdvancedMode(document.documentElement.getAttribute("advancedMode") == "true
"); |
160 updateExpression(); | 160 updateExpression(); |
161 | 161 |
162 setTimeout(function() { | 162 setTimeout(function() { |
163 document.getElementById("domainGroup").selectedItem.focus(); | 163 document.getElementById("domainGroup").selectedItem.focus(); |
164 if (document.getElementById("preview").checked) | 164 if (document.getElementById("preview").checked) |
165 togglePreview(true); | 165 togglePreview(true); |
(...skipping 415 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
581 | 581 |
582 fillAttributes(item.nodeData); | 582 fillAttributes(item.nodeData); |
583 } | 583 } |
584 | 584 |
585 function addExpression() | 585 function addExpression() |
586 { | 586 { |
587 AdblockPlus.addPatterns([document.getElementById("expression").value]); | 587 AdblockPlus.addPatterns([document.getElementById("expression").value]); |
588 | 588 |
589 togglePreview(false); | 589 togglePreview(false); |
590 } | 590 } |
LEFT | RIGHT |