123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146 |
- function requestGeoPosition() {
-
- if (navigator.geolocation) {
- navigator.geolocation.getCurrentPosition(showGeoPosition, logGeoLocationError,
- {maximumAge: 600000, timeout: 5000, enableHighAccuracy: true});
- } else {
-
- }
- }
- function logGeoLocationError(error) {
- switch (error.code) {
- case error.PERMISSION_DENIED:
-
- break;
- case error.POSITION_UNAVAILABLE:
-
- break;
- case error.TIMEOUT:
-
- break;
- default:
-
- break;
- }
- }
- function showGeoPosition(position) {
- $('[name="geolocation"]').val(position.coords.latitude + ','
- + position.coords.longitude + ',' + position.coords.accuracy + ',' + position.timestamp);
- }
- function preserveAnchorTagOnForm() {
- $('#fm1').submit(function () {
- var location = self.document.location;
- var hash = decodeURIComponent(location.hash);
-
- if (hash != undefined && hash != '' && hash.indexOf('#') === -1) {
- hash = '#' + hash;
- }
- var action = $('#fm1').attr('action');
- if (action == undefined) {
- action = location.href;
- } else {
- var qidx = location.href.indexOf('?');
- if (qidx != -1) {
- var queryParams = location.href.substring(qidx);
- action += queryParams;
- }
- }
- action += hash;
- $('#fm1').attr('action', action);
-
- });
- }
- function areCookiesEnabled() {
- if ($.cookie == undefined) {
- return;
- }
- $.cookie('cookiesEnabled', 'true');
- var value = $.cookie('cookiesEnabled');
- $.removeCookie('cookiesEnabled');
- return value != undefined;
- }
- function disableEmptyInputFormSubmission() {
- var fields = $('#fm1 input[name="username"],[name="password"]');
- if (fields.length == 2) {
- fields.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');
- }
- });
- }
-
- if ($('#fm1 input[name="username"]').length > 0) {
- setTimeout(function () {
- var uid = $('#username').val();
- if (uid != null && uid != '') {
- $('#username').change();
- $('#username').focus();
- $('#fm1 input[name=submit]').removeAttr('disabled');
- }
- }, 100);
- }
- }
- function resourceLoadedSuccessfully() {
- $(document).ready(function () {
- if (trackGeoLocation) {
- requestGeoPosition();
- }
- if ($(':focus').length === 0) {
- $('input:visible:enabled:first').focus();
- }
- if (areCookiesEnabled()) {
- $('#cookiesDisabled').hide();
- } else {
- $('#cookiesDisabled').show();
- }
- disableEmptyInputFormSubmission();
- preserveAnchorTagOnForm();
- $('#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();
- }
- });
- }
|