From b10a1bb32dbea187422a43487527c379a9ddbb26 Mon Sep 17 00:00:00 2001 From: TC Date: Sat, 6 Jul 2019 20:03:29 +0200 Subject: [PATCH] Fix navigation plugin --- plugins/navigation/back.js | 7 ++- plugins/navigation/front.js | 17 +++--- plugins/navigation/style.css | 36 ++++++++++++ plugins/navigation/templates/back.html | 70 +++++++++++++++------- plugins/navigation/templates/forward.html | 71 ++++++++++++++++------- 5 files changed, 149 insertions(+), 52 deletions(-) create mode 100644 plugins/navigation/style.css diff --git a/plugins/navigation/back.js b/plugins/navigation/back.js index f19bb7de..54ee18a7 100644 --- a/plugins/navigation/back.js +++ b/plugins/navigation/back.js @@ -1,7 +1,10 @@ -const { listenAction } = require("../utils"); -const { ACTIONS, CHANNEL } = require("./actions.js"); +const path = require("path"); + +const { injectCSS, listenAction } = require("../utils"); +const { ACTIONS, CHANNEL } = require("./actions.js"); function handle(win) { + injectCSS(win.webContents, path.join(__dirname, "style.css")); listenAction(CHANNEL, (event, action) => { switch (action) { case ACTIONS.NEXT: diff --git a/plugins/navigation/front.js b/plugins/navigation/front.js index 0d7848d2..92bc1325 100644 --- a/plugins/navigation/front.js +++ b/plugins/navigation/front.js @@ -1,14 +1,15 @@ -const { ElementFromFile, templatePath } = require('../utils'); +const { ElementFromFile, templatePath } = require("../utils"); function run() { - const forwardButton = ElementFromFile(templatePath(__dirname, 'forward.html')); - const backButton = ElementFromFile(templatePath(__dirname, 'back.html')); - const menu = document.querySelector("ytmusic-pivot-bar-renderer"); + const forwardButton = ElementFromFile( + templatePath(__dirname, "forward.html") + ); + const backButton = ElementFromFile(templatePath(__dirname, "back.html")); + const menu = document.querySelector("ytmusic-pivot-bar-renderer"); - if (menu) { - menu.prepend(forwardButton); - menu.prepend(backButton); - } + if (menu) { + menu.prepend(backButton, forwardButton); + } } module.exports = run; diff --git a/plugins/navigation/style.css b/plugins/navigation/style.css new file mode 100644 index 00000000..5c7331cd --- /dev/null +++ b/plugins/navigation/style.css @@ -0,0 +1,36 @@ +.navigation-item { + font-family : Roboto, Noto Naskh Arabic UI, Arial, sans-serif; + font-size : 20px; + line-height : var(--ytmusic-title-1_-_line-height); + font-weight : 500; + color : #fff; + --yt-endpoint-color : #fff; + --yt-endpoint-hover-color : #fff; + --yt-endpoint-visited-color: #fff; + display : inline-flex; + align-items : center; + color : rgba(255, 255, 255, 0.5); + cursor : pointer; + margin : 0 var(--ytmusic-pivot-bar-tab-margin); +} + +.navigation-item:hover { + color: #fff; +} + +.navigation-icon { + display : inline-flex; + -ms-flex-align : center; + -webkit-align-items : center; + align-items : center; + -ms-flex-pack : center; + -webkit-justify-content: center; + justify-content : center; + position : relative; + vertical-align : middle; + fill : var(--iron-icon-fill-color, currentcolor); + stroke : none; + width : var(--iron-icon-width, 24px); + height : var(--iron-icon-height, 24px); + animation : var(--iron-icon_-_animation); +} diff --git a/plugins/navigation/templates/back.html b/plugins/navigation/templates/back.html index eda72891..157a4613 100644 --- a/plugins/navigation/templates/back.html +++ b/plugins/navigation/templates/back.html @@ -1,21 +1,51 @@ - - - - - - - - - + diff --git a/plugins/navigation/templates/forward.html b/plugins/navigation/templates/forward.html index 0e5c5f5e..252a8721 100644 --- a/plugins/navigation/templates/forward.html +++ b/plugins/navigation/templates/forward.html @@ -1,26 +1,53 @@ - - - - - +
+ + + - - - - + c5.076-5.084,7.864-11.872,7.848-19.088C390.542,238.668,387.754,231.884,382.678,226.804z" + class="style-scope yt-icon" + > + + +
- - - - - + + +