1var leftDocument = false; 2var fromUnblock = false; 3 4var isLoggingOut = false; 5var loggedOut = false; 6 7$(document).mouseleave(function () { 8 leftDocument = true; 9}); 10 11$(document).mouseenter(function () { 12 leftDocument = false; 13}); 14 15var idleTimerLogout = undefined; 16 17(function($) { 18 // A new function added to JQuery for translation handling 19 // Whenever a page added to DOM its pageName added to "data-language-inner-page" 20 // with divided by '|' for example: 21 // data-language-inner-page = homepage_inner.html; when we add another page to DOM like "accounts.html" new key-value will be like 22 // data-language-inner-page = homepage_inner.html|accounts.html; 23 // And value is parsed to an array when getLanguageData was called. 24 $.fn.attrInnerLanguage = function(dataSelector, value) { 25 var oldValue = $(this).attr(dataSelector) || ''; 26 27 if(!oldValue.includes(value)) { 28 var newValue = oldValue + '|' + value; 29 return $(this).attr(dataSelector, newValue); 30 } 31 32 return $(this); 33 }; 34}(jQuery)); 35 36function formatTables() { 37 // Check if there is a data-char-limit operation needed 38 // if needed the length of elements content need to be sliced 39 $charLimitElements = $('[data-char-limit]'); 40 41 $charLimitElements.each(function() { 42 $charLimit = $(this).attr("data-char-limit"); 43 44 if($.isNumeric($charLimit) && $(this).text() != undefined && $(this).text().length > $charLimit) { 45 $(this).text(truncateString($(this).text(), $charLimit)); 46 } 47 }); 48} 49 50$(document).ready(function () { 51 formatTables(); 52 53 setFooter(); 54 55 initHeaderComponents(); 56 57 // For datatable to handle date sorting properly 58 if($.fn.dataTable && $.fn.dataTable.moment) { 59 $.fn.dataTable.moment('dd.MM.YYYY'); 60 } 61 62 initDataTableSettings(); 63 64 $('.header-dropdown_yn').click(function () { 65 $(this).toggleClass('opened'); 66 }); 67 68 $('.lang-dropdown').click(function (e) { 69 var langItem = $(e.target).hasClass('lang-item') ? $(e.target) : $(e.target).parent().hasClass('lang-item') ? $(e.target).parent() : undefined; 70 71 if (langItem) { 72 73 var that = this; 74 75 var getting = $.get("languageChangeProceed.html"); 76 77 getting.done(function(confirmPage) { 78 var modal = { 79 body : confirmPage, 80 backEvent : function() { 81 $(that).parents('.proceed-modal').fadeOut(); 82 }, 83 proceedEvent : function() { 84 $(that).parents('.proceed-modal').fadeOut(); 85 86 $(that).find('span').empty().append(langItem.clone().children()); 87 88 changeLang(langItem.attr('data-lang')); 89 90 changeLangApi(langItem.attr('data-lang'), function() { 91 92 $("[data-language]").each(function(index, value) { 93 $(this).attr('data-language', langItem.attr('data-lang')); 94 }); 95 96 var getHomepageInner = $.get("homepage_inner.html"); 97 98 getHomepageInner.done(function(homePageData) { 99 $('.mainContainer').empty().append(homePageData).slideDown(); 100 }); 101 102 getHomepageInner.fail(function(err) { 103 toastr.error(err.responseText); 104 }); 105 }); 106 } 107 }; 108 initComponents().proceedModal(modal); 109 }); 110 111 getting.fail(function(err) { 112 toastr.error(err.responseText); 113 }); 114 } 115 $(this).toggleClass('opened'); 116 }); 117 118 moment.locale('sq'); 119 120 var appName = $('#applicationName').val(); 121 122 if (appName == null || appName == undefined) { 123 appName = ''; 124 } 125 126 idleTimerLogout = $(document).idleTimeout({ 127 idleTimeLimit: 120000, 128 redirectUrl: false, 129 sessionKeepAliveTimer: false, 130 customCallback: globalLogout, 131 applicationName: appName 132 }); 133 134}); 135 136function globalLogout() { 137 console.log('Global logout called.', fromUnblock); 138 if (!fromUnblock) { 139 forceLogout(); 140 } 141} 142 143function Stack() { 144 var items = []; 145 146 this.push = function (element) { 147 items.push(element); 148 }; 149 150 this.pop = function () { 151 return items.pop(); 152 }; 153 154 this.peek = function () { 155 return items[items.length - 1]; 156 }; 157 158 this.isEmpty = function () { 159 return items.length == 0; 160 }; 161 162 this.size = function () { 163 return items.length; 164 }; 165 166 this.clear = function () { 167 items = []; 168 }; 169 170 this.show = function () { 171 return items; 172 }; 173 174} 175 176var pageStack = new Stack(); 177 178function pageHistory(page) { 179 var language = $("main").attr('data-language-page');
180 var innerLanguage = $("main").attr('data-language-inner-page'); 181 var newPage = { 182 'page': page, 183 'language': language, 184 'innerlanguage': innerLanguage 185 } 186 pageStack.push(newPage); 187} 188 189function pageHistoryClear() { 190 pageStack.clear(); 191} 192 193/** 194 * 195 * @param callback function will be called after page loaded 196 */ 197function returnBack(callback) { 198 var bigPage = pageStack.peek(); 199 200 if (bigPage == null || bigPage == undefined) { 201 toastr.warning(i18next.t('msgNoPageToReturn')); 202 return; 203 } 204 205 var page = bigPage.page; 206 207 208 $("main").attr('data-language-page', bigPage.language); 209 $("main").attr('data-language-inner-page', bigPage.innerLanguage); 210 211 if (!page) { 212 pageStack.pop(); 213 location.reload(); 214 } else { 215 pageStack.pop(); 216 var ss = page.containerSelector ? $(page.containerSelector) : $(".mainContainer"); 217 page = page.obj || page; 218 219 if (page instanceof jQuery) { 220 ss.empty().append(page).slideDown(); 221 } else { 222 ss.html(page).slideDown(); 223 } 224 225 getLang(); 226 227 if(typeof callback === "function") { 228 console.log("callback called"); 229 callback(); 230 } 231 232 if (document.querySelectorAll('[data-inputmask]').length > 0) { 233 var elements = document.querySelectorAll('[data-inputmask]') 234 for (var i = 0; i < elements.length; i++) { 235 Inputmask().mask(elements[i]) 236 } 237 } 238 239 240 } 241} 242 243function logout() { 244 if(!loggedOut && !isLoggingOut) { 245 isLoggingOut = true; 246 247 var posting = $.post("logout"); 248 249 posting.done(function (data) { 250 loggedOut = true; 251 isLoggingOut = false;
252 253 window.location = data; 254 }); 255 } 256 257} 258 259function logoutWithoutRedirect() { 260 if(!loggedOut && !isLoggingOut) { 261 isLoggingOut = true; 262 263 var posting = $.post("logout"); 264 265 posting.done(function (data) { 266 // nothing to do, stay where you are 267 loggedOut = true; 268 isLoggingOut = false; 269 }); 270 } 271} 272 273function forceLogout() { 274 if (!loggedOut && !isLoggingOut) { 275 isLoggingOut = true; 276 277 var posting = $.post("forceLogout"); 278 279 posting.done(function (data) { 280 loggedOut = true; 281 isLoggingOut = false; 282 283 window.location = data; 284 }).fail(function(err) { 285 console.log(err); 286 window.location = 'logout.html'; 287 }); 288 } 289} 290 291function bannerClick(page, lang) { 292 var itemID = page; 293 var posting = $.post("getPage", { 294 itemID: itemID 295 }); 296 297 posting.done(function (data) { 298 var ss = $(".mainContainer"); 299 300 $.get(data).done(function(pageData) { 301 $(".mainContainer").empty(); 302 303 ss.attr('data-language-page', itemID); 304 ss.append(pageData).ready(function() { 305 updateMenuAndNav(); 306 getLang(lang); 307 getshortCuts(); 308 setFooter(); 309 }); 310 }).fail(function (err) { 311 toastr.warning(err.responseText); 312 }); 313 }).fail(function (err) { 314 toastr.warning(err.responseText); 315 }); 316} 317 318function nodeClick(elem, lang, sendData) { 319 var pageId = $(elem).attr('data-page'); 320 321 var languageInnerPageValue = $('.mainContainer').attr('data-language-inner-page'); 322 var languagePageValue = $('.mainContainer').attr('data-language-page'); 323 324 if (pageId == 'homepage.html') { 325 $('.mainContainer').attr('data-language-inner-page', 'homepage_inner.html'); 326 } else { 327 $('.mainContainer').attr('data-language-inner-page', pageId); 328 } 329 330 $('.mainContainer').attr('data-language-page', 'homepage.html'); 331 332 if (pageId) { 333 var itemID = pageId; 334 pageHistoryClear(); 335 var id = itemID; 336 337 var posting = $.post("getPage", { 338 itemID: itemID 339 }); 340 341 var menu = $("#" + id).siblings('ul'); 342 343 if (menu.length > 0) { 344 $("#sol_menu ul li ul").css("display", "none"); 345 menu.css("display", "block"); 346 } 347 348 posting.done(function (postPage) { 349 var ss = $(".mainContainer"); 350 ss.attr('data-language-page', itemID); 351 ss.attr('data-short-cut', $(elem).data().oid); 352 353 var data = {}; 354 355 if(sendData) { 356 data = sendData; 357 } 358 359 $.get(postPage, data).done(function(pageData) { 360 $(".mainContainer").empty(); 361 ss.append(pageData).ready(function() { 362 if (pageId != "homepage.html") { 363 updateMenuAndNav(); 364 } 365 getLang(lang); 366 getshortCuts(); 367 }); 368 }).fail(function (err) { 369 toastr.warning(err.responseText); 370 }); 371 372 $('nav.main-nav_yn li.opened').removeClass('opened'); 373 $('#main-navigation-menu li').removeClass('active'); 374 $('#main-navigation-menu').addClass('closed'); 375 $('.main-container-wrapper').removeClass('nav-menu-opened'); 376 377 setFooter(); 378 }).fail(function (err) { 379 toastr.warning(err.responseText); 380 }); 381 382 if(typeof traderInterval != "undefined") { 383 clearInterval(traderInterval); 384 } 385 386 } 387} 388 389function updateMenuAndNav() { 390 var pageTitle, 391 $pageNav = $('nav.page-header-nav'); 392 393 if ($('main .page-title').hasClass('page-title--narrow')) { 394 $pageNav.addClass('col-lg-offset-3 col-lg-6'); 395 } else { 396 $pageNav.removeClass('col-lg-offset-3 col-lg-6'); 397 } 398 399 if ($('main .page-title').hasClass('breadcrumb-hidden')) { 400 $pageNav.addClass('breadcrumb-hidden'); 401 } else { 402 $pageNav.removeClass('breadcrumb-hidden'); 403 } 404 405 pageTitle = $('main .page-title').length > 0 ? $('main .page-title').remove().children('span') : $('.bkt-table-title').length > 0 ? $('.bkt-table-title').remove().children('span') : ''; 406 $pageNav.fadeIn().find('.page-title').empty().append(pageTitle).append($('<i class="fa fa-star-o short-cut" onclick="shortCuts()"></i>')); 407 408 setupBreadcrumb(); 409 410 $(".page-title").show(); 411} 412 413function shortCuts() { 414 var menuOID = document.querySelectorAll('.mainContainer')[0].dataset.shortCut; 415 416 var posting = $.post("shortCutUpdate", { 417 menuOID: menuOID 418 }); 419 420 posting.done(function (data) { 421 if (data.IS_MENU_FAVORITED) { 422 $(".main-container-wrapper").find(".short-cut").removeClass('fa-star-o fa-star').addClass('fa-star'); 423 } else { 424 $(".main-container-wrapper").find(".short-cut").removeClass('fa-star-o fa-star').addClass('fa-star-o'); 425 } 426 427 if(data.RESPONSE === "3") { 428 $('.shortcuts_yn').find('.favorites-menu-list').empty().append('<a href="#">
428' + data.RESPONSE_DATA +'</a>'); 429 } else { 430 updateFavorites(data); 431 } 432 433 }).fail(function (err) { 434 console.log(err); 435 toastr.warning(err.responseText); 436 437 }); 438} 439 440function getshortCuts() { 441 var posting = $.post("getShortCuts", {}); 442 443 posting.done(function (data) { 444 if (data.IS_MENU_FAVORITED) { 445 $(".main-container-wrapper").find(".short-cut").removeClass('fa-star-o fa-star').addClass('fa-star'); 446 } else { 447 $(".main-container-wrapper").find(".short-cut").removeClass('fa-star-o fa-star').addClass('fa-star-o'); 448 } 449 450 if(data.RESPONSE === "3") { 451 $('.shortcuts_yn').find('.favorites-menu-list').empty().append('<a href="#">' + data.RESPONSE_DATA +'</a>'); 452 } else { 453 updateFavorites(data); 454 } 455 456 }).fail(function (err) { 457 console.log(err); 458 toastr.warning(err.responseText); 459 }); 460} 461 462function updateFavorites(data) { 463 $.get('mst/favoritesList.htm') 464 .done(function(template) { 465 var renderedList = Mustache.render(template, data); 466 $('.shortcuts_yn').find('.favorites-menu-list').empty().append(renderedList); 467 }) 468 .fail(function(err) { 469 console.log(err.responseText); 470 }); 471} 472 473$.postJSON = function (url, data, callback) { 474 return jQuery.ajax({ 475 'type': 'POST', 476 'url': url, 477 'contentType': 'application/json', 478 'data': JSON.stringify(data), 479 'dataType': 'json', 480 'success': callback 481 }); 482}; 483 484$.postJSON2 = function (url, data, callback) { 485 return jQuery.ajax({ 486 'type': 'POST', 487 'url': url, 488 'contentType': 'application/json', 489 'data': JSON.stringify(data), 490 'success': callback 491 }); 492}; 493 494toastr.options = { 495 "closeButton": true, 496 "debug": false, 497 "newestOnTop": true, 498 "progressBar": false, 499 "positionClass": "toast-top-right", 500 "preventDuplicates": true, 501 "onclick": null, 502 "showDuration": "300", 503 "hideDuration": "1000", 504 "timeOut": "5000", 505 "extendedTimeOut": "1000", 506 "showEasing": "swing", 507 "hideEasing": "linear", 508 "showMethod": "fadeIn", 509 "hideMethod": "fadeOut" 510} 511 512/** 513 * Check elements added and removed nodes for discrimination 514 * @param element html element 515 * @returns {Boolean} 516 */ 517function isElementShouldBeDiscriminated(element) { 518 if (element == null || element == undefined) { 519 return false; 520 } 521 522 // Can be added new ids or class names in these arrays for new elements thats need to be checked 523 var classNames = ['spinner-overlay', 'chart-tooltip']; 524 var ids = ['toast-container']; 525 526 // Checks for toastr and spinner if these elements added to dom there is no need for language call 527 if(element.addedNodes.length > 0) { 528 returnValue = isNodesNeedToBeDiscriminated(element.addedNodes, ids, classNames); 529 530 if(returnValue == true) { 531 return true; 532 } 533 } 534 535 // Checks for toastr and spinner if these elements removed from dom there is no need for language call 536 if(element.removedNodes.length > 0) { 537 returnValue = isNodesNeedToBeDiscriminated(element.removedNodes, ids, classNames); 538 539 if(returnValue == true) { 540 return true; 541 } 542 } 543 544 return false; 545} 546 547/** 548 * Checks for if nodes discriminated by ids or classNames 549 * 550 * @param nodes dom elements 551 * @param ids id string array 552 * @param classNames class name string array 553 * @returns {Boolean} 554 */ 555function isNodesNeedToBeDiscriminated(nodes, ids, classNames) { 556 if (nodes == undefined) { 557 return false; 558 } 559 560 for(var i=0; i < nodes.length; i++){ 561 var node = nodes[0]; 562 563 for(var j=0; j < ids.length; j++) { 564 if (node.id == ids[j]) { 565 return true; 566 } 567 } 568 569 for(var k=0; k < classNames.length; k++) { 570 if (node.className == classNames[k]) { 571 return true; 572 } 573 } 574 }; 575 576 return false; 577} 578 579function setFooter() { 580 var navMenuHeight = $('#main-navigation-menu').height(); 581 var mainContainerHeight = $('.main-container-wrapper').height(); 582 var bodyHeight = Math.max(navMenuHeight, mainContainerHeight) + 120; 583 $('body').css('min-height', bodyHeight); 584} 585 586//$('[data-toggle="tooltip"]').tooltip(); 587 588function textCapitalize(s){ 589 return s.toLowerCase().replace( /\b./g, function(a){ return a.toUpperCase(); } ); 590} 591 592function truncateString(string, maxLength) { 593 if (string.trim().length > maxLength) 594 return string.trim().substring(0,maxLength) + '...'; 595 else 596 return string.trim(); 597} 598 599/** 600 * Replaces search characters with replacement in given sourceString 601 * 602 * Example:
603 * input: 604 * sourceString: 'List of My Accounts' 605 * search: ' ' -> space character 606 * replacement: '_' 607 * output: 608 * sourceString: 'List_of_My_Accounts' 609 * 610 * @param sourceString 611 * @param search 612 * @param replacement 613 * @param fallbackString if given parameters are not usable then return fallbackString 614 * @returns 615 */ 616function replaceInString(sourceString, search, replacement, fallbackString) { 617 618 if(sourceString == undefined || search == undefined || replacement == undefined) { 619 return fallbackString || ''; 620 } 621 622 return sourceString.split(search).join(replacement); 623} 624 625/** 626 * Gets substring of sourceString to endString 627 * 628 * Example getSubString("test.html?query=123", "?") returns -> "test.html" 629 * 630 * @param sourceString 631 * @param endString 632 * @returns 633 */ 634function getSubstringToEndString(sourceString, endString) { 635 var endIndex = sourceString.indexOf(endString); 636 637 return sourceString.substring(0, endIndex); 638} 639 640function isEmptyString(testString) { 641 return testString == null || testString == undefined || testString.trim().length === 0; 642} 643 644function openContactPopup() { 645 var getting = $.get("contactPageModal.html"); 646 647 getting.done(function (contactPageModal) { 648 var modal = { 649 body : contactPageModal, 650 backEvent : function() { 651 $('.proceed-modal').fadeOut(); 652 $('.proceed-modal').remove(); 653 }, 654 sendEvent : function() { 655 var message = $('#messageArea').val(); 656 var type = $('#typeList').data().selectedKey; 657 var menuItem = $('.page-title').text(); 658 659 var postData = { 660 MESSAGE: message, 661 TYPE: type, 662 MENU_ITEM: menuItem 663 }; 664 665 var posting = $.post("sendContactPageMessage", postData); 666 667 posting.done(function(responseData) { 668 toastr.success(responseData); 669 $('.proceed-modal').fadeOut(); 670 }); 671 672 posting.fail(function(err) { 673 toastr.error(err.responseText); 674 }); 675 } 676 }; 677 initComponents().contactModal(modal); 678 }); 679 680 getting.fail(function (err) { 681 console.log(err.responseText); 682 }); 683} 684 685function initDataTableSettings() { 686 687 if(!$.fn.dataTableExt || !$.fn.dataTableExt.oSort) { 688 return; 689 } 690 691 delete $.fn.dataTableExt.oSort["string-pre"]; 692 693 var numberRegexp = /(\-){0,1}[0-9\,\.]+[ ]+[a-zA-Z]{3}|(\-){0,1}[0-9\,\.]{1,}[ ]*/g; 694 var dateRegexp = /[0-9][0-9][\.][0-9][0-9][\.][0-9][0-9][0-9][0-9]/g; 695 696 $.extend($.fn.dataTableExt.oSort, { 697 "de_datetime-asc": function ( a, b ) { 698 var x, y; 699 if (jQuery.trim(a) !== '') { 700 var deDatea = jQuery.trim(a).split(' '); 701 var deTimea = deDatea[1].split(':'); 702 var deDatea2 = deDatea[0].split('.'); 703 if(typeof deTimea[2] != 'undefined') { 704 x = (deDatea2[2] + deDatea2[1] + deDatea2[0] + deTimea[0] + deTimea[1] + deTimea[2]) * 1; 705 } else { 706 x = (deDatea2[2] + deDatea2[1] + deDatea2[0] + deTimea[0] + deTimea[1]) * 1; 707 } 708 } else { 709 x = -Infinity; // = l'an 1000 ... 710 } 711 712 if (jQuery.trim(b) !== '') { 713 var deDateb = jQuery.trim(b).split(' '); 714 var deTimeb = deDateb[1].split(':'); 715 deDateb = deDateb[0].split('.'); 716 if(typeof deTimeb[2] != 'undefined') { 717 y = (deDateb[2] + deDateb[1] + deDateb[0] + deTimeb[0] + deTimeb[1] + deTimeb[2]) * 1; 718 } else { 719 y = (deDateb[2] + deDateb[1] + deDateb[0] + deTimeb[0] + deTimeb[1]) * 1; 720 } 721 } else { 722 y = -Infinity; 723 } 724 var z = ((x < y) ? -1 : ((x > y) ? 1 : 0)); 725 return z; 726 }, 727 728 "de_datetime-desc": function ( a, b ) { 729 var x, y; 730 if (jQuery.trim(a) !== '') { 731 var deDatea = jQuery.trim(a).split(' '); 732 var deTimea = deDatea[1].split(':'); 733 var deDatea2 = deDatea[0].split('.'); 734 if(typeof deTimea[2] != 'undefined') { 735 x = (deDatea2[2] + deDatea2[1] + deDatea2[0] + deTimea[0] + deTimea[1] + deTimea[2]) * 1; 736 } else { 737 x = (deDatea2[2] + deDatea2[1] + deDatea2[0] + deTimea[0] + deTimea[1]) * 1; 738 } 739 } else { 740 x = Infinity; 741 } 742 743 if (jQuery.trim(b) !== '') { 744 var deDateb = jQuery.trim(b).split(' '); 745 var deTimeb = deDateb[1].split(':'); 746 deDateb = deDateb[0].split('.'); 747 if(typeof deTimeb[2] != 'undefined') { 748 y = (deDateb[2] + deDateb[1] + deDateb[0] + deTimeb[0] + deTimeb[1] + deTimeb[2]) * 1; 749 } else { 750 y = (deDateb[2] + deDateb[1] + deDateb[0] + deTimeb[0] + deTimeb[1]) * 1; 751 } 752 } else { 753 y = -Infinity; 754 } 755 var z = ((x < y) ? 1 : ((x > y) ? -1 : 0)); 756 return z; 757 }, 758 759 "de_date-asc": function ( a, b ) { 760 var x, y; 761 if (jQuery.trim(a) !== '') { 762 var deDatea = jQuery.trim(a).split('.'); 763 x = (deDatea[2] + deDatea[1] + deDatea[0]) * 1; 764 } else { 765 x = Infinity; // = l'an 1000 ... 766 } 767 768 if (jQuery.trim(b) !== '') { 769 var deDateb = jQuery.trim(b).split('.'); 770 y = (deDateb[2] + deDateb[1] + deDateb[0]) * 1; 771 } else { 772 y = -Infinity; 773 } 774 var z = ((x < y) ? -1 : ((x > y) ? 1 : 0)); 775 return z; 776 }, 777 778 "de_date-desc": function ( a, b ) { 779 var x, y; 780 if (jQuery.trim(a) !== '') { 781 var deDatea = jQuery.trim(a).split('.'); 782 x = (deDatea[2] + deDatea[1] + deDatea[0]) * 1; 783 } else { 784 x = -Infinity; 785 } 786 787 if (jQuery.trim(b) !== '') { 788 var deDateb = jQuery.trim(b).split('.'); 789 y = (deDateb[2] + deDateb[1] + deDateb[0]) * 1; 790 } else { 791 y = Infinity; 792 } 793 var z = ((x < y) ? 1 : ((x > y) ? -1 : 0)); 794 return z; 795 }, 796// "string-pre": function ( a ) { 797// // This is a little complex, but faster than always calling toString, 798// // http://jsperf.com/tostring-v-check 799// 800// if (a != null && a != undefined) { 801// if(a.match(/[.\-0-9., a-zA-Z]/g)) { 802// a = a.replace(/[^0-9.]/g, ""); 803// } 804// } 805// 806// return (a == null && a == undefined) ?
807// '' : 808// typeof a === 'string' ? 809// a.toLowerCase() : 810// ! a.toString ? 811// '' : 812// a.toString(); 813// }, 814 "string-asc": function ( x, y ) { 815 var matchType = ''; 816 if (x != null && x != undefined && y != null && y != undefined) { 817 818 var xMatch = x.match(dateRegexp); 819 var yMatch = y.match(dateRegexp); 820 821 if(xMatch != null && yMatch != null && xMatch != undefined && yMatch != undefined) { 822 823 if(xMatch.length == 1 && yMatch.length == 1 && 824 xMatch[0].length == x.length && yMatch[0].length == y.length) { 825 826 827 matchType = 'date'; 828 } 829 } else { 830 xMatch = x.match(numberRegexp); 831 yMatch = y.match(numberRegexp); 832 833 if(xMatch != null && yMatch != null && xMatch != undefined && yMatch != undefined) { 834 835 if(xMatch.length == 1 && yMatch.length == 1 && 836 xMatch[0].length == x.length && yMatch[0].length == y.length) { 837 838 x = xMatch[0].replace(/[^0-9.-]/g, ""); 839 y = yMatch[0].replace(/[^0-9.-]/g, ""); 840 841 matchType = 'money'; 842 } 843 } 844 } 845 } 846 847 x = (x == null && x == undefined) ? 848 '' : 849 typeof x === 'string' ? 850 x.toLowerCase() : 851 ! x.toString ? 852 '' : 853 x.toString(); 854 855 y = (y == null && y == undefined) ? 856 '' : 857 typeof y === 'string' ? 858 y.toLowerCase() : 859 ! y.toString ? 860 '' : 861 y.toString(); 862 863 if(matchType == 'money') { 864 if(!isNaN(x)) { 865 x = parseFloat(x); 866 } 867 868 if(!isNaN(y)) { 869 y = parseFloat(y); 870 } 871 872 return ((x < y) ? -1 : ((x > y) ? 1 : 0)); 873 } else if(matchType == 'date') { 874 var a, b; 875 if (jQuery.trim(x) !== '') { 876 var deDatea = jQuery.trim(x).split('.'); 877 a = (deDatea[2] + deDatea[1] + deDatea[0]) * 1; 878 } else { 879 a = Infinity; // = l'an 1000 ... 880 } 881 882 if (jQuery.trim(y) !== '') { 883 var deDateb = jQuery.trim(y).split('.'); 884 b = (deDateb[2] + deDateb[1] + deDateb[0]) * 1; 885 } else { 886 b = -Infinity; 887 } 888 var z = ((a < b) ? -1 : ((a > b) ? 1 : 0)); 889 return z; 890 } 891 892 return ((x < y) ? -1 : ((x > y) ? 1 : 0)); 893 }, 894 895 "string-desc": function ( x, y ) { 896 var matchType = ''; 897 898 if (x != null && x != undefined && y != null && y != undefined) { 899 900 var xMatch = x.match(dateRegexp); 901 var yMatch = y.match(dateRegexp); 902 903 if(xMatch != null && yMatch != null && xMatch != undefined && yMatch != undefined) { 904 905 if(xMatch.length == 1 && yMatch.length == 1 && 906 xMatch[0].length == x.length && yMatch[0].length == y.length) { 907 908 909 matchType = 'date'; 910 } 911 } else { 912 xMatch = x.match(numberRegexp); 913 yMatch = y.match(numberRegexp); 914 915 if(xMatch != null && yMatch != null && xMatch != undefined && yMatch != undefined) { 916 917 if(xMatch.length == 1 && yMatch.length == 1 && 918 xMatch[0].length == x.length && yMatch[0].length == y.length) { 919 920 x = xMatch[0].replace(/[^0-9.-]/g, ""); 921 y = yMatch[0].replace(/[^0-9.-]/g, ""); 922 923 matchType = 'money'; 924 } 925 } 926 } 927 } 928 929 x = (x == null && x == undefined) ? 930 '' : 931 typeof x === 'string' ? 932 x.toLowerCase() : 933 ! x.toString ? 934 '' : 935 x.toString(); 936 937 y = (y == null && y == undefined) ? 938 '' : 939 typeof y === 'string' ? 940 y.toLowerCase() : 941 ! y.toString ? 942 '' : 943 y.toString(); 944 if(matchType == 'money') { 945 if(!isNaN(x)) { 946 x = parseFloat(x); 947 } 948 949 if(!isNaN(y)) { 950 y = parseFloat(y); 951 } 952 953 return ((x < y) ? 1 : ((x > y) ? -1 : 0)); 954 } else if (matchType == 'date') { 955 var a, b; 956 if (jQuery.trim(x) !== '') { 957 var deDatea = jQuery.trim(x).split('.'); 958 a = (deDatea[2] + deDatea[1] + deDatea[0]) * 1; 959 } else { 960 a = -Infinity; 961 } 962 963 if (jQuery.trim(y) !== '') { 964 var deDateb = jQuery.trim(y).split('.'); 965 b = (deDateb[2] + deDateb[1] + deDateb[0]) * 1; 966 } else { 967 b = Infinity; 968 } 969 var z = ((a < b) ? 1 : ((a > b) ? -1 : 0)); 970 return z; 971 } 972 973 return ((x < y) ? 1 : ((x > y) ? -1 : 0)); 974 } 975 } ); 976} 977 978//# sourceURL=http://ebank.bkt-ks.com/ebanking/js/bktDesktop.js
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.