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

Side by Side Diff: desktop-options.js

Issue 29693558: Issue 6009 - Convert URLs into domains when adding domain to whitelist (Closed)
Patch Set: Created Feb. 9, 2018, 10:18 a.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 900 matching lines...) Expand 10 before | Expand all | Expand 10 after
911 911
912 // General tab 912 // General tab
913 getDocLink("contribute", (link) => 913 getDocLink("contribute", (link) =>
914 { 914 {
915 E("contribute").href = link; 915 E("contribute").href = link;
916 }); 916 });
917 getDocLink("acceptable_ads_criteria", (link) => 917 getDocLink("acceptable_ads_criteria", (link) =>
918 { 918 {
919 setLinks("enable-acceptable-ads-description", link); 919 setLinks("enable-acceptable-ads-description", link);
920 }); 920 });
921 setElementText(E("tracking-warning-1"), "options_tracking_warning_1", 921 setElementText(E("tracking-warning-1"), "options_tracking_warning_1",
saroyanm 2018/02/14 16:31:06 Detail: Please do not forget to rebase before push
922 [getMessage("common_feature_privacy_title"), 922 [getMessage("common_feature_privacy_title"),
923 getMessage("options_acceptableAds_ads_label")]); 923 getMessage("options_acceptableAds_ads_label")]);
924 setElementText(E("tracking-warning-3"), "options_tracking_warning_3", 924 setElementText(E("tracking-warning-3"), "options_tracking_warning_3",
925 [getMessage("options_acceptableAds_privacy_label")]); 925 [getMessage("options_acceptableAds_privacy_label")]);
926 926
927 getDocLink("privacy_friendly_ads", (link) => 927 getDocLink("privacy_friendly_ads", (link) =>
928 { 928 {
929 E("enable-acceptable-ads-privacy-description").href = link; 929 E("enable-acceptable-ads-privacy-description").href = link;
930 }); 930 });
931 getDocLink("adblock_plus_{browser}_dnt", url => 931 getDocLink("adblock_plus_{browser}_dnt", url =>
932 { 932 {
933 setLinks("dnt", url); 933 setLinks("dnt", url);
934 }); 934 });
(...skipping 269 matching lines...) Expand 10 before | Expand all | Expand 10 after
1204 for (let whitelistItem of collections.whitelist.items) 1204 for (let whitelistItem of collections.whitelist.items)
1205 { 1205 {
1206 if (whitelistItem.title == domain.value) 1206 if (whitelistItem.title == domain.value)
1207 { 1207 {
1208 whitelistItem[timestampUI] = Date.now(); 1208 whitelistItem[timestampUI] = Date.now();
1209 collections.whitelist.updateItem(whitelistItem); 1209 collections.whitelist.updateItem(whitelistItem);
1210 domain.value = ""; 1210 domain.value = "";
1211 break; 1211 break;
1212 } 1212 }
1213 } 1213 }
1214 if (domain.value) 1214 const value = domain.value.trim();
1215 if (value)
1215 { 1216 {
1217 const host = /^https?:\/\//i.test(value) ? new URL(value).host : value;
1216 sendMessageHandleErrors({ 1218 sendMessageHandleErrors({
1217 type: "filters.add", 1219 type: "filters.add",
1218 text: "@@||" + domain.value.toLowerCase() + "^$document" 1220 text: "@@||" + host.toLowerCase() + "^$document"
1219 }); 1221 });
1220 } 1222 }
1221 1223
1222 domain.value = ""; 1224 domain.value = "";
1223 E("whitelisting-add-button").disabled = true; 1225 E("whitelisting-add-button").disabled = true;
1224 } 1226 }
1225 1227
1226 function addEnableSubscription(url, title, homepage) 1228 function addEnableSubscription(url, title, homepage)
1227 { 1229 {
1228 let messageType = null; 1230 let messageType = null;
(...skipping 240 matching lines...) Expand 10 before | Expand all | Expand 10 after
1469 }); 1471 });
1470 browser.runtime.sendMessage({ 1472 browser.runtime.sendMessage({
1471 type: "subscriptions.listen", 1473 type: "subscriptions.listen",
1472 filter: ["added", "disabled", "homepage", "lastDownload", "removed", 1474 filter: ["added", "disabled", "homepage", "lastDownload", "removed",
1473 "title", "downloadStatus", "downloading"] 1475 "title", "downloadStatus", "downloading"]
1474 }); 1476 });
1475 1477
1476 window.addEventListener("DOMContentLoaded", onDOMLoaded, false); 1478 window.addEventListener("DOMContentLoaded", onDOMLoaded, false);
1477 window.addEventListener("hashchange", onHashChange, false); 1479 window.addEventListener("hashchange", onHashChange, false);
1478 } 1480 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld