1/** 2 * Global variables 3 */ 4"use strict"; 5 6var userAgent = navigator.userAgent.toLowerCase(), 7 initialDate = new Date(), 8 9 $document = $(document), 10 $window = $(window), 11 $html = $("html"), 12 13 isDesktop = $html.hasClass("desktop"), 14 isIE = userAgent.indexOf("msie") != -1 ? parseInt(userAgent.split("msie")[1]) : userAgent.indexOf("trident") != -1 ? 11 : userAgent.indexOf("edge") != -1 ? 12 : false, 15 isMobile = /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent), 16 isTouch = "ontouchstart" in window, 17 18 plugins = { 19 pointerEvents: isIE < 11 ? "js/pointer-events.min.js" : false, 20 smoothScroll: $html.hasClass("use--smoothscroll") ? "js/smoothscroll.min.js" : false, 21 bootstrapTooltip: $("[data-toggle='tooltip']"), 22 bootstrapTabs: $(".tabs"), 23 rdParallax: $(".rd-parallax"), 24 rdAudioPlayer: $(".rd-audio"), 25 rdVideoPlayer: $(".rd-video-player"), 26 responsiveTabs: $(".responsive-tabs"), 27 rdGoogleMaps: $(".rd-google-map"), 28 rdNavbar: $(".rd-navbar"), 29 rdVideoBG: $(".rd-video"), 30 rdRange: $('.rd-range'), 31 textRotator: $(".text-rotator"), 32 owl: $(".owl-carousel"), 33 swiper: $(".swiper-slider"), 34 counter: $(".counter"), 35 flickrfeed: $(".flickr"), 36 twitterfeed: $(".twitter"), 37 progressBar: $(".progress-bar-js"), 38 isotope: $(".isotope"), 39 countDown: $(".countdown"), 40 calendar: $(".rd-calendar"), 41 facebookfeed: $(".facebook"), 42 instafeed: $(".instafeed"), 43 facebookWidget: $('#fb-root'), 44 materialTabs: $('.rd-material-tabs'), 45 filePicker: $('.rd-file-picker'), 46 fileDrop: $('.rd-file-drop'), 47 popover: $('[data-toggle="popover"]'), 48 dateCountdown: $('.DateCountdown'), 49 statefulButton: $('.btn-stateful'), 50 slick: $('.slick-slider'), 51 scroller: $(".scroll-wrap"), 52 socialite: $(".socialite"), 53 viewAnimate: $('.view-animate'), 54 selectFilter: $("select"), 55 rdInputLabel: $(".form-label"), 56 stacktable: $("[data-responsive=true]"), 57 bootstrapDateTimePicker: $("[date-time-picker]"), 58 customWaypoints: $('[data-custom-scroll-to]'), 59 photoSwipeGallery: $("[data-photo-swipe-item]"), 60 circleProgress: $(".progress-bar-circle"), 61 stepper: $("input[type='number']"), 62 radio: $("input[type='radio']"), 63 checkbox: $("input[type='checkbox']"), 64 customToggle: $("[data-custom-toggle]"), 65 rdMailForm: $(".rd-mailform"), 66 regula: $("[data-constraints]"), 67 search: $(".rd-search"), 68 searchResults: $('.rd-search-results'), 69 imgZoom: $('[mag-thumb]') 70 }; 71 72/** 73 * Initialize All Scripts 74 */ 75$document.ready(function () 76{ 77 /** 78 lang 79 */ 80 81 $('.cs-lang').click(function() 82 { 83 // lang 84 var _sp = new Array(); 85 var _urlArray = new Array; 86 _sp = location.href.split('/'); 87 for(i=0 ; i< _sp.length ; i++ ) 88 { 89 if( i==3 ) 90 { 91 _urlArray.push( $(this).attr('lang') ); 92 } 93 else 94 { 95 _urlArray.push( _sp[i] ); 96 } 97 } 98 _urlArray = _urlArray.join('/'); 99 window.location.href=_urlArray; 100 }); 101 102 103 /** 104 * getSwiperHeight 105 * @description calculate the height of swiper slider basing on data attr 106 */ 107 function getSwiperHeight(object, attr) { 108 var val = object.attr("data-" + attr), 109 dim; 110 111 if (!val) { 112 return undefined; 113 } 114 115 dim = val.match(/(px)|(%)|(vh)$/i); 116 117 if (dim.length) { 118 switch (dim[0]) { 119 case "px": 120 return parseFloat(val); 121 case "vh": 122 return $(window).height() * (parseFloat(val) / 100); 123 case "%": 124 return object.width() * (parseFloat(val) / 100); 125 } 126 } else { 127 return undefined; 128 } 129 } 130 131 /** 132 * toggleSwiperInnerVideos 133 * @description toggle swiper videos on active slides 134 */ 135 function toggleSwiperInnerVideos(swiper) { 136 var prevSlide = $(swiper.slides[swiper.previousIndex]), 137 nextSlide = $(swiper.slides[swiper.activeIndex]), 138 videos; 139 140 prevSlide.find("video").each(function () { 141 this.pause(); 142 }); 143 144 videos = nextSlide.find("video"); 145 if (videos.length) { 146 videos.get(0).play(); 147 } 148 } 149 150 /** 151 * toggleSwiperCaptionAnimation 152 * @description toggle swiper animations on active slides 153 */ 154 function toggleSwiperCaptionAnimation(swiper) { 155 var prevSlide = $(swiper.container), 156 nextSlide = $(swiper.slides[swiper.activeIndex]); 157 158 prevSlide 159 .find("[data-caption-animate]") 160 .each(function () { 161 var $this = $(this); 162 $this 163 .removeClass("animated") 164 .removeClass($this.attr("data-caption-animate")) 165 .addClass("not-animated"); 166 }); 167 168 nextSlide 169 .find("[data-caption-animate]") 170 .each(function () { 171 var $this = $(this),
172 delay = $this.attr("data-caption-delay"); 173 174 setTimeout(function () { 175 $this 176 .removeClass("not-animated") 177 .addClass($this.attr("data-caption-animate")) 178 .addClass("animated"); 179 }, delay ? parseInt(delay) : 0); 180 }); 181 } 182 183 /** 184 * makeParallax 185 * @description create swiper parallax scrolling effect 186 */ 187 function makeParallax(el, speed, wrapper, prevScroll) { 188 var scrollY = window.scrollY || window.pageYOffset; 189 190 if (prevScroll != scrollY) { 191 prevScroll = scrollY; 192 el.addClass('no-transition'); 193 el[0].style['transform'] = 'translate3d(0,' + -scrollY * (1 - speed) + 'px,0)'; 194 el.height(); 195 el.removeClass('no-transition'); 196 197 if (el.attr('data-fade') === 'true') { 198 var bound = el[0].getBoundingClientRect(), 199 offsetTop = bound.top * 2 + scrollY, 200 sceneHeight = wrapper.outerHeight(), 201 sceneDevider = wrapper.offset().top + sceneHeight / 2.0, 202 layerDevider = offsetTop + el.outerHeight() / 2.0, 203 pos = sceneHeight / 6.0, 204 opacity; 205 if (sceneDevider + pos > layerDevider && sceneDevider - pos < layerDevider) { 206 el[0].style["opacity"] = 1; 207 } else { 208 if (sceneDevider - pos < layerDevider) { 209 opacity = 1 + ((sceneDevider + pos - layerDevider) / sceneHeight / 3.0 * 5); 210 } else { 211 opacity = 1 - ((sceneDevider - pos - layerDevider) / sceneHeight / 3.0 * 5); 212 } 213 el[0].style["opacity"] = opacity < 0 ? 0 : opacity > 1 ? 1 : opacity.toFixed(2); 214 } 215 } 216 } 217 218 requestAnimationFrame(function () { 219 makeParallax(el, speed, wrapper, prevScroll); 220 }); 221 } 222 223 /** 224 * isScrolledIntoView 225 * @description check the element whas been scrolled into the view 226 */ 227 function isScrolledIntoView(elem) { 228 var $window = $(window); 229 return elem.offset().top + elem.outerHeight() >= $window.scrollTop() && elem.offset().top <= $window.scrollTop() + $window.height(); 230 } 231 232 /** 233 * initOnView 234 * @description calls a function when element has been scrolled into the view 235 */ 236 function lazyInit(element, func) { 237 var $win = jQuery(window); 238 $win.on('load scroll', function () { 239 if ((!element.hasClass('lazy-loaded') && (isScrolledIntoView(element)))) { 240 func.call(); 241 element.addClass('lazy-loaded'); 242 } 243 }); 244 } 245 246 /** 247 * Live Search 248 * @description create live search results 249 */ 250 function liveSearch(options) { 251 $('#' + options.live).removeClass('cleared').html(); 252 options.current++; 253 options.spin.addClass('loading'); 254 $.get(handler, { 255 s: decodeURI(options.term), 256 liveSearch: options.live, 257 dataType: "html", 258 liveCount: options.liveCount, 259 filter: options.filter, 260 template: options.template 261 }, function (data) { 262 options.processed++; 263 var live = $('#' + options.live); 264 if (options.processed == options.current && !live.hasClass('cleared')) { 265 live.find('> #search-results').removeClass('active'); 266 live.html(data); 267 setTimeout(function () { 268 live.find('> #search-results').addClass('active'); 269 }, 50); 270 } 271 options.spin.parents('.rd-search').find('.input-group-addon').removeClass('loading'); 272 }) 273 } 274 275 /** 276 * attachFormValidator 277 * @description attach form validation to elements 278 */ 279 function attachFormValidator(elements) { 280 for (var i = 0; i < elements.length; i++) { 281 var o = $(elements[i]), v; 282 o.addClass("form-control-has-validation").after("<span class='form-validation'></span>"); 283 v = o.parent().find(".form-validation"); 284 if (v.is(":last-child")) { 285 o.addClass("form-control-last-child"); 286 } 287 } 288 289 elements 290 .on('input change propertychange blur', function (e) { 291 var $this = $(this), results; 292 293 if (e.type != "blur") { 294 if (!$this.parent().hasClass("has-error")) { 295 return; 296 } 297 } 298 299 if ($this.parents('.rd-mailform').hasClass('success')) { 300 return; 301 } 302 303 if ((results = $this.regula('validate')).length) { 304 for (i = 0; i < results.length; i++) { 305 $this.siblings(".form-validation").text(results[i].message).parent().addClass("has-error") 306 } 307 } else { 308 $this.siblings(".form-validation").text("").parent().removeClass("has-error") 309 } 310 }) 311 .regula('bind'); 312 } 313 314 /** 315 * isValidated 316 * @description check if all elemnts pass validation 317 */ 318 function isValidated(elements) { 319 var results, errors = 0; 320 if (elements.length) { 321 for (j = 0; j < elements.length; j++) { 322 323 var $input = $(elements[j]); 324 325 if ((results = $input.regula('validate')).length) { 326 for (k = 0; k < results.length; k++) { 327 errors++; 328 $input.siblings(".form-validation").text(results[k].message).parent().addClass("has-error"); 329 } 330 } else { 331 $input.siblings(".form-validation").text("").parent().removeClass("has-error") 332 } 333 } 334 335 return errors == 0; 336 } 337 return true; 338 } 339 340 /** 341 * Init Bootstrap tooltip 342 * @description calls a function when need to init bootstrap tooltips 343 */ 344 function initBootstrapTooltip(tooltipPlacement) { 345 if (window.innerWidth < 599) { 346 plugins.bootstrapTooltip.tooltip('destroy'); 347 plugins.bootstrapTooltip.tooltip({ 348 placement: 'bottom' 349 }); 350 } else { 351 plugins.bootstrapTooltip.tooltip('destroy'); 352 plugins.bootstrapTooltip.tooltipPlacement; 353 plugins.bootstrapTooltip.tooltip(); 354 } 355 } 356 357 /** 358 * Copyright Year 359 * @description Evaluates correct copyright year 360 */ 361 var o = $("#copyright-year"); 362 if (o.length) { 363 o.text(initialDate.getFullYear()); 364 } 365 366 /** 367 * IE Polyfills 368 * @description Adds some loosing functionality to IE browsers 369 */ 370 if (isIE) { 371 if (isIE < 10) { 372 $html.addClass("lt-ie-10"); 373 } 374 375 if (isIE < 11) { 376 if (plugins.pointerEvents) { 377 $.getScript(plugins.pointerEvents) 378 .done(function () { 379 $html.addClass("ie-10"); 380 //PointerEventsPolyfill.initialize({});//bensonhu mark by kiosk 381 }); 382 } 383 } 384 385 if (isIE === 11) { 386 $("html").addClass("ie-11"); 387 } 388 389 if (isIE === 12) { 390 $("html").addClass("ie-edge"); 391 } 392 } 393 394 /** 395 * Bootstrap Tooltips 396 * @description Activate Bootstrap Tooltips 397 */ 398 if (plugins.bootstrapTooltip.length) { 399 var tooltipPlacement = plugins.bootstrapTooltip.attr('data-placement'); 400 initBootstrapTooltip(tooltipPlacement); 401 $(window).on('resize orientationchange', function () { 402 initBootstrapTooltip(tooltipPlacement); 403 }) 404 } 405 406 /** 407 * Smooth scrolling 408 * @description Enables a smooth scrolling for Google Chrome (Windows) 409 */ 410 if (plugins.smoothScroll) { 411 $.getScript(plugins.smoothScroll); 412 } 413 414 /** 415 * RD Audio player
416 * @description Enables RD Audio player plugin 417 */ 418 if (plugins.rdAudioPlayer.length > 0) { 419 var i; 420 for (i = 0; i < plugins.rdAudioPlayer.length; i++) { 421 $(plugins.rdAudioPlayer[i]).RDAudio(); 422 } 423 } 424 425 /** 426 * Text Rotator 427 * @description Enables Text Rotator plugin 428 */ 429 if (plugins.textRotator.length) { 430 var i; 431 for (i = 0; i < plugins.textRotator.length; i++) { 432 var textRotatorItem = plugins.textRotator[i]; 433 $(textRotatorItem).rotator(); 434 } 435 } 436 437 /** 438 * RD Google Maps 439 * @description Enables RD Google Maps plugin 440 */ 441 if (plugins.rdGoogleMaps.length) { 442 var i; 443 444 $.getScript("//maps.google.com/maps/api/js?key=AIzaSyAFeB0kVA6ouyJ_gEvFbMaefLy3cBCyRwo&sensor=false&libraries=geometry,places&v=3.7", function () { 445 var head = document.getElementsByTagName('head')[0], 446 insertBefore = head.insertBefore; 447 448 head.insertBefore = function (newElement, referenceElement) { 449 if (newElement.href && newElement.href.indexOf('//fonts.googleapis.com/css?family=Roboto') != -1 || newElement.innerHTML.indexOf('gm-style') != -1) { 450 return; 451 } 452 insertBefore.call(head, newElement, referenceElement); 453 }; 454 455 for (i = 0; i < plugins.rdGoogleMaps.length; i++) { 456 457 var $googleMapItem = $(plugins.rdGoogleMaps[i]); 458
459 lazyInit($googleMapItem, $.proxy(function () { 460 var $this = $(this), 461 styles = $this.attr("data-styles"); 462 463 $this.googleMap({ 464 styles: styles ? JSON.parse(styles) : [], 465 onInit: function (map) { 466 var inputAddress = $('#rd-google-map-address'); 467 468 if (inputAddress.length) { 469 var input = inputAddress; 470 var geocoder = new google.maps.Geocoder(); 471 var marker = new google.maps.Marker( 472 { 473 map: map, 474 icon: "images/gmap_marker.png", 475 } 476 ); 477 var autocomplete = new google.maps.places.Autocomplete(inputAddress[0]); 478 autocomplete.bindTo('bounds', map); 479 inputAddress.attr('placeholder', ''); 480 inputAddress.on('change', function () { 481 $("#rd-google-map-address-submit").trigger('click'); 482 }); 483 inputAddress.on('keydown', function (e) { 484 if (e.keyCode == 13) { 485 $("#rd-google-map-address-submit").trigger('click'); 486 } 487 }); 488 489 490 $("#rd-google-map-address-submit").on('click', function (e) { 491 e.preventDefault(); 492 var address = input.val(); 493 geocoder.geocode({'address': address}, function (results, status) { 494 if (status == google.maps.GeocoderStatus.OK) { 495 var latitude = results[0].geometry.location.lat(); 496 var longitude = results[0].geometry.location.lng(); 497 498 map.setCenter(new google.maps.LatLng( 499 parseFloat(latitude), 500 parseFloat(longitude) 501 )); 502 marker.setPosition(new google.maps.LatLng( 503 parseFloat(latitude), 504 parseFloat(longitude) 505 )) 506 } 507 }); 508 }); 509 } 510 } 511 }); 512 }, $googleMapItem)); 513 } 514 }); 515 } 516 517 /** 518 * Bootstrap Date time picker 519 */ 520 if (plugins.bootstrapDateTimePicker.length) { 521 var i; 522 for (i = 0; i < plugins.bootstrapDateTimePicker.length; i++) { 523 var $dateTimePicker = $(plugins.bootstrapDateTimePicker[i]); 524 var options = {}; 525 526 options['format'] = 'dddd DD MMMM YYYY - HH:mm'; 527 if ($dateTimePicker.attr("date-time-picker") == "date") { 528 options['format'] = 'dddd DD MMMM YYYY'; 529 options['minDate'] = new Date(); 530 } else if ($dateTimePicker.attr("date-time-picker") == "time") { 531 options['format'] = 'HH:mm'; 532 } 533 534 options["time"] = ($dateTimePicker.attr("date-time-picker") != "date"); 535 options["date"] = ($dateTimePicker.attr("date-time-picker") != "time"); 536 options["shortTime"] = true; 537 538 $dateTimePicker.bootstrapMaterialDatePicker(options); 539 } 540 } 541 542 /** 543 * Responsive Tabs 544 * @description Enables Responsive Tabs plugin 545 */ 546 if (plugins.responsiveTabs.length > 0) { 547 var i; 548 for (i = 0; i < plugins.responsiveTabs.length; i++) { 549 var responsiveTabsItem = $(plugins.responsiveTabs[i]); 550 responsiveTabsItem.easyResponsiveTabs({ 551 type: responsiveTabsItem.attr("data-type") === "accordion" ? "accordion" : "default" 552 }); 553 } 554 } 555 556 /** 557 * RD Instafeed 558 * @description Enables Instafeed 559 */ 560 if (plugins.instafeed.length > 0) { 561 var i; 562 for (i = 0; i < plugins.instafeed.length; i++) { 563 var instafeedItem = $(plugins.instafeed[i]); 564 instafeedItem.RDInstafeed({}); 565 } 566 } 567 568 /** 569 * RD Twitter Feed 570 * @description Enables RD Twitter Feed plugin 571 */ 572 if (plugins.twitterfeed.length > 0) { 573 var i; 574 for (i = 0; i < plugins.twitterfeed.length; i++) { 575 var twitterfeedItem = plugins.twitterfeed[i]; 576 $(twitterfeedItem).RDTwitter({}); 577 } 578 } 579 580 /** 581 * RD MaterialTabs 582 * @description Enables RD MaterialTabs plugin 583 */ 584 if (plugins.materialTabs.length) { 585 var i; 586 for (i = 0; i < plugins.materialTabs.length; i++) { 587 var materialTabsItem = plugins.materialTabs[i]; 588 $(materialTabsItem).RDMaterialTabs({}); 589 } 590 } 591 592 /** 593 * RD Facebook
594 * @description Enables RD Facebook plugin 595 */ 596 if (plugins.facebookfeed.length > 0) { 597 var i; 598 for (i = 0; i < plugins.facebookfeed.length; i++) { 599 var facebookfeedItem = plugins.facebookfeed[i]; 600 $(facebookfeedItem).RDFacebookFeed({}); 601 } 602 } 603 604 /** 605 * Facebook widget 606 * @description Enables official Facebook widget 607 */ 608 if (plugins.facebookWidget.length) { 609 lazyInit(plugins.facebookWidget, function () { 610 (function (d, s, id) { 611 var js, fjs = d.getElementsByTagName(s)[0]; 612 if (d.getElementById(id)) return; 613 js = d.createElement(s); 614 js.id = id; 615 js.src = "//connect.facebook.net/ru_RU/sdk.js#xfbml=1&version=v2.5"; 616 fjs.parentNode.insertBefore(js, fjs); 617 }(document, 'script', 'facebook-jssdk')); 618 }); 619 } 620 621 /** 622 * RD Flickr Feed 623 * @description Enables RD Flickr Feed plugin 624 */ 625 if (plugins.flickrfeed.length > 0) { 626 var i; 627 for (i = 0; i < plugins.flickrfeed.length; i++) { 628 var flickrfeedItem = $(plugins.flickrfeed[i]); 629 flickrfeedItem.RDFlickr({ 630 callback: function () { 631 var items = flickrfeedItem.find("[data-photo-swipe-item]"); 632 633 if (items.length) { 634 for (var j = 0; j < items.length; j++) { 635 var image = new Image(); 636 image.setAttribute('data-index', j); 637 image.onload = function () { 638 items[this.getAttribute('data-index')].setAttribute('data-size', this.naturalWidth + 'x' + this.naturalHeight); 639 }; 640 image.src = items[j].getAttribute('href'); 641 } 642 } 643 } 644 }); 645 } 646 } 647 648 /** 649 * Select2 650 * @description Enables select2 plugin 651 */ 652 if (plugins.selectFilter.length) { 653 var i; 654 for (i = 0; i < plugins.selectFilter.length; i++) { 655 var select = $(plugins.selectFilter[i]); 656 657 select.select2({ 658 theme: "bootstrap" 659 }).next().addClass(select.attr("class").match(/(input-sm)|(input-lg)|($)/i).toString().replace(new RegExp(",", 'g'), " ")); 660 } 661 } 662 663 /** 664 * Stepper 665 * @description Enables Stepper Plugin 666 */ 667 if (plugins.stepper.length) { 668 plugins.stepper.stepper({ 669 labels: { 670 up: "", 671 down: "" 672 } 673 }); 674 } 675 676 /** 677 * Radio 678 * @description Add custom styling options for input[type="radio"] 679 */ 680 if (plugins.radio.length) { 681 var i; 682 for (i = 0; i < plugins.radio.length; i++) { 683 var $this = $(plugins.radio[i]); 684 $this.addClass("radio-custom").after("<span class='radio-custom-dummy'></span>") 685 } 686 } 687 688 /** 689 * Checkbox 690 * @description Add custom styling options for input[type="checkbox"] 691 */ 692 if (plugins.checkbox.length) { 693 var i; 694 for (i = 0; i < plugins.checkbox.length; i++) { 695 var $this = $(plugins.checkbox[i]); 696 $this.addClass("checkbox-custom").after("<span class='checkbox-custom-dummy'></span>") 697 } 698 } 699 700 /** 701 * RD Filepicker 702 * @description Enables RD Filepicker plugin 703 */ 704 if (plugins.filePicker.length || plugins.fileDrop.length) { 705 var i; 706 for (i = 0; i < plugins.filePicker.length; i++) { 707 var filePickerItem = plugins.filePicker[i]; 708 709 $(filePickerItem).RDFilepicker({ 710 metaFieldClass: "rd-file-picker-meta" 711 }); 712 } 713 714 for (i = 0; i < plugins.fileDrop.length; i++) { 715 var fileDropItem = plugins.fileDrop[i]; 716 717 $(fileDropItem).RDFilepicker({ 718 metaFieldClass: "rd-file-drop-meta", 719 buttonClass: "rd-file-drop-btn", 720 dropZoneClass: "rd-file-drop" 721 }); 722 } 723 } 724 725 /** 726 * Popovers 727 * @description Enables Popovers plugin 728 */ 729 if (plugins.popover.length) { 730 if (window.innerWidth < 767) { 731 plugins.popover.attr('data-placement', 'bottom'); 732 plugins.popover.popover(); 733 } 734 else { 735 plugins.popover.popover(); 736 } 737 } 738 739 /** 740 * jQuery Countdown 741 * @description Enable countdown plugin 742 */ 743 if (plugins.countDown.length) { 744 var i; 745 for (i = 0; i < plugins.countDown.length; i++) { 746 var countDownItem = plugins.countDown[i], 747 d = new Date(), 748 type = countDownItem.getAttribute('data-type'), 749 time = countDownItem.getAttribute('data-time'), 750 format = countDownItem.getAttribute('data-format'), 751 settings = []; 752
753 d.setTime(Date.parse(time)).toLocaleString(); 754 settings[type] = d; 755 settings['format'] = format; 756 $(countDownItem).countdown(settings); 757 } 758 } 759 760 /** 761 * TimeCircles 762 * @description Enable TimeCircles plugin 763 */ 764 if (plugins.dateCountdown.length) { 765 var i; 766 for (i = 0; i < plugins.dateCountdown.length; i++) { 767 var dateCountdownItem = $(plugins.dateCountdown[i]), 768 time = { 769 "Days": { 770 "text": "Days", 771 "color": "#6ed3ee", 772 "show": true 773 }, 774 "Hours": { 775 "text": "Hours", 776 "color": "#6ed3ee", 777 "show": true 778 }, 779 "Minutes": { 780 "text": "Minutes", 781 "color": "#6ed3ee", 782 "show": true 783 }, 784 "Seconds": { 785 "text": "Seconds", 786 "color": "#6ed3ee", 787 "show": true 788 } 789 }; 790 $(dateCountdownItem).TimeCircles({ 791 "animation": "smooth", 792 "bg_width": 1.0, 793 "fg_width": 0.05666666666666667, 794 "circle_bg_color": "rgba(255,255,255,1)", 795 "time": time 796 }); 797 $(window).on('load resize orientationchange', function () { 798 if (window.innerWidth < 479) { 799 dateCountdownItem.TimeCircles({ 800 time: { 801 Minutes: {show: true}, 802 Seconds: {show: false} 803 } 804 }).rebuild(); 805 } else if (window.innerWidth < 767) { 806 dateCountdownItem.TimeCircles({ 807 time: { 808 Seconds: {show: false} 809 } 810 }).rebuild(); 811 } else { 812 dateCountdownItem.TimeCircles({time: time}).rebuild(); 813 } 814 }); 815 } 816 } 817 818 /** 819 * Bootstrap Buttons 820 * @description Enable Bootstrap Buttons plugin 821 */ 822 if (plugins.statefulButton.length) { 823 $(plugins.statefulButton).on('click', function () { 824 var statefulButtonLoading = $(this).button('loading'); 825 826 setTimeout(function () { 827 statefulButtonLoading.button('reset') 828 }, 2000); 829 }) 830 } 831 832 /** 833 * RD Calendar 834 * @description Enables RD Calendar plugin 835 */ 836 if (plugins.calendar.length) { 837 var i; 838 for (i = 0; i < plugins.calendar.length; i++) { 839 var calendarItem = $(plugins.calendar[i]); 840 841 calendarItem.rdCalendar({ 842 days: calendarItem.attr("data-days") ? calendarItem.attr("data-days").split(/\s?,\s?/i) : ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'], 843 month: calendarItem.attr("data-months") ? calendarItem.attr("data-months").split(/\s?,\s?/i) : ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December'] 844 }); 845 } 846 } 847 848 /** 849 * Circle Progress 850 * @description Enable Circle Progress plugin 851 */ 852 if (plugins.circleProgress.length) { 853 var i; 854 for (i = 0; i < plugins.circleProgress.length; i++) { 855 var circleProgressItem = $(plugins.circleProgress[i]); 856 $document 857 .on("scroll", function () { 858 if (!circleProgressItem.hasClass('animated')) { 859 860 var arrayGradients = circleProgressItem.attr('data-gradient').split(","); 861 862 circleProgressItem.circleProgress({ 863 value: circleProgressItem.attr('data-value'), 864 size: circleProgressItem.attr('data-size') ? circleProgressItem.attr('data-size') : 175, 865 fill: {gradient: arrayGradients, gradientAngle: Math.PI / 4}, 866 startAngle: -Math.PI / 4 * 2, 867 emptyFill: $(this).attr('data-empty-fill') ? $(this).attr('data-empty-fill') : "rgb(245,245,245)" 868 869 }).on('circle-animation-progress', function (event, progress, stepValue) { 870 $(this).find('span').text(String(stepValue.toFixed(2)).replace('0.', '').replace('1.', '1')); 871 }); 872 circleProgressItem.addClass('animated'); 873 } 874 }) 875 .trigger("scroll"); 876 } 877 } 878 879 /** 880 * Progress bar 881 * @description Enable progress bar 882 */ 883 if (plugins.progressBar.length) { 884 var i, 885 bar, 886 type; 887 888 for (i = 0; i < plugins.progressBar.length; i++) { 889 var progressItem = plugins.progressBar[i]; 890 bar = null; 891 892 if (progressItem.className.indexOf("progress-bar-horizontal") > -1) { 893 type = 'Line'; 894 } 895 896 if (progressItem.className.indexOf("progress-bar-radial") > -1) {
897 type = 'Circle'; 898 } 899 900 if (progressItem.getAttribute("data-stroke") && progressItem.getAttribute("data-value") && type) { 901 bar = new ProgressBar[type](progressItem, { 902 strokeWidth: Math.round(parseFloat(progressItem.getAttribute("data-stroke")) / progressItem.offsetWidth * 100), 903 trailWidth: progressItem.getAttribute("data-trail") ? Math.round(parseFloat(progressItem.getAttribute("data-trail")) / progressItem.offsetWidth * 100) : 0, 904 text: { 905 value: progressItem.getAttribute("data-counter") === "true" ? '0' : null, 906 className: 'progress-bar__body', 907 style: null 908 } 909 }); 910 bar.svg.setAttribute('preserveAspectRatio', "none meet"); 911 if (type === 'Line') { 912 bar.svg.setAttributeNS(null, "height", progressItem.getAttribute("data-stroke")); 913 } 914 915 bar.path.removeAttribute("stroke"); 916 bar.path.className.baseVal = "progress-bar__stroke"; 917 if (bar.trail) { 918 bar.trail.removeAttribute("stroke"); 919 bar.trail.className.baseVal = "progress-bar__trail"; 920 } 921 922 if (progressItem.getAttribute("data-easing") && !isIE) { 923 $(document) 924 .on("scroll", {"barItem": bar}, $.proxy(function (event) { 925 var bar = event.data.barItem; 926 var $this = $(this); 927 928 if (isScrolledIntoView($this) && this.className.indexOf("progress-bar--animated") === -1) { 929 this.className += " progress-bar--animated"; 930 bar.animate(parseInt($this.attr("data-value")) / 100.0, { 931 easing: $this.attr("data-easing"), 932 duration: $this.attr("data-duration") ? parseInt($this.attr("data-duration")) : 800, 933 step: function (state, b) { 934 if (b._container.className.indexOf("progress-bar-horizontal") > -1 || 935 b._container.className.indexOf("progress-bar-vertical") > -1) { 936 b.text.style.width = Math.abs(b.value() * 100).toFixed(0) + "%" 937 } 938 b.setText(Math.abs(b.value() * 100).toFixed(0)); 939 } 940 }); 941 } 942 }, progressItem)) 943 .trigger("scroll"); 944 } else { 945 bar.set(parseInt($(progressItem).attr("data-value")) / 100.0); 946 bar.setText($(progressItem).attr("data-value")); 947 if (type === 'Line') { 948 bar.text.style.width = parseInt($(progressItem).attr("data-value")) + "%"; 949 } 950 } 951 } else { 952 console.error(progressItem.className + ": progress bar type is not defined"); 953 } 954 } 955 } 956 957 /** 958 * UI To Top 959 * @description Enables ToTop Button 960 */ 961 if (isDesktop) { 962 $().UItoTop({ 963 easingType: 'easeOutQuart', 964 containerClass: 'ui-to-top fa fa-chevron-up' 965 }); 966 } 967 968 /** 969 * RD Navbar 970 * @description Enables RD Navbar plugin 971 */ 972 if (plugins.rdNavbar.length) { 973 plugins.rdNavbar.RDNavbar({ 974 stickUpClone: (plugins.rdNavbar.attr("data-stick-up-clone")) ? plugins.rdNavbar.attr("data-stick-up-clone") === 'true' : false 975 976 977 }); 978 if (plugins.rdNavbar.attr("data-body-class")) { 979 document.body.className += ' ' + plugins.rdNavbar.attr("data-body-class"); 980 } 981 } 982 983 /** 984 * ViewPort Universal 985 * @description Add class in viewport 986 */ 987 if (plugins.viewAnimate.length) { 988 var i; 989 for (i = 0; i < plugins.viewAnimate.length; i++) { 990 var $view = $(plugins.viewAnimate[i]).not('.active'); 991 $document.on("scroll", $.proxy(function () { 992 if (isScrolledIntoView(this)) { 993 this.addClass("active"); 994 } 995 }, $view)) 996 .trigger("scroll"); 997 } 998 } 999 1000 1001 /** 1002 * Swiper 3.1.7 1003 * @description Enable Swiper Slider 1004 */ 1005 if (plugins.swiper.length) { 1006 var i; 1007 for (i = 0; i < plugins.swiper.length; i++) { 1008 var s = $(plugins.swiper[i]); 1009 var pag = s.find(".swiper-pagination"), 1010 next = s.find(".swiper-button-next"), 1011 prev = s.find(".swiper-button-prev"), 1012 bar = s.find(".swiper-scrollbar"), 1013 parallax = s.parents('.rd-parallax').length, 1014 swiperSlide = s.find(".swiper-slide"); 1015 1016 for (j = 0; j < swiperSlide.length; j++) { 1017 var $this = $(swiperSlide[j]), 1018 url; 1019
1020 if (url = $this.attr("data-slide-bg")) { 1021 $this.css({ 1022 "background-image": "url(" + url + ")", 1023 "background-size": "cover" 1024 }) 1025 } 1026 } 1027 1028 swiperSlide.end() 1029 .find("[data-caption-animate]") 1030 .addClass("not-animated") 1031 .end() 1032 .swiper({ 1033 autoplay: s.attr('data-autoplay') ? s.attr('data-autoplay') === "false" ? undefined : s.attr('data-autoplay') : 5000, 1034 direction: s.attr('data-direction') ? s.attr('data-direction') : "horizontal", 1035 effect: s.attr('data-slide-effect') ? s.attr('data-slide-effect') : "slide", 1036 speed: s.attr('data-slide-speed') ? s.attr('data-slide-speed') : 600, 1037 keyboardControl: s.attr('data-keyboard') === "true", 1038 mousewheelControl: s.attr('data-mousewheel') === "true", 1039 mousewheelReleaseOnEdges: s.attr('data-mousewheel-release') === "true", 1040 nextButton: next.length ? next.get(0) : null, 1041 prevButton: prev.length ? prev.get(0) : null, 1042 pagination: pag.length ? pag.get(0) : null, 1043 paginationClickable: pag.length ? pag.attr("data-clickable") !== "false" : false, 1044 paginationBulletRender: pag.length ? pag.attr("data-index-bullet") === "true" ? function (index, className) { 1045 return '<span class="' + className + '">' + (index + 1) + '</span>'; 1046 } : null : null, 1047 scrollbar: bar.length ? bar.get(0) : null, 1048 scrollbarDraggable: bar.length ? bar.attr("data-draggable") !== "false" : true, 1049 scrollbarHide: bar.length ? bar.attr("data-draggable") === "false" : false, 1050 loop: s.attr('data-loop') !== "false", 1051 onTransitionStart: function (swiper) { 1052 toggleSwiperInnerVideos(swiper); 1053 }, 1054 onTransitionEnd: function (swiper) { 1055 toggleSwiperCaptionAnimation(swiper); 1056 }, 1057 onInit: function (swiper) { 1058 toggleSwiperInnerVideos(swiper); 1059 toggleSwiperCaptionAnimation(swiper); 1060 var swiperParalax = s.find(".swiper-parallax"); 1061 1062 for (var k = 0; k < swiperParalax.length; k++) { 1063 var $this = $(swiperParalax[k]), 1064 speed; 1065 1066 if (parallax && !isIEBrows && !isMobile) { 1067 if (speed = $this.attr("data-speed")) { 1068 makeParallax($this, speed, s, false); 1069 } 1070 } 1071 } 1072 $(window).on('resize', function () { 1073 swiper.update(true); 1074 }) 1075 } 1076 }); 1077 1078 $(window) 1079 .on("resize", function () { 1080 var mh = getSwiperHeight(s, "min-height"), 1081 h = getSwiperHeight(s, "height"); 1082 if (h) { 1083 s.css("height", mh ? mh > h ? mh : h : h); 1084 } 1085 }) 1086 .trigger("resize"); 1087 } 1088 } 1089 1090 /** 1091 * RD Video Player 1092 * @description Enables RD Video player plugin 1093 */ 1094 if (plugins.rdVideoPlayer.length) { 1095 var i; 1096 for (i = 0; i < plugins.rdVideoPlayer.length; i++) { 1097 var videoItem = plugins.rdVideoPlayer[i], 1098 volumeWrap = $(".rd-video-volume-wrap"); 1099 1100 $(videoItem).RDVideoPlayer({}); 1101 1102 volumeWrap.on("mouseenter", function () { 1103 $(this).addClass("hover") 1104 }); 1105 1106 volumeWrap.on("mouseleave", function () { 1107 $(this).removeClass("hover") 1108 }); 1109 1110 if (isTouch) { 1111 volumeWrap.find(".rd-video-volume").on("click", function () { 1112 $(this).toggleClass("hover") 1113 }); 1114 $document.on("click", function (e) { 1115 if (!$(e.target).is(volumeWrap) && $(e.target).parents(volumeWrap).length == 0) { 1116 volumeWrap.find(".rd-video-volume").removeClass("hover") 1117 } 1118 }) 1119 } 1120 } 1121 } 1122 1123 1124 /** 1125 * RD Search 1126 * @description Enables search 1127 */ 1128 if (plugins.search.length || plugins.searchResults) { 1129 var handler = "bat/rd-search.php"; 1130 var defaultTemplate = '<h5 class="search_title"><a target="_top" href="#{href}" class="search_link">#{title}</a></h5>' + 1131 '<p>...#{token}...</p>' + 1132 '<p class="match"><em>Terms matched: #{count} - URL: #{href}</em></p>'; 1133 var defaultFilter = '*.html'; 1134 1135 if (plugins.search.length) { 1136 1137 for (i = 0; i < plugins.search.length; i++) { 1138 var searchItem = $(plugins.search[i]), 1139 options = { 1140 element: searchItem, 1141 filter: (searchItem.attr('data-search-filter')) ? searchItem.attr('data-search-filter') : defaultFilter, 1142 template: (searchItem.attr('data-search-template')) ? searchItem.attr('data-search-template') : defaultTemplate, 1143 live: (searchItem.attr('data-search-live')) ? searchItem.attr('data-search-live') : false, 1144 liveCount: (searchItem.attr('data-search-live-count')) ? parseInt(searchItem.attr('data-search-live')) : 4, 1145 current: 0, processed: 0, timer: {} 1146 }; 1147 1148 if ($('.rd-navbar-search-toggle').length) { 1149 var toggle = $('.rd-navbar-search-toggle'); 1150 toggle.on('click', function () { 1151 if (!($(this).hasClass('active'))) { 1152 searchItem.find('input').val('').trigger('propertychange'); 1153 } 1154 }); 1155 } 1156 1157 if (options.live) { 1158 var clearHandler = false;
1159 1160 searchItem.find('input').on("keyup input propertychange", $.proxy(function () { 1161 this.term = this.element.find('input').val().trim(); 1162 this.spin = this.element.find('.input-group-addon'); 1163 1164 clearTimeout(this.timer); 1165 1166 if (this.term.length > 2) { 1167 this.timer = setTimeout(liveSearch(this), 200); 1168 1169 if (clearHandler == false) { 1170 clearHandler = true; 1171 1172 $("body").on("click", function (e) { 1173 if ($(e.toElement).parents('.rd-search').length == 0) { 1174 $('#rd-search-results-live').addClass('cleared').html(''); 1175 } 1176 }) 1177 } 1178 1179 } else if (this.term.length == 0) { 1180 $('#' + this.live).addClass('cleared').html(''); 1181 } 1182 }, options, this)); 1183 } 1184 1185 searchItem.submit($.proxy(function () { 1186 $('<input />').attr('type', 'hidden') 1187 .attr('name', "filter") 1188 .attr('value', this.filter) 1189 .appendTo(this.element); 1190 return true; 1191 }, options, this)) 1192 } 1193 } 1194 1195 if (plugins.searchResults.length) { 1196 var regExp = /\?.*s=([^&]+)\&filter=([^&]+)/g; 1197 var match = regExp.exec(location.search); 1198 1199 if (match != null) { 1200 $.get(handler, { 1201 s: decodeURI(match[1]), 1202 dataType: "html", 1203 filter: match[2], 1204 template: defaultTemplate, 1205 live: '' 1206 }, function (data) { 1207 plugins.searchResults.html(data); 1208 }) 1209 } 1210 } 1211 } 1212 1213 /** 1214 * Slick carousel 1215 * @description Enable Slick carousel plugin 1216 */ 1217 if (plugins.slick.length) { 1218 var i; 1219 for (i = 0; i < plugins.slick.length; i++) { 1220 var $slickItem = $(plugins.slick[i]); 1221 1222 $slickItem.slick({ 1223 slidesToScroll: parseInt($slickItem.attr('data-slide-to-scroll')) || 1, 1224 asNavFor: $slickItem.attr('data-for') || false, 1225 dots: $slickItem.attr("data-dots") == "true", 1226 infinite: $slickItem.attr("data-loop") == "true", 1227 focusOnSelect: true, 1228 arrows: $slickItem.attr("data-arrows") == "true", 1229 swipe: $slickItem.attr("data-swipe") == "true", 1230 autoplay: $slickItem.attr("data-autoplay") == "true", 1231 vertical: $slickItem.attr("data-vertical") == "true", 1232 centerMode: $slickItem.attr("data-center-mode") == "true", 1233 centerPadding: $slickItem.attr("data-center-padding") ? $slickItem.attr("data-center-padding") : '0.50', 1234 mobileFirst: true, 1235 responsive: [ 1236 { 1237 breakpoint: 0, 1238 settings: { 1239 slidesToShow: parseInt($slickItem.attr('data-items')) || 1, 1240 } 1241 }, 1242 { 1243 breakpoint: 480, 1244 settings: { 1245 slidesToShow: parseInt($slickItem.attr('data-xs-items')) || 1, 1246 } 1247 }, 1248 { 1249 breakpoint: 768, 1250 settings: { 1251 slidesToShow: parseInt($slickItem.attr('data-sm-items')) || 1, 1252 } 1253 }, 1254 { 1255 breakpoint: 992, 1256 settings: { 1257 slidesToShow: parseInt($slickItem.attr('data-md-items')) || 1, 1258 } 1259 }, 1260 { 1261 breakpoint: 1200, 1262 settings: { 1263 slidesToShow: parseInt($slickItem.attr('data-lg-items')) || 1, 1264 } 1265 } 1266 ] 1267 }) 1268 .on('afterChange', function (event, slick, currentSlide, nextSlide) { 1269 var $this = $(this), 1270 childCarousel = $this.attr('data-child'); 1271 1272 if (childCarousel) { 1273 $(childCarousel + ' .slick-slide').removeClass('slick-current'); 1274 $(childCarousel + ' .slick-slide').eq(currentSlide).addClass('slick-current'); 1275 } 1276 }); 1277 } 1278 } 1279 1280 /** 1281 * Owl carousel
1282 * @description Enables Owl carousel plugin 1283 */ 1284 if (plugins.owl.length) { 1285 var k; 1286 for (k = 0; k < plugins.owl.length; k++) { 1287 var c = $(plugins.owl[k]), 1288 responsive = {}; 1289 1290 var aliaces = ["-", "-xs-", "-sm-", "-md-", "-lg-"], 1291 values = [0, 480, 768, 992, 1200], 1292 i, j; 1293 1294 for (i = 0; i < values.length; i++) { 1295 responsive[values[i]] = {}; 1296 for (j = i; j >= -1; j--) { 1297 if (!responsive[values[i]]["items"] && c.attr("data" + aliaces[j] + "items")) { 1298 responsive[values[i]]["items"] = j < 0 ? 1 : parseInt(c.attr("data" + aliaces[j] + "items")); 1299 } 1300 if (!responsive[values[i]]["stagePadding"] && responsive[values[i]]["stagePadding"] !== 0 && c.attr("data" + aliaces[j] + "stage-padding")) { 1301 responsive[values[i]]["stagePadding"] = j < 0 ? 0 : parseInt(c.attr("data" + aliaces[j] + "stage-padding")); 1302 } 1303 if (!responsive[values[i]]["margin"] && responsive[values[i]]["margin"] !== 0 && c.attr("data" + aliaces[j] + "margin")) { 1304 responsive[values[i]]["margin"] = j < 0 ? 30 : parseInt(c.attr("data" + aliaces[j] + "margin")); 1305 } 1306 if (!responsive[values[i]]["dotsEach"] && responsive[values[i]]["dotsEach"] !== 0 && c.attr("data" + aliaces[j] + "dots-each")) { 1307 responsive[values[i]]["dotsEach"] = j < 0 ? false : parseInt(c.attr("data" + aliaces[j] + "dots-each")); 1308 } 1309 } 1310 } 1311 1312 // Create custom Pagination 1313 if (c.attr('data-dots-custom')) { 1314 c.on("initialized.owl.carousel", function (event) { 1315 var carousel = $(event.currentTarget), 1316 customPag = $(carousel.attr("data-dots-custom")), 1317 active = 0; 1318 1319 if (carousel.attr('data-active')) { 1320 active = parseInt(carousel.attr('data-active')); 1321 } 1322 1323 carousel.trigger('to.owl.carousel', [active, 300, true]); 1324 customPag.find("[data-owl-item='" + active + "']").addClass("active"); 1325 1326 customPag.find("[data-owl-item]").on('click', function (e) { 1327 e.preventDefault(); 1328 carousel.trigger('to.owl.carousel', [parseInt(this.getAttribute("data-owl-item")), 300, true]); 1329 }); 1330 1331 carousel.on("translate.owl.carousel", function (event) { 1332 customPag.find(".active").removeClass("active"); 1333 customPag.find("[data-owl-item='" + event.item.index + "']").addClass("active") 1334 }); 1335 }); 1336 } 1337 1338 // Create custom Navigation 1339 if (c.attr('data-nav-custom')) { 1340 c.on("initialized.owl.carousel", function (event) { 1341 var carousel = $(event.currentTarget), 1342 customNav = $(carousel.attr("data-nav-custom")); 1343 1344 customNav.find("[data-owl-prev]").on('click', function (e) { 1345 e.preventDefault(); 1346 carousel.trigger('prev.owl.carousel', [300]); 1347 }); 1348 1349 customNav.find("[data-owl-next]").on('click', function (e) { 1350 e.preventDefault(); 1351 carousel.trigger('next.owl.carousel', [300]); 1352 }); 1353 }); 1354 } 1355 1356 c.owlCarousel({ 1357 autoplay: c.attr("data-autoplay") === "true", 1358 loop: c.attr("data-loop") === "true", 1359 items: 1, 1360 autoplaySpeed: 600, 1361 autoplayTimeout: 3000, 1362 dotsContainer: c.attr("data-pagination-class") || false, 1363 navContainer: c.attr("data-navigation-class") || false, 1364 mouseDrag: c.attr("data-mouse-drag") === "true", 1365 nav: c.attr("data-nav") === "true", 1366 dots: c.attr("data-dots") === "true", 1367 dotsEach: c.attr("data-dots-each") ? parseInt(c.attr("data-dots-each")) : false, 1368 responsive: responsive, 1369 animateOut: c.attr("data-animation-out") || false, 1370 navText: $.parseJSON(c.attr("data-nav-text")) || [], 1371 navClass: $.parseJSON(c.attr("data-nav-class")) || ['owl-prev', 'owl-next'] 1372 }); 1373 1374 } 1375 } 1376 1377 /** 1378 * jQuery Count To 1379 * @description Enables Count To plugin 1380 */ 1381 if (plugins.counter.length) { 1382 var i; 1383 1384 for (i = 0; i < plugins.counter.length; i++) { 1385 var $counterNotAnimated = $(plugins.counter[i]).not('.animated'); 1386 $document 1387 .on("scroll", $.proxy(function () { 1388 var $this = this; 1389 1390 if ((!$this.hasClass("animated")) && (isScrolledIntoView($this))) { 1391 $this.countTo({ 1392 refreshInterval: 40, 1393 speed: $this.attr("data-speed") || 1000 1394 }); 1395 $this.addClass('animated'); 1396 } 1397 }, $counterNotAnimated)) 1398 .trigger("scroll"); 1399 } 1400 } 1401 1402 /** 1403 * Isotope
1404 * @description Enables Isotope plugin 1405 */ 1406 if (plugins.isotope.length) { 1407 var i, isogroup = []; 1408 for (i = 0; i < plugins.isotope.length; i++) { 1409 var isotopeItem = plugins.isotope[i] 1410 , iso = new Isotope(isotopeItem, { 1411 itemSelector: '.isotope-item', 1412 layoutMode: isotopeItem.getAttribute('data-isotope-layout') ? isotopeItem.getAttribute('data-isotope-layout') : 'masonry', 1413 filter: '*' 1414 }); 1415 1416 isogroup.push(iso); 1417 } 1418 1419 $(window).on('load', function () { 1420 setTimeout(function () { 1421 var i; 1422 for (i = 0; i < isogroup.length; i++) { 1423 isogroup[i].element.className += " isotope--loaded"; 1424 isogroup[i].layout(); 1425 } 1426 }, 600); 1427 }); 1428 1429 var resizeTimout; 1430 1431 $("[data-isotope-filter]").on("click", function (e) { 1432 e.preventDefault(); 1433 var filter = $(this); 1434 clearTimeout(resizeTimout); 1435 filter.parents(".isotope-filters").find('.active').removeClass("active"); 1436 filter.addClass("active"); 1437 var iso = $('.isotope[data-isotope-group="' + this.getAttribute("data-isotope-group") + '"]'); 1438 iso.isotope({ 1439 itemSelector: '.isotope-item', 1440 layoutMode: iso.attr('data-isotope-layout') ? iso.attr('data-isotope-layout') : 'masonry', 1441 filter: this.getAttribute("data-isotope-filter") == '*' ? '*' : '[data-filter*="' + this.getAttribute("data-isotope-filter") + '"]' 1442 }); 1443 }).eq(0).trigger("click") 1444 } 1445 1446 /** 1447 * WOW 1448 * @description Enables Wow animation plugin 1449 */ 1450 if (isDesktop && $html.hasClass("wow-animation") && $(".wow").length) { 1451 new WOW().init(); 1452 } 1453 1454 /** 1455 * Bootstrap tabs 1456 * @description Activate Bootstrap Tabs 1457 */ 1458 if (plugins.bootstrapTabs.length) { 1459 var i; 1460 for (i = 0; i < plugins.bootstrapTabs.length; i++) { 1461 var bootstrapTabsItem = $(plugins.bootstrapTabs[i]); 1462 1463 bootstrapTabsItem.on("click", "a", function (event) { 1464 event.preventDefault(); 1465 $(this).tab('show'); 1466 }); 1467 } 1468 } 1469 1470 /** 1471 * JQuery mousewheel plugin 1472 * @description Enables jquery mousewheel plugin 1473 */ 1474 if (plugins.scroller.length) { 1475 var i; 1476 for (i = 0; i < plugins.scroller.length; i++) { 1477 var scrollerItem = $(plugins.scroller[i]); 1478 1479 scrollerItem.mCustomScrollbar({ 1480 scrollInertia: 200, 1481 scrollButtons: {enable: true} 1482 }); 1483 } 1484 } 1485 1486 /** 1487 * Socialite v2 1488 * @description Enables Socialite v2 plugin 1489 */ 1490 if (plugins.socialite.length) { 1491 Socialite.load(); 1492 } 1493 1494 /** 1495 * RD Video 1496 * @description Enables RD Video plugin 1497 */ 1498 if (plugins.rdVideoBG.length) { 1499 var i; 1500 for (i = 0; i < plugins.rdVideoBG.length; i++) { 1501 var videoItem = $(plugins.rdVideoBG[i]); 1502 videoItem.RDVideo({}); 1503 } 1504 } 1505 1506 /** 1507 * RD Input Label 1508 * @description Enables RD Input Label Plugin 1509 */ 1510 if (plugins.rdInputLabel.length) { 1511 plugins.rdInputLabel.RDInputLabel(); 1512 } 1513 1514 /** 1515 * Regula 1516 * @description Enables Regula plugin 1517 */ 1518 if (plugins.regula.length) { 1519 attachFormValidator(plugins.regula); 1520 } 1521 1522 /** 1523 * RD Mailform 1524 */ 1525 1526 if (plugins.rdMailForm.length) { 1527 var i, j, k, 1528 msg = { 1529 'MF000': 'Successfully sent!', 1530 'MF001': 'Recipients are not set!', 1531 'MF002': 'Form will not work locally!', 1532 'MF003': 'Please, define email field in your form!', 1533 'MF004': 'Please, define type of your form!', 1534 'MF254': 'Something went wrong with PHPMailer!', 1535 'MF255': 'Aw, snap! Something went wrong.' 1536 }; 1537 for (i = 0; i < plugins.rdMailForm.length; i++) { 1538 var $form = $(plugins.rdMailForm[i]); 1539 1540 $form.attr('novalidate', 'novalidate').ajaxForm({ 1541 data: { 1542 "form-type": $form.attr("data-form-type") || "contact", 1543 "counter": i 1544 }, 1545 beforeSubmit: function () { 1546 var form = $(plugins.rdMailForm[this.extraData.counter]); 1547 var inputs = form.find("[data-constraints]"); 1548 if (isValidated(inputs)) { 1549 var output = $("#" + form.attr("data-form-output")); 1550 1551 if (output.hasClass("snackbars")) { 1552 output.html('<p><span class="icon text-middle fa fa-circle-o-notch fa-spin icon-xxs"></span><span>Sending</span></p>'); 1553 output.addClass("active"); 1554 } 1555 } else { 1556 return false;
1557 } 1558 }, 1559 error: function (result) { 1560 var output = $("#" + $(plugins.rdMailForm[this.extraData.counter]).attr("data-form-output")); 1561 output.text(msg[result]); 1562 }, 1563 success: function (result) { 1564 var form = $(plugins.rdMailForm[this.extraData.counter]), 1565 output = $("#" + form.attr("data-form-output")), 1566 $select = $form.find('select'); 1567 1568 // Clear select2 after submit form 1569 if ($select.length) { 1570 for (j = 0; j < $select.length; j++) { 1571 var $selectitem = $($select[j]); 1572 $selectitem.select2('val', null); 1573 } 1574 } 1575 1576 form.addClass('success'); 1577 result = result.length == 5 ? result : 'MF255'; 1578 output.text(msg[result]); 1579 if (result === "MF000") { 1580 if (output.hasClass("snackbars")) { 1581 output.html('<p><span class="icon text-middle mdi mdi-check icon-xxs"></span><span>' + msg[result] + '</span></p>'); 1582 } else { 1583 output.addClass("success"); 1584 output.addClass("active"); 1585 } 1586 } else { 1587 if (output.hasClass("snackbars")) { 1588 output.html(' <p class="snackbars-left"><span class="icon icon-xxs mdi mdi-alert-outline text-middle"></span><span>' + msg[result] + '</span></p>'); 1589 } else { 1590 output.addClass("error"); 1591 output.addClass("active"); 1592 } 1593 } 1594 form.clearForm(); 1595 form.find('input, textarea').blur(); 1596 1597 setTimeout(function () { 1598 output.removeClass("active"); 1599 form.removeClass('success'); 1600 }, 5000); 1601 } 1602 }); 1603 } 1604 } 1605 1606 /** 1607 * RD Range 1608 * @description Enables RD Range plugin 1609 */ 1610 if (plugins.rdRange.length) { 1611 plugins.rdRange.RDRange({}); 1612 } 1613 1614 /** 1615 * PhotoSwipe Gallery 1616 * @description Enables PhotoSwipe Gallery plugin 1617 */ 1618 if (plugins.photoSwipeGallery.length) { 1619 1620 // init image click event 1621 $document.delegate("[data-photo-swipe-item]", "click", function (event) { 1622 event.preventDefault(); 1623 1624 var $el = $(this), 1625 $galleryItems = $el.parents("[data-photo-swipe-gallery]").find("a[data-photo-swipe-item]"), 1626 pswpElement = document.querySelectorAll('.pswp')[0], 1627 encounteredItems = {}, 1628 pswpItems = [], 1629 options, 1630 pswpIndex = 0, 1631 pswp; 1632 1633 if ($galleryItems.length == 0) { 1634 $galleryItems = $el; 1635 } 1636 1637 // loop over the gallery to build up the photoswipe items 1638 $galleryItems.each(function () { 1639 var $item = $(this), 1640 src = $item.attr('href'), 1641 size = $item.attr('data-size').split('x'), 1642 pswdItem; 1643 1644 if ($item.is(':visible')) { 1645 1646 // if we have this image the first time 1647 if (!encounteredItems[src]) { 1648 // build the photoswipe item 1649 pswdItem = { 1650 src: src, 1651 w: parseInt(size[0], 10), 1652 h: parseInt(size[1], 10), 1653 el: $item // save link to element for getThumbBoundsFn 1654 }; 1655 1656 // store that we already had this item 1657 encounteredItems[src] = { 1658 item: pswdItem, 1659 index: pswpIndex 1660 }; 1661 1662 // push the item to the photoswipe list 1663 pswpItems.push(pswdItem); 1664 pswpIndex++; 1665 } 1666 } 1667 }); 1668 1669 options = { 1670 index: encounteredItems[$el.attr('href')].index, 1671 1672 getThumbBoundsFn: function (index) { 1673 var $el = pswpItems[index].el, 1674 offset = $el.offset(); 1675 1676 return { 1677 x: offset.left, 1678 y: offset.top, 1679 w: $el.width() 1680 }; 1681 } 1682 }; 1683 1684 // open the photoswipe gallery 1685 pswp = new PhotoSwipe(pswpElement, PhotoSwipeUI_Default, pswpItems, options); 1686 pswp.init(); 1687 }); 1688 } 1689 1690 1691 /** 1692 * Stacktable 1693 * @description Enables Stacktable plugin 1694 */ 1695 if (plugins.stacktable.length) { 1696 var i; 1697 for (i = 0; i < plugins.stacktable.length; i++) { 1698 var stacktableItem = $(plugins.stacktable[i]); 1699 stacktableItem.stacktable(); 1700 } 1701 } 1702 1703 /** 1704 * Custom Toggles 1705 */ 1706 if (plugins.customToggle.length) { 1707 var i; 1708 1709 for (i = 0; i < plugins.customToggle.length; i++) { 1710 var $this = $(plugins.customToggle[i]); 1711 1712 $this.on('click', $.proxy(function (event) { 1713 event.preventDefault(); 1714 var $ctx = $(this); 1715 $($ctx.attr('data-custom-toggle')).add(this).toggleClass('active'); 1716 }, $this)); 1717
1718 if ($this.attr("data-custom-toggle-disable-on-blur") === "true") { 1719 $("body").on("click", $this, function (e) { 1720 if (e.target !== e.data[0] && $(e.data.attr('data-custom-toggle')).find($(e.target)).length == 0 && e.data.find($(e.target)).length == 0) { 1721 $(e.data.attr('data-custom-toggle')).add(e.data[0]).removeClass('active'); 1722 } 1723 }) 1724 } 1725 } 1726 } 1727 1728 /** 1729 * Magnificent image zoom 1730 */ 1731 if (plugins.imgZoom.length) { 1732 var i; 1733 for (i = 0; i < plugins.imgZoom.length; i++) { 1734 var $imgZoomItem = $(plugins.imgZoom[i]); 1735 $imgZoomItem.mag(); 1736 } 1737 } 1738 1739 /** 1740 * Custom Waypoints 1741 */ 1742 if (plugins.customWaypoints.length) { 1743 var i; 1744 for (i = 0; i < plugins.customWaypoints.length; i++) { 1745 var $this = $(plugins.customWaypoints[i]); 1746 1747 $this.on('click', function (e) { 1748 e.preventDefault(); 1749 $("body, html").stop().animate({ 1750 scrollTop: $("#" + $(this).attr('data-custom-scroll-to')).offset().top 1751 }, 1000, function () { 1752 $(window).trigger("resize"); 1753 }); 1754 }); 1755 } 1756 } 1757 1758 1759 /** 1760 * RD Parallax 1761 * @description Enables RD Parallax plugin 1762 */ 1763 if (plugins.rdParallax.length) { 1764 var i; 1765 $.RDParallax(); 1766 1767 if (!isIE && !isMobile) { 1768 $(window).on("scroll", function () { 1769 for (i = 0; i < plugins.rdParallax.length; i++) { 1770 var parallax = $(plugins.rdParallax[i]); 1771 if (isScrolledIntoView(parallax)) { 1772 parallax.find(".rd-parallax-inner").css("position", "fixed"); 1773 } else { 1774 parallax.find(".rd-parallax-inner").css("position", "absolute"); 1775 } 1776 } 1777 }); 1778 } 1779 1780 $("a[href='#']").on("click", function (event) { 1781 setTimeout(function () { 1782 $(window).trigger("resize"); 1783 }, 300); 1784 }); 1785 } 1786 1787}); 1788
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.