From 6bc22ab4ba7a5fb47f3cc297c160211ab35b6645 Mon Sep 17 00:00:00 2001 From: Raymond Hill Date: Wed, 19 Dec 2018 16:21:23 -0500 Subject: [PATCH] Convert uBO's svg-based icon into a stylable svg symbol-based icon --- src/css/common.css | 28 ++++++++++++++++++++++++++++ src/img/ublock-defs.svg | 27 +++++++++++++++++++++++++++ src/img/ublock-icon.svg | 4 ---- src/js/logger-ui.js | 10 ++++++---- src/logger-ui.html | 2 +- 5 files changed, 62 insertions(+), 9 deletions(-) create mode 100644 src/img/ublock-defs.svg delete mode 100644 src/img/ublock-icon.svg diff --git a/src/css/common.css b/src/css/common.css index a483215d8..c6499ef5a 100644 --- a/src/css/common.css +++ b/src/css/common.css @@ -79,3 +79,31 @@ body[dir="rtl"] button.custom.iconifiable > .fa { display: none; } } + +.ubo-icon { + align-items: center; + background-color: transparent; + border: 0; + display: inline-flex; + justify-content: center; + margin: 0; + padding: 0.1em; + position: relative; + } +.ubo-icon > * { + pointer-events: none; + } +.ubo-icon.disabled, +.disabled > .ubo-icon, +.ubo-icon[disabled], +[disabled] > .ubo-icon { + color: #000; + fill: #000; + opacity: 0.25; + stroke: #888; + pointer-events: none; + } +.ubo-icon > svg { + height: 1em; + width: 1em; + } diff --git a/src/img/ublock-defs.svg b/src/img/ublock-defs.svg new file mode 100644 index 000000000..dbc59a388 --- /dev/null +++ b/src/img/ublock-defs.svg @@ -0,0 +1,27 @@ + + + + + + + diff --git a/src/img/ublock-icon.svg b/src/img/ublock-icon.svg deleted file mode 100644 index b297a5436..000000000 --- a/src/img/ublock-icon.svg +++ /dev/null @@ -1,4 +0,0 @@ - - - - diff --git a/src/js/logger-ui.js b/src/js/logger-ui.js index 0d9e25ad0..2014635e3 100644 --- a/src/js/logger-ui.js +++ b/src/js/logger-ui.js @@ -1729,9 +1729,11 @@ const popupManager = (function() { document.addEventListener('tabIdChanged', onTabIdChanged); setTabId(realTabId); + uDom.nodeFromId('showpopup').classList.add('active'); }; const toggleOff = function() { + uDom.nodeFromId('showpopup').classList.remove('active'); document.removeEventListener('tabIdChanged', onTabIdChanged); uDom.nodeFromId('inspectors').classList.remove('popupOn'); popup.removeEventListener('load', onLoad); @@ -1743,9 +1745,6 @@ const popupManager = (function() { }; const exports = { - toggleOn: function() { - void (realTabId === 0 ? toggleOn() : toggleOff()); - }, toggleOff: function() { if ( realTabId !== 0 ) { toggleOff(); @@ -1757,6 +1756,10 @@ const popupManager = (function() { get: function() { return realTabId || 0; } }); + uDom('#showpopup').on('click', ( ) => { + void (realTabId === 0 ? toggleOn() : toggleOff()); + }); + return exports; })(); @@ -1820,7 +1823,6 @@ readLogBuffer(); uDom('#pageSelector').on('change', pageSelectorChanged); uDom('#refresh').on('click', reloadTab); -uDom('#showpopup').on('click', popupManager.toggleOn); uDom('#netInspector .vCompactToggler').on('click', toggleVCompactView); uDom('#clean').on('click', cleanBuffer); diff --git a/src/logger-ui.html b/src/logger-ui.html index 072ecad4e..40c0fc6d0 100644 --- a/src/logger-ui.html +++ b/src/logger-ui.html @@ -21,7 +21,7 @@ refresh code - + info-circle