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

Delta Between Two Patch Sets: new-options.js

Issue 29411555: Issue 5169 - Add whitelisted tab to the new options page (Closed)
Left Patch Set: Move new domains to top, implicit submission and comments Created June 16, 2017, 4:15 p.m.
Right Patch Set: Fixed the TYPO Created July 3, 2017, 4:10 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/new-options.css » ('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-2017 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
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
90 { 90 {
91 // Make sure that Acceptable Ads is always last, since it cannot be 91 // Make sure that Acceptable Ads is always last, since it cannot be
92 // disabled, but only be removed. That way it's grouped together with 92 // disabled, but only be removed. That way it's grouped together with
93 // the "Own filter list" which cannot be disabled either at the bottom 93 // the "Own filter list" which cannot be disabled either at the bottom
94 // of the filter lists in the Advanced tab. 94 // of the filter lists in the Advanced tab.
95 if (a.url == acceptableAdsUrl) 95 if (a.url == acceptableAdsUrl)
96 return 1; 96 return 1;
97 if (b.url == acceptableAdsUrl) 97 if (b.url == acceptableAdsUrl)
98 return -1; 98 return -1;
99 99
100 // Make sure that newly added entries are always appear on top in 100 // Make sure that newly added entries always appear on top in descending
Thomas Greiner 2017/06/16 17:28:28 Typo: Remove "are".
101 // descending chronological order 101 // chronological order
102 let aTimestamp = a[timestampUI] || 0; 102 let aTimestamp = a[timestampUI] || 0;
103 let bTimestamp = b[timestampUI] || 0; 103 let bTimestamp = b[timestampUI] || 0;
104 if (aTimestamp || bTimestamp) 104 if (aTimestamp || bTimestamp)
105 return bTimestamp - aTimestamp; 105 return bTimestamp - aTimestamp;
106 106
107 let aTitle = this._getItemTitle(a, 0).toLowerCase(); 107 let aTitle = this._getItemTitle(a, 0).toLowerCase();
108 let bTitle = this._getItemTitle(b, 0).toLowerCase(); 108 let bTitle = this._getItemTitle(b, 0).toLowerCase();
109 return aTitle.localeCompare(bTitle); 109 return aTitle.localeCompare(bTitle);
110 }); 110 });
111 }; 111 };
(...skipping 641 matching lines...) Expand 10 before | Expand all | Expand 10 after
753 }); 753 });
754 getDocLink("releases", (link) => 754 getDocLink("releases", (link) =>
755 { 755 {
756 E("link-version").setAttribute("href", link); 756 E("link-version").setAttribute("href", link);
757 }); 757 });
758 758
759 updateShareLink(); 759 updateShareLink();
760 updateTooltips(); 760 updateTooltips();
761 761
762 // Initialize interactive UI elements 762 // Initialize interactive UI elements
763 document.body.addEventListener("click", onClick, false); 763 document.body.addEventListener("click", onClick, false);
saroyanm 2017/06/16 16:43:08 I think I've learned something today: Apparently h
Thomas Greiner 2017/06/16 17:28:28 I was aware of an implicit submission causing the
764 document.body.addEventListener("keyup", onKeyUp, false); 764 document.body.addEventListener("keyup", onKeyUp, false);
765 let placeholderValue = getMessage("options_dialog_language_find"); 765 let placeholderValue = getMessage("options_dialog_language_find");
766 E("find-language").setAttribute("placeholder", placeholderValue); 766 E("find-language").setAttribute("placeholder", placeholderValue);
767 E("find-language").addEventListener("keyup", onFindLanguageKeyUp, false); 767 E("find-language").addEventListener("keyup", onFindLanguageKeyUp, false);
768 let exampleValue = getMessage("options_whitelist_placeholder_example", 768 let exampleValue = getMessage("options_whitelist_placeholder_example",
769 ["www.example.com"]); 769 ["www.example.com"]);
770 E("whitelisting-textbox").setAttribute("placeholder", exampleValue); 770 E("whitelisting-textbox").setAttribute("placeholder", exampleValue);
771 E("whitelisting-textbox").addEventListener("keyup", (e) => 771 E("whitelisting-textbox").addEventListener("keyup", (e) =>
772 { 772 {
773 E("whitelisting-add-button").disabled = !e.target.value; 773 E("whitelisting-add-button").disabled = !e.target.value;
saroyanm 2017/06/16 16:43:08 Not sure if this also needs to be moved into `onKe
Thomas Greiner 2017/06/16 17:28:28 I'd say either way is fine so let's keep it as is.
774 }, false); 774 }, false);
775 775
776 // Advanced tab 776 // Advanced tab
777 let tweaks = document.querySelectorAll("#tweaks li[data-pref]"); 777 let tweaks = document.querySelectorAll("#tweaks li[data-pref]");
778 tweaks = Array.prototype.map.call(tweaks, (checkbox) => 778 tweaks = Array.prototype.map.call(tweaks, (checkbox) =>
779 { 779 {
780 return checkbox.getAttribute("data-pref"); 780 return checkbox.getAttribute("data-pref");
781 }); 781 });
782 for (let key of tweaks) 782 for (let key of tweaks)
783 { 783 {
(...skipping 532 matching lines...) Expand 10 before | Expand all | Expand 10 after
1316 }); 1316 });
1317 ext.backgroundPage.sendMessage({ 1317 ext.backgroundPage.sendMessage({
1318 type: "subscriptions.listen", 1318 type: "subscriptions.listen",
1319 filter: ["added", "disabled", "homepage", "lastDownload", "removed", 1319 filter: ["added", "disabled", "homepage", "lastDownload", "removed",
1320 "title", "downloadStatus", "downloading"] 1320 "title", "downloadStatus", "downloading"]
1321 }); 1321 });
1322 1322
1323 window.addEventListener("DOMContentLoaded", onDOMLoaded, false); 1323 window.addEventListener("DOMContentLoaded", onDOMLoaded, false);
1324 window.addEventListener("hashchange", onHashChange, false); 1324 window.addEventListener("hashchange", onHashChange, false);
1325 } 1325 }
LEFTRIGHT

Powered by Google App Engine
This is Rietveld