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

Side by Side Diff: desktop-options.js

Issue 29683678: Issue 5542: Implement tooltips for new options page (Closed)
Patch Set: Created Jan. 29, 2018, 4:21 p.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 | skin/desktop-options.css » ('j') | 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",
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 465 matching lines...) Expand 10 before | Expand all | Expand 10 after
1400 } 1400 }
1401 1401
1402 function updateTooltips() 1402 function updateTooltips()
1403 { 1403 {
1404 let anchors = document.querySelectorAll(":not(.tooltip) > [data-tooltip]"); 1404 let anchors = document.querySelectorAll(":not(.tooltip) > [data-tooltip]");
1405 for (let anchor of anchors) 1405 for (let anchor of anchors)
1406 { 1406 {
1407 let id = anchor.getAttribute("data-tooltip"); 1407 let id = anchor.getAttribute("data-tooltip");
1408 1408
1409 let wrapper = document.createElement("div"); 1409 let wrapper = document.createElement("div");
1410 wrapper.setAttribute("aria-describedby", id);
1411 wrapper.setAttribute("tabindex", "0");
1410 wrapper.className = "icon tooltip"; 1412 wrapper.className = "icon tooltip";
1411 anchor.parentNode.replaceChild(wrapper, anchor); 1413 anchor.parentNode.replaceChild(wrapper, anchor);
1412 wrapper.appendChild(anchor); 1414 wrapper.appendChild(anchor);
1413 1415
1414 let tooltip = document.createElement("div"); 1416 let tooltip = document.createElement("div");
1417 tooltip.id = id;
1415 tooltip.setAttribute("role", "tooltip"); 1418 tooltip.setAttribute("role", "tooltip");
1416 1419
1417 let paragraph = document.createElement("p"); 1420 let paragraph = document.createElement("p");
1418 paragraph.textContent = getMessage(id); 1421 paragraph.textContent = getMessage(id);
1419 tooltip.appendChild(paragraph); 1422 tooltip.appendChild(paragraph);
1420 1423
1421 wrapper.appendChild(tooltip); 1424 wrapper.appendChild(tooltip);
1422 } 1425 }
1423 } 1426 }
1424 1427
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
1469 }); 1472 });
1470 browser.runtime.sendMessage({ 1473 browser.runtime.sendMessage({
1471 type: "subscriptions.listen", 1474 type: "subscriptions.listen",
1472 filter: ["added", "disabled", "homepage", "lastDownload", "removed", 1475 filter: ["added", "disabled", "homepage", "lastDownload", "removed",
1473 "title", "downloadStatus", "downloading"] 1476 "title", "downloadStatus", "downloading"]
1474 }); 1477 });
1475 1478
1476 window.addEventListener("DOMContentLoaded", onDOMLoaded, false); 1479 window.addEventListener("DOMContentLoaded", onDOMLoaded, false);
1477 window.addEventListener("hashchange", onHashChange, false); 1480 window.addEventListener("hashchange", onHashChange, false);
1478 } 1481 }
OLDNEW
« no previous file with comments | « no previous file | skin/desktop-options.css » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld