Always show actions when there is only a single term result

This commit is contained in:
toasted-nutbread 2020-01-16 21:33:58 -05:00
parent 6c344b2740
commit 9abfd7acde
2 changed files with 14 additions and 12 deletions

View File

@ -233,7 +233,7 @@ button.action-button {
border-top-style: solid;
}
.entry[data-type=term][data-multi-expression=true] .actions>.action-play-audio {
.entry[data-type=term][data-expression-multi=true]:not([data-expression-count="1"]) .actions>.action-play-audio {
display: none;
}
@ -280,11 +280,11 @@ button.action-button {
content: "\3001";
}
.term-expression-list[data-multi=true] .term-expression-details {
.term-expression-list[data-multi=true]:not([data-count="1"]) .term-expression-details {
visibility: hidden;
}
.term-expression-list[data-multi=true] .term-expression-details {
.term-expression-list[data-multi=true]:not([data-count="1"]) .term-expression-details {
display: inline-block;
position: relative;
width: 0;
@ -292,21 +292,21 @@ button.action-button {
visibility: hidden;
}
.term-expression-list[data-multi=true] .term-expression:hover .term-expression-details {
.term-expression-list[data-multi=true]:not([data-count="1"]) .term-expression:hover .term-expression-details {
visibility: visible;
}
.term-expression-list[data-multi=true] .term-expression-details>.action-play-audio {
.term-expression-list[data-multi=true]:not([data-count="1"]) .term-expression-details>.action-play-audio {
position: absolute;
left: 0;
bottom: 0.5em;
}
.term-expression-list[data-multi=true] .term-expression-details>.action-play-audio {
.term-expression-list[data-multi=true]:not([data-count="1"]) .term-expression-details>.action-play-audio {
display: block;
}
.term-expression-list[data-multi=true] .term-expression-details>.tags {
.term-expression-list[data-multi=true]:not([data-count="1"]) .term-expression-details>.tags {
display: block;
position: absolute;
left: 0;
@ -314,7 +314,7 @@ button.action-button {
white-space: nowrap;
}
.term-expression-list[data-multi=true] .term-expression-details>.frequencies {
.term-expression-list[data-multi=true]:not([data-count="1"]) .term-expression-details>.frequencies {
display: block;
position: absolute;
left: 0;

View File

@ -63,11 +63,13 @@ class DisplayGenerator {
const definitionsContainer = node.querySelector('.term-definition-list');
const debugInfoContainer = node.querySelector('.debug-info');
const multiExpression = Array.isArray(details.expressions);
const multiDefinition = Array.isArray(details.definitions);
const expressionMulti = Array.isArray(details.expressions);
const definitionMulti = Array.isArray(details.definitions);
node.dataset.multiExpression = `${multiExpression}`;
node.dataset.multiDefinition = `${multiDefinition}`;
node.dataset.expressionMulti = `${expressionMulti}`;
node.dataset.definitionMulti = `${definitionMulti}`;
node.dataset.expressionCount = `${expressionMulti ? details.expressions.length : 1}`;
node.dataset.definitionCount = `${definitionMulti ? details.definitions.length : 1}`;
DisplayGenerator._appendMultiple(expressionsContainer, this.createTermExpression.bind(this), details.expressions, [details]);
DisplayGenerator._appendMultiple(reasonsContainer, this.createTermReason.bind(this), details.reasons);