Skip to content

Commit 575e3f8

Browse files
committed
added autohide for fullscreen mode
1 parent 57c0d73 commit 575e3f8

File tree

1 file changed

+39
-1
lines changed

1 file changed

+39
-1
lines changed

common/content/commandline.js

Lines changed: 39 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
let timeID = null;
1515

1616
const CommandLine = Module("commandline", {
17-
requires: ["config", "liberator", "modes", "services", "storage", "template", "util"],
17+
requires: ["config", "liberator", "modes", "services", "storage", "template", "util", "styles"],
1818

1919
init: function () {
2020
const self = this;
@@ -26,6 +26,9 @@ const CommandLine = Module("commandline", {
2626
storage.newArray(liberator.storeName(mode, isPrivate), { store: !isPrivate});
2727
}, this);
2828

29+
liberator.registerObserver("fullscreen", this.updateBottombar);
30+
liberator.registerObserver("modeChange", this.updateBottombar);
31+
2932
// Really inideal.
3033
let services = modules.services; // Storage objects are global to all windows, 'modules' isn't.
3134
storage.newObject("sanitize", function () {
@@ -180,6 +183,9 @@ const CommandLine = Module("commandline", {
180183

181184
this._commandlineDisplayTimeoutID = null;
182185

186+
this._bottomBarHidden = false;
187+
this._hlContentSepValue;
188+
183189
this.registerCallback("submit", modes.EX, function (command) {
184190
if (self._commandlineDisplayTimeoutID) {
185191
window.clearTimeout(self._commandlineDisplayTimeoutID);
@@ -560,6 +566,38 @@ const CommandLine = Module("commandline", {
560566
this._setPrompt("");
561567
},
562568

569+
/**
570+
* Callback function for updating the Bottombar
571+
*/
572+
updateBottombar: function (){
573+
hide = window.fullScreen && liberator.mode == 1;
574+
commandline.hideBottombar(hide);
575+
},
576+
/**
577+
* Totally hides the vimperator bar at the bottom of the screen (for fullscreen mode)
578+
*/
579+
hideBottombar: function (hide){
580+
if( hide == this._bottomBarHidden)
581+
return;
582+
this._bottomBarHidden = hide;
583+
let bb = document.getElementById('liberator-bottombar');
584+
if (! bb)
585+
return;
586+
587+
if (hide) {
588+
this._hlContentSepValue = highlight.get('ContentSeparator').value;
589+
bb.style.height = '0px';
590+
bb.style.overflow = 'hidden';
591+
highlight.set('ContentSeparator', 'display:none', true, false);
592+
}
593+
else {
594+
bb.style.height = '';
595+
bb.style.overflow = '';
596+
highlight.set('ContentSeparator', this._hlContentSepValue, true, false);
597+
}
598+
},
599+
600+
563601
/**
564602
* Make the command line visible, hiding the status messages below
565603
*

0 commit comments

Comments
 (0)