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:
commit
3e929e338d
3 changed files with 14 additions and 10 deletions
|
@ -66,13 +66,15 @@ import ServerConnections from '../../components/ServerConnections';
|
||||||
if (updateAttribute !== false) {
|
if (updateAttribute !== false) {
|
||||||
button.setAttribute('data-played', played);
|
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') {
|
if (itemType !== 'AudioBook' && itemType !== 'AudioPodcast') {
|
||||||
button.title = globalize.translate('Watched');
|
button.title = played ? globalize.translate('Watched') : globalize.translate('MarkPlayed');
|
||||||
} else {
|
} else {
|
||||||
button.title = globalize.translate('Played');
|
button.title = played ? globalize.translate('Played') : globalize.translate('MarkPlayed');
|
||||||
}
|
}
|
||||||
|
|
||||||
const text = button.querySelector('.button-text');
|
const text = button.querySelector('.button-text');
|
||||||
|
@ -113,7 +115,6 @@ import ServerConnections from '../../components/ServerConnections';
|
||||||
if (itemId && serverId) {
|
if (itemId && serverId) {
|
||||||
setState(this, this.getAttribute('data-played') === 'true', false);
|
setState(this, this.getAttribute('data-played') === 'true', false);
|
||||||
bindEvents(this);
|
bindEvents(this);
|
||||||
setTitle(this, this.getAttribute('data-type'));
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -131,15 +132,15 @@ import ServerConnections from '../../components/ServerConnections';
|
||||||
if (item) {
|
if (item) {
|
||||||
this.setAttribute('data-id', item.Id);
|
this.setAttribute('data-id', item.Id);
|
||||||
this.setAttribute('data-serverid', item.ServerId);
|
this.setAttribute('data-serverid', item.ServerId);
|
||||||
|
this.setAttribute('data-type', item.Type);
|
||||||
|
|
||||||
const played = item.UserData && item.UserData.Played;
|
const played = item.UserData && item.UserData.Played;
|
||||||
setState(this, played);
|
setState(this, played);
|
||||||
bindEvents(this);
|
bindEvents(this);
|
||||||
|
|
||||||
setTitle(this, item.Type);
|
|
||||||
} else {
|
} else {
|
||||||
this.removeAttribute('data-id');
|
this.removeAttribute('data-id');
|
||||||
this.removeAttribute('data-serverid');
|
this.removeAttribute('data-serverid');
|
||||||
|
this.removeAttribute('data-type');
|
||||||
this.removeAttribute('data-played');
|
this.removeAttribute('data-played');
|
||||||
clearEvents(this);
|
clearEvents(this);
|
||||||
}
|
}
|
||||||
|
|
|
@ -88,10 +88,12 @@ import ServerConnections from '../../components/ServerConnections';
|
||||||
|
|
||||||
button.setAttribute('data-likes', (likes === null ? '' : likes));
|
button.setAttribute('data-likes', (likes === null ? '' : likes));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
setTitle(button, isFavorite);
|
||||||
}
|
}
|
||||||
|
|
||||||
function setTitle(button) {
|
function setTitle(button, isFavorite) {
|
||||||
button.title = globalize.translate('Favorite');
|
button.title = isFavorite ? globalize.translate('Favorite') : globalize.translate('AddToFavorites');
|
||||||
|
|
||||||
const text = button.querySelector('.button-text');
|
const text = button.querySelector('.button-text');
|
||||||
if (text) {
|
if (text) {
|
||||||
|
@ -141,9 +143,9 @@ import ServerConnections from '../../components/ServerConnections';
|
||||||
|
|
||||||
setState(this, likes, isFavorite, false);
|
setState(this, likes, isFavorite, false);
|
||||||
bindEvents(this);
|
bindEvents(this);
|
||||||
|
} else {
|
||||||
|
setTitle(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
setTitle(this);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
EmbyRatingButtonPrototype.detachedCallback = function () {
|
EmbyRatingButtonPrototype.detachedCallback = function () {
|
||||||
|
|
|
@ -6,6 +6,7 @@
|
||||||
"AddedOnValue": "Added {0}",
|
"AddedOnValue": "Added {0}",
|
||||||
"AdditionalNotificationServices": "Browse the plugin catalog to install additional notification services.",
|
"AdditionalNotificationServices": "Browse the plugin catalog to install additional notification services.",
|
||||||
"AddToCollection": "Add to collection",
|
"AddToCollection": "Add to collection",
|
||||||
|
"AddToFavorites": "Add to favorites",
|
||||||
"AddToPlaylist": "Add to playlist",
|
"AddToPlaylist": "Add to playlist",
|
||||||
"AddToPlayQueue": "Add to play queue",
|
"AddToPlayQueue": "Add to play queue",
|
||||||
"AgeValue": "({0} years old)",
|
"AgeValue": "({0} years old)",
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue