var d = document; var safari = (navigator.userAgent.toLowerCase().indexOf('safari') != -1) ? true : false; var gebtn = function (parEl, child) { return parEl.getElementsByTagName(child); }; onload = function () { var body = gebtn(d, 'body')[0]; body.className = body.className && body.className != '' ? body.className + ' has-js' : 'has-js'; if (!d.getElementById || !d.createTextNode) return; var ls = gebtn(d, 'label'); for (var i = 0; i < ls.length; i++) { var l = ls[i]; if (l.className.indexOf('label_') == -1) continue; var inp = gebtn(l, 'input')[0]; if (l.className == 'label_check') { l.className = (safari && inp.checked == true || inp.checked) ? 'label_check c_on' : 'label_check c_off'; l.onclick = check_it; }; if (l.className == 'label_radio') { l.className = (safari && inp.checked == true || inp.checked) ? 'label_radio r_on' : 'label_radio r_off'; l.onclick = turn_radio; }; }; }; var check_it = function () { debugger; var inp = gebtn(this, 'input')[0]; if (this.className == 'label_check c_off') { this.className = 'label_check c_on'; if (safari) inp.click(); } else { this.className = 'label_check c_off'; if (safari) inp.click(); }; }; var turn_radio = function () { var inp = gebtn(this, 'input')[0]; if (this.className == 'label_radio r_off' || inp.checked) { var ls = gebtn(this.parentNode, 'label'); for (var i = 0; i < ls.length; i++) { var l = ls[i]; if (l.className.indexOf('label_radio') == -1) continue; l.className = 'label_radio r_off'; }; this.className = 'label_radio r_on'; if (safari) inp.click(); } else { this.className = 'label_radio r_off'; if (safari) inp.click(); }; }; $(document).ready(function () { $('#profile_drop').click(function (event) { event.stopPropagation(); }); $('html, #profile_drop .baloon_cancel').click(function (event) { $('#profile_drop').fadeOut(); }); $('.profileinfo').click(function (event) { $('#profile_drop').fadeIn(); event.stopPropagation(); }); $(document).ajaxError(function (xhr, props) { if (props.status === 401) { location.reload(); } }); }); function redirectUser(redirectUrl) { window.location.href = redirectUrl; } function GetDataSource(urlGetDataSource) { var resultdata; $.ajax({ url: urlGetDataSource, type: 'GET', dataType: "json", data: {}, cache: false, async: false, success: function (result) { resultdata = result; }, error: function (jqXHR, textStatus, errorThrown) { alert(textStatus + " :: " + errorThrown); }, complete: function () { } }); return resultdata; } function GetDataSourceByData(urlGetDataSource, parameterData) { var resultdata; $.ajax({ url: urlGetDataSource, type: 'GET', dataType: "json", data: parameterData, cache: false, async: false, success: function (result) { resultdata = result; }, error: function (jqXHR, textStatus, errorThrown) { alert(textStatus + " :: " + errorThrown); }, complete: function () { } }); return resultdata; } function HideErrordiv() { $("#divErrorMessage").hide(); $("div .validation-summary-success").hide(); } /* Toast message */ function Initnotification() { var notification = $("#notification").kendoNotification({ position: { pinned: false, top: 30, right: 30 }, autoHideAfter: 5000, //autoHideAfter: 0, stacking: "down", templates: [ { type: "error", template: $("#notificationErrorTemplate").html() }, { type: "success", template: $("#notificationSuccessTemplate").html() } ] }).data("kendoNotification"); return notification; } function ShowNotification(title, message, type) { var notification = Initnotification(); notification.show({ title: title, message: message }, type); } // source: https://stackoverflow.com/a/49890732/116614 // TFS #11529 - fix smart quotes on Safari mobile // $(function () { $('input').on('input', preventPretentiousPunctuation); }) function preventPretentiousPunctuation(event) { try { var str = $(this).val(); var replacedStr = str; replacedStr = replacedStr.replace(/[\u2018\u2019]/g, "'"); replacedStr = replacedStr.replace(/[\u201C\u201D]/g, '"'); if (str !== replacedStr) { $(this).val(replacedStr); } } catch (err) { // do nothing } } // END TFS #11529 // // source: https://gonative.io/docs/download-file // TFS #15337 - add gonative bridge call to download files while in mobile app // function essDownload(url) { if (isInGoNativeApp()) { // Source: https://stackoverflow.com/a/44547904/116614 // convert relative path to absolute path which is required for gonative downloadFile. url = new URL(url, document.baseURI).href; gonative.share.downloadFile({ url }); } else { location.href = url; } } function isInGoNativeApp() { if (navigator.userAgent.indexOf('gonative') > -1) { return true; } return false; } // #ND TFS #15337 //