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

Delta Between Two Patch Sets: new-options.js

Issue 29519650: Issue 5540 - implement notification (Closed)
Left Patch Set: Created Aug. 24, 2017, 6:39 p.m.
Right Patch Set: Rebased Created Aug. 25, 2017, 1:47 p.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/delete.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 517 matching lines...) Expand 10 before | Expand all | Expand 10 after
528 alert(errors.join("\n")); 528 alert(errors.join("\n"));
529 else if (onSuccess) 529 else if (onSuccess)
530 onSuccess(); 530 onSuccess();
531 }); 531 });
532 } 532 }
533 533
534 function openDocLink(id) 534 function openDocLink(id)
535 { 535 {
536 getDocLink(id, (link) => 536 getDocLink(id, (link) =>
537 { 537 {
538 if (id == "share-general") 538 location.href = link;
539 openSharePopup(link);
540 else
541 location.href = link;
542 }); 539 });
543 } 540 }
544 541
545 function switchTab(id) 542 function switchTab(id)
546 { 543 {
547 location.hash = id; 544 location.hash = id;
548 } 545 }
549 546
550 function execAction(action, element) 547 function execAction(action, element)
551 { 548 {
(...skipping 340 matching lines...) Expand 10 before | Expand all | Expand 10 after
892 889
893 getDocLink("subscriptions", (link) => 890 getDocLink("subscriptions", (link) =>
894 { 891 {
895 setLinks("filter-lists-description", link); 892 setLinks("filter-lists-description", link);
896 }); 893 });
897 894
898 E("custom-filters-raw").setAttribute("placeholder", 895 E("custom-filters-raw").setAttribute("placeholder",
899 getMessage("options_customFilters_edit_placeholder", ["/ads/track/*"])); 896 getMessage("options_customFilters_edit_placeholder", ["/ads/track/*"]));
900 897
901 // Help tab 898 // Help tab
902 getDocLink("faq", (link) => 899 getDocLink("adblock_plus_report_issue", (link) =>
903 { 900 {
904 E("link-faq").setAttribute("href", link); 901 setLinks("report-issue", link);
902 });
903 getDocLink("adblock_plus_report_ad", (link) =>
904 {
905 setLinks("report-ad", link);
906 });
907 getDocLink("adblock_plus_report_bug", (link) =>
908 {
909 setLinks("report-bug", link);
910 });
911 getDocLink("reporter_other_link", (link) =>
912 {
913 setLinks("report-forum", link);
905 }); 914 });
906 getDocLink("social_twitter", (link) => 915 getDocLink("social_twitter", (link) =>
907 { 916 {
908 E("link-twitter").setAttribute("href", link); 917 E("twitter").setAttribute("href", link);
909 }); 918 });
910 getDocLink("social_facebook", (link) => 919 getDocLink("social_facebook", (link) =>
911 { 920 {
912 E("link-facebook").setAttribute("href", link); 921 E("facebook").setAttribute("href", link);
913 }); 922 });
914 getDocLink("social_gplus", (link) => 923 getDocLink("social_gplus", (link) =>
915 { 924 {
916 E("link-gplus").setAttribute("href", link); 925 E("google-plus").setAttribute("href", link);
917 });
918 getDocLink("social_renren", (link) =>
919 {
920 E("link-renren").setAttribute("href", link);
921 }); 926 });
922 getDocLink("social_weibo", (link) => 927 getDocLink("social_weibo", (link) =>
923 { 928 {
924 E("link-weibo").setAttribute("href", link); 929 E("weibo").setAttribute("href", link);
925 });
926
927 // Set forum link
928 ext.backgroundPage.sendMessage({
929 type: "app.get",
930 what: "platform"
931 },
932 (platform) =>
933 {
934 ext.backgroundPage.sendMessage({
935 type: "app.get",
936 what: "application"
937 },
938 (application) =>
939 {
940 if (platform == "chromium" && application != "opera")
941 application = "chrome";
942
943 getDocLink(application + "_support", (link) =>
944 {
945 E("link-forum").setAttribute("href", link);
946 });
947 });
948 }); 930 });
949 931
950 E("dialog").addEventListener("keydown", function(e) 932 E("dialog").addEventListener("keydown", function(e)
951 { 933 {
952 switch (getKey(e)) 934 switch (getKey(e))
953 { 935 {
954 case "Escape": 936 case "Escape":
955 closeDialog(); 937 closeDialog();
956 break; 938 break;
957 case "Tab": 939 case "Tab":
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
994 976
995 function closeDialog() 977 function closeDialog()
996 { 978 {
997 let dialog = E("dialog"); 979 let dialog = E("dialog");
998 dialog.setAttribute("aria-hidden", true); 980 dialog.setAttribute("aria-hidden", true);
999 dialog.removeAttribute("aria-labelledby"); 981 dialog.removeAttribute("aria-labelledby");
1000 document.body.removeAttribute("data-dialog"); 982 document.body.removeAttribute("data-dialog");
1001 focusedBeforeDialog.focus(); 983 focusedBeforeDialog.focus();
1002 } 984 }
1003 985
1004 function showNotification(text) 986 function showNotification(text)
ire 2017/08/25 09:59:45 This doesn't need to hold up this review, but we c
saroyanm 2017/08/25 11:04:19 It's bit difficult because we don't know where is
ire 2017/08/25 12:10:07 Okay good point. In light of what you said, I thin
saroyanm 2017/08/25 12:22:55 I agree
1005 { 987 {
1006 E("notification").setAttribute("aria-hidden", false); 988 E("notification").setAttribute("aria-hidden", false);
1007 E("notification-text").textContent = text; 989 E("notification-text").textContent = text;
1008 setTimeout(hideNotification, 3000); 990 setTimeout(hideNotification, 3000);
1009 } 991 }
1010 992
1011 function hideNotification() 993 function hideNotification()
1012 { 994 {
1013 E("notification").setAttribute("aria-hidden", true); 995 E("notification").setAttribute("aria-hidden", true);
1014 E("notification-text").textContent = ""; 996 E("notification-text").textContent = "";
(...skipping 373 matching lines...) Expand 10 before | Expand all | Expand 10 after
1388 }); 1370 });
1389 ext.backgroundPage.sendMessage({ 1371 ext.backgroundPage.sendMessage({
1390 type: "subscriptions.listen", 1372 type: "subscriptions.listen",
1391 filter: ["added", "disabled", "homepage", "lastDownload", "removed", 1373 filter: ["added", "disabled", "homepage", "lastDownload", "removed",
1392 "title", "downloadStatus", "downloading"] 1374 "title", "downloadStatus", "downloading"]
1393 }); 1375 });
1394 1376
1395 window.addEventListener("DOMContentLoaded", onDOMLoaded, false); 1377 window.addEventListener("DOMContentLoaded", onDOMLoaded, false);
1396 window.addEventListener("hashchange", onHashChange, false); 1378 window.addEventListener("hashchange", onHashChange, false);
1397 } 1379 }
LEFTRIGHT

Powered by Google App Engine
This is Rietveld