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

41 lines
1.1 KiB
JavaScript
Raw Normal View History

2013-04-16 21:58:32 -07:00
(function ($, document, window) {
2013-12-25 20:44:26 -07:00
$(document).on('pageshow', "#appsWeatherPage", function () {
2013-04-16 21:58:32 -07:00
Dashboard.showLoadingMsg();
var page = this;
ApiClient.getServerConfiguration().done(function (config) {
2013-06-24 07:06:25 -07:00
$('#txtWeatherLocation', page).val(config.WeatherLocation);
$('#selectWeatherUnit', page).val(config.WeatherUnit).selectmenu("refresh");
2013-04-16 21:58:32 -07:00
$('input:first', page).focus();
Dashboard.hideLoadingMsg();
});
});
2013-12-25 20:44:26 -07:00
window.AppsWeatherPage = {
2013-04-16 21:58:32 -07:00
2013-12-25 20:44:26 -07:00
onSubmit: function () {
2013-04-16 21:58:32 -07:00
var form = this;
Dashboard.showLoadingMsg();
ApiClient.getServerConfiguration().done(function (config) {
2013-06-24 07:06:25 -07:00
config.WeatherLocation = $('#txtWeatherLocation', form).val();
config.WeatherUnit = $('#selectWeatherUnit', form).val();
2013-04-16 21:58:32 -07:00
ApiClient.updateServerConfiguration(config).done(Dashboard.processServerConfigurationUpdateResult);
});
// Disable default form submission
return false;
2013-12-25 20:44:26 -07:00
}
2013-04-16 21:58:32 -07:00
2013-12-25 20:44:26 -07:00
};
2013-04-16 21:58:32 -07:00
2013-06-24 07:06:25 -07:00
})($, document, window);