From 6c747faccfc2c4200b1eef11fc8f67527b5539a6 Mon Sep 17 00:00:00 2001 From: Rob Garrison Date: Sun, 10 Mar 2019 10:53:54 -0500 Subject: [PATCH] Change new style into a dropdown --- _locales/en/messages.json | 8 ++++++++ manage.html | 8 ++++++-- manage/manage-actions.js | 7 +++++++ manage/manage.css | 9 ++++++++- 4 files changed, 29 insertions(+), 3 deletions(-) diff --git a/_locales/en/messages.json b/_locales/en/messages.json index 6780c0d3..4884df69 100644 --- a/_locales/en/messages.json +++ b/_locales/en/messages.json @@ -3,6 +3,14 @@ "message": "Write new style", "description": "Label for the button to go to the add style page" }, + "addPlainStyleLabel": { + "message": "New plain style", + "description": "Label for the button to go to the add style page" + }, + "addUserCSSStyleLabel": { + "message": "New UserCSS style", + "description": "Label for the button to go to the add style page" + }, "addStyleTitle": { "message": "Add Style", "description": "Title of the page for adding styles" diff --git a/manage.html b/manage.html index 0b002f61..1e0d2ea4 100644 --- a/manage.html +++ b/manage.html @@ -221,12 +221,16 @@
- +
- + +
diff --git a/manage/manage-actions.js b/manage/manage-actions.js index 8d103fe0..21aa30fa 100644 --- a/manage/manage-actions.js +++ b/manage/manage-actions.js @@ -79,6 +79,7 @@ function initGlobalEvents() { } $$('#header a[href^="http"]').forEach(a => (a.onclick = handleEvent.external)); + $$('#add-usercss, #add-reg-css').forEach(a => (a.onclick = handleEvent.newStyle)); document.addEventListener('visibilitychange', onVisibilityChange); @@ -162,6 +163,12 @@ Object.assign(handleEvent, { handleEvent.edit(event); }, + newStyle(event) { + event.preventDefault(); + prefs.set('newStyleAsUsercss', event.target.id === 'add-usercss'); + window.location.href = 'edit.html'; + }, + edit(event) { if (event.altKey) { return; diff --git a/manage/manage.css b/manage/manage.css index c1670eb9..38f2d93e 100644 --- a/manage/manage.css +++ b/manage/manage.css @@ -809,11 +809,13 @@ a svg, .svg-icon.sort { text-overflow: ellipsis; } -/* export/import buttons */ +/* dropdown buttons */ +.new-style, .manage-backups { position: relative; } +.new-style .dropdown, .manage-backups .dropdown { display: none; background: transparent; @@ -824,6 +826,7 @@ a svg, .svg-icon.sort { z-index: 101; } +.new-style .dropdown a, .manage-backups .dropdown a { background-color: #f9f9f9; color: black; @@ -833,12 +836,14 @@ a svg, .svg-icon.sort { display: block; } +#main-header .new-style .dropdown a:hover, #main-header .manage-backups .dropdown a:hover { /* background-color: #f2f2f2 */ background-color: #e9e9e9; color: var(--header-text-hover-color); } +.new-style:hover .dropdown, .manage-backups:hover .dropdown { display: block; right: -20px; @@ -917,10 +922,12 @@ a svg, .svg-icon.sort { width: 100%; height: auto; } + .new-style, .manage-backups { display: inline-block; vertical-align: center; } + .new-style:hover .dropdown, .manage-backups:hover .dropdown { display: block; left: -20px;