1var MODULES = MODULES || {}; 2var UNIGATE = window.UNIGATE || { current: {} }; 3MODULES.Utility = {}; 4 5 6$.urlParam = function (name) { 7 var results = new RegExp('[\?&]' + name + '=([^&#]*)').exec(window.location.href); 8 if (results == null) { 9 return null; 10 } 11 return decodeURI(results[1]) || 0; 12} 13 14var sanitizeHTML = function (str) { 15 var temp = document.createElement('div'); 16 temp.textContent = str; 17 return temp.innerHTML; 18}; 19 20$.fn.onlyAllow = function (filter) { 21 if (typeof filter === "string") { 22 filter = filter.split(""); 23 } 24 this.each(function () { 25 $(this).bind("keypress", function (e) { 26 if (e.charCode !== 0 && !e.ctrlKey) { 27 var k = e.which || e.charCode; 28 var t = String.fromCharCode(k), 29 valid = false; 30 if (filter instanceof RegExp) { 31 if (!filter.test(t)) { 32 return false; 33 } 34 } else { 35 if ($.isArray(filter)) { 36 for (var i = 0; i < filter.length; i++) { 37 if (t === filter[i]) { 38 valid = true; 39 } 40 } 41 if (!valid) { 42 return false; 43 } 44 } 45 } 46 } 47 }); 48 }); 49}; 50 51$.fn.disallow = function (filter) { 52 if (typeof filter === "string") { 53 filter = filter.split(""); 54 } 55 this.each(function () { 56 $(this).bind("keypress", function (e) { 57 if (e.charCode !== 0) { 58 var k = e.which || e.charCode; 59 t = String.fromCharCode(k); 60 if (filter instanceof RegExp) { 61 if (filter.test(t)) { 62 return false; 63 } 64 } else { 65 if ($.isArray(filter)) { 66 for (var i = 0; i < filter.length; i++) { 67 if (t === filter[i]) { 68 return false; 69 } 70 } 71 } 72 } 73 } 74 }); 75 }); 76}; 77 78$.fn.onlyNumber = function () { 79 this.onlyAllow(/\d/); 80 81 $(this).bind("paste", function () { 82 var maxLength = $(this).attr("maxlength"); 83 84 if (maxLength != null && maxLength > 0) $(this).removeAttr("maxlength"); 85 86 var element = this; 87 setTimeout(function () { 88 var text = $(element).val(); 89 var regex = /[a-zA-ZıçÄüçöÅİÃÃÄÅÃ.*"#,@æ$%&()=?!'^+/_é<>ô~ïâ¬Â£Â½{\[\]}\\\-~;:¨|\- ]/g; 90 var _final = text.replace(regex, ""); 91 92 if (maxLength != null && maxLength > 0) { 93 $(element).val(_final.substring(0, maxLength)); 94 $(element).attr("maxlength", maxLength); 95 } else { 96 $(element).val(_final); 97 } 98 99 $(element).trigger("focus"); 100 }, 100); 101 }); 102}; 103 104$.fn.onlyEmail = function () { 105 this.disallow("ÅÅÄÄÃüÃçÃöİı !#/*{[()]}"); 106}; 107 108$.fn.onlyNumber = function () { 109 this.onlyAllow(/\d/); 110 111 $(this).bind("paste", function () { 112 var maxLength = $(this).attr("maxlength"); 113 114 if (maxLength != null && maxLength > 0) $(this).removeAttr("maxlength"); 115 116 var element = this; 117 setTimeout(function () { 118 var text = $(element).val(); 119 var regex = /[a-zA-ZıçÄüçöÅİÃÃÄÅÃ.*"#,@æ$%&()=?!'^+/_é<>ô~ïâ¬Â£Â½{\[\]}\\\-~;:¨|\- ]/g; 120 var _final = text.replace(regex, ""); 121 122 if (maxLength != null && maxLength > 0) { 123 $(element).val(_final.substring(0, maxLength)); 124 $(element).attr("maxlength", maxLength); 125 } else { 126 $(element).val(_final); 127 } 128 129 //$(element).trigger('blur'); 130 $(element).trigger("focus"); 131 }, 100); 132 }); 133}; 134 135$.fn.onlyNumberWithDot = function () { 136 this.onlyAllow(/^[1234567890.,\s]+$/); 137 this.disallow(/[*"#@æ$%&()=?!'^+/_é<>£½{\[\]}\\\-~;:¨|\-]/g); 138 139 $(this).bind("paste", function () { 140 var element = this; 141 setTimeout(function () { 142 var text = $(element).val(); 143 var regex = /[1234567890.*"#,@æ$%&()=?!'^+/_é<>£½{\[\]}\\\-~;:¨|\-]/g; 144 var _final = text.replace(regex, ""); 145 $(element).val(_final); 146 $(element).trigger("focus"); 147 }, 100); 148 }); 149}; 150 151$.fn.onlyLetter = function () { 152 this.onlyAllow(/^[a-zA-ZıçÄüçöÅİÃÃÄÅÃ\s]+$/); 153 this.disallow(/[1234567890.*"#,@æ$%&()=?!'^+/_é<>£½{\[\]}\\\-~;:¨|\-]/g); 154 155 $(this).bind("paste", function () { 156 var element = this; 157 setTimeout(function () { 158 var text = $(element).val(); 159 var regex = /[1234567890.*"#,@æ$%&()=?!'^+/_é<>£½{\[\]}\\\-~;:¨|\-]/g; 160 var _final = text.replace(regex, ""); 161 $(element).val(_final); 162 $(element).trigger("focus"); 163 }, 100); 164 }); 165}; 166 167$(".mail-replace").each(function () { 168 var mail = $(this).text(); 169 var mailurl = $(this).attr("data-url"); 170 var showType = $(this).attr("data-type"); 171 if (mailurl == undefined) { 172 mailurl = "medipol.edu.tr"; 173 } 174 var allMail = mail + String.fromCharCode(64) + mailurl; 175 176 if (showType == "noDomain") { 177 var text = mail; 178 } else { 179 var text = mail + String.fromCharCode(64) + mailurl; 180 } 181 182 $(this).html( 183 '<a href="mailto:' + allMail + '" class="contact-mail">
183' + text + "</a>" 184 ); 185}); 186 187$(".tel-replace").each(function () { 188 var tel = $(this).text(); 189 var telNoSpace = tel.replace(/[( )]/g, ""); 190 $(this).html( 191 '<a href="tel:' + telNoSpace + '" class="contact-phone">' + tel + "</a>" 192 ); 193}); 194 195$(".only-number").onlyNumber(); 196$(".only-email").onlyEmail(); 197$(".only-letter").onlyLetter(); 198$(".onlyNumberWithDot").onlyNumberWithDot(); 199 200$('.img-overflow').hover( 201 function () { $(this).parents(".card-body").find("a").addClass('hoverColor') }, 202 function () { $(this).parents(".card-body").find("a").removeClass('hoverColor') } 203) 204$('.card-body h2 a').hover( 205 function () { $(this).parents(".card-body").find(".img-overflow img").addClass('hoverZoom') }, 206 function () { $(this).parents(".card-body").find(".img-overflow img").removeClass('hoverZoom') } 207) 208$("select.select2").select2({ 209 minimumResultsForSearch: 15, 210 closeOnSelect: true, 211 width: "100%", 212 language: UNIGATE.current.language 213}).on("change", function () { 214 if ($(this).hasClass("error")) { 215 $(this).valid(); 216 } 217}); 218 219var ajaxForm; 220MODULES.Utility.FormValidate = (function ($) { 221 var info = "Form Validate"; 222 var _self = this; 223 224 function init() { 225 buildCache(); 226 init(); 227 } 228 229 function buildCache() { 230 _self.$form = $("form"); 231 } 232 233 function init() { 234 ajaxForm = _self.$form; 235 var patternEmail = /^\b[A-Z0-9._%-]+@[A-Z0-9.-]+\.[A-Z]{2,4}\b$/i; 236 function tcknControl(value) { 237 value = value.toString(); 238 var isEleven = /^[0-9]{11}$/.test(value); 239 var totalX = 0; 240 for (var i = 0; i < 10; i++) { 241 totalX += Number(value.substr(i, 1)); 242 } 243 var isRuleX = totalX % 10 == value.substr(10, 1); 244 var totalY1 = 0; 245 var totalY2 = 0; 246 for (var i = 0; i < 10; i += 2) { 247 totalY1 += Number(value.substr(i, 1)); 248 } 249 for (var i = 1; i < 10; i += 2) { 250 totalY2 += Number(value.substr(i, 1)); 251 } 252 var isRuleY = ((totalY1 * 7) - totalY2) % 10 == value.substr(9, 0); 253 return isEleven && isRuleX && isRuleY; 254 } 255 jQuery.validator.addMethod( 256 "isEmail", 257 function (value) { 258 return patternEmail.test(value); 259 }, 260 jQuery.validator.messages.email 261 ); 262 263 jQuery.validator.addMethod( 264 "noSpace", 265 function (value) { 266 return value == "" || value.trim().length != 0; 267 }, 268 jQuery.validator.messages.required 269 ); 270 271 jQuery.validator.addMethod("require_from_group", function ( 272 value, 273 element, 274 options 275 ) { 276 var numberRequired = options[0]; 277 var selector = options[1]; 278 var fields = $(selector, element.form); 279 var filled_fields = fields.filter(function () { 280 // it's more clear to compare with empty string 281 return $(this).val() != ""; 282 }); 283 var empty_fields = fields.not(filled_fields); 284 // we will mark only first empty field as invalid 285 if (filled_fields.length < numberRequired && empty_fields[0] == element) { 286 return false; 287 } 288 return true; 289 // {0} below is the 0th item in the options field 290 }); 291 jQuery.validator.addMethod( 292 "checkrequired", 293 function (value, elem, param) { 294 return $(".checkrequired:checkbox:checked").length > 0; 295 }, 296 function (params, elem) { 297 return $(elem).data("checkrequired"); 298 } 299 ); 300 jQuery.validator.addMethod("phonerule", function (value, element) { 301 $.validator.messages["phonerule"] = $.validator.messages["phone"]; 302 return $(element).inputmask('unmaskedvalue').length > 8; 303 }, ""); 304 jQuery.validator.addMethod("tckn", function (value, element) { 305 $.validator.messages["tckn"] = $.validator.messages["txttckn"]; 306 return tcknControl(value); 307 }, ""); 308 $(".btn-submit").on("click", function (e) { 309 var form = $(this) 310 .parents("form"); 311 312 if (!form.valid()) { 313 $('html,body').animate({ 314 scrollTop: $('label.error:visible').offset().top - 200 315 }, 'swing'); 316 e.preventDefault(); 317 e.stopPropagation(); 318 } else { 319 $(this).addClass("none-event"); 320 } 321 }); 322 jQuery.validator.addMethod( 323 "notEqualToGroup", 324 function (value, element, options) { 325 // get all the elements passed here with the same class 326 var elems = $(element).parents("form").find(options[0]); 327 // the value of the current element 328 var valueToCompare = value; 329 // count 330 var matchesFound = 0; 331 // loop each element and compare its value with the current value 332 // and increase the count every time we find one 333 jQuery.each(elems, function () { 334 thisVal = $(this).val(); 335 if (thisVal == valueToCompare) { 336 matchesFound++; 337 } 338 }); 339 // count should be either 0 or 1 max 340 if (this.optional(element) || matchesFound <= 1) { 341 //elems.removeClass('error'); 342 return true; 343 } else { 344 //elems.addClass('error'); 345 } 346 }, 347 "The device name must be unique" 348 ); 349 valid(); 350 } 351 352 function valid() { 353 jQuery.validator.addClassRules({ 354 checkrequired: { 355 checkrequired: true, 356 }, 357 required: { 358 required: true, 359 noSpace: true, 360 }, 361 requiredcombo: { 362 required: true, 363 }, 364 email: { 365 required: true, 366 isEmail: true, 367 }, 368 phone: { 369 phonerule: true 370 }, 371 tckn: { 372 tckn: true, 373 }, 374 min4: { 375 minlength: 4, 376 }, 377 min6: { 378 minlength: 6, 379 }, 380 min7: { 381 minlength: 7, 382 }, 383 min8: { 384 minlength: 8, 385 }, 386 min10: { 387 minlength: 10, 388 }, 389 min11: { 390 minlength: 11, 391 }, 392 min12: { 393 minlength: 12, 394 }, 395 min16: { 396 minlength: 16, 397 }, 398 fillone: { 399 require_from_group: [1, ".fillone"], 400 }, 401 zonenumber: { 402 startswith: true, 403 } 404 }); 405 jQuery.validator.setDefaults({ 406 ignore: ":hidden, .ignore", 407 errorClass: "error", 408 errorElement: "label", 409 onsubmit: false, 410 errorPlacement: function (error, element) { 411 if ($(element).parent().hasClass("input-group")) { 412 error.insertAfter($(element).parent()); 413 } else if ($(element).hasClass("select2")) { 414 error.insertAfter($(element).siblings(".select2-container")); 415 } else if ($(element).parents().hasClass("check-validate")) { 416 $(element).parents(".check-validate").find("label.error").remove(); 417 $(element).parents(".check-validate").append(error); 418 } else if ($(element).parents().hasClass("checkbox")) { 419 $(element).parents(".checkbox").addClass("error"); 420 error.insertAfter($(element).parents(".checkbox")); 421 } else if ($(element).parents().hasClass("radio-icon")) { 422 $(element).parents(".radio-icon").addClass("error"); 423 $(element).parents(".radio-icon").append(error); 424 $(element) 425 .parents(".radio-inline") 426 .find("label.error") 427 .css("text-align", "left"); 428 error.insertAfter($(element).parents(".checkbox")); 429 } else { 430 error.insertAfter(element); 431 } 432 433 error.attr("role", "alert"); 434 error.attr("aria-live", "polite"); 435 }, 436 highlight: function (element, errorClass) { 437 $(element).addClass("error"); 438 $(element).parents(".form-group").addClass("error"); 439 }, 440 unhighlight: function (element) { 441 $(element).removeClass("error"); 442 $(element).parents(".form-group").removeClass("error"); 443 $(element).parents(".checkbox").removeClass("error"); 444 }, 445 }); 446 } 447 return init; 448})(jQuery); 449 450MODULES.Utility.headerSlick = (function ($) { 451 var info = "Header Slick Slider"; 452 var _self = this; 453
454 function init() { 455 buildCache(); 456 eventListener(); 457 } 458 459 function buildCache() { 460 _self.slick = $(".header-slick-carousel"); 461 _self.headerMenuItem = $(".header-menu-item a"); 462 } 463 464 function eventListener() { 465 _self.slick.slick({ 466 infinite: true, 467 slidesToShow: 1, 468 slidesToScroll: 1, 469 dots: true, 470 arrows: false, 471 touchThreshold: 100, 472 fade: true, 473 cssEase: "linear", 474 autoplay: true, 475 autoplaySpeed: 8000, 476 pauseOnHover: false, 477 pauseOnFocus: false 478 }); 479 480 481 var timer = null 482 483 _self.headerMenuItem.hover(function () { 484 var _ths = this; 485 timer = setTimeout(function (params) { 486 var index = $(_ths).data("index"); 487 _self.slick.slick('slickGoTo', index); 488 }, 300) 489 }, function () { 490 timer && clearTimeout(timer); 491 }) 492 } 493 494 return init; 495})(jQuery); 496 497MODULES.Utility.footerSlick = (function ($) { 498 var info = "Footer Slick Slider"; 499 var _self = this; 500 501 function init() { 502 buildCache(); 503 eventListener(); 504 } 505 506 function buildCache() { 507 _self.slick = $(".footer-slick-carousel"); 508 } 509 510 function eventListener() { 511 _self.slick.slick({ 512 infinite: true, 513 slidesToShow: 8, 514 slidesToScroll: 1, 515 dots: false, 516 arrows: true, 517 prevArrow: "<i class='icon-" + ($("html").attr("dir") == "rtl" ? "right" : "left") + "'></i>", 518 nextArrow: "<i class='icon-" + ($("html").attr("dir") == "rtl" ? "left" : "right") + "'></i>", 519 touchThreshold: 100, 520 responsive: [ 521 { 522 breakpoint: 768, 523 settings: { 524 slidesToShow: 3, 525 slidesToScroll: 3, 526 infinite: true, 527 dots: true, 528 arrows: false, 529 }, 530 }, 531 ], 532 }); 533 } 534 535 return init; 536})(jQuery); 537 538MODULES.Utility.tableResponsive = (function ($) { 539 var info = "Table Responsive"; 540 var _self = this; 541 542 function init() { 543 buildCache(); 544 eventListener(); 545 } 546 547 function buildCache() { 548 _self.$table = $(".table-responsive"); 549 } 550 551 function eventListener() { 552 _self.$table.append('<span class="scrolled-table"></span>'); 553 } 554 555 return init; 556})(jQuery); 557 558MODULES.Utility.slickPlayPause = (function ($) { 559 var info = "Slick Play Pause"; 560 var _self = this; 561 562 function init() { 563 buildCache(); 564 eventListener(); 565 addPauseButton(); 566 } 567 568 function buildCache() { 569 _self.$slick = $(".slick-playpause"); 570 } 571 function addPauseButton() { 572 if (_self.$slick.find(".slick-dots .playpauseli").length === 0) { 573 _self.$slick.each(function () { 574 $(this) 575 .find(".slick-dots") 576 .append('<li class="playpauseli"><div class="playpause"></div><span class="sr-only">Durdur</span></li>'); 577 progress($(this)); 578 }); 579 } 580 } 581 function progress($slider) { 582 var _self = this; 583 var activeDots = $($slider).find(".slick-dots li.slick-active"); 584 $($slider).find(".banner-timer").remove(); 585 activeDots.append( 586 '<div class="banner-timer"><div class="slice1 slice-wrap"> </div><div class="slice2 slice-wrap"> </div></div>' 587 ); 588 } 589 590 function eventListener() { 591 var _this = this; 592 _self.$slick.on("click", ".playpause", function () { 593 var $slider = $(this).parents(".slick-playpause"); 594 595 $(this).toggleClass("pause"); 596 if ($(this).hasClass("pause")) { 597 $slider.find("li .banner-timer").remove(); 598 $slider.slick("slickPause"); 599 $slider.addClass("paused"); 600 } else { 601 $slider.slick("slickPlay"); 602 progress($slider); 603 $slider.removeClass("paused"); 604 } 605 }); 606 } 607 608 return { 609 init: init, 610 progress: progress, 611 addPauseButton: addPauseButton, 612 }; 613})(jQuery); 614MODULES.Utility.Accordion = (function ($) { 615 var info = "Acordion"; 616 var _self = this; 617 var _options = { 618 OnlyOneOpen: true, 619 openAndScroll: Browser.info.safari ? true : false 620 }; 621 622 function init() { 623 buildCache(); 624 eventListener(); 625 accinit(); 626 } 627 628 function buildCache() { 629 (_self.$accordion = $(".acc")), 630 (_self.$button = $(".acc>:first-child")), 631 (_self.$content = $(".acc-content")); 632 } 633 634 function eventListener() { 635 var _self = this; 636
637 $(document).off("click", toggleAccordion); 638 $(document).on("click", ".acc>:first-child", toggleAccordion); 639 window.addEventListener("hashchange", function () { 640 gotoHash(location.hash); 641 }); 642 $(window).on("load", function () { 643 gotoHash(location.hash); 644 }); 645 646 if (_self.$accordion.length < 2) { 647 toggleAccordion.call($(".acc:eq(0)>:first-child")); 648 } 649 } 650 function gotoHash(hash) { 651 var hash = hash.replace("#", ""); 652 if ($('.acc[data-id="' + hash + '"]').length > 0) { 653 $('.acc[data-id="' + hash + '"] button').trigger("click"); 654 } 655 } 656 function accinit() { 657 var count = 0; 658 _self.$button.each(function (k, l) { 659 count++; 660 var accInacc = 661 $(this).parents(".acc-content").find(".acc").length > 0 ? true : false; 662 var acc = $(this).closest(".acc"); 663 664 if (accInacc == true) { 665 acc.parents(".acc").addClass("parentAcc"); 666 } 667 //acc.attr("data-id", slugify($(this).text())); 668 acc.find(".acc-content").attr({ 669 id: "content-" + count, 670 "aria-labelledby": "accordion1", 671 role: "tabpanel", 672 "aria-hidden": "true", 673 }); 674 675 $(this).wrapInner( 676 "<button role='tab' type='button' id='acc-" + 677 count + 678 "' aria-expanded='false' aria-controls='content-" + 679 count + 680 "'></button>" 681 ); 682 683 if (acc.hasClass("active")) { 684 acc.find(".acc-content").attr("aria-hidden", "false"); 685 acc.find("#acc-" + count).attr("aria-expanded", "true"); 686 } 687 }); 688 } 689 690 function toggleAccordion() { 691 var _self = { 692 button: $(this).find("button"), 693 parent: $(this).closest(".acc").parent(), 694 content: $(this).parent().find(".acc-content").first(), 695 expandedStatus: $(this).find("button").attr("aria-expanded"), 696 }; 697 698 if (_options.OnlyOneOpen && !$(this).parent().hasClass("active")) { 699 allAccClose(_self); 700 } 701 702 _self.content.slideToggle(function () { 703 $(this).closest(".acc").toggleClass("active"); 704 705 }); 706 707 accessibility(_self); 708 709 if (_options.openAndScroll) { 710 setTimeout(function () { 711 $("html,body").animate({ scrollTop: _self.button.offset().top - 40 }, 300); 712 }, 600); 713 } 714 715 return false; 716 } 717 718 function accessibility(_self) { 719 if (_self.expandedStatus === "true") { 720 _self.button.attr("aria-expanded", "false"); 721 _self.content.attr("aria-hidden", "true"); 722 } else { 723 _self.button.attr("aria-expanded", "true"); 724 _self.content.attr("aria-hidden", "false"); 725 } 726 } 727 728 function allAccClose(_self) { 729 _self.parent.find(".acc").removeClass("active"); 730 _self.parent.find(".acc button").attr("aria-expanded", "false"); 731 _self.parent 732 .find(".acc") 733 .find(".acc-content") 734 .slideUp() 735 .attr("aria-hidden", "true"); 736 } 737 738 function slugify(text) { 739 var trMap = { 740 çÃ: "c", 741 ÄÄ: "g", 742 ÅÅ: "s", 743 üÃ: "u", 744 ıİ: "i", 745 öÃ: "o", 746 }; 747 for (var key in trMap) { 748 text = text.replace(new RegExp("[" + key + "]", "g"), trMap[key]); 749 } 750 return text 751 .replace(/[^-a-zA-Z0-9\s]+/gi, "") 752 .replace(/\s/gi, "-") 753 .replace(/[-]+/gi, "-") 754 .toLowerCase(); 755 } 756 return init; 757})(jQuery); 758MODULES.Utility.AccTable = (function ($) { 759 var info = "Acordion Table"; 760 var _self = this; 761 762 function init() { 763 buildCache(); 764 eventListener(); 765 accTableinit(); 766 } 767 768 function buildCache() { 769 (_self.$accordionTable = $(".acc-table")), 770 (_self.$accTablebutton = $(".acc-table>:first-child")), 771 (_self.$accTablecontent = $(".acc-content")); 772 } 773 774 function eventListener() { 775 var _self = this; 776 $(document).on("click", ".acc-table .button", function () { 777 $(this).parents(".acc-table").toggleClass("active"); 778 }); 779 780 } 781 782 function accTableinit() { 783 var count = 0; 784 _self.$accTablebutton.each(function (k, l) { 785 count++; 786 var accInacc = 787 $(this).parents(".acc-content").find(".acc").length > 0 ? true : false; 788 var acc = $(this).closest(".acc"); 789 790 if (accInacc == true) { 791 acc.parents(".acc-table").addClass("parentAcc"); 792 } 793 acc.find(".acc-content").attr({ 794 id: "content-" + count, 795 "aria-labelledby": "accordion1", 796 role: "tabpanel", 797 "aria-hidden": "true", 798 }); 799 800 801 if (acc.hasClass("active")) { 802 acc.find(".acc-content").attr("aria-hidden", "false"); 803 acc.find("#acc-" + count).attr("aria-expanded", "true"); 804 } 805 }); 806 } 807 808 function toggleAccordion() { 809 810 811 812 return false;
813 } 814 815 816 return init; 817})(jQuery); 818MODULES.Utility.Loading = (function ($) { 819 820 function show() { 821 //NProgress.configure({ trickleSpeed: 200 }); 822 //NProgress.start(); 823 } 824 825 function hide() { 826 //NProgress.done(); 827 } 828 829 return { 830 show: show, 831 hide: hide 832 }; 833 834})(jQuery); 835//$(window).on("load", function () { 836// MODULES.Utility.Loading.hide(); 837//}) 838$(function () { 839 MODULES.Utility.FormValidate(); 840 MODULES.Utility.footerSlick(); 841 MODULES.Utility.headerSlick(); 842 MODULES.Utility.Accordion(); 843 MODULES.Utility.AccTable(); 844 AccessibilityTab(); 845 $(":input").inputmask(); 846 moment.locale('tr'); 847 848 849 //$('input.birthday').daterangepicker({ 850 // singleDatePicker: true, 851 // showDropdowns: true, 852 // autoApply: true, 853 // minYear: 1901, 854 // maxDate: moment().subtract(18, 'years').format("L"), 855 // startDate: moment().subtract(18, 'years').format("L") 856 //}); 857 858 $('input.birthday').daterangepicker({ 859 singleDatePicker: true, 860 showDropdowns: true, 861 autoApply: true, 862 minYear: 1901, 863 maxDate: moment().subtract(0, 'years').format("L"), 864 startDate: moment().subtract(0, 'years').format("L") 865 }); 866 867 (function linkedSelect() { 868 var options = { 869 attrTarget: 'data-select-target', 870 attrService: 'data-select-service', 871 attrFilter: 'data-select-service-asfilter', 872 method: 'POST', 873 onBeforeFill: function ($source, $target, data) { }, 874 onAfterFill: function (target, source, data) { 875 876 if (!target && source) { 877 target = source; 878 source = null; 879 } 880 881 target.select2({ 882 minimumResultsForSearch: 15, 883 closeOnSelect: true, 884 width: "100%", 885 language: UNIGATE.current.language 886 }); 887 }, 888 service: { 889 onBeforeSend: function (service, data, serviceUri, options, base) { } 890 } 891 }; 892 893 $.linkedSelect.init(options); 894 895 $('.selectTrigger').val('-1').trigger('change'); 896 })(); 897 898 $('[data-toggle="tooltip"]').each(function () { 899 var tooltipContainer = $(this).attr("data-container") || "body"; 900 if ($(window).width() < 992) { 901 tooltipContainer = "body"; 902 } 903 $(this).tooltip({ 904 container: tooltipContainer, 905 trigger: "manual", 906 sanitize: false, 907 template: 908 '<div class="tooltip" role="tooltip"><a href="javacript:;" class="tooltip-close icon-close"></a><div class="arrow"></div><div class="tooltip-inner"></div></div>', 909 }); 910 }); 911 912 $('[data-toggle="tooltip"]').on("click", function () { 913 $(this).toggleClass("active"); 914 $(this).tooltip("toggle"); 915 }); 916 917 $(document).on("click", ".tooltip-close", function () { 918 $('[data-toggle="tooltip"]').removeClass("active"); 919 $('[data-toggle="tooltip"]').tooltip("hide"); 920 return false; 921 }); 922 923 $(document).on("click", function (e) { 924 if ($(e.target).data("toggle") != "tooltip" && !$(e.target).parents(".tooltip")[0]) { 925 $('[data-toggle="tooltip"]') 926 .tooltip("hide") 927 .removeClass("active"); 928 } 929 }); 930 931 if (!isMobile && $(window).width() > 768) { 932 $('[data-table="sticky"]:visible').floatThead({ scrollingTop: 0 }); 933 } 934 $(".modal").on("shown.bs.modal", function () { 935 $("html").addClass("modal-open"); 936 if (!isMobile && $(window).width() > 768) { 937 setTimeout(function () { 938 $('[data-table="sticky"]:visible').floatThead({ scrollingTop: 0 }); 939 }, 300); 940 } 941 }); 942 $(".modal").on("hidden.bs.modal", function () { 943 $("html").removeClass("modal-open"); 944 }); 945 $(".modal").on("hide.bs.modal", function () { 946 $(".table-wrapper").scrollTop(0); 947 $('[data-table="sticky"]').floatThead("destroy"); 948 }); 949 $(".modal").on("hidden.bs.modal", function () { 950 $("html").removeClass("modal-open"); 951 $("#videoModal .embed-responsive").html(''); 952 }); 953 $(".video-play").on("click", function () { 954 $("#videoModal .embed-responsive").html('<iframe class="embed-responsive-item" src="' + $(this).attr("data-video") + '" frameborder="0" allow="accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe>'); 955 }); 956 $(".video-show").on("click", function (e) { 957 if ($(window).width() > 991) { 958 $(this).attr('data-toggle', ''); 959 $(this).attr('data-target', ''); 960 e.preventDefault(); 961 $(this).find('iframe').remove(); 962 $(this).append('<iframe class="embed-responsive-item" src="' + $(this).attr("data-video") + '?autoplay=1" frameborder="0" allow="accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe>'); 963 $(this).find('.video-content').addClass('hide'); 964 } else { 965 966 $("#videoModal .embed-responsive").html('<iframe class="embed-responsive-item" src="' + $(this).attr("data-video") + '" frameborder="0" allow="accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe>'); 967 } 968 }); 969 $('#main-TabContent .nav-link').on('click', function () { 970 if ($(window).width() > 991) { 971 var _self = this; 972 setTimeout(function (params) { 973 $(_self).parents('.tab-content').find('.video-content').removeClass('hide'); 974 $(_self).parents('.tab-content').find('iframe').remove(); 975 }, 400) 976 } else { 977 var href = $(this).attr('href'); 978 $(href).find('.video-show').trigger('click'); 979 } 980 }) 981 982 $('#currencyTab .nav-link').on('click', function () { 983 984 var _self = this; 985 var index = $(_self).parents('.nav-item').index(); 986 $('#currencyTabContent .tab-pane:eq('+ index +') #exchangeFrom').trigger('input'); 987 }); 988 989 MODULES.Utility.slickPlayPause.init(); 990 MODULES.Utility.tableResponsive(); 991 $(".wrapper").removeClass("d-none"); 992 993 $(".breadcrumb-combo").on("click", function () { 994 $(".breadcrumb-combo-list").addClass("show"); 995 }); 996 997 $(".breadcrumb li").not(':last-child').on("click", function () { 998 $(".mobile-breadcrumb-cont").removeClass("show"); 999 $(this).parents('.position-relative').find(".mobile-breadcrumb-cont").addClass("show"); 1000 }); 1001 1002 $(".close-mobile-breadcrumb").on("click", function () { 1003 $(".mobile-breadcrumb-cont").removeClass("show"); 1004 }); 1005 1006 $(document).click(function (event) { 1007 if ( 1008 !$(event.target).closest(".breadcrumb-combo, .breadcrumb-combo-list") 1009 .length 1010 ) { 1011 $(".breadcrumb-combo-list").removeClass("show"); 1012 } 1013 }); 1014 1015 $(document).click(function (event) { 1016 if (!$(event.target).closest(".close-mobile-breadcrumb, .breadcrumb, .mobile-breadcrumb-cont").length) { 1017 $(".mobile-breadcrumb-cont").removeClass("show"); 1018 } 1019 }); 1020 1021 $(".header-bottom nav li.level, .header-search").hover( 1022 function () { 1023 $(this).addClass("hovered").parents("header").addClass("open"); 1024 $(".overlay").addClass("active"); 1025 }, 1026 function () { 1027 $(this).removeClass("hovered").parents("header").removeClass("open"); 1028 $(".overlay").removeClass("active"); 1029 } 1030 ).on("focusin", 1031 function () { 1032 $(this).addClass("hovered").parents("header").addClass("open"); 1033 $(".overlay").addClass("active"); 1034 } 1035 1036 ).focusout( 1037 function () { 1038 $(this).removeClass("hovered").parents("header").removeClass("open"); 1039 $(".overlay").removeClass("active"); 1040 } 1041 ); 1042 1043 $(window).scroll(function () { 1044 var scrollTop = $(window).scrollTop(); 1045 $('.header-bottom nav li.level, .header-search').removeClass('hovered'); 1046 if (scrollTop > 60) { 1047 $('.apply-layout header').addClass('fixed'); 1048 } else { 1049 $('.apply-layout header').removeClass('fixed'); 1050 } 1051 }); 1052 $(".nav-select").on("change", function () { 1053 $(".nav li a[href='" + $(this).val() + "']").trigger("click") 1054 }); 1055 //$(".nav-link").on("click", function () { 1056 // $(".nav-tabs .nav-link").removeClass("active") 1057 //}); 1058 $(".mobile-nav-tabs .nav-link").on("click", function () { 1059 var href = $(this).attr('href'); 1060 $(href).find(".nav-select").trigger('change'); 1061 }); 1062 1063 $("#loremIpsum").modal("show") 1064 1065 1066 1067}); 1068function AccessibilityTab() { 1069 $("#skipHeaderMenu").on('focus', function () { 1070 $(".skipHeaderMenuContainer").addClass('focus'); 1071 $(".isHomePage header").css("top", "36px"); 1072 }) 1073 $("#skipHeaderMenu").on('blur', function () { 1074 $(".skipHeaderMenuContainer").removeClass('focus'); 1075 $(".isHomePage header").css("top", "0"); 1076 }) 1077 $("#skipHeaderMenu").on("click", function () { 1078 $(".content-first-link").addClass("focus"); 1079 $(".content-first-link").focus(); 1080 $(".content-first-link").removeClass("focus"); 1081 $(".skipHeaderMenuContainer").removeClass('focus'); 1082 $(".isHomePage header").css("top", "0"); 1083 }) 1084} 1085 1086$('.tab-change-select').on('change', function () { 1087 var href = $(this).val(); 1088 $('[href="#' + href + '"').trigger('click'); 1089}) 1090$('.talep-takip-button').on('click', function () { 1091 $('[href="#takip"]').trigger('click') 1092}) 1093//Select2 Multiselect 1094jQuery(function ($) { 1095 $.fn.select2.amd.require([
1096 'select2/selection/single', 1097 'select2/selection/placeholder', 1098 'select2/selection/allowClear', 1099 'select2/dropdown', 1100 'select2/dropdown/search', 1101 'select2/dropdown/attachBody', 1102 'select2/utils' 1103 ], function (SingleSelection, Placeholder, AllowClear, Dropdown, DropdownSearch, AttachBody, Utils) { 1104 1105 var SelectionAdapter = Utils.Decorate( 1106 SingleSelection, 1107 Placeholder 1108 ); 1109 1110 SelectionAdapter = Utils.Decorate( 1111 SelectionAdapter, 1112 AllowClear 1113 ); 1114 1115 var DropdownAdapter = Utils.Decorate( 1116 Utils.Decorate( 1117 Dropdown, 1118 DropdownSearch 1119 ), 1120 AttachBody 1121 ); 1122 var base_element = $('.select2-multiple'); 1123 $(base_element).each(function () { 1124 var $this = $(this); 1125 $this.select2({ 1126 selectionAdapter: SelectionAdapter, 1127 dropdownAdapter: DropdownAdapter, 1128 allowClear: false, 1129 width: "100%", 1130 language: UNIGATE.current.language, 1131 templateResult: function (data) { 1132 $(".select2-search").remove(); 1133 if (!data.id) { return data.text; } 1134 1135 var $res = $('<div></div>'); 1136 $res.text(data.text); 1137 1138 if ($(data.element).attr('data-icon')) 1139 $res.append("<i class='" + $(data.element).attr('data-icon') + "'></i>"); 1140 1141 $res.attr("data-id", data.id).addClass('wrap'); 1142 1143 if (data.selected) 1144 $res.addClass("selected"); 1145 1146 $res.on("click", function () { 1147 var $select2Cont = $(this).parents(".select2-results__options"); 1148 if ($(this).hasClass("selected")) { 1149 $(this).removeClass("selected"); 1150 if ($(this).attr("data-id") === "all") { 1151 $this.find('> option').prop('selected', false); 1152 $select2Cont.find(".wrap").removeClass("selected"); 1153 $select2Cont.find(".select2-results__option").attr("aria-selected", false); 1154 } else { 1155 $this.find('option:eq(0)').prop('selected', false); 1156 $select2Cont.find("[data-id=all]").removeClass("selected"); 1157 $select2Cont.find("[data-id=all]").parent().attr("aria-selected", false); 1158 } 1159 $this.trigger("change"); 1160 } else { 1161 $(this).addClass("selected"); 1162 if ($(this).attr("data-id") === "all") { 1163 $this.find('> option').prop('selected', true); 1164 $select2Cont.find(".wrap").addClass("selected"); 1165 $select2Cont.find(".select2-results__option").attr("aria-selected", true); 1166 $this.trigger("change"); 1167 } 1168 } 1169 var selected = ($this.val() || []).length; 1170 var total = $('option', $this).length - 1; 1171 1172 if (selected >= total) { 1173 $this.find('option:eq(0)').prop('selected', true); 1174 $(".select2-results__options").find("[data-id=all]").addClass("selected"); 1175 $(".select2-results__options").find("[data-id=all]").parent().attr("aria-selected", true); 1176 } 1177 }); 1178 1179 return $res; 1180 }, 1181 templateSelection: function (data) { 1182 if (!data.id) { return data.text; } 1183 var selected = ($this.val() || []).length; 1184 var total = $('option', $this).length - 1; 1185 if (selected >= total) { 1186 return $this.find('option:eq(0)').text(); 1187 } 1188 return selected + " fonksiyon seçildi"; 1189 } 1190 }) 1191 }); 1192 }); 1193 $(".internet-subesi").on("click", function () { 1194 $(this).toggleClass("active"); 1195 }) 1196 $(".musteri-ol").on("click", function () { 1197 $(this).toggleClass("active"); 1198 }) 1199 $(".special-you-announcements").on("click", function () { 1200 $(this).addClass("active"); 1201 }) 1202 $('.header-mobile,#fullpage').click(function (event) { 1203 $(".special-you-announcements").removeClass("active") 1204 }); 1205}); 1206 1207 1208$(".redirect-store").on("click", function () { 1209 var appStoreLink = $(this).data("appstore"); 1210 var playStoreLink = $(this).data("playstore"); 1211 if (navigator.userAgent.toLowerCase().indexOf("iphone") > -1) { window.location.href = appStoreLink; } 1212 1213 if (navigator.userAgent.toLowerCase().indexOf("android") > -1) { window.location.href = playStoreLink; } 1214}) 1215 1216$(document).on('keyup', function (event) {
1217 var $focusedElement = $(document.activeElement); 1218 if (event.keyCode == 9) { 1219 //Site tab gezintisi 1220 $("body").addClass("Accessibility"); 1221 } 1222 if (event.keyCode == 13) { 1223 //Label & Checkbox Enter Click 1224 if ($focusedElement.prop('tagName').toLowerCase() == "label") { 1225 $focusedElement.trigger("click"); 1226 } 1227 } 1228}); 1229$(document).on('click', function (e) { 1230 $("body").removeClass("Accessibility"); 1231}); 1232 1233 1234 1235/**************** GLOBAL MODULE TEMPLATE ********************** 1236 1237MODULES.Utility.XXX = (function ($) { 1238 1239 var info = "MODUL NAME"; 1240 var _self = this; 1241 1242 function init() { 1243 buildCache(); 1244 eventListener(); 1245 } 1246 1247 function buildCache() { 1248 } 1249 1250 function eventListener() { 1251 } 1252 1253 return init; 1254 1255})(jQuery); 1256 1257**************** GLOBAL MODULE TEMPLATE **********************/ 1258 1259$(function () { 1260 1261 var hash = window.location.hash; 1262 1263 $("ul.nav.nav-tabs li a").on("click", function (e) { 1264 e.preventDefault(); 1265 1266 if(history.pushState) { 1267 history.pushState(null, null, '#' + $(e.target).parents("li").attr("id")); 1268 } 1269 else { 1270 location.hash = '#' + $(e.target).parents("li").attr("id"); 1271 } 1272 }); 1273 1274 if (hash && $(hash).offset()) { 1275 $(hash).find("a").click(); 1276 setTimeout(function(){ 1277 $('html, body').animate({ 1278 scrollTop: $(hash).offset().top - 50 1279 }, 1500); 1280 },0) 1281 } 1282});
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.