1jQuery(document).ready(function($) { 2 "use strict"; 3 4 /* window */ 5 var window_width, window_height, scroll_top; 6 7 /* admin bar */ 8 var adminbar_height = 0; 9 10 /* header menu */ 11 var header = $('#cshero-header'); 12 var header_top = 0; 13 14 var trigger_phone = false; 15 16 /* scroll status */ 17 var scroll_status = ''; 18 19 /* For Primary menu fixed */ 20 if ($('body').hasClass('atop-primary-menu')) { 21 22 } else { 23 jQuery('#cshero-header.header-fixed-page').affix({ 24 offset: { top: 1, } 25 }); 26 } 27 28 $('.cms-blog-item').fitVids(); 29 30 //pie char 31 $('.vc_pie_chart').each(function(){ 32 $(this).waypoint( 33 function() { 34 $(this).circliful(); 35 }, { 36 offset : '95%', 37 triggerOnce : true 38 }); 39 }); 40 41 //equal height 42 $('.equal-height').each(function() { 43 var row = $(this).parents('.cms-equal-height-wrapper'); 44 $(row).find('.equal-height').equalHeights(); 45 }) 46 47 /* Set background color over left */ 48 $('.bg_column_overleft').each(function(i, el) { 49 var bg_color = $(el).css('background-color'); 50 $(el).addClass('bg_column_overleft' + i); 51 if (bg_color != 'transparent' && bg_color != 'rgba(0, 0, 0, 0)') { 52 $('<style>.bg_column_overleft' + i+':before{background-color: '+ bg_color +'}</style>').appendTo('head'); 53 } 54 }); 55 56 if ($('.atop-primary-menu').length) { 57 $('.atop-primary-menu #cshero-header').sticky({ 58 topSpacing: 0 59 }); 60 } 61 //test resize trigger after 3s 62 setTimeout(function(){ 63 $(window).resize(); 64 }, 3000); 65 /** 66 * window load event. 67 * 68 * Bind an event handler to the "load" JavaScript event. 69 * @author Fox 70 */ 71 $(window).load(function() { 72 /* get admin bar height */ 73 adminbar_height = 32 ; 74 75 /** current scroll */ 76 scroll_top = $(window).scrollTop(); 77 78 /** current window width */ 79 window_width = $(window).width(); 80 81 /** current window height */ 82 window_height = $(window).height(); 83 84 /* get top header menu */ 85 header_top = adminbar_height; 86 87 /* check sticky menu. */ 88 if(CMSOptions.menu_sticky == '1'){ 89 cms_stiky_menu(scroll_top); 90 } 91 if(trigger_phone == false) { 92 portfolio_filter_onphone(); 93 } 94 95 /* check mobile menu */ 96 cms_mobile_menu(); 97 98 /* check back to top */ 99 if(CMSOptions.back_to_top == '1'){ 100 /* add html. */ 101 $('body').append('<div id="back_to_top" class="back_to_top"><span class="go_up"><i style="" class="fa fa-arrow-up"></i></span></div><!-- #back-to-top -->'); 102 cms_back_to_top(); 103 } 104 105 /* page loading. */ 106 cms_page_loading(); 107 108 /* check video size */ 109 cms_image_carousel(); 110 cms_lightbox_popup(); 111 112 /* Bs init */ 113 $(function () { 114 $('[data-toggle="tooltip"]').tooltip() 115 }); 116 117 //POPOVER INITIALIZE 118 $(function () { 119 $('[data-toggle="popover"]').popover() 120 }); 121 122 if ( $('.wow').length ) { 123 initWow(); 124 }; 125 126 /* Offset shortcode nav */ 127 var offsetFooter = $('.footer-offset').height() + 40 + $('.newsletter-on-single').height(); 128 jQuery('.menu-w_shortcodes-container, .menu-w_typography-container').parent().addClass('cms-nav-shortcode-wrap').affix({ 129 offset: { 130 top: 150, 131 bottom: offsetFooter 132 } 133 }); 134 135 if ($('.company-timeline-wrap').length) { 136 var data_date = $('.timeline-block.first-item').attr('data-timline-date'); 137 $('.timeline-start-date').text(data_date); 138 } 139 }); 140 141 /** 142 * reload event. 143 * 144 * Bind an event handler to the "navigate". 145 */ 146 window.onbeforeunload = function(){ cms_page_loading(1); } 147 148 /** 149 * resize event. 150 * 151 * Bind an event handler to the "resize" JavaScript event, or trigger that event on an element. 152 * @author Fox 153 */ 154 $(window).resize(function(event, ui) { 155 /** current window width */ 156 window_width = $(event.target).width(); 157 158 /** current window height */ 159 window_height = $(window).height(); 160 161 /** current scroll */ 162 scroll_top = $(window).scrollTop(); 163 164 /* check sticky menu. */ 165 if(CMSOptions.menu_sticky == '1'){ 166 cms_stiky_menu(scroll_top); 167 } 168 169 if(trigger_phone == false) { 170 portfolio_filter_onphone(); 171 } 172 173 /* check mobile menu */ 174 cms_mobile_menu(); 175 }); 176 177 /** 178 * scroll event. 179 * 180 * Bind an event handler to the "scroll" JavaScript event, or trigger that event on an element.
181 * @author Fox 182 */ 183 var lastScrollTop = 0; 184 185 $(window).scroll(function() { 186 /** current scroll */ 187 scroll_top = $(window).scrollTop(); 188 /** check scroll up or down. */ 189 if(scroll_top < lastScrollTop) { 190 /* scroll up. */ 191 scroll_status = 'up'; 192 } else { 193 /* scroll down. */ 194 scroll_status = 'down'; 195 } 196 197 lastScrollTop = scroll_top; 198 199 /* check sticky menu. */ 200 if(CMSOptions.menu_sticky == '1'){ 201 cms_stiky_menu(); 202 } 203 204 /* check sticky menu fixed page */ 205 if(CMSOptions.menu_sticky == '0'){ 206 cms_stiky_menu_fixed_page(); 207 } 208 209 /* check back to top */ 210 cms_back_to_top(); 211 }); 212 213 /** 214 * Stiky menu 215 * 216 * Show or hide sticky menu. 217 * @author Fox 218 * @since 1.0.0 219 */ 220 function cms_stiky_menu() { 221 222 if (header_top < scroll_top) { 223 switch (true) { 224 case (window_width >= 992): 225 header.addClass('header-fixed'); 226 $('body').addClass('fixed-margin-top'); 227 break; 228 case (window_width < 992): 229 header.addClass('header-fixed'); 230 $('body').addClass('fixed-margin-top'); 231 break; 232 } 233 } else { 234 header.removeClass('header-fixed'); 235 $('body').removeClass('fixed-margin-top'); 236 } 237 } 238 function cms_stiky_menu_fixed_page() { 239 if (header_top < scroll_top) { 240 header.addClass('header-fixed-page-trans'); 241 } else { 242 header.removeClass('header-fixed-page-trans'); 243 } 244 } 245 246 /** 247 * Mobile menu 248 * 249 * Show or hide mobile menu. 250 * @author Fox 251 * @since 1.0.0 252 */ 253 254 $('body').on('click', '#cshero-menu-mobile', function(){ 255 var navigation = $(this).parent().find('#cshero-header-navigation'); 256 if(!navigation.hasClass('collapse')){ 257 navigation.addClass('collapse'); 258 } else { 259 navigation.removeClass('collapse'); 260 } 261 }); 262 /* check mobile screen. */ 263 function cms_mobile_menu() { 264 var menu = $('#cshero-header-navigation'); 265 266 /* active mobile menu. */ 267 switch (true) { 268 case (window_width <= 992 && window_width >= 768): 269 menu.removeClass('phones-nav').addClass('tablets-nav'); 270 /* */ 271 cms_mobile_menu_group(menu); 272 break; 273 case (window_width <= 768): 274 menu.removeClass('tablets-nav').addClass('phones-nav'); 275 break; 276 default: 277 menu.removeClass('mobile-nav tablets-nav'); 278 menu.find('li').removeClass('mobile-group'); 279 break; 280 } 281 } 282 /* group sub menu. */ 283 function cms_mobile_menu_group(nav) { 284 nav.each(function(){ 285 $(this).find('li').each(function(){ 286 if($(this).find('ul:first').length > 0){ 287 $(this).addClass('mobile-group'); 288 } 289 }); 290 }); 291 } 292 293 /** 294 * Parallax. 295 * 296 * @author Fox 297 * @since 1.0.0 298 */ 299 var cms_parallax = $('.cms_parallax'); 300 if(cms_parallax.length > 0 && CMSOptions.paralax == '1') { 301 cms_parallax.each(function() { 302 "use strict"; 303 var speed = $(this).attr('data-speed'); 304 305 speed = (speed != undefined && speed != '') ? speed : 0.1 ; 306 307 $(this).parallax("50%", speed); 308 }); 309 } 310 311 /** 312 * Page Loading. 313 */ 314 function cms_page_loading($load) { 315 switch ($load) { 316 case 1: 317 $('#amilia-loading').css('display','block') 318 break; 319 default: 320 $('#amilia-loading').css('display','none') 321 break; 322 } 323 } 324 325 /** 326 * Post Like. 327 * 328 * @author Fox 329 * @since 1.0.0 330 */ 331 $('.entry-like').on('click', function (event) { 332 /* get post id. */ 333 var bt_like = $(this); 334 335 var post_id = bt_like.attr('data-id'); 336 337 if(post_id != undefined && post_id != '') { 338 /* add like. */ 339 $.post(ajaxurl, { 340 'action' : 'cms_post_like', 341 'id' : post_id 342 }, function(response) { 343 if(response != ''){ 344 bt_like.find('i').attr('class', 'fa fa-heart') 345 bt_like.find('span').html(response); 346 } 347 }); 348 } 349 event.preventDefault(); 350 }); 351 352 /** 353 * Back To Top 354 * 355 * @author Fox 356 * @since 1.0.0 357 */ 358 $('body').on('click', '#back_to_top', function () { 359 $("html, body").animate({ 360 scrollTop: 0 361 }, 1500); 362 }); 363 364 /* Show or hide buttom */ 365 function cms_back_to_top(){ 366 /* back to top */ 367 if (scroll_top < window_height) { 368 $('#back_to_top').addClass('off').removeClass('on'); 369 } else { 370 $('#back_to_top').removeClass('off').addClass('on'); 371 } 372 } 373 374 /* Amilia function custom in here */ 375 376 /** 377 * Portfolio Filter on phone 378 * 379 * @author DuongTung 380 * @since 1.0 381 */ 382 function portfolio_filter_onphone() { 383 trigger_phone = true; 384 if ( window_width - 599 <= 0 ) { //On phone 385 $('.cms-grid-filter-inphone a').on('click', function(e) { 386 var $this = $(this); 387 e.preventDefault(); 388 var wrap = $this.parents('.cms-grid-filter-wrap'); 389 if ( $('.cms-grid-filter', wrap).hasClass('active') ) { 390 $('.cms-grid-filter', wrap).removeClass('active').slideUp(); 391 } else { 392 $('.cms-grid-filter', wrap).addClass('active').slideDown(300); 393 } 394 }); 395 396 $('.cms-grid-filter a').on('click', function() { 397 var $this = $(this), 398 wrap = $this.parents('.cms-grid-filter-wrap');; 399 $('.cms-grid-filter', wrap).removeClass('active').slideUp(); 400 $('.cms-grid-filter-inphone a').text($this.text()); 401 }); 402 } 403 } 404
405 /** 406 * Custom Owl Carousel 407 * 408 * @author DuongTung 409 * @since 1.0.0 410 */ 411 function cms_image_carousel() { 412 if ( $('.cms-carousel-wrapper').length ) { 413 $('.cms-carousel-wrapper').each(function(index, el) { 414 415 var id_carousel = $(el).attr('id'); 416 var wrap = $('#' + id_carousel + ' .cms-owl-carousel'); 417 418 var image_carousel_setting = {}; 419 image_carousel_setting.items = wrap.attr('data-per-view'); 420 image_carousel_setting.rewind = true; 421 image_carousel_setting.margin = 0; 422 image_carousel_setting.mouseDrag = true; 423 image_carousel_setting.autoplay = (wrap.attr('data-autoplay') === "true"); 424 image_carousel_setting.autoplaySpeed = 800; 425 image_carousel_setting.dots = (wrap.attr('data-pagination') === "true"); 426 image_carousel_setting.loop = (wrap.attr('data-loop') === "true"); 427 image_carousel_setting.nav = (wrap.attr('data-nav') === "true"); 428 image_carousel_setting.navText = ["prev", "next"]; 429 if (wrap.attr('data-per-view') > 4) { 430 image_carousel_setting.responsive = { 431 1000:{ 432 items:5 433 }, 434 900:{ 435 items:3 436 }, 437 470:{ 438 items:2 439 } 440 } 441 } 442 443 //Play 444 wrap.owlCarousel(image_carousel_setting); 445 }); 446 } 447 } 448 449 /** 450 * Init Wow 451 * 452 * @author DuongTung 453 * @since 1.0.0 454 */ 455 function initWow(){ 456 var wow = new WOW( { mobile: false, } ); 457 wow.init(); 458 } 459 460 /** 461 * One page 462 * 463 * @author Fox 464 */ 465 if(CMSOptions.one_page == true) { 466 467 $('body').on('click', '.onepage', function () { 468 $('#cshero-menu-mobile').removeClass('close-open'); 469 $('#cshero-header-navigation').removeClass('open-menu'); 470 $('.cshero-menu-close').removeClass('open'); 471 }); 472 473 var one_page_options = {'filter' : '.onepage'}; 474 475 if(CMSOptions.one_page_speed != undefined) one_page_options.speed = parseInt(CMSOptions.one_page_speed); 476 if(CMSOptions.one_page_easing != undefined) one_page_options.easing = CMSOptions.one_page_easing; 477 478 $('#cshero-header-navigation, .widget_nav_menu').singlePageNav(one_page_options); 479 480 } 481 482 /** 483 * LightBox 484 * 485 * @author DuongTung 486 * @since 1.0.0 487 */ 488 function cms_lightbox_popup() { 489 $('.cms-lightbox').magnificPopup({ 490 // delegate: 'a', 491 type: 'image', 492 mainClass: 'mfp-3d-unfold', 493 removalDelay: 500, //delay removal by X to allow out-animation 494 callbacks: { 495 beforeOpen: function() { 496 // just a hack that adds mfp-anim class to markup 497 this.st.image.markup = this.st.image.markup.replace('mfp-figure', 'mfp-figure mfp-with-anim'); 498 // this.st.mainClass = this.st.el.attr('data-effect'); 499 } 500 }, 501 closeOnContentClick: true, 502 midClick: true // allow opening popup on middle mouse click. Always set it to true if you don't provide alternative source. 503 }); 504 505 $('.cms-popup-gallery').magnificPopup({ 506 delegate: 'a', 507 type: 'image', 508 tLoading: 'Loading image #%curr%...', 509 mainClass: 'mfp-3d-unfold', 510 removalDelay: 500, //delay removal by X to allow out-animation 511 callbacks: { 512 beforeOpen: function() { 513 // just a hack that adds mfp-anim class to markup 514 this.st.image.markup = this.st.image.markup.replace('mfp-figure', 'mfp-figure mfp-with-anim'); 515 // this.st.mainClass = this.st.el.attr('data-effect'); 516 } 517 }, 518 gallery: { 519 enabled: true, 520 navigateByImgClick: true, 521 preload: [0,1] // Will preload 0 - before current, and 1 after the current image 522 }, 523 image: { 524 tError: '<a href="%url%">The image #%curr%</a> could not be loaded.', 525 /*titleSrc: function(item) { 526 return item.el.attr('title') + '<small>by Marsel Van Oosten</small>'; 527 }*/ 528 } 529 }); 530 $('.cms-video-popup, .cms-lightbox-map').magnificPopup({ 531 //disableOn: 700, 532 type: 'iframe', 533 mainClass: 'mfp-fade', 534 removalDelay: 160, 535 preloader: false, 536 537 fixedContentPos: false 538 }); 539 } 540 /* End function custom */ 541 542}); 543 544/* Header sticky indent */ 545jQuery(document).on("scroll", function($) { 546 "use strict"; 547 548 setTimeout(function() { 549 if (jQuery('.cshero-main-header').hasClass('affix')) { 550 jQuery('.page-title').addClass('affix-indent'); 551 } else { 552 jQuery('.page-title').removeClass('affix-indent'); 553 }; 554 },100); 555});
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.