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: Rebased Created Aug. 23, 2017, 1:29 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 173 matching lines...) Expand 10 before | Expand all | Expand 10 after
763 // Show tab content 771 // Show tab content
764 document.body.setAttribute("data-tab", tabId); 772 document.body.setAttribute("data-tab", tabId);
765 773
766 // Select tab 774 // Select tab
767 let tabList = container.querySelector("[role='tablist']"); 775 let tabList = container.querySelector("[role='tablist']");
768 if (!tabList) 776 if (!tabList)
769 return null; 777 return null;
770 778
771 let previousTab = tabList.querySelector("[aria-selected]"); 779 let previousTab = tabList.querySelector("[aria-selected]");
772 previousTab.removeAttribute("aria-selected"); 780 previousTab.removeAttribute("aria-selected");
781 previousTab.setAttribute("tabindex", -1);
773 782
774 let tab = tabList.querySelector("a[href='#" + tabId + "']"); 783 let tab = tabList.querySelector("a[href='#" + tabId + "']");
775 tab.setAttribute("aria-selected", true); 784 tab.setAttribute("aria-selected", true);
785 tab.setAttribute("tabindex", 0);
776 786
777 let tabContentId = tab.getAttribute("aria-controls"); 787 let tabContentId = tab.getAttribute("aria-controls");
778 let tabContent = document.getElementById(tabContentId); 788 let tabContent = document.getElementById(tabContentId);
779 789
780 if (tab && focus) 790 if (tab && focus)
781 tab.focus(); 791 tab.focus();
782 792
783 return tabContent; 793 return tabContent;
784 } 794 }
785 795
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
868 878
869 getDocLink("subscriptions", (link) => 879 getDocLink("subscriptions", (link) =>
870 { 880 {
871 setLinks("filter-lists-description", link); 881 setLinks("filter-lists-description", link);
872 }); 882 });
873 883
874 E("custom-filters-raw").setAttribute("placeholder", 884 E("custom-filters-raw").setAttribute("placeholder",
875 getMessage("options_customFilters_edit_placeholder", ["/ads/track/*"])); 885 getMessage("options_customFilters_edit_placeholder", ["/ads/track/*"]));
876 886
877 // Help tab 887 // Help tab
878 getDocLink("faq", (link) => 888 getDocLink("adblock_plus_report_issue", (link) =>
879 { 889 {
880 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);
881 }); 903 });
882 getDocLink("social_twitter", (link) => 904 getDocLink("social_twitter", (link) =>
883 { 905 {
884 E("link-twitter").setAttribute("href", link); 906 E("twitter").setAttribute("href", link);
885 }); 907 });
886 getDocLink("social_facebook", (link) => 908 getDocLink("social_facebook", (link) =>
887 { 909 {
888 E("link-facebook").setAttribute("href", link); 910 E("facebook").setAttribute("href", link);
889 }); 911 });
890 getDocLink("social_gplus", (link) => 912 getDocLink("social_gplus", (link) =>
891 { 913 {
892 E("link-gplus").setAttribute("href", link); 914 E("google-plus").setAttribute("href", link);
893 });
894 getDocLink("social_renren", (link) =>
895 {
896 E("link-renren").setAttribute("href", link);
897 }); 915 });
898 getDocLink("social_weibo", (link) => 916 getDocLink("social_weibo", (link) =>
899 { 917 {
900 E("link-weibo").setAttribute("href", link); 918 E("weibo").setAttribute("href", link);
901 });
902
903 // Set forum link
904 ext.backgroundPage.sendMessage({
905 type: "app.get",
906 what: "platform"
907 },
908 (platform) =>
909 {
910 ext.backgroundPage.sendMessage({
911 type: "app.get",
912 what: "application"
913 },
914 (application) =>
915 {
916 if (platform == "chromium" && application != "opera")
917 application = "chrome";
918
919 getDocLink(application + "_support", (link) =>
920 {
921 E("link-forum").setAttribute("href", link);
922 });
923 });
924 }); 919 });
925 920
926 E("dialog").addEventListener("keydown", function(e) 921 E("dialog").addEventListener("keydown", function(e)
927 { 922 {
928 switch (getKey(e)) 923 switch (getKey(e))
929 { 924 {
930 case "Escape": 925 case "Escape":
931 closeDialog(); 926 closeDialog();
932 break; 927 break;
933 case "Tab": 928 case "Tab":
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
970 965
971 function closeDialog() 966 function closeDialog()
972 { 967 {
973 let dialog = E("dialog"); 968 let dialog = E("dialog");
974 dialog.setAttribute("aria-hidden", true); 969 dialog.setAttribute("aria-hidden", true);
975 dialog.removeAttribute("aria-labelledby"); 970 dialog.removeAttribute("aria-labelledby");
976 document.body.removeAttribute("data-dialog"); 971 document.body.removeAttribute("data-dialog");
977 focusedBeforeDialog.focus(); 972 focusedBeforeDialog.focus();
978 } 973 }
979 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
980 function setAcceptableAds() 988 function setAcceptableAds()
981 { 989 {
982 let option = "none"; 990 let option = "none";
983 document.forms["acceptable-ads"].classList.remove("show-dnt-notification"); 991 document.forms["acceptable-ads"].classList.remove("show-dnt-notification");
984 if (acceptableAdsUrl in subscriptionsMap) 992 if (acceptableAdsUrl in subscriptionsMap)
985 { 993 {
986 option = "ads"; 994 option = "ads";
987 } 995 }
988 else if (acceptableAdsPrivacyUrl in subscriptionsMap) 996 else if (acceptableAdsPrivacyUrl in subscriptionsMap)
989 { 997 {
(...skipping 334 matching lines...) Expand 10 before | Expand all | Expand 10 after
1324 }); 1332 });
1325 ext.backgroundPage.sendMessage({ 1333 ext.backgroundPage.sendMessage({
1326 type: "subscriptions.listen", 1334 type: "subscriptions.listen",
1327 filter: ["added", "disabled", "homepage", "lastDownload", "removed", 1335 filter: ["added", "disabled", "homepage", "lastDownload", "removed",
1328 "title", "downloadStatus", "downloading"] 1336 "title", "downloadStatus", "downloading"]
1329 }); 1337 });
1330 1338
1331 window.addEventListener("DOMContentLoaded", onDOMLoaded, false); 1339 window.addEventListener("DOMContentLoaded", onDOMLoaded, false);
1332 window.addEventListener("hashchange", onHashChange, false); 1340 window.addEventListener("hashchange", onHashChange, false);
1333 } 1341 }
LEFTRIGHT

Powered by Google App Engine
This is Rietveld