1"use strict"; 2 3/** 4 * MessageBox 5 */ 6var messageBox = { 7 settings: { 8 modal: false, 9 autoClose: true, 10 coverBackground: 'rgba(0,0,0, 0.3)' 11 }, 12 init: function(o) { 13// var cstyle = 'display: none; background: ' + this.settings.coverBackground + '; position: fixed; z-index: 999997; top:0; left:0; right:0; bottom:0; text-align: center;'; 14// var dstyle = 'display: none; position: fixed; z-index: 999998; min-height: 200px; top:50%; margin-top: -100px; left: 20%; right: 20%;'; 15 16 if(!$('#modal').length) 17 $('body').append(` 18 <div id="modal" class="modal modal-message fade" style="display: none;" aria-hidden="true"> 19 <div class="modal-dialog"> 20 <div class="modal-content"> 21 <div class="modal-header"></div> 22 <div class="modal-title"></div> 23 <div class="modal-body"></div> 24 <div class="modal-footer"> 25 <button type="button" class="btn btn-success" data-dismiss="modal">OK</button> 26 </div> 27 </div> 28 </div> 29 </div> 30 `); 31/* 32 // if not modal, bind close event to cover 33 if(!this.settings.modal) { 34 $('#pageCover').click( function(){ 35 $('#modal').fadeOut(function(){ 36 $('#pageCover').hide(); 37 }); 38 }); 39 } 40*/ 41 }, 42 reset: function(){ 43 $('#modal').removeClass('alert-success alert-info alert-warning alert-danger').addClass('alert-info'); 44 $('#modal .message-box-title').html(''); 45 $('#modal .message-box-text').html(''); 46 }, 47 message: function( msgType, msgTitle, msgText) { 48 $('#modal').removeClass('modal-success modal-info modal-danger modal-warning').addClass('modal-' + msgType); 49 switch(msgType) { 50 case 'success': 51 $('#modal .modal-header').html('<span class="fas fa-check-circle"></span>'); 52 break; 53 case 'info': 54 $('#modal .modal-header').html('<span class="fas fa-info-circle"></span>'); 55 break; 56 case 'danger': 57 $('#modal .modal-header').html('<span class="fas fa-times-circle"></span>'); 58 break; 59 case 'warning': 60 $('#modal .modal-header').html('<span class="fas fa-exclamation-triangle"></span>'); 61 break; 62 } 63 $('#modal .modal-title').html(msgTitle); 64 $('#modal .modal-body').html(msgText); 65 66 $('#modal').modal('show'); 67 }, 68 html: function( htmlText ) { 69 $('#modal .modal-content').html(htmlText); 70 $('#modal').modal('show'); 71 }, 72 ok: function( msgTitle, msgText ) { 73 this.message( 'success', msgTitle, msgText ); 74 }, 75 ok: function( msgText ) { 76 this.message( 'success', '', msgText ); 77 }, 78 say: function( msgTitle, msgText ) { 79 this.message( 'info', msgTitle, msgText ); 80 }, 81 say: function( msgText ) { 82 this.message( 'info', '', msgText ); 83 }, 84 warn: function(msgTitle, msgText) { 85 this.message('warning', msgTitle, msgText); 86 }, 87 warn: function(msgText) { 88 this.message('warning', '', msgText); 89 }, 90 error: function(msgTitle, msgText) { 91 this.message('danger', msgTitle, msgText); 92 }, 93 error: function(msgText) { 94 this.message('danger', '', msgText); 95 } 96} 97messageBox.init(); 98 99 100(function () { 101 // Global variables 102 var 103 userAgent = navigator.userAgent.toLowerCase(), 104 initialDate = new Date(), 105 106 $document = $(document), 107 $window = $(window), 108 $html = $("html"), 109 $body = $("body"), 110 111 isDesktop = $html.hasClass("desktop"), 112 isIE = userAgent.indexOf("msie") !== -1 ? parseInt(userAgent.split("msie")[1], 10) : userAgent.indexOf("trident") !== -1 ? 11 : userAgent.indexOf("edge") !== -1 ? 12 : false, 113 isMobile = /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent), 114 windowReady = false, 115 isNoviBuilder = false, 116 livedemo = true, 117 118 plugins = { 119 bootstrapTooltip: $( '[data-toggle="tooltip"]' ), 120 bootstrapModal: $( '.modal' ), 121 bootstrapTabs: $( '.tabs-custom' ), 122 customToggle: $( '[data-custom-toggle]' ), 123 captcha: $( '.recaptcha' ), 124 campaignMonitor: $( '.campaign-mailform' ), 125 copyrightYear: $( '.copyright-year' ), 126 checkbox: $( 'input[type="checkbox"]' ), 127 isotope: $(".isotope"), 128// lightGallery: $( '[data-lightgallery="group"]' ), 129// lightGalleryItem: $( '[data-lightgallery="item"]' ), 130// lightDynamicGalleryItem: $( '[data-lightgallery="dynamic"]' ), 131 materialParallax: $( '.parallax-container' ), 132// mailchimp: $( '.mailchimp-mailform' ), 133 owl: $( '.owl-carousel' ), 134 popover: $( '[data-toggle="popover"]' ), 135 preloader: $( '.preloader' ), 136 rdNavbar: $( '.rd-navbar' ), 137// rdMailForm: $( '.rd-mailform' ), 138 rdInputLabel: $( '.form-label' ), 139 regula: $( '[data-constraints]' ), 140 radio: $( 'input[type="radio"]' ), 141 swiper: $( '.swiper-container' ), 142// search: $( '.rd-search' ), 143// searchResults: $( '.rd-search-results' ), 144 statefulButton: $( '.btn-stateful' ), 145 viewAnimate: $( '.view-animate' ), 146 venobox: $('.venobox'), 147 wow: $( '.wow' ), 148 maps: document.querySelectorAll( '.map' ), 149 counter: document.querySelectorAll( '.counter' ), 150 progressLinear: document.querySelectorAll( '.progress-linear' ), 151 progressCircle: document.querySelectorAll( '.progress-circle' ), 152 countdown: document.querySelectorAll( '.countdown' ), 153 photoUploaders: document.querySelectorAll( '.photo-uploader' ) 154 }; 155 156 /** 157 * @desc Check the element was been scrolled into the view 158 * @param {object} elem - jQuery object 159 * @return {boolean} 160 */ 161 function isScrolledIntoView ( elem ) { 162 if ( isNoviBuilder ) return true; 163 return elem.offset().top + elem.outerHeight() >= $window.scrollTop() && elem.offset().top <= $window.scrollTop() + $window.height(); 164 } 165 166 /** 167 * @desc Calls a function when element has been scrolled into the view 168 * @param {object} element - jQuery object 169 * @param {function} func - init function 170 */ 171 function lazyInit( element, func ) { 172 var scrollHandler = function () { 173 if ( ( !element.hasClass( 'lazy-loaded' ) && ( isScrolledIntoView( element ) ) ) ) { 174 func.call(); 175 element.addClass( 'lazy-loaded' ); 176 } 177 }; 178 179 scrollHandler(); 180 $window.on( 'scroll', scrollHandler ); 181 } 182 183 // based on: 184 // https://www.smashingmagazine.com/2018/01/drag-drop-file-uploader-vanilla-js/
185 function initPhotoUploader(photoUploader) { 186 let dropArea = photoUploader.querySelector('.drop-area') 187 188 // Prevent default drag behaviors 189 ;['dragenter', 'dragover', 'dragleave', 'drop'].forEach(eventName => { 190 dropArea.addEventListener(eventName, preventDefaults, false) 191 document.body.addEventListener(eventName, preventDefaults, false) 192 }) 193 194 // Highlight drop area when item is dragged over it 195 ;['dragenter', 'dragover'].forEach(eventName => { 196 dropArea.addEventListener(eventName, highlight, false) 197 }) 198 199 ;['dragleave', 'drop'].forEach(eventName => { 200 dropArea.addEventListener(eventName, unhighlight, false) 201 }) 202 var filesElement = photoUploader.querySelector('.files-element') 203 filesElement.addEventListener('change', function(){ handleFiles(filesElement.files) }, false) 204 205 // Handle dropped files 206 dropArea.addEventListener('drop', handleDrop, false) 207 208 // Handle upload 209 photoUploader.addEventListener('uploadall', uploadAll, false) 210 211 // Handle upload finished 212 photoUploader.addEventListener('base64datauploaded', function(e){ 213 let imageElement = e.detail; 214 let imgName = imageElement.dataset.imageName; 215 let gallery = imageElement.closest('.gallery'); 216 imageElement.setAttribute('data-done', '1') 217 let remain = gallery.querySelectorAll('img:not([data-done="1"])').length 218 if(!remain) { 219 gallery.setAttribute('data-status', 'uploaded') 220 let evAllUploaded = new CustomEvent('alluploaded', { 221 bubbles: true, 222 cancelable: true, 223 detail: gallery 224 }) 225 window.dispatchEvent(evAllUploaded) 226 } 227 }); 228 function preventDefaults (e) { 229 e.preventDefault() 230 e.stopPropagation() 231 } 232 233 function highlight(e) { 234 dropArea.classList.add('highlight') 235 } 236 237 function unhighlight(e) { 238 dropArea.classList.remove('active') 239 } 240 241 function handleDrop(e) { 242 var dt = e.dataTransfer 243 var files = dt.files 244 245 handleFiles(files) 246 } 247 248 let uploadProgress = [] 249 let progressBar = photoUploader.querySelector('.progress-bar') 250 251 let btnUpload = photoUploader.querySelector('.cmd-upload') 252 let photos2upload = photoUploader.querySelectorAll('.gallery img') 253 if(btnUpload) { 254 btnUpload.addEventListener('click', function(e) { 255 uploadAll(e.target.closest('.photo-uploader')) 256 }) 257// && photos2upload.length) { 258 } 259 260 function uploadAll(e) { 261 let photoUploader = e.target ? e.target : e; //.closest('.photo-uploader') 262 var photos = photoUploader.querySelectorAll('.gallery img') 263 initializeProgress(photos.length) 264 photos.forEach(uploadBase64Data) 265 if(e.detail && e.detail.callback && typeof e.detail.callback === 'function') e.detail.callback() 266 } 267 268 function initializeProgress(numFiles) { 269 progressBar.value = 0 270 uploadProgress = [] 271 272 for(let i = numFiles; i > 0; i--) { 273 uploadProgress.push(0) 274 } 275 } 276 277 function updateProgress(fileNumber, percent) { 278 uploadProgress[fileNumber] = percent 279 let total = uploadProgress.reduce((tot, curr) => tot + curr, 0) / uploadProgress.length 280 progressBar.value = total 281 } 282 283 function handleFiles(files) { 284 if(!files.length) return false 285 files = [...files] 286 initializeProgress(files.length) 287 // files.forEach(uploadFile) // Use this for auto upload files 288 files.forEach(previewFile) 289 } 290 291 // 292 function shrinkImage(readerEvent, fileName) { 293 console.log('Reader event ' + fileName); 294 295 var image = new Image(); 296 image.imageName = fileName; 297 image.onload = function (imageEvent) { 298 299//console.log('Image event ' + image.imageName); 300 var mimeType = image.src.split(';base64,')[0].replace(/data\:/gi, ''); 301//console.log(mimeType); 302 if(mimeType == 'image/svg+xml') { 303 dataUrl = this.src; 304 } 305 else 306 { 307 // Resize the image 308 var canvas = document.createElement('canvas'), 309 max_size = photoUploader.dataset.maxSize || 800, 310 width = image.width, 311 height = image.height, 312 dataUrl; 313 if (width > height) { 314 if (width > max_size) { 315 height *= max_size / width; 316 width = max_size; 317 } 318 } else { 319 if (height > max_size) { 320 width *= max_size / height; 321 height = max_size; 322 } 323 } 324 canvas.width = width; 325 canvas.height = height; 326 canvas.getContext('2d').drawImage(image, 0, 0, width, height); 327 dataUrl = canvas.toDataURL(mimeType); //'image/jpeg' 328 } 329 var resizedImg = new Image(); 330 resizedImg.src = dataUrl; 331 resizedImg.dataset.imageName = this.imageName; 332 var imgItem = document.createElement('div') 333 imgItem.classList.add('image-item')
334 imgItem.appendChild(resizedImg) 335 var removeItem = document.createElement('div') 336 removeItem.classList.add('remove-item') 337 imgItem.appendChild(removeItem); 338 photoUploader.querySelector('.gallery').appendChild(imgItem) 339 window.dispatchEvent(new CustomEvent('filedropped', { 340 bubbles: true, 341 cancelable: true, 342 detail: imgItem 343 })); 344 } 345 image.src = readerEvent.target.result; 346 } 347 348 function previewFile(file) { 349 if(!file.type.match(/image.*/)) return false 350 let reader = new FileReader() 351 reader.readAsDataURL(file) 352 reader.fileName = file.name 353 reader.onloadend = function(e) { 354 shrinkImage(e, file.name); 355 } 356 } 357 358 function uploadFile(file, i) { 359 var url = '/upload' 360 var xhr = new XMLHttpRequest() 361 var formData = new FormData() 362 xhr.open('POST', url, true) 363 xhr.setRequestHeader('X-Requested-With', 'XMLHttpRequest') 364 365 // Update progress (can be used to show progress indicator) 366 xhr.upload.addEventListener('progress', function(e) { 367 updateProgress(i, (e.loaded * 100.0 / e.total) || 100) 368 }) 369 370 xhr.addEventListener('readystatechange', function(e) { 371 if (xhr.readyState == 4 && xhr.status == 200) { 372 updateProgress(i, 100) // <- Add this 373 } 374 else if (xhr.readyState == 4 && xhr.status != 200) { 375 // Error. Inform the user 376 } 377 }) 378 379 formData.append('upload_preset', 'username') 380 381 formData.append('file', file) 382 xhr.send(formData) 383 } 384 385 function uploadBase64Data(data, i) { 386 var url = '/upload.asp' 387 388 var imageElement = document.querySelector('[data-image-name="' + data.dataset.imageName + '"]') 389 var photoUploader = imageElement.closest('.photo-uploader') 390 391 var xhr = new XMLHttpRequest() 392// var formData = new FormData() 393 xhr.open('POST', url, true) 394// xhr.setRequestHeader('X-Requested-With', 'XMLHttpRequest') 395 xhr.setRequestHeader('Content-type', 'application/x-www-form-urlencoded; charset=utf-8') 396 397 // Update progress (can be used to show progress indicator) 398 xhr.upload.addEventListener('progress', function(e) { 399 updateProgress(i, (e.loaded * 100.0 / e.total) || 100) 400 }) 401 402 xhr.addEventListener('readystatechange', function(e) { 403 if (xhr.readyState == 4 && xhr.status == 200) { 404 updateProgress(i, 100) // <- Add this 405 console.log('base64datauploaded for ' + data.dataset.imageName); 406 var evDataUploaded = new CustomEvent('base64datauploaded', { 407 bubbles: true, 408 cancelable: true, 409 detail: imageElement 410 }) 411 photoUploader.dispatchEvent(evDataUploaded) 412 } 413 else if (xhr.readyState == 4 && xhr.status != 200) { 414 // Error. Inform the user 415 } 416 }) 417/* 418 formData.append('name', data.dataset.imageName) 419 formData.append('data', data.getAttribute('src')) 420 xhr.send(formData) 421*/ 422 var postData = 'name=' 423 + (photoUploader.dataset.prefix && photoUploader.dataset.prefix.length 424 ? photoUploader.dataset.prefix + '-' 425 : '' 426 ) 427 + encodeURIComponent(data.dataset.imageName) 428 + '&data=' + encodeURIComponent(data.getAttribute('src')) 429 xhr.send(postData) 430 } 431 } 432 433 // Initialize scripts that require a loaded window 434 435 $window.on('load', function () { 436 // Page loader & Page transition 437 if (plugins.preloader.length && !isNoviBuilder) { 438 pageTransition({ 439 target: document.querySelector( '.page' ), 440 delay: 0, 441 duration: 500, 442 classIn: 'fadeIn', 443 classOut: 'fadeOut', 444 classActive: 'animated', 445 conditions: function (event, link) { 446 return link && !/(\#|javascript:void\(0\)|callto:|tel:|mailto:|:\/\/)/.test(link) && !event.currentTarget.hasAttribute('data-lightgallery'); 447 }, 448 onTransitionStart: function ( options ) { 449 setTimeout( function () { 450 plugins.preloader.removeClass('loaded'); 451 }, options.duration * .75 ); 452 }, 453 onReady: function () { 454 plugins.preloader.addClass('loaded'); 455 windowReady = true; 456 } 457 }); 458 } 459 else 460 { 461 $('.page').css({'opacity': 1}); 462 } 463 464 // Counter 465 if ( plugins.counter ) { 466 for ( var i = 0; i < plugins.counter.length; i++ ) { 467 var 468 node = plugins.counter[i], 469 counter = aCounter({ 470 node: node, 471 duration: node.getAttribute( 'data-duration' ) || 1000 472 }), 473 scrollHandler = (function() { 474 if ( Util.inViewport( this ) && !this.classList.contains( 'animated-first' ) ) { 475 this.counter.run(); 476 this.classList.add( 'animated-first' ); 477 } 478 }
478).bind( node ), 479 blurHandler = (function() { 480 this.counter.params.to = parseInt( this.textContent, 10 ); 481 this.counter.run(); 482 }).bind( node ); 483 484 if ( isNoviBuilder ) { 485 node.counter.run(); 486 node.addEventListener( 'blur', blurHandler ); 487 } else { 488 scrollHandler(); 489 window.addEventListener( 'scroll', scrollHandler ); 490 } 491 } 492 } 493 494 // Progress Bar 495 if ( plugins.progressLinear ) { 496 for ( var i = 0; i < plugins.progressLinear.length; i++ ) { 497 var 498 container = plugins.progressLinear[i], 499 counter = aCounter({ 500 node: container.querySelector( '.progress-linear-counter' ), 501 duration: container.getAttribute( 'data-duration' ) || 1000, 502 onStart: function() { 503 this.custom.bar.style.width = this.params.to + '%'; 504 } 505 }); 506 507 counter.custom = { 508 container: container, 509 bar: container.querySelector( '.progress-linear-bar' ), 510 onScroll: (function() { 511 if ( ( Util.inViewport( this.custom.container ) && !this.custom.container.classList.contains( 'animated' ) ) || isNoviBuilder ) { 512 this.run(); 513 this.custom.container.classList.add( 'animated' ); 514 } 515 }).bind( counter ), 516 onBlur: (function() { 517 this.params.to = parseInt( this.params.node.textContent, 10 ); 518 this.run(); 519 }).bind( counter ) 520 }; 521 522 if ( isNoviBuilder ) { 523 counter.run(); 524 counter.params.node.addEventListener( 'blur', counter.custom.onBlur ); 525 } else { 526 counter.custom.onScroll(); 527 document.addEventListener( 'scroll', counter.custom.onScroll ); 528 } 529 } 530 } 531 532 // Progress Circle 533 if ( plugins.progressCircle ) { 534 for ( var i = 0; i < plugins.progressCircle.length; i++ ) { 535 var 536 container = plugins.progressCircle[i], 537 counter = aCounter({ 538 node: container.querySelector( '.progress-circle-counter' ), 539 duration: 500, 540 onUpdate: function( value ) { 541 this.custom.bar.render( value * 3.6 ); 542 } 543 }); 544 545 counter.params.onComplete = counter.params.onUpdate; 546 547 counter.custom = { 548 container: container, 549 bar: aProgressCircle({ node: container.querySelector( '.progress-circle-bar' ) }), 550 onScroll: (function() { 551 if ( Util.inViewport( this.custom.container ) && !this.custom.container.classList.contains( 'animated' ) ) { 552 this.run(); 553 this.custom.container.classList.add( 'animated' ); 554 } 555 }).bind( counter ), 556 onBlur: (function() { 557 this.params.to = parseInt( this.params.node.textContent, 10 ); 558 this.run(); 559 }).bind( counter ) 560 }; 561 562 if ( isNoviBuilder ) { 563 counter.run(); 564 counter.params.node.addEventListener( 'blur', counter.custom.onBlur ); 565 } else { 566 counter.custom.onScroll(); 567 window.addEventListener( 'scroll', counter.custom.onScroll ); 568 } 569 } 570 } 571 572 // Isotope 573 if (plugins.isotope.length) { 574 var isogroup = []; 575 for (var i = 0; i < plugins.isotope.length; i++) { 576 var isotopeItem = plugins.isotope[i], 577 isotopeInitAttrs = { 578 itemSelector: '.isotope-item', 579 layoutMode: isotopeItem.getAttribute('data-isotope-layout') ? isotopeItem.getAttribute('data-isotope-layout') : 'masonry', 580 filter: '*' 581 }; 582 583 if (isotopeItem.getAttribute('data-column-width')) { 584 isotopeInitAttrs.masonry = { 585 columnWidth: parseFloat(isotopeItem.getAttribute('data-column-width')) 586 }; 587 } else if (isotopeItem.getAttribute('data-column-class')) { 588 isotopeInitAttrs.masonry = { 589 columnWidth: isotopeItem.getAttribute('data-column-class') 590 }; 591 } 592 593 var iso = new Isotope(isotopeItem, isotopeInitAttrs); 594 isogroup.push(iso); 595 } 596 597 598 setTimeout(function () { 599 for (var i = 0; i < isogroup.length; i++) { 600 isogroup[i].element.className += " isotope--loaded"; 601 isogroup[i].layout(); 602 } 603 }, 200); 604 605 var resizeTimout; 606 607 $("[data-isotope-filter]").on("click", function (e) { 608 e.preventDefault(); 609 var filter = $(this); 610 clearTimeout(resizeTimout); 611 filter.parents(".isotope-filters").find('.active').removeClass("active"); 612 filter.addClass("active"); 613 var iso = $('.isotope[data-isotope-group="' + this.getAttribute("data-isotope-group") + '"]'), 614 isotopeAttrs = { 615 itemSelector: '.isotope-item', 616 layoutMode: iso.attr('data-isotope-layout') ? iso.attr('data-isotope-layout') : 'masonry', 617 filter: this.getAttribute("data-isotope-filter") === '*' ? '*' : '[data-filter*="' + this.getAttribute("data-isotope-filter") + '"]' 618 }; 619 if (iso.attr('data-column-width')) { 620 isotopeAttrs.masonry = { 621 columnWidth: parseFloat(iso.attr('data-column-width')) 622 }; 623 } else if (iso.attr('data-column-class')) { 624 isotopeAttrs.masonry = { 625 columnWidth: iso.attr('data-column-class') 626 }; 627 } 628 iso.isotope(isotopeAttrs); 629 }).eq(0).trigger("click") 630 } 631 632 // Material Parallax 633 if ( plugins.materialParallax.length ) { 634 if ( !isNoviBuilder && !isIE && !isMobile) { 635 plugins.materialParallax.parallax();
636 } else { 637 for ( var i = 0; i < plugins.materialParallax.length; i++ ) { 638 var $parallax = $(plugins.materialParallax[i]); 639 640 $parallax.addClass( 'parallax-disabled' ); 641 $parallax.css({ "background-image": 'url('+ $parallax.data("parallax-img") +')' }); 642 } 643 } 644 } 645 }); 646 647 // Initialize scripts that require a finished document 648 $(function () { 649 isNoviBuilder = window.xMode; 650 651 /** 652 * @desc Toggle swiper videos on active slides 653 * @param {object} swiper - swiper slider 654 */ 655 function toggleSwiperInnerVideos(swiper) { 656 var prevSlide = $(swiper.slides[swiper.previousIndex]), 657 nextSlide = $(swiper.slides[swiper.activeIndex]), 658 videos, 659 videoItems = prevSlide.find("video"); 660 661 for (var i = 0; i < videoItems.length; i++) { 662 videoItems[i].pause(); 663 } 664 665 videos = nextSlide.find("video"); 666 if (videos.length) { 667 videos.get(0).play(); 668 } 669 } 670 671 /** 672 * @desc Toggle swiper animations on active slides 673 * @param {object} swiper - swiper slider 674 */ 675 function toggleSwiperCaptionAnimation(swiper) { 676 var prevSlide = $(swiper.container).find("[data-caption-animate]"), 677 nextSlide = $(swiper.slides[swiper.activeIndex]).find("[data-caption-animate]"), 678 delay, 679 duration, 680 nextSlideItem, 681 prevSlideItem; 682 683 for (var i = 0; i < prevSlide.length; i++) { 684 prevSlideItem = $(prevSlide[i]); 685 686 prevSlideItem.removeClass("animated") 687 .removeClass(prevSlideItem.attr("data-caption-animate")) 688 .addClass("not-animated"); 689 } 690 691 692 var tempFunction = function (nextSlideItem, duration) { 693 return function () { 694 nextSlideItem 695 .removeClass("not-animated") 696 .addClass(nextSlideItem.attr("data-caption-animate")) 697 .addClass("animated"); 698 if (duration) { 699 nextSlideItem.css('animation-duration', duration + 'ms'); 700 } 701 }; 702 }; 703 704 for (var i = 0; i < nextSlide.length; i++) { 705 nextSlideItem = $(nextSlide[i]); 706 delay = nextSlideItem.attr("data-caption-delay"); 707 duration = nextSlideItem.attr('data-caption-duration'); 708 if (!isNoviBuilder) { 709 if (delay) { 710 setTimeout(tempFunction(nextSlideItem, duration), parseInt(delay, 10)); 711 } else { 712 tempFunction(nextSlideItem, duration); 713 } 714 715 } else { 716 nextSlideItem.removeClass("not-animated") 717 } 718 } 719 } 720 721 /** 722 * @desc Initialize owl carousel plugin 723 * @param {object} carousel - carousel jQuery object 724 */ 725 function initOwlCarousel ( carousel ) { 726 var 727 aliaces = [ '-', '-sm-', '-md-', '-lg-', '-xl-', '-xxl-' ], 728 values = [ 0, 576, 768, 992, 1200, 1600 ], 729 responsive = {}; 730 731 for ( var j = 0; j < values.length; j++ ) { 732 responsive[ values[ j ] ] = {}; 733 for ( var k = j; k >= -1; k-- ) { 734 if ( !responsive[ values[ j ] ][ 'items' ] && carousel.attr( 'data' + aliaces[ k ] + 'items' ) ) { 735 responsive[ values[ j ] ][ 'items' ] = k < 0 ? 1 : parseInt( carousel.attr( 'data' + aliaces[ k ] + 'items' ), 10 ); 736 } 737 if ( !responsive[ values[ j ] ][ 'stagePadding' ] && responsive[ values[ j ] ][ 'stagePadding' ] !== 0 && carousel.attr( 'data' + aliaces[ k ] + 'stage-padding' ) ) { 738 responsive[ values[ j ] ][ 'stagePadding' ] = k < 0 ? 0 : parseInt( carousel.attr( 'data' + aliaces[ k ] + 'stage-padding' ), 10 ); 739 } 740 if ( !responsive[ values[ j ] ][ 'margin' ] && responsive[ values[ j ] ][ 'margin' ] !== 0 && carousel.attr( 'data' + aliaces[ k ] + 'margin' ) ) { 741 responsive[ values[ j ] ][ 'margin' ] = k < 0 ? 30 : parseInt( carousel.attr( 'data' + aliaces[ k ] + 'margin' ), 10 ); 742 } 743 } 744 } 745 746 // Enable custom pagination 747 if ( carousel.attr( 'data-dots-custom' ) ) { 748 carousel.on( 'initialized.owl.carousel', function ( event ) { 749 var 750 carousel = $( event.currentTarget ), 751 customPag = $( carousel.attr( 'data-dots-custom' ) ), 752 active = 0; 753 754 if ( carousel.attr( 'data-active' ) ) { 755 active = parseInt( carousel.attr( 'data-active' ), 10 ); 756 } 757 758 carousel.trigger( 'to.owl.carousel', [ active, 300, true ] ); 759 customPag.find( '[data-owl-item="' + active + '"]' ).addClass( 'active' ); 760 761 customPag.find( '[data-owl-item]' ).on( 'click', function ( event ) { 762 event.preventDefault(); 763 carousel.trigger( 'to.owl.carousel', [ parseInt( this.getAttribute( 'data-owl-item' ), 10 ), 300, true ] ); 764 } ); 765 766 carousel.on( 'translate.owl.carousel', function ( event ) { 767 customPag.find( '.active' ).removeClass( 'active' ); 768 customPag.find( '[data-owl-item="' + event.item.index + '"]' ).addClass( 'active' ) 769 } ); 770 } ); 771 } 772 773 // Initialize lightgallery items in cloned owl items 774 carousel.on( 'initialized.owl.carousel', function () { 775 initLightGalleryItem( carousel.find( '[data-lightgallery="item"]' ), 'lightGallery-in-carousel' ); 776 } ); 777 778 carousel.owlCarousel( { 779 autoplay: isNoviBuilder ? false : carousel.attr( 'data-autoplay' ) !== 'false', 780 autoplayTimeout: carousel.attr( "data-autoplay" ) ? Number( carousel.attr( "data-autoplay" ) ) : 3000, 781 autoplayHoverPause: true, 782 autoWidth: carousel.attr( 'data-autowidth' ) === 'true', 783 loop: isNoviBuilder ? false : carousel.attr( 'data-loop' ) !== 'false', 784 items: 1, 785 center: carousel.attr( 'data-center' ) === 'true',
786 dotsContainer: carousel.attr( 'data-pagination-class' ) || false, 787 navContainer: carousel.attr( 'data-navigation-class' ) || false, 788 mouseDrag: isNoviBuilder ? false : carousel.attr( 'data-mouse-drag' ) !== 'false', 789 nav: carousel.attr( 'data-nav' ) === 'true', 790 dots: carousel.attr( 'data-dots' ) === 'true', 791 dotsEach: carousel.attr( 'data-dots-each' ) ? parseInt( carousel.attr( 'data-dots-each' ), 10 ) : false, 792 animateIn: carousel.attr( 'data-animation-in' ) ? carousel.attr( 'data-animation-in' ) : false, 793 animateOut: carousel.attr( 'data-animation-out' ) ? carousel.attr( 'data-animation-out' ) : false, 794 responsive: responsive, 795 navText: carousel.attr( 'data-nav-text' ) ? $.parseJSON( carousel.attr( 'data-nav-text' ) ) : [], 796 navClass: carousel.attr( 'data-nav-class' ) ? $.parseJSON( carousel.attr( 'data-nav-class' ) ) : [ 'owl-prev', 'owl-next' ] 797 } ); 798 } 799 800 /** 801 * @desc Create live search results 802 * @param {object} options 803 */ 804 function liveSearch(options) { 805 $('#' + options.live).removeClass('cleared').html(); 806 options.current++; 807 options.spin.addClass('loading'); 808 $.get(handler, { 809 s: decodeURI(options.term), 810 liveSearch: options.live, 811 dataType: "html", 812 liveCount: options.liveCount, 813 filter: options.filter, 814 template: options.template 815 }, function (data) { 816 options.processed++; 817 var live = $('#' + options.live); 818 if ((options.processed === options.current) && !live.hasClass('cleared')) { 819 live.find('> #search-results').removeClass('active'); 820 live.html(data); 821 setTimeout(function () { 822 live.find('> #search-results').addClass('active'); 823 }, 50); 824 } 825 options.spin.parents('.rd-search').find('.input-group-addon').removeClass('loading'); 826 }) 827 } 828 829 /** 830 * @desc Attach form validation to elements 831 * @param {object} elements - jQuery object 832 */ 833 function attachFormValidator(elements) { 834 // Custom validator - phone number 835 regula.custom({ 836 name: 'PhoneNumber', 837 defaultMessage: 'Invalid phone number format', 838 validator: function() { 839 if ( this.value === '' ) return true; 840 else return /^(\+\d)?[0-9\-\(\) ]{5,}$/i.test( this.value ); 841 } 842 }); 843 844 for (var i = 0; i < elements.length; i++) { 845 var o = $(elements[i]), v; 846 o.addClass("form-control-has-validation").after("<span class='form-validation'></span>"); 847 v = o.parent().find(".form-validation"); 848 if (v.is(":last-child")) o.addClass("form-control-last-child"); 849 } 850 851 elements.on('input change propertychange blur', function (e) { 852 var $this = $(this), results; 853 854 if (e.type !== "blur") if (!$this.parent().hasClass("has-error")) return; 855 if ($this.parents('.rd-mailform').hasClass('success')) return; 856 857 if (( results = $this.regula('validate') ).length) { 858 for (i = 0; i < results.length; i++) { 859 $this.siblings(".form-validation").text(results[i].message).parent().addClass("has-error"); 860 } 861 } else { 862 $this.siblings(".form-validation").text("").parent().removeClass("has-error") 863 } 864 }).regula('bind'); 865 866 var regularConstraintsMessages = [ 867 { 868 type: regula.Constraint.Required, 869 newMessage: "The text field is required." 870 }, 871 { 872 type: regula.Constraint.Email, 873 newMessage: "The email is not a valid email." 874 }, 875 { 876 type: regula.Constraint.Numeric, 877 newMessage: "Only numbers are required" 878 }, 879 { 880 type: regula.Constraint.Selected, 881 newMessage: "Please choose an option." 882 } 883 ]; 884 885 886 for (var i = 0; i < regularConstraintsMessages.length; i++) { 887 var regularConstraint = regularConstraintsMessages[i]; 888 889 regula.override({ 890 constraintType: regularConstraint.type, 891 defaultMessage: regularConstraint.newMessage 892 }); 893 } 894 } 895 896 /** 897 * @desc Check if all elements pass validation 898 * @param {object} elements - object of items for validation 899 * @param {object} captcha - captcha object for validation 900 * @return {boolean} 901 */ 902 function isValidated(elements, captcha) { 903 var results, errors = 0; 904 905 if (elements.length) { 906 for (var j = 0; j < elements.length; j++) { 907 908 var $input = $(elements[j]); 909 if ((results = $input.regula('validate')).length) { 910 for (k = 0; k < results.length; k++) { 911 errors++; 912 $input.siblings(".form-validation").text(results[k].message).parent().addClass("has-error"); 913 } 914 } else { 915 $input.siblings(".form-validation").text("").parent().removeClass("has-error") 916 } 917 } 918 919 if (captcha) { 920 if (captcha.length) { 921 return validateReCaptcha(captcha) && errors === 0 922 } 923 } 924 925 return errors === 0; 926 } 927 return true; 928 } 929 930 /** 931 * @desc Validate google reCaptcha 932 * @param {object} captcha - captcha object for validation 933 * @return {boolean} 934 */ 935 function validateReCaptcha(captcha) { 936 var captchaToken = captcha.find('.g-recaptcha-response').val(); 937 938 if (captchaToken.length === 0) { 939 captcha 940 .siblings('.form-validation') 941 .html('Please, prove that you are not robot.') 942 .addClass('active'); 943 captcha 944 .closest('.form-wrap') 945 .addClass('has-error'); 946 947 captcha.on('propertychange', function () { 948 var $this = $(this), 949 captchaToken = $this.find('.g-recaptcha-response').val(); 950 951 if (captchaToken.length > 0) { 952 $this 953 .closest('.form-wrap') 954 .removeClass('has-error'); 955 $this 956 .siblings('.form-validation') 957 .removeClass('active') 958 .html(''); 959 $this.off('propertychange'); 960 } 961 }); 962 963 return false; 964 } 965 966 return true; 967 } 968 969 /** 970 * @desc Initialize Google reCaptcha 971 */ 972 window.onloadCaptchaCallback = function () { 973 for (var i = 0; i < plugins.captcha.length; i++) { 974 var 975 $captcha = $(plugins.captcha[i]), 976 resizeHandler = (function() { 977 var 978 frame = this.querySelector( 'iframe' ), 979 inner = this.firstElementChild, 980 inner2 = inner.firstElementChild, 981 containerRect = null, 982 frameRect = null, 983 scale = null; 984 985 inner2.style.transform = ''; 986 inner.style.height = 'auto'; 987 inner.style.width = 'auto'; 988 989 containerRect = this.getBoundingClientRect(); 990 frameRect = frame.getBoundingClientRect(); 991 scale = containerRect.width/frameRect.width; 992 993 if ( scale < 1 ) { 994 inner2.style.transform = 'scale('+ scale +')'; 995 inner.style.height = ( frameRect.height * scale ) + 'px'; 996 inner.style.width = ( frameRect.width * scale ) + 'px'; 997 } 998 }).bind( plugins.captcha[i] ); 999 1000 grecaptcha.render( 1001 $captcha.attr('id'), 1002 { 1003 sitekey: $captcha.attr('data-sitekey'), 1004 size: $captcha.attr('data-size') ? $captcha.attr('data-size') : 'normal', 1005 theme: $captcha.attr('data-theme') ? $captcha.attr('data-theme') : 'light', 1006 callback: function () { 1007 $('.recaptcha').trigger('propertychange'); 1008 } 1009 } 1010 ); 1011 1012 $captcha.after("<span class='form-validation'></span>"); 1013 1014 if ( plugins.captcha[i].hasAttribute( 'data-auto-size' ) ) { 1015 resizeHandler(); 1016 window.addEventListener( 'resize', resizeHandler ); 1017 } 1018 } 1019 }; 1020 1021 /** 1022 * @desc Initialize Bootstrap tooltip with required placement 1023 * @param {string} tooltipPlacement 1024 */ 1025 function initBootstrapTooltip(tooltipPlacement) { 1026 plugins.bootstrapTooltip.tooltip('dispose'); 1027 1028 if (window.innerWidth < 576) { 1029 plugins.bootstrapTooltip.tooltip({placement: 'bottom'}); 1030 } else { 1031 plugins.bootstrapTooltip.tooltip({placement: tooltipPlacement}); 1032 } 1033 } 1034 1035 /** 1036 * @desc Initialize the gallery with set of images 1037 * @param {object} itemsToInit - jQuery object 1038 * @param {string} [addClass] - additional gallery class 1039 */ 1040 function initLightGallery ( itemsToInit, addClass ) { 1041 if ( !isNoviBuilder ) { 1042 $( itemsToInit ).lightGallery( { 1043 thumbnail: $( itemsToInit ).attr( "data-lg-thumbnail" ) !== "fal
1043se", 1044 selector: "[data-lightgallery='item']", 1045 autoplay: $( itemsToInit ).attr( "data-lg-autoplay" ) === "true", 1046 pause: parseInt( $( itemsToInit ).attr( "data-lg-autoplay-delay" ) ) || 5000, 1047 addClass: addClass, 1048 mode: $( itemsToInit ).attr( "data-lg-animation" ) || "lg-slide", 1049 loop: $( itemsToInit ).attr( "data-lg-loop" ) !== "false" 1050 } ); 1051 } 1052 } 1053 1054 /** 1055 * @desc Initialize the gallery with dynamic addition of images 1056 * @param {object} itemsToInit - jQuery object 1057 * @param {string} [addClass] - additional gallery class 1058 */ 1059 function initDynamicLightGallery ( itemsToInit, addClass ) { 1060 if ( !isNoviBuilder ) { 1061 $( itemsToInit ).on( "click", function () { 1062 $( itemsToInit ).lightGallery( { 1063 thumbnail: $( itemsToInit ).attr( "data-lg-thumbnail" ) !== "false", 1064 selector: "[data-lightgallery='item']", 1065 autoplay: $( itemsToInit ).attr( "data-lg-autoplay" ) === "true", 1066 pause: parseInt( $( itemsToInit ).attr( "data-lg-autoplay-delay" ) ) || 5000, 1067 addClass: addClass, 1068 mode: $( itemsToInit ).attr( "data-lg-animation" ) || "lg-slide", 1069 loop: $( itemsToInit ).attr( "data-lg-loop" ) !== "false", 1070 dynamic: true, 1071 dynamicEl: JSON.parse( $( itemsToInit ).attr( "data-lg-dynamic-elements" ) ) || [] 1072 } ); 1073 } ); 1074 } 1075 } 1076 1077 /** 1078 * @desc Initialize the gallery with one image 1079 * @param {object} itemToInit - jQuery object 1080 * @param {string} [addClass] - additional gallery class 1081 */ 1082 function initLightGalleryItem ( itemToInit, addClass ) { 1083 if ( !isNoviBuilder ) { 1084 $( itemToInit ).lightGallery( { 1085 selector: "this", 1086 addClass: addClass, 1087 counter: false, 1088 youtubePlayerParams: { 1089 modestbranding: 1, 1090 showinfo: 0, 1091 rel: 0, 1092 controls: 0 1093 }, 1094 vimeoPlayerParams: { 1095 byline: 0, 1096 portrait: 0 1097 } 1098 } ); 1099 } 1100 } 1101 1102 /** 1103 * @desc Google map function for getting latitude and longitude 1104 */ 1105 function getLatLngObject(str, marker, map, callback) { 1106 var coordinates = {}; 1107 try { 1108 coordinates = JSON.parse(str); 1109 callback(new google.maps.LatLng( 1110 coordinates.lat, 1111 coordinates.lng 1112 ), marker, map) 1113 } catch (e) { 1114 map.geocoder.geocode({'address': str}, function (results, status) { 1115 if (status === google.maps.GeocoderStatus.OK) { 1116 var latitude = results[0].geometry.location.lat(); 1117 var longitude = results[0].geometry.location.lng(); 1118 1119 callback(new google.maps.LatLng( 1120 parseFloat(latitude), 1121 parseFloat(longitude) 1122 ), marker, map) 1123 } 1124 }) 1125 } 1126 } 1127 1128 /** 1129 * @desc Initialize Google maps 1130 */ 1131 function initMaps() { 1132 var key; 1133 /** 1134 * Markup: 1135 * <div class="map"> 1136 * <div class="google-map" data-center data-zoom data-key data-icon></div><!-- handled by Google maps --> 1137 * <div class="marker" data-location data-icon data-description>or description</div> 1138 * </div> 1139 * <div class="map another"> 1140 * </div> 1141 */ 1142 if(plugins.maps.length) { 1143 for( var i=0; i<plugins.maps.length; i++) { 1144 var mapElement = plugins.maps[i]; 1145 key = mapElement.getAttribute('data-key'); 1146 var icon; 1147 if( mapElement.getAttribute('data-icon') && mapElement.getAttribute('data-icon').length){ 1148 icon = { 1149 url: mapElement.getAttribute('data-icon'), 1150// scaledSize: new google.maps.Size(31, 50), 1151 } 1152 } 1153 var script = document.createElement('script'); 1154 script.src = 'https://maps.googleapis.com/maps/api/js?key=' + key + '&callback=initMap'; 1155 script.async = true; 1156 1157 window.initMap = function() { 1158 const map = new google.maps.Map(mapElement.querySelectorAll('.google-map')[0], { 1159// scrollwheel: false, 1160 center: $('.map').data('center'), 1161 zoom: $('.map').data('zoom'), 1162 styles: [ //https://developers.google.com/maps/documentation/javascript/style-reference 1163 //hide business labels 1164 {featureType: 'poi.business', stylers: [{visibility: 'off'}]}, 1165 {featureType: 'landscape.natural', elementType: 'geometry', stylers: [{color: '#707755'}]}, 1166 {featureType: 'landscape.natural.terrain', elementType: 'geometry', stylers: [{color: '#766660'}
1166]}, 1167 {featureType: 'landscape.natural.landcover', elementType: 'geometry', stylers: [{color: '#707755'}]}, 1168 {featureType: 'landscape.man_made', elementType: 'geometry', stylers: [{color: '#635651'}]}, 1169 {featureType: 'water', elementType: 'geometry', stylers: [{color: '#6b848f'}]}, 1170 {featureType: 'road', elementType: 'geometry', stylers: [{color: '#413837'}]}, 1171 {featureType: 'road', elementType: 'labels.text.fill', stylers: [{color: '#ccbbaa'}]}, 1172 {featureType: 'road', elementType: 'labels.text.stroke', stylers: [{color: '#000000'}]}, 1173 {featureType: 'poi', elementType: 'labels.text.stroke', stylers: [{color: '#000000'}]}, 1174 1175 ] 1176 }); 1177 mapElement.querySelectorAll('.marker').forEach(function(el){ 1178 var latlon = JSON.parse(el.getAttribute('data-location')); 1179 if(el.getAttribute('data-icon') && el.getAttribute('data-icon').length){ 1180 icon = { 1181 url: el.getAttribute('data-icon'), 1182// scaledSize: new google.maps.Size(31, 50), 1183 } 1184 } 1185 const infowindow = new google.maps.InfoWindow({ 1186 content: '<div>' + el.innerHTML + '</div>' 1187 }); 1188 const marker = new google.maps.Marker({ 1189// position: $('.map').find('.google-map-markers li:first-child').data('location'), 1190 animation: google.maps.Animation.DROP, 1191 position: latlon, 1192 map: map, 1193 icon: icon 1194 }); 1195 marker.addListener('click', () => { 1196 infowindow.open(map, marker); 1197 }); 1198 }); 1199//console.log(marker); 1200 //infowindow.open(map, marker); 1201 1202 }; 1203 document.head.appendChild(script); 1204 } 1205 } 1206 1207 1208 1209 1210 1211 1212return false 1213 1214 for ( var i = 0; i < plugins.maps.length; i++ ) { 1215 if ( plugins.maps[i].hasAttribute('data-key') ) { 1216 key = plugins.maps[i].getAttribute('data-key'); 1217 break; 1218 } 1219 } 1220 var googleMapsApi = '//maps.googleapis.com/maps/api/js?'+ ( key ? 'key='+ key + '&' : '' ) +'sensor=false&libraries=geometry,places&v=quarterly'; 1221 $.getScript(googleMapsApi, function () { 1222 var head = document.getElementsByTagName('head')[0], 1223 insertBefore = head.insertBefore; 1224 1225 head.insertBefore = function (newElement, referenceElement) { 1226 if (newElement.href && newElement.href.indexOf('//fonts.googleapis.com/css?family=Roboto') !== -1 || newElement.innerHTML.indexOf('gm-style') !== -1) { 1227 return; 1228 } 1229 insertBefore.call(head, newElement, referenceElement); 1230 }; 1231 for (var i = 0; i < plugins.maps.length; i++) { 1232 var zoom = parseInt(plugins.maps[i].getAttribute("data-zoom"), 10) || 11; 1233 var styles = plugins.maps[i].hasAttribute('data-styles') ? JSON.parse(plugins.maps[i].getAttribute('data-styles')) : []; 1234 var center = plugins.maps[i].getAttribute("data-center") || "Naoussa GR"; 1235 1236 var latlon = JSON.parse(center); 1237 // Initialize map 1238 var map = new google.maps.Map(plugins.maps[i].querySelectorAll(".google-map")[0], { 1239 zoom: zoom, 1240// styles: styles, 1241// scrollwheel: false, 1242// center: {lat: 0, lng: 0} 1243 center: new google.maps.LatLng( 1244 latlon.lat, 1245 latlon.lng 1246 ) 1247 }); 1248 1249 // Add map object to map node 1250 plugins.maps[i].map = map; 1251 plugins.maps[i].keySupported = true; 1252 plugins.maps[i].google = google; 1253 1254 // Get Center coordinates from attribute 1255 getLatLngObject(center, null, plugins.maps[i], function (location, markerElement, mapElement) { 1256 mapElement.map.setCenter(location); 1257 }); 1258 // Add markers from google-map-markers array 1259 var markerItems = plugins.maps[i].querySelectorAll('.google-map-markers li'); 1260 1261 if (markerItems.length){ 1262 var markers = []; 1263 for (var j = 0; j < markerItems.length; j++){ 1264 const infoWindow = new google.maps.InfoWindow({ 1265 content: markerItems[j].getAttribute('data-description') 1266 }); 1267 const marker = new google.maps.Marker({ 1268 animation: google.maps.Animation.DROP, 1269 position: JSON.parse(markerItems[j].getAttribute('data-location')), 1270 map: map, 1271 icon: markerItems[j].getAttribute('data-icon') 1272 });
1273 marker.addListener('click', () => { 1274 infoWindow.open(map, marker); 1275console.log('click'); 1276 }); 1277 infoWindow.open(map, marker); 1278 markers.push({marker: marker, infoWindow: infoWindow}); 1279 } 1280 } 1281 } 1282 }); 1283 } 1284 function initMaps_DIS() { 1285 var key; 1286 1287 for ( var i = 0; i < plugins.maps.length; i++ ) { 1288 1289 if ( plugins.maps[i].hasAttribute( "data-key" ) ) { 1290 key = plugins.maps[i].getAttribute( "data-key" ); 1291 break; 1292 } 1293 } 1294// var googleMapsApi = '//maps.google.com/maps/api/js?'+ ( key ? 'key='+ key + '&' : '' ) +'sensor=false&libraries=geometry,places&v=quarterly'; 1295 var googleMapsApi = '//maps.googleapis.com/maps/api/js?'+ ( key ? 'key='+ key + '&' : '' ) +'sensor=false&libraries=geometry,places&v=quarterly'; 1296 $.getScript(googleMapsApi, function () { 1297 var head = document.getElementsByTagName('head')[0], 1298 insertBefore = head.insertBefore; 1299 1300 head.insertBefore = function (newElement, referenceElement) { 1301 if (newElement.href && newElement.href.indexOf('//fonts.googleapis.com/css?family=Roboto') !== -1 || newElement.innerHTML.indexOf('gm-style') !== -1) { 1302 return; 1303 } 1304 insertBefore.call(head, newElement, referenceElement); 1305 }; 1306 var geocoder = new google.maps.Geocoder; 1307 for (var i = 0; i < plugins.maps.length; i++) { 1308 var zoom = parseInt(plugins.maps[i].getAttribute("data-zoom"), 10) || 11; 1309 var styles = plugins.maps[i].hasAttribute('data-styles') ? JSON.parse(plugins.maps[i].getAttribute('data-styles')) : []; 1310 var center = plugins.maps[i].getAttribute("data-center") || "Naoussa GR"; 1311 1312 var latlon = JSON.parse(center); 1313 // Initialize map 1314 var map = new google.maps.Map(plugins.maps[i].querySelectorAll(".google-map")[0], { 1315 zoom: zoom, 1316// styles: styles, 1317// scrollwheel: false, 1318// center: {lat: 0, lng: 0} 1319 center: new google.maps.LatLng( 1320 latlon.lat, 1321 latlon.lng 1322 ) 1323 }); 1324 1325 // Add map object to map node 1326 plugins.maps[i].map = map; 1327 plugins.maps[i].geocoder = geocoder; 1328 plugins.maps[i].keySupported = true; 1329 plugins.maps[i].google = google; 1330 1331 // Get Center coordinates from attribute 1332 getLatLngObject(center, null, plugins.maps[i], function (location, markerElement, mapElement) { 1333 mapElement.map.setCenter(location); 1334 }); 1335 1336 // Add markers from google-map-markers array 1337 var markerItems = plugins.maps[i].querySelectorAll(".google-map-markers li"); 1338 1339 if (markerItems.length){ 1340 var markers = []; 1341 for (var j = 0; j < markerItems.length; j++){ 1342 var markerElement = markerItems[j]; 1343 getLatLngObject(markerElement.getAttribute("data-location"), markerElement, plugins.maps[i], function(location, markerElement, mapElement){ 1344 var icon = markerElement.getAttribute("data-icon") || mapElement.getAttribute("data-icon"); 1345 var activeIcon = markerElement.getAttribute("data-icon-active") || mapElement.getAttribute("data-icon-active"); 1346 var info = markerElement.getAttribute("data-description") || ""; 1347 var infoWindow = new google.maps.InfoWindow({ 1348 content: info 1349 });
1350 markerElement.infoWindow = infoWindow; 1351 var marker = new google.maps.Marker({ 1352 position: location, 1353 map: mapElement.map, 1354 icon: icon 1355 }); 1356 markerElement.gmarker = marker; 1357 markers.push({markerElement: markerElement, infoWindow: infoWindow}); 1358 marker.isActive = false; 1359 1360 marker.addListener('click', () => { 1361 infowindow.open(map, marker); 1362 }); 1363/* 1364 // Handle infoWindow close click 1365 google.maps.event.addListener(infoWindow,'closeclick',(function(markerElement, mapElement){ 1366 var markerIcon = null; 1367 markerElement.gmarker.isActive = false; 1368 markerIcon = markerElement.getAttribute("data-icon") || mapElement.getAttribute("data-icon"); 1369 markerElement.gmarker.setIcon(markerIcon); 1370 }).bind(this, markerElement, mapElement)); 1371 1372 // Set marker active on Click and open infoWindow 1373 google.maps.event.addListener(marker, 'click', (function(markerElement, mapElement) { 1374console.log(markerElement.infoWindow.getContent().length); 1375 if (markerElement.infoWindow.getContent().length === 0) return; 1376 var gMarker, currentMarker = markerElement.gmarker, currentInfoWindow; 1377 for (var k =0; k < markers.length; k++){ 1378 var markerIcon; 1379 if (markers[k].markerElement === markerElement){ 1380 currentInfoWindow = markers[k].infoWindow; 1381 } 1382 gMarker = markers[k].markerElement.gmarker; 1383 if (gMarker.isActive && markers[k].markerElement !== markerElement){ 1384 gMarker.isActive = false; 1385 markerIcon = markers[k].markerElement.getAttribute("data-icon") || mapElement.getAttribute("data-icon") 1386 gMarker.setIcon(markerIcon); 1387 markers[k].infoWindow.close(); 1388 } 1389 } 1390console.log(currentMarker); 1391 currentMarker.isActive = !currentMarker.isActive; 1392 if (currentMarker.isActive) { 1393 if (markerIcon = markerElement.getAttribute("data-icon-active") || mapElement.getAttribute("data-icon-active")){ 1394 currentMarker.setIcon(markerIcon); 1395 } 1396 1397 currentInfoWindow.open(map, marker); 1398 }else{ 1399 if (markerIcon = markerElement.getAttribute("data-icon") || mapElement.getAttribute("data-icon")){ 1400 currentMarker.setIcon(markerIcon); 1401 } 1402 currentInfoWindow.close(); 1403 } 1404 }).bind(this, markerElement, mapElement)) 1405*/ 1406 }) 1407 } 1408 } 1409 } 1410 }); 1411 } 1412 1413 // Google ReCaptcha 1414 if (plugins.captcha.length) { 1415 $.getScript("//www.google.com/recaptcha/api.js?onload=onloadCaptchaCallback&render=explicit&hl=en"); 1416 } 1417 1418 // Additional class on html if mac os. 1419 if (navigator.platform.match(/(Mac)/i)) { 1420 $html.addClass("mac-os"); 1421 } 1422 1423 // Adds some loosing functionality to IE browsers (IE Polyfills) 1424 if (isIE) { 1425 if (isIE === 12) $html.addClass("ie-edge"); 1426 if (isIE === 11) $html.addClass("ie-11"); 1427 if (isIE < 10) $html.addClass("lt-ie-10"); 1428 if (isIE < 11) $html.addClass("ie-10"); 1429 } 1430 1431 // Bootstrap Tooltips 1432 if (plugins.bootstrapTooltip.length) { 1433 var tooltipPlacement = plugins.bootstrapTooltip.attr('data-placement'); 1434 initBootstrapTooltip(tooltipPlacement); 1435 1436 $window.on('resize orientationchange', function () { 1437 initBootstrapTooltip(tooltipPlacement); 1438 }) 1439 } 1440 1441 // Bootstrap Modal 1442 if (plugins.bootstrapModal.length) { 1443 for (var i = 0; i < plugins.bootstrapModal.length; i++) { 1444 var modalItem = $(plugins.bootstrapModal[i]); 1445 1446 modalItem.on('hidden.bs.modal', $.proxy(function () { 1447 var activeModal = $(this), 1448 rdVideoInside = activeModal.find('video'), 1449 youTubeVideoInside = activeModal.find('iframe'); 1450 1451 if (rdVideoInside.length) { 1452 rdVideoInside[0].pause(); 1453 } 1454 1455 if (youTubeVideoInside.length) { 1456 var videoUrl = youTubeVideoInside.attr('src'); 1457 1458 youTubeVideoInside 1459 .attr('src', '') 1460 .attr('src', videoUrl); 1461 } 1462 }, modalItem)) 1463 } 1464 } 1465 1466 // Popovers 1467 if (plugins.popover.length) { 1468 if (window.innerWidth < 767) { 1469 plugins.popover.attr('data-placement', 'bottom'); 1470 plugins.popover.popover(); 1471 } 1472 else { 1473 plugins.popover.popover(); 1474 } 1475 } 1476 1477 // Bootstrap Buttons 1478 if (plugins.statefulButton.length) { 1479 $(plugins.statefulButton).on('click', function () { 1480 var statefulButtonLoading = $(this).button('loading'); 1481 1482 setTimeout(function () { 1483 statefulButtonLoading.button('reset') 1484 }, 2000); 1485 }) 1486 } 1487 1488 // Bootstrap tabs 1489 if (plugins.bootstrapTabs.length) { 1490 for (var i = 0; i < plugins.bootstrapTabs.length; i++) { 1491 var bootstrapTab = $(plugins.bootstrapTabs[i]); 1492 1493 //If have slick carousel inside tab - resize slick carousel on click 1494 if (bootstrapTab.find('.slick-slider').length) { 1495 bootstrapTab.find('.tabs-custom-list > li > a').on('click', $.proxy(function () { 1496 var $this = $(this); 1497 var setTimeOutTime = isNoviBuilder ? 1500 : 300; 1498 1499 setTimeout(function () { 1500 $this.find('.tab-content .tab-pane.active .slick-slider').slick('setPosition'); 1501 }, setTimeOutTime); 1502 }, bootstrapTab)); 1503 } 1504 1505 plugins.bootstrapTabs[i].querySelectorAll( '.nav li a' ).forEach( function( tab, index ) { 1506 if ( index === 0 ) { 1507 tab.parentElement.classList.remove( 'active' );
1508 $( tab ).tab( 'show' ); 1509 } 1510 1511 tab.addEventListener( 'click', function( event ) { 1512 event.preventDefault(); 1513 $( this ).tab( 'show' ); 1514 }); 1515 }); 1516 } 1517 } 1518 1519 // Copyright Year (Evaluates correct copyright year) 1520 if (plugins.copyrightYear.length) { 1521 plugins.copyrightYear.text(initialDate.getFullYear()); 1522 } 1523 1524 // Google maps 1525 if( plugins.maps.length ) { 1526 lazyInit( $(plugins.maps), initMaps ); 1527 } 1528 1529 // Add custom styling options for input[type="radio"] 1530 if (plugins.radio.length) { 1531 for (var i = 0; i < plugins.radio.length; i++) { 1532 $(plugins.radio[i]).addClass("radio-custom").after("<span class='radio-custom-dummy'></span>") 1533 } 1534 } 1535 1536 // Add custom styling options for input[type="checkbox"] 1537 if (plugins.checkbox.length) { 1538 for (var i = 0; i < plugins.checkbox.length; i++) { 1539 $(plugins.checkbox[i]).addClass("checkbox-custom").after("<span class='checkbox-custom-dummy'></span>") 1540 } 1541 } 1542 1543 // UI To Top 1544 if (isDesktop && !isNoviBuilder) { 1545 $().UItoTop({ 1546 easingType: 'easeOutQuad', 1547 containerClass: 'ui-to-top fa fa-angle-up' 1548 }); 1549 } 1550 1551 // RD Navbar 1552 if ( plugins.rdNavbar.length ) { 1553 var 1554 navbar = plugins.rdNavbar, 1555 aliases = { '-': 0, '-sm-': 576, '-md-': 768, '-lg-': 992, '-xl-': 1200, '-xxl-': 1600 }, 1556 responsive = {}; 1557 1558 for ( var alias in aliases ) { 1559 var link = responsive[ aliases[ alias ] ] = {}; 1560 if ( navbar.attr( 'data'+ alias +'layout' ) ) link.layout = navbar.attr( 'data'+ alias +'layout' ); 1561 if ( navbar.attr( 'data'+ alias +'device-layout' ) ) link.deviceLayout = navbar.attr( 'data'+ alias +'device-layout' ); 1562 if ( navbar.attr( 'data'+ alias +'hover-on' ) ) link.focusOnHover = navbar.attr( 'data'+ alias +'hover-on' ) === 'true'; 1563 if ( navbar.attr( 'data'+ alias +'auto-height' ) ) link.autoHeight = navbar.attr( 'data'+ alias +'auto-height' ) === 'true'; 1564 if ( navbar.attr( 'data'+ alias +'stick-up-offset' ) ) link.stickUpOffset = navbar.attr( 'data'+ alias +'stick-up-offset' ); 1565 if ( navbar.attr( 'data'+ alias +'stick-up' ) ) link.stickUp = navbar.attr( 'data'+ alias +'stick-up' ) === 'true'; 1566 if ( isNoviBuilder ) link.stickUp = false; 1567 else if ( navbar.attr( 'data'+ alias +'stick-up' ) ) link.stickUp = navbar.attr( 'data'+ alias +'stick-up' ) === 'true'; 1568 } 1569 1570 plugins.rdNavbar.RDNavbar({ 1571 anchorNav: !isNoviBuilder, 1572 stickUpClone: (plugins.rdNavbar.attr("data-stick-up-clone") && !isNoviBuilder) ? plugins.rdNavbar.attr("data-stick-up-clone") === 'true' : false, 1573 responsive: responsive, 1574 callbacks: { 1575 onStuck: function () { 1576 var navbarSearch = this.$element.find('.rd-search input'); 1577 1578 if (navbarSearch) { 1579 navbarSearch.val('').trigger('propertychange'); 1580 } 1581 }, 1582 onDropdownOver: function () { 1583 return !isNoviBuilder; 1584 }, 1585 onUnstuck: function () { 1586 if (this.$clone === null) 1587 return; 1588 1589 var navbarSearch = this.$clone.find('.rd-search input'); 1590 1591 if (navbarSearch) { 1592 navbarSearch.val('').trigger('propertychange'); 1593 navbarSearch.trigger('blur'); 1594 } 1595 1596 } 1597 } 1598 }); 1599 } 1600 1601 // RD Search 1602 /* 1603 if (plugins.search.length || plugins.searchResults) { 1604 var handler = "bat/rd-search.php"; 1605 var defaultTemplate = '<h5 class="search-title"><a target="_top" href="#{href}" class="search-link">#{title}</a></h5>' + 1606 '<p>...#{token}...</p>' + 1607 '<p class="match"><em>Terms matched: #{count} - URL: #{href}</em></p>'; 1608 var defaultFilter = '*.html'; 1609 1610 if (plugins.search.length) { 1611 for (var i = 0; i < plugins.search.length; i++) { 1612 var searchItem = $(plugins.search[i]), 1613 options = { 1614 element: searchItem, 1615 filter: (searchItem.attr('data-search-filter')) ? searchItem.attr('data-search-filter') : defaultFilter, 1616 template: (searchItem.attr('data-search-template')) ? searchItem.attr('data-search-template') : defaultTemplate, 1617 live: (searchItem.attr('data-search-live')) ? searchItem.attr('data-search-live') : false, 1618 liveCount: (searchItem.attr('data-search-live-count')) ? parseInt(searchItem.attr('data-search-live'), 10) : 4, 1619 current: 0, processed: 0, timer: {} 1620 }; 1621 1622 var $toggle = $('.rd-navbar-search-toggle'); 1623 if ($toggle.length) { 1624 $toggle.on('click', (function (searchItem) { 1625 return function () { 1626 if (!($(this).hasClass('active'))) { 1627 searchItem.find('input').val('').trigger('propertychange'); 1628 } 1629 } 1630 })(searchItem)); 1631 } 1632 1633 if (options.live) { 1634 var clearHandler = false; 1635 1636 searchItem.find('input').on("input propertychange", $.proxy(function () { 1637 this.term = this.element.find('input').val().trim(); 1638 this.spin = this.element.find('.input-group-addon'); 1639 1640 clearTimeout(this.timer); 1641 1642 if (this.term.length > 2) { 1643 this.timer = setTimeout(liveSearch(this), 200); 1644 1645 if (clearHandler === false) { 1646 clearHandler = true; 1647 1648 $body.on("click", function (e) { 1649 if ($(e.toElement).parents('.rd-search').length === 0) { 1650 $('#rd-search-results-live').addClass('cleared').html(''); 1651 } 1652 }) 1653 } 1654 1655 } else if (this.term.length === 0) { 1656 $('#' + this.live).addClass('cleared').html(''); 1657 } 1658 }, options, this)); 1659 } 1660 1661 searchItem.submit($.proxy(function () { 1662 $('<input />').attr('type', 'hidden') 1663 .attr('name', "filter") 1664 .attr('value', this.filter) 1665 .appendTo(this.element); 1666 return true; 1667 }, options, this)) 1668 } 1669 } 1670 1671 if (plugins.searchResults.length) { 1672 var regExp = /\?.*s=([^&]+)\&filter=([^&]+)/g; 1673 var match = regExp.exec(location.search); 1674 1675 if (match !== null) { 1676 $.get(handler, {
1677 s: decodeURI(match[1]), 1678 dataType: "html", 1679 filter: match[2], 1680 template: defaultTemplate, 1681 live: '' 1682 }, function (data) { 1683 plugins.searchResults.html(data); 1684 }) 1685 } 1686 } 1687 } 1688 */ 1689 1690 // Add class in viewport 1691 if (plugins.viewAnimate.length) { 1692 for (var i = 0; i < plugins.viewAnimate.length; i++) { 1693 var $view = $(plugins.viewAnimate[i]).not('.active'); 1694 $document.on("scroll", $.proxy(function () { 1695 if (isScrolledIntoView(this)) { 1696 this.addClass("active"); 1697 } 1698 }, $view)) 1699 .trigger("scroll"); 1700 } 1701 } 1702 1703 // Swiper 1704 if (plugins.swiper.length) { 1705 for (var i = 0; i < plugins.swiper.length; i++) { 1706 var s = $(plugins.swiper[i]); 1707 var pag = s.find(".swiper-pagination"), 1708 next = s.find(".swiper-button-next"), 1709 prev = s.find(".swiper-button-prev"), 1710 bar = s.find(".swiper-scrollbar"), 1711 swiperSlide = s.find(".swiper-slide"), 1712 autoplay = false; 1713 1714 for (var j = 0; j < swiperSlide.length; j++) { 1715 var $this = $(swiperSlide[j]), 1716 url; 1717 1718 if (url = $this.attr("data-slide-bg")) { 1719 $this.css({ 1720 "background-image": "url(" + url + ")", 1721 "background-size": "cover" 1722 }) 1723 } 1724 } 1725 1726 swiperSlide.end() 1727 .find("[data-caption-animate]") 1728 .addClass("not-animated") 1729 .end(); 1730 1731 s.swiper({ 1732 autoplay: !isNoviBuilder && $.isNumeric( s.attr('data-autoplay') ) ? s.attr('data-autoplay') : false, 1733 direction: s.attr('data-direction') ? s.attr('data-direction') : "horizontal", 1734 effect: s.attr('data-slide-effect') ? s.attr('data-slide-effect') : "slide", 1735 speed: s.attr('data-slide-speed') ? s.attr('data-slide-speed') : 600, 1736 keyboardControl: s.attr('data-keyboard') === "true", 1737 mousewheelControl: s.attr('data-mousewheel') === "true", 1738 mousewheelReleaseOnEdges: s.attr('data-mousewheel-release') === "true", 1739 nextButton: next.length ? next.get(0) : null, 1740 prevButton: prev.length ? prev.get(0) : null, 1741 pagination: pag.length ? pag.get(0) : null, 1742 paginationClickable: pag.length ? pag.attr("data-clickable") !== "false" : false, 1743 paginationBulletRender: pag.length ? pag.attr("data-index-bullet") === "true" ? function (swiper, index, className) { 1744 return '<span class="' + className + '">' + (index + 1) + '</span>'; 1745 } : null : null, 1746 scrollbar: bar.length ? bar.get(0) : null, 1747 scrollbarDraggable: bar.length ? bar.attr("data-draggable") !== "false" : true, 1748 scrollbarHide: bar.length ? bar.attr("data-draggable") === "false" : false, 1749 loop: isNoviBuilder ? false : s.attr('data-loop') !== "false", 1750 simulateTouch: s.attr('data-simulate-touch') && !isNoviBuilder ? s.attr('data-simulate-touch') === "true" : false, 1751 onTransitionStart: function (swiper) { 1752 toggleSwiperInnerVideos(swiper); 1753 }, 1754 onTransitionEnd: function (swiper) { 1755 toggleSwiperCaptionAnimation(swiper); 1756 }, 1757 onInit: function (swiper) { 1758 toggleSwiperInnerVideos(swiper); 1759 toggleSwiperCaptionAnimation(swiper); 1760 initLightGalleryItem(s.find('[data-lightgallery="item"]'), 'lightGallery-in-carousel'); 1761 } 1762 }); 1763 } 1764 } 1765 1766 // Owl carousel 1767 if ( plugins.owl.length ) { 1768 for ( var i = 0; i < plugins.owl.length; i++ ) { 1769 var carousel = $( plugins.owl[ i ] ); 1770 plugins.owl[ i ].owl = carousel; 1771 initOwlCarousel( carousel ); 1772 } 1773 } 1774 1775 // WOW 1776 if ($html.hasClass("wow-animation") && plugins.wow.length && !isNoviBuilder && isDesktop) { 1777 new WOW().init(); 1778 } 1779 1780 // RD Input Label 1781 if (plugins.rdInputLabel.length) { 1782 plugins.rdInputLabel.RDInputLabel(); 1783 } 1784 1785 // Regula 1786 if (plugins.regula.length) { 1787 attachFormValidator(plugins.regula); 1788 } 1789 1790 // MailChimp Ajax subscription 1791 /* 1792 if (plugins.mailchimp.length) { 1793 for (i = 0; i < plugins.mailchimp.length; i++) { 1794 var $mailchimpItem = $(plugins.mailchimp[i]), 1795 $email = $mailchimpItem.find('input[type="email"]'); 1796 1797 // Required by MailChimp 1798 $mailchimpItem.attr('novalidate', 'true'); 1799 $email.attr('name', 'EMAIL'); 1800 1801 $mailchimpItem.on('submit', $.proxy( function ( $email, event ) { 1802 event.preventDefault(); 1803 1804 var $this = this; 1805 1806 var data = {}, 1807 url = $this.attr('action').replace('/post?', '/post-json?').concat('&c=?'), 1808 dataArray = $this.serializeArray(), 1809 $output = $("#" + $this.attr("data-form-output")); 1810 1811 for (i = 0; i < dataArray.length; i++) { 1812 data[dataArray[i].name] = dataArray[i].value; 1813 } 1814 1815 $.ajax({
1816 data: data, 1817 url: url, 1818 dataType: 'jsonp', 1819 error: function (resp, text) { 1820 $output.html('Server error: ' + text); 1821 1822 setTimeout(function () { 1823 $output.removeClass("active"); 1824 }, 4000); 1825 }, 1826 success: function (resp) { 1827 $output.html(resp.msg).addClass('active'); 1828 $email[0].value = ''; 1829 var $label = $('[for="'+ $email.attr( 'id' ) +'"]'); 1830 if ( $label.length ) $label.removeClass( 'focus not-empty' ); 1831 1832 setTimeout(function () { 1833 $output.removeClass("active"); 1834 }, 6000); 1835 }, 1836 beforeSend: function (data) { 1837 var isNoviBuilder = window.xMode; 1838 1839 var isValidated = (function () { 1840 var results, errors = 0; 1841 var elements = $this.find('[data-constraints]'); 1842 var captcha = null; 1843 if (elements.length) { 1844 for (var j = 0; j < elements.length; j++) { 1845 1846 var $input = $(elements[j]); 1847 if ((results = $input.regula('validate')).length) { 1848 for (var k = 0; k < results.length; k++) { 1849 errors++; 1850 $input.siblings(".form-validation").text(results[k].message).parent().addClass("has-error"); 1851 } 1852 } else { 1853 $input.siblings(".form-validation").text("").parent().removeClass("has-error") 1854 } 1855 } 1856 1857 if (captcha) { 1858 if (captcha.length) { 1859 return validateReCaptcha(captcha) && errors === 0 1860 } 1861 } 1862 1863 return errors === 0; 1864 } 1865 return true; 1866 })(); 1867 1868 // Stop request if builder or inputs are invalide 1869 if (isNoviBuilder || !isValidated) 1870 return false; 1871 1872 $output.html('Submitting...').addClass('active'); 1873 } 1874 }); 1875 1876 return false; 1877 }, $mailchimpItem, $email )); 1878 } 1879 } 1880 */ 1881 1882 // Campaign Monitor ajax subscription 1883 /* 1884 if (plugins.campaignMonitor.length) { 1885 for (i = 0; i < plugins.campaignMonitor.length; i++) { 1886 var $campaignItem = $(plugins.campaignMonitor[i]); 1887 1888 $campaignItem.on('submit', $.proxy(function (e) { 1889 var data = {}, 1890 url = this.attr('action'), 1891 dataArray = this.serializeArray(), 1892 $output = $("#" + plugins.campaignMonitor.attr("data-form-output")), 1893 $this = $(this); 1894 1895 for (i = 0; i < dataArray.length; i++) { 1896 data[dataArray[i].name] = dataArray[i].value; 1897 } 1898 1899 $.ajax({
1900 data: data, 1901 url: url, 1902 dataType: 'jsonp', 1903 error: function (resp, text) { 1904 $output.html('Server error: ' + text); 1905 1906 setTimeout(function () { 1907 $output.removeClass("active"); 1908 }, 4000); 1909 }, 1910 success: function (resp) { 1911 $output.html(resp.Message).addClass('active'); 1912 1913 setTimeout(function () { 1914 $output.removeClass("active"); 1915 }, 6000); 1916 }, 1917 beforeSend: function (data) { 1918 // Stop request if builder or inputs are invalide 1919 if (isNoviBuilder || !isValidated($this.find('[data-constraints]'))) 1920 return false; 1921 1922 $output.html('Submitting...').addClass('active'); 1923 } 1924 }); 1925 1926 // Clear inputs after submit 1927 var inputs = $this[0].getElementsByTagName('input'); 1928 for (var i = 0; i < inputs.length; i++) { 1929 inputs[i].value = ''; 1930 var label = document.querySelector( '[for="'+ inputs[i].getAttribute( 'id' ) +'"]' ); 1931 if( label ) label.classList.remove( 'focus', 'not-empty' ); 1932 } 1933 1934 return false; 1935 }, $campaignItem)); 1936 } 1937 } 1938 */ 1939 1940 // RD Mailform 1941 /* 1942 if (plugins.rdMailForm.length) { 1943 var i, j, k, 1944 msg = { 1945 'MF000': 'Successfully sent!', 1946 'MF001': 'Recipients are not set!', 1947 'MF002': 'Form will not work locally!', 1948 'MF003': 'Please, define email field in your form!', 1949 'MF004': 'Please, define type of your form!', 1950 'MF254': 'Something went wrong with PHPMailer!', 1951 'MF255': 'Aw, snap! Something went wrong.' 1952 }; 1953 1954 for (i = 0; i < plugins.rdMailForm.length; i++) { 1955 var $form = $(plugins.rdMailForm[i]), 1956 formHasCaptcha = false; 1957 1958 $form.attr('novalidate', 'novalidate').ajaxForm({ 1959 data: { 1960 "form-type": $form.attr("data-form-type") || "contact", 1961 "counter": i 1962 }, 1963 beforeSubmit: function (arr, $form, options) { 1964 if (isNoviBuilder) 1965 return; 1966 1967 var form = $(plugins.rdMailForm[this.extraData.counter]), 1968 inputs = form.find("[data-constraints]"), 1969 output = $("#" + form.attr("data-form-output")), 1970 captcha = form.find('.recaptcha'), 1971 captchaFlag = true; 1972 1973 output.removeClass("active error success"); 1974 1975 if (isValidated(inputs, captcha)) { 1976 1977 // veify reCaptcha 1978 if (captcha.length) { 1979 var captchaToken = captcha.find('.g-recaptcha-response').val(), 1980 captchaMsg = { 1981 'CPT001': 'Please, setup you "site key" and "secret key" of reCaptcha', 1982 'CPT002': 'Something wrong with google reCaptcha' 1983 }; 1984 1985 formHasCaptcha = true; 1986 1987 $.ajax({
1988 method: "POST", 1989 url: "bat/reCaptcha.php", 1990 data: {'g-recaptcha-response': captchaToken}, 1991 async: false 1992 }) 1993 .done(function (responceCode) { 1994 if (responceCode !== 'CPT000') { 1995 if (output.hasClass("snackbars")) { 1996 output.html('<p><span class="icon text-middle mdi mdi-check icon-xxs"></span><span>' + captchaMsg[responceCode] + '</span></p>') 1997 1998 setTimeout(function () { 1999 output.removeClass("active"); 2000 }, 3500); 2001 2002 captchaFlag = false; 2003 } else { 2004 output.html(captchaMsg[responceCode]); 2005 } 2006 2007 output.addClass("active"); 2008 } 2009 }); 2010 } 2011 2012 if (!captchaFlag) { 2013 return false; 2014 } 2015 2016 form.addClass('form-in-process'); 2017 2018 if (output.hasClass("snackbars")) { 2019 output.html('<p><span class="icon text-middle fa fa-circle-o-notch fa-spin icon-xxs"></span><span>Sending</span></p>'); 2020 output.addClass("active"); 2021 } 2022 } else { 2023 return false; 2024 } 2025 }, 2026 error: function (result) { 2027 if (isNoviBuilder) 2028 return; 2029 2030 var output = $("#" + $(plugins.rdMailForm[this.extraData.counter]).attr("data-form-output")), 2031 form = $(plugins.rdMailForm[this.extraData.counter]); 2032 2033 output.text(msg[result]); 2034 form.removeClass('form-in-process'); 2035 2036 if (formHasCaptcha) { 2037 grecaptcha.reset(); 2038 } 2039 }, 2040 success: function (result) { 2041 if (isNoviBuilder) 2042 return; 2043 2044 var form = $(plugins.rdMailForm[this.extraData.counter]), 2045 output = $("#" + form.attr("data-form-output")), 2046 select = form.find('select'); 2047 2048 form 2049 .addClass('success') 2050 .removeClass('form-in-process'); 2051 2052 if (formHasCaptcha) { 2053 grecaptcha.reset(); 2054 } 2055 2056 result = result.length === 5 ? result : 'MF255'; 2057 output.text(msg[result]); 2058 2059 if (result === "MF000") { 2060 if (output.hasClass("snackbars")) { 2061 output.html('<p><span class="icon text-middle mdi mdi-check icon-xxs"></span><span>' + msg[result] + '</span></p>'); 2062 } else { 2063 output.addClass("active success"); 2064 } 2065 } else { 2066 if (output.hasClass("snackbars")) { 2067 output.html(' <p class="snackbars-left"><span class="icon icon-xxs mdi mdi-alert-outline text-middle"></span><span>' + msg[result] + '</span></p>'); 2068 } else { 2069 output.addClass("active error"); 2070 } 2071 } 2072 2073 form.clearForm(); 2074 2075 if (select.length) { 2076 select.select2("val", ""); 2077 } 2078 2079 form.find('input, textarea').trigger('blur'); 2080 2081 setTimeout(function () { 2082 output.removeClass("active error success"); 2083 form.removeClass('success'); 2084 }, 3500); 2085 } 2086 }); 2087 } 2088 } 2089 */ 2090 2091 // lightGallery 2092 /* 2093 if (plugins.lightGallery.length) { 2094 for (var i = 0; i < plugins.lightGallery.length; i++) { 2095 initLightGallery(plugins.lightGallery[i]); 2096 } 2097 } 2098 */ 2099 2100 // lightGallery item 2101 /* 2102 if (plugins.lightGalleryItem.length) { 2103 // Filter carousel items 2104 var notCarouselItems = []; 2105 2106 for (var z = 0; z < plugins.lightGalleryItem.length; z++) { 2107 if (!$(plugins.lightGalleryItem[z]).parents('.owl-carousel').length && 2108 !$(plugins.lightGalleryItem[z]).parents('.swiper-slider').length && 2109 !$(plugins.lightGalleryItem[z]).parents('.slick-slider').length) { 2110 notCarouselItems.push(plugins.lightGalleryItem[z]); 2111 } 2112 } 2113 2114 plugins.lightGalleryItem = notCarouselItems; 2115 2116 for (var i = 0; i < plugins.lightGalleryItem.length; i++) { 2117 initLightGalleryItem(plugins.lightGalleryItem[i]); 2118 } 2119 } 2120 */ 2121 2122 // Dynamic lightGallery 2123 /* 2124 if (plugins.lightDynamicGalleryItem.length) { 2125 for (var i = 0; i < plugins.lightDynamicGalleryItem.length; i++) { 2126 initDynamicLightGallery(plugins.lightDynamicGalleryItem[i]); 2127 } 2128 } 2129 */ 2130 2131 // Custom Toggles 2132 if (plugins.customToggle.length) { 2133 for (i = 0; i < plugins.customToggle.length; i++) { 2134 var $this = $(plugins.customToggle[i]); 2135 2136 $this.on('click', $.proxy(function (event) { 2137 event.preventDefault(); 2138 var $ctx = $(this); 2139 $($ctx.attr('data-custom-toggle')).add(this).toggleClass('active'); 2140 }, $this)); 2141
2142 if ($this.attr("data-custom-toggle-disable-on-blur") === "true") { 2143 $("body").on("click", $this, function (e) { 2144 if (e.target !== e.data[0] 2145 && $(e.data.attr('data-custom-toggle')).find($(e.target)).length 2146 && e.data.find($(e.target)).length == 0) { 2147 $(e.data.attr('data-custom-toggle')).add(e.data[0]).removeClass('active'); 2148 } 2149 }) 2150 } 2151 2152 if ($this.attr("data-custom-toggle-disable-on-blur") === "true") { 2153 $('body').on("click", $this, function (e) { 2154 if (e.target !== e.data[0] && $(e.data.attr('data-custom-toggle')).find($(e.target)).length === 0 && e.data.find($(e.target)).length === 0) { 2155 $(e.data.attr('data-custom-toggle')).add(e.data[0]).removeClass('active'); 2156 } 2157 }) 2158 } 2159 } 2160 } 2161 2162 // Countdown 2163 if ( plugins.countdown.length ) { 2164 for ( var i = 0; i < plugins.countdown.length; i++) { 2165 var 2166 node = plugins.countdown[i], 2167 countdown = aCountdown({ 2168 node: node, 2169 from: node.getAttribute( 'data-from' ), 2170 to: node.getAttribute( 'data-to' ), 2171 count: node.getAttribute( 'data-count' ), 2172 tick: 100, 2173 }); 2174 } 2175 } 2176 2177 if(plugins.venobox.length){ 2178// $('.venobox').off('click').on('click', function(e){ e.preventDefault() }).addClass('done'); 2179 plugins.venobox.venobox({ 2180 /* 2181 framewidth: '400px', // default: '' 2182 frameheight: '300px', // default: '' 2183 border: '10px', // default: '0' 2184 bgcolor: '#5dff5e', // default: '#fff' 2185 titleattr: 'data-title', // default: 'title' 2186 numeratio: true, // default: false 2187 infinigall: true // default: false 2188 */ 2189 }); 2190 } 2191 2192 if(plugins.photoUploaders.length){ 2193 plugins.photoUploaders.forEach(pu => { 2194 initPhotoUploader(pu); 2195 }); 2196 } 2197 2198 }); 2199 2200}()); 2201
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.