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