| OLD | NEW | 
|    1 /* |    1 /* | 
|    2  * This file is part of Adblock Plus <https://adblockplus.org/>, |    2  * This file is part of Adblock Plus <https://adblockplus.org/>, | 
|    3  * Copyright (C) 2006-2015 Eyeo GmbH |    3  * Copyright (C) 2006-2015 Eyeo GmbH | 
|    4  * |    4  * | 
|    5  * Adblock Plus is free software: you can redistribute it and/or modify |    5  * Adblock Plus is free software: you can redistribute it and/or modify | 
|    6  * it under the terms of the GNU General Public License version 3 as |    6  * it under the terms of the GNU General Public License version 3 as | 
|    7  * published by the Free Software Foundation. |    7  * published by the Free Software Foundation. | 
|    8  * |    8  * | 
|    9  * Adblock Plus is distributed in the hope that it will be useful, |    9  * Adblock Plus is distributed in the hope that it will be useful, | 
|   10  * but WITHOUT ANY WARRANTY; without even the implied warranty of |   10  * but WITHOUT ANY WARRANTY; without even the implied warranty of | 
| (...skipping 453 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  464   var filterText = "@@||" + domain + "^$document"; |  464   var filterText = "@@||" + domain + "^$document"; | 
|  465   FilterStorage.addFilter(Filter.fromText(filterText)); |  465   FilterStorage.addFilter(Filter.fromText(filterText)); | 
|  466 } |  466 } | 
|  467  |  467  | 
|  468 // Adds filter text that user typed to the selection box |  468 // Adds filter text that user typed to the selection box | 
|  469 function addTypedFilter(event) |  469 function addTypedFilter(event) | 
|  470 { |  470 { | 
|  471   event.preventDefault(); |  471   event.preventDefault(); | 
|  472  |  472  | 
|  473   var element = document.getElementById("newFilter"); |  473   var element = document.getElementById("newFilter"); | 
|  474   var filter; |  474   var result = parseFilter(element.value); | 
|  475  |  475  | 
|  476   try |  476   if (result.error) | 
|  477   { |  477   { | 
|  478     filter = parseFilter(element.value); |  478     alert(result.error); | 
|  479   } |  | 
|  480   catch (error) |  | 
|  481   { |  | 
|  482     alert(error); |  | 
|  483     return; |  479     return; | 
|  484   } |  480   } | 
|  485  |  481  | 
|  486   if (filter) |  482   if (result.filter) | 
|  487     FilterStorage.addFilter(filter); |  483     FilterStorage.addFilter(result.filter); | 
|  488  |  484  | 
|  489   element.value = ""; |  485   element.value = ""; | 
|  490 } |  486 } | 
|  491  |  487  | 
|  492 // Removes currently selected whitelisted domains |  488 // Removes currently selected whitelisted domains | 
|  493 function removeSelectedExcludedDomain(event) |  489 function removeSelectedExcludedDomain(event) | 
|  494 { |  490 { | 
|  495   event.preventDefault(); |  491   event.preventDefault(); | 
|  496   var excludedDomainsBox = document.getElementById("excludedDomainsBox"); |  492   var excludedDomainsBox = document.getElementById("excludedDomainsBox"); | 
|  497   var remove = []; |  493   var remove = []; | 
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  534     for (var i = 0; i < userFiltersBox.length; i++) |  530     for (var i = 0; i < userFiltersBox.length; i++) | 
|  535       text += userFiltersBox.options[i].value + "\n"; |  531       text += userFiltersBox.options[i].value + "\n"; | 
|  536     document.getElementById("rawFiltersText").value = text; |  532     document.getElementById("rawFiltersText").value = text; | 
|  537   } |  533   } | 
|  538 } |  534 } | 
|  539  |  535  | 
|  540 // Imports filters in the raw text box |  536 // Imports filters in the raw text box | 
|  541 function importRawFiltersText() |  537 function importRawFiltersText() | 
|  542 { |  538 { | 
|  543   var text = document.getElementById("rawFiltersText").value; |  539   var text = document.getElementById("rawFiltersText").value; | 
 |  540   var result = parseFilters(text, true); | 
|  544  |  541  | 
|  545   var add; |  542   if (result.error) | 
|  546   try |  | 
|  547   { |  543   { | 
|  548     add = parseFilters(text, true); |  544     alert(result.error); | 
|  549   } |  | 
|  550   catch (error) |  | 
|  551   { |  | 
|  552     alert(error); |  | 
|  553     return; |  545     return; | 
|  554   } |  546   } | 
|  555  |  547  | 
|  556   var seenFilter = Object.create(null); |  548   var seenFilter = Object.create(null); | 
|  557   for (var i = 0; i < add.length; i++) |  549   for (var i = 0; i < result.filters.length; i++) | 
|  558   { |  550   { | 
|  559     var filter = add[i]; |  551     var filter = result.filters[i]; | 
|  560     FilterStorage.addFilter(filter); |  552     FilterStorage.addFilter(filter); | 
|  561     seenFilter[filter.text] = null; |  553     seenFilter[filter.text] = null; | 
|  562   } |  554   } | 
|  563  |  555  | 
|  564   var remove = []; |  556   var remove = []; | 
|  565   for (var i = 0; i < FilterStorage.subscriptions.length; i++) |  557   for (var i = 0; i < FilterStorage.subscriptions.length; i++) | 
|  566   { |  558   { | 
|  567     var subscription = FilterStorage.subscriptions[i]; |  559     var subscription = FilterStorage.subscriptions[i]; | 
|  568     if (!(subscription instanceof SpecialSubscription)) |  560     if (!(subscription instanceof SpecialSubscription)) | 
|  569       continue; |  561       continue; | 
| (...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  643       links[i].href = arguments[i + 1]; |  635       links[i].href = arguments[i + 1]; | 
|  644       links[i].setAttribute("target", "_blank"); |  636       links[i].setAttribute("target", "_blank"); | 
|  645     } |  637     } | 
|  646     else if (typeof arguments[i + 1] == "function") |  638     else if (typeof arguments[i + 1] == "function") | 
|  647     { |  639     { | 
|  648       links[i].href = "javascript:void(0);"; |  640       links[i].href = "javascript:void(0);"; | 
|  649       links[i].addEventListener("click", arguments[i + 1], false); |  641       links[i].addEventListener("click", arguments[i + 1], false); | 
|  650     } |  642     } | 
|  651   } |  643   } | 
|  652 } |  644 } | 
| OLD | NEW |