From 7c1c430097027eef508e2bd8317fc13179e8e89e Mon Sep 17 00:00:00 2001 From: Nate Goldman Date: Sat, 5 Mar 2016 20:33:00 -0800 Subject: [PATCH] hide header on video after mouse idle --- renderer/index.css | 19 ++++++++++++++++++- renderer/index.js | 6 ++++++ renderer/views/header.js | 14 ++++++++++---- 3 files changed, 34 insertions(+), 5 deletions(-) diff --git a/renderer/index.css b/renderer/index.css index 21604690..933bb377 100644 --- a/renderer/index.css +++ b/renderer/index.css @@ -102,11 +102,24 @@ a:not(.disabled):hover, i:not(.disabled):hover { */ .header { + background: rgb(40, 40, 40); border-bottom: 1px solid rgb(20, 20, 20); - height: 37px; + height: 38px; padding-top: 6px; overflow: hidden; flex: 0 1 auto; + opacity: 1; + position: fixed; + left: 0; + top: 0; + right: 0; + z-index: 1000; + transition: opacity 0.1s ease-out; +} + +.header.hide { + opacity: 0; + cursor: none; } .header .title { @@ -196,6 +209,10 @@ body.drag::before { * TORRENT LIST */ +.torrent-list { + margin-top: 38px; +} + .torrent { height: 120px; padding: 20px; diff --git a/renderer/index.js b/renderer/index.js index 0582b507..a04a8810 100644 --- a/renderer/index.js +++ b/renderer/index.js @@ -143,6 +143,8 @@ function dispatch (action, ...args) { setDimensions(args[0] /* dimensions */) } if (action === 'back') { + // TODO + // window.history.back() if (state.url === '/player') { restoreBounds() closeServer() @@ -150,6 +152,10 @@ function dispatch (action, ...args) { state.url = '/' update() } + if (action === 'forward') { + // TODO + // window.history.forward() + } if (action === 'playPause') { state.video.isPaused = !state.video.isPaused update() diff --git a/renderer/views/header.js b/renderer/views/header.js index d1cc92f2..bcd24e3f 100644 --- a/renderer/views/header.js +++ b/renderer/views/header.js @@ -5,21 +5,26 @@ var hyperx = require('hyperx') var hx = hyperx(h) function Header (state, dispatch) { - var navLeftStyle = process.platform === 'darwin' - ? {marginLeft: '78px'} /* OSX needs room on the left for min/max/close buttons */ - : null /* On Windows and Linux, the header is separate & underneath the title bar */ + var hideControls = state.url === '/player' && + state.video.mouseStationarySince !== 0 && + new Date().getTime() - state.video.mouseStationarySince > 2000 + var navLeftStyle = (process.platform === 'darwin' && !state.isFullScreen) + ? { marginLeft: '78px' } /* OSX needs room on the left for min/max/close buttons */ + : {} /* On Windows and Linux, the header is separate & underneath the title bar */ return hx` -
+
${getTitle()}