1
0
Fork 0
mirror of https://github.com/jellyfin/jellyfin-web synced 2025-03-30 19:56:21 +00:00

Merge pull request #3458 from dmitrylyzo/button-state

Alter the title of the state buttons
This commit is contained in:
Bill Thornton 2022-02-25 11:33:57 -05:00 committed by GitHub
commit 3e929e338d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 14 additions and 10 deletions

View file

@ -66,13 +66,15 @@ import ServerConnections from '../../components/ServerConnections';
if (updateAttribute !== false) {
button.setAttribute('data-played', played);
}
setTitle(button, button.getAttribute('data-type'), played);
}
function setTitle(button, itemType) {
function setTitle(button, itemType, played) {
if (itemType !== 'AudioBook' && itemType !== 'AudioPodcast') {
button.title = globalize.translate('Watched');
button.title = played ? globalize.translate('Watched') : globalize.translate('MarkPlayed');
} else {
button.title = globalize.translate('Played');
button.title = played ? globalize.translate('Played') : globalize.translate('MarkPlayed');
}
const text = button.querySelector('.button-text');
@ -113,7 +115,6 @@ import ServerConnections from '../../components/ServerConnections';
if (itemId && serverId) {
setState(this, this.getAttribute('data-played') === 'true', false);
bindEvents(this);
setTitle(this, this.getAttribute('data-type'));
}
};
@ -131,15 +132,15 @@ import ServerConnections from '../../components/ServerConnections';
if (item) {
this.setAttribute('data-id', item.Id);
this.setAttribute('data-serverid', item.ServerId);
this.setAttribute('data-type', item.Type);
const played = item.UserData && item.UserData.Played;
setState(this, played);
bindEvents(this);
setTitle(this, item.Type);
} else {
this.removeAttribute('data-id');
this.removeAttribute('data-serverid');
this.removeAttribute('data-type');
this.removeAttribute('data-played');
clearEvents(this);
}

View file

@ -88,10 +88,12 @@ import ServerConnections from '../../components/ServerConnections';
button.setAttribute('data-likes', (likes === null ? '' : likes));
}
setTitle(button, isFavorite);
}
function setTitle(button) {
button.title = globalize.translate('Favorite');
function setTitle(button, isFavorite) {
button.title = isFavorite ? globalize.translate('Favorite') : globalize.translate('AddToFavorites');
const text = button.querySelector('.button-text');
if (text) {
@ -141,9 +143,9 @@ import ServerConnections from '../../components/ServerConnections';
setState(this, likes, isFavorite, false);
bindEvents(this);
} else {
setTitle(this);
}
setTitle(this);
};
EmbyRatingButtonPrototype.detachedCallback = function () {

View file

@ -6,6 +6,7 @@
"AddedOnValue": "Added {0}",
"AdditionalNotificationServices": "Browse the plugin catalog to install additional notification services.",
"AddToCollection": "Add to collection",
"AddToFavorites": "Add to favorites",
"AddToPlaylist": "Add to playlist",
"AddToPlayQueue": "Add to play queue",
"AgeValue": "({0} years old)",