Left: | ||
Right: |
LEFT | RIGHT |
---|---|
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-2016 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 |
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
12 * GNU General Public License for more details. | 12 * GNU General Public License for more details. |
13 * | 13 * |
(...skipping 14 matching lines...) Expand all Loading... | |
28 * values as arguments. | 28 * values as arguments. |
29 * @return {function} The generated messaging function, optionally | 29 * @return {function} The generated messaging function, optionally |
30 * taking any values as specified by the paramKeys | 30 * taking any values as specified by the paramKeys |
31 * and finally an optional callback. (Although the | 31 * and finally an optional callback. (Although the |
32 * value arguments are optional their index must be | 32 * value arguments are optional their index must be |
33 * maintained. E.g. if you omit the first value you | 33 * maintained. E.g. if you omit the first value you |
34 * must omit the second too.) | 34 * must omit the second too.) |
35 */ | 35 */ |
36 function wrapper(baseMessage, ...paramKeys) | 36 function wrapper(baseMessage, ...paramKeys) |
37 { | 37 { |
38 return function(...paramValues /* , callback */) | 38 return function(...paramValues /* , callback */) |
Wladimir Palant
2017/03/14 13:03:30
I wonder why this isn't using promises. Not someth
kzar
2017/03/15 04:57:53
Acknowledged.
| |
39 { | 39 { |
40 let message = Object.create(null); | 40 let message = Object.create(null); |
41 for (let key in baseMessage) | 41 for (let key in baseMessage) |
42 { | 42 { |
43 if (baseMessage.hasOwnProperty(key)) | 43 if (baseMessage.hasOwnProperty(key)) |
44 message[key] = baseMessage[key]; | 44 message[key] = baseMessage[key]; |
45 } | 45 } |
46 | 46 |
47 let callback; | 47 let callback; |
48 | 48 |
(...skipping 313 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
362 | 362 |
363 function addSubscriptionClicked() | 363 function addSubscriptionClicked() |
364 { | 364 { |
365 let list = document.getElementById("subscriptionSelector"); | 365 let list = document.getElementById("subscriptionSelector"); |
366 let data = list.options[list.selectedIndex]._data; | 366 let data = list.options[list.selectedIndex]._data; |
367 if (data) | 367 if (data) |
368 addSubscription(data.url, data.title, data.homepage); | 368 addSubscription(data.url, data.title, data.homepage); |
369 else | 369 else |
370 { | 370 { |
371 let url = document.getElementById("customSubscriptionLocation") | 371 let url = document.getElementById("customSubscriptionLocation") |
372 .value.trim(); | 372 .value.trim(); |
Wladimir Palant
2017/03/14 13:03:30
Nit: align dots maybe?
kzar
2017/03/15 04:57:53
Done.
| |
373 if (!/^https?:/i.test(url)) | 373 if (!/^https?:/i.test(url)) |
374 { | 374 { |
375 alert(i18n.getMessage("global_subscription_invalid_location")); | 375 alert(i18n.getMessage("global_subscription_invalid_location")); |
376 $("#customSubscriptionLocation").focus(); | 376 $("#customSubscriptionLocation").focus(); |
377 return; | 377 return; |
378 } | 378 } |
379 | 379 |
380 let title = document.getElementById("customSubscriptionTitle").value.trim(); | 380 let title = document.getElementById("customSubscriptionTitle").value.trim(); |
381 if (!title) | 381 if (!title) |
382 title = url; | 382 title = url; |
(...skipping 225 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
608 let rawFilters = document.getElementById("rawFilters"); | 608 let rawFilters = document.getElementById("rawFilters"); |
609 let filters = []; | 609 let filters = []; |
610 | 610 |
611 if (rawFilters.style.display != "table-row") | 611 if (rawFilters.style.display != "table-row") |
612 { | 612 { |
613 rawFilters.style.display = "table-row"; | 613 rawFilters.style.display = "table-row"; |
614 for (let option of document.getElementById("userFiltersBox").options) | 614 for (let option of document.getElementById("userFiltersBox").options) |
615 filters.push(option.value); | 615 filters.push(option.value); |
616 } | 616 } |
617 else | 617 else |
618 { | |
618 rawFilters.style.display = "none"; | 619 rawFilters.style.display = "none"; |
620 } | |
619 | 621 |
620 document.getElementById("rawFiltersText").value = filters.join("\n"); | 622 document.getElementById("rawFiltersText").value = filters.join("\n"); |
621 } | 623 } |
622 | 624 |
623 // Imports filters in the raw text box | 625 // Imports filters in the raw text box |
624 function importRawFiltersText() | 626 function importRawFiltersText() |
625 { | 627 { |
626 let text = document.getElementById("rawFiltersText").value; | 628 let text = document.getElementById("rawFiltersText").value; |
627 | 629 |
628 importRawFilters(text, true, errors => | 630 importRawFilters(text, true, errors => |
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
737 onFilterMessage(message.action, message.args[0]); | 739 onFilterMessage(message.action, message.args[0]); |
738 break; | 740 break; |
739 case "prefs.respond": | 741 case "prefs.respond": |
740 onPrefMessage(message.action, message.args[0]); | 742 onPrefMessage(message.action, message.args[0]); |
741 break; | 743 break; |
742 case "subscriptions.respond": | 744 case "subscriptions.respond": |
743 onSubscriptionMessage(message.action, message.args[0]); | 745 onSubscriptionMessage(message.action, message.args[0]); |
744 break; | 746 break; |
745 } | 747 } |
746 }); | 748 }); |
LEFT | RIGHT |