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

Side by Side 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.
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 | « css/desktop-options.scss ('k') | no next file » | 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 1335 matching lines...) Expand 10 before | Expand all | Expand 10 after
1346 1346
1347 function getSubscriptionFilters(subscription) 1347 function getSubscriptionFilters(subscription)
1348 { 1348 {
1349 return browser.runtime.sendMessage({ 1349 return browser.runtime.sendMessage({
1350 type: "filters.get", 1350 type: "filters.get",
1351 subscriptionUrl: subscription.url}); 1351 subscriptionUrl: subscription.url});
1352 } 1352 }
1353 1353
1354 function hidePref(key, value) 1354 function hidePref(key, value)
1355 { 1355 {
1356 let element = document.querySelector("[data-pref='" + key + "']"); 1356 const element = getPrefElement(key);
1357 if (element) 1357 if (element)
1358 element.setAttribute("aria-hidden", value); 1358 element.setAttribute("aria-hidden", value);
1359 } 1359 }
1360 1360
1361 function getPrefElement(key)
1362 {
1363 return document.querySelector("[data-pref='" + key + "']");
1364 }
1365
1361 function getPref(key, callback) 1366 function getPref(key, callback)
1362 { 1367 {
1363 let checkPref = getPref.checks[key] || getPref.checkNone; 1368 let checkPref = getPref.checks[key] || getPref.checkNone;
1364 checkPref((isActive) => 1369 checkPref((isActive) =>
1365 { 1370 {
1366 if (!isActive) 1371 if (!isActive)
1367 { 1372 {
1368 hidePref(key, !isActive); 1373 hidePref(key, !isActive);
1369 return; 1374 return;
1370 } 1375 }
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
1445 switch (message.action) 1450 switch (message.action)
1446 { 1451 {
1447 case "addSubscription": 1452 case "addSubscription":
1448 let subscription = message.args[0]; 1453 let subscription = message.args[0];
1449 let dialog = E("dialog-content-predefined"); 1454 let dialog = E("dialog-content-predefined");
1450 dialog.querySelector("h3").textContent = subscription.title || ""; 1455 dialog.querySelector("h3").textContent = subscription.title || "";
1451 dialog.querySelector(".url").textContent = subscription.url; 1456 dialog.querySelector(".url").textContent = subscription.url;
1452 openDialog("predefined"); 1457 openDialog("predefined");
1453 break; 1458 break;
1454 case "focusSection": 1459 case "focusSection":
1455 document.body.setAttribute("data-tab", message.args[0]); 1460 let section = message.args[0];
1461 if (section == "notifications")
1462 {
1463 section = "advanced";
1464 const elem = getPrefElement("notifications_ignoredcategories");
1465 elem.classList.add("highlight-animate");
1466 elem.querySelector("button").focus();
1467 }
1468
1469 selectTabItem(section, document.body, false);
1456 break; 1470 break;
1457 } 1471 }
1458 break; 1472 break;
1459 case "filters.respond": 1473 case "filters.respond":
1460 onFilterMessage(message.action, message.args[0]); 1474 onFilterMessage(message.action, message.args[0]);
1461 break; 1475 break;
1462 case "prefs.respond": 1476 case "prefs.respond":
1463 onPrefMessage(message.action, message.args[0], false); 1477 onPrefMessage(message.action, message.args[0], false);
1464 break; 1478 break;
1465 case "subscriptions.respond": 1479 case "subscriptions.respond":
(...skipping 17 matching lines...) Expand all
1483 "ui_warn_tracking"] 1497 "ui_warn_tracking"]
1484 }); 1498 });
1485 port.postMessage({ 1499 port.postMessage({
1486 type: "subscriptions.listen", 1500 type: "subscriptions.listen",
1487 filter: ["added", "disabled", "homepage", "lastDownload", "removed", 1501 filter: ["added", "disabled", "homepage", "lastDownload", "removed",
1488 "title", "downloadStatus", "downloading"] 1502 "title", "downloadStatus", "downloading"]
1489 }); 1503 });
1490 1504
1491 window.addEventListener("DOMContentLoaded", onDOMLoaded, false); 1505 window.addEventListener("DOMContentLoaded", onDOMLoaded, false);
1492 window.addEventListener("hashchange", onHashChange, false); 1506 window.addEventListener("hashchange", onHashChange, false);
OLDNEW
« 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