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

Delta Between Two Patch Sets: desktop-options.js

Issue 29673576: Make new options page compatible with edge (Closed)
Left Patch Set: Created Jan. 18, 2018, 11:13 a.m.
Right Patch Set: dropped automatically inserted extra line Created Feb. 5, 2018, 9:44 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 | « no previous file | skin/desktop-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-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 515 matching lines...) Expand 10 before | Expand all | Expand 10 after
526 type + "_title"); 526 type + "_title");
527 } 527 }
528 528
529 addSubscription(subscription); 529 addSubscription(subscription);
530 } 530 }
531 }); 531 });
532 } 532 }
533 533
534 function findParentData(element, dataName, returnElement) 534 function findParentData(element, dataName, returnElement)
535 { 535 {
536 element = element.closest(`[data-${dataName}]`); 536 element = element.closest(`[data-${dataName}]`);
Thomas Greiner 2018/01/18 16:20:46 Nice, I wasn't even aware of this method. :)
saroyanm 2018/02/08 14:59:09 Detail: We are usually careful when it comes to ex
a.giammarchi 2018/02/08 15:07:21 FWIW closest is not really experimental, it has be
saroyanm 2018/02/08 15:20:18 According to MDN it is -> https://developer.mozill
a.giammarchi 2018/02/08 15:27:29 don't trust everything you read in MDN ... it's up
saroyanm 2018/02/08 15:38:30 Thanks for the links and info. Acknowledged.
537 if (element) 537 if (!element)
Thomas Greiner 2018/01/18 16:20:46 Detail: We can save one level of indentation by re
a.giammarchi 2018/01/19 17:02:28 Done.
538 { 538 return null;
539 if (returnElement) return element; 539 if (returnElement)
Thomas Greiner 2018/01/18 16:20:46 Detail: We tend to avoid single-line if-statements
a.giammarchi 2018/01/19 11:16:48 to be honest, there's no way I am going to remembe
Thomas Greiner 2018/01/19 13:55:16 Our coding style wasn't written with compatibility
a.giammarchi 2018/01/19 14:16:28 it's good you mentioned that ... 'cause I need a C
a.giammarchi 2018/01/19 17:02:28 Done.
a.giammarchi 2018/01/19 17:02:28 Done.
Thomas Greiner 2018/01/22 13:06:38 That's a very noble approach. I'd be curious to he
540 return element.getAttribute(`data-${dataName}`); 540 return element;
541 } 541 return element.getAttribute(`data-${dataName}`);
542 return null;
543 } 542 }
544 543
545 function sendMessageHandleErrors(message, onSuccess) 544 function sendMessageHandleErrors(message, onSuccess)
546 { 545 {
547 browser.runtime.sendMessage(message, (errors) => 546 browser.runtime.sendMessage(message, (errors) =>
548 { 547 {
549 if (errors.length > 0) 548 if (errors.length > 0)
550 alert(errors.join("\n")); 549 alert(errors.join("\n"));
551 else if (onSuccess) 550 else if (onSuccess)
552 onSuccess(); 551 onSuccess();
(...skipping 522 matching lines...) Expand 10 before | Expand all | Expand 10 after
1075 { 1074 {
1076 acceptableAds.setAttribute("aria-checked", true); 1075 acceptableAds.setAttribute("aria-checked", true);
1077 acceptableAdsPrivacy.setAttribute("aria-disabled", false); 1076 acceptableAdsPrivacy.setAttribute("aria-disabled", false);
1078 } 1077 }
1079 else if (acceptableAdsPrivacyUrl in subscriptionsMap) 1078 else if (acceptableAdsPrivacyUrl in subscriptionsMap)
1080 { 1079 {
1081 acceptableAds.setAttribute("aria-checked", true); 1080 acceptableAds.setAttribute("aria-checked", true);
1082 acceptableAdsPrivacy.setAttribute("aria-checked", true); 1081 acceptableAdsPrivacy.setAttribute("aria-checked", true);
1083 acceptableAdsPrivacy.setAttribute("aria-disabled", false); 1082 acceptableAdsPrivacy.setAttribute("aria-disabled", false);
1084 1083
1085 if (navigator.doNotTrack != 1) 1084 if (navigator.doNotTrack != 1)
saroyanm 2018/02/08 14:59:09 Edge uses window.doNotTrack: https://developer.mo
1086 acceptableAdsForm.classList.add("show-dnt-notification"); 1085 acceptableAdsForm.classList.add("show-dnt-notification");
1087 } 1086 }
1088 else 1087 else
1089 { 1088 {
1090 // Using aria-disabled in order to keep the focus 1089 // Using aria-disabled in order to keep the focus
1091 acceptableAdsPrivacy.setAttribute("aria-disabled", true); 1090 acceptableAdsPrivacy.setAttribute("aria-disabled", true);
1092 acceptableAdsPrivacy.setAttribute("tabindex", -1); 1091 acceptableAdsPrivacy.setAttribute("tabindex", -1);
1093 } 1092 }
1094 } 1093 }
1095 1094
(...skipping 368 matching lines...) Expand 10 before | Expand all | Expand 10 after
1464 }); 1463 });
1465 browser.runtime.sendMessage({ 1464 browser.runtime.sendMessage({
1466 type: "subscriptions.listen", 1465 type: "subscriptions.listen",
1467 filter: ["added", "disabled", "homepage", "lastDownload", "removed", 1466 filter: ["added", "disabled", "homepage", "lastDownload", "removed",
1468 "title", "downloadStatus", "downloading"] 1467 "title", "downloadStatus", "downloading"]
1469 }); 1468 });
1470 1469
1471 window.addEventListener("DOMContentLoaded", onDOMLoaded, false); 1470 window.addEventListener("DOMContentLoaded", onDOMLoaded, false);
1472 window.addEventListener("hashchange", onHashChange, false); 1471 window.addEventListener("hashchange", onHashChange, false);
1473 } 1472 }
LEFTRIGHT

Powered by Google App Engine
This is Rietveld