1/*jslint browser: true*/ 2/*jslint white: true */ 3/*global $,jQuery,ozy_headerType,headerMenuFixed,alert,$OZY_WP_AJAX_URL,$OZY_WP_IS_HOME,$OZY_WP_HOME_URL,addthis*/ 4 5/* Wedding Planner WordPress Theme Main JS File */ 6 7/** 8* Call Close Fancybox 9*/ 10function close_fancybox(){ 11 "use strict"; 12 jQuery.fancybox.close(); 13} 14 15/** 16* Read cookie 17* 18* @key - Cookie key 19*/ 20function getCookieValue(key) { 21 "use strict"; 22 var currentcookie = document.cookie, firstidx, lastidx; 23 if (currentcookie.length > 0) 24 { 25 firstidx = currentcookie.indexOf(key + "="); 26 if (firstidx !== -1) 27 { 28 firstidx = firstidx + key.length + 1; 29 lastidx = currentcookie.indexOf(";", firstidx); 30 if (lastidx === -1) 31 { 32 lastidx = currentcookie.length; 33 } 34 return decodeURIComponent(currentcookie.substring(firstidx, lastidx)); 35 } 36 } 37 return ""; 38} 39 40/** 41* Cookie checker for like system 42* 43* @post_id - WordPress post ID 44*/ 45function check_favorite_like_cookie(post_id) { 46 "use strict"; 47 var str = getCookieValue( "post_id" ); 48 if(str.indexOf("[" + post_id + "]") > -1) { 49 return true; 50 } 51 52 return false; 53} 54 55/** 56* Cokie writer for like system 57* 58* @post_id - WordPress post ID 59*/ 60function write_favorite_like_cookie(post_id) { 61 "use strict"; 62 var now = new Date(); 63 now.setMonth( now.getYear() + 1 ); 64 post_id = "[" + post_id + "]," + getCookieValue("post_id"); 65 document.cookie="post_id=" + post_id + "; expires=" + now.toGMTString() + "; path=/; "; 66} 67 68/** 69* Cookie Notice Banner 70*/ 71function ozy_cookie_notice_banner() { 72 "use strict"; 73 if(getCookieValue( "wedding_planner_cookie_banner" ) != '1') { 74 jQuery('#ozy-cookie_notice_banner').addClass('show'); 75 76 jQuery('#ozy-cookie_notice_banner a.generic-button').on("click", function(e){ 77 e.preventDefault(); 78 79 var now = new Date(); 80 now.setMonth( now.getYear() + 1 ); 81 document.cookie="wedding_planner_cookie_banner=" + "1; expires=" + now.toGMTString() + "; path=/; "; 82 jQuery('#ozy-cookie_notice_banner').removeClass('show'); 83 84 return false; 85 }); 86 } 87} 88 89/** 90* Like buttons handler 91* 92* @post_id - WordPress post ID 93* @p_post_type 94* @p_vote_type 95* @$obj 96*/ 97function ajax_favorite_like(post_id, p_post_type, p_vote_type, $obj) { 98 "use strict"; 99 if( !check_favorite_like_cookie( post_id ) ) { //check, if there is no id in cookie 100 jQuery.ajax({ 101 url: ozy_headerType.$OZY_WP_AJAX_URL, 102 data: { action: 'wedding_planner_ajax_like', vote_post_id: post_id, vote_post_type: p_post_type, vote_type: p_vote_type }, 103 cache: false, 104 success: function(data) { 105 //not integer returned, so error message 106 if( parseInt(data,0) > 0 ){ 107 write_favorite_like_cookie(post_id); 108 jQuery('span', $obj).text(data); 109 } else { 110 alert(data); 111 } 112 }, 113 error: function(MLHttpRequest, textStatus, errorThrown){ 114 alert("MLHttpRequest: " + MLHttpRequest + "\ntextStatus: " + textStatus + "\nerrorThrown: " + errorThrown); 115 } 116 }); 117 } 118} 119 120/** 121* Load more button handler 122* 123* @order 124* @orderby 125* @item_count 126* @category_name 127* @offset 128* @found 129* @e 130* @layout_type 131*/ 132function ozy_ajax_load_more_blog(order, orderby, item_count, category_name, offset, found, e, layout_type, fitRows) { 133 134 jQuery.ajax({ 135 url: ozy_headerType.$OZY_WP_AJAX_URL, 136 data: { action: 'wedding_planner_ajax_load_more', p_order : order, p_orderby : orderby, p_item_count : item_count, p_category_name : category_name, p_offset : offset, p_layout_type : layout_type}, 137 cache: false, 138 success: function(data) { 139 140 jQuery('.wpb_wrapper.isotope').append(data); 141 142 if(layout_type === 'portfolio') { 143 ozy_page_template_page_portfolio_init(); 144 }else{ 145 ozy_page_template_page_isotope_blog_init(fitRows); 146 } 147 148 jQuery(e).find('a.button').html( jQuery(e).data('loadmorecaption') + '<span></span><span></span>'); 149 150 if((item_count + offset) >= found) { 151 jQuery(e).hide(); 152 } 153 154 var load_more_button_top_pos = e.position(); 155 jQuery('html, body').animate({scrollTop: load_more_button_top_pos.top }, 'slow'); 156 157 }, 158 error: function(MLHttpRequest, textStatus, errorThrown){ 159 alert(errorThrown); 160 } 161 }); 162 163} 164 165function ozy_ajax_load_more_blog_action() { 166 jQuery(".load_more_blog").click(function(e) { 167 168 e.preventDefault(); 169 170 jQuery(this).find('a.button').html( jQuery(this).data('loadingcaption') + '<span></span><span></span>'); 171 172 var order = jQuery(this).data("order"); 173 var orderby = jQuery(this).data("orderby"); 174 var item_count = jQuery(this).data("item_count"); 175 var excerpt_length = jQuery(this).data("excerpt_length"); 176 var category_name = jQuery(this).data("category_name"); 177 var offset = jQuery(this).data("offset"); 178 var found = jQuery(this).data("found"); 179 var layout_type = jQuery(this).data("layout_type"); 180 var fitRows = jQuery(this).data("fitrows"); 181 182 offset = offset + item_count; 183 ozy_ajax_load_more_blog(order, orderby, item_count, category_name, offset, found, jQuery(this), layout_type, fitRows); 184 jQuery(this).data("offset", offset); 185 186 return false; 187 188 }); 189} 190 191function ozy_page_template_page_portfolio_init() { 192 var $container_portfolio, visible_item_count = 8; 193 jQuery('.isotope').each(function() { 194 var $that = jQuery(this); 195 $that.imagesLoaded( function() { 196 var conf_arr = { 197 filter: '', 198 itemSelector: '.ozy_portfolio', 199 layoutMode: 'masonry', 200 masonry: {} 201 }; 202 if($that.hasClass('custom-gutter')) { 203 visible_item_count = parseInt($that.data('visible_item_count')) + 2; 204 conf_arr['masonry'] = { 205 columnWidth: '.grid-sizer', 206 gutter: '.gutter-sizer' 207 }; 208 }else{ 209 visible_item_count = $that.data('visible_item_count'); 210 conf_arr['masonry'] = { 211 gutter:0 212 }; 213 } 214 conf_arr['filter'] = jQuery('.ozy-portfolio-listing').length>0 ? ':nth-child(-n+'+ visible_item_count +')' : ''; 215 jQuery('.isotope.loaded-already').isotope('destroy'); 216 $container_portfolio = $that.addClass('loaded-already').isotope(conf_arr); 217 218 jQuery('.load_more_blog').animate({opacity:1}, 300, 'easeInOutExpo'); 219 220 if(jQuery('.ozy-portfolio-listing').length<=0) { 221 jQuery('#portfolio-filter a').each(function() { 222 if(!jQuery('.isotope>div' + jQuery(this).data('filter')).length) { 223 jQuery(this).addClass('disabled').parent('li').animate({opacity:'.3'}, 300, 'easeInOutExpo'); 224 }else{ 225 jQuery(this).removeClass('disabled').parent('li').animate({opacity:'1'}, 300, 'easeInOutExpo'); 226 } 227 }); 228 } 229 230 // Deep linking, just finds the filtering links and calling click of it 231 if (location.hash.indexOf('#') > -1) { 232 let $deep_link_filter = '.category-' + location.hash.substring(('#').length); 233 jQuery('#portfolio-filter a[data-filter="'+ $deep_link_filter +'"]').click(); //$container_portfolio.isotope({ filter: $deep_link_filter }); 234 } 235 }); 236 }); 237 238 // bind filter button click 239 jQuery('#portfolio-filter a').on( 'click', function(e) { 240 e.preventDefault(); 241 if(jQuery(this).hasClass('disabled')) {return false;} 242 var filterValue = jQuery(this ).attr('data-filter'); 243 $container_portfolio.isotope({ filter: filterValue });
244 jQuery(this).parents('ul').find('li').removeClass('active');jQuery(this).parent('li').addClass('active'); 245 return false; 246 }); 247} 248 249/** 250* Popup window launcher 251* 252* @url - Url address for the popup window 253* @title - Popup window title 254* @w - Width of the window 255* @h - Height of the window 256*/ 257function ozyPopupWindow(url, title, w, h) { 258 "use strict"; 259 var left = (screen.width/2)-(w/2), top = (screen.height/2)-(h/2); 260 return window.open(url, title, 'toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbars=no, resizable=no, copyhistory=no, width='+w+', height='+h+', top='+top+', left='+left); 261} 262 263/** 264* To check iOS devices and versions 265*/ 266function ozyCheckIsMobile() { 267 "use strict"; 268 return (/Mobi/.test(navigator.userAgent)); 269} 270 271function ozyCheckIs768el() { 272 "use strict"; 273 return jQuery(window).width()<=768 ? true : false; 274} 275 276function ozyCheckIs1440el() { 277 "use strict"; 278 return jQuery(window).width()<=1440 ? true : false; 279} 280 281function ozyCheckMac(){ 282 "use strict"; 283 var isMac = /(mac)/.exec( window.navigator.userAgent.toLowerCase() ); 284 return ( isMac != null && isMac.length ); 285} 286 287function ozyCheckFirefox() { 288 if(navigator.userAgent.toLowerCase().indexOf('firefox') > -1){ 289 return true; 290 } 291 return false; 292} 293 294function ozyCheckChrome() { 295 "use strict"; 296 var isChrome = /Chrome/.test(navigator.userAgent) && /Google Inc/.test(navigator.vendor); 297 var isSafari = /Safari/.test(navigator.userAgent) && /Apple Computer/.test(navigator.vendor); 298 return isChrome || isSafari; 299} 300 301/** 302* ozy_full_row_fix 303* 304* Set sections to document height which matches with selector 305*/ 306function ozy_full_row_fix() { 307 "use strict"; 308 /* Countdown Page */ 309 if(jQuery('body.page-template-page-countdown').length || jQuery('body.page-template-page-revo-full').length) { 310 jQuery('#content').height(jQuery(window).height() - 80); //-80 for top bottom padding 311 } 312} 313 314function ozy_share_button() { 315 "use strict"; 316 jQuery(document).on('click', 'a.footer-share-buttons, body.single .post-submeta>a:not(.blog-like-link)', function(e) { 317 e.preventDefault(); 318 ozyPopupWindow(jQuery(this).attr('href'), 'Share', 640, 440); 319 }); 320} 321 322/** 323* ozy_hash_scroll_fix 324* 325* Check if there is a hash and scrolls to there, onload 326*/ 327function ozy_hash_scroll_fix() { 328 "use strict"; 329 setTimeout(function(){ 330 if(window.location.hash) { 331 var hash = window.location.hash; 332 if(jQuery(hash).length) { 333 jQuery('html,body').animate({scrollTop: jQuery(hash).offset().top}, 1600, 'easeInOutExpo'); 334 } 335 }}, 200); 336} 337 338function ozy_custom_map_mobile_full_height_fix() { 339 /* Google Map */ 340 if ('undefined' !== typeof jQuery.fn.prettyMaps) { 341 if( jQuery(window).width() <= 479) { 342 jQuery('.ozy-google-map:not(.init-later)').each(function(index, element) { 343 if(jQuery(this).data('height').toString().indexOf('%') !== -1) { 344 jQuery(this).height('400px'); 345 } 346 }); 347 } else { 348 jQuery('.ozy-google-map:not(.init-later)').each(function(index, element) { 349 if(jQuery(this).data('height').toString().indexOf('%') !== -1) { 350 jQuery(this).height(jQuery(this).data('height')); 351 } 352 }); 353 } 354 } 355} 356 357var ozy_ticker_containerheight = 0, ozy_ticker_numbercount = 0, ozy_ticker_liheight, ozy_ticker_index = 1, ozy_ticker_timer; 358function ozy_callticker() { 359 "use strict"; 360 jQuery(".ozy-ticker ul").stop().animate({ 361 "margin-top": (-1) * (ozy_ticker_liheight * ozy_ticker_index) 362 }, 1500); 363 jQuery('#ozy-tickerwrapper .pagination>a').removeClass('active');jQuery('#ozy-tickerwrapper .pagination>a[data-slide="'+ (ozy_ticker_index) +'"]').addClass('active');//bullet active 364 if (ozy_ticker_index != ozy_ticker_numbercount - 1) { 365 ozy_ticker_index = ozy_ticker_index + 1; 366 }else{ 367 ozy_ticker_index = 0; 368 } 369 ozy_ticker_timer = setTimeout("ozy_callticker()", 3600); 370} 371 372/* Resets windows scroll position if there is a hash to make it work smooth scroll*/ 373var windowScrollTop = jQuery(window).scrollTop(); 374window.scrollTo(0, 0); 375setTimeout(function() { 376 "use strict"; 377 window.scrollTo(0, windowScrollTop); 378}
378, 1); 379 380jQuery(window).resize(function() { 381 "use strict"; 382 ozy_full_row_fix(); 383 ozy_custom_map_mobile_full_height_fix(); 384}); 385 386jQuery(window).on('load', function(){ 387 if (jQuery().masonry) { 388 /* Search page */ 389 if(jQuery('body.search-results').length) { 390 jQuery('body.search-results .post-content>div').imagesLoaded( function(){ 391 jQuery('body.search-results .post-content>div').masonry({ 392 itemSelector : 'article.result', 393 gutter : 20 394 }); 395 }); 396 } 397 } 398 399 /* Row Kenburns Slider */ 400 jQuery('.smoothslides').each(function() { 401 jQuery(jQuery(this)).smoothSlides({ 402 effectModifier: (ozyCheckFirefox() ? 1 : 1.3), 403 effectDuration:5000, 404 navigation:false, 405 pagination:false, 406 matchImageSize:false 407 }); 408 }); 409 410 /* Testimonial Slider Bullet Fix */ 411 jQuery('div.flickity-carousel').find('.testimonial').each(function(index, element) { 412 jQuery(this).parents('div.flickity-carousel').find('ol.flickity-page-dots').css('bottom', '25px'); 413 return; 414 }); 415 416 /*Music Player*/ 417 if(jQuery('#wedding_planner_mp3_player').length && jQuery(window).width() >= 768) { 418 function ss_soundbits(sound){ 419 var audio_element = document.getElementById("wedding_planner_mp3_player"); 420 audio_element.playclip=function(){ 421 audio_element.pause(); 422 audio_element.currentTime=0; 423 audio_element.play(); 424 }; 425 return audio_element; 426 } 427
428 function ss_sounbit_cookie_check(post_id) { 429 "use strict"; 430 var str = getCookieValue( "post_id_audio"+ post_id ); 431 if(str == 'true') 432 return true; 433 return false; 434 } 435 436 function ss_sounbit_cookie_write(post_id, val) { 437 "use strict"; 438 var now = new Date(); 439 now.setMonth( now.getYear() + 1 ); 440 document.cookie="post_id_audio"+ post_id +"=" + val + "; expires=" + now.toGMTString() + "; path=/; "; 441 } 442 443 var audio = ss_soundbits(ozy_headerType.mp3_file) 444 445 var stopped = false; 446 //check if music previously stopped 447 if(!ss_sounbit_cookie_check(ozy_headerType.post_id)) { 448 audio.playclip(); 449 } else { 450 stopped = true; 451 } 452 453 audio.addEventListener('ended', function() { 454 if(!stopped){ 455 this.currentTime = 0; 456 this.play(); 457 } 458 }, false); 459 460 jQuery('#music-play').click(function(e) { 461 e.preventDefault(); 462 if(stopped) { 463 stopped = false; 464 audio.play(); 465 }else{ 466 stopped = true; 467 audio.pause(); 468 } 469 jQuery(this).attr('data-stopped', stopped); 470 ss_sounbit_cookie_write(ozy_headerType.post_id, stopped); 471 }).attr('data-stopped', stopped); 472 } 473 474 /* WooCommerce Category & Product Pages */ 475 wedding_planner_shop_page_masonry(); 476}); 477 478function wedding_planner_shop_page_masonry() { 479 if (jQuery().isotope) { 480 if(jQuery('.woocommerce ul.products').length) { 481 jQuery('.woocommerce ul.products').imagesLoaded( function(){ 482 try { 483 jQuery('.woocommerce ul.products').isotope('reloadItems'); 484 } catch (error) { 485 // nothing, just ignore. 486 } 487 jQuery('.woocommerce ul.products').isotope({ 488 layoutMode: 'fitRows', 489 itemSelector: 'li.product', 490 isAnimated: true, 491 fitRows: { 492 gutter: '.woo-gutter-spacer' 493 } 494 }); 495 }); 496 } 497 } 498} 499 500/* Sticky Menu, only works on desktop devices */ 501function wedding_planner_ozy_menu_bg_color_fixer() { 502 "use strict"; 503 var do_time = 0; 504 var headerMenuFixed = false; 505 jQuery.doTimeout('scroll', do_time, function(){ 506 if(!jQuery('body').hasClass('force-transparent-menu') && !jQuery('body').hasClass('ozy-menu-script')) { 507 if(jQuery(window).scrollTop() >= 50) { 508 if(!headerMenuFixed) { 509 jQuery('body').addClass('ozy-alternate-menu'); 510 } 511 } else { 512 jQuery('body').removeClass('ozy-alternate-menu'); 513 headerMenuFixed = false; 514 } 515 } 516 517 /* Cookie Notice Banner Visibility */ 518 if(jQuery('#ozy-cookie_notice_banner').length) { 519 if(jQuery(window).scrollTop() >= 150) { 520 jQuery('#ozy-cookie_notice_banner').addClass('in-viewport'); 521 }else{ 522 jQuery('#ozy-cookie_notice_banner').removeClass('in-viewport'); 523 } 524 } 525 }); 526} 527 528jQuery(window).scroll(function() { 529 "use strict"; 530 wedding_planner_ozy_menu_bg_color_fixer(); 531}); 532 533jQuery(document).ajaxComplete(function() { 534 /*re init lighgallery for newly loaded items*/ 535 if(jQuery('.wpb_wrapper.isotope').length) { 536 var $target_gallery = jQuery('.wpb_wrapper.isotope'); 537 if($target_gallery.data('lightGallery')) { 538 $target_gallery.data('lightGallery').destroy(true); 539 } 540 $target_gallery.lightGallery({ 541 selector: '.lightgallery', 542 thumbnail:true 543 }); 544 545 jQuery(".ozy_portfolio:not(.zs-wrapper)").zoomScroller({ 546 onZoom: function(el, zoomType) { 547 if (zoomType == "in") { 548 el.find(".caption").fadeIn("slow"); 549 } else { 550 el.find(".caption").fadeOut("slow"); 551 } 552 } 553 }); 554 } 555 556 /* re init woocommerce shop page on ajax event complete */ 557 if(jQuery('body').hasClass('woocommerce-shop')) { 558 wedding_planner_shop_page_masonry(); 559 } 560}); 561 562jQuery(document).ready(function($) { 563 "use strict"; 564 565 jQuery(window).scroll(); //init logo switch for first time 566 567 ozy_share_button(); 568 569 ozy_full_row_fix(); 570 571 ozy_ajax_load_more_blog_action(); 572 573 ozy_hash_scroll_fix(); 574 575 ozy_cookie_notice_banner(); 576 577 /* Animsition */ 578 if(ozy_Animsition.is_active) { 579 $(".animsition").animsition({ 580 inClass: 'fade-in', 581 outClass: 'fade-out', 582 inDuration: 1500, 583 outDuration: 800, 584 linkElement: 'nav.navbar.bootsnav ul.nav li>a:not([target="_blank"]):not([href^="#"])', // e.g. linkElement: 'a:not([target="_blank"]):not([href^=#])' 585 loading: true, 586 loadingParentElement: 'body', //animsition wrapper element 587 loadingClass: 'square-loader',//'uil-ring-css',//'animsition-loading', 588 loadingInner: '<div><div><svg class="loader_1" xmlns="http://www.w3.org/2000/svg" width="70" height="70" viewB
588ox="-50 -50 244 265"><title></title><desc></desc><g><path class="line_1" stroke-width="2" stroke="#000" fill="#000" opacity=".9"d="M72.7 0.6L72.7 0.6C74.8 0.6 76.4 2.4 76.4 4.6L76.4 36.6C76.4 38.8 74.8 40.6 72.7 40.6 70.7 40.6 69.1 38.8 69.1 36.6L69.1 4.6C69.1 2.4 70.7 0.6 72.7 0.6"/><path class="line_2" stroke-width="2" stroke="#000" opacity="0.8" fill="#000" d="M137.8 40.6C137.1 40.6 136.4 40.8 135.7 41.2L107.5 58.2C105.6 59.4 104.9 62 106 64 106.8 65.3 108.1 66.1 109.6 66.1 110.2 66.1 110.9 65.9 111.6 65.5L139.8 48.5C141.8 47.4 142.4 44.8 141.3 42.7 140.6 41.4 139.2 40.6 137.8 40.6"/><path class="line_3" stroke-width: "2" stroke="#000" opacity="0.6" fill="#000" d="M109.6 102.5C108.1 102.5 106.8 103.3 106 104.6 104.9 106.7 105.6 109.3 107.5 110.5L135.7 127.4C136.4 127.8 137.1 128 137.8 128 139.2 128 140.6 127.3 141.3 125.9 142.4 123.9 141.8 121.3 139.8 120.1L111.6 103.1C110.9 102.7 110.2 102.5 109.6 102.5"/><path class="line_4" stroke-width="2" stroke="#000" opacity="0.6" fill="#000" d="M72.7 124.4C70.7 124.4 69.1 126.2 69.1 128.4L69.1 160.4C69.1 162.6 70.7 164.4 72.7 164.4 74.8 164.4 76.4 162.6 76.4 160.4L76.4 128.4C76.4 126.2 74.8 124.4 72.7 124.4"/><path class="line_5" stroke-width="2" stroke="#000" opacity="0.4" fill="#000" d="M32.3 102.5C31.6 102.5 30.9 102.7 30.3 103.1L2 120.1C0.1 121.3-0.6 123.9 0.5 125.9 1.3 127.3 2.7 128 4.1 128 4.8 128 5.5 127.8 6.1 127.4L34.3 110.5C36.3 109.3 37 106.7 35.8 104.6 35.1 103.3 33.7 102.5 32.3 102.5"/><path class="line_6" stroke-width="2" stroke="#000" opacity="0.2" fill="#000" d="M4.1 40.6C2.7 40.6 1.3 41.4 0.5 42.7 -0.6 44.8 0.1 47.4 2 48.5L30.3 65.5C30.9 65.9 31.6 66.1 32.3 66.1 33.7 66.1 35.1 65.3 35.8 64 37 62 36.3 59.4 34.3 58.2L6.1 41.2C5.5 40.8 4.8 40.6 4.1 40.6"/></g></svg></div></div>', // e.g '<img src="loading.svg" />' 589 timeout: true, 590 timeoutCountdown: 3000, 591 onLoadEvent: true, 592 browser: [ 'animation-duration', '-webkit-animation-duration'], 593 overlay : false, 594 overlayClass : 'animsition-overlay-slide', 595 overlayParentElement : 'body', 596 transition: function(url){ window.location.href = url; } 597 }); 598 } 599 600 /* Menu Link */ 601 $('nav.navbar.bootsnav ul.nav>li>a[href*="#"]:not([href="#"]),#content a[href^="#"]:not([data-filter]),#content a.vc_btn3[href*="#"],.widget ul.menu>li>a[href*="#"]').click(function(e) { 602 var pattern = /^((http|https|ftp):\/\/)/; 603 if(pattern.test(this.href)) { 604 e.preventDefault(); 605 if(ozy_click_hash_check(this)) { 606 if(ozy_Animsition.is_active) { 607 $('.animsition').animsition('out', $(e.target), ozy_headerType.$OZY_WP_HOME_URL + this.hash); 608 }else{ 609 window.location = ozy_headerType.$OZY_WP_HOME_URL + this.hash; 610 } 611 } 612 }else if (/#/.test(this.href)) { 613 e.preventDefault(); 614 if(ozy_click_hash_check(this)) { 615 if(ozy_Animsition.is_active) { 616 $('.animsition').animsition('out', $(e.target), ozy_headerType.$OZY_WP_HOME_URL + $(this).attr('href')); 617 }else{ 618 window.location = ozy_headerType.$OZY_WP_HOME_URL + $(this).attr('href'); 619 } 620 } 621 }else{ 622 if(ozy_Animsition.is_active) { 623 e.preventDefault(); 624 $('.animsition').animsition('out', $(e.target), $(this).attr('href')); 625 } 626 } 627 }); 628 629 /* Search Button & Stuff */ 630 $(document).on('touchstart, click', '#close-search-overlay,.attr-nav>ul>li.search>a', function(e) { 631 e.preventDefault(); 632 $('body').toggleClass('search-overlay-open');$('#search-overlay #search').focus(); 633 }); 634 $(document).keyup(function(e) { 635 if (e.which == 27) { 636 $('body').removeClass('search-overlay-open'); 637 } 638 e.preventDefault(); 639 }); 640 641 /* Floating Share Bar */ 642 $('#floating-share>span:first-child, #close-floating-share-bar').click(function(e) { 643 $('body').toggleClass('floatin-share-bar-open'); 644 e.preventDefault(); 645 }); 646 647 /* Language Switcher */ 648 $('.lang-switcher').click(function(e) { 649 $('.lang-switcher-dropdown,.top-info-bar>div>span.lang-switcher').toggleClass('open'); 650 e.preventDefault(); 651 }); 652 653 /* Product page Qantity Form */ 654 $('body.single form.cart').find('.button').each(function(){ 655 $(this).height($(this).find('input.qty').outerHeight() ? $(this).find('input.qty').outerHeight() : '50px'); 656 }); 657 658 function customQtyButtons(){ 659 //$('.qty-plus, .qty-minus').unbind('click'); 660 $('.quantity').off('click', '.qty-plus').on('click', '.qty-plus', function() { 661 var _field = $(this).parents('.quantity').find('input.qty'); 662 var _new_val = parseFloat(_field.val()) + 1; var _max = parseFloat(_field.attr('max')); 663 _field.val( _new_val <= _max ? _new_val : parseFloat(_field.val()) ).change(); 664 }); 665 666 $('.quantity').off('click', '.qty-minus').on('click', '.qty-minus', function() { 667 var _field = $(this).parents('.quantity').find('input.qty'); 668 var _new_val = parseFloat(_field.val()) - 1; var _min = parseFloat(_field.attr('min')); 669 _field.val( _new_val >= _min ? _new_val : parseFloat(_field.val()) ).change(); 670 }); 671 } 672 673 jQuery(document).ajaxComplete(function() { 674 customQtyButtons(); 675 }); 676 677 customQtyButtons(); 678 679 $('body.single-product .comment-form .comment-form-comment label').each(function(){ 680 $(this).insertAfter( $(this).next('input') ); 681 $(this).insertAfter( $(this).next('textarea') ); 682 }); 683 684 /* WooCommerce Basket */ 685 function woocommerce_mini_cart() { 686 if($('a.cart-contents').length && $('#woocommerce-cart-wrapper').length) { 687 $('a.cart-contents,#woocommerce-cart-wrapper>h3>.fa.fa-chevron-circle-right').unbind('click').on('click', function(e){
688 e.preventDefault(); 689 $('body').toggleClass('cart-open'); 690 return false; 691 }); 692 jQuery(document).on("click", function(e) { 693 var basket_div = jQuery('body.cart-open #woocommerce-cart-wrapper'); 694 if (!basket_div.is(e.target) && !basket_div.has(e.target).length && basket_div.is(':visible') && !jQuery(e.target).hasClass('ajax-basket')) { 695 $('body').toggleClass('cart-open'); 696 } 697 }); 698 } 699 } 700 if(ozy_headerType.woocommerce_active) { 701 var woo_cart_init_count = 0; 702 703 $('.cart_list.product_list_widget').niceScroll({scrollbarid:"mini-cart-scrollbar", autohidemode:"false", cursorwidth: "6px", cursorcolor: "rgba(33,30,31,.5)", cursorborder: "none"}); 704 705 jQuery(window).on('load', function(){ 706 woocommerce_mini_cart(); 707 }); 708 709 jQuery(document).ajaxComplete(function() { 710 woocommerce_mini_cart(); 711 if(woo_cart_init_count>1) { $('#mini-cart-scrollbar, #mini-cart-scrollbar-hr').remove(); } 712 $('.cart_list.product_list_widget').niceScroll({scrollbarid:"mini-cart-scrollbar", autohidemode:"false", cursorwidth: "6px", cursorcolor: "rgba(33,30,31,.5)", cursorborder: "none"}); 713 woo_cart_init_count++; 714 }); 715 716 // WooCommerce Ajax delete product in the cart 717 $(document).on('click', '.mini_cart_item a.remove', function (e) { 718 e.preventDefault(); 719 720 var product_id = $(this).attr("data-product_id"), 721 cart_item_key = $(this).attr("data-cart_item_key"), 722 product_container = $(this).parents('.mini_cart_item'); 723 724 // Add loader 725 product_container.block({ 726 message: null, 727 overlayCSS: { 728 cursor: 'none' 729 } 730 }); 731 732 $.ajax({ 733 type: 'POST', 734 dataType: 'json', 735 url: wc_add_to_cart_params.ajax_url, 736 data: { 737 action: "product_remove", 738 product_id: product_id, 739 cart_item_key: cart_item_key 740 }, 741 success: function(response) { 742 if ( ! response || response.error ) { 743 return; 744 } 745 746 var fragments = response.fragments; 747 748 // Replace fragments 749 if ( fragments ) { 750 $.each( fragments, function( key, value ) { 751 $( key ).replaceWith( value ); 752 }); 753 } 754 } 755 }); 756 }); 757 } 758 759 760 function ozy_visual_stuff() { 761 /* Blog Share Button*/ 762 $(document).on('click', '.post-submeta>a.post-share, .big-blog-post-submeta>a.post-share', function(e) { 763 if($(this).data('open') !== '1') { 764 $(this).data('open', '1').next('div').stop().animate({'margin-left': '0', opacity: 'show'}, 300, 'easeInOutExpo'); 765 }else{ 766 $(this).data('open', '0').next('div').stop().animate({'margin-left': '30px', opacity: 'hide'}, 300, 'easeInOutExpo'); 767 } 768 e.preventDefault(); 769 }); 770 $(document).on("click", function(e) { 771 var post_share_button = $(".post-submeta>a.post-share, .big-blog-post-submeta>a.post-share"); 772 if (!post_share_button.is(e.target) && !post_share_button.has(e.target).length) { 773 post_share_button.data('open', '0').next('div').stop().animate({'margin-left': '30px', opacity: 'hide'}, 300, 'easeInOutExpo'); 774 } 775 }); 776 777 /* Tooltip plugin init */ 778 $(function(){ 779 $('.tooltip-top').tooltipsy({className:'tooltipsy white', offset: [0, 20]}); 780 $('.tooltip').tooltipsy(); 781 }); 782 783 /* YouTube Embed */ 784 $('.oytb-videoWrapper').each(function(index, element) { 785 var $poster = $(this); 786 var $wrapper = $poster.closest(this); 787 788 $(this).click(function(ev){ 789 ev.preventDefault(); 790 videoPlay($wrapper); 791 }); 792 793 function videoPlay($wrapper) { 794 var $iframe = $wrapper.find('.oytb-js-videoIframe'); 795 var src = $iframe.data('src'); 796 $wrapper.addClass('oytb-videoWrapperActive'); 797 $poster.parent('div').find('.oytb-video-StopButton').show(100, 'easeInOutExpo'); 798 $iframe.attr('src',src); 799 } 800 801 $('.oytb-video-StopButton').click(function(){ 802 videoStop($wrapper); 803 }); 804 805 function videoStop($wrapper) { 806 if (!$wrapper) { 807 var $wrapper = $('.oytb-js-videoWrapper'); 808 var $iframe = $('.oytb-js-videoIframe'); 809 } else { 810 var $iframe = $wrapper.find('.oytb-js-videoIframe'); 811 } 812 $wrapper.removeClass('oytb-videoWrapperActive'); 813 $poster.parent('div').find('.oytb-video-StopButton').hide(100, 'easeInOutExpo'); 814 $iframe.attr('src',''); 815 } 816 }); 817 818 /* Flickity See All switch button */ 819 $('.flickity-carousel-wrapper>.flickity-carousel.carousel').each(function(index, element) { 820 var $carousel = $(this); 821 var isFlickity = true; 822 // toggle Flickity on/off 823 $('.flickity-see-all').on( 'click', function() { 824 //switch button label 825 var button_label = $(this).toggleClass('grid-open').data('label');$(this).data('label', $(this).html());$(this).html(button_label); 826 827 if ( isFlickity ) { 828 //setup isotope 829 var conf_arr = { 830 layoutMode: 'packery', 831 itemSelector: '.carousel-cell' 832 }; 833 $carousel.toggleClass('flickity-carousel-grid').flickity('destroy').isotope(conf_arr); 834 835 //isotope animation 836 var anim_timing = 0.25; 837 $carousel.find('.carousel-cell').each(function(index, element) { 838 $(this).css({'-webkit-transform' : 'translateX(200%)', 'transform' : 'translateX(200%)', '-webkit-animation' : 'comeFromRight '+anim_timing+'s ease-in-out forwards', 'animation' : 'comeFromRight '+anim_timing+'s ease-in-out forwards'}); 839 anim_timing = anim_timing + 0.10; 840 }); 841 842 } else { 843 //init new Flickity 844 var data_flickity_str = $carousel.attr('data-flickity'); 845 $carousel.isotope('destroy').toggleClass('flickity-carousel-grid').flickity(JSON.parse(data_flickity_str)); 846 } 847 isFlickity = !isFlickity; 848 return false; 849 }); 850 }); 851 852 /* Custom Buttons */ 853 $('.ozy-custom_button.ocbtn-6') 854 .on('mouseenter', function(e) { 855 var parentOffset = $(this).offset(), 856 relX = e.pageX - parentOffset.left, 857 relY = e.pageY - parentOffset.top; 858 $(this).find('span').css({top:relY, left:relX}) 859 }) 860 .on('mouseout', function(e) { 861 var parentOffset = $(this).offset(), 862 relX = e.pageX - parentOffset.left, 863 relY = e.pageY - parentOffset.top; 864 $(this).find('span').css({top:relY, left:relX}) 865 }); 866 } 867 868 ozy_visual_stuff(); 869 870 function ozy_vc_components() { 871 /* Google Map */ 872 if ('undefined' !== typeof jQuery.fn.prettyMaps) {
873 $('.ozy-google-map:not(.init-later)').each(function(index, element) { 874 if($(this).data('height').toString().indexOf('%') !== -1) { 875 $(this).parent('div.wpb_wrapper').css('height', '100%'); 876 } 877 $(this).parent().append( 878 $('<div class="gmaps-cover"></div>').click(function(){ $(this).remove(); }) 879 ); 880 $(this).prettyMaps({ 881 address: $(this).data('address'), 882 zoom: $(this).data('zoom'), 883 panControl: true, 884 zoomControl: true, 885 mapTypeControl: true, 886 scaleControl: true, 887 streetViewControl: true, 888 overviewMapControl: true, 889 scrollwheel: true, 890 image: $(this).data('icon'), 891 hue: $(this).data('hue'), 892 saturation: $(this).data('saturation'), 893 lightness: $(this).data('lightness') 894 }); 895 }); 896 ozy_custom_map_mobile_full_height_fix(); 897 } 898 899 /* Counter */ 900 if ('undefined' !== typeof jQuery.fn.waypoint) { 901 jQuery('.ozy-counter>.timer').waypoint(function() { 902 if(!$(this.element).hasClass('ran')) { 903 $(this.element).addClass('ran').countTo({ 904 from: $(this.element).data('from'), 905 to: $(this.element).data('to'), 906 speed: 5000, 907 refreshInterval: 25, 908 sign: $(this.element).data('sign'), 909 signpos: $(this.element).data('signpos') 910 }); 911 } 912 },{ 913 offset: '85%' 914 }); 915 } 916 917 /* Sticky Footer Info Bar */ 918 if(!ozyCheckIsMobile()) { 919 jQuery('#footer-widget-bar').waypoint(function(direction) { 920 jQuery('#footer-widget-bar-sticky').removeClass('inherit fixed').addClass((direction !== 'down' ? 'fixed' : 'inherit')); 921 },{ 922 offset: '95%' 923 }); 924 } 925 $('#footer-widget-bar-sticky #close-footer-info-bar').click(function(e) { 926 e.preventDefault(); 927 $('#footer-widget-bar-sticky').animate({height:0, opacity:0}, 200, 'easeInOutExpo'); 928 }); 929 930 /* Hearts Background */ 931 function heartsBackground() { 932 $(".vc_row.has-heart-bg").each(function(index, element) { 933 var love = setInterval(function(){ 934 var r_num = Math.floor(Math.random() * 40) + 1; 935 var r_size = Math.floor(Math.random() * 35) + 10; 936 var r_left = Math.floor(Math.random() * 100) + 1; 937 var r_bg = Math.floor(Math.random() * 25) + 100; 938 var r_time = Math.floor(Math.random() * 5) + 5; 939 940 $(element).append("<div class='heart' style='width:"+r_size+"px;height:"+r_size+"px;left:"+r_left+"%;background:rgba(255,"+(r_bg-25)+","+r_bg+",1);-webkit-animation:love "+r_time+"s ease;-moz-animation:love "+r_time+"s ease;-ms-animation:love "+r_time+"s ease;animation:love "+r_time+"s ease'></div>"); 941 942 $(element).append("<div class='heart' style='width:"+(r_size-10)+"px;height:"+(r_size-10)+"px;left:"+(r_left+r_num)+"%;background:rgba(255,"+(r_bg-25)+","+(r_bg+25)+",1);-webkit-animation:love "+(r_time+5)+"s ease;-moz-animation:love "+(r_time+5)+"s ease;-ms-animation:love "+(r_time+5)+"s ease;animation:love "+(r_time+5)+"s ease'></div>"); 943 944 $('.heart', element).each(function(){ 945 var top = $(this).css("top").replace(/[^-\d\.]/g, ''); 946 var width = $(this).css("width").replace(/[^-\d\.]/g, ''); 947 if(top <= -100 || width >= 150){ 948 $(this).detach(); 949 } 950 }); 951 },500); 952 }); 953 } 954 heartsBackground(); 955 956 /* Typewriter */ 957 $(".typing-box").each(function() { 958 var options = { 959 typeSpeed : $(this).data('typespeed'), 960 startDelay : $(this).data('startdelay'), 961 backSpeed : $(this).data('backspeed'), 962 backDelay : $(this).data('backdelay'), 963 loop : $(this).data('loop'), 964 strings : $.parseJSON(ozyTypeWriterData[$(this).data('path')]) 965 }; 966 $(this).typed(options); 967 }); 968 969 /* Instagram Feed */ 970 $('.ozy-instagram-gallery:not(.new)').each(function(index, element) { 971 var accesstoken = $(this).data('accesstoken'), 972 num_photos = $(this).data('numitems'); 973 $.ajax({ 974 url: 'https://api.instagram.com/v1/users/self/media/recent/?access_token='+accesstoken+'&count='+num_photos+'&callback=?', 975 dataType: 'jsonp', 976 type: 'GET', 977 data: {count: num_photos, access_token: accesstoken}, 978 success: function(data2){ 979 if ('undefined' !== typeof data2.data) { 980 for(var i = 0; i < data2.data.length; i++) { 981 $(element).append('<li><a href="'+ data2.data[i].link +'" target="_blank"><img src="'+data2.data[i].images.thumbnail.url+'"></a></li>'); 982 } 983 } 984 }, 985 error: function(data2){ 986 $(element).append('<li>'+ data2 +'</li>'); 987 } 988 }); 989 }); 990 991 /* New Instagram Feed */ 992 $('.ozy-instagram-gallery.new').each(function(index, element) { 993 var accesstoken = $(this).data('accesstoken'), 994 userid = $(this).data('userid'), 995 num_photos = $(this).data('numitems'); 996 if(accesstoken && userid && num_photos) { 997 jQuery.ajax({ 998 url: ozy_headerType.$OZY_WP_AJAX_URL, 999 data: { action: 'wedding_planner_ajax_instagram', request_user_id : userid, request_access_token : accesstoken, request_num_photos : num_photos}, 1000 cache: false, 1001 success: function(data) { 1002 $(element).replaceWith(data); 1003 }, 1004 error: function(MLHttpRequest, textStatus, errorThrown){ 1005 alert(errorThrown); 1006 } 1007 }); 1008 } 1009 }); 1010 1011 /* Team Member Extended Content (Lightbox) */ 1012 if($('.ozy-team_member.has-extended-content').length) { 1013 $('.ozy-team_member.has-extended-content a').click(function(e) { 1014 e.preventDefault(); 1015 var $this = $(this).parents('div.ozy-team_member'); 1016 $this.find('figure>a').click(function(e){ e.preventDefault(); }); 1017 var $source = $this.find('.extended-content'), 1018 $target = $('#side-extended-content'); 1019 $.fancybox({ 1020 maxWidth:940, 1021 maxHeight:640, 1022 padding:0, 1023 scrolling:'no', 1024 'content' : $source.html() 1025 }); 1026 }); 1027 } 1028 1029 /* Fancy Blog List */ 1030 $('.ozy-fancyaccordion-feed tr.title').click(function(e){
1031 e.preventDefault(); 1032 if($(this).hasClass('open')) { 1033 $(this).next('tr.excerpt').find('td>div').hide(200, function() { 1034 $(this).parent().slideUp(100); 1035 }); 1036 }else{ 1037 $(this).next('tr.excerpt').find('td').show(200, function() { 1038 $(this).find('div').slideDown(100); 1039 }); 1040 } 1041 $(this).toggleClass('open'); 1042 }); 1043 } 1044 1045 ozy_vc_components(); 1046 1047 function ozy_click_hash_check($this) { 1048 if (location.pathname.replace(/^\//,'') == $this.pathname.replace(/^\//,'') 1049 || location.hostname == $this.hostname) { 1050 1051 var target = $($this.hash); 1052 target = target.length ? target : $('[name=' + $this.hash.slice(1) +']'); 1053 if (target.length) { 1054 $('html,body').animate({ 1055 scrollTop: target.offset().top 1056 }, 1600, 'easeInOutExpo'); 1057 return false; 1058 } 1059 } 1060 return true; 1061 } 1062 1063 /* Waypoint animations */ 1064 if ('undefined' !== typeof jQuery.fn.waypoint) { 1065 jQuery('.ozy-waypoint-animate').waypoint(function() { 1066 jQuery(this.element).addClass('ozy-start-animation'); 1067 },{ 1068 offset: '85%' 1069 }); 1070 } 1071 1072 /* Blog post like function */ 1073 $(document).on('click', '.blog-like-link', function(e) { 1074 ajax_favorite_like($(this).data('post_id'), 'like', 'blog', this); 1075 e.preventDefault(); 1076 }); 1077 1078 /* FancyBox initialization */ 1079 $(".wp-caption>p").click( function(){ jQuery(this).prev('a').attr('title', jQuery(this).text()).click(); } ); //WordPress captioned image fix 1080 $(".fancybox, .wp-caption>a, .single-image-fancybox a").fancybox({ 1081 beforeLoad: function() { 1082 }, 1083 padding : 0, 1084 helpers : { 1085 title : { type : 'inside' }, 1086 buttons : {} 1087 } 1088 }); 1089 $('.fancybox-media').fancybox({openEffect : 'none',closeEffect : 'none',helpers : {title : { type : 'inside' }, media : {}}}); 1090 $('.fancybox-iframe-link').fancybox({ type: 'iframe' }); 1091 1092 /* Back to top button */ 1093 var pxScrolled = 200; 1094 var duration = 500; 1095 1096 $(window).scroll(function() { 1097 if ($(this).scrollTop() > pxScrolled) { 1098 $('.wedding-planner-btt-container').css({'bottom': '65px', 'transition': '.3s'}); 1099 } else { 1100 $('.wedding-planner-btt-container').css({'bottom': '-100px'}); 1101 } 1102 }); 1103 1104 $('.top').click(function() { 1105 $('body,html').animate({scrollTop: 0}, duration); 1106 }) 1107}); 1108 1109/* page-portfolio.php*/ 1110document.addEventListener("DOMContentLoaded", function() { 1111 imagesLoaded('body', function() { 1112 if(jQuery('body.page-template-page-portfolio-php').length>0) { 1113 jQuery('.wpb_wrapper.isotope').lightGallery({ 1114 selector: '.lightgallery', 1115 thumbnail:true 1116 }); 1117 ozy_page_template_page_portfolio_init(); 1118 } 1119 }); 1120});
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.