mirror of
https://github.com/jellyfin/jellyfin-web
synced 2025-03-30 19:56:21 +00:00
Make title of playstatebutton state-dependent
This commit is contained in:
parent
a42053563d
commit
26bf0d532b
1 changed files with 7 additions and 6 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);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue