mirror of
https://github.com/jellyfin/jellyfin-web
synced 2025-03-30 19:56:21 +00:00
make auto saving conditional
This commit is contained in:
parent
24a456b877
commit
9fb1452f93
7 changed files with 90 additions and 11 deletions
|
@ -115,6 +115,10 @@
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
<button type="submit" data-role="none" class="clearButton block btnSave hide">
|
||||||
|
<paper-button raised class="submit block"><iron-icon icon="check"></iron-icon><span>${ButtonSave}</span></paper-button>
|
||||||
|
</button>
|
||||||
|
|
||||||
<p>
|
<p>
|
||||||
<span style="color:#52B54B;margin-left:.5em;margin-right:.5em;">*</span><span>${LegendTheseSettingsShared}</span>
|
<span style="color:#52B54B;margin-left:.5em;margin-right:.5em;">*</span><span>${LegendTheseSettingsShared}</span>
|
||||||
</p>
|
</p>
|
||||||
|
|
|
@ -138,6 +138,10 @@
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
<button type="submit" data-role="none" class="clearButton block btnSave hide">
|
||||||
|
<paper-button raised class="submit block"><iron-icon icon="check"></iron-icon><span>${ButtonSave}</span></paper-button>
|
||||||
|
</button>
|
||||||
|
|
||||||
<p>
|
<p>
|
||||||
<span style="color:#52B54B;margin-left:.5em;margin-right:.5em;">*</span><span>${LegendTheseSettingsShared}</span>
|
<span style="color:#52B54B;margin-left:.5em;margin-right:.5em;">*</span><span>${LegendTheseSettingsShared}</span>
|
||||||
</p>
|
</p>
|
||||||
|
|
|
@ -88,6 +88,11 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<button type="submit" data-role="none" class="clearButton block btnSave hide">
|
||||||
|
<paper-button raised class="submit block"><iron-icon icon="check"></iron-icon><span>${ButtonSave}</span></paper-button>
|
||||||
|
</button>
|
||||||
|
|
||||||
<p>
|
<p>
|
||||||
<span style="color:#52B54B;margin-left:.5em;margin-right:.5em;">*</span><span>${LegendTheseSettingsShared}</span>
|
<span style="color:#52B54B;margin-left:.5em;margin-right:.5em;">*</span><span>${LegendTheseSettingsShared}</span>
|
||||||
</p>
|
</p>
|
||||||
|
|
|
@ -25,16 +25,29 @@
|
||||||
appStorage.setItem('enableThemeSongs-' + user.Id, $('#selectThemeSong', page).val());
|
appStorage.setItem('enableThemeSongs-' + user.Id, $('#selectThemeSong', page).val());
|
||||||
appStorage.setItem('enableBackdrops-' + user.Id, $('#selectBackdrop', page).val());
|
appStorage.setItem('enableBackdrops-' + user.Id, $('#selectBackdrop', page).val());
|
||||||
|
|
||||||
ApiClient.updateUserConfiguration(user.Id, user.Configuration);
|
return ApiClient.updateUserConfiguration(user.Id, user.Configuration);
|
||||||
}
|
}
|
||||||
|
|
||||||
function save(page) {
|
function save(page) {
|
||||||
|
|
||||||
var userId = getParameterByName('userId') || Dashboard.getCurrentUserId();
|
var userId = getParameterByName('userId') || Dashboard.getCurrentUserId();
|
||||||
|
|
||||||
|
if (!AppInfo.enableAutoSave) {
|
||||||
|
Dashboard.showLoadingMsg();
|
||||||
|
}
|
||||||
|
|
||||||
ApiClient.getUser(userId).then(function (user) {
|
ApiClient.getUser(userId).then(function (user) {
|
||||||
|
|
||||||
saveUser(page, user);
|
saveUser(page, user).then(function () {
|
||||||
|
|
||||||
|
Dashboard.hideLoadingMsg();
|
||||||
|
if (!AppInfo.enableAutoSave) {
|
||||||
|
Dashboard.alert(Globalize.translate('SettingsSaved'));
|
||||||
|
}
|
||||||
|
|
||||||
|
}, function () {
|
||||||
|
Dashboard.hideLoadingMsg();
|
||||||
|
});
|
||||||
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -55,6 +68,12 @@
|
||||||
|
|
||||||
$('.displayPreferencesForm').off('submit', onSubmit).on('submit', onSubmit);
|
$('.displayPreferencesForm').off('submit', onSubmit).on('submit', onSubmit);
|
||||||
|
|
||||||
|
if (AppInfo.enableAutoSave) {
|
||||||
|
page.querySelector('.btnSave').classList.add('hide');
|
||||||
|
} else {
|
||||||
|
page.querySelector('.btnSave').classList.remove('hide');
|
||||||
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
pageIdOn('pageshow', "displayPreferencesPage", function () {
|
pageIdOn('pageshow', "displayPreferencesPage", function () {
|
||||||
|
|
||||||
|
@ -88,7 +107,9 @@
|
||||||
|
|
||||||
var page = this;
|
var page = this;
|
||||||
|
|
||||||
save(page);
|
if (AppInfo.enableAutoSave) {
|
||||||
|
save(page);
|
||||||
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
@ -197,21 +197,36 @@
|
||||||
displayPreferences.CustomPrefs.home2 = $('#selectHomeSection3', page).val();
|
displayPreferences.CustomPrefs.home2 = $('#selectHomeSection3', page).val();
|
||||||
displayPreferences.CustomPrefs.home3 = $('#selectHomeSection4', page).val();
|
displayPreferences.CustomPrefs.home3 = $('#selectHomeSection4', page).val();
|
||||||
|
|
||||||
ApiClient.updateDisplayPreferences('home', displayPreferences, user.Id, AppSettings.displayPreferencesKey()).then(function () {
|
return ApiClient.updateDisplayPreferences('home', displayPreferences, user.Id, AppSettings.displayPreferencesKey()).then(function () {
|
||||||
|
|
||||||
ApiClient.updateUserConfiguration(user.Id, user.Configuration);
|
return ApiClient.updateUserConfiguration(user.Id, user.Configuration);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function save(page) {
|
function save(page) {
|
||||||
|
|
||||||
|
Dashboard.showLoadingMsg();
|
||||||
|
|
||||||
var userId = getParameterByName('userId') || Dashboard.getCurrentUserId();
|
var userId = getParameterByName('userId') || Dashboard.getCurrentUserId();
|
||||||
|
|
||||||
|
if (!AppInfo.enableAutoSave) {
|
||||||
|
Dashboard.showLoadingMsg();
|
||||||
|
}
|
||||||
|
|
||||||
ApiClient.getUser(userId).then(function (user) {
|
ApiClient.getUser(userId).then(function (user) {
|
||||||
|
|
||||||
ApiClient.getDisplayPreferences('home', user.Id, AppSettings.displayPreferencesKey()).then(function (displayPreferences) {
|
ApiClient.getDisplayPreferences('home', user.Id, AppSettings.displayPreferencesKey()).then(function (displayPreferences) {
|
||||||
|
|
||||||
saveUser(page, user, displayPreferences);
|
saveUser(page, user, displayPreferences).then(function () {
|
||||||
|
|
||||||
|
Dashboard.hideLoadingMsg();
|
||||||
|
if (!AppInfo.enableAutoSave) {
|
||||||
|
Dashboard.alert(Globalize.translate('SettingsSaved'));
|
||||||
|
}
|
||||||
|
|
||||||
|
}, function () {
|
||||||
|
Dashboard.hideLoadingMsg();
|
||||||
|
});
|
||||||
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
@ -270,6 +285,12 @@
|
||||||
|
|
||||||
$('.homeScreenPreferencesForm').off('submit', onSubmit).on('submit', onSubmit);
|
$('.homeScreenPreferencesForm').off('submit', onSubmit).on('submit', onSubmit);
|
||||||
|
|
||||||
|
if (AppInfo.enableAutoSave) {
|
||||||
|
page.querySelector('.btnSave').classList.add('hide');
|
||||||
|
} else {
|
||||||
|
page.querySelector('.btnSave').classList.remove('hide');
|
||||||
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
pageIdOn('pageshow', "homeScreenPreferencesPage", function () {
|
pageIdOn('pageshow', "homeScreenPreferencesPage", function () {
|
||||||
|
@ -293,8 +314,10 @@
|
||||||
pageIdOn('pagebeforehide', "homeScreenPreferencesPage", function () {
|
pageIdOn('pagebeforehide', "homeScreenPreferencesPage", function () {
|
||||||
|
|
||||||
var page = this;
|
var page = this;
|
||||||
|
|
||||||
save(page);
|
if (AppInfo.enableAutoSave) {
|
||||||
|
save(page);
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
})(jQuery, window, document);
|
})(jQuery, window, document);
|
|
@ -96,7 +96,7 @@
|
||||||
|
|
||||||
AppSettings.enableCinemaMode(page.querySelector('.chkEnableCinemaMode').checked);
|
AppSettings.enableCinemaMode(page.querySelector('.chkEnableCinemaMode').checked);
|
||||||
|
|
||||||
ApiClient.updateUserConfiguration(user.Id, user.Configuration);
|
return ApiClient.updateUserConfiguration(user.Id, user.Configuration);
|
||||||
}
|
}
|
||||||
|
|
||||||
function save(page) {
|
function save(page) {
|
||||||
|
@ -113,9 +113,22 @@
|
||||||
|
|
||||||
var userId = getParameterByName('userId') || Dashboard.getCurrentUserId();
|
var userId = getParameterByName('userId') || Dashboard.getCurrentUserId();
|
||||||
|
|
||||||
|
if (!AppInfo.enableAutoSave) {
|
||||||
|
Dashboard.showLoadingMsg();
|
||||||
|
}
|
||||||
|
|
||||||
ApiClient.getUser(userId).then(function (result) {
|
ApiClient.getUser(userId).then(function (result) {
|
||||||
|
|
||||||
saveUser(page, result);
|
saveUser(page, result).then(function () {
|
||||||
|
|
||||||
|
Dashboard.hideLoadingMsg();
|
||||||
|
if (!AppInfo.enableAutoSave) {
|
||||||
|
Dashboard.alert(Globalize.translate('SettingsSaved'));
|
||||||
|
}
|
||||||
|
|
||||||
|
}, function () {
|
||||||
|
Dashboard.hideLoadingMsg();
|
||||||
|
});
|
||||||
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -141,6 +154,12 @@
|
||||||
});
|
});
|
||||||
|
|
||||||
$('.languagePreferencesForm').off('submit', onSubmit).on('submit', onSubmit);
|
$('.languagePreferencesForm').off('submit', onSubmit).on('submit', onSubmit);
|
||||||
|
|
||||||
|
if (AppInfo.enableAutoSave) {
|
||||||
|
page.querySelector('.btnSave').classList.add('hide');
|
||||||
|
} else {
|
||||||
|
page.querySelector('.btnSave').classList.remove('hide');
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
pageIdOn('pageshow', "languagePreferencesPage", function () {
|
pageIdOn('pageshow', "languagePreferencesPage", function () {
|
||||||
|
@ -168,7 +187,9 @@
|
||||||
|
|
||||||
var page = this;
|
var page = this;
|
||||||
|
|
||||||
save(page);
|
if (AppInfo.enableAutoSave) {
|
||||||
|
save(page);
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
})(jQuery, window, document);
|
})(jQuery, window, document);
|
|
@ -1555,6 +1555,7 @@ var AppInfo = {};
|
||||||
AppInfo.enableNowPlayingBar = true;
|
AppInfo.enableNowPlayingBar = true;
|
||||||
AppInfo.enableHomeTabs = true;
|
AppInfo.enableHomeTabs = true;
|
||||||
AppInfo.enableNowPlayingPageBottomTabs = true;
|
AppInfo.enableNowPlayingPageBottomTabs = true;
|
||||||
|
AppInfo.enableAutoSave = browserInfo.mobile;
|
||||||
|
|
||||||
AppInfo.enableAppStorePolicy = isCordova;
|
AppInfo.enableAppStorePolicy = isCordova;
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue