Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Delta Between Two Patch Sets: new-options.js

Issue 29502647: Issue 5482 - Sidebar and about ABP dialog (Closed)
Left Patch Set: Created Aug. 24, 2017, 5:35 p.m.
Right Patch Set: Fixed nit Created Aug. 28, 2017, 11:38 a.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
Left: Side by side diff | Download
Right: Side by side diff | Download
« no previous file with change/comment | « new-options.html ('k') | skin/abp-logo.svg » ('j') | no next file with change/comment »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
LEFTRIGHT
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-present eyeo GmbH 3 * Copyright (C) 2006-present 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 414 matching lines...) Expand 10 before | Expand all | Expand 10 after
425 } 425 }
426 } 426 }
427 427
428 function updateFilter(filter) 428 function updateFilter(filter)
429 { 429 {
430 let match = filter.text.match(whitelistedDomainRegexp); 430 let match = filter.text.match(whitelistedDomainRegexp);
431 if (match && !filtersMap[filter.text]) 431 if (match && !filtersMap[filter.text])
432 { 432 {
433 filter.title = match[1]; 433 filter.title = match[1];
434 collections.whitelist.addItem(filter); 434 collections.whitelist.addItem(filter);
435 if (isCustomFiltersLoaded)
436 {
437 let text = getMessage("options_whitelist_notification", [filter.title]);
438 showNotification(text);
439 }
435 } 440 }
436 else 441 else
437 { 442 {
438 customFilters.push(filter.text); 443 customFilters.push(filter.text);
439 if (isCustomFiltersLoaded) 444 if (isCustomFiltersLoaded)
440 updateCustomFiltersUi(); 445 updateCustomFiltersUi();
441 } 446 }
442 447
443 filtersMap[filter.text] = filter; 448 filtersMap[filter.text] = filter;
444 } 449 }
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after
570 break; 575 break;
571 } 576 }
572 } 577 }
573 break; 578 break;
574 case "close-dialog": 579 case "close-dialog":
575 closeDialog(); 580 closeDialog();
576 break; 581 break;
577 case "edit-custom-filters": 582 case "edit-custom-filters":
578 setCustomFiltersView("write"); 583 setCustomFiltersView("write");
579 break; 584 break;
585 case "hide-notification":
586 hideNotification();
587 break;
580 case "import-subscription": { 588 case "import-subscription": {
581 let url = E("blockingList-textbox").value; 589 let url = E("blockingList-textbox").value;
582 addEnableSubscription(url); 590 addEnableSubscription(url);
583 closeDialog(); 591 closeDialog();
584 break; 592 break;
585 } 593 }
586 case "open-context-menu": { 594 case "open-context-menu": {
587 let listItem = findParentData(element, "access", true); 595 let listItem = findParentData(element, "access", true);
588 if (listItem && !listItem.classList.contains("show-context-menu")) 596 if (listItem && !listItem.classList.contains("show-context-menu"))
589 listItem.classList.add("show-context-menu"); 597 listItem.classList.add("show-context-menu");
(...skipping 280 matching lines...) Expand 10 before | Expand all | Expand 10 after
870 878
871 getDocLink("subscriptions", (link) => 879 getDocLink("subscriptions", (link) =>
872 { 880 {
873 setLinks("filter-lists-description", link); 881 setLinks("filter-lists-description", link);
874 }); 882 });
875 883
876 E("custom-filters-raw").setAttribute("placeholder", 884 E("custom-filters-raw").setAttribute("placeholder",
877 getMessage("options_customFilters_edit_placeholder", ["/ads/track/*"])); 885 getMessage("options_customFilters_edit_placeholder", ["/ads/track/*"]));
878 886
879 // Help tab 887 // Help tab
880 getDocLink("faq", (link) => 888 getDocLink("adblock_plus_report_issue", (link) =>
881 { 889 {
882 E("link-faq").setAttribute("href", link); 890 setLinks("report-issue", link);
891 });
892 getDocLink("adblock_plus_report_ad", (link) =>
893 {
894 setLinks("report-ad", link);
895 });
896 getDocLink("adblock_plus_report_bug", (link) =>
897 {
898 setLinks("report-bug", link);
899 });
900 getDocLink("reporter_other_link", (link) =>
901 {
902 setLinks("report-forum", link);
883 }); 903 });
884 getDocLink("social_twitter", (link) => 904 getDocLink("social_twitter", (link) =>
885 { 905 {
886 E("link-twitter").setAttribute("href", link); 906 E("twitter").setAttribute("href", link);
887 }); 907 });
888 getDocLink("social_facebook", (link) => 908 getDocLink("social_facebook", (link) =>
889 { 909 {
890 E("link-facebook").setAttribute("href", link); 910 E("facebook").setAttribute("href", link);
891 }); 911 });
892 getDocLink("social_gplus", (link) => 912 getDocLink("social_gplus", (link) =>
893 { 913 {
894 E("link-gplus").setAttribute("href", link); 914 E("google-plus").setAttribute("href", link);
895 });
896 getDocLink("social_renren", (link) =>
897 {
898 E("link-renren").setAttribute("href", link);
899 }); 915 });
900 getDocLink("social_weibo", (link) => 916 getDocLink("social_weibo", (link) =>
901 { 917 {
902 E("link-weibo").setAttribute("href", link); 918 E("weibo").setAttribute("href", link);
903 });
904
905 // Set forum link
906 ext.backgroundPage.sendMessage({
907 type: "app.get",
908 what: "platform"
909 },
910 (platform) =>
911 {
912 ext.backgroundPage.sendMessage({
913 type: "app.get",
914 what: "application"
915 },
916 (application) =>
917 {
918 if (platform == "chromium" && application != "opera")
919 application = "chrome";
920
921 getDocLink(application + "_support", (link) =>
922 {
923 E("link-forum").setAttribute("href", link);
924 });
925 });
926 }); 919 });
927 920
928 E("dialog").addEventListener("keydown", function(e) 921 E("dialog").addEventListener("keydown", function(e)
929 { 922 {
930 switch (getKey(e)) 923 switch (getKey(e))
931 { 924 {
932 case "Escape": 925 case "Escape":
933 closeDialog(); 926 closeDialog();
934 break; 927 break;
935 case "Tab": 928 case "Tab":
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
972 965
973 function closeDialog() 966 function closeDialog()
974 { 967 {
975 let dialog = E("dialog"); 968 let dialog = E("dialog");
976 dialog.setAttribute("aria-hidden", true); 969 dialog.setAttribute("aria-hidden", true);
977 dialog.removeAttribute("aria-labelledby"); 970 dialog.removeAttribute("aria-labelledby");
978 document.body.removeAttribute("data-dialog"); 971 document.body.removeAttribute("data-dialog");
979 focusedBeforeDialog.focus(); 972 focusedBeforeDialog.focus();
980 } 973 }
981 974
975 function showNotification(text)
976 {
977 E("notification").setAttribute("aria-hidden", false);
978 E("notification-text").textContent = text;
979 setTimeout(hideNotification, 3000);
980 }
981
982 function hideNotification()
983 {
984 E("notification").setAttribute("aria-hidden", true);
985 E("notification-text").textContent = "";
986 }
987
982 function setAcceptableAds() 988 function setAcceptableAds()
983 { 989 {
984 let option = "none"; 990 let option = "none";
985 document.forms["acceptable-ads"].classList.remove("show-dnt-notification"); 991 document.forms["acceptable-ads"].classList.remove("show-dnt-notification");
986 if (acceptableAdsUrl in subscriptionsMap) 992 if (acceptableAdsUrl in subscriptionsMap)
987 { 993 {
988 option = "ads"; 994 option = "ads";
989 } 995 }
990 else if (acceptableAdsPrivacyUrl in subscriptionsMap) 996 else if (acceptableAdsPrivacyUrl in subscriptionsMap)
991 { 997 {
(...skipping 334 matching lines...) Expand 10 before | Expand all | Expand 10 after
1326 }); 1332 });
1327 ext.backgroundPage.sendMessage({ 1333 ext.backgroundPage.sendMessage({
1328 type: "subscriptions.listen", 1334 type: "subscriptions.listen",
1329 filter: ["added", "disabled", "homepage", "lastDownload", "removed", 1335 filter: ["added", "disabled", "homepage", "lastDownload", "removed",
1330 "title", "downloadStatus", "downloading"] 1336 "title", "downloadStatus", "downloading"]
1331 }); 1337 });
1332 1338
1333 window.addEventListener("DOMContentLoaded", onDOMLoaded, false); 1339 window.addEventListener("DOMContentLoaded", onDOMLoaded, false);
1334 window.addEventListener("hashchange", onHashChange, false); 1340 window.addEventListener("hashchange", onHashChange, false);
1335 } 1341 }
LEFTRIGHT

Powered by Google App Engine
This is Rietveld