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

Unified Diff: js/desktop-options.js

Issue 29730617: Issue 6510 - Configure notification opens options page incorrectly (Closed)
Patch Set: Created March 22, 2018, 8: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 | « css/desktop-options.scss ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: js/desktop-options.js
===================================================================
--- a/js/desktop-options.js
+++ b/js/desktop-options.js
@@ -1348,21 +1348,26 @@
{
return browser.runtime.sendMessage({
type: "filters.get",
subscriptionUrl: subscription.url});
}
function hidePref(key, value)
{
- let element = document.querySelector("[data-pref='" + key + "']");
+ const element = getPrefElement(key);
if (element)
element.setAttribute("aria-hidden", value);
}
+function getPrefElement(key)
+{
+ return document.querySelector("[data-pref='" + key + "']");
+}
+
function getPref(key, callback)
{
let checkPref = getPref.checks[key] || getPref.checkNone;
checkPref((isActive) =>
{
if (!isActive)
{
hidePref(key, !isActive);
@@ -1447,17 +1452,26 @@
case "addSubscription":
let subscription = message.args[0];
let dialog = E("dialog-content-predefined");
dialog.querySelector("h3").textContent = subscription.title || "";
dialog.querySelector(".url").textContent = subscription.url;
openDialog("predefined");
break;
case "focusSection":
- document.body.setAttribute("data-tab", message.args[0]);
+ let section = message.args[0];
+ if (section == "notifications")
+ {
+ section = "advanced";
+ const elem = getPrefElement("notifications_ignoredcategories");
+ elem.classList.add("highlight-animate");
+ elem.querySelector("button").focus();
+ }
+
+ selectTabItem(section, document.body, false);
break;
}
break;
case "filters.respond":
onFilterMessage(message.action, message.args[0]);
break;
case "prefs.respond":
onPrefMessage(message.action, message.args[0], false);
« no previous file with comments | « css/desktop-options.scss ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld