aboutsummaryrefslogtreecommitdiff
path: root/MediaBrowser.WebDashboard/Html/scripts/DisplaySettingsPage.js
blob: da87a106f7893f731ff910b357dbb0496b2fe919 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
var DisplaySettingsPage = {

    onPageShow: function () {
        Dashboard.showLoadingMsg();

        var page = this;

        ApiClient.getServerConfiguration().done(function (config) {

            $('#txtWeatherLocation', page).val(config.WeatherLocation);
            $('#txtMinResumePct', page).val(config.MinResumePct);
            $('#txtMaxResumePct', page).val(config.MaxResumePct);
            $('#txtMinResumeDuration', page).val(config.MinResumeDurationSeconds);
            $('#selectWeatherUnit', page).val(config.WeatherUnit).selectmenu("refresh");

            Dashboard.hideLoadingMsg();
        });

    },
    
    submit: function() {

        $('.btnSubmit', $.mobile.activePage)[0].click();

    },

    onSubmit: function () {
        var form = this;

        ApiClient.getServerConfiguration().done(function (config) {

            config.WeatherLocation = $('#txtWeatherLocation', form).val();
            config.WeatherUnit = $('#selectWeatherUnit', form).val();
            config.MinResumePct = $('#txtMinResumePct', form).val();
            config.MaxResumePct = $('#txtMaxResumePct', form).val();
            config.MinResumeDurationSeconds = $('#txtMinResumeDuration', form).val();

            ApiClient.updateServerConfiguration(config);
        });

        // Disable default form submission
        return false;
    }
};

$(document).on('pageshow', "#displaySettingsPage", DisplaySettingsPage.onPageShow);