diff options
author | siikamiika <siikamiika@users.noreply.github.com> | 2017-10-07 07:02:50 +0300 |
---|---|---|
committer | siikamiika <siikamiika@users.noreply.github.com> | 2017-10-07 07:02:50 +0300 |
commit | 94d590fc85f87028d8264e93c8ad58c71d0977f2 (patch) | |
tree | a4f1bd946674995fed7748b5433dba5fe37a2f93 /ext/mixed | |
parent | 981d9eddb69322494589c241d049652c9091ed06 (diff) |
merged mode: support audio and tags for terms
Diffstat (limited to 'ext/mixed')
-rw-r--r-- | ext/mixed/css/display.css | 20 | ||||
-rw-r--r-- | ext/mixed/js/display.js | 10 |
2 files changed, 23 insertions, 7 deletions
diff --git a/ext/mixed/css/display.css b/ext/mixed/css/display.css index 04e6a326..147256bf 100644 --- a/ext/mixed/css/display.css +++ b/ext/mixed/css/display.css @@ -118,20 +118,34 @@ hr { font-size: 24px; } -.expression a { +.expression .kanji-link { border-bottom: 1px #777 dashed; color: #333; text-decoration: none; } -.expression-popular, .expression-popular a { +.expression-popular, .expression-popular .kanji-link { color: #0275d8; } -.expression-rare, .expression-rare a { +.expression-rare, .expression-rare .kanji-link { color: #999; } +.expression .peek-wrapper { + font-size: 14px; + white-space: nowrap; + display: inline-block; + position: relative; + width: 0px; + height: 0px; + visibility: hidden; +} + +.expression:hover .peek-wrapper { + visibility: visible; +} + .reasons { color: #777; display: inline-block; diff --git a/ext/mixed/js/display.js b/ext/mixed/js/display.js index 2dd95692..e54c8b18 100644 --- a/ext/mixed/js/display.js +++ b/ext/mixed/js/display.js @@ -71,8 +71,10 @@ class Display { onAudioPlay(e) { e.preventDefault(); - const index = Display.entryIndexFind($(e.currentTarget)); - this.audioPlay(this.definitions[index]); + const link = $(e.currentTarget); + const definitionIndex = Display.entryIndexFind(link); + const expressionIndex = $(e.currentTarget).closest('.entry').find('.expression .action-play-audio').index(link); + this.audioPlay(this.definitions[definitionIndex], expressionIndex); } onNoteAdd(e) { @@ -380,11 +382,11 @@ class Display { } } - async audioPlay(definition) { + async audioPlay(definition, expressionIndex) { try { this.spinner.show(); - let url = await apiAudioGetUrl(definition, this.options.general.audioSource); + let url = await apiAudioGetUrl(expressionIndex === -1 ? definition : definition.expressions[expressionIndex], this.options.general.audioSource); if (!url) { url = '/mixed/mp3/button.mp3'; } |