1
13693261870
2022-09-16 58d012f11dd34564d81b4eb3a6099eb689876597
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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
head.ready(document, function () {
    if (!window.jQuery) {
        head.load("download-jquery/jquery.min.js", loadjQueryUI);
    } else {
        resourceLoadedSuccessfully();
    }
});
 
function loadjQueryUI() {
    head.load("download-jquery/jquery-ui.min.js", loadjQueryCookies);
}
 
function loadjQueryCookies() {
    head.load("download-jquery/jquery.cookie.min.js", resourceLoadedSuccessfully);
}
 
function requestGeoPosition() {
    console.log("Requesting GeoLocation data from the browser...");
    if (navigator.geolocation) {
        navigator.geolocation.getCurrentPosition(showGeoPosition, logGeoLocationError,
            {maximumAge: 600000, timeout: 1000, enableHighAccuracy: true});
    } else {
        console.log("Browser does not support Geo Location");
    }
}
 
function logGeoLocationError(error) {
    switch (error.code) {
        case error.PERMISSION_DENIED:
            console.log("User denied the request for GeoLocation.");
            break;
        case error.POSITION_UNAVAILABLE:
            console.log("Location information is unavailable.");
            break;
        case error.TIMEOUT:
            console.log("The request to get user location timed out.");
            break;
        default:
            console.log("An unknown error occurred.");
            break;
    }
}
 
function showGeoPosition(position) {
    $('[name="geolocation"]').val(position.coords.latitude + ","
        + position.coords.longitude + "," + position.coords.accuracy + "," + position.timestamp);
}
 
function areCookiesEnabled() {
    if ($.cookie == undefined) {
        console.log("JQuery Cookie library is not defined")
        return;
    }
 
    $.cookie('cookiesEnabled', 'true');
    var value = $.cookie('cookiesEnabled');
    $.removeCookie('cookiesEnabled');
    if (value != undefined) {
        return true;
    }
    return false;
}
 
function animateCasMessageBoxes() {
    //flash error box
    $('#msg.errors').animate({backgroundColor: 'rgb(187,0,0)'}, 30).animate({backgroundColor: 'rgb(255,238,221)'}, 500);
 
    //flash success box
    $('#msg.success').animate({backgroundColor: 'rgb(51,204,0)'}, 30).animate({backgroundColor: 'rgb(221,255,170)'}, 500);
 
    //flash confirm box
    $('#msg.question').animate({backgroundColor: 'rgb(51,204,0)'}, 30).animate({backgroundColor: 'rgb(221,255,170)'}, 500);
}
 
function disableEmptyInputFormSubmission() {
 
    $('#fm1 input[name="username"],[name="password"]').on("input", function (event) {
        var enableSubmission = $('#fm1 input[name="username"]').val().trim() &&
            $('#fm1 input[name="password"]').val().trim();
 
        if (enableSubmission) {
            $("#fm1 input[name=submit]").removeAttr('disabled');
            event.stopPropagation();
        } else {
            $("#fm1 input[name=submit]").attr('disabled', 'true');
        }
    });
}
 
function resourceLoadedSuccessfully() {
    $(document).ready(function () {
 
        if (trackGeoLocation) {
            requestGeoPosition();
        }
 
        if ($(":focus").length === 0) {
            $("input:visible:enabled:first").focus();
        }
 
        if (areCookiesEnabled()) {
            $('#cookiesDisabled').hide();
        } else {
            $('#cookiesDisabled').show();
            $('#cookiesDisabled').animate({backgroundColor: 'rgb(187,0,0)'}, 30).animate({backgroundColor: 'rgb(255,238,221)'}, 500);
        }
 
        animateCasMessageBoxes();
        disableEmptyInputFormSubmission();
 
        $('#capslock-on').hide();
        $('#fm1 input[name="username"],[name="password"]').trigger("input");
        $('#fm1 input[name="username"]').focus();
 
        $('#password').keypress(function (e) {
            var s = String.fromCharCode(e.which);
            if (s.toUpperCase() === s && s.toLowerCase() !== s && !e.shiftKey) {
                $('#capslock-on').show();
            } else {
                $('#capslock-on').hide();
            }
        });
        if (typeof(jqueryReady) == "function") {
            jqueryReady();
        }
    });
 
};
0