Skip to content

Commit e092dbe

Browse files
also hide titlebar when autohideControls = true
1 parent e4a6896 commit e092dbe

3 files changed

Lines changed: 38 additions & 16 deletions

File tree

src/player/modules/Sidebar/style.css

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,10 @@
88
color: #cececb;
99
font-weight: 100;
1010
z-index: 4;
11-
/*box-shadow: 0 0 2px 1px #000;*/
12-
-webkit-transition: all 200ms linear; /* Firefox */
13-
-moz-transition: all 200ms linear; /* WebKit */
14-
-o-transition: all 200ms linear; /* Opera */
15-
transition: all 200ms linear; /* Standard */
11+
transition: all 200ms linear;
12+
overflow-x: hidden;
13+
overflow-y: auto;
14+
scrollbar-width: thin;
1615
}
1716

1817
.sidebar.open {

src/player/modules/ViewVideo/module.js

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -722,12 +722,13 @@ FrameTrail.defineModule('ViewVideo', function(FrameTrail){
722722

723723
var isMobileWidth = (_target.offsetWidth <= 768),
724724
inEditMode = (FrameTrail.getState('editMode') != false && FrameTrail.getState('editMode') != 'preview' && FrameTrail.getState('editMode') != 'layout'),
725+
autohideTitlebar = (FrameTrail.getState('hv_config_autohideControls') && FrameTrail.getState('editMode') == false),
725726
editBorder = (FrameTrail.getState('editMode') != false) ? (parseInt(getComputedStyle(domElement).borderTopWidth)*2) : 0,
726727
mainContainerWidth = _target.offsetWidth
727728
- ((FrameTrail.getState('sidebarOpen') && !FrameTrail.getState('fullscreen')) ? FrameTrail.module('Sidebar').width : 0)
728729
- editBorder,
729730
mainContainerHeight = _target.offsetHeight
730-
- _titlebar.offsetHeight
731+
- (autohideTitlebar ? 0 : _titlebar.offsetHeight)
731732
- editBorder,
732733
_video = Video,
733734
videoFit = (FrameTrail.module('Database').config.videoFit) ? FrameTrail.module('Database').config.videoFit : 'contain';
@@ -1163,13 +1164,16 @@ FrameTrail.defineModule('ViewVideo', function(FrameTrail){
11631164
*/
11641165
function toggleConfig_autohideControls(newState, oldState) {
11651166

1167+
var _target = document.querySelector(FrameTrail.getState('target'));
11661168
if (newState) {
1167-
document.body.classList.add('autohideControls');
1169+
_target.classList.add('autohideControls');
11681170
} else {
1169-
document.body.classList.remove('autohideControls');
1170-
document.body.classList.remove('userinactive');
1171+
_target.classList.remove('autohideControls');
1172+
_target.classList.remove('userinactive');
11711173
}
11721174

1175+
adjustHypervideo();
1176+
11731177
};
11741178

11751179

@@ -1532,10 +1536,11 @@ FrameTrail.defineModule('ViewVideo', function(FrameTrail){
15321536
function toggleUserActive(activeState) {
15331537

15341538
if (FrameTrail.getState('hv_config_autohideControls')) {
1539+
var _target = document.querySelector(FrameTrail.getState('target'));
15351540
if (activeState) {
1536-
document.body.classList.remove('userinactive');
1541+
_target.classList.remove('userinactive');
15371542
} else {
1538-
document.body.classList.add('userinactive');
1543+
_target.classList.add('userinactive');
15391544
}
15401545
}
15411546

src/player/modules/ViewVideo/style.css

Lines changed: 23 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -80,8 +80,9 @@
8080
}
8181

8282
/* Autohide: overlay controls on top of the video so no empty space remains.
83-
Active in player mode and preview mode, but not in real edit modes. */
84-
body.autohideControls .mainContainer:not([data-edit-mode="overlays"]):not([data-edit-mode="annotations"]):not([data-edit-mode="codesnippets"]):not([data-edit-mode="layout"]) .playerContainer .controls {
83+
Active in player mode and preview mode, but not in real edit modes.
84+
Classes are set on the target element (.frametrail-body), not body. */
85+
.autohideControls .mainContainer:not([data-edit-mode="overlays"]):not([data-edit-mode="annotations"]):not([data-edit-mode="codesnippets"]):not([data-edit-mode="layout"]) .playerContainer .controls {
8586
position: absolute;
8687
bottom: 0;
8788
left: 0;
@@ -90,7 +91,7 @@ body.autohideControls .mainContainer:not([data-edit-mode="overlays"]):not([data-
9091
transition: visibility 0.4s, opacity 0.4s;
9192
}
9293

93-
body.autohideControls .mainContainer:not([data-edit-mode="overlays"]):not([data-edit-mode="annotations"]):not([data-edit-mode="codesnippets"]):not([data-edit-mode="layout"]) .playerContainer .playerProgress {
94+
.autohideControls .mainContainer:not([data-edit-mode="overlays"]):not([data-edit-mode="annotations"]):not([data-edit-mode="codesnippets"]):not([data-edit-mode="layout"]) .playerContainer .playerProgress {
9495
position: absolute;
9596
bottom: 40px;
9697
left: 0;
@@ -99,14 +100,31 @@ body.autohideControls .mainContainer:not([data-edit-mode="overlays"]):not([data-
99100
transition: visibility 0.4s, opacity 0.4s;
100101
}
101102

102-
body.userinactive .mainContainer:not([data-edit-mode="overlays"]):not([data-edit-mode="annotations"]):not([data-edit-mode="codesnippets"]):not([data-edit-mode="layout"]) .playerContainer .controls,
103-
body.userinactive .mainContainer:not([data-edit-mode="overlays"]):not([data-edit-mode="annotations"]):not([data-edit-mode="codesnippets"]):not([data-edit-mode="layout"]) .playerContainer .playerProgress {
103+
/* Titlebar: only autohide when NOT in edit mode (not even preview) */
104+
.autohideControls:has(.mainContainer:not(.editActive)) > .titlebar {
105+
position: absolute;
106+
top: 0;
107+
left: 0;
108+
right: 0;
109+
width: 100%;
110+
background: var(--secondary-bg-color);
111+
transition: visibility 0.4s, opacity 0.4s;
112+
}
113+
114+
.userinactive .mainContainer:not([data-edit-mode="overlays"]):not([data-edit-mode="annotations"]):not([data-edit-mode="codesnippets"]):not([data-edit-mode="layout"]) .playerContainer .controls,
115+
.userinactive .mainContainer:not([data-edit-mode="overlays"]):not([data-edit-mode="annotations"]):not([data-edit-mode="codesnippets"]):not([data-edit-mode="layout"]) .playerContainer .playerProgress {
104116
display: block;
105117
visibility: hidden;
106118
opacity: 0;
107119
transition: visibility 1.5s, opacity 1.5s;
108120
}
109121

122+
.userinactive:has(.mainContainer:not(.editActive)) > .titlebar {
123+
visibility: hidden;
124+
opacity: 0;
125+
transition: visibility 1.5s, opacity 1.5s;
126+
}
127+
110128
/* Progress Bar */
111129

112130
.playerContainer .playerProgress {

0 commit comments

Comments
 (0)