Skip to content

Commit

Permalink
Tidy up a little
Browse files Browse the repository at this point in the history
  • Loading branch information
hawkeye116477 committed Dec 21, 2019
1 parent a9b2e7e commit 1dcaa15
Show file tree
Hide file tree
Showing 3 changed files with 84 additions and 64 deletions.
72 changes: 43 additions & 29 deletions browser/base/content/utilityOverlay.js
Expand Up @@ -1246,54 +1246,64 @@ function resetZoomStatus() {


function updateZoomStatus() {
var zoomValue = windowRoot.ownerGlobal.ZoomManager.getZoomForBrowser(windowRoot.ownerGlobal.gBrowser)
var zoomValue = windowRoot.ownerGlobal.ZoomManager.getZoomForBrowser(windowRoot.ownerGlobal.gBrowser);
var resetZoomBtn = windowRoot.ownerGlobal.document.querySelector('.reset-zoom.button-textonly');
windowRoot.ownerGlobal.document.querySelector('#zoom-range-status').value = zoomValue;
var zoomPercentValue = parseInt(zoomValue * 100);
windowRoot.ownerGlobal.document.querySelector('.zoom-percent-status').textContent = zoomPercentValue +' %';
if (zoomPercentValue != 100){
windowRoot.ownerGlobal.document.querySelector('.reset-zoom.button-textonly').disabled = "";
resetZoomBtn.disabled = "";
}
else
{
windowRoot.ownerGlobal.document.querySelector('.reset-zoom.button-textonly').disabled = "true";
resetZoomBtn.disabled = "true";
}
}

function toggleStatusBar() {
var statuspanel = windowRoot.ownerGlobal.document.getElementById("statuspanel");
var statusbar = windowRoot.ownerGlobal.document.querySelector(".toolbar-statusbar");
var zoombtn = windowRoot.ownerGlobal.document.querySelector("#urlbar-zoom-button");
var pageActionSeparator = windowRoot.ownerGlobal.document.querySelector("#pageActionSeparator");

if (Services.prefs.getIntPref("browser.statusbar.mode") == 2) {
windowRoot.ownerGlobal.document.getElementById("statuspanel").hidden = true;
windowRoot.ownerGlobal.document.querySelector(".toolbar-statusbar").style.display = "flex";
windowRoot.ownerGlobal.document.querySelector("#urlbar-zoom-button").style.display = "none";
windowRoot.ownerGlobal.document.querySelector("#pageActionSeparator").style.display = "none";
statuspanel.hidden = true;
statusbar.style.display = "flex";
zoombtn.style.display = "none";
pageActionSeparator.style.display = "none";
}
else if (Services.prefs.getIntPref("browser.statusbar.mode") == 1) {
windowRoot.ownerGlobal.document.querySelector(".toolbar-statusbar").style.display = "none";
windowRoot.ownerGlobal.document.querySelector("#urlbar-zoom-button").style.display = "";
windowRoot.ownerGlobal.document.getElementById("statuspanel").hidden = "";
windowRoot.ownerGlobal.document.querySelector("#pageActionSeparator").style.display = "";
windowRoot.ownerGlobal.document.querySelector("#pageActionSeparator").style.visibility = "visible";
statusbar.style.display = "none";
zoombtn.style.display = "";
statuspanel.hidden = "";
pageActionSeparator.style.display = "";
pageActionSeparator.style.visibility = "visible";
}
else if (Services.prefs.getIntPref("browser.statusbar.mode") == 0) {
windowRoot.ownerGlobal.document.querySelector(".toolbar-statusbar").style.display = "none";
windowRoot.ownerGlobal.document.getElementById("statuspanel").hidden = true;
windowRoot.ownerGlobal.document.querySelector("#urlbar-zoom-button").style.display = "";
windowRoot.ownerGlobal.document.querySelector("#pageActionSeparator").style.display = "";
windowRoot.ownerGlobal.document.querySelector("#pageActionSeparator").style.visibility = "visible";
statusbar.style.display = "none";
statuspanel.hidden = true;
zoombtn.style.display = "";
pageActionSeparator.style.display = "";
pageActionSeparator.style.visibility = "visible";
}
}

function showBtnRange() {
var zoomoutsb = windowRoot.ownerGlobal.document.querySelector("#zoomoutsb");
var zoominsb = windowRoot.ownerGlobal.document.querySelector("#zoominsb");
var zoomStatus = windowRoot.ownerGlobal.document.querySelector("#zoom-range-status");

if (Services.prefs.getIntPref("browser.statusbar.mode") == 2) {
if(Services.prefs.getBoolPref("browser.statusbar.showbtn", true)) {
windowRoot.ownerGlobal.document.querySelector("#zoomoutsb").style.display = "initial";
windowRoot.ownerGlobal.document.querySelector("#zoominsb").style.display = "initial";
windowRoot.ownerGlobal.document.querySelector("#zoom-range-status").style.display = "none";
zoomoutsb.style.display = "initial";
zoominsb.style.display = "initial";
zoomStatus.style.display = "none";
}
else
{
windowRoot.ownerGlobal.document.querySelector("#zoomoutsb").style.display = "none";
windowRoot.ownerGlobal.document.querySelector("#zoominsb").style.display = "none";
windowRoot.ownerGlobal.document.querySelector("#zoom-range-status").style.display = "initial";
zoomoutsb.style.display = "none";
zoominsb.style.display = "none";
zoomStatus.style.display = "initial";
}
}
}
Expand Down Expand Up @@ -1340,17 +1350,21 @@ function moveTabBar()
}

function moveWindowControls() {
var titlebarButtonbox = windowRoot.ownerGlobal.document.querySelector(".titlebar-buttonbox");
var windowControls = windowRoot.ownerGlobal.document.querySelector("#window-controls");
var tabsToolbar = windowRoot.ownerGlobal.document.querySelector("#TabsToolbar");

if(Services.prefs.getStringPref("browser.windowControls.position") == "left")
{
windowRoot.ownerGlobal.document.querySelector(".titlebar-buttonbox").classList.add("left");
windowRoot.ownerGlobal.document.querySelector("#window-controls").classList.add("left");
windowRoot.ownerGlobal.document.querySelector("#TabsToolbar").classList.add("leftWindowControls");
titlebarButtonbox.classList.add("left");
windowControls.classList.add("left");
tabsToolbar.classList.add("leftWindowControls");
}
else
{
windowRoot.ownerGlobal.document.querySelector(".titlebar-buttonbox").classList.remove("left");
windowRoot.ownerGlobal.document.querySelector("#window-controls").classList.remove("left");
windowRoot.ownerGlobal.document.querySelector("#TabsToolbar").classList.remove("leftWindowControls");
titlebarButtonbox.classList.remove("left");
windowControls.classList.remove("left");
tabsToolbar.classList.remove("leftWindowControls");
}
}

Expand Down
72 changes: 37 additions & 35 deletions browser/components/preferences/in-content-all-new/appearance.xul
Expand Up @@ -10,31 +10,31 @@
<groupbox id="preferencesGroup"
data-category="paneAppearance"
hidden="true">
<label><html:h2 data-l10n-id="settings-page"/></label>
<label><html:h2 data-l10n-id="pane-windowAppearance-title"/></label>
<label><html:h3 data-l10n-id="settings-page"/></label>

<checkbox id="browser.preferences.useAllNew" data-l10n-id="display-all-new-prefs"
preference="browser.preferences.useAllNew"/>
</groupbox>

<!-- Restart Menu Item preferences -->
<groupbox id="restartGroup"
<!-- Window Controls Position preferences -->
<groupbox id="windowControlsGroup"
data-category="paneAppearance"
hidden="true">
<label><html:h2 data-l10n-id="restart-header"/></label>

<checkbox id="browser.restart_menu.showpanelmenubtn" data-l10n-id="restart-paneluibtn"
preference="browser.restart_menu.showpanelmenubtn"/>
<checkbox id="browser.restart_menu.purgecache" data-l10n-id="clean-fast-restart-cache"
preference="browser.restart_menu.purgecache"/>
<checkbox id="browser.restart_menu.requireconfirm" data-l10n-id="restart-reqconfirmation"
preference="browser.restart_menu.requireconfirm"/>
</groupbox>
<label><html:h3 data-l10n-id="window-controls-position-header"/></label>
<radiogroup id="windowControlsRadioGroup" preference="browser.windowControls.position" onsyncfrompreference="gAppearancePane.toggleMoveWindowControls(); moveWindowControls();">
<radio value="right"
data-l10n-id="right-side"/>
<radio value="left"
data-l10n-id="left-side"/>
</radiogroup>
</groupbox>

<!-- Status Bar preferences -->
<groupbox id="statusBarGroup"
data-category="paneAppearance"
hidden="true">
<label><html:h2 data-l10n-id="statusBar-header"/></label>
<label><html:h3 data-l10n-id="statusBar-header"/></label>
<vbox id="statusBarContainer">
<radiogroup id="statusBarRadioGroup" preference="browser.statusbar.mode" onsyncfrompreference="toggleStatusBar();">
<radio id="showStatusBar"
Expand All @@ -53,24 +53,39 @@
</vbox>
</groupbox>

<!-- Window Controls Position preferences -->
<groupbox id="windowControlsGroup"
<!-- Bookmarks Toolbar Position preferences -->
<groupbox id="bookmarksBarPositionGroup"
data-category="paneAppearance"
hidden="true">
<label><html:h2 data-l10n-id="window-controls-position-header"/></label>
<radiogroup id="windowControlsRadioGroup" preference="browser.windowControls.position" onsyncfrompreference="gAppearancePane.toggleMoveWindowControls(); moveWindowControls();">
<radio value="right"
data-l10n-id="right-side"/>
<radio value="left"
data-l10n-id="left-side"/>
<label><html:h3 data-l10n-id="bookmarks-bar-position-header"/></label>
<radiogroup id="bookmarksBarPositionRadioGroup" preference="browser.bookmarksBar.position" onsyncfrompreference="moveBookmarksBar();">
<radio value="top"
data-l10n-id="top-bookmarks"/>
<radio value="bottom"
data-l10n-id="tab-bottom"/>
</radiogroup>
</groupbox>

<!-- Restart Menu Item preferences -->
<groupbox id="restartGroup"
data-category="paneAppearance"
hidden="true">
<label><html:h2 data-l10n-id="pane-menu-title"/></label>
<label><html:h3 data-l10n-id="restart-header"/></label>

<checkbox id="browser.restart_menu.showpanelmenubtn" data-l10n-id="restart-paneluibtn"
preference="browser.restart_menu.showpanelmenubtn"/>
<checkbox id="browser.restart_menu.purgecache" data-l10n-id="clean-fast-restart-cache"
preference="browser.restart_menu.purgecache"/>
<checkbox id="browser.restart_menu.requireconfirm" data-l10n-id="restart-reqconfirmation"
preference="browser.restart_menu.requireconfirm"/>
</groupbox>

<!-- Menu Icon Style preferences -->
<groupbox id="menuIconStyleGroup"
data-category="paneAppearance"
hidden="true">
<label><html:h2 data-l10n-id="menu-icon-style-header"/></label>
<label><html:h3 data-l10n-id="menu-icon-style-header"/></label>
<radiogroup id="menuIconStyleRadioGroup" preference="browser.menuIcon.style" onsyncfrompreference="changeMenuIconStyle();">
<radio value="0"
data-l10n-id="menu-icon"/>
Expand All @@ -79,17 +94,4 @@
</radiogroup>
</groupbox>

<!-- Bookmarks Toolbar Position preferences -->
<groupbox id="bookmarksBarPositionGroup"
data-category="paneAppearance"
hidden="true">
<label><html:h2 data-l10n-id="bookmarks-bar-position-header"/></label>
<radiogroup id="bookmarksBarPositionRadioGroup" preference="browser.bookmarksBar.position" onsyncfrompreference="moveBookmarksBar();">
<radio value="top"
data-l10n-id="top-bookmarks"/>
<radio value="bottom"
data-l10n-id="tab-bottom"/>
</radiogroup>
</groupbox>

</html:template>
4 changes: 4 additions & 0 deletions browser/locales/en-US/browser/preferences/preferences.ftl
Expand Up @@ -1179,3 +1179,7 @@ bookmarks-bar-position-header = Bookmarks Toolbar Position
top-bookmarks =
.label = Top
pane-windowAppearance-title = Window Appearance
pane-menu-title = Menu

0 comments on commit 1dcaa15

Please sign in to comment.