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-2016 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 486 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
497 let url = dialog.querySelector(".url").textContent; | 497 let url = dialog.querySelector(".url").textContent; |
498 addEnableSubscription(url, title); | 498 addEnableSubscription(url, title); |
499 closeDialog(); | 499 closeDialog(); |
500 break; | 500 break; |
501 } | 501 } |
502 case "cancel-custom-filters": | 502 case "cancel-custom-filters": |
503 E("custom-filters").classList.remove("mode-edit"); | 503 E("custom-filters").classList.remove("mode-edit"); |
504 break; | 504 break; |
505 case "cancel-domain-exception": | 505 case "cancel-domain-exception": |
506 E("whitelisting-textbox").value = ""; | 506 E("whitelisting-textbox").value = ""; |
507 document.querySelector("#whitelisting .controls").classList. | 507 document.querySelector("#whitelisting .controls").classList |
508 remove("mode-edit"); | 508 .remove("mode-edit"); |
509 break; | 509 break; |
510 case "close-dialog": | 510 case "close-dialog": |
511 closeDialog(); | 511 closeDialog(); |
512 break; | 512 break; |
513 case "edit-custom-filters": | 513 case "edit-custom-filters": |
514 E("custom-filters").classList.add("mode-edit"); | 514 E("custom-filters").classList.add("mode-edit"); |
515 editCustomFilters(); | 515 editCustomFilters(); |
516 break; | 516 break; |
517 case "edit-domain-exception": | 517 case "edit-domain-exception": |
518 document.querySelector("#whitelisting .controls").classList. | 518 document.querySelector("#whitelisting .controls").classList |
519 add("mode-edit"); | 519 .add("mode-edit"); |
520 E("whitelisting-textbox").focus(); | 520 E("whitelisting-textbox").focus(); |
521 break; | 521 break; |
522 case "import-subscription": { | 522 case "import-subscription": { |
523 let url = E("blockingList-textbox").value; | 523 let url = E("blockingList-textbox").value; |
524 addEnableSubscription(url); | 524 addEnableSubscription(url); |
525 closeDialog(); | 525 closeDialog(); |
526 break; | 526 break; |
527 } | 527 } |
528 case "open-dialog": { | 528 case "open-dialog": { |
529 let dialog = findParentData(element, "dialog", false); | 529 let dialog = findParentData(element, "dialog", false); |
(...skipping 278 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
808 () => | 808 () => |
809 { | 809 { |
810 filterTextbox.value = ""; | 810 filterTextbox.value = ""; |
811 }); | 811 }); |
812 } | 812 } |
813 E("custom-filters-add").addEventListener("submit", (e) => | 813 E("custom-filters-add").addEventListener("submit", (e) => |
814 { | 814 { |
815 e.preventDefault(); | 815 e.preventDefault(); |
816 addCustomFilters(); | 816 addCustomFilters(); |
817 }, false); | 817 }, false); |
| 818 |
| 819 // Help tab |
| 820 getDocLink("faq", (link) => |
| 821 { |
| 822 E("link-faq").setAttribute("href", link); |
| 823 }); |
| 824 getDocLink("social_twitter", (link) => |
| 825 { |
| 826 E("link-twitter").setAttribute("href", link); |
| 827 }); |
| 828 getDocLink("social_facebook", (link) => |
| 829 { |
| 830 E("link-facebook").setAttribute("href", link); |
| 831 }); |
| 832 getDocLink("social_gplus", (link) => |
| 833 { |
| 834 E("link-gplus").setAttribute("href", link); |
| 835 }); |
| 836 getDocLink("social_renren", (link) => |
| 837 { |
| 838 E("link-renren").setAttribute("href", link); |
| 839 }); |
| 840 getDocLink("social_weibo", (link) => |
| 841 { |
| 842 E("link-weibo").setAttribute("href", link); |
| 843 }); |
| 844 |
| 845 // Set forum link |
| 846 ext.backgroundPage.sendMessage({ |
| 847 type: "app.get", |
| 848 what: "platform" |
| 849 }, |
| 850 (platform) => |
| 851 { |
| 852 ext.backgroundPage.sendMessage({ |
| 853 type: "app.get", |
| 854 what: "application" |
| 855 }, |
| 856 (application) => |
| 857 { |
| 858 if (platform == "chromium" && application != "opera") |
| 859 application = "chrome"; |
| 860 |
| 861 getDocLink(application + "_support", (link) => |
| 862 { |
| 863 E("link-forum").setAttribute("href", link); |
| 864 }); |
| 865 }); |
| 866 }); |
818 | 867 |
819 E("dialog").addEventListener("keydown", function(e) | 868 E("dialog").addEventListener("keydown", function(e) |
820 { | 869 { |
821 switch (getKey(e)) | 870 switch (getKey(e)) |
822 { | 871 { |
823 case "Escape": | 872 case "Escape": |
824 closeDialog(); | 873 closeDialog(); |
825 break; | 874 break; |
826 case "Tab": | 875 case "Tab": |
827 if (e.shiftKey) | 876 if (e.shiftKey) |
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
930 let domain = E("whitelisting-textbox"); | 979 let domain = E("whitelisting-textbox"); |
931 if (domain.value) | 980 if (domain.value) |
932 { | 981 { |
933 sendMessageHandleErrors({ | 982 sendMessageHandleErrors({ |
934 type: "filters.add", | 983 type: "filters.add", |
935 text: "@@||" + domain.value.toLowerCase() + "^$document" | 984 text: "@@||" + domain.value.toLowerCase() + "^$document" |
936 }); | 985 }); |
937 } | 986 } |
938 | 987 |
939 domain.value = ""; | 988 domain.value = ""; |
940 document.querySelector("#whitelisting .controls"). | 989 document.querySelector("#whitelisting .controls") |
941 classList.remove("mode-edit"); | 990 .classList.remove("mode-edit"); |
942 } | 991 } |
943 | 992 |
944 function editCustomFilters() | 993 function editCustomFilters() |
945 { | 994 { |
946 let filterTexts = []; | 995 let filterTexts = []; |
947 for (let customFilterItem of collections.customFilters.items) | 996 for (let customFilterItem of collections.customFilters.items) |
948 filterTexts.push(customFilterItem.text); | 997 filterTexts.push(customFilterItem.text); |
949 E("custom-filters-raw").value = filterTexts.join("\n"); | 998 E("custom-filters-raw").value = filterTexts.join("\n"); |
950 } | 999 } |
951 | 1000 |
(...skipping 296 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1248 }); | 1297 }); |
1249 ext.backgroundPage.sendMessage({ | 1298 ext.backgroundPage.sendMessage({ |
1250 type: "subscriptions.listen", | 1299 type: "subscriptions.listen", |
1251 filter: ["added", "disabled", "homepage", "lastDownload", "removed", | 1300 filter: ["added", "disabled", "homepage", "lastDownload", "removed", |
1252 "title", "downloadStatus", "downloading"] | 1301 "title", "downloadStatus", "downloading"] |
1253 }); | 1302 }); |
1254 | 1303 |
1255 window.addEventListener("DOMContentLoaded", onDOMLoaded, false); | 1304 window.addEventListener("DOMContentLoaded", onDOMLoaded, false); |
1256 window.addEventListener("hashchange", onHashChange, false); | 1305 window.addEventListener("hashchange", onHashChange, false); |
1257 } | 1306 } |
LEFT | RIGHT |