1// page init 2jQuery(function () { 3 hideEmptyEvents(); 4 5 jQuery('input, textarea').placeholder(); 6 initSameHeight(); 7 initNavigationSelect(); 8 initTabs(); 9 initCustomForms(); 10 initOpenClose(); 11 initAccordion(); 12 initMobileNav(); 13 initChildClasses(); 14 initAjaxLoading(); 15 initLayout(); 16 initCarousel(); 17 initSlideShow(); 18 initMobileNavigation(); 19 initSelectTabs(); 20 initDotdot(); 21 initTabNav(); 22 initDatepicker(); 23 initCheckList(); 24 initCustomCycleCarousel(); 25 26 // Added by Dev 27 initDirectory(); 28 initNewsletter(); 29 initJobs(); 30 initPopups(); 31 initNewsTicker(); 32}); 33function refreshScrollbars() { 34 $('.same-height-right .jcf-scrollable,.same-height-left .jcf-scrollable').each(function () { 35 var $this = this; 36 var scrollableInstance = jcf.getInstance($this); 37 if (scrollableInstance) { 38 var parent = $($this).closest('.same-height-right,.same-height-left'); 39 40 41 $($this).height($($this).closest('.same-height-right,.same-height-left').height()); 42 43 $($this).height(parent.height()); 44 45 46 scrollableInstance.isModifiedStyles = 1; 47 scrollableInstance.refresh(); 48 } 49 50 51 52 }); 53} 54function resetScrollbars(wrapper) { 55 $(wrapper).find('.jcf-scrollable').each(function () { 56 $(this).closest('.jcf-scrollable-wrapper').css({ height: '', overflow: '' }); 57 $(this).css({ height: '', overflow: '' }); 58 }); 59} 60// fade gallery init 61function initNewsTicker() { 62 jQuery('.news-heading').fadeGallery({ 63 slides: '.item', 64 event: 'click', 65 useSwipe: true, 66 autoRotation: false, 67 autoHeight: true, 68 switchTime: 3000, 69 animSpeed: 500 70 }); 71} 72 73 74 75 76function hideEmptyEvents() { 77 jQuery(document).ready(function () { 78 jQuery(".events-block:not(:has(.content a,.showtimes))").hide(); 79 }); 80} 81 82function initJobs() { 83 jQuery('#jobno').val(''); 84 jQuery('#department-field').val(''); 85 jQuery('#location-field').val(''); 86} 87 88function loadJobPage(id, p, type) { 89 var jobno = jQuery('#jobno').val(); 90 var department = jQuery('#department').val(); 91 //var location = jQuery('#location-field').val(); 92 var location = ""; 93 94 95 $(".loading-block").load("/modules/job/?id=" + id + "&type=" + type + "&p=" + p + "&jobno=" + encodeURIComponent(jobno) + "&department=" + encodeURIComponent(department) + "&location=" + encodeURIComponent(location)); 96} 97 98 99function initNewsletter() { 100 jQuery('.subscribe-form').on('submit', function () { 101 jQuery.ajax({ 102 type: "POST", 103 data: { 104 Email: jQuery('#email').val() 105 }, 106 url: "/modules/newsletter/?do=signup", 107 context: document.body 108 }).done(function (response) { 109 alert("Your email address has been added to the " + response + " newsletter!"); 110 jQuery('#email').val(""); 111 }); 112 return false; 113 }); 114} 115 116 117// popups init 118function initPopups() { 119 jQuery('.row').contentPopup({ 120 mode: 'click', 121 hideOnClickLink: false, 122 hideOnClickOutside: false, 123 btnOpen: '.btn-search', 124 openClass: 'active' 125 }); 126} 127 128 129/* 130 * Popups plugin 131 */ 132; (function ($) { 133 function ContentPopup(opt) { 134 this.options = $.extend({ 135 holder: null, 136 popup: '.popup', 137 btnOpen: '.open', 138 btnClose: '.close', 139 openClass: 'popup-active', 140 clickEvent: 'click', 141 mode: 'click', 142 hideOnClickLink: true, 143 hideOnClickOutside: true, 144 delay: 50 145 }, opt); 146 if (this.options.holder) { 147 this.holder = $(this.options.holder); 148 this.init(); 149 } 150 } 151 ContentPopup.prototype = { 152 init: function () { 153 this.findElements(); 154 this.attachEvents(); 155 }, 156 findElements: function () { 157 this.popup = this.holder.find(this.options.popup); 158 this.btnOpen = this.holder.find(this.options.btnOpen); 159 this.btnClose = this.holder.find(this.options.btnClose); 160 }, 161 attachEvents: function () { 162 // handle popup openers 163 var self = this; 164 this.clickMode = isTouchDevice || (self.options.mode === self.options.clickEvent); 165 166 if (this.clickMode) { 167 // handle click mode 168 this.btnOpen.bind(self.options.clickEvent, function (e) { 169 if (self.holder.hasClass(self.options.openClass)) { 170 if (self.options.hideOnClickLink) { 171 self.hidePopup(); 172 } 173 } else { 174 self.showPopup(); 175 } 176 e.preventDefault(); 177 }); 178 179 // prepare outside click handler 180 this.outsideClickHandler = this.bind(this.outsideClickHandler, this); 181 } else { 182 // handle hover mode 183 var timer, delayedFunc = function (func) { 184 clearTimeout(timer); 185 timer = setTimeout(function () { 186 func.call(self); 187 }, self.options.delay); 188 }; 189 this.btnOpen.bind('mouseover', function () { 190 delayedFunc(self.showPopup); 191 }).bind('mouseout', function () { 192 delayedFunc(self.hidePopup); 193 }); 194 this.popup.bind('mouseover', function () { 195 delayedFunc(self.showPopup); 196 }).bind('mouseout', function () { 197 delayedFunc(self.hidePopup); 198 }); 199 } 200 201 // handle close buttons 202 this.btnClose.bind(self.options.clickEvent, function (e) { 203 self.hidePopup(); 204 e.preventDefault(); 205 }); 206 }, 207 outsideClickHandler: function (e) { 208 // hide popup if clicked outside 209 var currentNode = (e.changedTouches ? e.changedTouches[0] : e).target; 210 if (!$(currentNode).parents().filter(this.holder).length) { 211 this.hidePopup(); 212 } 213 }, 214 showPopup: function () { 215 // reveal popup 216 this.holder.addClass(this.options.openClass); 217 this.popup.css({ display: 'block' }); 218 219 // outside click handler 220 if (this.clickMode && this.options.hideOnClickOutside && !this.outsideHandlerActive) { 221 this.outsideHandlerActive = true; 222 $(document).bind('click touchstart', this.outsideClickHandler); 223 } 224 }, 225 hidePopup: function () { 226 // hide popup 227 this.holder.removeClass(this.options.openClass); 228 this.popup.css({ display: 'none' }); 229 230 // outside click handler 231 if (this.clickMode && this.options.hideOnClickOutside && this.outsideHandlerActive) { 232 this.outsideHandlerActive = false;
233 $(document).unbind('click touchstart', this.outsideClickHandler); 234 } 235 }, 236 bind: function (f, scope, forceArgs) { 237 return function () { return f.apply(scope, forceArgs ? [forceArgs] : arguments); }; 238 } 239 }; 240 241 // detect touch devices 242 var isTouchDevice = /MSIE 10.*Touch/.test(navigator.userAgent) || ('ontouchstart' in window) || window.DocumentTouch && document instanceof DocumentTouch; 243 244 // jQuery plugin interface 245 $.fn.contentPopup = function (opt) { 246 return this.each(function () { 247 new ContentPopup($.extend(opt, { holder: this })); 248 }); 249 }; 250}(jQuery)); 251 252var directoryCategory = "ALL"; 253var directoryAlpha = "ALL"; 254var directorySearch = ""; 255 256function initDirectory() { 257 initAlpha(); 258 initSearch(); 259} 260 261function initAlpha() { 262 jQuery('.alphabet a').each(function () { 263 var holder = jQuery(this); 264 holder.on('click', function () { 265 setAlpha(this); 266 var value = this.innerHTML.toLowerCase(); 267 if (value == "#") { 268 value = "digit"; 269 } 270 directoryAlpha = value; 271 updateResults(); 272 return false; 273 }); 274 }); 275} 276 277function initSearch() { 278 279 jQuery('.btn-search').on('click', function () { 280 resetSearch(); 281 resetAlpha(); 282 jQuery('.search-text').focus(); 283 }); 284 285 jQuery('.search-text').on('keyup', function () { 286 doSearch(this.value); 287 }); 288 289 jQuery('.popup .close').on('click', function () { 290 resetSearch(); 291 updateResults(); 292 }); 293} 294 295function doSearch(value) { 296 directorySearch = value.toLowerCase(); 297 updateResults(); 298} 299 300function resetSearch() { 301 jQuery('.search-text').val(''); 302 directorySearch = ""; 303} 304 305function setAlpha(el) { 306 clearAlpha(); 307 jQuery(el).addClass("active"); 308 directoryAlpha = el.innerHTML; 309} 310 311function resetAlpha() { 312 clearAlpha(); 313 jQuery('.alphabet .all').addClass("active"); 314 directoryAlpha = "ALL"; 315} 316 317function clearAlpha() { 318 jQuery('.alphabet a').each(function () { 319 var holder = jQuery(this); 320 holder.removeClass("active"); 321 }); 322} 323 324function updateResults() { 325 $(".directory-block").load("/modules/directory/?type=component&id=" + directoryId + "&alpha=" + directoryAlpha + "&search=" + encodeURIComponent(directorySearch)); 326} 327 328 329// Called by initDatepicker's onSelect() 330function filterActivity(startDate) { 331 if (startDate) { 332 jQuery('#startDate').val(startDate); 333 } 334 335 var activityId = jQuery('#activityId').val(); 336 var templateFolder = jQuery('#templateFolder').val(); 337 var sectionId = jQuery('#sectionId').val(); 338 var startDate = jQuery('#startDate').val(); 339 var programId = jQuery('#programId').val(); 340 341 342 $(".loading-block").load("/modules/activity/?p=1&id=" + activityId + "&tf=" + templateFolder + "&sd=" + startDate + "&sec=" + sectionId + "&filterData=" + filterData + "&programId=" + programId, function () { 343 initOpenClose(); 344 initAjaxLoading(); 345 }); 346} 347 348var filterData = ""; 349 350function filterActivityCategory() { 351 filterData = ""; 352 jQuery(".categories-list input").each(function (index) { 353 var itemChecked = jQuery(this).is(':checked'); 354 var itemName = jQuery(this).attr('name'); 355 356 filterData += "|" + itemName + ":" + itemChecked; 357 }); 358 filterActivity(); 359} 360// End - Added by Dev 361 362function initDatepicker() { 363 //activity filer datepicker 364 var datepicker = jQuery('aside .datepicker').datepicker({ 365 showOtherMonths: true, 366 selectOtherMonths: true, 367 showButtonPanel: true, 368 currentText: 'Today', 369 // Added by Dev 370 onSelect: function (date) { 371 filterActivity(date); 372 } 373 }); 374 //home page with calendar with circle dates 375 jQuery('.block-holder .datepicker').each(function () { 376 var datepicker = jQuery(this); 377 var tooltipEvents = []; 378 379 // search event 380 var getEventData = function (date) { 381 var dateStr = jQuery.datepicker.formatDate('mm/dd/yy', date); 382 for (var i = 0; i < tooltipEvents.length; i++) { 383 if (tooltipEvents[i].date === dateStr) { 384 return tooltipEvents[i]; 385 } 386 } 387 }; 388 389 // load tooltip data 390 var reloadTooltipList = function (year, month) { 391 tooltipEvents = []; 392 /* jQuery.ajax({ 393 type: 'get', 394 cache: false, 395 url: datepicker.data('source'), 396 data: 'month='+month+'&year='+year, 397 dataType: 'json', 398 success: function(events) { 399 tooltipEvents = events; 400 datepicker.datepicker('refresh'); 401 } 402 });*/ 403 }; 404 405 datepicker.datepicker({ 406 showOtherMonths: true, 407 onSelect: function (date) { 408 jQuery.ajax({ 409 type: 'get', 410 cache: false, 411 url: "/modules/activity/?do=setDate", 412 data: 'date=' + date, 413 dataType: 'json', 414 complete: function (events) { 415 window.location.href = "/events/"; 416 } 417 }); 418 }, 419 beforeShowDay: function (date) { 420 var currentDate = new Date(date.getTime()), 421 eventData = getEventData(date), 422 pickerBlock = jQuery(this); 423 424 if (eventData) { 425 var addTooltip = function () { 426 // find matching cell 427 var eventCells = pickerBlock.find('td'); 428 var eventCell = eventCells.filter(function () { 429 return this.getAttribute('data-month') == currentDate.getMonth() && 430 this.getAttribute('data-year') == currentDate.getFullYear() && 431 this.children[0] && this.children[0].innerHTML == currentDate.getDate(); 432 }); 433 eventCell.addClass('event'); 434 }; 435 setTimeout(addTooltip, 1); 436 437 } 438 return [true, true]; 439 }, 440 onChangeMonthYear: reloadTooltipList 441 }); 442 443 // load initial events 444 var selectedDate = datepicker.datepicker('getDate'); 445 reloadTooltipList(selectedDate.getFullYear(), selectedDate.getMonth() + 1); 446 }); 447} 448 449 450// cycle vertical gallery init 451function initCustomCycleCarousel() { 452 var win = jQuery(window); 453 454 jQuery('.visual').each(function () { 455 var mainGallery = jQuery(this); 456 var pagingGallery = mainGallery.find('.pagination'); 457 var pagingSlideshow = mainGallery.find('.slideshow'); 458 var pagingHolder = pagingGallery.find('.pagination-gallery'); 459 var pagingSlides = pagingGallery.find('li'); 460 var isMainSlide = true; 461 462 pagingSlides.each(function (i) { 463 var slide = jQuery(this); 464 465 slide.attr('data-index', i); 466 if (i > 0) { 467 slide.prependTo(pagingHolder); 468 } 469 jQuery('<span></span>').insertAfter(slide.find(' img')); 470 }); 471 472 jQuery('<a class="scorll-arrow" href="#">scorll arrow</a>').insertAfter(pagingGallery.find(pagingHolder)); 473 474 pagingSlides.eq(0).prependTo(pagingHolder); 475 476 function resizePagingSlides() { 477 pagingGallery.css({ 478 height: pagingSlideshow.outerHeight() 479 }); 480 pagingSlides.css({ 481 height: pagingSlideshow.outerHeight() / 3 482 }); 483 } 484 485 resizePagingSlides(); 486 487 mainGallery.fadeGallery({ 488 slides: '.slide', 489 pagerLinks: null, 490 event: 'click', 491 btnPrev: 'a.prev', 492 btnNext: 'a.next', 493 useSwipe: true, 494 autoRotation: true, 495 autoHeight: true, 496 switchTime: 4000, 497 animSpeed: 500, 498 onBeforeChange: function (self) { 499 var pagingGalleryAPI = pagingGallery.data('CycleCarousel2'); 500 501 if (pagingGalleryAPI && isMainSlide) { 502 var curSlide = pagingGalleryAPI.slideset.find(pagingGalleryAPI.options.slides).filter('[data-index="' + this.currentIndex + '"]'); 503 504 505 if (this.direction < 1) { 506 pagingGalleryAPI.switchSlide(1, false); 507 } else { 508 pagingGalleryAPI.switchSlide(1, true); 509 } 510 511 } 512 } 513 }); 514 515 pagingGallery.cycleCarousel2({ 516 slideset: '.pagination-gallery', 517 slides: '> li', 518 animSpeed: 500, 519 btnPrev: '.btn-prev', 520 btnNext: '.scorll-arrow, .btn-next', 521 autoRotation: false, 522 switchTime: 4000, 523 vertical: true, 524 step: 1, 525 onInit: function () { 526 var self = this; 527 this.slides.eq(0).addClass('active'); 528 this.slides.on('click', function (e) { 529 e.preventDefault(); 530 self.switchSlide(jQuery(this).index(), true); 531 532 }); 533 }, 534 onBeforeChange: function (slide, direction) { 535 isMainSlide = false;
536 num = slide.data('index'); 537 if (direction) { 538 num--; 539 } 540 541 if (mainGallery.data('FadeGallery')) { 542 mainGallery.data('FadeGallery').numSlide(num); 543 } 544 }, 545 onChange: function () { 546 isMainSlide = true; 547 this.slides.removeClass('active'); 548 this.slides.eq(0).addClass('active'); 549 } 550 }); 551 552 win.on('load resize orientationchange', resizePagingSlides); 553 }); 554 555} 556 557// fade gallery init 558//function initSlideShow() { 559// jQuery('.slideshow').fadeGallery({ 560// slides: '.slide', 561// btnPrev: 'a.btn-prev', 562// btnNext: 'a.btn-next', 563// event: 'click', 564// autoRotation: false, 565// autoHeight: true, 566// switchTime: 4000, 567// animSpeed: 500, 568// useSwipe: true 569// }); 570//} 571 572 573function initDotdot() { 574 var rowsCount = 2; 575 jQuery('.slideshow-news .slide a').each(function () { 576 var text = jQuery(this); 577 578 text.dotdotdot({ 579 height: parseInt(text.css('lineHeight')) * rowsCount, 580 ellipsis: '...', 581 watch: 'window', 582 windowResizeFix: true 583 }); 584 }); 585} 586 587// align blocks height 588function initSameHeight() { 589 jQuery('.info-holder').sameHeight({ 590 elements: '.info-block', 591 flexible: true, 592 multiLine: true, 593 biggestHeight: true 594 }); 595 ResponsiveHelper.addRange({ 596 '998..': { 597 on: function () { 598 jQuery('#two-columns').sameHeight({ 599 elements: '.adds-area, .features-events-area', 600 flexible: true, 601 multiLine: true, 602 biggestHeight: true, 603 onBeforeResize: function (wrapper) { 604 605 resetScrollbars(wrapper); 606 }, 607 608 onResize: function () { 609 refreshScrollbars(); 610 611 } 612 }); 613 } 614 }, 615 '..998': { 616 on: function () { 617 jQuery('.adds-area').css('height', 'auto'); 618 jQuery('.features-events-area').css('height', 'auto'); 619 jQuery('.features-events-block').removeClass('jcf-scrollable'); 620 } 621 } 622 }); 623} 624 625// mobile navigation init 626function initMobileNavigation() { 627 jQuery('.nav-holder').mobileNavigation(); 628} 629 630function initSelectTabs() { 631 jQuery('.tabset-panel').each(function () { 632 var holder = jQuery(this); 633 var select = holder.find('select'); 634 var tabset = holder.find('.tabset'); 635 636 select.on('change', function () { 637 var link = jQuery('a[href="' + jQuery(this).val() + '"]'); 638 link.trigger('click'); 639 }); 640 641 tabset.on('click', 'a', function () { 642 var link = jQuery(this); 643 var option = jQuery('option[value="' + link.attr('href') + '"]'); 644 option.attr('selected', 'selected'); 645 jcf.refresh(select); 646 }); 647 }); 648 jQuery('.tab-area-styled').each(function () { 649 var holder = jQuery(this); 650 var select = holder.find('select'); 651 var tabset = holder.find('.tabset'); 652 653 select.on('change', function () { 654 var link = jQuery('a[href="' + jQuery(this).val() + '"]'); 655 link.trigger('click'); 656 }); 657 658 tabset.on('click', 'a', function () { 659 var link = jQuery(this); 660 var option = jQuery('option[value="' + link.attr('href') + '"]'); 661 option.attr('selected', 'selected'); 662 jcf.refresh(select); 663 }); 664 }); 665} 666 667// "tab" key handling 668function initTabNav() { 669 jQuery('#nav').tabNav({ 670 items: 'li' 671 }); 672} 673 674function initCheckList() { 675 jQuery('.categories-list').each(function () { 676 var holder = jQuery(this); 677 var checkboxAll = holder.find('.checkbox-all'); 678 var checkboxes = holder.find('input').not(checkboxAll); 679 var drops = holder.find('.drop-list').slideUp(0); 680 var openers = holder.find('input.opener'); 681 var itemsHasDrop = holder.find('li:has(.drop-list)'); 682 683 itemsHasDrop.each(function () { 684 var item = jQuery(this); 685 var opener = item.find('.opener'); 686 var drop = item.find('.drop-list'); 687 var dropInput = drop.find('input'); 688 689 dropInput.on('change', function () {
690 if (drop.find('input:checked').length === 0) { 691 opener.trigger('click'); 692 } 693 }); 694 695 opener.data({ 696 drop: drop, 697 item: item 698 }); 699 }); 700 701 checkboxAll.on('change', function () { 702 checkboxes.prop('checked', this.checked); 703 jcf.refresh(checkboxes); 704 }); 705 706 openers.on('change', function () { 707 var opener = jQuery(this); 708 var drop = opener.data('drop'); 709 var item = opener.data('item'); 710 var checkboxesDrop = drop.find('input'); 711 712 if (this.checked) { 713 drop.slideDown(); 714 checkboxesDrop.prop('checked', true); 715 } else { 716 drop.slideUp(); 717 checkboxesDrop.prop('checked', false); 718 } 719 jcf.refresh(checkboxesDrop); 720 }); 721 722 checkboxes.on('click', function () { 723 getCheck(); 724 }); 725 726 function getCheck() { 727 checkboxAll.prop('checked', false); 728 if (holder.find('input:checked').length === checkboxes.length) { 729 checkboxAll.prop('checked', true); 730 } 731 jcf.refresh(checkboxAll); 732 filterActivityCategory(); 733 } 734 }); 735} 736 737 738// scroll gallery init 739function initCarousel() { 740 jQuery('.calendar-carousel').scrollGallery({ 741 mask: '.mask', 742 slider: '.calendar-slideset', 743 slides: '.slide', 744 btnPrev: 'a.btn-prev', 745 btnNext: 'a.btn-next', 746 pagerLinks: '.calendar-heading .box', 747 stretchSlideToMask: true, 748 maskAutoSize: true, 749 autoRotation: false, 750 switchTime: 4000, 751 animSpeed: 500, 752 step: 1 753 }); 754 jQuery('.features-events').scrollGallery({ 755 mask: '.mask', 756 slider: '.slideset', 757 slides: '.slide', 758 btnPrev: 'a.btn-prev', 759 btnNext: 'a.btn-next', 760 generatePagination: '.pagination', 761 maskAutoSize: true, 762 stretchSlideToMask: true, 763 autoRotation: false, 764 switchTime: 3000, 765 animSpeed: 500 766 }); 767} 768 769//// fade gallery init 770function initSlideShow() { 771 jQuery('.slideshow-news').fadeGallery({ 772 slides: '.slide', 773 btnPrev: 'a.btn-prev', 774 btnNext: 'a.btn-next', 775 pagerLinks: '.pagination li', 776 event: 'click', 777 disableFadeIE: true, 778 useSwipe: true, 779 autoRotation: true, 780 autoHeight: true, 781 switchTime: 4000, 782 animSpeed: 500 783 }); 784 jQuery('.carousel.home-gallery').fadeGallery({ 785 slides: '.slide', 786 btnPrev: 'a.btn-prev', 787 btnNext: 'a.btn-next', 788 pagerLinks: '.pagination li', 789 event: 'click', 790 disableFadeIE: true, 791 useSwipe: true, 792 autoRotation: true, 793 autoHeight: true, 794 switchTime: 4000, 795 animSpeed: 500 796 }); 797} 798 799// responsive layout handling 800function initLayout() { 801 var isIE8 = navigator.appVersion.indexOf("MSIE 8") != -1; 802 // find elements 803 var footerGallery = jQuery('.footer-gallery'); 804 var contentGallery = jQuery('.fade-gallery'); 805 var timer; 806 807 if (isIE8) { 808 footerGallery.scrollGallery({ 809 mask: '.mask', 810 slider: '.slideset', 811 slides: '.slide', 812 btnPrev: 'a.btn-prev', 813 btnNext: 'a.btn-next', 814 generatePagination: '.pagination', 815 stretchSlideToMask: true, 816 maskAutoSize: true, 817 autoRotation: true, 818 switchTime: 4000, 819 animSpeed: 500, 820 step: 1 821 }); 822 contentGallery.fadeGallery({ 823 slides: 'div.slide', 824 btnPrev: 'a.btn-prev', 825 btnNext: 'a.btn-next', 826 pagerLinks: '.pagination li', 827 event: 'click', 828 useSwipe: true, 829 autoRotation: true, 830 autoHeight: true, 831 switchTime: 4000, 832 animSpeed: 500, 833 step: 1 834 }); 835 } else { 836 // handle layout resize 837 ResponsiveHelper.addRange({ 838 '768..': { 839 on: function () { 840 clearTimeout(timer); 841 timer = setTimeout(function () { 842 footerGallery.each(function () { 843 var carousel = jQuery(this); 844 845 if (carousel.data('FadeGallery')) { 846 carousel.data('FadeGallery').destroy(); 847 } 848 carousel.scrollGallery({ 849 mask: '.mask', 850 slider: '.slideset', 851 slides: '.slide', 852 btnPrev: 'a.btn-prev', 853 btnNext: 'a.btn-next', 854 generatePagination: '.pagination', 855 stretchSlideToMask: true, 856 maskAutoSize: true, 857 autoRotation: true, 858 switchTime: 4000, 859 animSpeed: 500, 860 step: 1 861 }); 862 }); 863 contentGallery.each(function () { 864 var carousel = jQuery(this); 865 866 if (carousel.data('ScrollGallery')) { 867 carousel.data('ScrollGallery').destroy(); 868 } 869 carousel.fadeGallery({ 870 slides: 'div.slide', 871 btnPrev: 'a.btn-prev', 872 btnNext: 'a.btn-next', 873 pagerLinks: '.pagination li', 874 event: 'click', 875 useSwipe: true, 876 autoRotation: true, 877 autoHeight: true, 878 switchTime: 4000, 879 animSpeed: 500, 880 step: 1 881 }); 882 }); 883 }, 100); 884 } 885 }, 886 '..767': { 887 on: function () { 888 clearTimeout(timer); 889 timer = setTimeout(function () { 890 footerGallery.each(function () { 891 var carousel = jQuery(this); 892 893 if (carousel.data('ScrollGallery')) { 894 carousel.data('ScrollGallery').destroy(); 895 } 896 carousel.fadeGallery({ 897 slides: 'div.slide', 898 btnPrev: 'a.btn-prev', 899 btnNext: 'a.btn-next', 900 pagerLinks: '.pagination li', 901 event: 'click', 902 useSwipe: true, 903 autoRotation: true, 904 autoHeight: true, 905 switchTime: 4000, 906 animSpeed: 500 907 }); 908 }); 909 contentGallery.each(function () { 910 var carousel = jQuery(this); 911 912 if (carousel.data('FadeGallery')) { 913 carousel.data('FadeGallery').destroy(); 914 } 915 carousel.scrollGallery({ 916 mask: '.mask', 917 slider: '.slideset', 918 slides: '.slide', 919 btnPrev: 'a.btn-prev', 920 btnNext: 'a.btn-next', 921 generatePagination: '.pagination', 922 stretchSlideToMask: true, 923 maskAutoSize: true, 924 autoRotation: true, 925 switchTime: 4000, 926 animSpeed: 500 927 }); 928 }); 929 }, 100); 930 } 931 } 932 }); 933 } 934} 935 936//load post items content 937function initAjaxLoading() { 938 jQuery('.loading-block').infinityContent({ 939 items: '>*', 940 targetBlock: '.loading-holder', 941 loader: '.load-box', 942 moreLink: '.more-link', 943 showOnScroll: false, 944 exrtaSpace: 40, 945 animSpeed: 300, 946 onAllLoaded: function (self) { 947 var openCloseBox = self.find('.open-close'); 948 949 openCloseBox.openClose({ 950 activeClass: 'active', 951 opener: '.events-opener', 952 slider: '.slide', 953 animSpeed: 400, 954 effect: 'slide' 955 }); 956 } 957 }); 958} 959 960 961// initialize custom form elements 962function initCustomForms() { 963 jcf.setOptions('Select', { 964 wrapNative: false 965 }); 966 jcf.replaceAll(); 967} 968 969// content tabs init 970function initTabs() { 971 jQuery('ul.tabset').contentTabs({ 972 addToParent: true, 973 tabLinks: 'a' 974 }); 975} 976 977// open-close init 978function initOpenClose() { 979 jQuery('.open-close').openClose({ 980 activeClass: 'active', 981 opener: '.opener', 982 slider: '.slide', 983 animSpeed: 400, 984 effect: 'slide' 985 }); 986 jQuery('.open-close').openClose({ 987 activeClass: 'active', 988 opener: '.events-opener', 989 slider: '.slide', 990 animSpeed: 400, 991 effect: 'slide' 992 }); 993} 994 995// accordion menu init 996function initAccordion() { 997 jQuery('.sitemap-accordion').slideAccordion({ 998 opener: '> a.opener', 999 slider: 'div.slide', 1000 animSpeed: 300 1001 }); 1002 jQuery('.sitemap-accordion div.slide').slideAccordion({ 1003 opener: '> a.opener', 1004 slider: 'ul.slide', 1005 animSpeed: 300 1006 }); 1007 jQuery('.accordion').slideAccordion({ 1008 opener: 'a.opener', 1009 slider: 'div.slide', 1010 animSpeed: 300 1011 }); 1012} 1013 1014// mobile menu init 1015function initMobileNav() { 1016 jQuery('body').mobileNav({ 1017 hideOnClickOutside: true, 1018 menuActiveClass: 'nav-active', 1019 menuOpener: '.nav-opener', 1020 menuDrop: '.nav-holder' 1021 }); 1022} 1023 1024// add classes to support css3 selectors in old browsers
1025function initChildClasses() { 1026 jQuery('.table tbody').children(':even').addClass('even'); 1027} 1028 1029// generate select from navigation 1030function initNavigationSelect() { 1031 jQuery('ul.tabset').navigationSelect({ 1032 defaultOptionAttr: 'title', 1033 defaultOptionText: '', 1034 selectClass: 'tabset-select', 1035 activeClass: 'tab-active', 1036 useDefaultOption: false 1037 }); 1038} 1039 1040/* 1041 * jQuery Carousel plugin 1042 */ 1043; (function ($) { 1044 function ScrollGallery(options) { 1045 this.options = $.extend({ 1046 mask: 'div.mask', 1047 slider: '>*', 1048 slides: '>*', 1049 activeClass: 'active', 1050 disabledClass: 'disabled', 1051 btnPrev: 'a.btn-prev', 1052 btnNext: 'a.btn-next', 1053 generatePagination: false, 1054 pagerList: '<ul>', 1055 pagerListItem: '<li><a href="#"></a></li>', 1056 pagerListItemText: 'a', 1057 pagerLinks: '.pagination li', 1058 currentNumber: 'span.current-num', 1059 totalNumber: 'span.total-num', 1060 btnPlay: '.btn-play', 1061 btnPause: '.btn-pause', 1062 btnPlayPause: '.btn-play-pause', 1063 galleryReadyClass: 'gallery-js-ready', 1064 autorotationActiveClass: 'autorotation-active', 1065 autorotationDisabledClass: 'autorotation-disabled', 1066 stretchSlideToMask: false, 1067 circularRotation: true, 1068 disableWhileAnimating: false, 1069 autoRotation: false, 1070 pauseOnHover: isTouchDevice ? false : true, 1071 maskAutoSize: false, 1072 switchTime: 4000, 1073 animSpeed: 600, 1074 event: 'click', 1075 swipeThreshold: 15, 1076 handleTouch: true, 1077 vertical: false, 1078 useTranslate3D: false, 1079 step: false 1080 }, options); 1081 this.init(); 1082 } 1083 ScrollGallery.prototype = { 1084 init: function () { 1085 if (this.options.holder) { 1086 this.findElements(); 1087 this.attachEvents(); 1088 this.refreshPosition(); 1089 this.refreshState(true); 1090 this.resumeRotation(); 1091 this.makeCallback('onInit', this); 1092 } 1093 }, 1094 findElements: function () { 1095 // define dimensions proporties 1096 this.fullSizeFunction = this.options.vertical ? 'outerHeight' : 'outerWidth'; 1097 this.innerSizeFunction = this.options.vertical ? 'height' : 'width'; 1098 this.slideSizeFunction = 'outerHeight'; 1099 this.maskSizeProperty = 'height'; 1100 this.animProperty = this.options.vertical ? 'marginTop' : 'marginLeft'; 1101 1102 // control elements 1103 this.gallery = $(this.options.holder).addClass(this.options.galleryReadyClass); 1104 this.mask = this.gallery.find(this.options.mask); 1105 this.slider = this.mask.find(this.options.slider); 1106 this.slides = this.slider.find(this.options.slides); 1107 this.btnPrev = this.gallery.find(this.options.btnPrev); 1108 this.btnNext = this.gallery.find(this.options.btnNext); 1109 this.currentStep = 0; this.stepsCount = 0; 1110 1111 // get start index 1112 if (this.options.step === false) { 1113 var activeSlide = this.slides.filter('.' + this.options.activeClass); 1114 if (activeSlide.length) { 1115 this.currentStep = this.slides.index(activeSlide); 1116 } 1117 } 1118 1119 // calculate offsets 1120 this.calculateOffsets(); 1121 1122 // create gallery pagination 1123 if (typeof this.options.generatePagination === 'string') { 1124 this.pagerLinks = $(); 1125 this.buildPagination(); 1126 } else { 1127 this.pagerLinks = this.gallery.find(this.options.pagerLinks); 1128 this.attachPaginationEvents(); 1129 } 1130 1131 // autorotation control buttons 1132 this.btnPlay = this.gallery.find(this.options.btnPlay); 1133 this.btnPause = this.gallery.find(this.options.btnPause); 1134 this.btnPlayPause = this.gallery.find(this.options.btnPlayPause); 1135 1136 // misc elements 1137 this.curNum = this.gallery.find(this.options.currentNumber); 1138 this.allNum = this.gallery.find(this.options.totalNumber); 1139 }, 1140 attachEvents: function () { 1141 // bind handlers scope 1142 var self = this; 1143 this.bindHandlers(['onWindowResize']); 1144 $(window).bind('load resize orientationchange', this.onWindowResize); 1145 1146 // previous and next button handlers 1147 if (this.btnPrev.length) { 1148 this.prevSlideHandler = function (e) { 1149 e.preventDefault(); 1150 self.prevSlide(); 1151 }; 1152 this.btnPrev.bind(this.options.event, this.prevSlideHandler); 1153 } 1154 if (this.btnNext.length) { 1155 this.nextSlideHandler = function (e) { 1156 e.preventDefault(); 1157 self.nextSlide(); 1158 }; 1159 this.btnNext.bind(this.options.event, this.nextSlideHandler); 1160 } 1161 1162 // pause on hover handling 1163 if (this.options.pauseOnHover && !isTouchDevice) { 1164 this.hoverHandler = function () { 1165 if (self.options.autoRotation) { 1166 self.galleryHover = true; 1167 self.pauseRotation(); 1168 } 1169 }; 1170 this.leaveHandler = function () { 1171 if (self.options.autoRotation) { 1172 self.galleryHover = false;
1173 self.resumeRotation(); 1174 } 1175 }; 1176 this.gallery.bind({ mouseenter: this.hoverHandler, mouseleave: this.leaveHandler }); 1177 } 1178 1179 // autorotation buttons handler 1180 if (this.btnPlay.length) { 1181 this.btnPlayHandler = function (e) { 1182 e.preventDefault(); 1183 self.startRotation(); 1184 }; 1185 this.btnPlay.bind(this.options.event, this.btnPlayHandler); 1186 } 1187 if (this.btnPause.length) { 1188 this.btnPauseHandler = function (e) { 1189 e.preventDefault(); 1190 self.stopRotation(); 1191 }; 1192 this.btnPause.bind(this.options.event, this.btnPauseHandler); 1193 } 1194 if (this.btnPlayPause.length) { 1195 this.btnPlayPauseHandler = function (e) { 1196 e.preventDefault(); 1197 if (!self.gallery.hasClass(self.options.autorotationActiveClass)) { 1198 self.startRotation(); 1199 } else { 1200 self.stopRotation(); 1201 } 1202 }; 1203 this.btnPlayPause.bind(this.options.event, this.btnPlayPauseHandler); 1204 } 1205 1206 // enable hardware acceleration 1207 if (isTouchDevice && this.options.useTranslate3D) { 1208 this.slider.css({ '-webkit-transform': 'translate3d(0px, 0px, 0px)' }); 1209 } 1210 1211 // swipe event handling 1212 if (isTouchDevice && this.options.handleTouch && window.Hammer && this.mask.length) { 1213 this.swipeHandler = new Hammer.Manager(this.mask[0]); 1214 this.swipeHandler.add(new Hammer.Pan({ 1215 direction: self.options.vertical ? Hammer.DIRECTION_VERTICAL : Hammer.DIRECTION_HORIZONTAL, 1216 threshold: self.options.swipeThreshold 1217 })); 1218 1219 this.swipeHandler.on('panstart', function () { 1220 if (self.galleryAnimating) { 1221 self.swipeHandler.stop(); 1222 } else { 1223 self.pauseRotation(); 1224 self.originalOffset = parseFloat(self.slider.css(self.animProperty)); 1225 } 1226 }).on('panmove', function (e) { 1227 var tmpOffset = self.originalOffset + e[self.options.vertical ? 'deltaY' : 'deltaX']; 1228 tmpOffset = Math.max(Math.min(0, tmpOffset), self.maxOffset); 1229 self.slider.css(self.animProperty, tmpOffset); 1230 }).on('panend', function (e) { 1231 self.resumeRotation(); 1232 if (e.distance > self.options.swipeThreshold) { 1233 if (e.offsetDirection === Hammer.DIRECTION_RIGHT || e.offsetDirection === Hammer.DIRECTION_DOWN) { 1234 self.nextSlide(); 1235 } else { 1236 self.prevSlide(); 1237 } 1238 } else { 1239 self.switchSlide(); 1240 } 1241 }); 1242 } 1243 }, 1244 onWindowResize: function () { 1245 if (!this.galleryAnimating) { 1246 this.calculateOffsets(); 1247 this.refreshPosition(); 1248 this.buildPagination(); 1249 this.refreshState(); 1250 this.resizeQueue = false; 1251 } else { 1252 this.resizeQueue = true; 1253 } 1254 }, 1255 refreshPosition: function () { 1256 this.currentStep = Math.min(this.currentStep, this.stepsCount - 1); 1257 this.tmpProps = {}; 1258 this.tmpProps[this.animProperty] = this.getStepOffset(); 1259 this.slider.stop().css(this.tmpProps); 1260 }, 1261 calculateOffsets: function () { 1262 var self = this, tmpOffset, tmpStep; 1263 if (this.options.stretchSlideToMask) { 1264 var tmpObj = {}; 1265 tmpObj[this.innerSizeFunction] = this.mask[this.innerSizeFunction](); 1266 this.slides.css(tmpObj); 1267 } 1268 1269 this.maskSize = this.mask[this.innerSizeFunction]();
1270 this.sumSize = this.getSumSize(); 1271 this.maxOffset = this.maskSize - this.sumSize; 1272 1273 // vertical gallery with single size step custom behavior 1274 if (this.options.vertical && this.options.maskAutoSize) { 1275 this.options.step = 1; 1276 this.stepsCount = this.slides.length; 1277 this.stepOffsets = [0]; 1278 tmpOffset = 0; 1279 for (var i = 0; i < this.slides.length; i++) { 1280 tmpOffset -= $(this.slides[i])[this.fullSizeFunction](true); 1281 this.stepOffsets.push(tmpOffset); 1282 } 1283 this.maxOffset = tmpOffset; 1284 return; 1285 } 1286 1287 // scroll by slide size 1288 if (typeof this.options.step === 'number' && this.options.step > 0) { 1289 this.slideDimensions = []; 1290 this.slides.each($.proxy(function (ind, obj) { 1291 self.slideDimensions.push($(obj)[self.fullSizeFunction](true)); 1292 }, this)); 1293 1294 // calculate steps count 1295 this.stepOffsets = [0]; 1296 this.stepsCount = 1; 1297 tmpOffset = tmpStep = 0; 1298 while (tmpOffset > this.maxOffset) { 1299 tmpOffset -= this.getSlideSize(tmpStep, tmpStep + this.options.step); 1300 tmpStep += this.options.step; 1301 this.stepOffsets.push(Math.max(tmpOffset, this.maxOffset)); 1302 this.stepsCount++; 1303 } 1304 } 1305 // scroll by mask size 1306 else { 1307 // define step size 1308 this.stepSize = this.maskSize; 1309 1310 // calculate steps count 1311 this.stepsCount = 1; 1312 tmpOffset = 0; 1313 while (tmpOffset > this.maxOffset) { 1314 tmpOffset -= this.stepSize; 1315 this.stepsCount++; 1316 } 1317 } 1318 }, 1319 getSumSize: function () { 1320 var sum = 0; 1321 this.slides.each($.proxy(function (ind, obj) { 1322 sum += $(obj)[this.fullSizeFunction](true); 1323 }, this)); 1324 this.slider.css(this.innerSizeFunction, sum); 1325 return sum; 1326 }, 1327 getStepOffset: function (step) { 1328 step = step || this.currentStep; 1329 if (typeof this.options.step === 'number') { 1330 return this.stepOffsets[this.currentStep]; 1331 } else { 1332 return Math.min(0, Math.max(-this.currentStep * this.stepSize, this.maxOffset)); 1333 } 1334 }, 1335 getSlideSize: function (i1, i2) { 1336 var sum = 0; 1337 for (var i = i1; i < Math.min(i2, this.slideDimensions.length); i++) { 1338 sum += this.slideDimensions[i]; 1339 } 1340 return sum; 1341 }, 1342 buildPagination: function () { 1343 if (typeof this.options.generatePagination === 'string') { 1344 if (!this.pagerHolder) { 1345 this.pagerHolder = this.gallery.find(this.options.generatePagination); 1346 } 1347 if (this.pagerHolder.length && this.oldStepsCount != this.stepsCount) { 1348 this.oldStepsCount = this.stepsCount; 1349 this.pagerHolder.empty(); 1350 this.pagerList = $(this.options.pagerList).appendTo(this.pagerHolder); 1351 for (var i = 0; i < this.stepsCount; i++) { 1352 $(this.options.pagerListItem).appendTo(this.pagerList).find(this.options.pagerListItemText).text(i + 1); 1353 } 1354 this.pagerLinks = this.pagerList.children(); 1355 this.attachPaginationEvents(); 1356 } 1357 } 1358 }, 1359 attachPaginationEvents: function () { 1360 var self = this; 1361 this.pagerLinksHandler = function (e) { 1362 e.preventDefault(); 1363 self.numSlide(self.pagerLinks.index(e.currentTarget)); 1364 }; 1365 this.pagerLinks.bind(this.options.event, this.pagerLinksHandler); 1366 }, 1367 prevSlide: function () { 1368 if (!(this.options.disableWhileAnimating && this.galleryAnimating)) { 1369 if (this.currentStep > 0) { 1370 this.currentStep--; 1371 this.switchSlide(); 1372 } else if (this.options.circularRotation) { 1373 this.currentStep = this.stepsCount - 1; 1374 this.switchSlide(); 1375 } 1376 } 1377 }, 1378 nextSlide: function (fromAutoRotation) { 1379 if (!(this.options.disableWhileAnimating && this.galleryAnimating)) { 1380 if (this.currentStep < this.stepsCount - 1) { 1381 this.currentStep++; 1382 this.switchSlide(); 1383 } else if (this.options.circularRotation || fromAutoRotation === true) { 1384 this.currentStep = 0; 1385 this.switchSlide(); 1386 } 1387 } 1388 }, 1389 numSlide: function (c) { 1390 if (this.currentStep != c) { 1391 this.currentStep = c; 1392 this.switchSlide(); 1393 } 1394 }, 1395 switchSlide: function () { 1396 var self = this; 1397 this.galleryAnimating = true; 1398 this.tmpProps = {};
1399 this.tmpProps[this.animProperty] = this.getStepOffset(); 1400 this.slider.stop().animate(this.tmpProps, { 1401 duration: this.options.animSpeed, complete: function () { 1402 // animation complete 1403 self.galleryAnimating = false; 1404 if (self.resizeQueue) { 1405 self.onWindowResize(); 1406 } 1407 1408 // onchange callback 1409 self.makeCallback('onChange', self); 1410 self.autoRotate(); 1411 } 1412 }); 1413 this.refreshState(); 1414 1415 // onchange callback 1416 this.makeCallback('onBeforeChange', this); 1417 }, 1418 refreshState: function (initial) { 1419 if (this.options.step === 1 || this.stepsCount === this.slides.length) { 1420 this.slides.removeClass(this.options.activeClass).eq(this.currentStep).addClass(this.options.activeClass); 1421 } 1422 this.pagerLinks.removeClass(this.options.activeClass).eq(this.currentStep).addClass(this.options.activeClass); 1423 this.curNum.html(this.currentStep + 1); 1424 this.allNum.html(this.stepsCount); 1425 1426 // initial refresh 1427 if (this.options.maskAutoSize && typeof this.options.step === 'number') { 1428 this.tmpProps = {}; 1429 this.tmpProps[this.maskSizeProperty] = this.slides.eq(Math.min(this.currentStep, this.slides.length - 1))[this.slideSizeFunction](true); 1430 this.mask.stop()[initial ? 'css' : 'animate'](this.tmpProps); 1431 } 1432 1433 // disabled state 1434 if (!this.options.circularRotation) { 1435 this.btnPrev.add(this.btnNext).removeClass(this.options.disabledClass); 1436 if (this.currentStep === 0) this.btnPrev.addClass(this.options.disabledClass); 1437 if (this.currentStep === this.stepsCount - 1) this.btnNext.addClass(this.options.disabledClass); 1438 } 1439 1440 // add class if not enough slides 1441 this.gallery.toggleClass('not-enough-slides', this.sumSize <= this.maskSize); 1442 }, 1443 startRotation: function () { 1444 this.options.autoRotation = true; 1445 this.galleryHover = false; 1446 this.autoRotationStopped = false; 1447 this.resumeRotation(); 1448 }, 1449 stopRotation: function () { 1450 this.galleryHover = true; 1451 this.autoRotationStopped = true; 1452 this.pauseRotation(); 1453 }, 1454 pauseRotation: function () { 1455 this.gallery.addClass(this.options.autorotationDisabledClass); 1456 this.gallery.removeClass(this.options.autorotationActiveClass); 1457 clearTimeout(this.timer); 1458 }, 1459 resumeRotation: function () { 1460 if (!this.autoRotationStopped) { 1461 this.gallery.addClass(this.options.autorotationActiveClass); 1462 this.gallery.removeClass(this.options.autorotationDisabledClass); 1463 this.autoRotate(); 1464 } 1465 }, 1466 autoRotate: function () { 1467 var self = this; 1468 clearTimeout(this.timer); 1469 if (this.options.autoRotation && !this.galleryHover && !this.autoRotationStopped) { 1470 this.timer = setTimeout(function () { 1471 self.nextSlide(true); 1472 }, this.options.switchTime); 1473 } else { 1474 this.pauseRotation(); 1475 } 1476 }, 1477 bindHandlers: function (handlersList) { 1478 var self = this; 1479 $.each(handlersList, function (index, handler) { 1480 var origHandler = self[handler]; 1481 self[handler] = function () { 1482 return origHandler.apply(self, arguments); 1483 }; 1484 }); 1485 }, 1486 makeCallback: function (name) { 1487 if (typeof this.options[name] === 'function') { 1488 var args = Array.prototype.slice.call(arguments); 1489 args.shift(); 1490 this.options[name].apply(this, args); 1491 } 1492 }, 1493 destroy: function () { 1494 // destroy handler 1495 $(window).unbind('load resize orientationchange', this.onWindowResize); 1496 this.btnPrev.unbind(this.options.event, this.prevSlideHandler); 1497 this.btnNext.unbind(this.options.event, this.nextSlideHandler); 1498 this.pagerLinks.unbind(this.options.event, this.pagerLinksHandler); 1499 this.gallery.unbind('mouseenter', this.hoverHandler); 1500 this.gallery.unbind('mouseleave', this.leaveHandler); 1501 1502 // autorotation buttons handlers 1503 this.stopRotation(); 1504 this.btnPlay.unbind(this.options.event, this.btnPlayHandler); 1505 this.btnPause.unbind(this.options.event, this.btnPauseHandler); 1506 this.btnPlayPause.unbind(this.options.event, this.btnPlayPauseHandler); 1507 1508 // destroy swipe handler 1509 if (this.swipeHandler) { 1510 this.swipeHandler.destroy(); 1511 } 1512 1513 // remove inline styles, classes and pagination 1514 this.mask.stop().removeAttr('style');
1515 var unneededClasses = [this.options.galleryReadyClass, this.options.autorotationActiveClass, this.options.autorotationDisabledClass]; 1516 this.gallery.removeClass(unneededClasses.join(' ')); 1517 this.slider.add(this.slides).removeAttr('style'); 1518 if (typeof this.options.generatePagination === 'string') { 1519 this.pagerHolder.empty(); 1520 } 1521 } 1522 }; 1523 1524 // detect device type 1525 var isTouchDevice = /Windows Phone/.test(navigator.userAgent) || ('ontouchstart' in window) || window.DocumentTouch && document instanceof DocumentTouch; 1526 1527 // jquery plugin 1528 $.fn.scrollGallery = function (opt) { 1529 return this.each(function () { 1530 $(this).data('ScrollGallery', new ScrollGallery($.extend(opt, { holder: this }))); 1531 }); 1532 }; 1533}(jQuery)); 1534 1535/* 1536 * jQuery Cycle Gallery plugin 1537 */ 1538; (function ($) { 1539 function CycleCarousel2(options) { 1540 this.options = $.extend({ 1541 slideset: '.slideset', 1542 slides: '.slide', 1543 btnPrev: '.btn-prev', 1544 btnNext: '.btn-next', 1545 animSpeed: 500, 1546 switchTime: 3000, 1547 autoRotation: false, 1548 handleTouch: true, 1549 swipeThreshold: 15, 1550 vertical: false, 1551 step: 1 1552 }, options); 1553 this.init(); 1554 } 1555 CycleCarousel2.prototype = { 1556 init: function () { 1557 if (this.options.holder) { 1558 this.findElements(); 1559 // this.savePosition(); 1560 this.attachEvents(); 1561 this.makeCallback('onInit', true); 1562 } 1563 }, 1564 findElements: function () { 1565 // find structure elements 1566 this.holder = $(this.options.holder); 1567 this.slideset = this.holder.find(this.options.slideset); 1568 this.slides = this.slideset.find(this.options.slides); 1569 this.btnPrev = this.holder.find(this.options.btnPrev); 1570 this.btnNext = this.holder.find(this.options.btnNext); 1571 this.slidesCount = this.slides.length; 1572 this.animating = false; 1573 1574 // define index variables 1575 this.animProperty = this.options.vertical ? 'marginTop' : 'marginLeft'; 1576 }, 1577 savePosition: function () { 1578 this.slides.each(function (i) { 1579 jQuery(this).data('index', i); 1580 }); 1581 }, 1582 attachEvents: function () { 1583 // attach handlers 1584 var self = this; 1585 1586 if (this.btnPrev.length) { 1587 this.btnPrev.on('click', function (e) { 1588 e.preventDefault(); 1589 self.prevSlide(); 1590 }); 1591 } 1592 if (this.btnNext.length) { 1593 this.btnNext.on('click', function (e) { 1594 e.preventDefault(); 1595 self.nextSlide(); 1596 }); 1597 } 1598 1599 // handle swipe on mobile devices 1600 if (this.options.handleTouch && window.Hammer && this.holder.length && this.slides.length > 1 && isTouchDevice) { 1601 this.swipeHandler = new Hammer.Manager(this.holder[0]); 1602 this.swipeHandler.add(new Hammer.Pan({ 1603 direction: self.options.vertical ? Hammer.DIRECTION_VERTICAL : Hammer.DIRECTION_HORIZONTAL, 1604 threshold: self.options.swipeThreshold 1605 })); 1606 1607 this.swipeHandler.on('panend', function (e) { 1608 if (e.distance > self.options.swipeThreshold) { 1609 if (e.offsetDirection === Hammer.DIRECTION_RIGHT || e.offsetDirection === Hammer.DIRECTION_DOWN) { 1610 self.nextSlide(); 1611 } else { 1612 self.prevSlide(); 1613 } 1614 } 1615 }); 1616 } 1617 1618 // start autorotation 1619 this.autoRotate(); 1620 }, 1621 prevSlide: function () { 1622 if (!this.animating && this.slides.length > 1) { 1623 this.switchSlide(this.options.step, true); 1624 } 1625 }, 1626 nextSlide: function () { 1627 if (!this.animating && this.slides.length > 1) { 1628 this.switchSlide(this.options.step, false); 1629 } 1630 }, 1631 calculateSumm: function (slidesArray) { 1632 var self = this; 1633 var summ = 0; 1634 $.each(slidesArray, function () { 1635 if (self.options.vertical) { 1636 summ += $(this).outerHeight(true); 1637 } else { 1638 summ += $(this).outerWidth(true); 1639 } 1640 }); 1641 return summ; 1642 }, 1643 resetSlideset: function () { 1644 this.slides = this.slideset.find(this.options.slides); 1645 this.slideset.css(this.animProperty, '0'); 1646 }, 1647 switchSlide: function (count, direction) { 1648 var self = this; 1649 var startObj = {}; 1650 var animObj = {}; 1651 1652 this.animating = true; 1653 if (direction) { 1654 var fakeSlide = this.slides.filter(function (index) { 1655 return index < count; 1656 }); 1657 this.slideset.append(fakeSlide.clone(true)); 1658 1659 animObj[this.animProperty] = -this.calculateSumm(fakeSlide); 1660 this.slideset.animate(animObj, { 1661 duration: self.options.animSpeed, 1662 complete: function () { 1663 fakeSlide.remove(); 1664 self.resetSlideset(); 1665 self.animating = false;
1666 self.autoRotate(); 1667 self.makeCallback('onChange', fakeSlide); 1668 } 1669 }); 1670 1671 this.makeCallback('onBeforeChange', fakeSlide.eq(fakeSlide.length - 1), direction); 1672 } else { 1673 var fakeSlide = this.slides.filter(function (index) { 1674 return index > self.slidesCount - 1 - count; 1675 }); 1676 1677 this.slideset.prepend(fakeSlide.clone(true)); 1678 startObj[this.animProperty] = -this.calculateSumm(fakeSlide); 1679 animObj[this.animProperty] = 0; 1680 this.slideset.css(startObj).animate(animObj, { 1681 duration: self.options.animSpeed, 1682 complete: function () { 1683 fakeSlide.remove(); 1684 self.resetSlideset(); 1685 self.animating = false; 1686 self.autoRotate(); 1687 self.makeCallback('onChange', true); 1688 } 1689 }); 1690 1691 this.makeCallback('onBeforeChange', fakeSlide.eq(0), direction); 1692 } 1693 }, 1694 autoRotate: function () { 1695 var self = this; 1696 clearTimeout(this.timer); 1697 if (this.options.autoRotation) { 1698 this.timer = setTimeout(function () { 1699 self.nextSlide(); 1700 }, this.options.switchTime); 1701 } 1702 }, 1703 destroy: function () { 1704 // destroy handler 1705 this.btnPrev.off('click', this.btnPrevHandler); 1706 this.btnNext.off('click', this.btnNextHandler); 1707 clearTimeout(this.timer); 1708 1709 // destroy swipe handler 1710 if (this.swipeHandler) { 1711 this.swipeHandler.dispose(); 1712 } 1713 1714 // remove inline styles 1715 this.slideset.add(this.slides).removeAttr('style'); 1716 }, 1717 makeCallback: function (name) { 1718 if (typeof this.options[name] === 'function') { 1719 var args = Array.prototype.slice.call(arguments); 1720 args.shift(); 1721 this.options[name].apply(this, args); 1722 } 1723 } 1724 }; 1725 1726 // detect device type 1727 var isTouchDevice = /Windows Phone/.test(navigator.userAgent) || ('ontouchstart' in window) || window.DocumentTouch && document instanceof DocumentTouch; 1728 1729 // jquery plugin 1730 $.fn.cycleCarousel2 = function (opt) { 1731 return this.each(function () { 1732 $(this).data('CycleCarousel2', new CycleCarousel2($.extend(opt, { 1733 holder: this 1734 }))); 1735 }); 1736 }; 1737}(jQuery)); 1738 1739/* 1740 * jQuery SlideShow plugin 1741 */ 1742; (function ($) { 1743 function FadeGallery(options) { 1744 this.options = $.extend({ 1745 slides: 'ul.slideset > li', 1746 activeClass: 'active', 1747 disabledClass: 'disabled', 1748 btnPrev: 'a.btn-prev', 1749 btnNext: 'a.btn-next', 1750 generatePagination: false, 1751 pagerList: '<ul>', 1752 pagerListItem: '<li><a href="#"></a></li>', 1753 pagerListItemText: 'a', 1754 pagerLinks: '.pagination li', 1755 currentNumber: 'span.current-num', 1756 totalNumber: 'span.total-num', 1757 btnPlay: '.btn-play', 1758 btnPause: '.btn-pause', 1759 btnPlayPause: '.btn-play-pause', 1760 galleryReadyClass: 'gallery-js-ready', 1761 autorotationActiveClass: 'autorotation-active', 1762 autorotationDisabledClass: 'autorotation-disabled', 1763 autorotationStopAfterClick: false, 1764 circularRotation: true, 1765 switchSimultaneously: true, 1766 disableWhileAnimating: false, 1767 disableFadeIE: false, 1768 autoRotation: false, 1769 pauseOnHover: true, 1770 autoHeight: false, 1771 useSwipe: false, 1772 swipeThreshold: 15, 1773 switchTime: 4000, 1774 animSpeed: 600, 1775 event: 'click' 1776 }, options); 1777 this.init(); 1778 } 1779 FadeGallery.prototype = { 1780 init: function () { 1781 if (this.options.holder) { 1782 this.findElements(); 1783 this.attachEvents(); 1784 this.refreshState(true); 1785 this.autoRotate(); 1786 this.makeCallback('onInit', this); 1787 } 1788 }, 1789 findElements: function () { 1790 // control elements 1791 this.gallery = $(this.options.holder).addClass(this.options.galleryReadyClass); 1792 this.slides = this.gallery.find(this.options.slides); 1793 this.slidesHolder = this.slides.eq(0).parent(); 1794 this.stepsCount = this.slides.length; 1795 this.btnPrev = this.gallery.find(this.options.btnPrev); 1796 this.btnNext = this.gallery.find(this.options.btnNext); 1797 this.currentIndex = 0; 1798 1799 // disable fade effect in old IE
1800 if (this.options.disableFadeIE && !$.support.opacity) { 1801 this.options.animSpeed = 0; 1802 } 1803 1804 // create gallery pagination 1805 if (typeof this.options.generatePagination === 'string') { 1806 this.pagerHolder = this.gallery.find(this.options.generatePagination).empty(); 1807 this.pagerList = $(this.options.pagerList).appendTo(this.pagerHolder); 1808 for (var i = 0; i < this.stepsCount; i++) { 1809 $(this.options.pagerListItem).appendTo(this.pagerList).find(this.options.pagerListItemText).text(i + 1); 1810 } 1811 this.pagerLinks = this.pagerList.children(); 1812 } else { 1813 this.pagerLinks = this.gallery.find(this.options.pagerLinks); 1814 } 1815 1816 // get start index 1817 var activeSlide = this.slides.filter('.' + this.options.activeClass); 1818 if (activeSlide.length) { 1819 this.currentIndex = this.slides.index(activeSlide); 1820 } 1821 this.prevIndex = this.currentIndex; 1822 1823 // autorotation control buttons 1824 this.btnPlay = this.gallery.find(this.options.btnPlay); 1825 this.btnPause = this.gallery.find(this.options.btnPause); 1826 this.btnPlayPause = this.gallery.find(this.options.btnPlayPause); 1827 1828 // misc elements 1829 this.curNum = this.gallery.find(this.options.currentNumber); 1830 this.allNum = this.gallery.find(this.options.totalNumber); 1831 1832 // handle flexible layout 1833 this.slides.css({ display: 'block', opacity: 0 }).eq(this.currentIndex).css({ 1834 opacity: '' 1835 }); 1836 }, 1837 attachEvents: function () { 1838 var self = this; 1839 1840 // flexible layout handler 1841 this.resizeHandler = function () { 1842 self.onWindowResize(); 1843 }; 1844 $(window).bind('load resize orientationchange', this.resizeHandler); 1845 1846 if (this.btnPrev.length) { 1847 this.btnPrevHandler = function (e) { 1848 e.preventDefault(); 1849 self.prevSlide(); 1850 if (self.options.autorotationStopAfterClick) { 1851 self.stopRotation(); 1852 } 1853 }; 1854 this.btnPrev.bind(this.options.event, this.btnPrevHandler); 1855 } 1856 if (this.btnNext.length) { 1857 this.btnNextHandler = function (e) { 1858 e.preventDefault(); 1859 self.nextSlide(); 1860 if (self.options.autorotationStopAfterClick) { 1861 self.stopRotation(); 1862 } 1863 }; 1864 this.btnNext.bind(this.options.event, this.btnNextHandler); 1865 } 1866 if (this.pagerLinks.length) { 1867 this.pagerLinksHandler = function (e) { 1868 e.preventDefault(); 1869 self.numSlide(self.pagerLinks.index(e.currentTarget)); 1870 if (self.options.autorotationStopAfterClick) { 1871 self.stopRotation(); 1872 } 1873 }; 1874 this.pagerLinks.bind(self.options.event, this.pagerLinksHandler); 1875 } 1876 1877 // autorotation buttons handler 1878 if (this.btnPlay.length) { 1879 this.btnPlayHandler = function (e) { 1880 e.preventDefault(); 1881 self.startRotation(); 1882 }; 1883 this.btnPlay.bind(this.options.event, this.btnPlayHandler); 1884 } 1885 if (this.btnPause.length) { 1886 this.btnPauseHandler = function (e) { 1887 e.preventDefault(); 1888 self.stopRotation(); 1889 }; 1890 this.btnPause.bind(this.options.event, this.btnPauseHandler); 1891 } 1892 if (this.btnPlayPause.length) { 1893 this.btnPlayPauseHandler = function (e) { 1894 e.preventDefault(); 1895 if (!self.gallery.hasClass(self.options.autorotationActiveClass)) { 1896 self.startRotation(); 1897 } else { 1898 self.stopRotation(); 1899 } 1900 }; 1901 this.btnPlayPause.bind(this.options.event, this.btnPlayPauseHandler); 1902 } 1903 1904 // swipe gestures handler 1905 if (this.options.useSwipe && window.Hammer && isTouchDevice) { 1906 this.swipeHandler = new Hammer.Manager(this.gallery[0]); 1907 this.swipeHandler.add(new Hammer.Swipe({ 1908 direction: Hammer.DIRECTION_HORIZONTAL, 1909 threshold: self.options.swipeThreshold 1910 })); 1911 this.swipeHandler.on('swipeleft', function () { 1912 self.nextSlide(); 1913 }).on('swiperight', function () { 1914 self.prevSlide(); 1915 }); 1916 } 1917 1918 // pause on hover handling 1919 if (this.options.pauseOnHover) { 1920 this.hoverHandler = function () { 1921 if (self.options.autoRotation) { 1922 self.galleryHover = true; 1923 self.pauseRotation(); 1924 } 1925 }; 1926 this.leaveHandler = function () { 1927 if (self.options.autoRotation) { 1928 self.galleryHover = false;
1929 self.resumeRotation(); 1930 } 1931 }; 1932 this.gallery.bind({ mouseenter: this.hoverHandler, mouseleave: this.leaveHandler }); 1933 } 1934 }, 1935 onWindowResize: function () { 1936 if (this.options.autoHeight) { 1937 this.slidesHolder.css({ height: this.slides.eq(this.currentIndex).outerHeight(true) }); 1938 } 1939 }, 1940 prevSlide: function () { 1941 if (!(this.options.disableWhileAnimating && this.galleryAnimating)) { 1942 this.prevIndex = this.currentIndex; 1943 if (this.currentIndex > 0) { 1944 this.currentIndex--; 1945 this.switchSlide(); 1946 } else if (this.options.circularRotation) { 1947 this.currentIndex = this.stepsCount - 1; 1948 this.switchSlide(); 1949 } 1950 } 1951 }, 1952 nextSlide: function (fromAutoRotation) { 1953 if (!(this.options.disableWhileAnimating && this.galleryAnimating)) { 1954 this.prevIndex = this.currentIndex; 1955 if (this.currentIndex < this.stepsCount - 1) { 1956 this.currentIndex++; 1957 this.switchSlide(); 1958 } else if (this.options.circularRotation || fromAutoRotation === true) { 1959 this.currentIndex = 0; 1960 this.switchSlide(); 1961 } 1962 } 1963 }, 1964 numSlide: function (c) { 1965 if (this.currentIndex != c) { 1966 this.prevIndex = this.currentIndex; 1967 this.currentIndex = c; 1968 this.switchSlide(); 1969 } 1970 }, 1971 switchSlide: function () { 1972 var self = this; 1973 if (this.slides.length > 1) { 1974 this.galleryAnimating = true; 1975 if (!this.options.animSpeed) { 1976 this.slides.eq(this.prevIndex).css({ opacity: 0 }); 1977 } else { 1978 this.slides.eq(this.prevIndex).stop().animate({ opacity: 0 }, { duration: this.options.animSpeed }); 1979 } 1980 1981 this.switchNext = function () { 1982 if (!self.options.animSpeed) { 1983 self.slides.eq(self.currentIndex).css({ opacity: '' }); 1984 } else { 1985 self.slides.eq(self.currentIndex).stop().animate({ opacity: 1 }, { duration: self.options.animSpeed }); 1986 } 1987 clearTimeout(this.nextTimer); 1988 this.nextTimer = setTimeout(function () { 1989 self.slides.eq(self.currentIndex).css({ opacity: '' }); 1990 self.galleryAnimating = false; 1991 self.autoRotate(); 1992 1993 // onchange callback 1994 self.makeCallback('onChange', self); 1995 }, self.options.animSpeed); 1996 }; 1997 1998 if (this.options.switchSimultaneously) { 1999 self.switchNext(); 2000 } else { 2001 clearTimeout(this.switchTimer); 2002 this.switchTimer = setTimeout(function () { 2003 self.switchNext(); 2004 }, this.options.animSpeed); 2005 } 2006 this.refreshState(); 2007 2008 // onchange callback 2009 this.makeCallback('onBeforeChange', this); 2010 } 2011 }, 2012 refreshState: function (initial) { 2013 this.slides.removeClass(this.options.activeClass).eq(this.currentIndex).addClass(this.options.activeClass); 2014 this.pagerLinks.removeClass(this.options.activeClass).eq(this.currentIndex).addClass(this.options.activeClass); 2015 this.curNum.html(this.currentIndex + 1); 2016 this.allNum.html(this.stepsCount); 2017 2018 // initial refresh 2019 if (this.options.autoHeight) { 2020 if (initial) { 2021 this.slidesHolder.css({ height: this.slides.eq(this.currentIndex).outerHeight(true) }); 2022 } else { 2023 this.slidesHolder.stop().animate({ height: this.slides.eq(this.currentIndex).outerHeight(true) }, { duration: this.options.animSpeed }); 2024 } 2025 } 2026 2027 // disabled state 2028 if (!this.options.circularRotation) { 2029 this.btnPrev.add(this.btnNext).removeClass(this.options.disabledClass); 2030 if (this.currentIndex === 0) this.btnPrev.addClass(this.options.disabledClass); 2031 if (this.currentIndex === this.stepsCount - 1) this.btnNext.addClass(this.options.disabledClass); 2032 } 2033 2034 // add class if not enough slides
2035 this.gallery.toggleClass('not-enough-slides', this.stepsCount === 1); 2036 }, 2037 startRotation: function () { 2038 this.options.autoRotation = true; 2039 this.galleryHover = false; 2040 this.autoRotationStopped = false; 2041 this.resumeRotation(); 2042 }, 2043 stopRotation: function () { 2044 this.galleryHover = true; 2045 this.autoRotationStopped = true; 2046 this.pauseRotation(); 2047 }, 2048 pauseRotation: function () { 2049 this.gallery.addClass(this.options.autorotationDisabledClass); 2050 this.gallery.removeClass(this.options.autorotationActiveClass); 2051 clearTimeout(this.timer); 2052 }, 2053 resumeRotation: function () { 2054 if (!this.autoRotationStopped) { 2055 this.gallery.addClass(this.options.autorotationActiveClass); 2056 this.gallery.removeClass(this.options.autorotationDisabledClass); 2057 this.autoRotate(); 2058 } 2059 }, 2060 autoRotate: function () { 2061 var self = this; 2062 clearTimeout(this.timer); 2063 if (this.options.autoRotation && !this.galleryHover && !this.autoRotationStopped) { 2064 this.gallery.addClass(this.options.autorotationActiveClass); 2065 this.timer = setTimeout(function () { 2066 self.nextSlide(true); 2067 }, this.options.switchTime); 2068 } else { 2069 this.pauseRotation(); 2070 } 2071 }, 2072 makeCallback: function (name) { 2073 if (typeof this.options[name] === 'function') { 2074 var args = Array.prototype.slice.call(arguments); 2075 args.shift(); 2076 this.options[name].apply(this, args); 2077 } 2078 }, 2079 destroy: function () { 2080 // navigation buttons handler 2081 this.btnPrev.unbind(this.options.event, this.btnPrevHandler); 2082 this.btnNext.unbind(this.options.event, this.btnNextHandler); 2083 this.pagerLinks.unbind(this.options.event, this.pagerLinksHandler); 2084 $(window).unbind('load resize orientationchange', this.resizeHandler); 2085 2086 // remove autorotation handlers 2087 this.stopRotation(); 2088 this.btnPlay.unbind(this.options.event, this.btnPlayHandler); 2089 this.btnPause.unbind(this.options.event, this.btnPauseHandler); 2090 this.btnPlayPause.unbind(this.options.event, this.btnPlayPauseHandler); 2091 this.gallery.unbind('mouseenter', this.hoverHandler); 2092 this.gallery.unbind('mouseleave', this.leaveHandler); 2093 2094 // remove swipe handler if used 2095 if (this.swipeHandler) { 2096 this.swipeHandler.destroy(); 2097 } 2098 if (typeof this.options.generatePagination === 'string') { 2099 this.pagerHolder.empty(); 2100 } 2101 2102 // remove unneeded classes and styles 2103 var unneededClasses = [this.options.galleryReadyClass, this.options.autorotationActiveClass, this.options.autorotationDisabledClass]; 2104 this.gallery.removeClass(unneededClasses.join(' ')); 2105 this.slidesHolder.add(this.slides).removeAttr('style'); 2106 } 2107 }; 2108 2109 // detect device type 2110 var isTouchDevice = /Windows Phone/.test(navigator.userAgent) || ('ontouchstart' in window) || window.DocumentTouch && document instanceof DocumentTouch; 2111 2112 // jquery plugin 2113 $.fn.fadeGallery = function (opt) { 2114 return this.each(function () { 2115 $(this).data('FadeGallery', new FadeGallery($.extend(opt, { holder: this }))); 2116 }); 2117 }; 2118}(jQuery)); 2119 2120/* 2121 * jQuery Tabs plugin 2122 */ 2123; (function ($) { 2124 $.fn.contentTabs = function (o) { 2125 // default options 2126 var options = $.extend({ 2127 activeClass: 'active', 2128 addToParent: false, 2129 autoHeight: false, 2130 autoRotate: false, 2131 checkHash: false, 2132 animSpeed: 400, 2133 switchTime: 3000, 2134 effect: 'none', // "fade", "slide" 2135 tabLinks: 'a', 2136 attrib: 'href', 2137 event: 'click' 2138 }, o); 2139 2140 return this.each(function () { 2141 var tabset = $(this), tabs = $(); 2142 var tabLinks = tabset.find(options.tabLinks); 2143 var tabLinksParents = tabLinks.parent(); 2144 var prevActiveLink = tabLinks.eq(0), currentTab, animating; 2145 var tabHolder; 2146 2147 // handle location hash 2148 if (options.checkHash && tabLinks.filter('[' + options.attrib + '="' + location.hash + '"]').length) { 2149 (options.addToParent ? tabLinksParents : tabLinks).removeClass(options.activeClass); 2150 setTimeout(function () { 2151 window.scrollTo(0, 0); 2152 }, 1); 2153 } 2154 2155 // init tabLinks 2156 2157 tabLinks.each(function () { 2158 var link = $(this); 2159 var href = link.attr(options.attrib); 2160 var parent = link.parent(); 2161 href = href.substr(href.lastIndexOf('#')); 2162 2163 // get elements 2164 var tab = $(href).hide().addClass(tabHiddenClass); 2165 tabs = tabs.add(tab); 2166 link.data('cparent', parent); 2167 link.data('ctab', tab); 2168 2169 // find tab holder 2170 if (!tabHolder && tab.length) { 2171 tabHolder = tab.parent(); 2172 } 2173 2174 // show only active tab 2175 var classOwner = options.addToParent ? parent : link; 2176 if (classOwner.hasClass(options.activeClass) || (options.checkHash && location.hash === href)) { 2177 classOwner.addClass(options.activeClass); 2178 prevActiveLink = link; currentTab = tab; 2179 tab.removeClass(tabHiddenClass).width(''); 2180 contentTabsEffect[options.effect].show({ tab: tab, fast: true }); 2181 } else {
2182 var tabWidth = tab.width(); 2183 if (tabWidth) { 2184 tab.width(tabWidth); 2185 } 2186 tab.addClass(tabHiddenClass); 2187 } 2188 2189 // event handler 2190 link.bind(options.event, function (e) { 2191 if (link != prevActiveLink && !animating) { 2192 switchTab(prevActiveLink, link); 2193 prevActiveLink = link; 2194 } 2195 }); 2196 if (options.attrib === 'href') { 2197 link.bind('click', function (e) { 2198 e.preventDefault(); 2199 }); 2200 } 2201 }); 2202 2203 // tab switch function 2204 function switchTab(oldLink, newLink) { 2205 animating = true; 2206 var oldTab = oldLink.data('ctab'); 2207 var newTab = newLink.data('ctab'); 2208 prevActiveLink = newLink; 2209 currentTab = newTab; 2210 2211 // refresh pagination links 2212 (options.addToParent ? tabLinksParents : tabLinks).removeClass(options.activeClass); 2213 (options.addToParent ? newLink.data('cparent') : newLink).addClass(options.activeClass); 2214 2215 // hide old tab 2216 resizeHolder(oldTab, true); 2217 contentTabsEffect[options.effect].hide({ 2218 speed: options.animSpeed, 2219 tab: oldTab, 2220 complete: function () { 2221 // show current tab 2222 resizeHolder(newTab.removeClass(tabHiddenClass).width('')); 2223 contentTabsEffect[options.effect].show({ 2224 speed: options.animSpeed, 2225 tab: newTab, 2226 complete: function () { 2227 if (!oldTab.is(newTab)) { 2228 oldTab.width(oldTab.width()).addClass(tabHiddenClass); 2229 } 2230 animating = false; 2231 resizeHolder(newTab, false); 2232 autoRotate(); 2233 $(window).trigger('resize'); 2234 } 2235 }); 2236 } 2237 }); 2238 } 2239 2240 // holder auto height 2241 function resizeHolder(block, state) { 2242 var curBlock = block && block.length ? block : currentTab; 2243 if (options.autoHeight && curBlock) { 2244 tabHolder.stop(); 2245 if (state === false) { 2246 tabHolder.css({ height: '' }); 2247 } else { 2248 var origStyles = curBlock.attr('style'); 2249 curBlock.show().css({ width: curBlock.width() }); 2250 var tabHeight = curBlock.outerHeight(true); 2251 if (!origStyles) curBlock.removeAttr('style'); else curBlock.attr('style', origStyles); 2252 if (state === true) { 2253 tabHolder.css({ height: tabHeight }); 2254 } else { 2255 tabHolder.animate({ height: tabHeight }, { duration: options.animSpeed }); 2256 } 2257 } 2258 } 2259 } 2260 if (options.autoHeight) { 2261 $(window).bind('resize orientationchange', function () { 2262 tabs.not(currentTab).removeClass(tabHiddenClass).show().each(function () { 2263 var tab = jQuery(this), tabWidth = tab.css({ width: '' }).width(); 2264 if (tabWidth) { 2265 tab.width(tabWidth); 2266 } 2267 }).hide().addClass(tabHiddenClass); 2268 2269 resizeHolder(currentTab, false); 2270 }); 2271 } 2272 2273 // autorotation handling 2274 var rotationTimer; 2275 function nextTab() { 2276 var activeItem = (options.addToParent ? tabLinksParents : tabLinks).filter('.' + options.activeClass); 2277 var activeIndex = (options.addToParent ? tabLinksParents : tabLinks).index(activeItem); 2278 var newLink = tabLinks.eq(activeIndex < tabLinks.length - 1 ? activeIndex + 1 : 0); 2279 prevActiveLink = tabLinks.eq(activeIndex); 2280 switchTab(prevActiveLink, newLink); 2281 } 2282 function autoRotate() { 2283 if (options.autoRotate && tabLinks.length > 1) { 2284 clearTimeout(rotationTimer); 2285 rotationTimer = setTimeout(function () { 2286 if (!animating) { 2287 nextTab(); 2288 } else { 2289 autoRotate(); 2290 } 2291 }, options.switchTime); 2292 } 2293 } 2294 autoRotate(); 2295 }); 2296 }; 2297 2298 // add stylesheet for tabs on DOMReady 2299 var tabHiddenClass = 'js-tab-hidden'; 2300 (function () { 2301 var tabStyleSheet = $('<style type="text/css">')[0]; 2302 var tabStyleRule = '.' + tabHiddenClass; 2303 tabStyleRule += '{position:absolute !important;left:-9999px !important;top:-9999px !important;display:block !important}'; 2304 if (tabStyleSheet.styleSheet) { 2305 tabStyleSheet.styleSheet.cssText = tabStyleRule; 2306 } else { 2307 tabStyleSheet.appendChild(document.createTextNode(tabStyleRule)); 2308 } 2309 $('head').append(tabStyleSheet); 2310 }()); 2311 2312 // tab switch effects 2313 var contentTabsEffect = { 2314 none: { 2315 show: function (o) { 2316 o.tab.css({ display: 'block' }); 2317 if (o.complete) o.complete(); 2318 }, 2319 hide: function (o) { 2320 o.tab.css({ display: 'none' }); 2321 if (o.complete) o.complete(); 2322 } 2323 }, 2324 fade: { 2325 show: function (o) { 2326 if (o.fast) o.speed = 1; 2327 o.tab.fadeIn(o.speed); 2328 if (o.complete) setTimeout(o.complete, o.speed); 2329 }, 2330 hide: function (o) { 2331 if (o.fast) o.speed = 1; 2332 o.tab.fadeOut(o.speed); 2333 if (o.complete) setTimeout(o.complete, o.speed); 2334 } 2335 }, 2336 slide: { 2337 show: function (o) { 2338 var tabHeight = o.tab.show().css({ width: o.tab.width() }).outerHeight(true); 2339 var tmpWrap = $('<div class="effect-div">').insertBefore(o.tab).append(o.tab); 2340 tmpWrap.css({ width: '100%', overflow: 'hidden', position: 'relative' }); o.tab.css({ marginTop: -tabHeight, display: 'block' }); 2341 if (o.fast) o.speed = 1; 2342 o.tab.animate({ marginTop: 0 }, { 2343 duration: o.speed, complete: function () { 2344 o.tab.css({ marginTop: '', width: '' }).insertBefore(tmpWrap); 2345 tmpWrap.remove(); 2346 if (o.complete) o.complete(); 2347 } 2348 }); 2349 }, 2350 hide: function (o) { 2351 var tabHeight = o.tab.show().css({ width: o.tab.width() }).outerHeight(true); 2352 var tmpWrap = $('<div class="effect-div">').insertBefore(o.tab).append(o.tab); 2353 tmpWrap.css({ width: '100%', overflow: 'hidden', position: 'relative' }); 2354 2355 if (o.fast) o.speed = 1; 2356 o.tab.animate({ marginTop: -tabHeight }, {
2357 duration: o.speed, complete: function () { 2358 o.tab.css({ display: 'none', marginTop: '', width: '' }).insertBefore(tmpWrap); 2359 tmpWrap.remove(); 2360 if (o.complete) o.complete(); 2361 } 2362 }); 2363 } 2364 } 2365 }; 2366}(jQuery)); 2367 2368/* 2369 * jQuery Open/Close plugin 2370 */ 2371; (function ($) { 2372 function OpenClose(options) { 2373 this.options = $.extend({ 2374 addClassBeforeAnimation: true, 2375 hideOnClickOutside: false, 2376 activeClass: 'active', 2377 opener: '.opener', 2378 slider: '.slide', 2379 animSpeed: 400, 2380 effect: 'fade', 2381 event: 'click' 2382 }, options); 2383 this.init(); 2384 } 2385 OpenClose.prototype = { 2386 init: function () { 2387 if (this.options.holder) { 2388 this.findElements(); 2389 this.attachEvents(); 2390 this.makeCallback('onInit', this); 2391 } 2392 }, 2393 findElements: function () { 2394 this.holder = $(this.options.holder); 2395 this.opener = this.holder.find(this.options.opener); 2396 this.slider = this.holder.find(this.options.slider); 2397 }, 2398 attachEvents: function () { 2399 // add handler 2400 var self = this; 2401 this.eventHandler = function (e) { 2402 e.preventDefault(); 2403 if (self.slider.hasClass(slideHiddenClass)) { 2404 self.showSlide(); 2405 } else { 2406 self.hideSlide(); 2407 } 2408 }; 2409 self.opener.bind(self.options.event, this.eventHandler); 2410 2411 // hover mode handler 2412 if (self.options.event === 'over') { 2413 self.opener.bind('mouseenter', function () { 2414 self.showSlide(); 2415 }); 2416 self.holder.bind('mouseleave', function () { 2417 self.hideSlide(); 2418 }); 2419 } 2420 2421 // outside click handler 2422 self.outsideClickHandler = function (e) { 2423 if (self.options.hideOnClickOutside) { 2424 var target = $(e.target); 2425 if (!target.is(self.holder) && !target.closest(self.holder).length) { 2426 self.hideSlide(); 2427 } 2428 } 2429 }; 2430 2431 // set initial styles 2432 if (this.holder.hasClass(this.options.activeClass)) { 2433 $(document).bind('click touchstart', self.outsideClickHandler); 2434 } else { 2435 this.slider.addClass(slideHiddenClass); 2436 } 2437 }, 2438 showSlide: function () { 2439 var self = this; 2440 if (self.options.addClassBeforeAnimation) { 2441 self.holder.addClass(self.options.activeClass); 2442 } 2443 self.slider.removeClass(slideHiddenClass); 2444 $(document).bind('click touchstart', self.outsideClickHandler); 2445 2446 self.makeCallback('animStart', true); 2447 toggleEffects[self.options.effect].show({ 2448 box: self.slider, 2449 speed: self.options.animSpeed, 2450 complete: function () { 2451 if (!self.options.addClassBeforeAnimation) { 2452 self.holder.addClass(self.options.activeClass); 2453 } 2454 self.makeCallback('animEnd', true); 2455 } 2456 }); 2457 }, 2458 hideSlide: function () { 2459 var self = this; 2460 if (self.options.addClassBeforeAnimation) { 2461 self.holder.removeClass(self.options.activeClass); 2462 } 2463 $(document).unbind('click touchstart', self.outsideClickHandler); 2464 2465 self.makeCallback('animStart', false); 2466 toggleEffects[self.options.effect].hide({ 2467 box: self.slider, 2468 speed: self.options.animSpeed, 2469 complete: function () { 2470 if (!self.options.addClassBeforeAnimation) { 2471 self.holder.removeClass(self.options.activeClass); 2472 } 2473 self.slider.addClass(slideHiddenClass); 2474 self.makeCallback('animEnd', false); 2475 } 2476 }); 2477 }, 2478 destroy: function () { 2479 this.slider.removeClass(slideHiddenClass).css({ display: '' }); 2480 this.opener.unbind(this.options.event, this.eventHandler); 2481 this.holder.removeClass(this.options.activeClass).removeData('OpenClose'); 2482 $(document).unbind('click touchstart', this.outsideClickHandler); 2483 }, 2484 makeCallback: function (name) { 2485 if (typeof this.options[name] === 'function') { 2486 var args = Array.prototype.slice.call(arguments); 2487 args.shift(); 2488 this.options[name].apply(this, args); 2489 } 2490 } 2491 }; 2492 2493 // add stylesheet for slide on DOMReady 2494 var slideHiddenClass = 'js-slide-hidden'; 2495 (function () { 2496 var tabStyleSheet = $('<style type="text/css">')[0]; 2497 var tabStyleRule = '.' + slideHiddenClass; 2498 tabStyleRule += '{position:absolute !important;left:-9999px !important;top:-9999px !important;display:block !important}'; 2499 if (tabStyleSheet.styleSheet) { 2500 tabStyleSheet.styleSheet.cssText = tabStyleRule; 2501 } else { 2502 tabStyleSheet.appendChild(document.createTextNode(tabStyleRule)); 2503 } 2504 $('head').append(tabStyleSheet); 2505 }()); 2506 2507 // animation effects 2508 var toggleEffects = { 2509 slide: { 2510 show: function (o) { 2511 o.box.stop(true).hide().slideDown(o.speed, o.complete); 2512 }, 2513 hide: function (o) {
2514 o.box.stop(true).slideUp(o.speed, o.complete); 2515 } 2516 }, 2517 fade: { 2518 show: function (o) { 2519 o.box.stop(true).hide().fadeIn(o.speed, o.complete); 2520 }, 2521 hide: function (o) { 2522 o.box.stop(true).fadeOut(o.speed, o.complete); 2523 } 2524 }, 2525 none: { 2526 show: function (o) { 2527 o.box.hide().show(0, o.complete); 2528 }, 2529 hide: function (o) { 2530 o.box.hide(0, o.complete); 2531 } 2532 } 2533 }; 2534 2535 // jQuery plugin interface 2536 $.fn.openClose = function (opt) { 2537 return this.each(function () { 2538 jQuery(this).data('OpenClose', new OpenClose($.extend(opt, { holder: this }))); 2539 }); 2540 }; 2541}(jQuery)); 2542 2543/* 2544 * jQuery Accordion plugin 2545 */ 2546; (function ($) { 2547 $.fn.slideAccordion = function (opt) { 2548 // default options 2549 var options = $.extend({ 2550 addClassBeforeAnimation: false, 2551 allowClickWhenExpanded: false, 2552 activeClass: 'active', 2553 opener: '.opener', 2554 slider: '.slide', 2555 animSpeed: 300, 2556 collapsible: true, 2557 event: 'click' 2558 }, opt); 2559 2560 return this.each(function () { 2561 // options 2562 var accordion = $(this); 2563 var items = accordion.find(':has(' + options.slider + ')'); 2564 2565 items.each(function () { 2566 var item = $(this); 2567 var opener = item.find(options.opener); 2568 var slider = item.find(options.slider); 2569 opener.bind(options.event, function (e) { 2570 if (!slider.is(':animated')) { 2571 if (item.hasClass(options.activeClass)) { 2572 if (options.allowClickWhenExpanded) { 2573 return; 2574 } else if (options.collapsible) { 2575 slider.slideUp(options.animSpeed, function () { 2576 hideSlide(slider); 2577 item.removeClass(options.activeClass); 2578 }); 2579 } 2580 } else { 2581 // show active 2582 var levelItems = item.siblings('.' + options.activeClass); 2583 var sliderElements = levelItems.find(options.slider); 2584 item.addClass(options.activeClass); 2585 showSlide(slider).hide().slideDown(options.animSpeed); 2586 2587 // collapse others 2588 sliderElements.slideUp(options.animSpeed, function () { 2589 levelItems.removeClass(options.activeClass); 2590 hideSlide(sliderElements); 2591 }); 2592 } 2593 } 2594 e.preventDefault(); 2595 }); 2596 if (item.hasClass(options.activeClass)) showSlide(slider); else hideSlide(slider); 2597 }); 2598 }); 2599 }; 2600 2601 // accordion slide visibility 2602 var showSlide = function (slide) { 2603 return slide.css({ position: '', top: '', left: '', width: '' }); 2604 }; 2605 var hideSlide = function (slide) { 2606 return slide.show().css({ position: 'absolute', top: -9999, left: -9999, width: slide.width() }); 2607 }; 2608}(jQuery)); 2609 2610/* 2611 * Simple Mobile Navigation 2612 */ 2613; (function ($) { 2614 function MobileNav(options) { 2615 this.options = $.extend({ 2616 container: null, 2617 hideOnClickOutside: false, 2618 menuActiveClass: 'nav-active', 2619 menuOpener: '.nav-opener', 2620 menuDrop: '.nav-drop', 2621 toggleEvent: 'click', 2622 outsideClickEvent: 'click touchstart pointerdown MSPointerDown' 2623 }, options); 2624 this.initStructure(); 2625 this.attachEvents(); 2626 } 2627 MobileNav.prototype = { 2628 initStructure: function () { 2629 this.page = $('html'); 2630 this.container = $(this.options.container); 2631 this.opener = this.container.find(this.options.menuOpener); 2632 this.drop = this.container.find(this.options.menuDrop); 2633 }, 2634 attachEvents: function () { 2635 var self = this; 2636 2637 if (activateResizeHandler) { 2638 activateResizeHandler(); 2639 activateResizeHandler = null; 2640 } 2641 2642 this.outsideClickHandler = function (e) { 2643 if (self.isOpened()) { 2644 var target = $(e.target); 2645 if (!target.closest(self.opener).length && !target.closest(self.drop).length) { 2646 self.hide(); 2647 } 2648 } 2649 }; 2650 2651 this.openerClickHandler = function (e) { 2652 e.preventDefault();
2653 self.toggle(); 2654 }; 2655 2656 this.opener.on(this.options.toggleEvent, this.openerClickHandler); 2657 }, 2658 isOpened: function () { 2659 return this.container.hasClass(this.options.menuActiveClass); 2660 }, 2661 show: function () { 2662 this.container.addClass(this.options.menuActiveClass); 2663 if (this.options.hideOnClickOutside) { 2664 this.page.on(this.options.outsideClickEvent, this.outsideClickHandler); 2665 } 2666 }, 2667 hide: function () { 2668 this.container.removeClass(this.options.menuActiveClass); 2669 if (this.options.hideOnClickOutside) { 2670 this.page.off(this.options.outsideClickEvent, this.outsideClickHandler); 2671 } 2672 }, 2673 toggle: function () { 2674 if (this.isOpened()) { 2675 this.hide(); 2676 } else { 2677 this.show(); 2678 } 2679 }, 2680 destroy: function () { 2681 this.container.removeClass(this.options.menuActiveClass); 2682 this.opener.off(this.options.toggleEvent, this.clickHandler); 2683 this.page.off(this.options.outsideClickEvent, this.outsideClickHandler); 2684 } 2685 }; 2686 2687 var activateResizeHandler = function () { 2688 var win = $(window), 2689 doc = $('html'), 2690 resizeClass = 'resize-active', 2691 flag, timer; 2692 var removeClassHandler = function () { 2693 flag = false; 2694 doc.removeClass(resizeClass); 2695 }; 2696 var resizeHandler = function () { 2697 if (!flag) { 2698 flag = true; 2699 doc.addClass(resizeClass); 2700 } 2701 clearTimeout(timer); 2702 timer = setTimeout(removeClassHandler, 500); 2703 }; 2704 win.on('resize orientationchange', resizeHandler); 2705 }; 2706 2707 $.fn.mobileNav = function (options) { 2708 return this.each(function () { 2709 var params = $.extend({}, options, { container: this }), 2710 instance = new MobileNav(params); 2711 $.data(this, 'MobileNav', instance); 2712 }); 2713 }; 2714}(jQuery)); 2715 2716/* 2717 * Convert navigation to select 2718 */ 2719; (function ($) { 2720 function NavigationSelect(options) { 2721 this.options = $.extend({ 2722 list: null, 2723 levelIndentHTML: ' • ', 2724 defaultOptionAttr: 'title', 2725 defaultOptionText: '...', 2726 selectClass: 'nav-select', 2727 activeClass: 'nav-active', 2728 defaultOptionClass: 'opt-default', 2729 hasDropClass: 'opt-sublevel', 2730 levelPrefixClass: 'opt-level-', 2731 useDefaultOption: true 2732 }, options); 2733 if (this.options.list) { 2734 this.createSelect(); 2735 this.attachEvents(); 2736 } 2737 } 2738 NavigationSelect.prototype = { 2739 createSelect: function () { 2740 var self = this; 2741 this.startIndex = 0; 2742 this.navigation = $(this.options.list); 2743 this.select = $('<select>').addClass(this.options.selectClass); 2744 this.createDefaultOption(); 2745 this.createList(this.navigation, 0); 2746 this.select.insertBefore(this.navigation); 2747 }, 2748 createDefaultOption: function () { 2749 if (this.options.useDefaultOption) { 2750 var attrText = this.navigation.attr(this.options.defaultOptionAttr); 2751 var defaultOption = $('<option>').addClass(this.options.defaultOptionClass).text(attrText || this.options.defaultOptionText); 2752 this.navigation.removeAttr(this.options.defaultOptionAttr); 2753 this.select.append(defaultOption); 2754 this.startIndex = 1; 2755 } 2756 }, 2757 createList: function (list, level) { 2758 var self = this; 2759 list.children().each(function (index, item) { 2760 var listItem = $(this), 2761 listLink = listItem.find('a').eq(0), 2762 listDrop = listItem.find('ul').eq(0), 2763 hasDrop = listDrop.length > 0; 2764 2765 if (listLink.length) { 2766 self.select.append(self.createOption(listLink, hasDrop, level, listLink.hasClass(self.options.activeClass))); 2767 } 2768 if (hasDrop) {
2769 self.createList(listDrop, level + 1); 2770 } 2771 }); 2772 }, 2773 createOption: function (link, hasDrop, level, selected) { 2774 var optionHTML = this.getLevelIndent(level) + link.html(); 2775 return $('<option>').html(optionHTML) 2776 .addClass(this.options.levelPrefixClass + (level + 1)) 2777 .toggleClass(this.options.hasDropClass, hasDrop) 2778 .val(link.attr('href')).attr('selected', selected ? 'selected' : false); 2779 }, 2780 getLevelIndent: function (level) { 2781 return (new Array(level + 1)).join(this.options.levelIndentHTML); 2782 }, 2783 attachEvents: function () { 2784 // redirect on select change 2785 var self = this; 2786 this.select.change(function () { 2787 if (this.selectedIndex >= self.startIndex) { 2788 //location.href = this.value; 2789 } 2790 }); 2791 } 2792 }; 2793 2794 // jquery pluginm interface 2795 $.fn.navigationSelect = function (opt) { 2796 return this.each(function () { 2797 new NavigationSelect($.extend({ list: this }, opt)); 2798 }); 2799 }; 2800}(jQuery)); 2801 2802/*! https://mths.be/placeholder v2.0.7 by @mathias */ 2803; (function (window, document, $) { 2804 2805 // Opera Mini v7 doesn’t support placeholder although its DOM seems to indicate so 2806 var isOperaMini = Object.prototype.toString.call(window.operamini) == '[object OperaMini]'; 2807 var isInputSupported = 'placeholder' in document.createElement('input') && !isOperaMini; 2808 var isTextareaSupported = 'placeholder' in document.createElement('textarea') && !isOperaMini; 2809 var prototype = $.fn; 2810 var valHooks = $.valHooks; 2811 var propHooks = $.propHooks; 2812 var hooks; 2813 var placeholder; 2814 2815 if (isInputSupported && isTextareaSupported) { 2816 2817 placeholder = prototype.placeholder = function () { 2818 return this; 2819 }; 2820 2821 placeholder.input = placeholder.textarea = true; 2822 2823 } else { 2824 2825 placeholder = prototype.placeholder = function () { 2826 var $this = this; 2827 $this 2828 .filter((isInputSupported ? 'textarea' : ':input') + '[placeholder]') 2829 .not('.placeholder') 2830 .bind({ 2831 'focus.placeholder': clearPlaceholder, 2832 'blur.placeholder': setPlaceholder 2833 }) 2834 .data('placeholder-enabled', true) 2835 .trigger('blur.placeholder'); 2836 return $this; 2837 }; 2838 2839 placeholder.input = isInputSupported; 2840 placeholder.textarea = isTextareaSupported; 2841 2842 hooks = { 2843 'get': function (element) { 2844 var $element = $(element); 2845 2846 var $passwordInput = $element.data('placeholder-password'); 2847 if ($passwordInput) { 2848 return $passwordInput[0].value; 2849 } 2850 2851 return $element.data('placeholder-enabled') && $element.hasClass('placeholder') ? '' : element.value; 2852 }, 2853 'set': function (element, value) { 2854 var $element = $(element); 2855 2856 var $passwordInput = $element.data('placeholder-password'); 2857 if ($passwordInput) { 2858 return $passwordInput[0].value = value; 2859 } 2860 2861 if (!$element.data('placeholder-enabled')) { 2862 return element.value = value; 2863 } 2864 if (value == '') { 2865 element.value = value; 2866 // Issue #56: Setting the placeholder causes problems if the element continues to have focus. 2867 if (element != safeActiveElement()) { 2868 // We can't use `triggerHandler` here because of dummy text/password inputs :( 2869 setPlaceholder.call(element); 2870 } 2871 } else if ($element.hasClass('placeholder')) { 2872 clearPlaceholder.call(element, true, value) || (element.value = value); 2873 } else { 2874 element.value = value; 2875 } 2876 // `set` can not return `undefined`; see https://jsapi.info/jquery/1.7.1/val#L2363 2877 return $element; 2878 } 2879 }; 2880 2881 if (!isInputSupported) { 2882 valHooks.input = hooks; 2883 propHooks.value = hooks; 2884 } 2885 if (!isTextareaSupported) { 2886 valHooks.textarea = hooks; 2887 propHooks.value = hooks; 2888 } 2889 2890 $(function () { 2891 // Look for forms 2892 $(document).delegate('form', 'submit.placeholder', function () { 2893 // Clear the placeholder values so they don't get submitted
2894 var $inputs = $('.placeholder', this).each(clearPlaceholder); 2895 setTimeout(function () { 2896 $inputs.each(setPlaceholder); 2897 }, 10); 2898 }); 2899 }); 2900 2901 // Clear placeholder values upon page reload 2902 $(window).bind('beforeunload.placeholder', function () { 2903 $('.placeholder').each(function () { 2904 this.value = ''; 2905 }); 2906 }); 2907 2908 } 2909 2910 function args(elem) { 2911 // Return an object of element attributes 2912 var newAttrs = {}; 2913 var rinlinejQuery = /^jQuery\d+$/; 2914 $.each(elem.attributes, function (i, attr) { 2915 if (attr.specified && !rinlinejQuery.test(attr.name)) { 2916 newAttrs[attr.name] = attr.value; 2917 } 2918 }); 2919 return newAttrs; 2920 } 2921 2922 function clearPlaceholder(event, value) { 2923 var input = this; 2924 var $input = $(input); 2925 if (input.value == $input.attr('placeholder') && $input.hasClass('placeholder')) { 2926 if ($input.data('placeholder-password')) { 2927 $input = $input.hide().next().show().attr('id', $input.removeAttr('id').data('placeholder-id')); 2928 // If `clearPlaceholder` was called from `$.valHooks.input.set` 2929 if (event === true) { 2930 return $input[0].value = value; 2931 } 2932 $input.focus(); 2933 } else { 2934 input.value = ''; 2935 $input.removeClass('placeholder'); 2936 input == safeActiveElement() && input.select(); 2937 } 2938 } 2939 } 2940 2941 function setPlaceholder() { 2942 var $replacement; 2943 var input = this; 2944 var $input = $(input); 2945 var id = this.id; 2946 if (input.value == '') { 2947 if (input.type == 'password') { 2948 if (!$input.data('placeholder-textinput')) { 2949 try { 2950 $replacement = $input.clone().attr({ 'type': 'text' }); 2951 } catch (e) { 2952 $replacement = $('<input>').attr($.extend(args(this), { 'type': 'text' })); 2953 } 2954 $replacement 2955 .removeAttr('name') 2956 .data({ 2957 'placeholder-password': $input, 2958 'placeholder-id': id 2959 }) 2960 .bind('focus.placeholder', clearPlaceholder); 2961 $input 2962 .data({ 2963 'placeholder-textinput': $replacement, 2964 'placeholder-id': id 2965 }) 2966 .before($replacement); 2967 } 2968 $input = $input.removeAttr('id').hide().prev().attr('id', id).show(); 2969 // Note: `$input[0] != input` now! 2970 } 2971 $input.addClass('placeholder'); 2972 $input[0].value = $input.attr('placeholder'); 2973 } else { 2974 $input.removeClass('placeholder'); 2975 } 2976 } 2977 2978 function safeActiveElement() { 2979 // Avoid IE9 `document.activeElement` of death 2980 // https://github.com/mathiasbynens/jquery-placeholder/pull/99 2981 try { 2982 return document.activeElement; 2983 } catch (err) { } 2984 } 2985 2986}(this, document, jQuery)); 2987 2988/*! 2989 * JavaScript Custom Forms 2990 * 2991 * Copyright 2014-2015 PSD2HTML - https://psd2html.com/jcf 2992 * Released under the MIT license (LICENSE.txt) 2993 * 2994 * Version: 1.1.2 2995 */ 2996; (function (root, factory) { 2997 'use strict'; 2998 if (typeof define === 'function' && define.amd) { 2999 define(['jquery'], factory); 3000 } else if (typeof exports === 'object') { 3001 module.exports = factory(require('jquery')); 3002 } else { 3003 root.jcf = factory(jQuery); 3004 } 3005}(this, function ($) { 3006 'use strict'; 3007 3008 // define version 3009 var version = '1.1.2'; 3010 3011 // private variables 3012 var customInstances = []; 3013 3014 // default global options 3015 var commonOptions = { 3016 optionsKey: 'jcf', 3017 dataKey: 'jcf-instance', 3018 rtlClass: 'jcf-rtl', 3019 focusClass: 'jcf-focus', 3020 pressedClass: 'jcf-pressed', 3021 disabledClass: 'jcf-disabled', 3022 hiddenClass: 'jcf-hidden', 3023 resetAppearanceClass: 'jcf-reset-appearance', 3024 unselectableClass: 'jcf-unselectable' 3025 }; 3026 3027 // detect device type 3028 var isTouchDevice = ('ontouchstart' in window) || window.DocumentTouch && document instanceof window.DocumentTouch, 3029 isWinPhoneDevice = /Windows Phone/.test(navigator.userAgent); 3030 commonOptions.isMobileDevice = !!(isTouchDevice || isWinPhoneDevice); 3031 3032 // create global stylesheet if custom forms are used 3033 var createStyleSheet = function () { 3034 var styleTag = $('<style>').appendTo('head'), 3035 styleSheet = styleTag.prop('sheet') || styleTag.prop('styleSheet'); 3036 3037 // crossbrowser style handling 3038 var addCSSRule = function (selector, rules, index) { 3039 if (styleSheet.insertRule) { 3040 styleSheet.insertRule(selector + '{' + rules + '}', index); 3041 } else { 3042 styleSheet.addRule(selector, rules, index); 3043 } 3044 }; 3045 3046 // add special rules 3047 addCSSRule('.' + commonOptions.hiddenClass, 'position:absolute !important;left:-9999px !important;height:1px !important;width:1px !important;margin:0 !important;border-width:0 !important;-webkit-appearance:none;-moz-appearance:none;appearance:none'); 3048 addCSSRule('.' + commonOptions.rtlClass + ' .' + commonOptions.hiddenClass, 'right:-9999px !important; left: auto !important'); 3049 addCSSRule('.' + commonOptions.unselectableClass, '-webkit-user-select: none; -moz-user-select: none; -ms-user-select: none; user-select: none; -webkit-tap-highlight-color: rgba(0,0,0,0);'); 3050 addCSSRule('.' + commonOptions.resetAppearanceClass, 'background: none; border: none; -webkit-appearance: none; appearance: none; opacity: 0; filter: alpha(opacity=0);'); 3051 3052 // detect rtl pages 3053 var html = $('html'), body = $('body'); 3054 if (html.css('direction') === 'rtl' || body.css('direction') === 'rtl') { 3055 html.addClass(commonOptions.rtlClass); 3056 } 3057 3058 // handle form reset event 3059 html.on('reset', function () { 3060 setTimeout(function () { 3061 api.refreshAll(); 3062 }, 0); 3063 }); 3064 3065 // mark stylesheet as created 3066 commonOptions.styleSheetCreated = true; 3067 }; 3068 3069 // simplified pointer events handler 3070 (function () { 3071 var pointerEventsSupported = navigator.pointerEnabled || navigator.msPointerEnabled, 3072 touchEventsSupported = ('ontouchstart' in window) || window.DocumentTouch && document instanceof window.DocumentTouch, 3073 eventList, eventMap = {}, eventPrefix = 'jcf-'; 3074 3075 // detect events to attach 3076 if (pointerEventsSupported) { 3077 eventList = { 3078 pointerover: navigator.pointerEnabled ? 'pointerover' : 'MSPointerOver', 3079 pointerdown: navigator.pointerEnabled ? 'pointerdown' : 'MSPointerDown', 3080 pointermove: navigator.pointerEnabled ? 'pointermove' : 'MSPointerMove', 3081 pointerup: navigator.pointerEnabled ? 'pointerup' : 'MSPointerUp' 3082 }; 3083 } else { 3084 eventList = { 3085 pointerover: 'mouseover', 3086 pointerdown: 'mousedown' + (touchEventsSupported ? ' touchstart' : ''), 3087 pointermove: 'mousemove' + (touchEventsSupported ? ' touchmove' : ''), 3088 pointerup: 'mouseup' + (touchEventsSupported ? ' touchend' : '') 3089 }; 3090 } 3091 3092 // create event map 3093 $.each(eventList, function (targetEventName, fakeEventList) { 3094 $.each(fakeEventList.split(' '), function (index, fakeEventName) { 3095 eventMap[fakeEventName] = targetEventName; 3096 }); 3097 }); 3098 3099 // jQuery event hooks 3100 $.each(eventList, function (eventName, eventHandlers) { 3101 eventHandlers = eventHandlers.split(' '); 3102 $.event.special[eventPrefix + eventName] = { 3103 setup: function () { 3104 var self = this; 3105 $.each(eventHandlers, function (index, fallbackEvent) { 3106 if (self.addEventListener) self.addEventListener(fallbackEvent, fixEvent, false); 3107 else self['on' + fallbackEvent] = fixEvent; 3108 }); 3109 }, 3110 teardown: function () { 3111 var self = this; 3112 $.each(eventHandlers, function (index, fallbackEvent) { 3113 if (self.addEventListener) self.removeEventListener(fallbackEvent, fixEvent, false); 3114 else self['on' + fallbackEvent] = null; 3115 }); 3116 } 3117 }; 3118 }); 3119 3120 // check that mouse event are not simulated by mobile browsers 3121 var lastTouch = null; 3122 var mouseEventSimulated = function (e) { 3123 var dx = Math.abs(e.pageX - lastTouch.x), 3124 dy = Math.abs(e.pageY - lastTouch.y), 3125 rangeDistance = 25; 3126 3127 if (dx <= rangeDistance && dy <= rangeDistance) { 3128 return true; 3129 } 3130 }; 3131 3132 // normalize event 3133 var fixEvent = function (e) { 3134 var origEvent = e || window.event, 3135 touchEventData = null, 3136 targetEventName = eventMap[origEvent.type]; 3137 3138 e = $.event.fix(origEvent); 3139 e.type = eventPrefix + targetEventName; 3140 3141 if (origEvent.pointerType) { 3142 switch (origEvent.pointerType) { 3143 case 2: e.pointerType = 'touch'; break; 3144 case 3: e.pointerType = 'pen'; break; 3145 case 4: e.pointerType = 'mouse'; break; 3146 default: e.pointerType = origEvent.pointerType; 3147 } 3148 } else { 3149 e.pointerType = origEvent.type.substr(0, 5); // "mouse" or "touch" word length 3150 } 3151 3152 if (!e.pageX && !e.pageY) { 3153 touchEventData = origEvent.changedTouches ? origEvent.changedTouches[0] : origEvent; 3154 e.pageX = touchEventData.pageX; 3155 e.pageY = touchEventData.pageY; 3156 } 3157 3158 if (origEvent.type === 'touchend') { 3159 lastTouch = { x: e.pageX, y: e.pageY }; 3160 } 3161 if (e.pointerType === 'mouse' && lastTouch && mouseEventSimulated(e)) { 3162 return; 3163 } else { 3164 return ($.event.dispatch || $.event.handle).call(this, e); 3165 } 3166 }; 3167 }()); 3168 3169 // custom mousewheel/trackpad handler 3170 (function () { 3171 var wheelEvents = ('onwheel' in document || document.documentMode >= 9 ? 'wheel' : 'mousewheel DOMMouseScroll').split(' '), 3172 shimEventName = 'jcf-mousewheel'; 3173 3174 $.event.special[shimEventName] = { 3175 setup: function () { 3176 var self = this; 3177 $.each(wheelEvents, function (index, fallbackEvent) { 3178 if (self.addEventListener) self.addEventListener(fallbackEvent, fixEvent, false); 3179 else self['on' + fallbackEvent] = fixEvent; 3180 }); 3181 }, 3182 teardown: function () { 3183 var self = this; 3184 $.each(wheelEvents, function (index, fallbackEvent) { 3185 if (self.addEventListener) self.removeEventListener(fallbackEvent, fixEvent, false); 3186 else self['on' + fallbackEvent] = null; 3187 }); 3188 } 3189 }; 3190 3191 var fixEvent = function (e) { 3192 var origEvent = e || window.event; 3193 e = $.event.fix(origEvent); 3194 e.type = shimEventName; 3195 3196 // old wheel events handler 3197 if ('detail' in origEvent) { e.deltaY = -origEvent.detail; } 3198 if ('wheelDelta' in origEvent) { e.deltaY = -origEvent.wheelDelta; } 3199 if ('wheelDeltaY' in origEvent) { e.deltaY = -origEvent.wheelDeltaY; } 3200 if ('wheelDeltaX' in origEvent) { e.deltaX = -origEvent.wheelDeltaX; } 3201 3202 // modern wheel event handler 3203 if ('deltaY' in origEvent) { 3204 e.deltaY = origEvent.deltaY; 3205 } 3206 if ('deltaX' in origEvent) { 3207 e.deltaX = origEvent.deltaX; 3208 } 3209 3210 // handle deltaMode for mouse wheel 3211 e.delta = e.deltaY || e.deltaX; 3212 if (origEvent.deltaMode === 1) { 3213 var lineHeight = 16; 3214 e.delta *= lineHeight; 3215 e.deltaY *= lineHeight; 3216 e.deltaX *= lineHeight; 3217 } 3218 3219 return ($.event.dispatch || $.event.handle).call(this, e); 3220 }; 3221 }()); 3222 3223 // extra module methods 3224 var moduleMixin = { 3225 // provide function for firing native events 3226 fireNativeEvent: function (elements, eventName) { 3227 $(elements).each(function () { 3228 var element = this, eventObject; 3229 if (element.dispatchEvent) { 3230 eventObject = document.createEvent('HTMLEvents'); 3231 eventObject.initEvent(eventName, true, true); 3232 element.dispatchEvent(eventObject); 3233 } else if (document.createEventObject) { 3234 eventObject = document.createEventObject(); 3235 eventObject.target = element; 3236 element.fireEvent('on' + eventName, eventObject); 3237 } 3238 }); 3239 }, 3240 // bind event handlers for module instance (functions beggining with "on") 3241 bindHandlers: function () { 3242 var self = this; 3243 $.each(self, function (propName, propValue) { 3244 if (propName.indexOf('on') === 0 && $.isFunction(propValue)) { 3245 // dont use $.proxy here because it doesn't create unique handler 3246 self[propName] = function () { 3247 return propValue.apply(self, arguments); 3248 }; 3249 } 3250 }); 3251 } 3252 }; 3253 3254 // public API 3255 var api = { 3256 version: version, 3257 modules: {}, 3258 getOptions: function () { 3259 return $.extend({}, commonOptions); 3260 }, 3261 setOptions: function (moduleName, moduleOptions) { 3262 if (arguments.length > 1) { 3263 // set module options 3264 if (this.modules[moduleName]) { 3265 $.extend(this.modules[moduleName].prototype.options, moduleOptions); 3266 } 3267 } else { 3268 // set common options 3269 $.extend(commonOptions, moduleName); 3270 } 3271 }, 3272 addModule: function (proto) { 3273 // add module to list 3274 var Module = function (options) { 3275 // save instance to collection 3276 if (!options.element.data(commonOptions.dataKey)) { 3277 options.element.data(commonOptions.dataKey, this); 3278 } 3279 customInstances.push(this); 3280 3281 // save options 3282 this.options = $.extend({}, commonOptions, this.options, getInlineOptions(options.element), options); 3283 3284 // bind event handlers to instance 3285 this.bindHandlers(); 3286 3287 // call constructor 3288 this.init.apply(this, arguments); 3289 }; 3290 3291 // parse options from HTML attribute 3292 var getInlineOptions = function (element) { 3293 var dataOptions = element.data(commonOptions.optionsKey), 3294 attrOptions = element.attr(commonOptions.optionsKey); 3295 3296 if (dataOptions) { 3297 return dataOptions; 3298 } else if (attrOptions) { 3299 try { 3300 return $.parseJSON(attrOptions); 3301 } catch (e) { 3302 // ignore invalid attributes 3303 } 3304 } 3305 }; 3306 3307 // set proto as prototype for new module 3308 Module.prototype = proto; 3309 3310 // add mixin methods to module proto 3311 $.extend(proto, moduleMixin); 3312 if (proto.plugins) { 3313 $.each(proto.plugins, function (pluginName, pl
3313ugin) { 3314 $.extend(plugin.prototype, moduleMixin); 3315 }); 3316 } 3317 3318 // override destroy method 3319 var originalDestroy = Module.prototype.destroy; 3320 Module.prototype.destroy = function () { 3321 this.options.element.removeData(this.options.dataKey); 3322 3323 for (var i = customInstances.length - 1; i >= 0; i--) { 3324 if (customInstances[i] === this) { 3325 customInstances.splice(i, 1); 3326 break; 3327 } 3328 } 3329 3330 if (originalDestroy) { 3331 originalDestroy.apply(this, arguments); 3332 } 3333 }; 3334 3335 // save module to list 3336 this.modules[proto.name] = Module; 3337 }, 3338 getInstance: function (element) { 3339 return $(element).data(commonOptions.dataKey); 3340 }, 3341 replace: function (elements, moduleName, customOptions) { 3342 var self = this, 3343 instance; 3344 3345 if (!commonOptions.styleSheetCreated) { 3346 createStyleSheet(); 3347 } 3348 3349 $(elements).each(function () { 3350 var moduleOptions, 3351 element = $(this); 3352 3353 instance = element.data(commonOptions.dataKey); 3354 if (instance) { 3355 instance.refresh(); 3356 } else { 3357 if (!moduleName) { 3358 $.each(self.modules, function (currentModuleName, module) { 3359 if (module.prototype.matchElement.call(module.prototype, element)) { 3360 moduleName = currentModuleName; 3361 return false; 3362 } 3363 }); 3364 } 3365 if (moduleName) { 3366 moduleOptions = $.extend({ element: element }, customOptions); 3367 instance = new self.modules[moduleName](moduleOptions); 3368 } 3369 } 3370 }); 3371 return instance; 3372 }, 3373 refresh: function (elements) { 3374 $(elements).each(function () { 3375 var instance = $(this).data(commonOptions.dataKey); 3376 if (instance) { 3377 instance.refresh(); 3378 } 3379 }); 3380 }, 3381 destroy: function (elements) { 3382 $(elements).each(function () { 3383 var instance = $(this).data(commonOptions.dataKey); 3384 if (instance) { 3385 instance.destroy(); 3386 } 3387 }); 3388 }, 3389 replaceAll: function (context) { 3390 var self = this; 3391 $.each(this.modules, function (moduleName, module) { 3392 $(module.prototype.selector, context).each(function () { 3393 if (this.className.indexOf('jcf-ignore') < 0) { 3394 self.replace(this, moduleName); 3395 } 3396 }); 3397 }); 3398 }, 3399 refreshAll: function (context) { 3400 if (context) { 3401 $.each(this.modules, function (moduleName, module) { 3402 $(module.prototype.selector, context).each(function () { 3403 var instance = $(this).data(commonOptions.dataKey); 3404 if (instance) { 3405 instance.refresh(); 3406 } 3407 }); 3408 }); 3409 } else { 3410 for (var i = customInstances.length - 1; i >= 0; i--) { 3411 customInstances[i].refresh(); 3412 } 3413 } 3414 }, 3415 destroyAll: function (context) { 3416 if (context) { 3417 $.each(this.modules, function (moduleName, module) { 3418 $(module.prototype.selector, context).each(function (index, element) { 3419 var instance = $(element).data(commonOptions.dataKey); 3420 if (instance) { 3421 instance.destroy(); 3422 } 3423 }); 3424 }); 3425 } else { 3426 while (customInstances.length) { 3427 customInstances[0].destroy(); 3428 } 3429 } 3430 } 3431 }; 3432 3433 return api; 3434})); 3435 3436/*! 3437 * JavaScript Custom Forms : Scrollbar Module 3438 * 3439 * Copyright 2014-2015 PSD2HTML - https://psd2html.com/jcf 3440 * Released under the MIT license (LICENSE.txt) 3441 * 3442 * Version: 1.1.3 3443 */ 3444; (function ($, window) { 3445 'use strict'; 3446 3447 jcf.addModule({ 3448 name: 'Scrollable', 3449 selector: '.jcf-scrollable', 3450 plugins: { 3451 ScrollBar: ScrollBar 3452 }, 3453 options: { 3454 mouseWheelStep: 150, 3455 handleResize: true, 3456 alwaysShowScrollbars: false, 3457 alwaysPreventMouseWheel: false, 3458 scrollAreaStructure: '<div class="jcf-scrollable-wrapper"></div>' 3459 }, 3460 matchElement: function (element) { 3461 return element.is('.jcf-scrollable'); 3462 }, 3463 init: function () { 3464 this.initStructure(); 3465 this.attachEvents(); 3466 this.rebuildScrollbars(); 3467 }, 3468 initStructure: function () { 3469 // prepare structure 3470 this.doc = $(document); 3471 this.win = $(window); 3472 this.realElement = $(this.options.element); 3473 this.scrollWrapper = $(this.options.scrollAreaStructure).insertAfter(this.realElement); 3474 3475 // set initial styles 3476 this.scrollWrapper.css('position', 'relative'); 3477 this.realElement.css('overflow', 'hidden'); 3478 this.vBarEdge = 0; 3479 }, 3480 attachEvents: function () { 3481 // create scrollbars 3482 var self = this; 3483 this.vBar = new ScrollBar({ 3484 holder: this.scrollWrapper, 3485 vertical: true, 3486 onScroll: function (scrollTop) { 3487 self.realElement.scrollTop(scrollTop); 3488 } 3489 }); 3490 this.hBar = new ScrollBar({ 3491 holder: this.scrollWrapper, 3492 vertical: false, 3493 onScroll: function (scrollLeft) { 3494 self.realElement.scrollLeft(scrollLeft); 3495 } 3496 }); 3497 3498 // add event handlers 3499 this.realElement.on('scroll', this.onScroll); 3500 if (this.options.handleResize) { 3501 this.win.on('resize orientationchange load', this.onResize); 3502 } 3503 3504 // add pointer/wheel event handlers 3505 this.realElement.on('jcf-mousewheel', this.onMouseWheel); 3506 this.realElement.on('jcf-pointerdown', this.onTouchBo
3506dy); 3507 }, 3508 onScroll: function () { 3509 this.redrawScrollbars(); 3510 }, 3511 onResize: function () { 3512 // do not rebuild scrollbars if form field is in focus 3513 if (!$(document.activeElement).is(':input')) { 3514 this.rebuildScrollbars(); 3515 } 3516 }, 3517 onTouchBody: function (e) { 3518 if (e.pointerType === 'touch') { 3519 this.touchData = { 3520 scrollTop: this.realElement.scrollTop(), 3521 scrollLeft: this.realElement.scrollLeft(), 3522 left: e.pageX, 3523 top: e.pageY 3524 }; 3525 this.doc.on({ 3526 'jcf-pointermove': this.onMoveBody, 3527 'jcf-pointerup': this.onReleaseBody 3528 }); 3529 } 3530 }, 3531 onMoveBody: function (e) { 3532 var targetScrollTop, 3533 targetScrollLeft, 3534 verticalScrollAllowed = this.verticalScrollActive, 3535 horizontalScrollAllowed = this.horizontalScrollActive; 3536 3537 if (e.pointerType === 'touch') { 3538 targetScrollTop = this.touchData.scrollTop - e.pageY + this.touchData.top; 3539 targetScrollLeft = this.touchData.scrollLeft - e.pageX + this.touchData.left; 3540 3541 // check that scrolling is ended and release outer scrolling 3542 if (this.verticalScrollActive && (targetScrollTop < 0 || targetScrollTop > this.vBar.maxValue)) { 3543 verticalScrollAllowed = false; 3544 } 3545 if (this.horizontalScrollActive && (targetScrollLeft < 0 || targetScrollLeft > this.hBar.maxValue)) { 3546 horizontalScrollAllowed = false; 3547 } 3548 3549 this.realElement.scrollTop(targetScrollTop); 3550 this.realElement.scrollLeft(targetScrollLeft); 3551 3552 if (verticalScrollAllowed || horizontalScrollAllowed) { 3553 e.preventDefault(); 3554 } else { 3555 this.onReleaseBody(e); 3556 } 3557 } 3558 }, 3559 onReleaseBody: function (e) { 3560 if (e.pointerType === 'touch') { 3561 delete this.touchData; 3562 this.doc.off({ 3563 'jcf-pointermove': this.onMoveBody, 3564 'jcf-pointerup': this.onReleaseBody 3565 }); 3566 } 3567 }, 3568 onMouseWheel: function (e) { 3569 var currentScrollTop = this.realElement.scrollTop(), 3570 currentScrollLeft = this.realElement.scrollLeft(), 3571 maxScrollTop = this.realElement.prop('scrollHeight') - this.embeddedDimensions.innerHeight, 3572 maxScrollLeft = this.realElement.prop('scrollWidth') - this.embeddedDimensions.innerWidth, 3573 extraLeft, extraTop, preventFlag; 3574 3575 // check edge cases 3576 if (!this.options.alwaysPreventMouseWheel) { 3577 if (this.verticalScrollActive && e.deltaY) { 3578 if (!(currentScrollTop <= 0 && e.deltaY < 0) && !(currentScrollTop >= maxScrollTop && e.deltaY > 0)) { 3579 preventFlag = true; 3580 } 3581 } 3582 if (this.horizontalScrollActive && e.deltaX) { 3583 if (!(currentScrollLeft <= 0 && e.deltaX < 0) && !(currentScrollLeft >= maxScrollLeft && e.deltaX > 0)) { 3584 preventFlag = true; 3585 } 3586 } 3587 if (!this.verticalScrollActive && !this.horizontalScrollActive) { 3588 return; 3589 } 3590 } 3591 3592 // prevent default action and scroll item 3593 if (preventFlag || this.options.alwaysPreventMouseWheel) { 3594 e.preventDefault(); 3595 } else { 3596 return; 3597 } 3598 3599 extraLeft = e.deltaX / 100 * this.options.mouseWheelStep; 3600 extraTop = e.deltaY / 100 * this.options.mouseWheelStep; 3601 3602 this.realElement.scrollTop(currentScrollTop + extraTop); 3603 this.realElement.scrollLeft(currentScrollLeft + extraLeft); 3604 }, 3605 setScrollBarEdge: function (edgeSize) { 3606 this.vBarEdge = edgeSize || 0; 3607 this.redrawScrollbars(); 3608 }, 3609 saveElementDimensions: function () { 3610 this.savedDimensions = { 3611 top: this.realElement.width(), 3612 left: this.realElement.height() 3613 }; 3614 return this; 3615 }, 3616 restoreElementDimensions: function () { 3617 if (this.savedDimensions) { 3618 this.realElement.css({ 3619 width: this.savedDimensions.width, 3620 height: this.savedDimensions.height 3621 }); 3622 } 3623 return this; 3624 }, 3625 saveScrollOffsets: function () { 3626 this.savedOffsets = { 3627 top: this.realElement.scrollTop(), 3628 left: this.realElement.scrollLeft() 3629 }; 3630 return this; 3631 }, 3632 restoreScrollOffsets: function () { 3633 if (this.savedOffsets) { 3634 this.realElement.scrollTop(this.savedOffsets.top); 3635 this.realElement.scrollLeft(this.savedOffsets.left); 3636 } 3637 return this; 3638 }, 3639 getContainerDimensions: function () { 3640 // save current styles 3641 var desiredDimensions, 3642 currentStyles, 3643 currentHeight, 3644 currentWidth; 3645 3646 if (this.isModifiedStyles) { 3647 desiredDimensions = { 3648 width: this.realElement.innerWidth() + this.vBar.getThickness(),
3649 height: this.realElement.innerHeight() + this.hBar.getThickness() 3650 }; 3651 } else { 3652 // unwrap real element and measure it according to CSS 3653 this.saveElementDimensions().saveScrollOffsets(); 3654 this.realElement.insertAfter(this.scrollWrapper); 3655 this.scrollWrapper.detach(); 3656 3657 // measure element 3658 currentStyles = this.realElement.prop('style'); 3659 currentWidth = parseFloat(currentStyles.width); 3660 currentHeight = parseFloat(currentStyles.height); 3661 3662 // reset styles if needed 3663 if (this.embeddedDimensions && currentWidth && currentHeight) { 3664 this.isModifiedStyles |= (currentWidth !== this.embeddedDimensions.width || currentHeight !== this.embeddedDimensions.height); 3665 this.realElement.css({ 3666 overflow: '', 3667 width: '', 3668 height: '' 3669 }); 3670 } 3671 3672 // calculate desired dimensions for real element 3673 desiredDimensions = { 3674 width: this.realElement.outerWidth(), 3675 height: this.realElement.outerHeight() 3676 }; 3677 3678 // restore structure and original scroll offsets 3679 this.scrollWrapper.insertAfter(this.realElement); 3680 this.realElement.css('overflow', 'hidden').prependTo(this.scrollWrapper); 3681 this.restoreElementDimensions().restoreScrollOffsets(); 3682 } 3683 3684 return desiredDimensions; 3685 }, 3686 getEmbeddedDimensions: function (dimensions) { 3687 // handle scrollbars cropping 3688 var fakeBarWidth = this.vBar.getThickness(), 3689 fakeBarHeight = this.hBar.getThickness(), 3690 paddingWidth = this.realElement.outerWidth() - this.realElement.width(), 3691 paddingHeight = this.realElement.outerHeight() - this.realElement.height(), 3692 resultDimensions; 3693 3694 if (this.options.alwaysShowScrollbars) { 3695 // simply return dimensions without custom scrollbars 3696 this.verticalScrollActive = true; 3697 this.horizontalScrollActive = true; 3698 resultDimensions = { 3699 innerWidth: dimensions.width - fakeBarWidth, 3700 innerHeight: dimensions.height - fakeBarHeight 3701 }; 3702 } else { 3703 // detect when to display each scrollbar 3704 this.saveElementDimensions(); 3705 this.verticalScrollActive = false; 3706 this.horizontalScrollActive = false; 3707 3708 // fill container with full size 3709 this.realElement.css({ 3710 width: dimensions.width - paddingWidth, 3711 height: dimensions.height - paddingHeight 3712 }); 3713 3714 this.horizontalScrollActive = this.realElement.prop('scrollWidth') > this.containerDimensions.width; 3715 this.verticalScrollActive = this.realElement.prop('scrollHeight') > this.containerDimensions.height; 3716 3717 this.restoreElementDimensions(); 3718 resultDimensions = { 3719 innerWidth: dimensions.width - (this.verticalScrollActive ? fakeBarWidth : 0), 3720 innerHeight: dimensions.height - (this.horizontalScrollActive ? fakeBarHeight : 0) 3721 }; 3722 } 3723 $.extend(resultDimensions, { 3724 width: resultDimensions.innerWidth - paddingWidth, 3725 height: resultDimensions.innerHeight - paddingHeight 3726 }); 3727 return resultDimensions; 3728 }, 3729 rebuildScrollbars: function () { 3730 // resize wrapper according to real element styles 3731 this.containerDimensions = this.getContainerDimensions(); 3732 this.embeddedDimensions = this.getEmbeddedDimensions(this.containerDimensions); 3733 3734 // resize wrapper to desired dimensions 3735 this.scrollWrapper.css({ 3736 width: this.containerDimensions.width, 3737 height: this.containerDimensions.height 3738 }); 3739 3740 // resize element inside wrapper excluding scrollbar size 3741 this.realElement.css({ 3742 overflow: 'hidden', 3743 width: this.embeddedDimensions.width, 3744 height: this.embeddedDimensions.height 3745 }); 3746 3747 // redraw scrollbar offset 3748 this.redrawScrollbars(); 3749 }, 3750 redrawScrollbars: function () { 3751 var viewSize, maxScrollValue; 3752 3753 // redraw vertical scrollbar 3754 if (this.verticalScrollActive) { 3755 viewSize = this.vBarEdge ? this.containerDimensions.height - this.vBarEdge : this.embeddedDimensions.innerHeight; 3756 maxScrollValue = Math.max(this.realElement.prop('offsetHeight'), this.realElement.prop('scrollHeight')) - this.vBarEdge; 3757 3758 this.vBar.show().setMaxValue(maxScrollValue - viewSize).setRatio(viewSize / maxScrollValue).setSize(viewSize); 3759 this.vBar.setValue(this.realElement.scrollTop()); 3760 } else { 3761 this.vBar.hide(); 3762 } 3763 3764 // redraw horizontal scrollbar 3765 if (this.horizontalScrollActive) { 3766 viewSize = this.embeddedDimensions.innerWidth; 3767 maxScrollValue = this.realElement.prop('scrollWidth'); 3768 3769 if (maxScrollValue === viewSize) { 3770 this.horizontalScrollActive = false;
3771 } 3772 this.hBar.show().setMaxValue(maxScrollValue - viewSize).setRatio(viewSize / maxScrollValue).setSize(viewSize); 3773 this.hBar.setValue(this.realElement.scrollLeft()); 3774 } else { 3775 this.hBar.hide(); 3776 } 3777 3778 // set "touch-action" style rule 3779 var touchAction = ''; 3780 if (this.verticalScrollActive && this.horizontalScrollActive) { 3781 touchAction = 'none'; 3782 } else if (this.verticalScrollActive) { 3783 touchAction = 'pan-x'; 3784 } else if (this.horizontalScrollActive) { 3785 touchAction = 'pan-y'; 3786 } 3787 this.realElement.css('touchAction', touchAction); 3788 }, 3789 refresh: function () { 3790 this.rebuildScrollbars(); 3791 }, 3792 destroy: function () { 3793 // remove event listeners 3794 this.win.off('resize orientationchange load', this.onResize); 3795 this.realElement.off({ 3796 'jcf-mousewheel': this.onMouseWheel, 3797 'jcf-pointerdown': this.onTouchBody 3798 }); 3799 this.doc.off({ 3800 'jcf-pointermove': this.onMoveBody, 3801 'jcf-pointerup': this.onReleaseBody 3802 }); 3803 3804 // restore structure 3805 this.saveScrollOffsets(); 3806 this.vBar.destroy(); 3807 this.hBar.destroy(); 3808 this.realElement.insertAfter(this.scrollWrapper).css({ 3809 touchAction: '', 3810 overflow: '', 3811 width: '', 3812 height: '' 3813 }); 3814 this.scrollWrapper.remove(); 3815 this.restoreScrollOffsets(); 3816 } 3817 }); 3818 3819 // custom scrollbar 3820 function ScrollBar(options) { 3821 this.options = $.extend({ 3822 holder: null, 3823 vertical: true, 3824 inactiveClass: 'jcf-inactive', 3825 verticalClass: 'jcf-scrollbar-vertical', 3826 horizontalClass: 'jcf-scrollbar-horizontal', 3827 scrollbarStructure: '<div class="jcf-scrollbar"><div class="jcf-scrollbar-dec"></div><div class="jcf-scrollbar-slider"><div class="jcf-scrollbar-handle"></div></div><div class="jcf-scrollbar-inc"></div></div>', 3828 btnDecSelector: '.jcf-scrollbar-dec', 3829 btnIncSelector: '.jcf-scrollbar-inc', 3830 sliderSelector: '.jcf-scrollbar-slider', 3831 handleSelector: '.jcf-scrollbar-handle', 3832 scrollInterval: 300, 3833 scrollStep: 400 // px/sec 3834 }, options); 3835 this.init(); 3836 } 3837 $.extend(ScrollBar.prototype, { 3838 init: function () { 3839 this.initStructure(); 3840 this.attachEvents(); 3841 }, 3842 initStructure: function () { 3843 // define proporties 3844 this.doc = $(document); 3845 this.isVertical = !!this.options.vertical; 3846 this.sizeProperty = this.isVertical ? 'height' : 'width'; 3847 this.fullSizeProperty = this.isVertical ? 'outerHeight' : 'outerWidth'; 3848 this.invertedSizeProperty = this.isVertical ? 'width' : 'height'; 3849 this.thicknessMeasureMethod = 'outer' + this.invertedSizeProperty.charAt(0).toUpperCase() + this.invertedSizeProperty.substr(1); 3850 this.offsetProperty = this.isVertical ? 'top' : 'left'; 3851 this.offsetEventProperty = this.isVertical ? 'pageY' : 'pageX'; 3852 3853 // initialize variables 3854 this.value = this.options.value || 0; 3855 this.maxValue = this.options.maxValue || 0; 3856 this.currentSliderSize = 0; 3857 this.handleSize = 0; 3858 3859 // find elements 3860 this.holder = $(this.options.holder); 3861 this.scrollbar = $(this.options.scrollbarStructure).appendTo(this.holder); 3862 this.btnDec = this.scrollbar.find(this.options.btnDecSelector); 3863 this.btnInc = this.scrollbar.find(this.options.btnIncSelector); 3864 this.slider = this.scrollbar.find(this.options.sliderSelector); 3865 this.handle = this.slider.find(this.options.handleSelector); 3866 3867 // set initial styles 3868 this.scrollbar.addClass(this.isVertical ? this.options.verticalClass : this.options.horizontalClass).css({ 3869 touchAction: this.isVertical ? 'pan-x' : 'pan-y', 3870 position: 'absolute' 3871 }); 3872 this.slider.css({ 3873 position: 'relative' 3874 }); 3875 this.handle.css({ 3876 touchAction: 'none', 3877 position: 'absolute' 3878 }); 3879 }, 3880 attachEvents: function () { 3881 this.bindHandlers(); 3882 this.handle.on('jcf-pointerdown', this.onHandlePress); 3883 this.slider.add(this.btnDec).add(this.btnInc).on('jcf-pointerdown', this.onButtonPress); 3884 }, 3885 onHandlePress: function (e) { 3886 if (e.pointerType === 'mouse' && e.button > 1) { 3887 return; 3888 } else { 3889 e.preventDefault(); 3890 this.handleDragActive = true; 3891 this.sliderOffset = this.slider.offset()[this.offsetProperty]; 3892 this.innerHandleOffset = e[this.offsetEventProperty] - this.handle.offset()[this.offsetProperty]; 3893 3894 this.doc.on('jcf-pointermove', this.onHandleDrag); 3895 this.doc.on('jcf-pointerup', this.onHandleRelease); 3896 } 3897 }, 3898 onHandleDrag: function (e) { 3899 e.preventDefault(); 3900 this.calcOffset = e[this.offsetEventProperty] - this.sliderOffset - this.innerHandleOffset; 3901 this.setValue(this.calcOffset / (this.currentSliderSize - this.handleSize) * this.maxValue); 3902 this.triggerScrollEvent(this.value); 3903 }, 3904 onHandleRelease: function () { 3905 this.handleDragActive = false;
3906 this.doc.off('jcf-pointermove', this.onHandleDrag); 3907 this.doc.off('jcf-pointerup', this.onHandleRelease); 3908 }, 3909 onButtonPress: function (e) { 3910 var direction, clickOffset; 3911 if (e.pointerType === 'mouse' && e.button > 1) { 3912 return; 3913 } else { 3914 e.preventDefault(); 3915 if (!this.handleDragActive) { 3916 if (this.slider.is(e.currentTarget)) { 3917 // slider pressed 3918 direction = this.handle.offset()[this.offsetProperty] > e[this.offsetEventProperty] ? -1 : 1; 3919 clickOffset = e[this.offsetEventProperty] - this.slider.offset()[this.offsetProperty]; 3920 this.startPageScrolling(direction, clickOffset); 3921 } else { 3922 // scrollbar buttons pressed 3923 direction = this.btnDec.is(e.currentTarget) ? -1 : 1; 3924 this.startSmoothScrolling(direction); 3925 } 3926 this.doc.on('jcf-pointerup', this.onButtonRelease); 3927 } 3928 } 3929 }, 3930 onButtonRelease: function () { 3931 this.stopPageScrolling(); 3932 this.stopSmoothScrolling(); 3933 this.doc.off('jcf-pointerup', this.onButtonRelease); 3934 }, 3935 startPageScrolling: function (direction, clickOffset) { 3936 var self = this, 3937 stepValue = direction * self.currentSize; 3938 3939 // limit checker 3940 var isFinishedScrolling = function () { 3941 var handleTop = (self.value / self.maxValue) * (self.currentSliderSize - self.handleSize); 3942 3943 if (direction > 0) { 3944 return handleTop + self.handleSize >= clickOffset; 3945 } else { 3946 return handleTop <= clickOffset; 3947 } 3948 }; 3949 3950 // scroll by page when track is pressed 3951 var doPageScroll = function () { 3952 self.value += stepValue; 3953 self.setValue(self.value); 3954 self.triggerScrollEvent(self.value); 3955 3956 if (isFinishedScrolling()) { 3957 clearInterval(self.pageScrollTimer); 3958 } 3959 }; 3960 3961 // start scrolling 3962 this.pageScrollTimer = setInterval(doPageScroll, this.options.scrollInterval); 3963 doPageScroll(); 3964 }, 3965 stopPageScrolling: function () { 3966 clearInterval(this.pageScrollTimer); 3967 }, 3968 startSmoothScrolling: function (direction) { 3969 var self = this, dt; 3970 this.stopSmoothScrolling(); 3971 3972 // simple animation functions 3973 var raf = window.requestAnimationFrame || function (func) { 3974 setTimeout(func, 16); 3975 }; 3976 var getTimestamp = function () { 3977 return Date.now ? Date.now() : new Date().getTime(); 3978 }; 3979 3980 // set animation limit 3981 var isFinishedScrolling = function () { 3982 if (direction > 0) { 3983 return self.value >= self.maxValue; 3984 } else { 3985 return self.value <= 0; 3986 } 3987 }; 3988 3989 // animation step 3990 var doScrollAnimation = function () { 3991 var stepValue = (getTimestamp() - dt) / 1000 * self.options.scrollStep; 3992 3993 if (self.smoothScrollActive) { 3994 self.value += stepValue * direction; 3995 self.setValue(self.value); 3996 self.triggerScrollEvent(self.value); 3997 3998 if (!isFinishedScrolling()) { 3999 dt = getTimestamp(); 4000 raf(doScrollAnimation); 4001 } 4002 } 4003 }; 4004 4005 // start animation 4006 self.smoothScrollActive = true; 4007 dt = getTimestamp(); 4008 raf(doScrollAnimation); 4009 }, 4010 stopSmoothScrolling: function () { 4011 this.smoothScrollActive = false; 4012 }, 4013 triggerScrollEvent: function (scrollValue) { 4014 if (this.options.onScroll) { 4015 this.options.onScroll(scrollValue); 4016 } 4017 }, 4018 getThickness: function () { 4019 return this.scrollbar[this.thicknessMeasureMethod](); 4020 }, 4021 setSize: function (size) { 4022 // resize scrollbar 4023 var btnDecSize = this.btnDec[this.fullSizeProperty](), 4024 btnIncSize = this.btnInc[this.fullSizeProperty](); 4025 4026 // resize slider 4027 this.currentSize = size; 4028 this.currentSliderSize = size - btnDecSize - btnIncSize; 4029 this.scrollbar.css(this.sizeProperty, size); 4030 this.slider.css(this.sizeProperty, this.currentSliderSize); 4031 this.currentSliderSize = this.slider[this.sizeProperty](); 4032 4033 // resize handle 4034 this.handleSize = Math.round(this.currentSliderSize * this.ratio); 4035 this.handle.css(this.sizeProperty, this.handleSize); 4036 this.handleSize = this.handle[this.fullSizeProperty](); 4037 4038 return this; 4039 }, 4040 setRatio: function (ratio) { 4041 this.ratio = ratio; 4042 return this; 4043 },
4044 setMaxValue: function (maxValue) { 4045 this.maxValue = maxValue; 4046 this.setValue(Math.min(this.value, this.maxValue)); 4047 return this; 4048 }, 4049 setValue: function (value) { 4050 this.value = value; 4051 if (this.value < 0) { 4052 this.value = 0; 4053 } else if (this.value > this.maxValue) { 4054 this.value = this.maxValue; 4055 } 4056 this.refresh(); 4057 }, 4058 setPosition: function (styles) { 4059 this.scrollbar.css(styles); 4060 return this; 4061 }, 4062 hide: function () { 4063 this.scrollbar.detach(); 4064 return this; 4065 }, 4066 show: function () { 4067 this.scrollbar.appendTo(this.holder); 4068 return this; 4069 }, 4070 refresh: function () { 4071 // recalculate handle position 4072 if (this.value === 0 || this.maxValue === 0) { 4073 this.calcOffset = 0; 4074 } else { 4075 this.calcOffset = (this.value / this.maxValue) * (this.currentSliderSize - this.handleSize); 4076 } 4077 this.handle.css(this.offsetProperty, this.calcOffset); 4078 4079 // toggle inactive classes 4080 this.btnDec.toggleClass(this.options.inactiveClass, this.value === 0); 4081 this.btnInc.toggleClass(this.options.inactiveClass, this.value === this.maxValue); 4082 this.scrollbar.toggleClass(this.options.inactiveClass, this.maxValue === 0); 4083 }, 4084 destroy: function () { 4085 // remove event handlers and scrollbar block itself 4086 this.btnDec.add(this.btnInc).off('jcf-pointerdown', this.onButtonPress); 4087 this.handle.off('jcf-pointerdown', this.onHandlePress); 4088 this.doc.off('jcf-pointermove', this.onHandleDrag); 4089 this.doc.off('jcf-pointerup', this.onHandleRelease); 4090 this.doc.off('jcf-pointerup', this.onButtonRelease); 4091 this.stopSmoothScrolling(); 4092 this.stopPageScrolling(); 4093 this.scrollbar.remove(); 4094 } 4095 }); 4096 4097}(jQuery, this)); 4098 4099 4100/*! 4101 * JavaScript Custom Forms : Select Module 4102 * 4103 * Copyright 2014-2015 PSD2HTML - https://psd2html.com/jcf 4104 * Released under the MIT license (LICENSE.txt) 4105 * 4106 * Version: 1.1.2 4107 */ 4108 4109; (function ($, window) { 4110 'use strict'; 4111 4112 jcf.addModule({ 4113 name: 'Select', 4114 selector: 'select', 4115 options: { 4116 element: null, 4117 multipleCompactStyle: false 4118 }, 4119 plugins: { 4120 ListBox: ListBox, 4121 ComboBox: ComboBox, 4122 SelectList: SelectList 4123 }, 4124 matchElement: function (element) { 4125 return element.is('select'); 4126 }, 4127 init: function () { 4128 this.element = $(this.options.element); 4129 this.createInstance(); 4130 }, 4131 isListBox: function () { 4132 return this.element.is('[size]:not([jcf-size]), [multiple]'); 4133 }, 4134 createInstance: function () { 4135 if (this.instance) { 4136 this.instance.destroy(); 4137 } 4138 if (this.isListBox() && !this.options.multipleCompactStyle) { 4139 this.instance = new ListBox(this.options); 4140 } else { 4141 this.instance = new ComboBox(this.options); 4142 } 4143 }, 4144 refresh: function () { 4145 var typeMismatch = (this.isListBox() && this.instance instanceof ComboBox) || 4146 (!this.isListBox() && this.instance instanceof ListBox); 4147 4148 if (typeMismatch) { 4149 this.createInstance(); 4150 } else { 4151 this.instance.refresh(); 4152 } 4153 }, 4154 destroy: function () { 4155 this.instance.destroy(); 4156 } 4157 }); 4158 4159 // combobox module 4160 function ComboBox(options) { 4161 this.options = $.extend({ 4162 wrapNative: true, 4163 wrapNativeOnMobile: true, 4164 fakeDropInBody: true, 4165 useCustomScroll: true, 4166 flipDropToFit: true, 4167 maxVisibleItems: 10, 4168 fakeAreaStructure: '<span class="jcf-select"><span class="jcf-select-text"></span><span class="jcf-select-opener"></span></span>', 4169 fakeDropStructure: '<div class="jcf-select-drop"><div class="jcf-select-drop-content"></div></div>', 4170 optionClassPrefix: 'jcf-option-', 4171 selectClassPrefix: 'jcf-select-', 4172 dropContentSelector: '.jcf-select-drop-content', 4173 selectTextSelector: '.jcf-select-text', 4174 dropActiveClass: 'jcf-drop-active', 4175 flipDropClass: 'jcf-drop-flipped' 4176 }, options); 4177 this.init(); 4178 } 4179 $.extend(ComboBox.prototype, { 4180 init: function () { 4181 this.initStructure(); 4182 this.bindHandlers(); 4183 this.attachEvents(); 4184 this.refresh(); 4185 }, 4186 initStructure: function () { 4187 // prepare structure 4188 this.win = $(window); 4189 this.doc = $(document); 4190 this.realElement = $(this.options.element); 4191 this.fakeElement = $(this.options.fakeAreaStructure).insertAfter(this.realElement); 4192 this.selectTextContainer = this.fakeElement.find(this.options.selectTextSelector); 4193 this.selectText = $('<span></span>').appendTo(this.selectTextContainer); 4194 makeUnselectable(this.fakeElement); 4195 4196 // copy classes from original select
4197 this.fakeElement.addClass(getPrefixedClasses(this.realElement.prop('className'), this.options.selectClassPrefix)); 4198 4199 // handle compact multiple style 4200 if (this.realElement.prop('multiple')) { 4201 this.fakeElement.addClass('jcf-compact-multiple'); 4202 } 4203 4204 // detect device type and dropdown behavior 4205 if (this.options.isMobileDevice && this.options.wrapNativeOnMobile && !this.options.wrapNative) { 4206 this.options.wrapNative = true; 4207 } 4208 4209 if (this.options.wrapNative) { 4210 // wrap native select inside fake block 4211 this.realElement.prependTo(this.fakeElement).css({ 4212 position: 'absolute', 4213 height: '100%', 4214 width: '100%' 4215 }).addClass(this.options.resetAppearanceClass); 4216 } else { 4217 // just hide native select 4218 this.realElement.addClass(this.options.hiddenClass); 4219 this.fakeElement.attr('title', this.realElement.attr('title')); 4220 this.fakeDropTarget = this.options.fakeDropInBody ? $('body') : this.fakeElement; 4221 } 4222 }, 4223 attachEvents: function () { 4224 // delayed refresh handler 4225 var self = this; 4226 this.delayedRefresh = function () { 4227 setTimeout(function () { 4228 self.refresh(); 4229 if (self.list) { 4230 self.list.refresh(); 4231 } 4232 }, 1); 4233 }; 4234 4235 // native dropdown event handlers 4236 if (this.options.wrapNative) { 4237 this.realElement.on({ 4238 focus: this.onFocus, 4239 change: this.onChange, 4240 click: this.onChange, 4241 keydown: this.onChange 4242 }); 4243 } else { 4244 // custom dropdown event handlers 4245 this.realElement.on({ 4246 focus: this.onFocus, 4247 change: this.onChange, 4248 keydown: this.onKeyDown 4249 }); 4250 this.fakeElement.on({ 4251 'jcf-pointerdown': this.onSelectAreaPress 4252 }); 4253 } 4254 }, 4255 onKeyDown: function (e) { 4256 if (e.which === 13) { 4257 this.toggleDropdown(); 4258 } else if (this.dropActive) { 4259 this.delayedRefresh(); 4260 } 4261 }, 4262 onChange: function () { 4263 this.refresh(); 4264 }, 4265 onFocus: function () { 4266 if (!this.pressedFlag || !this.focusedFlag) { 4267 this.fakeElement.addClass(this.options.focusClass); 4268 this.realElement.on('blur', this.onBlur); 4269 this.toggleListMode(true); 4270 this.focusedFlag = true; 4271 } 4272 }, 4273 onBlur: function () { 4274 if (!this.pressedFlag) { 4275 this.fakeElement.removeClass(this.options.focusClass); 4276 this.realElement.off('blur', this.onBlur); 4277 this.toggleListMode(false); 4278 this.focusedFlag = false; 4279 } 4280 }, 4281 onResize: function () { 4282 if (this.dropActive) { 4283 this.hideDropdown(); 4284 } 4285 }, 4286 onSelectDropPress: function () { 4287 this.pressedFlag = true; 4288 }, 4289 onSelectDropRelease: function (e, pointerEvent) { 4290 this.pressedFlag = false; 4291 if (pointerEvent.pointerType === 'mouse') { 4292 this.realElement.focus(); 4293 } 4294 }, 4295 onSelectAreaPress: function (e) { 4296 // skip click if drop inside fake element or real select is disabled 4297 var dropClickedInsideFakeElement = !this.options.fakeDropInBody && $(e.target).closest(this.dropdown).length; 4298 if (dropClickedInsideFakeElement || e.button > 1 || this.realElement.is(':disabled')) { 4299 return; 4300 } 4301 4302 // toggle dropdown visibility 4303 this.selectOpenedByEvent = e.pointerType; 4304 this.toggleDropdown(); 4305 4306 // misc handlers 4307 if (!this.focusedFlag) { 4308 if (e.pointerType === 'mouse') { 4309 this.realElement.focus(); 4310 } else { 4311 this.onFocus(e); 4312 } 4313 } 4314 this.pressedFlag = true; 4315 this.fakeElement.addClass(this.options.pressedClass); 4316 this.doc.on('jcf-pointerup', this.onSelectAreaRelease); 4317 }, 4318 onSelectAreaRelease: function (e) { 4319 if (this.focusedFlag && e.pointerType === 'mouse') { 4320 this.realElement.focus(); 4321 } 4322 this.pressedFlag = false;
4323 this.fakeElement.removeClass(this.options.pressedClass); 4324 this.doc.off('jcf-pointerup', this.onSelectAreaRelease); 4325 }, 4326 onOutsideClick: function (e) { 4327 var target = $(e.target), 4328 clickedInsideSelect = target.closest(this.fakeElement).length || target.closest(this.dropdown).length; 4329 4330 if (!clickedInsideSelect) { 4331 this.hideDropdown(); 4332 } 4333 }, 4334 onSelect: function () { 4335 this.refresh(); 4336 4337 if (this.realElement.prop('multiple')) { 4338 this.repositionDropdown(); 4339 } else { 4340 this.hideDropdown(); 4341 } 4342 4343 this.fireNativeEvent(this.realElement, 'change'); 4344 }, 4345 toggleListMode: function (state) { 4346 if (!this.options.wrapNative) { 4347 if (state) { 4348 // temporary change select to list to avoid appearing of native dropdown 4349 this.realElement.attr({ 4350 size: 4, 4351 'jcf-size': '' 4352 }); 4353 } else { 4354 // restore select from list mode to dropdown select 4355 if (!this.options.wrapNative) { 4356 this.realElement.removeAttr('size jcf-size'); 4357 } 4358 } 4359 } 4360 }, 4361 createDropdown: function () { 4362 // destroy previous dropdown if needed 4363 if (this.dropdown) { 4364 this.list.destroy(); 4365 this.dropdown.remove(); 4366 } 4367 4368 // create new drop container 4369 this.dropdown = $(this.options.fakeDropStructure).appendTo(this.fakeDropTarget); 4370 this.dropdown.addClass(getPrefixedClasses(this.realElement.prop('className'), this.options.selectClassPrefix)); 4371 makeUnselectable(this.dropdown); 4372 4373 // handle compact multiple style 4374 if (this.realElement.prop('multiple')) { 4375 this.dropdown.addClass('jcf-compact-multiple'); 4376 } 4377 4378 // set initial styles for dropdown in body 4379 if (this.options.fakeDropInBody) { 4380 this.dropdown.css({ 4381 position: 'absolute', 4382 top: -9999 4383 }); 4384 } 4385 4386 // create new select list instance 4387 this.list = new SelectList({ 4388 useHoverClass: true, 4389 handleResize: false, 4390 alwaysPreventMouseWheel: true, 4391 maxVisibleItems: this.options.maxVisibleItems, 4392 useCustomScroll: this.options.useCustomScroll, 4393 holder: this.dropdown.find(this.options.dropContentSelector), 4394 multipleSelectWithoutKey: this.realElement.prop('multiple'), 4395 element: this.realElement 4396 }); 4397 $(this.list).on({ 4398 select: this.onSelect, 4399 press: this.onSelectDropPress, 4400 release: this.onSelectDropRelease 4401 }); 4402 }, 4403 repositionDropdown: function () { 4404 var selectOffset = this.fakeElement.offset(), 4405 selectWidth = this.fakeElement.outerWidth(), 4406 selectHeight = this.fakeElement.outerHeight(), 4407 dropHeight = this.dropdown.css('width', selectWidth).outerHeight(), 4408 winScrollTop = this.win.scrollTop(), 4409 winHeight = this.win.height(), 4410 calcTop, calcLeft, bodyOffset, needFlipDrop = false; 4411 4412 // check flip drop position 4413 if (selectOffset.top + selectHeight + dropHeight > winScrollTop + winHeight && selectOffset.top - dropHeight > winScrollTop) { 4414 needFlipDrop = true; 4415 } 4416 4417 if (this.options.fakeDropInBody) { 4418 bodyOffset = this.fakeDropTarget.css('position') !== 'static' ? this.fakeDropTarget.offset().top : 0; 4419 if (this.options.flipDropToFit && needFlipDrop) { 4420 // calculate flipped dropdown position 4421 calcLeft = selectOffset.left; 4422 4423 calcTop = selectOffset.top - dropHeight - bodyOffset; 4424 } else { 4425 // calculate default drop position 4426 calcLeft = selectOffset.left; 4427 calcTop = selectOffset.top + selectHeight - bodyOffset; 4428 } 4429 4430 // update drop styles 4431 this.dropdown.css({ 4432 width: selectWidth, 4433 left: calcLeft, 4434 top: calcTop 4435 }); 4436 } 4437 4438 // refresh flipped class 4439 this.dropdown.add(this.fakeElement).toggleClass(this.options.flipDropClass, this.options.flipDropToFit && needFlipDrop); 4440 }, 4441 showDropdown: function () { 4442 // do not show empty custom dropdown 4443 if (!this.realElement.prop('options').length) { 4444 return; 4445 } 4446 4447 // create options list if not created 4448 if (!this.dropdown) { 4449 this.createDropdown(); 4450 } 4451 4452 // show dropdown 4453 this.dropActive = true; 4454 this.dropdown.appendTo(this.fakeDropTarget); 4455 this.fakeElement.addClass(this.options.dropActiveClass); 4456 this.refreshSelectedText(); 4457 this.repositionDropdown(); 4458 this.list.setScrollTop(this.savedScrollTop); 4459 this.list.refresh(); 4460 4461 // add temporary event handlers 4462 this.win.on('resize', this.onResize); 4463 this.doc.on('jcf-pointerdown', this.onOutsideClick); 4464 }, 4465 hideDropdown: function () { 4466 if (this.dropdown) { 4467 this.savedScrollTop = this.list.getScrollTop(); 4468 this.fakeElement.removeClass(this.options.dropActiveClass + ' ' + this.options.flipDropClass); 4469 this.dropdown.removeClass(this.options.flipDropClass).detach(); 4470 this.doc.off('jcf-pointerdown', this.onOutsideClick); 4471 this.win.off('resize', this.onResize); 4472 this.dropActive = false;
4473 if (this.selectOpenedByEvent === 'touch') { 4474 this.onBlur(); 4475 } 4476 } 4477 }, 4478 toggleDropdown: function () { 4479 if (this.dropActive) { 4480 this.hideDropdown(); 4481 } else { 4482 this.showDropdown(); 4483 } 4484 }, 4485 refreshSelectedText: function () { 4486 // redraw selected area 4487 var selectedIndex = this.realElement.prop('selectedIndex'), 4488 selectedOption = this.realElement.prop('options')[selectedIndex], 4489 selectedOptionImage = selectedOption ? selectedOption.getAttribute('data-image') : null, 4490 selectedOptionText = '', 4491 selectedOptionClasses; 4492 4493 if (this.realElement.prop('multiple')) { 4494 $.each(this.realElement.prop('options'), function (index, option) { 4495 if (option.selected) { 4496 selectedOptionText += (selectedOptionText ? ', ' : '') + option.innerHTML; 4497 } 4498 }); 4499 this.selectText.removeAttr('class').html(selectedOptionText); 4500 } else if (!selectedOption) { 4501 if (this.selectImage) { 4502 this.selectImage.hide(); 4503 } 4504 this.selectText.removeAttr('class').empty(); 4505 } else if (this.currentSelectedText !== selectedOption.innerHTML || this.currentSelectedImage !== selectedOptionImage) { 4506 selectedOptionClasses = getPrefixedClasses(selectedOption.className, this.options.optionClassPrefix); 4507 this.selectText.attr('class', selectedOptionClasses).html(selectedOption.innerHTML); 4508 4509 if (selectedOptionImage) { 4510 if (!this.selectImage) { 4511 this.selectImage = $('<img>').prependTo(this.selectTextContainer).hide(); 4512 } 4513 this.selectImage.attr('src', selectedOptionImage).show(); 4514 } else if (this.selectImage) { 4515 this.selectImage.hide(); 4516 } 4517 4518 this.currentSelectedText = selectedOption.innerHTML; 4519 this.currentSelectedImage = selectedOptionImage; 4520 } 4521 }, 4522 refresh: function () { 4523 // refresh fake select visibility 4524 if (this.realElement.prop('style').display === 'none') { 4525 this.fakeElement.hide(); 4526 } else { 4527 this.fakeElement.show(); 4528 } 4529 4530 // refresh selected text 4531 this.refreshSelectedText(); 4532 4533 // handle disabled state 4534 this.fakeElement.toggleClass(this.options.disabledClass, this.realElement.is(':disabled')); 4535 }, 4536 destroy: function () { 4537 // restore structure 4538 if (this.options.wrapNative) { 4539 this.realElement.insertBefore(this.fakeElement).css({ 4540 position: '', 4541 height: '', 4542 width: '' 4543 }).removeClass(this.options.resetAppearanceClass); 4544 } else { 4545 this.realElement.removeClass(this.options.hiddenClass); 4546 if (this.realElement.is('[jcf-size]')) { 4547 this.realElement.removeAttr('size jcf-size'); 4548 } 4549 } 4550 4551 // removing element will also remove its event handlers 4552 this.fakeElement.remove(); 4553 4554 // remove other event handlers 4555 this.doc.off('jcf-pointerup', this.onSelectAreaRelease); 4556 this.realElement.off({ 4557 focus: this.onFocus 4558 }); 4559 } 4560 }); 4561 4562 // listbox module 4563 function ListBox(options) { 4564 this.options = $.extend({ 4565 wrapNative: true, 4566 useCustomScroll: true, 4567 fakeStructure: '<span class="jcf-list-box"><span class="jcf-list-wrapper"></span></span>', 4568 selectClassPrefix: 'jcf-select-', 4569 listHolder: '.jcf-list-wrapper' 4570 }, options); 4571 this.init(); 4572 } 4573 $.extend(ListBox.prototype, { 4574 init: function () { 4575 this.bindHandlers(); 4576 this.initStructure(); 4577 this.attachEvents(); 4578 }, 4579 initStructure: function () { 4580 this.realElement = $(this.options.element); 4581 this.fakeElement = $(this.options.fakeStructure).insertAfter(this.realElement); 4582 this.listHolder = this.fakeElement.find(this.options.listHolder); 4583 makeUnselectable(this.fakeElement); 4584 4585 // copy classes from original select
4586 this.fakeElement.addClass(getPrefixedClasses(this.realElement.prop('className'), this.options.selectClassPrefix)); 4587 this.realElement.addClass(this.options.hiddenClass); 4588 4589 this.list = new SelectList({ 4590 useCustomScroll: this.options.useCustomScroll, 4591 holder: this.listHolder, 4592 selectOnClick: false, 4593 element: this.realElement 4594 }); 4595 }, 4596 attachEvents: function () { 4597 // delayed refresh handler 4598 var self = this; 4599 this.delayedRefresh = function (e) { 4600 if (e && e.which === 16) { 4601 // ignore SHIFT key 4602 return; 4603 } else { 4604 clearTimeout(self.refreshTimer); 4605 self.refreshTimer = setTimeout(function () { 4606 self.refresh(); 4607 }, 1); 4608 } 4609 }; 4610 4611 // other event handlers 4612 this.realElement.on({ 4613 focus: this.onFocus, 4614 click: this.delayedRefresh, 4615 keydown: this.delayedRefresh 4616 }); 4617 4618 // select list event handlers 4619 $(this.list).on({ 4620 select: this.onSelect, 4621 press: this.onFakeOptionsPress, 4622 release: this.onFakeOptionsRelease 4623 }); 4624 }, 4625 onFakeOptionsPress: function (e, pointerEvent) { 4626 this.pressedFlag = true; 4627 if (pointerEvent.pointerType === 'mouse') { 4628 this.realElement.focus(); 4629 } 4630 }, 4631 onFakeOptionsRelease: function (e, pointerEvent) { 4632 this.pressedFlag = false; 4633 if (pointerEvent.pointerType === 'mouse') { 4634 this.realElement.focus(); 4635 } 4636 }, 4637 onSelect: function () { 4638 this.fireNativeEvent(this.realElement, 'change'); 4639 this.fireNativeEvent(this.realElement, 'click'); 4640 }, 4641 onFocus: function () { 4642 if (!this.pressedFlag || !this.focusedFlag) { 4643 this.fakeElement.addClass(this.options.focusClass); 4644 this.realElement.on('blur', this.onBlur); 4645 this.focusedFlag = true; 4646 } 4647 }, 4648 onBlur: function () { 4649 if (!this.pressedFlag) { 4650 this.fakeElement.removeClass(this.options.focusClass); 4651 this.realElement.off('blur', this.onBlur); 4652 this.focusedFlag = false; 4653 } 4654 }, 4655 refresh: function () { 4656 this.fakeElement.toggleClass(this.options.disabledClass, this.realElement.is(':disabled')); 4657 this.list.refresh(); 4658 }, 4659 destroy: function () { 4660 this.list.destroy(); 4661 this.realElement.insertBefore(this.fakeElement).removeClass(this.options.hiddenClass); 4662 this.fakeElement.remove(); 4663 } 4664 }); 4665 4666 // options list module 4667 function SelectList(options) { 4668 this.options = $.extend({ 4669 holder: null, 4670 maxVisibleItems: 10, 4671 selectOnClick: true, 4672 useHoverClass: false, 4673 useCustomScroll: false, 4674 handleResize: true, 4675 multipleSelectWithoutKey: false, 4676 alwaysPreventMouseWheel: false, 4677 indexAttribute: 'data-index', 4678 cloneClassPrefix: 'jcf-option-', 4679 containerStructure: '<span class="jcf-list"><span class="jcf-list-content"></span></span>', 4680 containerSelector: '.jcf-list-content', 4681 captionClass: 'jcf-optgroup-caption', 4682 disabledClass: 'jcf-disabled', 4683 optionClass: 'jcf-option', 4684 groupClass: 'jcf-optgroup', 4685 hoverClass: 'jcf-hover', 4686 selectedClass: 'jcf-selected', 4687 scrollClass: 'jcf-scroll-active' 4688 }, options); 4689 this.init(); 4690 } 4691 $.extend(SelectList.prototype, { 4692 init: function () { 4693 this.initStructure(); 4694 this.refreshSelectedClass(); 4695 this.attachEvents(); 4696 }, 4697 initStructure: function () { 4698 this.element = $(this.options.element); 4699 this.indexSelector = '[' + this.options.indexAttribute + ']'; 4700 this.container = $(this.options.containerStructure).appendTo(this.options.holder); 4701 this.listHolder = this.container.find(this.options.containerSelector); 4702 this.lastClickedIndex = this.element.prop('selectedIndex'); 4703 this.rebuildList(); 4704 }, 4705 attachEvents: function () { 4706 this.bindHandlers(); 4707 this.listHolder.on('jcf-pointerdown', this.indexSelector, this.onItemPress); 4708 this.listHolder.on('jcf-pointerdown', this.onPress); 4709 4710 if (this.options.useHoverClass) { 4711 this.listHolder.on('jcf-pointerover', this.indexSelector, this.onHoverItem); 4712 } 4713 }, 4714 onPress: function (e) { 4715 $(this).trigger('press', e); 4716 this.listHolder.on('jcf-pointerup', this.onRelease); 4717 }, 4718 onRelease: function (e) { 4719 $(this).trigger('release', e); 4720 this.listHolder.off('jcf-pointerup', this.onRelease); 4721 }, 4722 onHoverItem: function (e) { 4723 var hoverIndex = parseFloat(e.currentTarget.getAttribute(this.options.indexAttribute)); 4724 this.fakeOptions.removeClass(this.options.hoverClass).eq(hoverIndex).addClass(this.options.hoverClass); 4725 }, 4726 onItemPress: function (e) { 4727 if (e.pointerType === 'touch' || this.options.selectOnClick) { 4728 // select option after "click" 4729 this.tmpListOffsetTop = this.list.offset().top; 4730 this.listHolder.on('jcf-pointerup', this.indexSelector, this.onItemRelease); 4731 } else { 4732 // select option immediately 4733 this.onSelectItem(e); 4734 } 4735 }, 4736 onItemRelease: function (e) { 4737 // remove event handlers and temporary data 4738 this.listHolder.off('jcf-pointerup', this.indexSelector, this.onItemRelease); 4739 4740 // simulate item selection 4741 if (this.tmpListOffsetTop === this.list.offset().top) { 4742 this.listHolder.on('click', this.indexSelector, { savedPointerType: e.pointerType }, this.onSelectItem); 4743 } 4744 delete this.tmpListOffsetTop; 4745 }, 4746 onSelectItem: function (e) { 4747 var clickedIndex = parseFloat(e.currentTarget.getAttribute(this.options.indexAttribute)), 4748 pointerType = e.data && e.data.savedPointerType || e.pointerType || 'mouse', 4749 range; 4750 4751 // remove click event handler 4752 this.listHolder.off('click', this.indexSelector, this.onSelectItem); 4753 4754 // ignore clicks on disabled options 4755 if (e.button > 1 || this.realOptions[clickedIndex].disabled) { 4756 return; 4757 } 4758 4759 if (this.element.prop('multiple')) { 4760 if (e.metaKey || e.ctrlKey || pointerType === 'touch' || this.options.multipleSelectWithoutKey) { 4761 // if CTRL/CMD pressed or touch devices - toggle selected option 4762 this.realOptions[clickedIndex].selected = !this.realOptions[clickedIndex].selected; 4763 } else if (e.shiftKey) { 4764 // if SHIFT pressed - update selection 4765 range = [this.lastClickedIndex, clickedIndex].sort(function (a, b) { 4766 return a - b; 4767 }); 4768 this.realOptions.each(function (index, option) { 4769 option.selected = (index >= range[0] && index <= range[1]); 4770 }); 4771 } else { 4772 // set single selected index 4773 this.element.prop('selectedIndex', clickedIndex); 4774 } 4775 } else { 4776 this.element.prop('selectedIndex', clickedIndex); 4777 } 4778 4779 // save last clicked option 4780 if (!e.shiftKey) { 4781 this.lastClickedIndex = clickedIndex; 4782 } 4783 4784 // refresh classes 4785 this.refreshSelectedClass(); 4786 4787 // scroll to active item in desktop browsers 4788 if (pointerType === 'mouse') { 4789 this.scrollToActiveOption(); 4790 } 4791 4792 // make callback when item selected 4793 $(this).trigger('select'); 4794 }, 4795 rebuildList: function () { 4796 // rebuild options 4797 var self = this, 4798 rootElement = this.element[0]; 4799 4800 // recursively create fake options 4801 this.storedSelectHTML = rootElement.innerHTML; 4802 this.optionIndex = 0; 4803 this.list = $(this.createOptionsList(rootElement)); 4804 this.listHolder.empty().append(this.list); 4805 this.realOptions = this.element.find('option'); 4806 this.fakeOptions = this.list.find(this.indexSelector); 4807 this.fakeListItems = this.list.find('.' + this.options.captionClass + ',' + this.indexSelector); 4808 delete this.optionIndex; 4809 4810 // detect max visible items 4811 var maxCount = this.options.maxVisibleItems, 4812 sizeValue = this.element.prop('size'); 4813 if (sizeValue > 1 && !this.element.is('[jcf-size]')) { 4814 maxCount = sizeValue; 4815 } 4816 4817 // handle scrollbar 4818 var needScrollBar = this.fakeOptions.length > maxCount; 4819 this.container.toggleClass(this.options.scrollClass, needScrollBar); 4820 if (needScrollBar) { 4821 // change max-height 4822 this.listHolder.css({ 4823 maxHeight: this.getOverflowHeight(maxCount), 4824 overflow: 'auto' 4825 }); 4826 4827 if (this.options.useCustomScroll && jcf.modules.Scrollable) { 4828 // add custom scrollbar if specified in options 4829 jcf.replace(this.listHolder, 'Scrollable', { 4830 handleResize: this.options.handleResize, 4831 alwaysPreventMouseWheel: this.options.alwaysPreventMouseWheel 4832 }); 4833 return; 4834 } 4835 } 4836 4837 // disable edge wheel scrolling 4838 if (this.options.alwaysPreventMouseWheel) { 4839 this.preventWheelHandler = function (e) { 4840 var currentScrollTop = self.listHolder.scrollTop(), 4841 maxScrollTop = self.listHolder.prop('scrollHeight') - self.listHolder.innerHe
4841ight(); 4842 4843 // check edge cases 4844 if ((currentScrollTop <= 0 && e.deltaY < 0) || (currentScrollTop >= maxScrollTop && e.deltaY > 0)) { 4845 e.preventDefault(); 4846 } 4847 }; 4848 this.listHolder.on('jcf-mousewheel', this.preventWheelHandler); 4849 } 4850 }, 4851 refreshSelectedClass: function () { 4852 var self = this, 4853 selectedItem, 4854 isMultiple = this.element.prop('multiple'), 4855 selectedIndex = this.element.prop('selectedIndex'); 4856 4857 if (isMultiple) { 4858 this.realOptions.each(function (index, option) { 4859 self.fakeOptions.eq(index).toggleClass(self.options.selectedClass, !!option.selected); 4860 }); 4861 } else { 4862 this.fakeOptions.removeClass(this.options.selectedClass + ' ' + this.options.hoverClass); 4863 selectedItem = this.fakeOptions.eq(selectedIndex).addClass(this.options.selectedClass); 4864 if (this.options.useHoverClass) { 4865 selectedItem.addClass(this.options.hoverClass); 4866 } 4867 } 4868 }, 4869 scrollToActiveOption: function () { 4870 // scroll to target option 4871 var targetOffset = this.getActiveOptionOffset(); 4872 this.listHolder.prop('scrollTop', targetOffset); 4873 }, 4874 getSelectedIndexRange: function () { 4875 var firstSelected = -1, lastSelected = -1; 4876 this.realOptions.each(function (index, option) { 4877 if (option.selected) { 4878 if (firstSelected < 0) { 4879 firstSelected = index; 4880 } 4881 lastSelected = index; 4882 } 4883 }); 4884 return [firstSelected, lastSelected]; 4885 }, 4886 getChangedSelectedIndex: function () { 4887 var selectedIndex = this.element.prop('selectedIndex'), 4888 targetIndex; 4889 4890 if (this.element.prop('multiple')) { 4891 // multiple selects handling 4892 if (!this.previousRange) { 4893 this.previousRange = [selectedIndex, selectedIndex]; 4894 } 4895 this.currentRange = this.getSelectedIndexRange(); 4896 targetIndex = this.currentRange[this.currentRange[0] !== this.previousRange[0] ? 0 : 1]; 4897 this.previousRange = this.currentRange; 4898 return targetIndex; 4899 } else { 4900 // single choice selects handling 4901 return selectedIndex; 4902 } 4903 }, 4904 getActiveOptionOffset: function () { 4905 // calc values 4906 var dropHeight = this.listHolder.height(), 4907 dropScrollTop = this.listHolder.prop('scrollTop'), 4908 currentIndex = this.getChangedSelectedIndex(), 4909 fakeOption = this.fakeOptions.eq(currentIndex), 4910 fakeOptionOffset = fakeOption.offset().top - this.list.offset().top, 4911 fakeOptionHeight = fakeOption.innerHeight(); 4912 4913 // scroll list 4914 if (fakeOptionOffset + fakeOptionHeight >= dropScrollTop + dropHeight) { 4915 // scroll down (always scroll to option) 4916 return fakeOptionOffset - dropHeight + fakeOptionHeight; 4917 } else if (fakeOptionOffset < dropScrollTop) { 4918 // scroll up to option 4919 return fakeOptionOffset; 4920 } 4921 }, 4922 getOverflowHeight: function (sizeValue) { 4923 var item = this.fakeListItems.eq(sizeValue - 1), 4924 listOffset = this.list.offset().top, 4925 itemOffset = item.offset().top, 4926 itemHeight = item.innerHeight(); 4927 4928 return itemOffset + itemHeight - listOffset; 4929 }, 4930 getScrollTop: function () { 4931 return this.listHolder.scrollTop(); 4932 }, 4933 setScrollTop: function (value) { 4934 this.listHolder.scrollTop(value); 4935 }, 4936 createOption: function (option) { 4937 var newOption = document.createElement('span'); 4938 newOption.className = this.options.optionClass; 4939 newOption.innerHTML = option.innerHTML; 4940 newOption.setAttribute(this.options.indexAttribute, this.optionIndex++); 4941 4942 var optionImage, optionImageSrc = option.getAttribute('data-image'); 4943 if (optionImageSrc) { 4944 optionImage = document.createElement('img'); 4945 optionImage.src = optionImageSrc; 4946 newOption.insertBefore(optionImage, newOption.childNodes[0]); 4947 } 4948 if (option.disabled) { 4949 newOption.className += ' ' + this.options.disabledClass; 4950 } 4951 if (option.className) {
4952 newOption.className += ' ' + getPrefixedClasses(option.className, this.options.cloneClassPrefix); 4953 } 4954 return newOption; 4955 }, 4956 createOptGroup: function (optgroup) { 4957 var optGroupContainer = document.createElement('span'), 4958 optGroupName = optgroup.getAttribute('label'), 4959 optGroupCaption, optGroupList; 4960 4961 // create caption 4962 optGroupCaption = document.createElement('span'); 4963 optGroupCaption.className = this.options.captionClass; 4964 optGroupCaption.innerHTML = optGroupName; 4965 optGroupContainer.appendChild(optGroupCaption); 4966 4967 // create list of options 4968 if (optgroup.children.length) { 4969 optGroupList = this.createOptionsList(optgroup); 4970 optGroupContainer.appendChild(optGroupList); 4971 } 4972 4973 optGroupContainer.className = this.options.groupClass; 4974 return optGroupContainer; 4975 }, 4976 createOptionContainer: function () { 4977 var optionContainer = document.createElement('li'); 4978 return optionContainer; 4979 }, 4980 createOptionsList: function (container) { 4981 var self = this, 4982 list = document.createElement('ul'); 4983 4984 $.each(container.children, function (index, currentNode) { 4985 var item = self.createOptionContainer(currentNode), 4986 newNode; 4987 4988 switch (currentNode.tagName.toLowerCase()) { 4989 case 'option': newNode = self.createOption(currentNode); break; 4990 case 'optgroup': newNode = self.createOptGroup(currentNode); break; 4991 } 4992 list.appendChild(item).appendChild(newNode); 4993 }); 4994 return list; 4995 }, 4996 refresh: function () { 4997 // check for select innerHTML changes 4998 if (this.storedSelectHTML !== this.element.prop('innerHTML')) { 4999 this.rebuildList(); 5000 } 5001 5002 // refresh custom scrollbar 5003 var scrollInstance = jcf.getInstance(this.listHolder); 5004 if (scrollInstance) { 5005 scrollInstance.refresh(); 5006 } 5007 5008 // refresh selectes classes 5009 this.refreshSelectedClass(); 5010 }, 5011 destroy: function () { 5012 this.listHolder.off('jcf-mousewheel', this.preventWheelHandler); 5013 this.listHolder.off('jcf-pointerdown', this.indexSelector, this.onSelectItem); 5014 this.listHolder.off('jcf-pointerover', this.indexSelector, this.onHoverItem); 5015 this.listHolder.off('jcf-pointerdown', this.onPress); 5016 } 5017 }); 5018 5019 // helper functions 5020 var getPrefixedClasses = function (className, prefixToAdd) { 5021 return className ? className.replace(/[\s]*([\S]+)+[\s]*/gi, prefixToAdd + '$1 ') : ''; 5022 }; 5023 var makeUnselectable = (function () { 5024 var unselectableClass = jcf.getOptions().unselectableClass; 5025 function preventHandler(e) { 5026 e.preventDefault(); 5027 } 5028 return function (node) { 5029 node.addClass(unselectableClass).on('selectstart', preventHandler); 5030 }; 5031 }()); 5032 5033}(jQuery, this)); 5034 5035/*! 5036 * JavaScript Custom Forms : Radio Module 5037 * 5038 * Copyright 2014-2015 PSD2HTML - https://psd2html.com/jcf 5039 * Released under the MIT license (LICENSE.txt) 5040 * 5041 * Version: 1.1.2 5042 */ 5043; (function ($) { 5044 'use strict'; 5045 5046 jcf.addModule({ 5047 name: 'Radio', 5048 selector: 'input[type="radio"]', 5049 options: { 5050 wrapNative: true, 5051 checkedClass: 'jcf-checked', 5052 uncheckedClass: 'jcf-unchecked', 5053 labelActiveClass: 'jcf-label-active', 5054 fakeStructure: '<span class="jcf-radio"><span></span></span>' 5055 }, 5056 matchElement: function (element) { 5057 return element.is(':radio'); 5058 }, 5059 init: function () { 5060 this.initStructure(); 5061 this.attachEvents(); 5062 this.refresh(); 5063 }, 5064 initStructure: function () { 5065 // prepare structure 5066 this.doc = $(document); 5067 this.realElement = $(this.options.element); 5068 this.fakeElement = $(this.options.fakeStructure).insertAfter(this.realElement); 5069 this.labelElement = this.getLabelFor(); 5070 5071 if (this.options.wrapNative) { 5072 // wrap native radio inside fake block
5073 this.realElement.prependTo(this.fakeElement).css({ 5074 position: 'absolute', 5075 opacity: 0 5076 }); 5077 } else { 5078 // just hide native radio 5079 this.realElement.addClass(this.options.hiddenClass); 5080 } 5081 }, 5082 attachEvents: function () { 5083 // add event handlers 5084 this.realElement.on({ 5085 focus: this.onFocus, 5086 click: this.onRealClick 5087 }); 5088 this.fakeElement.on('click', this.onFakeClick); 5089 this.fakeElement.on('jcf-pointerdown', this.onPress); 5090 }, 5091 onRealClick: function (e) { 5092 // redraw current radio and its group (setTimeout handles click that might be prevented) 5093 var self = this; 5094 this.savedEventObject = e; 5095 setTimeout(function () { 5096 self.refreshRadioGroup(); 5097 }, 0); 5098 }, 5099 onFakeClick: function (e) { 5100 // skip event if clicked on real element inside wrapper 5101 if (this.options.wrapNative && this.realElement.is(e.target)) { 5102 return; 5103 } 5104 5105 // toggle checked class 5106 if (!this.realElement.is(':disabled')) { 5107 delete this.savedEventObject; 5108 this.currentActiveRadio = this.getCurrentActiveRadio(); 5109 this.stateChecked = this.realElement.prop('checked'); 5110 this.realElement.prop('checked', true); 5111 this.fireNativeEvent(this.realElement, 'click'); 5112 if (this.savedEventObject && this.savedEventObject.isDefaultPrevented()) { 5113 this.realElement.prop('checked', this.stateChecked); 5114 this.currentActiveRadio.prop('checked', true); 5115 } else { 5116 this.fireNativeEvent(this.realElement, 'change'); 5117 } 5118 delete this.savedEventObject; 5119 } 5120 }, 5121 onFocus: function () { 5122 if (!this.pressedFlag || !this.focusedFlag) { 5123 this.focusedFlag = true; 5124 this.fakeElement.addClass(this.options.focusClass); 5125 this.realElement.on('blur', this.onBlur); 5126 } 5127 }, 5128 onBlur: function () { 5129 if (!this.pressedFlag) { 5130 this.focusedFlag = false; 5131 this.fakeElement.removeClass(this.options.focusClass); 5132 this.realElement.off('blur', this.onBlur); 5133 } 5134 }, 5135 onPress: function (e) { 5136 if (!this.focusedFlag && e.pointerType === 'mouse') { 5137 this.realElement.focus(); 5138 } 5139 this.pressedFlag = true; 5140 this.fakeElement.addClass(this.options.pressedClass); 5141 this.doc.on('jcf-pointerup', this.onRelease); 5142 }, 5143 onRelease: function (e) { 5144 if (this.focusedFlag && e.pointerType === 'mouse') { 5145 this.realElement.focus(); 5146 } 5147 this.pressedFlag = false; 5148 this.fakeElement.removeClass(this.options.pressedClass); 5149 this.doc.off('jcf-pointerup', this.onRelease); 5150 }, 5151 getCurrentActiveRadio: function () { 5152 return this.getRadioGroup(this.realElement).filter(':checked'); 5153 }, 5154 getRadioGroup: function (radio) { 5155 // find radio group for specified radio button 5156 var name = radio.attr('name'), 5157 parentForm = radio.parents('form'); 5158 5159 if (name) { 5160 if (parentForm.length) { 5161 return parentForm.find('input[name="' + name + '"]'); 5162 } else { 5163 return $('input[name="' + name + '"]:not(form input)'); 5164 } 5165 } else { 5166 return radio; 5167 } 5168 }, 5169 getLabelFor: function () { 5170 var parentLabel = this.realElement.closest('label'), 5171 elementId = this.realElement.prop('id'); 5172 5173 if (!parentLabel.length && elementId) { 5174 parentLabel = $('label[for="' + elementId + '"]'); 5175 } 5176 return parentLabel.length ? parentLabel : null; 5177 }, 5178 refreshRadioGroup: function () { 5179 // redraw current radio and its group 5180 this.getRadioGroup(this.realElement).each(function () { 5181 jcf.refresh(this); 5182 }); 5183 }, 5184 refresh: function () { 5185 // redraw current radio button 5186 var isChecked = this.realElement.is(':checked'), 5187 isDisabled = this.realElement.is(':disabled'); 5188 5189 this.fakeElement.toggleClass(this.options.checkedClass, isChecked) 5190 .toggleClass(this.options.uncheckedClass, !isChecked) 5191 .toggleClass(this.options.disabledClass, isDisabled); 5192 5193 if (this.labelElement) { 5194 this.labelElement.toggleClass(this.options.labelActiveClass, isChecked); 5195 } 5196 }, 5197 destroy: function () { 5198 // restore structure 5199 if (this.options.wrapNative) { 5200 this.realElement.insertBefore(this.fakeElement).css({ 5201 position: '', 5202 width: '', 5203 height: '', 5204 opacity: '', 5205 margin: '' 5206 }); 5207 } else { 5208 this.realElement.removeClass(this.options.hiddenClass); 5209 } 5210 5211 // removing element will also remove its event handlers 5212 this.fakeElement.off('jcf-pointerdown', this.onPress); 5213 this.fakeElement.remove(); 5214 5215 // remove other event handlers 5216 this.doc.off('jcf-pointerup', this.onRelease); 5217 this.realElement.off({ 5218 blur: this.onBlur, 5219 focus: this.onFocus, 5220 click: this.onRealClick 5221 }); 5222 } 5223 }); 5224 5225}(jQuery)); 5226 5227/*! 5228 * JavaScript Custom Forms : Checkbox Module 5229 * 5230 * Copyright 2014-2015 PSD2HTML - https://psd2html.com/jcf 5231 * Released under the MIT license (LICENSE.txt) 5232 * 5233 * Version: 1.1.2 5234 */ 5235; (function ($) { 5236 'use strict'; 5237 5238 jcf.addModule({ 5239 name: 'Checkbox', 5240 selector: 'input[type="checkbox"]', 5241 options: { 5242 wrapNative: true, 5243 checkedClass: 'jcf-checked', 5244 uncheckedClass: 'jcf-unchecked', 5245 labelActiveClass: 'jcf-label-active', 5246 fakeStructure: '<span class="jcf-checkbox"><span></span></span>' 5247 }, 5248 matchElement: function (element) { 5249 return element.is(':checkbox'); 5250 }, 5251 init: function () { 5252 this.initStructure(); 5253 this.attachEvents(); 5254 this.refresh(); 5255 }, 5256 initStructure: function () { 5257 // prepare structure 5258 this.doc = $(document); 5259 this.realElement = $(this.options.element); 5260 this.fakeElement = $(this.options.fakeStructure).insertAfter(this.realElement); 5261 this.labelElement = this.getLabelFor(); 5262 5263 if (this.options.wrapNative) { 5264 // wrap native checkbox inside fake block 5265 this.realElement.appendTo(this.fakeElement).css({ 5266 position: 'absolute', 5267 height: '100%', 5268 width: '100%', 5269 opacity: 0, 5270 margin: 0 5271 }); 5272 } else { 5273 // just hide native checkbox 5274 this.realElement.addClass(this.options.hiddenClass); 5275 } 5276 }, 5277 attachEvents: function () { 5278 // add event handlers 5279 this.realElement.on({ 5280 focus: this.onFocus, 5281 click: this.onRealClick 5282 }); 5283 this.fakeElement.on('click', this.onFakeClick); 5284 this.fakeElement.on('jcf-pointerdown', this.onPress); 5285 }, 5286 onRealClick: function (e) { 5287 // just redraw fake element (setTimeout handles click that might be prevented) 5288 var self = this; 5289 this.savedEventObject = e; 5290 setTimeout(function () { 5291 self.refresh(); 5292 }, 0); 5293 }, 5294 onFakeClick: function (e) { 5295 // skip event if clicked on real element inside wrapper 5296 if (this.options.wrapNative && this.realElement.is(e.target)) { 5297 return; 5298 } 5299 5300 // toggle checked class 5301 if (!this.realElement.is(':disabled')) { 5302 delete this.savedEventObject; 5303 this.stateChecked = this.realElement.prop('checked'); 5304 this.realElement.prop('checked', !this.stateChecked); 5305 this.fireNativeEvent(this.realElement, 'click'); 5306 if (this.savedEventObject && this.savedEventObject.isDefaultPrevented()) { 5307 this.realElement.prop('checked', this.stateChecked); 5308 } else { 5309 this.fireNativeEvent(this.realElement, 'change'); 5310 } 5311 delete this.savedEventObject; 5312 } 5313 }, 5314 onFocus: function () { 5315 if (!this.pressedFlag || !this.focusedFlag) { 5316 this.focusedFlag = true; 5317 this.fakeElement.addClass(this.options.focusClass); 5318 this.realElement.on('blur', this.onBlur); 5319 } 5320 }, 5321 onBlur: function () { 5322 if (!this.pressedFlag) { 5323 this.focusedFlag = false;
5324 this.fakeElement.removeClass(this.options.focusClass); 5325 this.realElement.off('blur', this.onBlur); 5326 } 5327 }, 5328 onPress: function (e) { 5329 if (!this.focusedFlag && e.pointerType === 'mouse') { 5330 this.realElement.focus(); 5331 } 5332 this.pressedFlag = true; 5333 this.fakeElement.addClass(this.options.pressedClass); 5334 this.doc.on('jcf-pointerup', this.onRelease); 5335 }, 5336 onRelease: function (e) { 5337 if (this.focusedFlag && e.pointerType === 'mouse') { 5338 this.realElement.focus(); 5339 } 5340 this.pressedFlag = false; 5341 this.fakeElement.removeClass(this.options.pressedClass); 5342 this.doc.off('jcf-pointerup', this.onRelease); 5343 }, 5344 getLabelFor: function () { 5345 var parentLabel = this.realElement.closest('label'), 5346 elementId = this.realElement.prop('id'); 5347 5348 if (!parentLabel.length && elementId) { 5349 parentLabel = $('label[for="' + elementId + '"]'); 5350 } 5351 return parentLabel.length ? parentLabel : null; 5352 }, 5353 refresh: function () { 5354 // redraw custom checkbox 5355 var isChecked = this.realElement.is(':checked'), 5356 isDisabled = this.realElement.is(':disabled'); 5357 5358 this.fakeElement.toggleClass(this.options.checkedClass, isChecked) 5359 .toggleClass(this.options.uncheckedClass, !isChecked) 5360 .toggleClass(this.options.disabledClass, isDisabled); 5361 5362 if (this.labelElement) { 5363 this.labelElement.toggleClass(this.options.labelActiveClass, isChecked); 5364 } 5365 }, 5366 destroy: function () { 5367 // restore structure 5368 if (this.options.wrapNative) { 5369 this.realElement.insertBefore(this.fakeElement).css({ 5370 position: '', 5371 width: '', 5372 height: '', 5373 opacity: '', 5374 margin: '' 5375 }); 5376 } else { 5377 this.realElement.removeClass(this.options.hiddenClass); 5378 } 5379 5380 // removing element will also remove its event handlers 5381 this.fakeElement.off('jcf-pointerdown', this.onPress); 5382 this.fakeElement.remove(); 5383 5384 // remove other event handlers 5385 this.doc.off('jcf-pointerup', this.onRelease); 5386 this.realElement.off({ 5387 focus: this.onFocus, 5388 click: this.onRealClick 5389 }); 5390 } 5391 }); 5392 5393}(jQuery)); 5394 5395/* 5396 * infinityContent 5397 */ 5398; (function ($) { 5399 function InfinityContent(options) { 5400 this.options = $.extend({ 5401 items: '>*', 5402 loadingClass: 'loading', 5403 targetBlock: '.loading-holder', 5404 loader: '.load-box', 5405 moreLink: '.more-link', 5406 ajaxData: 'ajax=1', 5407 showOnScroll: false, 5408 exrtaSpace: 0 5409 }, options); 5410 this.init(); 5411 } 5412 InfinityContent.prototype = { 5413 init: function () { 5414 this.findElements(); 5415 this.addEvents(); 5416 this.makeCallback('onInit', this); 5417 }, 5418 findElements: function () { 5419 this.holder = $(this.options.holder); 5420 this.targetBlock = this.holder.find(this.options.targetBlock); 5421 this.loader = this.holder.find(this.options.loader); 5422 this.moreLink = this.holder.find(this.options.moreLink); 5423 this.loading = false; 5424 this.destroyed = false; 5425 }, 5426 addEvents: function () { 5427 var self = this, 5428 win = jQuery(window); 5429 5430 this.clickHandler = function (e) { 5431 e.preventDefault(); 5432 if (!self.destroyed && !self.loading) { 5433 self.loadContent(); 5434 } 5435 }; 5436 5437 this.moreLink.on('click', this.clickHandler); 5438 5439 if (this.options.showOnScroll) { 5440 this.scrollHandler = function () { 5441 if (!self.loading && !self.allLoaded && !self.destroyed) { 5442 if (win.scrollTop() + self.winHeight - self.options.exrtaSpace > self.targetTop + self.targetHeight) { 5443 self.loadContent(); 5444 } 5445 } 5446 }; 5447 this.resizeHandler = function () { 5448 self.winHeight = self.getWindowHeight(); 5449 self.targetTop = self.targetBlock.offset().top; 5450 self.targetHeight = self.targetBlock.innerHeight(); 5451 self.scrollHandler(); 5452 }; 5453 this.resizeHandler(); 5454 win 5455 .on('load resize orientationchange', this.resizeHandler) 5456 .on('scroll', this.scrollHandler); 5457 } 5458 }, 5459 getWindowHeight: function () { 5460 return typeof window.innerHeight === 'number' ? window.innerHeight : document.documentElement.clientHeight; 5461 }, 5462 loadAll: function () { 5463 var self = this; 5464 5465 if (!this.allLoaded && this.moreLink.length) { 5466 this.loadContent(function () { 5467 self.loadAll(); 5468 }); 5469 } 5470 }, 5471 loadContent: function () { 5472 var self = this; 5473 5474 this.loading = true; 5475 this.holder.addClass(this.options.loadingClass); 5476 5477 if (this.ajaxRequest) { 5478 this.ajaxRequest.abort(); 5479 } 5480 5481 this.ajaxRequest = $.ajax({ 5482 url: self.moreLink.attr('href'), 5483 data: self.options.ajaxData, 5484 cache: false, 5485 type: 'get', 5486 dataType: 'text', 5487 success: function (data) { 5488 self.appendNewContent(data); 5489 } 5490 }); 5491 }, 5492 appendNewContent: function (data) { 5493 var newContent = jQuery('<div>', { html: data }), 5494 newItems = newContent.find(this.options.items).not(this.options.moreLink), 5495 newMoreLink = newContent.find(this.options.moreLink); 5496 5497 this.targetBlock.append(newItems); 5498 this.holder.removeClass(this.options.loadingClass); 5499 if (newMoreLink.length) { 5500 this.moreLink.attr('href', newMoreLink.attr('href')); 5501 if (this.options.showOnScroll) { 5502 this.resizeHandler(); 5503 } 5504 this.loading = false;
5505 } else { 5506 this.moreLink.off('click', this.clickHandler); 5507 this.loader.hide(); 5508 this.allLoaded = true; 5509 } 5510 this.makeCallback('onAllLoaded', newItems); 5511 newItems.css({ opacity: 0 }); 5512 newItems.stop().animate({ opacity: 1 }, this.options.animSpeed); 5513 this.makeCallback('onLoad', newItems); 5514 }, 5515 destroy: function () { 5516 this.destroyed = true; 5517 win 5518 .off('load resize orientationchange', this.resizeHandler) 5519 .off('scroll', this.scrollHandler); 5520 if (this.ajaxRequest) { 5521 this.ajaxRequest.abort(); 5522 } 5523 }, 5524 makeCallback: function (name) { 5525 if (typeof this.options[name] === 'function') { 5526 var args = Array.prototype.slice.call(arguments); 5527 args.shift(); 5528 this.options[name].apply(this, args); 5529 } 5530 } 5531 }; 5532 5533 // jQuery plugin interface 5534 $.fn.infinityContent = function (options) { 5535 return this.each(function () { 5536 jQuery(this).data('InfinityContent', new InfinityContent($.extend(options, { holder: this }))); 5537 }); 5538 }; 5539}(jQuery)); 5540 5541/* 5542 * Responsive Layout helper 5543 */ 5544ResponsiveHelper = (function ($) { 5545 // init variables 5546 var handlers = [], 5547 prevWinWidth, 5548 win = $(window), 5549 nativeMatchMedia = false; 5550 5551 // detect match media support 5552 if (window.matchMedia) { 5553 if (window.Window && window.matchMedia === Window.prototype.matchMedia) { 5554 nativeMatchMedia = true; 5555 } else if (window.matchMedia.toString().indexOf('native') > -1) { 5556 nativeMatchMedia = true; 5557 } 5558 } 5559 5560 // prepare resize handler 5561 function resizeHandler() { 5562 var winWidth = win.width(); 5563 if (winWidth !== prevWinWidth) { 5564 prevWinWidth = winWidth; 5565 5566 // loop through range groups 5567 $.each(handlers, function (index, rangeObject) { 5568 // disable current active area if needed 5569 $.each(rangeObject.data, function (property, item) { 5570 if (item.currentActive && !matchRange(item.range[0], item.range[1])) { 5571 item.currentActive = false; 5572 if (typeof item.disableCallback === 'function') { 5573 item.disableCallback(); 5574 } 5575 } 5576 }); 5577 5578 // enable areas that match current width 5579 $.each(rangeObject.data, function (property, item) { 5580 if (!item.currentActive && matchRange(item.range[0], item.range[1])) { 5581 // make callback 5582 item.currentActive = true; 5583 if (typeof item.enableCallback === 'function') { 5584 item.enableCallback(); 5585 } 5586 } 5587 }); 5588 }); 5589 } 5590 } 5591 win.bind('load resize orientationchange', resizeHandler); 5592 5593 // test range 5594 function matchRange(r1, r2) { 5595 var mediaQueryString = ''; 5596 if (r1 > 0) { 5597 mediaQueryString += '(min-width: ' + r1 + 'px)'; 5598 } 5599 if (r2 < Infinity) { 5600 mediaQueryString += (mediaQueryString ? ' and ' : '') + '(max-width: ' + r2 + 'px)'; 5601 } 5602 return matchQuery(mediaQueryString, r1, r2); 5603 } 5604 5605 // media query function 5606 function matchQuery(query, r1, r2) { 5607 if (window.matchMedia && nativeMatchMedia) { 5608 return matchMedia(query).matches; 5609 } else if (window.styleMedia) { 5610 return styleMedia.matchMedium(query); 5611 } else if (window.media) { 5612 return media.matchMedium(query); 5613 } else { 5614 return prevWinWidth >= r1 && prevWinWidth <= r2; 5615 } 5616 } 5617 5618 // range parser 5619 function parseRange(rangeStr) { 5620 var rangeData = rangeStr.split('..'); 5621 var x1 = parseInt(rangeData[0], 10) || -Infinity; 5622 var x2 = parseInt(rangeData[1], 10) || Infinity; 5623 return [x1, x2].sort(function (a, b) { 5624 return a - b; 5625 }); 5626 } 5627 5628 // export public functions 5629 return { 5630 addRange: function (ranges) { 5631 // parse data and add items to collection 5632 var result = { data: {} }; 5633 $.each(ranges, function (property, data) { 5634 result.data[property] = { 5635 range: parseRange(property), 5636 enableCallback: data.on, 5637 disableCallback: data.off 5638 }; 5639 }); 5640 handlers.push(result); 5641 5642 // call resizeHandler to recalculate all events 5643 prevWinWidth = null; 5644 resizeHandler(); 5645 } 5646 }; 5647}(jQuery)); 5648 5649 5650/* 5651 * jQuery SlideShow plugin 5652 */ 5653; (function ($) { 5654 function FadeGallery(options) { 5655 this.options = $.extend({ 5656 slides: 'ul.slideset > li', 5657 activeClass: 'active', 5658 disabledClass: 'disabled', 5659 btnPrev: 'a.btn-prev', 5660 btnNext: 'a.btn-next', 5661 generatePagination: false, 5662 pagerList: '<ul>', 5663 pagerListItem: '<li><a href="#"></a></li>', 5664 pagerListItemText: 'a', 5665 pagerLinks: '.pagination li', 5666 currentNumber: 'span.current-num', 5667 totalNumber: 'span.total-num', 5668 btnPlay: '.btn-play', 5669 btnPause: '.btn-pause', 5670 btnPlayPause: '.btn-play-pause', 5671 galleryReadyClass: 'gallery-js-ready', 5672 autorotationActiveClass: 'autorotation-active', 5673 autorotationDisabledClass: 'autorotation-disabled', 5674 autorotationStopAfterClick: false, 5675 circularRotation: true, 5676 switchSimultaneously: true, 5677 disableWhileAnimating: false,
5678 disableFadeIE: false, 5679 autoRotation: false, 5680 pauseOnHover: true, 5681 autoHeight: false, 5682 useSwipe: false, 5683 swipeThreshold: 15, 5684 switchTime: 4000, 5685 animSpeed: 600, 5686 event: 'click' 5687 }, options); 5688 this.init(); 5689 } 5690 FadeGallery.prototype = { 5691 init: function () { 5692 if (this.options.holder) { 5693 this.findElements(); 5694 this.attachEvents(); 5695 this.refreshState(true); 5696 this.autoRotate(); 5697 this.makeCallback('onInit', this); 5698 } 5699 }, 5700 findElements: function () { 5701 // control elements 5702 this.gallery = $(this.options.holder).addClass(this.options.galleryReadyClass); 5703 this.slides = this.gallery.find(this.options.slides); 5704 this.slidesHolder = this.slides.eq(0).parent(); 5705 this.stepsCount = this.slides.length; 5706 this.btnPrev = this.gallery.find(this.options.btnPrev); 5707 this.btnNext = this.gallery.find(this.options.btnNext); 5708 this.currentIndex = 0; 5709 5710 // disable fade effect in old IE 5711 if (this.options.disableFadeIE && !$.support.opacity) { 5712 this.options.animSpeed = 0; 5713 } 5714 5715 // create gallery pagination 5716 if (typeof this.options.generatePagination === 'string') { 5717 this.pagerHolder = this.gallery.find(this.options.generatePagination).empty(); 5718 this.pagerList = $(this.options.pagerList).appendTo(this.pagerHolder); 5719 for (var i = 0; i < this.stepsCount; i++) { 5720 $(this.options.pagerListItem).appendTo(this.pagerList).find(this.options.pagerListItemText).text(i + 1); 5721 } 5722 this.pagerLinks = this.pagerList.children(); 5723 } else { 5724 this.pagerLinks = this.gallery.find(this.options.pagerLinks); 5725 } 5726 5727 // get start index 5728 var activeSlide = this.slides.filter('.' + this.options.activeClass); 5729 if (activeSlide.length) { 5730 this.currentIndex = this.slides.index(activeSlide); 5731 } 5732 this.prevIndex = this.currentIndex; 5733 5734 // autorotation control buttons 5735 this.btnPlay = this.gallery.find(this.options.btnPlay); 5736 this.btnPause = this.gallery.find(this.options.btnPause); 5737 this.btnPlayPause = this.gallery.find(this.options.btnPlayPause); 5738 5739 // misc elements 5740 this.curNum = this.gallery.find(this.options.currentNumber); 5741 this.allNum = this.gallery.find(this.options.totalNumber); 5742 5743 // handle flexible layout 5744 this.slides.css({ display: 'block', opacity: 0 }).eq(this.currentIndex).css({ 5745 opacity: '' 5746 }); 5747 }, 5748 attachEvents: function () { 5749 var self = this; 5750 5751 // flexible layout handler 5752 this.resizeHandler = function () { 5753 self.onWindowResize(); 5754 }; 5755 $(window).bind('load resize orientationchange', this.resizeHandler); 5756 5757 if (this.btnPrev.length) { 5758 this.btnPrevHandler = function (e) { 5759 e.preventDefault(); 5760 self.prevSlide(); 5761 if (self.options.autorotationStopAfterClick) { 5762 self.stopRotation(); 5763 } 5764 }; 5765 this.btnPrev.bind(this.options.event, this.btnPrevHandler); 5766 } 5767 if (this.btnNext.length) { 5768 this.btnNextHandler = function (e) { 5769 e.preventDefault(); 5770 self.nextSlide(); 5771 if (self.options.autorotationStopAfterClick) { 5772 self.stopRotation(); 5773 } 5774 }; 5775 this.btnNext.bind(this.options.event, this.btnNextHandler); 5776 } 5777 if (this.pagerLinks.length) { 5778 this.pagerLinksHandler = function (e) { 5779 e.preventDefault(); 5780 self.numSlide(self.pagerLinks.index(e.currentTarget)); 5781 if (self.options.autorotationStopAfterClick) { 5782 self.stopRotation(); 5783 } 5784 }; 5785 this.pagerLinks.bind(self.options.event, this.pagerLinksHandler); 5786 } 5787 5788 // autorotation buttons handler 5789 if (this.btnPlay.length) { 5790 this.btnPlayHandler = function (e) { 5791 e.preventDefault(); 5792 self.startRotation(); 5793 }; 5794 this.btnPlay.bind(this.options.event, this.btnPlayHandler); 5795 } 5796 if (this.btnPause.length) { 5797 this.btnPauseHandler = function (e) { 5798 e.preventDefault(); 5799 self.stopRotation(); 5800 }; 5801 this.btnPause.bind(this.options.event, this.btnPauseHandler); 5802 } 5803 if (this.btnPlayPause.length) { 5804 this.btnPlayPauseHandler = function (e) { 5805 e.preventDefault(); 5806 if (!self.gallery.hasClass(self.options.autorotationActiveClass)) { 5807 self.startRotation(); 5808 } else { 5809 self.stopRotation(); 5810 } 5811 }; 5812 this.btnPlayPause.bind(this.options.event, this.btnPlayPauseHandler); 5813 } 5814 5815 // swipe gestures handler 5816 if (this.options.useSwipe && window.Hammer && isTouchDevice) { 5817 this.swipeHandler = new Hammer.Manager(this.gallery[0]); 5818 this.swipeHandler.add(new Hammer.Swipe({ 5819 direction: Hammer.DIRECTION_HORIZONTAL, 5820 threshold: self.options.swipeThreshold 5821 })); 5822 this.swipeHandler.on('swipeleft', function () { 5823 self.nextSlide(); 5824 }).on('swiperight', function () { 5825 self.prevSlide(); 5826 }); 5827 } 5828 5829 // pause on hover handling 5830 if (this.options.pauseOnHover) { 5831 this.hoverHandler = function () { 5832 if (self.options.autoRotation) { 5833 self.galleryHover = true; 5834 self.pauseRotation(); 5835 } 5836 }; 5837 this.leaveHandler = function () { 5838 if (self.options.autoRotation) { 5839 self.galleryHover = false;
5840 self.resumeRotation(); 5841 } 5842 }; 5843 this.gallery.bind({ mouseenter: this.hoverHandler, mouseleave: this.leaveHandler }); 5844 } 5845 }, 5846 onWindowResize: function () { 5847 if (this.options.autoHeight && !this.galleryAnimating) { 5848 this.slidesHolder.css({ height: this.slides.eq(this.currentIndex).outerHeight(true) }); 5849 this.resizeQueue = false; 5850 } else { 5851 this.resizeQueue = true; 5852 } 5853 }, 5854 prevSlide: function () { 5855 if (!(this.options.disableWhileAnimating && this.galleryAnimating)) { 5856 this.prevIndex = this.currentIndex; 5857 if (this.currentIndex > 0) { 5858 this.currentIndex--; 5859 this.switchSlide(); 5860 } else if (this.options.circularRotation) { 5861 this.currentIndex = this.stepsCount - 1; 5862 this.switchSlide(); 5863 } 5864 } 5865 }, 5866 nextSlide: function (fromAutoRotation) { 5867 if (!(this.options.disableWhileAnimating && this.galleryAnimating)) { 5868 this.prevIndex = this.currentIndex; 5869 if (this.currentIndex < this.stepsCount - 1) { 5870 this.currentIndex++; 5871 this.switchSlide(); 5872 } else if (this.options.circularRotation || fromAutoRotation === true) { 5873 this.currentIndex = 0; 5874 this.switchSlide(); 5875 } 5876 } 5877 }, 5878 numSlide: function (c) { 5879 if (this.currentIndex != c) { 5880 this.prevIndex = this.currentIndex; 5881 this.currentIndex = c; 5882 this.switchSlide(); 5883 } 5884 }, 5885 switchSlide: function () { 5886 var self = this; 5887 if (this.slides.length > 1) { 5888 this.galleryAnimating = true; 5889 if (!this.options.animSpeed) { 5890 this.slides.eq(this.prevIndex).css({ opacity: 0 }); 5891 } else { 5892 this.slides.eq(this.prevIndex).stop().animate({ opacity: 0 }, { duration: this.options.animSpeed }); 5893 } 5894 5895 this.switchNext = function () { 5896 if (!self.options.animSpeed) { 5897 self.slides.eq(self.currentIndex).css({ opacity: '' }); 5898 } else { 5899 self.slides.eq(self.currentIndex).stop().animate({ opacity: 1 }, { duration: self.options.animSpeed }); 5900 } 5901 clearTimeout(this.nextTimer); 5902 this.nextTimer = setTimeout(function () { 5903 self.slides.eq(self.currentIndex).css({ opacity: '' }); 5904 if (self.resizeQueue) { 5905 self.onWindowResize(); 5906 } 5907 self.galleryAnimating = false; 5908 self.autoRotate(); 5909 5910 // onchange callback 5911 self.makeCallback('onChange', self); 5912 }, self.options.animSpeed); 5913 }; 5914 5915 if (this.options.switchSimultaneously) { 5916 self.switchNext(); 5917 } else { 5918 clearTimeout(this.switchTimer); 5919 this.switchTimer = setTimeout(function () { 5920 self.switchNext(); 5921 }, this.options.animSpeed); 5922 } 5923 this.refreshState(); 5924 5925 // onchange callback 5926 this.makeCallback('onBeforeChange', this); 5927 } 5928 }, 5929 refreshState: function (initial) { 5930 this.slides.removeClass(this.options.activeClass).eq(this.currentIndex).addClass(this.options.activeClass); 5931 this.pagerLinks.removeClass(this.options.activeClass).eq(this.currentIndex).addClass(this.options.activeClass); 5932 this.curNum.html(this.currentIndex + 1); 5933 this.allNum.html(this.stepsCount); 5934 5935 // initial refresh 5936 if (this.options.autoHeight) { 5937 if (initial) { 5938 this.slidesHolder.css({ height: this.slides.eq(this.currentIndex).outerHeight(true) }); 5939 } else { 5940 this.slidesHolder.stop().animate({ height: this.slides.eq(this.currentIndex).outerHeight(true) }, { duration: this.options.animSpeed }); 5941 } 5942 } 5943 5944 // disabled state 5945 if (!this.options.circularRotation) { 5946 this.btnPrev.add(this.btnNext).removeClass(this.options.disabledClass); 5947 if (this.currentIndex === 0) this.btnPrev.addClass(this.options.disabledClass); 5948 if (this.currentIndex === this.stepsCount - 1) this.btnNext.addClass(this.options.disabledClass); 5949 } 5950 5951 // add class if not enough slides
5952 this.gallery.toggleClass('not-enough-slides', this.stepsCount === 1); 5953 }, 5954 startRotation: function () { 5955 this.options.autoRotation = true; 5956 this.galleryHover = false; 5957 this.autoRotationStopped = false; 5958 this.resumeRotation(); 5959 }, 5960 stopRotation: function () { 5961 this.galleryHover = true; 5962 this.autoRotationStopped = true; 5963 this.pauseRotation(); 5964 }, 5965 pauseRotation: function () { 5966 this.gallery.addClass(this.options.autorotationDisabledClass); 5967 this.gallery.removeClass(this.options.autorotationActiveClass); 5968 clearTimeout(this.timer); 5969 }, 5970 resumeRotation: function () { 5971 if (!this.autoRotationStopped) { 5972 this.gallery.addClass(this.options.autorotationActiveClass); 5973 this.gallery.removeClass(this.options.autorotationDisabledClass); 5974 this.autoRotate(); 5975 } 5976 }, 5977 autoRotate: function () { 5978 var self = this; 5979 clearTimeout(this.timer); 5980 if (this.options.autoRotation && !this.galleryHover && !this.autoRotationStopped) { 5981 this.gallery.addClass(this.options.autorotationActiveClass); 5982 this.timer = setTimeout(function () { 5983 self.nextSlide(true); 5984 }, this.options.switchTime); 5985 } else { 5986 this.pauseRotation(); 5987 } 5988 }, 5989 makeCallback: function (name) { 5990 if (typeof this.options[name] === 'function') { 5991 var args = Array.prototype.slice.call(arguments); 5992 args.shift(); 5993 this.options[name].apply(this, args); 5994 } 5995 }, 5996 destroy: function () { 5997 // navigation buttons handler 5998 this.btnPrev.unbind(this.options.event, this.btnPrevHandler); 5999 this.btnNext.unbind(this.options.event, this.btnNextHandler); 6000 this.pagerLinks.unbind(this.options.event, this.pagerLinksHandler); 6001 $(window).unbind('load resize orientationchange', this.resizeHandler); 6002 6003 // remove autorotation handlers 6004 this.stopRotation(); 6005 this.btnPlay.unbind(this.options.event, this.btnPlayHandler); 6006 this.btnPause.unbind(this.options.event, this.btnPauseHandler); 6007 this.btnPlayPause.unbind(this.options.event, this.btnPlayPauseHandler); 6008 this.gallery.unbind('mouseenter', this.hoverHandler); 6009 this.gallery.unbind('mouseleave', this.leaveHandler); 6010 this.slidesHolder.css('height', ''); 6011 6012 // remove swipe handler if used 6013 if (this.swipeHandler) { 6014 this.swipeHandler.destroy(); 6015 } 6016 if (typeof this.options.generatePagination === 'string') { 6017 this.pagerHolder.empty(); 6018 } 6019 6020 // remove unneeded classes and styles 6021 var unneededClasses = [this.options.galleryReadyClass, this.options.autorotationActiveClass, this.options.autorotationDisabledClass]; 6022 this.gallery.removeClass(unneededClasses.join(' ')); 6023 this.slidesHolder.add(this.slides).removeAttr('style'); 6024 } 6025 }; 6026 6027 // detect device type 6028 var isTouchDevice = /Windows Phone/.test(navigator.userAgent) || ('ontouchstart' in window) || window.DocumentTouch && document instanceof DocumentTouch; 6029 6030 // jquery plugin 6031 $.fn.fadeGallery = function (opt) { 6032 return this.each(function () { 6033 $(this).data('FadeGallery', new FadeGallery($.extend(opt, { holder: this }))); 6034 }); 6035 }; 6036}(jQuery)); 6037 6038/* 6039 * jQuery Open/Close plugin 6040 */ 6041; (function ($) { 6042 function MobileNavigation(options) { 6043 this.options = $.extend({ 6044 addClassBeforeAnimation: true, 6045 hideOnClickOutside: false, 6046 slider: '#nav > ul', 6047 listItems: 'li', 6048 opener: '> a', 6049 nextLevel: '>.dropdown', 6050 activeClass: 'active-state', 6051 backText: 'Back', 6052 backBtn: '<a href="#" class="btn-back" />', 6053 backPrefix: 'Back to ', 6054 backTitle: '<a href="#" class="title-drop" />', 6055 animSpeed: 400 6056 }, options); 6057 this.init(); 6058 } 6059 MobileNavigation.prototype = { 6060 init: function () { 6061 if (this.options.holder) { 6062 this.findElements(); 6063 this.attachEvents(); 6064 this.makeCallback('onInit', this); 6065 } 6066 }, 6067 findElements: function () { 6068 var self = this; 6069 this.holder = $(this.options.holder); 6070 this.slider = this.holder.find(this.options.slider); 6071 this.allListItems = this.slider.find(this.options.listItems).has(this.options.nextLevel); 6072 this.allOpeners = $(); 6073 this.allBack = $(); 6074 this.allListItems.each(function () { 6075 var listItem = $(this); 6076 var opener = listItem.find(self.options.opener); 6077 var drop = listItem.find(self.options.nextLevel); 6078 var parentDrop = listItem.closest('.drop'); 6079 var backLink = $(self.options.backBtn); 6080 var linkDrop = $(self.options.backTitle); 6081 var backText = self.options.backText; 6082 if (parentDrop.length) backText = self.options.backPrefix + opener.text(); 6083 backLink.text(backText).prependTo(drop); 6084 linkDrop.attr('href', opener.attr('href')).text(opener.text()).insertAfter(backLink); 6085 self.allOpeners = self.allOpeners.add(opener); 6086 opener.data({ 6087 drop: drop, 6088 listItem: listItem, 6089 backLink: backLink 6090 }); 6091 listItem.data({ 6092 drop: drop, 6093 opener: opener 6094 }); 6095 self.allBack = self.allBack.add(backLink); 6096 }); 6097 this.levelCounter = 0; 6098 }, 6099 attachEvents: function () { 6100 var self = this; 6101 6102 this.resizeHandler = function () { 6103 self.onPageResize(); 6104 }; 6105 6106 $(window).on('resize orientationchange load', this.resizeHandler); 6107 this.allOpeners.each(function () { 6108 var currOpener = $(this); 6109 var backLink = currOpener.data('backLink'); 6110 currOpener.on('click.menu', function (e) { 6111 e.preventDefault(); 6112 self.showLevel(currOpener.data('listItem')); 6113 }); 6114 if (backLink && backLink.length) { 6115 backLink.on('click.menu', function (e) { 6116 e.preventDefault(); 6117 self.hideLevel(currOpener.data('listItem')); 6118 }); 6119 } 6120 }); 6121 }, 6122 showLevel: function (listItem) { 6123 var self = this; 6124 ++this.levelCounter; 6125 this.moveSlider(); 6126 listItem.siblings().removeClass(this.options.activeClass); 6127 listItem.addClass(this.options.activeClass); 6128 }, 6129 hideLevel: function (listItem) { 6130 var self = this; 6131 --this.levelCounter; 6132 this.moveSlider({ 6133 complete: function () { 6134 listItem.removeClass(self.options.activeClass); 6135 } 6136 }); 6137 }, 6138 hideAllLevels: function () { 6139 var self = this; 6140 this.levelCounter = 0; 6141 this.moveSlider({ 6142 complete: function () { 6143 self.allListItems.removeClass(self.options.activeClass); 6144 } 6145 }); 6146 }, 6147 moveSlider: function (obj) { 6148 this.slider.stop().animate({ marginLeft: -this.levelCounter * this.moveOffset }, (obj && obj.noAnim) ? 0 : this.options.animSpeed, function () { 6149 if (obj && obj.complete) obj.complete(); 6150 }); 6151 }, 6152 onPageResize: function () { 6153 this.moveOffset = this.slider.innerWidth(); 6154 this.moveSlider({ noAnim: true }); 6155 }, 6156 destroy: function () { 6157 this.allOpeners.off('click.menu'); 6158 this.allBack.remove(); 6159 this.allListItems.removeClass(this.options.activeClass); 6160 this.slider.stop().css({ marginLeft: '' }); 6161 $(window).off('resize orientationchange load', this.resizeHandler); 6162 }, 6163 makeCallback: function (name) { 6164 if (typeof this.options[name] === 'function') { 6165 var args = Array.prototype.slice.call(arguments); 6166 args.shift(); 6167 this.options[name].apply(this, args); 6168 } 6169 } 6170 }; 6171 6172 // jQuery plugin interface 6173 $.fn.mobileNavigation = function (opt) { 6174 return this.each(function () { 6175 jQuery(this).data('MobileNavigation', new MobileNavigation($.extend(opt, { holder: this }))); 6176 }); 6177 }; 6178}(jQuery)); 6179 6180 6181/* 6182 * jQuery SameHeight plugin 6183 */ 6184; (function ($) { 6185 $.fn.sameHeight = function (opt) { 6186 var options = $.extend({ 6187 skipClass: 'same-height-ignore', 6188 leftEdgeClass: 'same-height-left', 6189 rightEdgeClass: 'same-height-right', 6190 elements: '>*', 6191 flexible: false, 6192 multiLine: false, 6193 useMinHeight: false, 6194 biggestHeight: false, 6195 onBeforeResize: $.noop, 6196 onResize: $.noop 6197 }, opt); 6198 return this.each(function () { 6199 var holder = $(this), postResizeTimer, ignoreResize; 6200 var elements = holder.find(options.elements).not('.' + options.skipClass); 6201 if (!elements.length) return; 6202 6203 // resize handler 6204 function doResize() { 6205 if (options.onBeforeResize) { 6206 options.onBeforeResize(holder); 6207 } 6208 elements.css(options.useMinHeight && supportMinHeight ? 'minHeight' : 'height', ''); 6209 if (options.multiLine) { 6210 // resize elements row by row 6211 resizeElementsByRows(elements, options); 6212 } else { 6213 // resize elements by holder 6214 resizeElements(elements, holder, options); 6215 } 6216 if (options.onResize) { 6217 options.onResize(holder); 6218 } 6219 } 6220 doResize(); 6221 6222 // handle flexible layout / font resize 6223 var delayedResizeHandler = function () { 6224 if (!ignoreResize) { 6225 ignoreResize = true; 6226 doResize(); 6227 clearTimeout(postResizeTimer); 6228 postResizeTimer = setTimeout(function () { 6229 doResize(); 6230 setTimeout(function () { 6231 ignoreResize = false;
6232 }, 10); 6233 }, 100); 6234 } 6235 }; 6236 6237 // handle flexible/responsive layout 6238 if (options.flexible) { 6239 $(window).bind('resize orientationchange fontresize', delayedResizeHandler); 6240 } 6241 6242 // handle complete page load including images and fonts 6243 $(window).bind('load', delayedResizeHandler); 6244 }); 6245 }; 6246 6247 // detect css min-height support 6248 var supportMinHeight = typeof document.documentElement.style.maxHeight !== 'undefined'; 6249 6250 // get elements by rows 6251 function resizeElementsByRows(boxes, options) { 6252 var currentRow = $(), maxHeight, maxCalcHeight = 0, firstOffset = boxes.eq(0).offset().top; 6253 boxes.each(function (ind) { 6254 var curItem = $(this); 6255 if (curItem.offset().top === firstOffset) { 6256 currentRow = currentRow.add(this); 6257 } else { 6258 maxHeight = getMaxHeight(currentRow); 6259 maxCalcHeight = Math.max(maxCalcHeight, resizeElements(currentRow, maxHeight, options)); 6260 currentRow = curItem; 6261 firstOffset = curItem.offset().top; 6262 } 6263 }); 6264 if (currentRow.length) { 6265 maxHeight = getMaxHeight(currentRow); 6266 maxCalcHeight = Math.max(maxCalcHeight, resizeElements(currentRow, maxHeight, options)); 6267 } 6268 if (options.biggestHeight) { 6269 boxes.css(options.useMinHeight && supportMinHeight ? 'minHeight' : 'height', maxCalcHeight); 6270 } 6271 } 6272 6273 // calculate max element height 6274 function getMaxHeight(boxes) { 6275 var maxHeight = 0; 6276 boxes.each(function () { 6277 maxHeight = Math.max(maxHeight, $(this).outerHeight()); 6278 }); 6279 return maxHeight; 6280 } 6281 6282 // resize helper function 6283 function resizeElements(boxes, parent, options) { 6284 var calcHeight; 6285 var parentHeight = typeof parent === 'number' ? parent : parent.height(); 6286 boxes.removeClass(options.leftEdgeClass).removeClass(options.rightEdgeClass).each(function (i) { 6287 var element = $(this); 6288 var depthDiffHeight = 0; 6289 var isBorderBox = element.css('boxSizing') === 'border-box' || element.css('-moz-box-sizing') === 'border-box' || element.css('-webkit-box-sizing') === 'border-box'; 6290 6291 if (typeof parent !== 'number') { 6292 element.parents().each(function () { 6293 var tmpParent = $(this); 6294 if (parent.is(this)) { 6295 return false; 6296 } else { 6297 depthDiffHeight += tmpParent.outerHeight() - tmpParent.height(); 6298 } 6299 }); 6300 } 6301 calcHeight = parentHeight - depthDiffHeight; 6302 calcHeight -= isBorderBox ? 0 : element.outerHeight() - element.height(); 6303 6304 if (calcHeight > 0) { 6305 element.css(options.useMinHeight && supportMinHeight ? 'minHeight' : 'height', calcHeight); 6306 } 6307 }); 6308 boxes.filter(':first').addClass(options.leftEdgeClass); 6309 boxes.filter(':last').addClass(options.rightEdgeClass); 6310 return calcHeight; 6311 } 6312}(jQuery)); 6313 6314/* 6315 * jQuery FontResize Event 6316 */ 6317jQuery.onFontResize = (function ($) { 6318 $(function () { 6319 var randomID = 'font-resize-frame-' + Math.floor(Math.random() * 1000); 6320 var resizeFrame = $('<iframe>').attr('id', randomID).addClass('font-resize-helper'); 6321 6322 // required styles 6323 resizeFrame.css({ 6324 width: '100em', 6325 height: '10px', 6326 position: 'absolute', 6327 borderWidth: 0, 6328 top: '-9999px', 6329 left: '-9999px' 6330 }).appendTo('body'); 6331 6332 // use native IE resize event if possible 6333 if (window.attachEvent && !window.addEventListener) { 6334 resizeFrame.bind('resize', function () { 6335 $.onFontResize.trigger(resizeFrame[0].offsetWidth / 100); 6336 }); 6337 } 6338 // use script inside the iframe to detect resize for other browsers 6339 else { 6340 var doc = resizeFrame[0].contentWindow.document; 6341 doc.open(); 6342 doc.write('<scri' + 'pt>window.onload = function(){var em = parent.jQuery("#' + randomID + '")[0];window.onresize = function(){if(parent.jQuery.onFontResize){parent.jQuery.onFontResize.trigger(em.offsetWidth / 100);}}};</scri' + 'pt>'); 6343 doc.close(); 6344 }
6345 jQuery.onFontResize.initialSize = resizeFrame[0].offsetWidth / 100; 6346 }); 6347 return { 6348 // public method, so it can be called from within the iframe 6349 trigger: function (em) { 6350 $(window).trigger("fontresize", [em]); 6351 } 6352 }; 6353}(jQuery)); 6354 6355 6356/* 6357 * Accessible TAB navigation 6358 */ 6359; (function ($) { 6360 var isWindowsPhone = /Windows Phone/.test(navigator.userAgent); 6361 var isTouchDevice = ('ontouchstart' in window) || window.DocumentTouch && document instanceof DocumentTouch; 6362 6363 $.fn.tabNav = function (opt) { 6364 var options = $.extend({ 6365 hoverClass: 'hover', 6366 items: 'li', 6367 opener: '>a', 6368 delay: 10 6369 }, opt); 6370 6371 if (isWindowsPhone || isTouchDevice) { 6372 return this; 6373 } 6374 6375 return this.each(function () { 6376 var nav = $(this), items = nav.find(options.items); 6377 6378 items.each(function (index, navItem) { 6379 var item = $(this), navActive, touchNavActive; 6380 var link = item.find(options.opener), timer; 6381 6382 link.bind('focus', function () { 6383 navActive = nav.hasClass('js-nav-active'); 6384 touchNavActive = window.TouchNav && TouchNav.isActiveOn(navItem); 6385 if (!navActive || touchNavActive) { 6386 initSimpleNav(); 6387 } 6388 item.trigger(navActive && touchNavActive ? 'itemhover' : 'mouseenter'); 6389 }).bind('blur', function () { 6390 item.trigger(navActive && touchNavActive ? 'itemleave' : 'mouseleave'); 6391 }); 6392 6393 var initSimpleNav = function () { 6394 if (!initSimpleNav.done) { 6395 initSimpleNav.done = true; 6396 item.hover(function () { 6397 clearTimeout(timer); 6398 timer = setTimeout(function () { 6399 item.addClass(options.hoverClass); 6400 }, options.delay); 6401 }, function () { 6402 clearTimeout(timer); 6403 timer = setTimeout(function () { 6404 item.removeClass(options.hoverClass); 6405 }, options.delay); 6406 }); 6407 } 6408 }; 6409 }); 6410 }); 6411 }; 6412}(jQuery)); 6413 6414/* 6415 * jQuery dotdotdot 1.6.13 6416 * 6417 * Copyright (c) Fred Heusschen 6418 * www.frebsite.nl 6419 * 6420 * Plugin website: 6421 * dotdotdot.frebsite.nl 6422 * 6423 * Dual licensed under the MIT and GPL licenses. 6424 * https://en.wikipedia.org/wiki/MIT_License 6425 * https://en.wikipedia.org/wiki/GNU_General_Public_License 6426 */ 6427!function (t, e) { function n(t, e, n) { var r = t.children(), o = !1; t.empty(); for (var i = 0, d = r.length; d > i; i++) { var l = r.eq(i); if (t.append(l), n && t.append(n), a(t, e)) { l.remove(), o = !0; break } n && n.detach() } return o } function r(e, n, i, d, l) { var s = !1, c = "table, thead, tbody, tfoot, tr, col, colgroup, object, embed, param, ol, ul, dl, blockquote, select, optgroup, option, textarea, script, style", u = "script"; return e.contents().detach().each(function () { var h = this, f = t(h); if ("undefined" == typeof h || 3 == h.nodeType && 0 == t.trim(h.data).length) return !0; if (f.is(u)) e.append(f); else { if (s) return !0; e.append(f), l && e[e.is(c) ? "after" : "append"](l), a(i, d) && (s = 3 == h.nodeType ? o(f, n, i, d, l) : r(f, n, i, d, l), s || (f.detach(), s = !0)), s || l && l.detach() } }), s } function o(e, n, r, o, d) { var c = e[0]; if (!c) return !1; var h = s(c), f = -1 !== h.indexOf(" ") ? " " : " ", p = "letter" == o.wrap ? "" : f, g = h.split(p), v = -1, w = -1, b = 0, y = g.length - 1; for (o.fallbackToLetter && 0 == b && 0 == y && (p = "", g = h.split(p), y = g.length - 1); y >= b && (0 != b || 0 != y);) { var m = Math.floor((b + y) / 2); if (m == w) break; w = m, l(c, g.slice(0, w + 1).join(p) + o.ellipsis), a(r, o) ? (y = w, o.fallbackToLetter && 0 == b && 0 == y && (p = "", g = g[0].split(p), v = -1, w =
vendor: 4,444 bytes, line 6427
6427-1, b = 0, y = g.length - 1)) : (v = w, b = w) } if (-1 == v || 1 == g.length && 0 == g[0].length) { var x = e.parent(); e.detach(); var T = d && d.closest(x).length ? d.length : 0; x.contents().length > T ? c = u(x.contents().eq(-1 - T), n) : (c = u(x, n, !0), T || x.detach()), c && (h = i(s(c), o), l(c, h), T && d && t(c).parent().append(d)) } else h = i(g.slice(0, v + 1).join(p), o), l(c, h); return !0 } function a(t, e) { return t.innerHeight() > e.maxHeight } function i(e, n) { for (; t.inArray(e.slice(-1), n.lastCharacter.remove) > -1;)e = e.slice(0, -1); return t.inArray(e.slice(-1), n.lastCharacter.noEllipsis) < 0 && (e += n.ellipsis), e } function d(t) { return { width: t.innerWidth(), height: t.innerHeight() } } function l(t, e) { t.innerText ? t.innerText = e : t.nodeValue ? t.nodeValue = e : t.textContent && (t.textContent = e) } function s(t) { return t.innerText ? t.innerText : t.nodeValue ? t.nodeValue : t.textContent ? t.textContent : "" } function c(t) { do t = t.previousSibling; while (t && 1 !== t.nodeType && 3 !== t.nodeType); return t } function u(e, n, r) { var o, a = e && e[0]; if (a) { if (!r) { if (3 === a.nodeType) return a; if (t.trim(e.text())) return u(e.contents().last(), n) } for (o = c(a); !o;) { if (e = e.parent(), e.is(n) || !e.length) return !1; o = c(e[0]) } if (o) return u(t(o), n) } return !1 } function h(e, n) { return e ? "string" == typeof e ? (e = t(e, n), e.length ? e : !1) : e.jquery ? e : !1 : !1 } function f(t) { for (var e = t.innerHeight(), n = ["paddingTop", "paddingBottom"], r = 0, o = n.length; o > r; r++) { var a = parseInt(t.css(n[r]), 10); isNaN(a) && (a = 0), e -= a } return e } if (!t.fn.dotdotdot) { t.fn.dotdotdot = function (e) { if (0 == this.length) return t.fn.dotdotdot.debug('No element found for "' + this.selector + '".'), this; if (this.length > 1) return this.each(function () { t(this).dotdotdot(e) }); var o = this; o.data("dotdotdot") && o.trigger("destroy.dot"), o.data("dotdotdot-style", o.attr("style") || ""), o.css("word-wrap", "break-word"), "nowrap" === o.css("white-space") && o.css("white-space", "normal"), o.bind_events = function () { return o.bind("update.dot", function (e, d) { e.preventDefault(), e.stopPropagation(), l.maxHeight = "number" == typeof l.height ? l.height : f(o), l.maxHeight += l.tolerance, "undefined" != typeof d && (("string" == typeof d || d instanceof HTMLElement) && (d = t("<div />").append(d).contents()), d instanceof t && (i = d)), g = o.wrapInner('<div class="dotdotdot" />').children(), g.contents().detach().end().append(i.clone(!0)).find("br").replaceWith(" <br /> ").end().css({ height: "auto", width: "auto", border: "none", padding: 0, margin: 0 }); var c = !1, u = !1; return s.afterElement && (c = s.afterElement.clone(!0), c.show(), s.afterElement.detach()), a(g, l) && (u = "children" == l.wrap ? n(g, l, c) : r(g, o, g, l, c)), g.replaceWith(g.contents()), g = null, t.isFunction(l.callback) && l.callback.call(o[0], u, i), s.isTruncated = u, u }).bind("isTruncated.dot", function (t, e) { return t.preventDefault(), t.stopPropagation(), "function" == typeof e && e.call(o[0], s.isTruncated), s.isTruncated }).bind("originalContent.dot", function (t, e) { return t.preventDefault(), t.stopPropagation(), "function" == typeof e && e.call(o[0], i), i }).bind("destroy.dot", function (t) { t.preventDefault(), t.stopPropagation(), o.unwatch().unbind_events().contents().detach().end().append(i).attr("style", o.data("dotdotdot-style") || "").data("dotdotdot", !1) }), o }, o.unbind_events = function () { return o.unbind(".dot"), o }, o.watch = function () { if (o.unwatch(), "window" == l.watch) { var e = t(window), n = e.width(), r = e.height(); e.bind("resize.dot" + s.dotId, function () { n == e.width() && r == e.height() && l.windowResizeFix || (n = e.width(), r = e.height(), u && clearInterval(u), u = setTimeout(function () { o.trigger("update.dot") }, 10)) }) } else c = d(o), u = setInterval(function () { var t = d(o); (c.width != t.width || c.height != t.height) && (o.trigger("update.dot"), c = d(o)) }, 100); return o }, o.unwatch = function () { return t(window).unbind("resize.dot" + s.dotId), u && clearInterval(u), o }; var i = o.contents(), l = t.extend(!0, {}, t.fn.dotdotdot.defaults, e), s = {}, c = {}, u = null, g = null; return l.lastCharacter.remove instanceof Array || (l.lastCharacter.remove = t.fn.dotdotdot.defaultArrays.lastCharacter.remove), l.lastCharacter.n
vendor: 24,738 bytes, lines 6427-6442
6427oEllipsis instanceof Array || (l.lastCharacter.noEllipsis = t.fn.dotdotdot.defaultArrays.lastCharacter.noEllipsis), s.afterElement = h(l.after, o), s.isTruncated = !1, s.dotId = p++ , o.data("dotdotdot", !0).bind_events().trigger("update.dot"), l.watch && o.watch(), o }, t.fn.dotdotdot.defaults = { ellipsis: "... ", wrap: "word", fallbackToLetter: !0, lastCharacter: {}, tolerance: 0, callback: null, after: null, height: null, watch: !1, windowResizeFix: !0 }, t.fn.dotdotdot.defaultArrays = { lastCharacter: { remove: [" ", " ", ",", ";", ".", "!", "?"], noEllipsis: [] } }, t.fn.dotdotdot.debug = function () { }; var p = 1, g = t.fn.html; t.fn.html = function (n) { return n != e && !t.isFunction(n) && this.data("dotdotdot") ? this.trigger("update", [n]) : g.apply(this, arguments) }; var v = t.fn.text; t.fn.text = function (n) { return n != e && !t.isFunction(n) && this.data("dotdotdot") ? (n = t("<div />").text(n).html(), this.trigger("update", [n])) : v.apply(this, arguments) } } }(jQuery); 6428 6429/*! Hammer.JS - v2.0.4 - 2014-09-28 6430 * https://hammerjs.github.io/ 6431 * 6432 * Copyright (c) 2014 Jorik Tangelder; 6433 * Licensed under the MIT license */ 6434if (Object.create) { !function (a, b, c, d) { "use strict"; function e(a, b, c) { return setTimeout(k(a, c), b) } function f(a, b, c) { return Array.isArray(a) ? (g(a, c[b], c), !0) : !1 } function g(a, b, c) { var e; if (a) if (a.forEach) a.forEach(b, c); else if (a.length !== d) for (e = 0; e < a.length;)b.call(c, a[e], e, a), e++; else for (e in a) a.hasOwnProperty(e) && b.call(c, a[e], e, a) } function h(a, b, c) { for (var e = Object.keys(b), f = 0; f < e.length;)(!c || c && a[e[f]] === d) && (a[e[f]] = b[e[f]]), f++; return a } function i(a, b) { return h(a, b, !0) } function j(a, b, c) { var d, e = b.prototype; d = a.prototype = Object.create(e), d.constructor = a, d._super = e, c && h(d, c) } function k(a, b) { return function () { return a.apply(b, arguments) } } function l(a, b) { return typeof a == kb ? a.apply(b ? b[0] || d : d, b) : a } function m(a, b) { return a === d ? b : a } function n(a, b, c) { g(r(b), function (b) { a.addEventListener(b, c, !1) }) } function o(a, b, c) { g(r(b), function (b) { a.removeEventListener(b, c, !1) }) } function p(a, b) { for (; a;) { if (a == b) return !0; a = a.parentNode } return !1 } function q(a, b) { return a.indexOf(b) > -1 } function r(a) { return a.trim().split(/\s+/g) } function s(a, b, c) { if (a.indexOf && !c) return a.indexOf(b); for (var d = 0; d < a.length;) { if (c && a[d][c] == b || !c && a[d] === b) return d; d++ } return -1 } function t(a) { return Array.prototype.slice.call(a, 0) } function u(a, b, c) { for (var d = [], e = [], f = 0; f < a.length;) { var g = b ? a[f][b] : a[f]; s(e, g) < 0 && d.push(a[f]), e[f] = g, f++ } return c && (d = b ? d.sort(function (a, c) { return a[b] > c[b] }) : d.sort()), d } function v(a, b) { for (var c, e, f = b[0].toUpperCase() + b.slice(1), g = 0; g < ib.length;) { if (c = ib[g], e = c ? c + f : b, e in a) return e; g++ } return d } function w() { return ob++ } function x(a) { var b = a.ownerDocument; return b.defaultView || b.parentWindow } function y(a, b) { var c = this; this.manager = a, this.callback = b, this.element = a.element, this.target = a.options.inputTarget, this.domHandler = function (b) { l(a.options.enable, [a]) && c.handler(b) }, this.init() } function z(a) { var b, c = a.options.inputClass; return new (b = c ? c : rb ? N : sb ? Q : qb ? S : M)(a, A) } function A(a, b, c) { var d = c.pointers.length, e = c.changedPointers.length, f = b & yb && d - e === 0, g = b & (Ab | Bb) && d - e === 0; c.isFirst = !!f, c.isFinal = !!g, f && (a.session = {}), c.eventType = b, B(a, c), a.emit("hammer.input", c), a.recognize(c), a.session.prevInput = c } function B(a, b) { var c = a.session, d = b.pointers, e = d.length; c.firstInput || (c.firstInput = E(b)), e > 1 && !c.firstMultiple ? c.firstMultiple = E(b) : 1 === e && (c.firstMultiple = !1); var f = c.firstInput, g = c.firstMultiple, h = g ? g.center : f.center, i = b.center = F(d); b.timeStamp = nb(), b.deltaTime = b.timeStamp - f.timeStamp, b.angle = J(h, i), b.distance = I(h, i), C(c, b), b.offsetDirection = H(b.deltaX, b.deltaY), b.scale = g ? L(g.pointers, d) : 1, b.rotation = g ? K(g.pointers, d) : 0, D(c, b); var j = a.element; p(b.srcEvent.target, j) && (j = b.srcEvent.target), b.target = j } function C(a, b) { var c = b.center, d = a.offsetDelta || {}, e = a.prevDelta || {}, f = a.prevInput || {}; (b.eventType === yb || f.eventType === Ab) && (e = a.prevDelta = { x: f.deltaX || 0, y: f.deltaY || 0 }, d = a.offsetDelta = { x: c.x, y: c.y }), b.deltaX = e.x + (c.x - d.x), b.deltaY = e.y + (c.y - d.y) } function D(a, b) { var c, e, f, g, h = a.lastInterval || b, i = b.timeStamp - h.timeStamp; if (b.eventType != Bb && (i > xb || h.velocity === d)) { var j = h.deltaX - b.deltaX, k = h.deltaY - b.deltaY, l = G(i, j, k); e = l.x, f = l.y, c = mb(l.x) > mb(l.y) ? l.x : l.y, g = H(j, k), a.lastInterval = b } else c = h.velocity, e = h.velocityX, f = h.velocityY, g = h.direction; b.velocity = c, b.velocityX = e, b.velocityY = f, b.direction = g } function E(a) { for (var b = [], c = 0; c < a.pointers.length;)b[c] = { clientX: lb(a.pointers[c].clientX), clientY: lb(a.pointers[c].clientY) }, c++; return { timeStamp: nb(), pointers: b, center: F(b), deltaX: a.deltaX, deltaY: a.deltaY } } function F(a) { var b = a.length; if (1 === b) return { x: lb(a[0].clientX), y: lb(a[0].clientY) }; for (var c = 0, d = 0, e = 0; b > e;)c += a[e].clientX, d += a[e].clientY, e++; return { x: lb(c / b), y: lb(d / b) } } function G(a, b, c) { return { x: b / a || 0, y: c / a || 0 } } function H(a, b) { return a === b ? Cb : mb(a) >= mb(b) ? a > 0 ? Db : Eb : b > 0 ? Fb : Gb } function I(a, b, c) { c || (c = Kb); var d = b[c[0]] - a[c[0]], e = b[c[1]] - a[c[1]]; return Math.sqrt(d * d + e * e) } function J(a, b, c) { c || (c = Kb); var d = b[c[0]] - a[c[0]], e = b[c[1]] - a[c[1]]; return 180 * Math.atan2(e, d) / Math.PI } function K(a, b) { return J(b[1], b[0], Lb) - J(a[1], a[0], Lb) } function L(a, b) { return I(b[0], b[1], Lb) / I(a[0], a[1], Lb) } function M() { this.evEl = Nb, this.evWin = Ob, this.allow = !0, this.pressed = !1, y.apply(this, arguments) } function N() { this.evEl = Rb, this.evWin = Sb, y.apply(this, arguments), this.store = this.manager.session.pointerEvents = [] } function O() { this.evTarget = Ub, this.evWin = Vb, this.started = !1, y.apply(this, arguments) } function P(a, b) { var c = t(a.touches), d = t(a.changedTouches); return b & (Ab | Bb) && (c = u(c.concat(d), "identifier", !0)), [c, d] } function Q() { this.evTarget = Xb, this.targetIds = {}, y.apply(this, arguments) } function R(a, b) { var c = t(a.touches), d = this.targetIds; if (b & (yb | zb) && 1 === c.length) return d[c[0].identifier] = !0, [c, c]; var e, f, g = t(a.changedTouches), h = [], i = this.target; if (f = c.filter(function (a) { return p(a.target, i) }), b === yb) for (e = 0; e < f.length;)d[f[e].identifier] = !0, e++; for (e = 0; e < g.length;)d[g[e].identifier] && h.push(g[e]), b & (Ab | Bb) && delete d[g[e].identifier], e++; return h.length ? [u(f.concat(h), "identifier", !0), h] : void 0 } function S() { y.apply(this, arguments); var a = k(this.handler, this); this.touch = new Q(this.manager, a), this.mouse = new M(this.manager, a) } function T(a, b) { this.manager = a, this.set(b) } function U(a) { if (q(a, bc)) return bc; var b = q(a, cc), c = q(a, dc); return b && c ? cc + " " + dc : b || c ? b ? cc : dc : q(a, ac) ? ac : _b } function V(a) { this.id = w(), this.manager = null, this.options = i(a || {}, this.defaults), this.options.enable = m(this.options.enable, !0), this.state = ec, this.simultaneous = {}, this.requireFail = [] } function W(a) { return a & jc ? "cancel" : a & hc ? "end" : a & gc ? "move" : a & fc ? "start" : "" } function X(a) { return a == Gb ? "down" : a == Fb ? "up" : a == Db ? "left" : a == Eb ? "right" : "" } function Y(a, b) { var c = b.manager; return c ? c.get(a) : a } function Z() { V.apply(this, arguments) } function $() { Z.apply(this, arguments), this.pX = null, this.pY = null } function _() { Z.apply(this, arguments) } function ab() { V.apply(this, arguments), this._timer = null, this._input = null } function bb() { Z.apply(this, arguments) } function cb() { Z.apply(this, arguments) } function db() { V.apply(this, arguments), this.pTime = !1, this.pCenter = !1, this._timer = null, this._input = null, this.count = 0 } function eb(a, b) { return b = b || {}, b.recognizers = m(b.recognizers, eb.defaults.preset), new fb(a, b) } function fb(a, b) { b = b || {}, this.options = i(b, eb.defaults), this.options.inputTarget = this.options.inputTarget || a, this.handlers = {}, this.session = {}, this.recognizers = [], this.element = a, this.input = z(this), this.touchAction = new T(this, this.options.touchAction), gb(this, !0), g(b.recognizers, function (a) { var b = this.add(new a[0](a[1])); a[2] && b.recognizeWith(a[2]), a[3] && b.requireFailure(a[3]) }, this) } function gb(a, b) { var c = a.element; g(a.options.cssProps, function (a, d) { c.style[v(c.style, d)] = b ? a : "" }) } function hb(a, c) { var d = b.createEvent("Event"); d.initEvent(a, !0, !0), d.gesture = c, c.target.dispatchEvent(d) } var ib = ["", "webkit", "moz", "MS", "ms", "o"], jb = b.createElement("div"), kb = "function", lb = Math.round, mb = Math.abs, nb = Date.now, ob = 1, pb = /mobile|tablet|ip(ad|hone|od)|android/i, qb = "ontouchstart" in a, rb = v(a, "PointerEvent") !== d, sb = qb && pb.test(navigator.userAgent), tb = "touch", ub = "pen", vb = "mouse", wb = "kinect", xb = 25, yb = 1, zb = 2, Ab = 4, Bb = 8, Cb = 1, Db = 2, Eb = 4, Fb = 8, Gb = 16, Hb = Db | Eb, Ib = Fb | Gb, Jb = Hb | Ib, Kb = ["x", "y"], Lb = ["clientX", "clientY"]; y.prototype = { handler: function () { }, init: function () { this.evEl && n(this.element, this.evEl, this.domHandler), this.evTarget && n(this.target, this.evTarget, this.domHandler), this.evWin && n(x(this.element), this.evWin, this.domHandler) }, destroy: function () { this.evEl && o(this.element, this.evEl, this.domHandler), this.evTarget && o(this.target, this.evTarget, this.domHandler), this.evWin && o(x(this.element), this.evWin, this.domHandler) } }; var Mb = { mousedown: yb, mousemove: zb, mouseup: Ab }, Nb = "mousedown", Ob = "mousemove mouseup"; j(M, y, { handler: function (a) { var b = Mb[a.type]; b & yb && 0 === a.button && (this.pressed = !0), b & zb && 1 !== a.which && (b = Ab), this.pressed && this.allow && (b & Ab && (this.pressed = !1), this.callback(this.manager, b, { pointers: [a], changedPointers: [a], pointerType: vb, srcEvent: a })) } }); var Pb = { pointerdown: yb, pointermove: zb, pointerup: Ab, pointercancel: Bb, pointerout: Bb }, Qb = { 2: tb, 3: ub, 4: vb, 5: wb }, Rb = "pointerdown", Sb = "pointermove pointerup pointercancel"; a.MSPointerEvent && (Rb = "MSPointerDown", Sb = "MSPointerMove MSPointerUp MSPointerCancel"), j(N, y, { handler: function (a) { var b = this.store, c = !1, d = a.type.toLowerCase().replace("ms", ""), e = Pb[d], f = Qb[a.pointerType] || a.pointerType, g = f == tb, h = s(b, a.pointerId, "pointerId"); e & yb && (0 === a.button || g) ? 0 > h && (b.push(a), h = b.length - 1) : e & (Ab | Bb) && (c = !0), 0 > h || (b[h] = a, this.callback(this.manager, e, { pointers: b, changedPointers: [a], pointerType: f, srcEvent: a }), c && b.splice(h, 1)) } }); var Tb = { touchstart: yb, touchmove: zb, touchend: Ab, touchcancel: Bb }, Ub = "touchstart", Vb = "touchstart touchmove touchend touchcancel"; j(O, y, { handler: function (a) { var b = Tb[a.type]; if (b === yb && (this.started = !0), this.started) { var c = P.call(this, a, b); b & (Ab | Bb) && c[0].length - c[1].length === 0 && (this.started = !1), this.callback(this.manager, b, { pointers: c[0], changedPointers: c[1], pointerType: tb, srcEvent: a }) } } }); var Wb = { touchstart: yb, touchmove: zb, touchend: Ab, touchcancel: Bb }, Xb = "touchstart touchmove touchend touchcancel"; j(Q, y, { handler: function (a) { var b = Wb[a.type], c = R.call(this, a, b); c && this.callback(this.manager, b, { pointers: c[0], changedPointers: c[1], pointerType: tb, srcEvent: a }) } }), j(S, y, { handler: function (a, b, c) { var d = c.pointerType == tb, e = c.pointerType == vb; if (d) this.mouse.allow = !1; else if (e && !this.mouse.allow) return; b & (Ab | Bb) && (this.mouse.allow = !0), this.callback(a, b, c) }, destroy: function () { this.touch.destroy(), this.mouse.destroy() } }); var Yb = v(jb.style, "touchAction"), Zb = Yb !== d, $b = "compute", _b = "auto", ac = "manipulation", bc = "none", cc = "pan-x", dc = "pan-y"; T.prototype = { set: function (a) { a == $b && (a = this.compute()), Zb && (this.manager.element.style[Yb] = a), this.actions = a.toLowerCase().trim() }, update: function () { this.set(this.manager.options.touchAction) }, compute: function () { var a = []; return g(this.manager.recognizers, function (b) { l(b.options.enable, [b]) && (a = a.concat(b.getTouchAction())) }), U(a.join(" ")) }, preventDefaults: function (a) { if (!Zb) { var b = a.srcEvent, c = a.offsetDirection; if (this.manager.session.prevented) return void b.preventDefault(); var d = this.actions, e = q(d, bc), f = q(d, dc), g = q(d, cc); return e || f && c & Hb || g && c & Ib ? this.preventSrc(b) : void 0 } }, preventSrc: function (a) { this.manager.session.prevented = !0, a.preventDefault() } }; var ec = 1, fc = 2, gc = 4, hc = 8, ic = hc, jc = 16, kc = 32; V.prototype = { defaults: {}, set: function (a) { return h(this.options, a), this.manager && this.manager.touchAction.update(), this }, recognizeWith: function (a) { if (f(a, "recognizeWith", this)) return this; var b = this.simultaneous; return a = Y(a, this), b[a.id] || (b[a.id] = a, a.recognizeWith(this)), this }, dropRecognizeWith: function (a) { return f(a, "dropRecognizeWith", this) ? this : (a = Y(a, this), delete this.simultaneous[a.id], this) }, requireFailure: function (a) { if (f(a, "requireFailure", this)) return this; var b = this.requireFail; return a = Y(a, this), -1 === s(b, a) && (b.push(a), a.requireFailure(this)), this }, dropRequireFailure: function (a) { if (f(a, "dropRequireFailure", this)) return this; a = Y(a, this); var b = s(this.requireFail, a); return b > -1 && this.requireFail.splice(b, 1), this }, hasRequireFailures: function () { return this.requireFail.length > 0 }, canRecognizeWith: function (a) { return !!this.simultaneous[a.id] }, emit: function (a) { function b(b) { c.manager.emit(c.options.event + (b ? W(d) : ""), a) } var c = this, d = this.state; hc > d && b(!0), b(), d >= hc && b(!0) }, tryEmit: function (a) { return this.canEmit() ? this.emit(a) : void (this.state = kc) }, canEmit: function () { for (var a = 0; a < this.requireFail.length;) { if (!(this.requireFail[a].state & (kc | ec))) return !1; a++ } return !0 }, recognize: function (a) { var b = h({}, a); return l(this.options.enable, [this, b]) ? (this.state & (ic | jc | kc) && (this.state = ec), this.state = this.process(b), void (this.state & (fc | gc | hc | jc) && this.tryEmit(b))) : (this.reset(), void (this.state = kc)) }, process: function () { }, getTouchAction: function () { }, reset: function () { } }, j(Z, V, { defaults: { pointers: 1 }, attrTest: function (a) { var b = this.options.pointers; return 0 === b || a.pointers.length === b }, process: function (a) { var b = this.state, c = a.eventType, d = b & (fc | gc), e = this.attrTest(a); return d && (c & Bb || !e) ? b | jc : d || e ? c & Ab ? b | hc : b & fc ? b | gc : fc : kc } }), j($, Z, { defaults: { event: "pan", threshold: 10, pointers: 1, direction: Jb }, getTouchAction: function () { var a = this.options.direction, b = []; return a & Hb && b.push(dc), a & Ib && b.push(cc), b }, directionTest: function (a) { var b = this.options, c = !0, d = a.distance, e = a.direction, f = a.deltaX, g = a.deltaY; return e & b.direction || (b.direction & Hb ? (e = 0 === f ? Cb : 0 > f ? Db : Eb, c = f != this.pX, d = Math.abs(a.deltaX)) : (e = 0 === g ? Cb : 0 > g ? Fb : Gb, c = g != this.pY, d = Math.abs(a.deltaY))), a.direction = e, c && d > b.threshold && e & b.direction }, attrTest: function (a) { return Z.prototype.attrTest.call(this, a) && (this.state & fc || !(this.state & fc) && this.directionTest(a)) }, emit: function (a) { this.pX = a.deltaX, this.pY = a.deltaY; var b = X(a.direction); b && this.manager.emit(this.options.event + b, a), this._super.emit.call(this, a) } }), j(_, Z, { defaults: { event: "pinch", threshold: 0, pointers: 2 }, getTouchAction: function () { return [bc] }, attrTest: function (a) { return this._super.attrTest.call(this, a) && (Math.abs(a.scale - 1) > this.options.threshold || this.state & fc) }, emit: function (a) { if (this._super.emit.call(this, a), 1 !== a.scale) { var b = a.scale < 1 ? "in" : "out"; this.manager.emit(this.options.event + b, a) } } }), j(ab, V, { defaults: { event: "press", pointers: 1, time: 500, threshold: 5 }, getTouchAction: function () { return [_b] }, process: function (a) { var b = this.options, c = a.pointers.length === b.pointers, d = a.distance < b.threshold, f = a.deltaTime > b.time; if (this._input = a, !d || !c || a.eventType & (Ab | Bb) && !f) this.reset(); else if (a.eventType & yb) this.reset(), this._timer = e(function () { this.state = ic, this.tryEmit() }, b.time, this); else if (a.eventType & Ab) return ic; return kc }, reset: function () { clearTimeout(this._timer) }, emit: function (a) { this.state === ic && (a && a.eventType & Ab ? this.manager.emit(this.options.event + "up", a) : (this._input.timeStamp = nb(), this.manager.emit(this.options.event, this._input))) } }), j(bb, Z, { defaults: { event: "rotate", threshold: 0, pointers: 2 }, getTouchAction: function () { return [bc] }, attrTest: function (a) { return this._super.attrTest.call(this, a) && (Math.abs(a.rotation) > this.options.threshold || this.state & fc) } }), j(cb, Z, { defaults: { event: "swipe", threshold: 10, velocity: .65, direction: Hb | Ib, pointers: 1 }, getTouchAction: function () { return $.prototype.getTouchAction.call(this) }, attrTest: function (a) { var b, c = this.options.direction; return c & (Hb | Ib) ? b = a.velocity : c & Hb ? b = a.velocityX : c & Ib && (b = a.velocityY), this._super.attrTest.call(this, a) && c & a.direction && a.distance > this.options.threshold && mb(b) > this.options.velocity && a.eventType & Ab }, emit: function (a) { var b = X(a.direction); b && this.manager.emit(this.options.event + b, a), this.manager.emit(this.options.event, a) } }), j(db, V, { defaults: { event: "tap", pointers: 1, taps: 1, interval: 300, time: 250, threshold: 2, posThreshold: 10 }, getTouchAction: function () { return [ac] }, process: function (a) { var b = this.options, c = a.pointers.length === b.pointers, d = a.distance < b.threshold, f = a.deltaTime < b.time; if (this.reset(), a.eventType & yb && 0 === this.count) return this.failTimeout(); if (d && f && c) { if (a.eventType != Ab) return this.failTimeout(); var g = this.pTime ? a.timeStamp - this.pTime < b.interval : !0, h = !this.pCenter || I(this.pCenter, a.center) < b.posThreshold; this.pTime = a.timeStamp, this.pCenter = a.center, h && g ? this.count += 1 : this.count = 1, this._input = a; var i = this.count % b.taps; if (0 === i) return this.hasRequireFailures() ? (this._timer = e(function () { this.state = ic, this.tryEmit() }, b.interval, this), fc) : ic } return kc }, failTimeout: function () { return this._timer = e(function () { this.state = kc }, this.options.interval, this), kc }, reset: function () { clearTimeout(this._timer) }, emit: function () { this.state == ic && (this._input.tapCount = this.count, this.manager.emit(this.options.event, this._input)) } }), eb.VERSION = "2.0.4", eb.defaults = { domEvents: !1, touchAction: $b, enable: !0, inputTarget: null, inputClass: null, preset: [[bb, { enable: !1 }], [_, { enable: !1 }, ["rotate"]], [cb, { direction: Hb }], [$, { direction: Hb }, ["swipe"]], [db], [db, { event: "doubletap", taps: 2 }, ["tap"]], [ab]], cssProps: { userSelect: "none", touchSelect: "none", touchCallout: "none", contentZooming: "none", userDrag: "none", tapHighlightColor: "rgba(0,0,0,0)" } }; var lc = 1, mc = 2; fb.prototype = { set: function (a) { return h(this.options, a), a.touchAction && this.touchAction.update(), a.inputTarget && (this.input.destroy(), this.input.target = a.inputTarget, this.input.init()), this }, stop: function (a) { this.session.stopped = a ? mc : lc }, recognize: function (a) { var b = this.session; if (!b.stopped) { this.touchAction.preventDefaults(a); var c, d = this.recognizers, e = b.curRecognizer; (!e || e && e.state & ic) && (e = b.curRecognizer = null); for (var f = 0; f < d.length;)c = d[f], b.stopped === mc || e && c != e && !c.canRecognizeWith(e) ? c.reset() : c.recognize(a), !e && c.state & (fc | gc | hc) && (e = b.curRecognizer = c), f++ } }, get: function (a) { if (a instanceof V) return a; for (var b = this.recognizers, c = 0; c < b.length; c++)if (b[c].options.event == a) return b[c]; return null }, add: function (a) { if (f(a, "add", this)) return this; var b = this.get(a.options.event); return b && this.remove(b), this.recognizers.push(a), a.manager = this, this.touchAction.update(), a }, remove: function (a) { if (f(a, "remove", this)) return this; var b = this.recognizers; return a = this.get(a), b.splice(s(b, a), 1), this.touchAction.update(), this }, on: function (a, b) { var c = this.handlers; return g(r(a), function (a) { c[a] = c[a] || [], c[a].push(b) }), this }, off: function (a, b) { var c = this.handlers; return g(r(a), function (a) { b ? c[a].splice(s(c[a], b), 1) : delete c[a] }), this }, emit: function (a, b) { this.options.domEvents && hb(a, b); var c = this.handlers[a] && this.handlers[a].slice(); if (c && c.length) { b.type = a, b.preventDefault = function () { b.srcEvent.preventDefault() }; for (var d = 0; d < c.length;)c[d](b), d++ } }, destroy: function () { this.element && gb(this, !1), this.handlers = {}, this.session = {}, this.input.destroy(), this.element = null } }, h(eb, { INPUT_START: yb, INPUT_MOVE: zb, INPUT_END: Ab, INPUT_CANCEL: Bb, STATE_POSSIBLE: ec, STATE_BEGAN: fc, STATE_CHANGED: gc, STATE_ENDED: hc, STATE_RECOGNIZED: ic, STATE_CANCELLED: jc, STATE_FAILED: kc, DIRECTION_NONE: Cb, DIRECTION_LEFT: Db, DIRECTION_RIGHT: Eb, DIRECTION_UP: Fb, DIRECTION_DOWN: Gb, DIRECTION_HORIZONTAL: Hb, DIRECTION_VERTICAL: Ib, DIRECTION_ALL: Jb, Manager: fb, Input: y, TouchAction: T, TouchInput: Q, MouseInput: M, PointerEventInput: N, TouchMouseInput: S, SingleTouchInput: O, Recognizer: V, AttrRecognizer: Z, Tap: db, Pan: $, Swipe: cb, Pinch: _, Rotate: bb, Press: ab, on: n, off: o, each: g, merge: i, extend: h, inherit: j, bindFn: k, prefixed: v }), typeof define == kb && define.amd ? define(function () { return eb }) : "undefined" != typeof module && module.exports ? module.exports = eb : a[c] = eb }(window, document, "Hammer"); } 6435 6436/*! jQuery UI - v1.11.2 - 2014-11-09 6437* https://jqueryui.com 6438* Includes: core.js, datepicker.js 6439* Copyright 2014 jQuery Foundation and other contributors; Licensed MIT */ 6440 6441(function (e) { "function" == typeof define && define.amd ? define(["jquery"], e) : e(jQuery) })(function (e) { 6442 function t(t, s) { var a, n, r, o = t.nodeName.toLowerCase(); return "area" === o ? (a = t.parentNode, n = a.name, t.href && n && "map" === a.nodeName.toLowerCase() ? (r = e("img[usemap='#" + n + "']")[0], !!r && i(r)) : !1) : (/input|select|textarea|button|object/.test(o) ? !t.disabled : "a" === o ? t.href || s : s) && i(t) } function i(t) { return e.expr.filters.visible(t) && !e(t).parents().addBack().filter(function () { return "hidden" === e.css(this, "visibility") }).length } function s(e) { for (var t, i; e.length && e[0] !== document;) { if (t = e.css("position"), ("absolute" === t || "relative" === t || "fixed" === t) && (i = parseInt(e.css("zIndex"), 10), !isNaN(i) && 0 !== i)) return i; e = e.parent() } return 0 } function a() { this._curInst = null, this._keyEvent = !1, this._disabledInputs = [], this._datepickerShowing = !1, this._inDialog = !1, this._mainDivId = "ui-datepicker-div", this._inlineClass = "ui-datepicker-inline", this._appendClass = "ui-datepicker-append", this._triggerClass = "ui-datepicker-trigger", this._dialogClass = "ui-datepicker-dialog", this._disableClass = "ui-datepicker-disabled", this._unselectableClass = "ui-datepicker-unselectable", this._currentClass = "ui-datepicker-current-day", this._dayOverClass = "ui-datepicker-days-cell-over", this.regional = [], this.regional[""] = { closeText: "Done", prevText: "Prev", nextText: "Next", currentText: "Today", monthNames: ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "
vendor: 9,940 bytes, lines 6442-6443
6442November", "December"], monthNamesShort: ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"], dayNames: ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"], dayNamesShort: ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"], dayNamesMin: ["Su", "Mo", "Tu", "We", "Th", "Fr", "Sa"], weekHeader: "Wk", dateFormat: "mm/dd/yy", firstDay: 0, isRTL: !1, showMonthAfterYear: !1, yearSuffix: "" }, this._defaults = { showOn: "focus", showAnim: "fadeIn", showOptions: {}, defaultDate: null, appendText: "", buttonText: "...", buttonImage: "", buttonImageOnly: !1, hideIfNoPrevNext: !1, navigationAsDateFormat: !1, gotoCurrent: !1, changeMonth: !1, changeYear: !1, yearRange: "c-10:c+10", showOtherMonths: !1, selectOtherMonths: !1, showWeek: !1, calculateWeek: this.iso8601Week, shortYearCutoff: "+10", minDate: null, maxDate: null, duration: "fast", beforeShowDay: null, beforeShow: null, onSelect: null, onChangeMonthYear: null, onClose: null, numberOfMonths: 1, showCurrentAtPos: 0, stepMonths: 1, stepBigMonths: 12, altField: "", altFormat: "", constrainInput: !0, showButtonPanel: !1, autoSize: !1, disabled: !1 }, e.extend(this._defaults, this.regional[""]), this.regional.en = e.extend(!0, {}, this.regional[""]), this.regional["en-US"] = e.extend(!0, {}, this.regional.en), this.dpDiv = n(e("<div id='" + this._mainDivId + "' class='ui-datepicker ui-widget ui-widget-content ui-helper-clearfix ui-corner-all'></div>")) } function n(t) { var i = "button, .ui-datepicker-prev, .ui-datepicker-next, .ui-datepicker-calendar td a"; return t.delegate(i, "mouseout", function () { e(this).removeClass("ui-state-hover"), -1 !== this.className.indexOf("ui-datepicker-prev") && e(this).removeClass("ui-datepicker-prev-hover"), -1 !== this.className.indexOf("ui-datepicker-next") && e(this).removeClass("ui-datepicker-next-hover") }).delegate(i, "mouseover", r) } function r() { e.datepicker._isDisabledDatepicker(h.inline ? h.dpDiv.parent()[0] : h.input[0]) || (e(this).parents(".ui-datepicker-calendar").find("a").removeClass("ui-state-hover"), e(this).addClass("ui-state-hover"), -1 !== this.className.indexOf("ui-datepicker-prev") && e(this).addClass("ui-datepicker-prev-hover"), -1 !== this.className.indexOf("ui-datepicker-next") && e(this).addClass("ui-datepicker-next-hover")) } function o(t, i) { e.extend(t, i); for (var s in i) null == i[s] && (t[s] = i[s]); return t } e.ui = e.ui || {}, e.extend(e.ui, { version: "1.11.2", keyCode: { BACKSPACE: 8, COMMA: 188, DELETE: 46, DOWN: 40, END: 35, ENTER: 13, ESCAPE: 27, HOME: 36, LEFT: 37, PAGE_DOWN: 34, PAGE_UP: 33, PERIOD: 190, RIGHT: 39, SPACE: 32, TAB: 9, UP: 38 } }), e.fn.extend({ scrollParent: function (t) { var i = this.css("position"), s = "absolute" === i, a = t ? /(auto|scroll|hidden)/ : /(auto|scroll)/, n = this.parents().filter(function () { var t = e(this); return s && "static" === t.css("position") ? !1 : a.test(t.css("overflow") + t.css("overflow-y") + t.css("overflow-x")) }).eq(0); return "fixed" !== i && n.length ? n : e(this[0].ownerDocument || document) }, uniqueId: function () { var e = 0; return function () { return this.each(function () { this.id || (this.id = "ui-id-" + ++e) }) } }(), removeUniqueId: function () { return this.each(function () { /^ui-id-\d+$/.test(this.id) && e(this).removeAttr("id") }) } }), e.extend(e.expr[":"], { data: e.expr.createPseudo ? e.expr.createPseudo(function (t) { return function (i) { return !!e.data(i, t) } }) : function (t, i, s) { return !!e.data(t, s[3]) }, focusable: function (i) { return t(i, !isNaN(e.attr(i, "tabindex"))) }, tabbable: function (i) { var s = e.attr(i, "tabindex"), a = isNaN(s); return (a || s >= 0) && t(i, !a) } }), e("<a>").outerWidth(1).jquery || e.each(["Width", "Height"], function (t, i) { function s(t, i, s, n) { return e.each(a, function () { i -= parseFloat(e.css(t, "padding" + this)) || 0, s && (i -= parseFloat(e.css(t, "border" + this + "Width")) || 0), n && (i -= parseFloat(e.css(t, "margin" + this)) || 0) }), i } var a = "Width" === i ? ["Left", "Right"] : ["Top", "Bottom"], n = i.toLowerCase(), r = { innerWidth: e.fn.innerWidth, innerHeight: e.fn.innerHeight, outerWidth: e.fn.outerWidth, outerHeight: e.fn.outerHeight }; e.fn["inner" + i] = function (t) { return void 0 === t ? r["inner" + i].call(this) : this.each(function () { e(this).css(n, s(this, t) + "px") }) }, e.fn["outer" + i] = function (t, a) { return "number" != typeof t ? r["outer" + i].call(this, t) : this.each(function () { e(this).css(n, s(this, t, !0, a) + "px") }) } }), e.fn.addBack || (e.fn.addBack = function (e) { return this.add(null == e ? this.prevObject : this.prevObject.filter(e)) }), e("<a>").data("a-b", "a").removeData("a-b").data("a-b") && (e.fn.removeData = function (t) { return function (i) { return arguments.length ? t.call(this, e.camelCase(i)) : t.call(this) } }(e.fn.removeData)), e.ui.ie = !!/msie [\w.]+/.exec(navigator.userAgent.toLowerCase()), e.fn.extend({ focus: function (t) { return function (i, s) { return "number" == typeof i ? this.each(function () { var t = this; setTimeout(function () { e(t).focus(), s && s.call(t) }, i) }) : t.apply(this, arguments) } }(e.fn.focus), disableSelection: function () { var e = "onselectstart" in document.createElement("div") ? "selectstart" : "mousedown"; return function () { return this.bind(e + ".ui-disableSelection", function (e) { e.preventDefault() }) } }(), enableSelection: function () { return this.unbind(".ui-disableSelection") }, zIndex: function (t) { if (void 0 !== t) return this.css("zIndex", t); if (this.length) for (var i, s, a = e(this[0]); a.length && a[0] !== document;) { if (i = a.css("position"), ("absolute" === i || "relative" === i || "fixed" === i) && (s = parseInt(a.css("zIndex"), 10), !isNaN(s) && 0 !== s)) return s; a = a.parent() } return 0 } }), e.ui.plugin = { add: function (t, i, s) { var a, n = e.ui[t].prototype; for (a in s) n.plugins[a] = n.plugins[a] || [], n.plugins[a].push([i, s[a]]) }, call: function (e, t, i, s) { var a, n = e.plugins[t]; if (n && (s || e.element[0].parentNode && 11 !== e.element[0].parentNode.nodeType)) for (a = 0; n.length > a; a++)e.options[n[a][0]] && n[a][1].apply(e.element, i) } }, e.extend(e.ui, { datepicker: { version: "1.11.2" } }); var h; e.extend(a.prototype, { 6443 markerClassName: "hasDatepicker", maxRows: 4, _widgetDatepicker: function () { return this.dpDiv }, setDefaults: function (e) { return o(this._defaults, e || {}), this }, _attachDatepicker: function (t, i) { var s, a, n; s = t.nodeName.toLowerCase(), a = "div" === s || "span" === s, t.id || (this.uuid += 1, t.id = "dp" + this.uuid), n = this._newInst(e(t), a), n.settings = e.extend({}, i || {}), "input" === s ? this._connectDatepicker(t, n) : a && this._inlineDatepicker(t, n) }, _newInst: function (t, i) { var s = t[0].id.replace(/([^A-Za-z0-9_\-])/g, "\\\\$1"); return { id: s, input: t, selectedDay: 0, selectedMonth: 0, selectedYear: 0, drawMonth: 0, drawYear: 0, inline: i, dpDiv: i ? n(e("<div class='" + this._inlineClass + " ui-datepicker ui-widget ui-widget-content ui-helper-clearfix ui-corner-all'></div>")) : this.dpDiv } }, _connectDatepicker: function (t, i) { var s = e(t); i.append = e([]), i.trigger = e([]), s.hasClass(this.markerClassName) || (this._attachments(s, i), s.addClass(this.markerClassName).keydown(this._doKeyDown).keypress(this._doKeyPress).keyup(this._doKeyUp), this._autoSize(i), e.data(t, "datepicker", i), i.settings.disabled && this._disableDatepicker(t)) }, _attachments: function (t, i) { var s, a, n, r = this._get(i, "appendText"), o = this._get(i, "isRTL"); i.append && i.append.remove(), r && (i.append = e("<span class='" + this._appendClass + "'>" + r + "</span>"), t[o ? "before" : "after"](i.append)), t.unbind("focus", this._showDatepicker), i.trigger && i.trigger.remove(), s = this._get(i, "showOn"), ("focus" === s || "both" === s) && t.focus(this._showDatepicker), ("button" === s || "both" === s) && (a = this._get(i, "buttonText"), n = this._get(i, "buttonImage"), i.trigger = e(this._get(i, "buttonImageOnly") ? e("<img/>").addClass(this._triggerClass).attr({ src: n, alt: a, title: a }) : e("<button type='button'></button>").addClass(this._triggerClass).html(n ? e("<img/>").attr({ src: n, alt: a, title: a }) : a)), t[o ? "before" : "after"](i.trigger), i.trigger.click(function () { return e.datepicker._datepickerShowing && e.datepicker._lastInput === t[0] ? e.datepicker._hideDatepicker() : e.datepicker._datepickerShowing && e.datepicker._lastInput !== t[0] ? (e.datepicker._hideDatepicker(), e.datepicker._showDatepicker(t[0])) : e.datepicker._showDatepicker(t[0]), !1 })) }, _autoSize: function (e) { if (this._get(e, "autoSize") && !e.inline) { var t, i, s, a, n = new Date(2009, 11, 20), r = this._get(e, "dateFormat"); r.match(/[DM]/) && (t = function (e) { for (i = 0, s = 0, a = 0; e.length > a; a++)e[a].length > i && (i = e[a].length, s = a); return s }, n.setMonth(t(this._get(e, r.match(/MM/) ? "monthNames" : "monthNamesShort"))), n.setDate(t(this._get(e, r.match(/DD/) ? "dayNames" : "dayNamesShort")) + 20 - n.getDay())), e.input.attr("size", this._formatDate(e, n).length) } }, _inlineDatepicker: function (t, i) { var s = e(t); s.hasClass(this.markerClassName) || (s.addClass(this.markerClassName).append(i.dpDiv), e.data(t, "datepicker", i), this._setDate(i, this._getDefaultDate(i), !0), this._updateDatepicker(i), this._updateAlternate(i), i.settings.disabled && this._disableDatepicker(t), i.dpDiv.css("display", "block")) }, _dialogDatepicker: function (t, i, s, a, n) { var r, h, l, u, d, c = this._dialogInst; return c || (this.uuid += 1, r = "dp" + this.uuid, this._dialogInput = e("<input type='text' id='" + r + "' style='position: absolute; top: -100px; width: 0px;'/>"), this._dialogInput.keydown(this._doKeyDown), e("body").append(this._dialogInput), c = this._dialogInst = this._newInst(this._dialogInput, !1), c.settings = {}
vendor: 6,837 bytes, line 6443
6443, e.data(this._dialogInput[0], "datepicker", c)), o(c.settings, a || {}), i = i && i.constructor === Date ? this._formatDate(c, i) : i, this._dialogInput.val(i), this._pos = n ? n.length ? n : [n.pageX, n.pageY] : null, this._pos || (h = document.documentElement.clientWidth, l = document.documentElement.clientHeight, u = document.documentElement.scrollLeft || document.body.scrollLeft, d = document.documentElement.scrollTop || document.body.scrollTop, this._pos = [h / 2 - 100 + u, l / 2 - 150 + d]), this._dialogInput.css("left", this._pos[0] + 20 + "px").css("top", this._pos[1] + "px"), c.settings.onSelect = s, this._inDialog = !0, this.dpDiv.addClass(this._dialogClass), this._showDatepicker(this._dialogInput[0]), e.blockUI && e.blockUI(this.dpDiv), e.data(this._dialogInput[0], "datepicker", c), this }, _destroyDatepicker: function (t) { var i, s = e(t), a = e.data(t, "datepicker"); s.hasClass(this.markerClassName) && (i = t.nodeName.toLowerCase(), e.removeData(t, "datepicker"), "input" === i ? (a.append.remove(), a.trigger.remove(), s.removeClass(this.markerClassName).unbind("focus", this._showDatepicker).unbind("keydown", this._doKeyDown).unbind("keypress", this._doKeyPress).unbind("keyup", this._doKeyUp)) : ("div" === i || "span" === i) && s.removeClass(this.markerClassName).empty()) }, _enableDatepicker: function (t) { var i, s, a = e(t), n = e.data(t, "datepicker"); a.hasClass(this.markerClassName) && (i = t.nodeName.toLowerCase(), "input" === i ? (t.disabled = !1, n.trigger.filter("button").each(function () { this.disabled = !1 }).end().filter("img").css({ opacity: "1.0", cursor: "" })) : ("div" === i || "span" === i) && (s = a.children("." + this._inlineClass), s.children().removeClass("ui-state-disabled"), s.find("select.ui-datepicker-month, select.ui-datepicker-year").prop("disabled", !1)), this._disabledInputs = e.map(this._disabledInputs, function (e) { return e === t ? null : e })) }, _disableDatepicker: function (t) { var i, s, a = e(t), n = e.data(t, "datepicker"); a.hasClass(this.markerClassName) && (i = t.nodeName.toLowerCase(), "input" === i ? (t.disabled = !0, n.trigger.filter("button").each(function () { this.disabled = !0 }).end().filter("img").css({ opacity: "0.5", cursor: "default" })) : ("div" === i || "span" === i) && (s = a.children("." + this._inlineClass), s.children().addClass("ui-state-disabled"), s.find("select.ui-datepicker-month, select.ui-datepicker-year").prop("disabled", !0)), this._disabledInputs = e.map(this._disabledInputs, function (e) { return e === t ? null : e }), this._disabledInputs[this._disabledInputs.length] = t) }, _isDisabledDatepicker: function (e) { if (!e) return !1; for (var t = 0; this._disabledInputs.length > t; t++)if (this._disabledInputs[t] === e) return !0; return !1 }, _getInst: function (t) { try { return e.data(t, "datepicker") } catch (i) { throw "Missing instance data for this datepicker" } }, _optionDatepicker: function (t, i, s) { var a, n, r, h, l = this._getInst(t); return 2 === arguments.length && "string" == typeof i ? "defaults" === i ? e.extend({}, e.datepicker._defaults) : l ? "all" === i ? e.extend({}, l.settings) : this._get(l, i) : null : (a = i || {}, "string" == typeof i && (a = {}, a[i] = s), l && (this._curInst === l && this._hideDatepicker(), n = this._getDateDatepicker(t, !0), r = this._getMinMaxDate(l, "min"), h = this._getMinMaxDate(l, "max"), o(l.settings, a), null !== r && void 0 !== a.dateFormat && void 0 === a.minDate && (l.settings.minDate = this._formatDate(l, r)), null !== h && void 0 !== a.dateFormat && void 0 === a.maxDate && (l.settings.maxDate = this._formatDate(l, h)), "disabled" in a && (a.disabled ? this._disableDatepicker(t) : this._enableDatepicker(t)), this._attachments(e(t), l), this._autoSize(l), this._setDate(l, n), this._updateAlternate(l), this._updateDatepicker(l)), void 0) }, _changeDatepicker: function (e, t, i) { this._optionDatepicker(e, t, i) }, _refreshDatepicker: function (e) { var t = this._getInst(e); t && this._updateDatepicker(t) }, _setDateDatepicker: function (e, t) { var i = this._getInst(e); i && (this._setDate(i, t), this._updateDatepicker(i), this._updateAlternate(i)) }, _getDateDatepicker: function (e, t) { var i = this._getInst(e); return i && !i.inline && this._setDateFromField(i, t), i ? this._getDate(i) : null }, _doKeyDown: function (t) { var i, s, a, n = e.datepicker._getInst(t.target), r = !0, o = n.dpDiv.is(".ui-datepicker-rtl"); if (n._keyEvent = !0, e.datepicker._datepickerShowing) switch (t.keyCode) { case 9: e.datepicker._hideDatepicker(), r = !1; break; case 13: return a = e("td." + e.datepicker._dayOverClass + ":not(." + e.datepicker._currentClass + ")", n.dpDiv), a[0] && e.datepicker._selectDay(t.target, n.selectedMonth, n.selectedYear, a[0]), i = e.datepicker._get(n, "onSelect"), i ? (s = e.datepicker._formatDate(n), i.apply(n.input ? n.input[0] : null, [s, n])) : e.datepicker._hideDatepicker(), !1; case 27: e.datepicker._hideDatepicker(); break; case 33: e.datepicker._adjustDate(t.target, t.ctrlKey ? -e.datepicker._get(n, "stepBigMonths") : -e.datepicker._get(n, "stepMonths"), "M"); break; case 34: e.datepicker._adjustDate(t.target, t.ctrlKey ? +e.datepicker._get(n, "stepBigMonths") : +e.datepicker._get(n, "stepMonths"), "M"); break; case 35: (t.ctrlKey || t.metaKey) && e.datepicker._clearDate(t.target), r = t.ctrlKey || t.metaKey; break; case 36: (t.ctrlKey || t.metaKey) && e.datepicker._gotoToday(t.target), r = t.ctrlKey || t.metaKey; break; case 37: (t.ctrlKey || t.metaKey) && e.datepicker._adjustDate(t.target, o ? 1 : -1, "D"), r = t.ctrlKey || t.metaKey, t.originalEvent.altKey && e.datepicker._adjustDate(t.target, t.ctrlKey ? -e.datepicker._get(n, "stepBigMonths") : -e.datepicker._get(n, "stepMonths"), "M"); break; case 38: (t.ctrlKey || t.metaKey) && e.datepicker._adjustDate(t.target, -7, "D"), r = t.ctrlKey || t.metaKey; break; case 39: (t.ctrlKey || t.metaKey) && e.datepicker._adjustDate(t.target, o ? -1 : 1, "D"), r = t.ctrlKey || t.metaKey, t.originalEvent.altKey && e.datepicker._adjustDate(t.target, t.ctrlKey ? +e.datepicker._get(n, "stepBigMonths") : +e.datepicker._get(n, "stepMonths"), "M"); break; case 40: (t.ctrlKey || t.metaKey) && e.datepicker._adjustDate(t.target, 7, "D"), r = t.ctrlKey || t.metaKey; break; default: r = !1 } else 36 === t.keyCode && t.ctrlKey ? e.datepicker._showDatepicker(this) : r = !1; r && (t.preventDefault(), t.stopPropagation()) }, _doKeyPress: function (t) { var i, s, a = e.datepicker._getInst(t.target); return e.datepicker._get(a, "constrainInput") ? (i = e.datepicker._possibleChars(e.datepicker._get(a, "dateFormat")), s = String.fromCharCode(null == t.charCode ? t.keyCode : t.charCode), t.ctrlKey || t.metaKey || " " > s || !i || i.indexOf(s) > -1) : void 0 }, _doKeyUp: function (t) { var i, s = e.datepicker._getInst(t.target);
vendor: 27,817 bytes, lines 6443-6455
6443 if (s.input.val() !== s.lastVal) try { i = e.datepicker.parseDate(e.datepicker._get(s, "dateFormat"), s.input ? s.input.val() : null, e.datepicker._getFormatConfig(s)), i && (e.datepicker._setDateFromField(s), e.datepicker._updateAlternate(s), e.datepicker._updateDatepicker(s)) } catch (a) { } return !0 }, _showDatepicker: function (t) { if (t = t.target || t, "input" !== t.nodeName.toLowerCase() && (t = e("input", t.parentNode)[0]), !e.datepicker._isDisabledDatepicker(t) && e.datepicker._lastInput !== t) { var i, a, n, r, h, l, u; i = e.datepicker._getInst(t), e.datepicker._curInst && e.datepicker._curInst !== i && (e.datepicker._curInst.dpDiv.stop(!0, !0), i && e.datepicker._datepickerShowing && e.datepicker._hideDatepicker(e.datepicker._curInst.input[0])), a = e.datepicker._get(i, "beforeShow"), n = a ? a.apply(t, [t, i]) : {}, n !== !1 && (o(i.settings, n), i.lastVal = null, e.datepicker._lastInput = t, e.datepicker._setDateFromField(i), e.datepicker._inDialog && (t.value = ""), e.datepicker._pos || (e.datepicker._pos = e.datepicker._findPos(t), e.datepicker._pos[1] += t.offsetHeight), r = !1, e(t).parents().each(function () { return r |= "fixed" === e(this).css("position"), !r }), h = { left: e.datepicker._pos[0], top: e.datepicker._pos[1] }, e.datepicker._pos = null, i.dpDiv.empty(), i.dpDiv.css({ position: "absolute", display: "block", top: "-1000px" }), e.datepicker._updateDatepicker(i), h = e.datepicker._checkOffset(i, h, r), i.dpDiv.css({ position: e.datepicker._inDialog && e.blockUI ? "static" : r ? "fixed" : "absolute", display: "none", left: h.left + "px", top: h.top + "px" }), i.inline || (l = e.datepicker._get(i, "showAnim"), u = e.datepicker._get(i, "duration"), i.dpDiv.css("z-index", s(e(t)) + 1), e.datepicker._datepickerShowing = !0, e.effects && e.effects.effect[l] ? i.dpDiv.show(l, e.datepicker._get(i, "showOptions"), u) : i.dpDiv[l || "show"](l ? u : null), e.datepicker._shouldFocusInput(i) && i.input.focus(), e.datepicker._curInst = i)) } }, _updateDatepicker: function (t) { this.maxRows = 4, h = t, t.dpDiv.empty().append(this._generateHTML(t)), this._attachHandlers(t); var i, s = this._getNumberOfMonths(t), a = s[1], n = 17, o = t.dpDiv.find("." + this._dayOverClass + " a"); o.length > 0 && r.apply(o.get(0)), t.dpDiv.removeClass("ui-datepicker-multi-2 ui-datepicker-multi-3 ui-datepicker-multi-4").width(""), a > 1 && t.dpDiv.addClass("ui-datepicker-multi-" + a).css("width", n * a + "em"), t.dpDiv[(1 !== s[0] || 1 !== s[1] ? "add" : "remove") + "Class"]("ui-datepicker-multi"), t.dpDiv[(this._get(t, "isRTL") ? "add" : "remove") + "Class"]("ui-datepicker-rtl"), t === e.datepicker._curInst && e.datepicker._datepickerShowing && e.datepicker._shouldFocusInput(t) && t.input.focus(), t.yearshtml && (i = t.yearshtml, setTimeout(function () { i === t.yearshtml && t.yearshtml && t.dpDiv.find("select.ui-datepicker-year:first").replaceWith(t.yearshtml), i = t.yearshtml = null }, 0)) }, _shouldFocusInput: function (e) { return e.input && e.input.is(":visible") && !e.input.is(":disabled") && !e.input.is(":focus") }, _checkOffset: function (t, i, s) { var a = t.dpDiv.outerWidth(), n = t.dpDiv.outerHeight(), r = t.input ? t.input.outerWidth() : 0, o = t.input ? t.input.outerHeight() : 0, h = document.documentElement.clientWidth + (s ? 0 : e(document).scrollLeft()), l = document.documentElement.clientHeight + (s ? 0 : e(document).scrollTop()); return i.left -= this._get(t, "isRTL") ? a - r : 0, i.left -= s && i.left === t.input.offset().left ? e(document).scrollLeft() : 0, i.top -= s && i.top === t.input.offset().top + o ? e(document).scrollTop() : 0, i.left -= Math.min(i.left, i.left + a > h && h > a ? Math.abs(i.left + a - h) : 0), i.top -= Math.min(i.top, i.top + n > l && l > n ? Math.abs(n + o) : 0), i }, _findPos: function (t) { for (var i, s = this._getInst(t), a = this._get(s, "isRTL"); t && ("hidden" === t.type || 1 !== t.nodeType || e.expr.filters.hidden(t));)t = t[a ? "previousSibling" : "nextSibling"]; return i = e(t).offset(), [i.left, i.top] }, _hideDatepicker: function (t) { var i, s, a, n, r = this._curInst; !r || t && r !== e.data(t, "datepicker") || this._datepickerShowing && (i = this._get(r, "showAnim"), s = this._get(r, "duration"), a = function () { e.datepicker._tidyDialog(r) }, e.effects && (e.effects.effect[i] || e.effects[i]) ? r.dpDiv.hide(i, e.datepicker._get(r, "showOptions"), s, a) : r.dpDiv["slideDown" === i ? "slideUp" : "fadeIn" === i ? "fadeOut" : "hide"](i ? s : null, a), i || a(), this._datepickerShowing = !1, n = this._get(r, "onClose"), n && n.apply(r.input ? r.input[0] : null, [r.input ? r.input.val() : "", r]), this._lastInput = null, this._inDialog && (this._dialogInput.css({ position: "absolute", left: "0", top: "-100px" }), e.blockUI && (e.unblockUI(), e("body").append(this.dpDiv))), this._inDialog = !1) }, _tidyDialog: function (e) { e.dpDiv.removeClass(this._dialogClass).unbind(".ui-datepicker-calendar") }, _checkExternalClick: function (t) { if (e.datepicker._curInst) { var i = e(t.target), s = e.datepicker._getInst(i[0]); (i[0].id !== e.datepicker._mainDivId && 0 === i.parents("#" + e.datepicker._mainDivId).length && !i.hasClass(e.datepicker.markerClassName) && !i.closest("." + e.datepicker._triggerClass).length && e.datepicker._datepickerShowing && (!e.datepicker._inDialog || !e.blockUI) || i.hasClass(e.datepicker.markerClassName) && e.datepicker._curInst !== s) && e.datepicker._hideDatepicker() } }, _adjustDate: function (t, i, s) { var a = e(t), n = this._getInst(a[0]); this._isDisabledDatepicker(a[0]) || (this._adjustInstDate(n, i + ("M" === s ? this._get(n, "showCurrentAtPos") : 0), s), this._updateDatepicker(n)) }, _gotoToday: function (t) { var i, s = e(t), a = this._getInst(s[0]); this._get(a, "gotoCurrent") && a.currentDay ? (a.selectedDay = a.currentDay, a.drawMonth = a.selectedMonth = a.currentMonth, a.drawYear = a.selectedYear = a.currentYear) : (i = new Date, a.selectedDay = i.getDate(), a.drawMonth = a.selectedMonth = i.getMonth(), a.drawYear = a.selectedYear = i.getFullYear()), this._notifyChange(a), this._adjustDate(s) }, _selectMonthYear: function (t, i, s) { var a = e(t), n = this._getInst(a[0]); n["selected" + ("M" === s ? "Month" : "Year")] = n["draw" + ("M" === s ? "Month" : "Year")] = parseInt(i.options[i.selectedIndex].value, 10), this._notifyChange(n), this._adjustDate(a) }, _selectDay: function (t, i, s, a) { var n, r = e(t); e(a).hasClass(this._unselectableClass) || this._isDisabledDatepicker(r[0]) || (n = this._getInst(r[0]), n.selectedDay = n.currentDay = e("a", a).html(), n.selectedMonth = n.currentMonth = i, n.selectedYear = n.currentYear = s, this._selectDate(t, this._formatDate(n, n.currentDay, n.currentMonth, n.currentYear))) }, _clearDate: function (t) { var i = e(t); this._selectDate(i, "") }, _selectDate: function (t, i) { var s, a = e(t), n = this._getInst(a[0]); i = null != i ? i : this._formatDate(n), n.input && n.input.val(i), this._updateAlternate(n), s = this._get(n, "onSelect"), s ? s.apply(n.input ? n.input[0] : null, [i, n]) : n.input && n.input.trigger("change"), n.inline ? this._updateDatepicker(n) : (this._hideDatepicker(), this._lastInput = n.input[0], "object" != typeof n.input[0] && n.input.focus(), this._lastInput = null) }, _updateAlternate: function (t) { var i, s, a, n = this._get(t, "altField"); n && (i = this._get(t, "altFormat") || this._get(t, "dateFormat"), s = this._getDate(t), a = this.formatDate(i, s, this._getFormatConfig(t)), e(n).each(function () { e(this).val(a) })) }, noWeekends: function (e) { var t = e.getDay(); return [t > 0 && 6 > t, ""] }, iso8601Week: function (e) { var t, i = new Date(e.getTime()); return i.setDate(i.getDate() + 4 - (i.getDay() || 7)), t = i.getTime(), i.setMonth(0), i.setDate(1), Math.floor(Math.round((t - i) / 864e5) / 7) + 1 }, parseDate: function (t, i, s) { if (null == t || null == i) throw "Invalid arguments"; if (i = "object" == typeof i ? "" + i : i + "", "" === i) return null; var a, n, r, o, h = 0, l = (s ? s.shortYearCutoff : null) || this._defaults.shortYearCutoff, u = "string" != typeof l ? l : (new Date).getFullYear() % 100 + parseInt(l, 10), d = (s ? s.dayNamesShort : null) || this._defaults.dayNamesShort, c = (s ? s.dayNames : null) || this._defaults.dayNames, p = (s ? s.monthNamesShort : null) || this._defaults.monthNamesShort, f = (s ? s.monthNames : null) || this._defaults.monthNames, m = -1, g = -1, v = -1, y = -1, b = !1, _ = function (e) { var i = t.length > a + 1 && t.charAt(a + 1) === e; return i && a++ , i }, x = function (e) { var t = _(e), s = "@" === e ? 14 : "!" === e ? 20 : "y" === e && t ? 4 : "o" === e ? 3 : 2, a = "y" === e ? s : 1, n = RegExp("^\\d{" + a + "," + s + "}"), r = i.substring(h).match(n); if (!r) throw "Missing number at position " + h; return h += r[0].length, parseInt(r[0], 10) }, k = function (t, s, a) { var n = -1, r = e.map(_(t) ? a : s, function (e, t) { return [[t, e]] }).sort(function (e, t) { return -(e[1].length - t[1].length) }); if (e.each(r, function (e, t) { var s = t[1]; return i.substr(h, s.length).toLowerCase() === s.toLowerCase() ? (n = t[0], h += s.length, !1) : void 0 }), -1 !== n) return n + 1; throw "Unknown name at position " + h }, w = function () { if (i.charAt(h) !== t.charAt(a)) throw "Unexpected literal at position " + h; h++ }; for (a = 0; t.length > a; a++)if (b) "'" !== t.charAt(a) || _("'") ? w() : b = !1; else switch (t.charAt(a)) { case "d": v = x("d"); break; case "D": k("D", d, c); break; case "o": y = x("o"); break; case "m": g = x("m"); break; case "M": g = k("M", p, f); break; case "y": m = x("y"); break; case "@": o = new Date(x("@")), m = o.getFullYear(), g = o.getMonth() + 1, v = o.getDate(); break; case "!": o = new Date((x("!") - this._ticksTo1970) / 1e4), m = o.getFullYear(), g = o.getMonth() + 1, v = o.getDate(); break; case "'": _("'") ? w() : b = !0; break; default: w() }if (i.length > h && (r = i.substr(h), !/^\s+/.test(r))) throw "Extra/unparsed characters found in date: " + r; if (-1 === m ? m = (new Date).getFullYear() : 100 > m && (m += (new Date).getFullYear() - (new Date).getFullYear() % 100 + (u >= m ? 0 : -100)), y > -1) for (g = 1, v = y; ;) { if (n = this._getDaysInMonth(m, g - 1), n >= v) break; g++ , v -= n } if (o = this._daylightSavingAdjust(new Date(m, g - 1, v)), o.getFullYear() !== m || o.getMonth() + 1 !== g || o.getDate() !== v) throw "Invalid date"; return o }, ATOM: "yy-mm-dd", COOKIE: "D, dd M yy", ISO_8601: "yy-mm-dd", RFC_822: "D, d M y", RFC_850: "DD, dd-M-y", RFC_1036: "D, d M y", RFC_1123: "D, d M yy", RFC_2822: "D, d M yy", RSS: "D, d M y", TICKS: "!", TIMESTAMP: "@", W3C: "yy-mm-dd", _ticksTo1970: 1e7 * 60 * 60 * 24 * (718685 + Math.floor(492.5) - Math.floor(19.7) + Math.floor(4.925)), formatDate: function (e, t, i) { if (!t) return ""; var s, a = (i ? i.dayNamesShort : null) || this._defaults.dayNamesShort, n = (i ? i.dayNames : null) || this._defaults.dayNames, r = (i ? i.monthNamesShort : null) || this._defaults.monthNamesShort, o = (i ? i.monthNames : null) || this._defaults.monthNames, h = function (t) { var i = e.length > s + 1 && e.charAt(s + 1) === t; return i && s++ , i }, l = function (e, t, i) { var s = "" + t; if (h(e)) for (; i > s.length;)s = "0" + s; return s }, u = function (e, t, i, s) { return h(e) ? s[t] : i[t] }, d = "", c = !1; if (t) for (s = 0; e.length > s; s++)if (c) "'" !== e.charAt(s) || h("'") ? d += e.charAt(s) : c = !1; else switch (e.charAt(s)) { case "d": d += l("d", t.getDate(), 2); break; case "D": d += u("D", t.getDay(), a, n); break; case "o": d += l("o", Math.round((new Date(t.getFullYear(), t.getMonth(), t.getDate()).getTime() - new Date(t.getFullYear(), 0, 0).getTime()) / 864e5), 3); break; case "m": d += l("m", t.getMonth() + 1, 2); break; case "M": d += u("M", t.getMonth(), r, o); break; case "y": d += h("y") ? t.getFullYear() : (10 > t.getYear() % 100 ? "0" : "") + t.getYear() % 100; break; case "@": d += t.getTime(); break; case "!": d += 1e4 * t.getTime() + this._ticksTo1970; break; case "'": h("'") ? d += "'" : c = !0; break; default: d += e.charAt(s) }return d }, _possibleChars: function (e) { var t, i = "", s = !1, a = function (i) { var s = e.length > t + 1 && e.charAt(t + 1) === i; return s && t++ , s }; for (t = 0; e.length > t; t++)if (s) "'" !== e.charAt(t) || a("'") ? i += e.charAt(t) : s = !1; else switch (e.charAt(t)) { case "d": case "m": case "y": case "@": i += "0123456789"; break; case "D": case "M": return null; case "'": a("'") ? i += "'" : s = !0; break; default: i += e.charAt(t) }return i }, _get: function (e, t) { return void 0 !== e.settings[t] ? e.settings[t] : this._defaults[t] }, _setDateFromField: function (e, t) { if (e.input.val() !== e.lastVal) { var i = this._get(e, "dateFormat"), s = e.lastVal = e.input ? e.input.val() : null, a = this._getDefaultDate(e), n = a, r = this._getFormatConfig(e); try { n = this.parseDate(i, s, r) || a } catch (o) { s = t ? "" : s } e.selectedDay = n.getDate(), e.drawMonth = e.selectedMonth = n.getMonth(), e.drawYear = e.selectedYear = n.getFullYear(), e.currentDay = s ? n.getDate() : 0, e.currentMonth = s ? n.getMonth() : 0, e.currentYear = s ? n.getFullYear() : 0, this._adjustInstDate(e) } }, _getDefaultDate: function (e) { return this._restrictMinMax(e, this._determineDate(e, this._get(e, "defaultDate"), new Date)) }, _determineDate: function (t, i, s) { var a = function (e) { var t = new Date; return t.setDate(t.getDate() + e), t }, n = function (i) { try { return e.datepicker.parseDate(e.datepicker._get(t, "dateFormat"), i, e.datepicker._getFormatConfig(t)) } catch (s) { } for (var a = (i.toLowerCase().match(/^c/) ? e.datepicker._getDate(t) : null) || new Date, n = a.getFullYear(), r = a.getMonth(), o = a.getDate(), h = /([+\-]?[0-9]+)\s*(d|D|w|W|m|M|y|Y)?/g, l = h.exec(i); l;) { switch (l[2] || "d") { case "d": case "D": o += parseInt(l[1], 10); break; case "w": case "W": o += 7 * parseInt(l[1], 10); break; case "m": case "M": r += parseInt(l[1], 10), o = Math.min(o, e.datepicker._getDaysInMonth(n, r)); break; case "y": case "Y": n += parseInt(l[1], 10), o = Math.min(o, e.datepicker._getDaysInMonth(n, r)) }l = h.exec(i) } return new Date(n, r, o) }, r = null == i || "" === i ? s : "string" == typeof i ? n(i) : "number" == typeof i ? isNaN(i) ? s : a(i) : new Date(i.getTime()); return r = r && "Invalid Date" == "" + r ? s : r, r && (r.setHours(0), r.setMinutes(0), r.setSeconds(0), r.setMilliseconds(0)), this._daylightSavingAdjust(r) }, _daylightSavingAdjust: function (e) { return e ? (e.setHours(e.getHours() > 12 ? e.getHours() + 2 : 0), e) : null }, _setDate: function (e, t, i) { var s = !t, a = e.selectedMonth, n = e.selectedYear, r = this._restrictMinMax(e, this._determineDate(e, t, new Date)); e.selectedDay = e.currentDay = r.getDate(), e.drawMonth = e.selectedMonth = e.currentMonth = r.getMonth(), e.drawYear = e.selectedYear = e.currentYear = r.getFullYear(), a === e.selectedMonth && n === e.selectedYear || i || this._notifyChange(e), this._adjustInstDate(e), e.input && e.input.val(s ? "" : this._formatDate(e)) }, _getDate: function (e) { var t = !e.currentYear || e.input && "" === e.input.val() ? null : this._daylightSavingAdjust(new Date(e.currentYear, e.currentMonth, e.currentDay)); return t }, _attachHandlers: function (t) { var i = this._get(t, "stepMonths"), s = "#" + t.id.replace(/\\\\/g, "\\"); t.dpDiv.find("[data-handler]").map(function () { var t = { prev: function () { e.datepicker._adjustDate(s, -i, "M") }, next: function () { e.datepicker._adjustDate(s, +i, "M") }, hide: function () { e.datepicker._hideDatepicker() }, today: function () { e.datepicker._gotoToday(s) }, selectDay: function () { return e.datepicker._selectDay(s, +this.getAttribute("data-month"), +this.getAttribute("data-year"), this), !1 }, selectMonth: function () { return e.datepicker._selectMonthYear(s, this, "M"), !1 }, selectYear: function () { return e.datepicker._selectMonthYear(s, this, "Y"), !1 } }; e(this).bind(this.getAttribute("data-event"), t[this.getAttribute("data-handler")]) }) }, _generateHTML: function (e) { 6444 var t, i, s, a, n, r, o, h, l, u, d, c, p, f, m, g, v, y, b, _, x, k, w, T, D, S, M, N, C, A, I, P, F, H, z, j, E, O, L, W = new Date, R = this._daylightSavingAdjust(new Date(W.getFullYear(), W.getMonth(), W.getDate())), Y = this._get(e, "isRTL"), J = this._get(e, "showButtonPanel"), B = this._get(e, "hideIfNoPrevNext"), K = this._get(e, "navigationAsDateFormat"), V = this._getNumberOfMonths(e), q = this._get(e, "showCurrentAtPos"), U = this._get(e, "stepMonths"), G = 1 !== V[0] || 1 !== V[1], Q = this._daylightSavingAdjust(e.currentDay ? new Date(e.currentYear, e.currentMonth, e.currentDay) : new Date(9999, 9, 9)), X = this._getMinMaxDate(e, "min"), $ = this._getMinMaxDate(e, "max"), Z = e.drawMonth - q, et = e.drawYear; if (0 > Z && (Z += 12, et--), $) for (t = this._daylightSavingAdjust(new Date($.getFullYear(), $.getMonth() - V[0] * V[1] + 1, $.getDate())), t = X && X > t ? X : t; this._daylightSavingAdjust(new Date(et, Z, 1)) > t;)Z-- , 0 > Z && (Z = 11, et--); for (e.drawMonth = Z, e.drawYear = et, i = this._get(e, "prevText"), i = K ? this.formatDate(i, this._daylightSavingAdjust(new Date(et, Z - U, 1)), this._getFormatConfig(e)) : i, s = this._canAdjustMonth(e, -1, et, Z) ? "<a class='ui-datepicker-prev ui-corner-all' data-handler='prev' data-event='click' title='" + i + "'><span class='ui-icon ui-icon-circle-triangle-" + (Y ? "e" : "w") + "'>" + i + "</span></a>" : B ? "" : "<a class='ui-datepicker-prev ui-corner-all ui-state-disabled' title='" + i + "'><span class='ui-icon ui-icon-circle-triangle-" + (Y ? "e" : "w") + "'>" + i + "</span></a>", a = this._get(e, "nextText"), a = K ? this.formatDate(a, this._daylightSavingAdjust(new Date(et, Z + U, 1)), this._getFormatConfig(e)) : a, n = this._canAdjustMonth(e, 1, et, Z) ? "<a class='ui-datepicker-next ui-corner-all' data-handler='next' data-event='click' title='" + a + "'><span class='ui-icon ui-icon-circle-triangle-" + (Y ? "w" : "e") + "'>" + a + "</span></a>" : B ? "" : "<a class='ui-datepicker-next ui-corner-all ui-state-disabled' title='" + a + "'><span class='ui-icon ui-icon-circle-triangle-" + (Y ? "w" : "e") + "'>" + a + "</span></a>", r = this._get(e, "currentText"), o = this._get(e, "gotoCurrent") && e.currentDay ? Q : R, r = K ? this.formatDate(r, o, this._getFormatConfig(e)) : r, h = e.inline ? "" : "<button type='button' class='ui-datepicker-close ui-state-default ui-priority-primary ui-corner-all' data-handler='hide' data-event='click'>" + this._get(e, "closeText") + "</button>", l = J ? "<div class='ui-datepicker-buttonpane ui-widget-content'>" + (Y ? h : "") + (this._isInRange(e, o) ? "<button type='button' class='ui-datepicker-current ui-state-default ui-priority-secondary ui-corner-all' data-handler='today' data-event='click'>" + r + "</button>" : "") + (Y ? "" : h) + "</div>" : "", u = parseInt(this._get(e, "firstDay"), 10), u = isNaN(u) ? 0 : u, d = this._get(e, "showWeek"), c = this._get(e, "dayNames"), p = this._get(e, "dayNamesMin"), f = this._get(e, "monthNames"), m = this._get(e, "monthNamesShort"), g = this._get(e, "beforeShowDay"), v = this._get(e, "showOtherMonths"), y = this._get(e, "selectOtherMonths"), b = this._getDefaultDate(e), _ = "", k = 0; V[0] > k; k++) { 6445 for (w = "", this.maxRows = 4, T = 0; V[1] > T; T++) { 6446 if (D = this._daylightSavingAdjust(new Date(et, Z, e.selectedDay)), S = " ui-corner-all", M = "", G) { 6447 if (M += "<div class='ui-datepicker-group", V[1] > 1) switch (T) { 6448 case 0: M += " ui-datepicker-group-first", S = " ui-corner-" + (Y ? "right" : "left"); 6449 break; case V[1] - 1: M += " ui-datepicker-group-last", S = " ui-corner-" + (Y ? "left" : "right"); break; default: M += " ui-datepicker-group-middle", S = "" 6450 }M += "'>" 6451 } for (M += "<div class='ui-datepicker-header ui-widget-header ui-helper-clearfix" + S + "'>" + (/all|left/.test(S) && 0 === k ? Y ? n : s : "") + (/all|right/.test(S) && 0 === k ? Y ? s : n : "") + this._generateMonthYearHeader(e, Z, et, X, $, k > 0 || T > 0, f, m) + "</div><table class='ui-datepicker-calendar'><thead>" + "<tr>", N = d ? "<th class='ui-datepicker-week-col'>" + this._get(e, "weekHeader") + "</th>" : "", x = 0; 7 > x; x++)C = (x + u) % 7, N += "<th scope='col'" + ((x + u + 6) % 7 >= 5 ? " class='ui-datepicker-week-end'" : "") + ">" + "<span title='" + c[C] + "'>" + p[C] + "</span></th>"; for (M += N + "</tr></thead><tbody>", A = this._getDaysInMonth(et, Z), et === e.selectedYear && Z === e.selectedMonth && (e.selectedDay = Math.min(e.selectedDay, A)), I = (this._getFirstDayOfMonth(et, Z) - u + 7) % 7, P = Math.ceil((I + A) / 7), F = G ? this.maxRows > P ? this.maxRows : P : P, this.maxRows = F, H = this._daylightSavingAdjust(new Date(et, Z, 1 - I)), z = 0; F > z; z++) { for (M += "<tr>", j = d ? "<td class='ui-datepicker-week-col'>" + this._get(e, "calculateWeek")(H) + "</td>" : "", x = 0; 7 > x; x++)E = g ? g.apply(e.input ? e.input[0] : null, [H]) : [!0, ""], O = H.getMonth() !== Z, L = O && !y || !E[0] || X && X > H || $ && H > $, j += "<td class='" + ((x + u + 6) % 7 >= 5 ? " ui-datepicker-week-end" : "") + (O ? " ui-datepicker-other-month" : "") + (H.getTime() === D.getTime() && Z === e.selectedMonth && e._keyEvent || b.getTime() === H.getTime() && b.getTime() === D.getTime() ? " " + this._dayOverClass : "") + (L ? " " + this._unselectableClass + " ui-state-disabled" : "") + (O && !v ? "" : " " + E[1] + (H.getTime() === Q.getTime() ? " " + this._currentClass : "") + (H.getTime() === R.getTime() ? " ui-datepicker-today" : "")) + "'" + (O && !v || !E[2] ? "" : " title='" + E[2].replace(/'/g, "'") + "'") + (L ? "" : " data-handler='selectDay' data-event='click' data-month='" + H.getMonth() + "' data-year='" + H.getFullYear() + "'") + ">" + (O && !v ? " " : L ? "<span class='ui-state-default'>" + H.getDate() + "</span>" : "<a class='ui-state-default" + (H.getTime() === R.getTime() ? " ui-state-highlight" : "") + (H.getTime() === Q.getTime() ? " ui-state-active" : "") + (O ? " ui-priority-secondary" : "") + "' href='#'>" + H.getDate() + "</a>") + "</td>", H.setDate(H.getDate() + 1), H = this._daylightSavingAdjust(H); M += j + "</tr>" } Z++ , Z > 11 && (Z = 0, et++), M += "</tbody></table>" + (G ? "</div>" + (V[0] > 0 && T === V[1] - 1 ? "<div class='ui-datepicker-row-break'></div>" : "") : ""), w += M 6452 } _ += w 6453 } return _ += l, e._keyEvent = !1, _ 6454 }, _generateMonthYearHeader: function (e, t, i, s, a, n, r, o) { var h, l, u, d, c, p, f, m, g = this._get(e, "changeMonth"), v = this._get(e, "changeYear"), y = this._get(e, "showMonthAfterYear"), b = "<div class='ui-datepicker-title'>", _ = ""; if (n || !g) _ += "<span class='ui-datepicker-month'>" + r[t] + "</span>"; else { for (h = s && s.getFullYear() === i, l = a && a.getFullYear() === i, _ += "<select class='ui-datepicker-month' data-handler='selectMonth' data-event='change'>", u = 0; 12 > u; u++)(!h || u >= s.getMonth()) && (!l || a.getMonth() >= u) && (_ += "<option value='" + u + "'" + (u === t ? " selected='selected'" : "") + ">" + o[u] + "</option>"); _ += "</select>" } if (y || (b += _ + (!n && g && v ? "" : " ")), !e.yearshtml) if (e.yearshtml = "", n || !v) b += "<span class='ui-datepicker-year'>" + i + "</span>"; else { for (d = this._get(e, "yearRange").split(":"), c = (new Date).getFullYear(), p = function (e) { var t = e.match(/c[+\-].*/) ? i + parseInt(e.substring(1), 10) : e.match(/[+\-].*/) ? c + parseInt(e, 10) : parseInt(e, 10); return isNaN(t) ? c : t }, f = p(d[0]), m = Math.max(f, p(d[1] || "")), f = s ? Math.max(f, s.getFullYear()) : f, m = a ? Math.min(m, a.getFullYear()) : m, e.yearshtml += "<select class='ui-datepicker-year' data-handler='selectYear' data-event='change'>"; m >= f; f++)e.yearshtml += "<option value='" + f + "'" + (f === i ? " selected='selected'" : "") + ">" + f + "</option>"; e.yearshtml += "</select>", b += e.yearshtml, e.yearshtml = null } return b += this._get(e, "yearSuffix"), y && (b += (!n && g && v ? "" : " ") + _), b += "</div>" }, _adjustInstDate: function (e, t, i) { var s = e.drawYear + ("Y" === i ? t : 0), a = e.drawMonth + ("M" === i ? t : 0), n = Math.min(e.selectedDay, this._getDaysInMonth(s, a)) + ("D" === i ? t : 0), r = this._restrictMinMax(e, this._daylightSavingAdjust(new Date(s, a, n))); e.selectedDay = r.getDate(), e.drawMonth = e.selectedMonth = r.getMonth(), e.drawYear = e.selectedYear = r.getFullYear(), ("M" === i || "Y" === i) && this._notifyChange(e) }, _restrictMinMax: function (e, t) { var i = this._getMinMaxDate(e, "min"), s = this._getMinMaxDate(e, "max"), a = i && i > t ? i : t; return s && a > s ? s : a }, _notifyChange: function (e) { var t = this._get(e, "onChangeMonthYear"); t && t.apply(e.input ? e.input[0] : null, [e.selectedYear, e.selectedMonth + 1, e]) }, _getNumberOfMonths: function (e) { var t = this._get(e, "numberOfMonths"); return null == t ? [1, 1] : "number" == typeof t ? [1, t] : t }, _getMinMaxDate: function (e, t) { return this._determineDate(e, this._get(e, t + "Date"), null) }, _getDaysInMonth: function (e, t) { return 32 - this._daylightSavingAdjust(new Date(e, t, 32)).getDate() }, _getFirstDayOfMonth: function (e, t) { return new Date(e, t, 1).getDay() }, _canAdjustMonth: function (e, t, i, s) { var a = this._getNumberOfMonths(e), n = this._daylightSavingAdjust(new Date(i, s + (0 > t ? t : a[0] * a[1]), 1)); return 0 > t && n.setDate(this._getDaysInMonth(n.getFullYear(), n.getMonth())), this._isInRange(e, n) }, _isInRange: function (e, t) { var i, s, a = this._getMinMaxDate(e, "min"), n = this._getMinMaxDate(e, "max"), r = null, o = null, h = this._get(e, "yearRange"); return h && (i = h.split(":"), s = (new Date).getFullYear(), r = parseInt(i[0], 10), o = parseInt(i[1], 10), i[0].match(/[+\-].*/) && (r += s), i[1].match(/[+\-].*/) && (o += s)), (!a || t.getTime() >= a.getTime()) && (!n || t.getTime() <= n.getTime()) && (!r || t.getFullYear() >= r) && (!o || o >= t.getFullYear()) }, _getFormatConfig: function (e) { var t = this._get(e, "shortYearCutoff"); return t = "string" != typeof t ? t : (new Date).getFullYear() % 100 + parseInt(t, 10), { shortYearCutoff: t, dayNamesShort: this._get(e, "dayNamesShort"), dayNames: this._get(e, "dayNames"), monthNamesShort: this._get(e, "monthNamesShort"), monthNames: this._get(e, "monthNames") } }, _formatDate: function (e, t, i, s) { t || (e.currentDay = e.selectedDay, e.currentMonth = e.selectedMonth, e.currentYear = e.selectedYear); var a = t ? "object" == typeof t ? t : this._daylightSavingAdjust(new Date(s, i, t)) : this._daylightSavingAdjust(new Date(e.currentYear, e.currentMonth, e.currentDay)); return this.formatDate(this._get(e, "dateFormat"), a, this._getFormatConfig(e)) } 6455 }), e.fn.datepicker = function (t) { if (!this.length) return this; e.datepicker.initialized || (e(document).mousedown(e.datepicker._checkExternalClick), e.datepicker.initialized = !0), 0 === e("#" + e.datepicker._mainDivId).length && e("body").append(e.datepicker.dpDiv); var i = Array.prototype.slice.call(arguments, 1); return "string" != typeof t || "isDisabled" !== t && "getDate" !== t && "widget" !== t ? "option" === t && 2 === arguments.length && "string" == typeof arguments[1] ? e.datepicker["_" + t + "Datepicker"].apply(e.datepicker, [this[0]].concat(i)) : this.each(function () { "string" == typeof t ? e.datepicker["_" + t + "Datepicker"].apply(e.datepicker, [this].concat(i)) : e.datepicker._attachDatepicker(this, t) }) : e.datepicker["_" + t + "Datepicker"].apply(e.datepicker, [this[0]].concat(i)) }, e.datepicker = new a, e.datepicker.initialized = !1, e.datepicker.uuid = (ne
6455w Date).getTime(), e.datepicker.version = "1.11.2", e.datepicker 6456});
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.