OLD | NEW |
1 var backgroundPage = chrome.extension.getBackgroundPage(); | 1 var backgroundPage = chrome.extension.getBackgroundPage(); |
2 var require = backgroundPage.require; | 2 var require = backgroundPage.require; |
3 | 3 |
4 with(require("filterClasses")) | 4 with(require("filterClasses")) |
5 { | 5 { |
6 this.Filter = Filter; | 6 this.Filter = Filter; |
7 this.WhitelistFilter = WhitelistFilter; | 7 this.WhitelistFilter = WhitelistFilter; |
8 } | 8 } |
9 with(require("subscriptionClasses")) | 9 with(require("subscriptionClasses")) |
10 { | 10 { |
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
143 { | 143 { |
144 var selectedIndex = 0; | 144 var selectedIndex = 0; |
145 var selectedPrefix = null; | 145 var selectedPrefix = null; |
146 var matchCount = 0; | 146 var matchCount = 0; |
147 | 147 |
148 var list = document.getElementById("subscriptionSelector"); | 148 var list = document.getElementById("subscriptionSelector"); |
149 var elements = request.responseXML.documentElement.getElementsByTagName("sub
scription"); | 149 var elements = request.responseXML.documentElement.getElementsByTagName("sub
scription"); |
150 for (var i = 0; i < elements.length; i++) | 150 for (var i = 0; i < elements.length; i++) |
151 { | 151 { |
152 var element = elements[i]; | 152 var element = elements[i]; |
153 var option = document.createElement("option"); | 153 var option = new Option(); |
154 option.text = element.getAttribute("title") + " (" + element.getAttribute(
"specialization") + ")"; | 154 option.text = element.getAttribute("title") + " (" + element.getAttribute(
"specialization") + ")"; |
155 option._data = { | 155 option._data = { |
156 title: element.getAttribute("title"), | 156 title: element.getAttribute("title"), |
157 url: element.getAttribute("url"), | 157 url: element.getAttribute("url"), |
158 homepage: element.getAttribute("homepage") | 158 homepage: element.getAttribute("homepage") |
159 }; | 159 }; |
160 | 160 |
161 var prefix = require("utils").Utils.checkLocalePrefixMatch(element.getAttr
ibute("prefixes")); | 161 var prefix = require("utils").Utils.checkLocalePrefixMatch(element.getAttr
ibute("prefixes")); |
162 if (prefix) | 162 if (prefix) |
163 { | 163 { |
(...skipping 17 matching lines...) Expand all Loading... |
181 if (Math.random() * matchCount < 1) | 181 if (Math.random() * matchCount < 1) |
182 { | 182 { |
183 selectedIndex = i; | 183 selectedIndex = i; |
184 selectedPrefix = prefix; | 184 selectedPrefix = prefix; |
185 } | 185 } |
186 } | 186 } |
187 } | 187 } |
188 list.appendChild(option); | 188 list.appendChild(option); |
189 } | 189 } |
190 | 190 |
191 var option = document.createElement("option"); | 191 var option = new Option(); |
192 option.text = i18n.getMessage("filters_addSubscriptionOther_label") + "\u202
6"; | 192 option.text = i18n.getMessage("filters_addSubscriptionOther_label") + "\u202
6"; |
193 option._data = null; | 193 option._data = null; |
194 list.appendChild(option); | 194 list.appendChild(option); |
195 | 195 |
196 list.selectedIndex = selectedIndex; | 196 list.selectedIndex = selectedIndex; |
197 | 197 |
198 if (delayedSubscriptionSelection) | 198 if (delayedSubscriptionSelection) |
199 startSubscriptionSelection.apply(null, delayedSubscriptionSelection); | 199 startSubscriptionSelection.apply(null, delayedSubscriptionSelection); |
200 }; | 200 }; |
201 request.send(null); | 201 request.send(null); |
(...skipping 210 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
412 // Populates a list box with a number of entries | 412 // Populates a list box with a number of entries |
413 function populateList(id, entries) | 413 function populateList(id, entries) |
414 { | 414 { |
415 var list = document.getElementById(id); | 415 var list = document.getElementById(id); |
416 while (list.lastChild) | 416 while (list.lastChild) |
417 list.removeChild(list.lastChild); | 417 list.removeChild(list.lastChild); |
418 | 418 |
419 entries.sort(); | 419 entries.sort(); |
420 for (var i = 0; i < entries.length; i++) | 420 for (var i = 0; i < entries.length; i++) |
421 { | 421 { |
422 var option = document.createElement("option"); | 422 var option = new Option(); |
423 option.text = entries[i]; | 423 option.text = entries[i]; |
424 option.value = entries[i]; | 424 option.value = entries[i]; |
425 list.appendChild(option); | 425 list.appendChild(option); |
426 } | 426 } |
427 } | 427 } |
428 | 428 |
429 // Add a filter string to the list box. | 429 // Add a filter string to the list box. |
430 function appendToListBox(boxId, text) | 430 function appendToListBox(boxId, text) |
431 { | 431 { |
432 var elt = document.createElement("option"); | 432 var elt = new Option(); |
433 elt.text = text; | 433 elt.text = text; |
434 elt.value = text; | 434 elt.value = text; |
435 document.getElementById(boxId).appendChild(elt); | 435 document.getElementById(boxId).appendChild(elt); |
436 } | 436 } |
437 | 437 |
438 // Remove a filter string from a list box. | 438 // Remove a filter string from a list box. |
439 function removeFromListBox(boxId, text) | 439 function removeFromListBox(boxId, text) |
440 { | 440 { |
441 var elt = document.createElement("option"); | |
442 elt.text = text; | |
443 elt.value = text; | |
444 var list = document.getElementById(boxId); | 441 var list = document.getElementById(boxId); |
445 for (var i = 0; i < list.length; i++) | 442 for (var i = 0; i < list.length; i++) |
446 if (list.options[i].value == text) | 443 if (list.options[i].value == text) |
447 list.remove(i--); | 444 list.remove(i--); |
448 } | 445 } |
449 | 446 |
450 function addWhitelistDomain(event) | 447 function addWhitelistDomain(event) |
451 { | 448 { |
452 event.preventDefault(); | 449 event.preventDefault(); |
453 | 450 |
(...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
596 if (subscription.disabled == !enabled.checked) | 593 if (subscription.disabled == !enabled.checked) |
597 return; | 594 return; |
598 | 595 |
599 subscription.disabled = !enabled.checked; | 596 subscription.disabled = !enabled.checked; |
600 }, false); | 597 }, false); |
601 | 598 |
602 updateSubscriptionInfo(element); | 599 updateSubscriptionInfo(element); |
603 | 600 |
604 document.getElementById("filterLists").appendChild(element); | 601 document.getElementById("filterLists").appendChild(element); |
605 } | 602 } |
OLD | NEW |