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

Unified Diff: new-options.js

Issue 29502647: Issue 5482 - Sidebar and about ABP dialog (Closed)
Patch Set: Fixed tabulation Created Aug. 23, 2017, 1:31 p.m.
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: new-options.js
===================================================================
--- a/new-options.js
+++ b/new-options.js
@@ -526,17 +526,6 @@
});
}
- function openDocLink(id)
- {
- getDocLink(id, (link) =>
- {
- if (id == "share-general")
- openSharePopup(link);
- else
- location.href = link;
- });
- }
-
function switchTab(id)
{
location.hash = id;
@@ -605,11 +594,6 @@
openDialog(dialog);
break;
}
- case "open-doclink": {
- let doclink = findParentData(element, "doclink", false);
- openDocLink(doclink);
- break;
- }
case "remove-filter":
ext.backgroundPage.sendMessage({
type: "filters.remove",
@@ -646,8 +630,7 @@
});
break;
case "switch-tab":
- let tabId = findParentData(element, "tab", false);
- switchTab(tabId);
+ switchTab(element.getAttribute("href").substr(1));
break;
case "toggle-disable-subscription":
ext.backgroundPage.sendMessage({
@@ -760,10 +743,12 @@
if (element.getAttribute("role") == "tab")
{
+ let parent = element.parentElement;
if (key == "ArrowLeft" || key == "ArrowUp")
- element = element.previousElementSibling || container.lastElementChild;
+ parent = parent.previousElementSibling || container.lastElementChild;
else if (key == "ArrowRight" || key == "ArrowDown")
- element = element.nextElementSibling || container.firstElementChild;
+ parent = parent.nextElementSibling || container.firstElementChild;
+ element = parent.firstElementChild;
}
let actions = container.getAttribute("data-action").split(",");
@@ -785,11 +770,9 @@
let previousTab = tabList.querySelector("[aria-selected]");
previousTab.removeAttribute("aria-selected");
- previousTab.setAttribute("tabindex", -1);
- let tab = tabList.querySelector("li[data-tab='" + tabId + "']");
+ let tab = tabList.querySelector("a[href='#" + tabId + "']");
tab.setAttribute("aria-selected", true);
- tab.setAttribute("tabindex", 0);
let tabContentId = tab.getAttribute("aria-controls");
let tabContent = document.getElementById(tabContentId);
@@ -829,14 +812,10 @@
},
(addonVersion) =>
{
- E("abp-version").textContent = addonVersion;
- });
- getDocLink("releases", (link) =>
- {
- E("link-version").setAttribute("href", link);
+ E("abp-version").textContent = getMessage("options_dialog_about_version",
+ [addonVersion]);
});
- updateShareLink();
updateTooltips();
// Initialize interactive UI elements
@@ -850,6 +829,11 @@
E("whitelisting-add-button").disabled = !e.target.value;
}, false);
+
+ getDocLink("contribute", (link) =>
+ {
+ E("contribute").href = link;
+ });
getDocLink("acceptable_ads_criteria", (link) =>
{
setLinks("enable-aa-description", link);
@@ -1136,7 +1120,6 @@
case "added":
filter[timestampUI] = Date.now();
updateFilter(filter);
- updateShareLink();
break;
case "loaded":
populateLists();
@@ -1149,7 +1132,6 @@
removeCustomFilter(filter.text);
delete filtersMap[filter.text];
- updateShareLink();
break;
}
}
@@ -1213,7 +1195,6 @@
break;
}
- updateShareLink();
}
function hidePref(key, value)
@@ -1274,30 +1255,6 @@
checkbox.setAttribute("aria-checked", value);
}
- function updateShareLink()
- {
- let shareResources = [
- "https://facebook.com/plugins/like.php?",
- "https://platform.twitter.com/widgets/",
- "https://apis.google.com/se/0/_/+1/fastbutton?"
- ];
- let isAnyBlocked = false;
- let checksRemaining = shareResources.length;
-
- function onResult(isBlocked)
- {
- isAnyBlocked |= isBlocked;
- if (!--checksRemaining)
- {
- // Hide the share tab if a script on the share page would be blocked
- E("tab-share").hidden = isAnyBlocked;
- }
- }
-
- for (let sharedResource of shareResources)
- checkShareResource(sharedResource, onResult);
- }
-
function updateTooltips()
{
let anchors = document.querySelectorAll(":not(.tooltip) > [data-tooltip]");

Powered by Google App Engine
This is Rietveld