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: Created Aug. 24, 2017, 5:35 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
« no previous file with comments | « new-options.html ('k') | skin/abp-logo.svg » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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(",");
@@ -787,7 +772,7 @@
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);
@@ -829,14 +814,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 +831,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 +1122,6 @@
case "added":
filter[timestampUI] = Date.now();
updateFilter(filter);
- updateShareLink();
break;
case "loaded":
populateLists();
@@ -1149,7 +1134,6 @@
removeCustomFilter(filter.text);
delete filtersMap[filter.text];
- updateShareLink();
break;
}
}
@@ -1213,7 +1197,6 @@
break;
}
- updateShareLink();
}
function hidePref(key, value)
@@ -1274,30 +1257,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]");
« no previous file with comments | « new-options.html ('k') | skin/abp-logo.svg » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld