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-2017 eyeo GmbH | 3 * Copyright (C) 2006-2017 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 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
63 const removeSubscription = wrapper({type: "subscriptions.remove"}, "url"); | 63 const removeSubscription = wrapper({type: "subscriptions.remove"}, "url"); |
64 const addSubscription = wrapper({type: "subscriptions.add"}, | 64 const addSubscription = wrapper({type: "subscriptions.add"}, |
65 "url", "title", "homepage"); | 65 "url", "title", "homepage"); |
66 const toggleSubscription = wrapper({type: "subscriptions.toggle"}, | 66 const toggleSubscription = wrapper({type: "subscriptions.toggle"}, |
67 "url", "keepInstalled"); | 67 "url", "keepInstalled"); |
68 const updateSubscription = wrapper({type: "subscriptions.update"}, "url"); | 68 const updateSubscription = wrapper({type: "subscriptions.update"}, "url"); |
69 const importRawFilters = wrapper({type: "filters.importRaw"}, | 69 const importRawFilters = wrapper({type: "filters.importRaw"}, |
70 "text", "removeExisting"); | 70 "text", "removeExisting"); |
71 const addFilter = wrapper({type: "filters.add"}, "text"); | 71 const addFilter = wrapper({type: "filters.add"}, "text"); |
72 const removeFilter = wrapper({type: "filters.remove"}, "text"); | 72 const removeFilter = wrapper({type: "filters.remove"}, "text"); |
| 73 const quoteCSS = wrapper({type: "composer.quoteCSS"}, "CSS"); |
73 | 74 |
74 const whitelistedDomainRegexp = /^@@\|\|([^/:]+)\^\$document$/; | 75 const whitelistedDomainRegexp = /^@@\|\|([^/:]+)\^\$document$/; |
75 const statusMessages = new Map([ | 76 const statusMessages = new Map([ |
76 ["synchronize_invalid_url", | 77 ["synchronize_invalid_url", |
77 "filters_subscription_lastDownload_invalidURL"], | 78 "filters_subscription_lastDownload_invalidURL"], |
78 ["synchronize_connection_error", | 79 ["synchronize_connection_error", |
79 "filters_subscription_lastDownload_connectionError"], | 80 "filters_subscription_lastDownload_connectionError"], |
80 ["synchronize_invalid_data", | 81 ["synchronize_invalid_data", |
81 "filters_subscription_lastDownload_invalidData"], | 82 "filters_subscription_lastDownload_invalidData"], |
82 ["synchronize_checksum_mismatch", | 83 ["synchronize_checksum_mismatch", |
(...skipping 439 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
522 let elt = new Option(); | 523 let elt = new Option(); |
523 elt.text = text; | 524 elt.text = text; |
524 elt.value = text; | 525 elt.value = text; |
525 document.getElementById(boxId).appendChild(elt); | 526 document.getElementById(boxId).appendChild(elt); |
526 } | 527 } |
527 | 528 |
528 // Remove a filter string from a list box. | 529 // Remove a filter string from a list box. |
529 function removeFromListBox(boxId, text) | 530 function removeFromListBox(boxId, text) |
530 { | 531 { |
531 let list = document.getElementById(boxId); | 532 let list = document.getElementById(boxId); |
532 let selector = "option[value=" + CSS.escape(text) + "]"; | 533 // Edge does not support CSS.escape yet: |
533 for (let option of list.querySelectorAll(selector)) | 534 // https://developer.microsoft.com/en-us/microsoft-edge/platform/issues/101410
/ |
534 list.removeChild(option); | 535 quoteCSS(text, escapedCSS => |
| 536 { |
| 537 let selector = "option[value=" + escapedCSS + "]"; |
| 538 for (let option of list.querySelectorAll(selector)) |
| 539 list.removeChild(option); |
| 540 }); |
535 } | 541 } |
536 | 542 |
537 function addWhitelistDomain(event) | 543 function addWhitelistDomain(event) |
538 { | 544 { |
539 event.preventDefault(); | 545 event.preventDefault(); |
540 | 546 |
541 let domain = document.getElementById( | 547 let domain = document.getElementById( |
542 "newWhitelistDomain" | 548 "newWhitelistDomain" |
543 ).value.replace(/\s/g, ""); | 549 ).value.replace(/\s/g, ""); |
544 document.getElementById("newWhitelistDomain").value = ""; | 550 document.getElementById("newWhitelistDomain").value = ""; |
(...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
729 onFilterMessage(message.action, message.args[0]); | 735 onFilterMessage(message.action, message.args[0]); |
730 break; | 736 break; |
731 case "prefs.respond": | 737 case "prefs.respond": |
732 onPrefMessage(message.action, message.args[0]); | 738 onPrefMessage(message.action, message.args[0]); |
733 break; | 739 break; |
734 case "subscriptions.respond": | 740 case "subscriptions.respond": |
735 onSubscriptionMessage(message.action, message.args[0]); | 741 onSubscriptionMessage(message.action, message.args[0]); |
736 break; | 742 break; |
737 } | 743 } |
738 }); | 744 }); |
OLD | NEW |