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

Delta Between Two Patch Sets: desktop-options.js

Issue 29565799: Noissue - Load options on DOMContentLoaded rather than jQuery.ready (Closed) Base URL: https://hg.adblockplus.org/adblockpluschrome/
Left Patch Set: Created Oct. 5, 2017, 7:40 p.m.
Right Patch Set: Use addEventListener Created Oct. 5, 2017, 8:06 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 | « no previous file | no next file » | 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 168 matching lines...) Expand 10 before | Expand all | Expand 10 after
179 filter: ["added", "disabled", "homepage", "lastDownload", "removed", 179 filter: ["added", "disabled", "homepage", "lastDownload", "removed",
180 "title", "downloadStatus", "downloading"] 180 "title", "downloadStatus", "downloading"]
181 }); 181 });
182 182
183 // Load recommended subscriptions 183 // Load recommended subscriptions
184 loadRecommendations(); 184 loadRecommendations();
185 185
186 // Show user's filters 186 // Show user's filters
187 reloadFilters(); 187 reloadFilters();
188 } 188 }
189 $(document).on("DOMContentLoaded", loadOptions);
Sebastian Noack 2017/10/05 19:50:28 Why not avoiding jQuery at all and just use docume
Manish Jethani 2017/10/05 20:10:13 Yes, that makes sense. Done. (I've also moved it
190 189
191 function convertSpecialSubscription(subscription) 190 function convertSpecialSubscription(subscription)
192 { 191 {
193 for (let filter of subscription.filters) 192 for (let filter of subscription.filters)
194 { 193 {
195 if (whitelistedDomainRegexp.test(filter.text)) 194 if (whitelistedDomainRegexp.test(filter.text))
196 appendToListBox("excludedDomainsBox", RegExp.$1); 195 appendToListBox("excludedDomainsBox", RegExp.$1);
197 else 196 else
198 appendToListBox("userFiltersBox", filter.text); 197 appendToListBox("userFiltersBox", filter.text);
199 } 198 }
(...skipping 496 matching lines...) Expand 10 before | Expand all | Expand 10 after
696 links[i].setAttribute("target", "_blank"); 695 links[i].setAttribute("target", "_blank");
697 } 696 }
698 else if (typeof args[i] == "function") 697 else if (typeof args[i] == "function")
699 { 698 {
700 links[i].href = "javascript:void(0);"; 699 links[i].href = "javascript:void(0);";
701 links[i].addEventListener("click", args[i], false); 700 links[i].addEventListener("click", args[i], false);
702 } 701 }
703 } 702 }
704 } 703 }
705 704
705 document.addEventListener("DOMContentLoaded", loadOptions);
706
706 ext.onMessage.addListener(message => 707 ext.onMessage.addListener(message =>
Manish Jethani 2017/10/05 20:10:13 By the way I notice that this listener could get c
Manish Jethani 2017/10/05 20:12:34 It won't in practice though because of the recent
Sebastian Noack 2017/10/05 20:14:47 Unlikely, as the document isn't loaded over the ne
707 { 708 {
708 switch (message.type) 709 switch (message.type)
709 { 710 {
710 case "app.respond": 711 case "app.respond":
711 switch (message.action) 712 switch (message.action)
712 { 713 {
713 case "addSubscription": 714 case "addSubscription":
714 let subscription = message.args[0]; 715 let subscription = message.args[0];
715 startSubscriptionSelection(subscription.title, subscription.url); 716 startSubscriptionSelection(subscription.title, subscription.url);
716 break; 717 break;
(...skipping 21 matching lines...) Expand all
738 onFilterMessage(message.action, message.args[0]); 739 onFilterMessage(message.action, message.args[0]);
739 break; 740 break;
740 case "prefs.respond": 741 case "prefs.respond":
741 onPrefMessage(message.action, message.args[0]); 742 onPrefMessage(message.action, message.args[0]);
742 break; 743 break;
743 case "subscriptions.respond": 744 case "subscriptions.respond":
744 onSubscriptionMessage(message.action, message.args[0]); 745 onSubscriptionMessage(message.action, message.args[0]);
745 break; 746 break;
746 } 747 }
747 }); 748 });
LEFTRIGHT
« no previous file | no next file » | Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Toggle Comments ('s')

Powered by Google App Engine
This is Rietveld