diff options
author | toasted-nutbread <toasted-nutbread@users.noreply.github.com> | 2021-02-21 13:57:28 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-02-21 13:57:28 -0500 |
commit | b7789749380a6e101adbca82c37a55dcd5fe31a4 (patch) | |
tree | 529f5e00030b1b8c40fdc67bd6bc7b09cab5cfc4 /ext/js | |
parent | 75d0d333d86d2450db811a89b503bae22a3b49b6 (diff) |
Improve tag styles (#1431)
* Update tag styles
* Refactor _createTag
* Update padding
Diffstat (limited to 'ext/js')
-rw-r--r-- | ext/js/display/display-generator.js | 13 | ||||
-rw-r--r-- | ext/js/display/display.js | 5 |
2 files changed, 11 insertions, 7 deletions
diff --git a/ext/js/display/display-generator.js b/ext/js/display/display-generator.js index d02e2d9c..9b451995 100644 --- a/ext/js/display/display-generator.js +++ b/ext/js/display/display-generator.js @@ -413,15 +413,16 @@ class DisplayGenerator { } _createTag(details) { + const {notes, name, category, redundant} = details; const node = this._templates.instantiate('tag'); - const inner = node.querySelector('.tag-inner'); + const inner = node.querySelector('.tag-label-content'); - node.title = details.notes; - this._setTextContent(inner, details.name); - node.dataset.details = details.notes || details.name; - node.dataset.category = details.category; - if (details.redundant) { node.dataset.redundant = 'true'; } + node.title = notes; + this._setTextContent(inner, name); + node.dataset.details = notes || name; + node.dataset.category = category; + if (redundant) { node.dataset.redundant = 'true'; } return node; } diff --git a/ext/js/display/display.js b/ext/js/display/display.js index 35f22718..517b391d 100644 --- a/ext/js/display/display.js +++ b/ext/js/display/display.js @@ -787,6 +787,9 @@ class Display extends EventDispatcher { } _showTagNotification(tagNode) { + tagNode = tagNode.parentNode; + if (tagNode === null) { return; } + if (this._tagNotification === null) { const node = this._displayGenerator.createEmptyFooterNotification(); node.classList.add('click-scannable'); @@ -1677,7 +1680,7 @@ class Display extends EventDispatcher { this._addMultipleEventListeners(entry, '.action-view-note', 'click', this._onNoteView.bind(this)); this._addMultipleEventListeners(entry, '.kanji-link', 'click', this._onKanjiLookup.bind(this)); this._addMultipleEventListeners(entry, '.debug-log-link', 'click', this._onDebugLogClick.bind(this)); - this._addMultipleEventListeners(entry, '.tag', 'click', this._onTagClick.bind(this)); + this._addMultipleEventListeners(entry, '.tag-label', 'click', this._onTagClick.bind(this)); } _updateDefinitionTextScanner(options) { |