Bug 738796 - Update category navigation. r=jaws
This commit is contained in:
@@ -32,10 +32,8 @@ function init_all() {
|
||||
|
||||
let categories = document.getElementById("categories");
|
||||
categories.addEventListener("select", event => gotoPref(event.target.value));
|
||||
window.addEventListener("popstate", event => selectCategory(event.state));
|
||||
|
||||
if (history.length > 1 && history.state) {
|
||||
updateCommands();
|
||||
selectCategory(history.state);
|
||||
} else {
|
||||
history.replaceState("paneGeneral", document.title);
|
||||
@@ -49,38 +47,9 @@ function selectCategory(name) {
|
||||
}
|
||||
|
||||
function gotoPref(page) {
|
||||
if (history.state != page) {
|
||||
window.history.pushState(page, document.title);
|
||||
}
|
||||
|
||||
updateCommands();
|
||||
window.history.replaceState(page, document.title);
|
||||
search(page, "data-category");
|
||||
}
|
||||
|
||||
function cmd_back() {
|
||||
window.history.back();
|
||||
}
|
||||
|
||||
function cmd_forward() {
|
||||
window.history.forward();
|
||||
}
|
||||
|
||||
function updateCommands() {
|
||||
document.getElementById("back-btn").disabled = !canGoBack();
|
||||
document.getElementById("forward-btn").disabled = !canGoForward();
|
||||
}
|
||||
|
||||
function canGoBack() {
|
||||
return window.QueryInterface(Ci.nsIInterfaceRequestor)
|
||||
.getInterface(Ci.nsIWebNavigation)
|
||||
.canGoBack;
|
||||
}
|
||||
|
||||
function canGoForward() {
|
||||
return window.QueryInterface(Ci.nsIInterfaceRequestor)
|
||||
.getInterface(Ci.nsIWebNavigation)
|
||||
.canGoForward;
|
||||
}
|
||||
|
||||
function search(aQuery, aAttribute) {
|
||||
let elements = document.getElementById("mainPrefPane").children;
|
||||
|
||||
@@ -74,15 +74,6 @@
|
||||
src="chrome://browser/locale/preferences/applicationManager.properties"/>
|
||||
</stringbundleset>
|
||||
|
||||
<hbox id="header">
|
||||
<toolbarbutton id="back-btn" class="nav-button header-button"
|
||||
oncommand="cmd_back()" tooltiptext="&buttonBack.tooltip;"
|
||||
disabled="true"/>
|
||||
<toolbarbutton id="forward-btn" class="nav-button header-button"
|
||||
oncommand="cmd_forward()" tooltiptext="&buttonForward.tooltip;"
|
||||
disabled="true"/>
|
||||
</hbox>
|
||||
|
||||
<hbox flex="1">
|
||||
|
||||
<!-- category list -->
|
||||
|
||||
Reference in New Issue
Block a user