jellyfin-web/dashboard-ui/scripts/mypreferencescommon.js

47 lines
1.6 KiB
JavaScript
Raw Normal View History

2015-09-24 22:15:29 -07:00
pageIdOn('pageinit', 'myPreferencesMenuPage', function () {
var page = this;
2016-06-02 12:32:15 -07:00
page.querySelector('.btnLogout').addEventListener('click', function () {
2015-09-24 22:15:29 -07:00
Dashboard.logout();
});
});
pageIdOn('pageshow', 'myPreferencesMenuPage', function () {
2015-05-27 22:51:48 -07:00
var page = this;
var userId = getParameterByName('userId') || Dashboard.getCurrentUserId();
2016-06-02 12:32:15 -07:00
page.querySelector('.lnkDisplayPreferences').setAttribute('href', 'mypreferencesdisplay.html?userId=' + userId);
page.querySelector('.lnkLanguagePreferences').setAttribute('href', 'mypreferenceslanguages.html?userId=' + userId);
page.querySelector('.lnkHomeScreenPreferences').setAttribute('href', 'mypreferenceshome.html?userId=' + userId);
page.querySelector('.lnkMyProfile').setAttribute('href', 'myprofile.html?userId=' + userId);
page.querySelector('.lnkSync').setAttribute('href', 'mysyncsettings.html?userId=' + userId);
2015-07-29 19:35:11 -07:00
2015-09-11 09:26:06 -07:00
if (Dashboard.capabilities().SupportsSync) {
2015-07-29 19:35:11 -07:00
page.querySelector('.lnkSync').classList.remove('hide');
} else {
page.querySelector('.lnkSync').classList.add('hide');
}
2015-09-24 10:08:10 -07:00
2015-12-14 08:43:03 -07:00
Dashboard.getCurrentUser().then(function (user) {
2015-09-24 22:15:29 -07:00
page.querySelector('.headerUser').innerHTML = user.Name;
2016-04-28 12:11:43 -07:00
if (user.Policy.IsAdministrator) {
2016-03-27 20:45:38 -07:00
page.querySelector('.adminSection').classList.remove('hide');
2015-09-24 22:15:29 -07:00
} else {
page.querySelector('.adminSection').classList.add('hide');
}
});
2016-02-14 13:38:19 -07:00
if (Dashboard.isConnectMode()) {
page.querySelector('.selectServer').classList.remove('hide');
2015-09-24 10:08:10 -07:00
} else {
2016-02-14 13:38:19 -07:00
page.querySelector('.selectServer').classList.add('hide');
2015-09-24 10:08:10 -07:00
}
2015-09-24 22:15:29 -07:00
2015-05-27 22:51:48 -07:00
});