1/*global $, document, window 2 */ 3$(document).ready(function ($) { 4 'use strict'; 5 6 /*------------------------------------- 7 Navbar Toggle for Mobile 8 -------------------------------------*/ 9 function navbarCollapse() { 10 if ($(window).width() < 992) { 11 $(document).on('click', function (event) { 12 var clickover = $(event.target); 13 var _opened = $("#navbar-collapse").hasClass("in"); 14 if (_opened === true && !(clickover.is('.dropdown'))) { 15 $("button.navbar-toggle").trigger('click'); 16 } 17 }); 18 19 $('.dropdown').unbind('click'); 20 $('.dropdown').on('click', function () { 21 $(this).children('.dropdown-menu').slideToggle(); 22 }); 23 24 $('.dropdown *').on('click', function (e) { 25 e.stopPropagation(); 26 }); 27 } 28 } 29 navbarCollapse(); 30 31 /*------------------------------------- 32 Language Toggle 33 -------------------------------------*/ 34 function languageTogg() { 35 if ($('#languageToggle').length > 0) { 36 $('#languageToggle').on('click', function () { 37 $('#language-select').slideToggle(); 38 }); 39 40 $(document).on('click', function (event) { 41 var clickover = $(event.target); 42 var _opened = $("#language-select").is(':visible'); 43 if (_opened === true && !(clickover.is('#languageToggle'))) { 44 $("#languageToggle").trigger('click'); 45 } 46 }); 47 48 $("#languageToggle *").on('click', function (e) { 49 e.stopPropagation(); 50 }); 51 } 52 } 53 54 languageTogg(); 55 56 /*------------------------------------- 57 Header Search Toggle 58 -------------------------------------*/ 59 function searchToggle() { 60 if ($(window).width() > 991) { 61 $('#navbar-search-toggle').unbind('click'); 62 $('#navbar-search-toggle').on('click', function () { 63 $(this).children('.fa').toggleClass('fa-search fa-close'); 64 $('#navbar-searchform').slideToggle(); 65 }); 66 67 $(document).on('click', function (event) { 68 var clickover = $(event.target); 69 var _opened = $("#navbar-searchform").is(':visible'); 70 if (_opened === true && !(clickover.is('#navbar-search-toggle, #navbar-search-toggle *, #navbar-searchform, #navbar-searchform *'))) { 71 $("#navbar-search-toggle").trigger('click'); 72 } 73 }); 74 } 75 } 76 77 searchToggle(); 78 79 /*------------------------------------- 80 Generic Isotope 81 -------------------------------------*/ 82 $('.elh-grid').each(function () { 83 // init Isotope 84 var $grid = $(this).isotope({ 85 // options... 86 }); 87 88 // layout Isotope after each image loads 89 $grid.imagesLoaded().progress(function () { 90 $grid.isotope('layout'); 91 }); 92 93 //Filter 94 if ($(this).siblings('.elh-grid-filter').length > 0) { 95 // filter items on button click 96 var gridFilter = $(this).siblings('.elh-grid-filter'); 97 gridFilter.on('click', 'button', function () { 98 var filterValue = $(this).attr('data-filter'); 99 $(this).siblings('button').removeClass('active'); 100 $(this).addClass('active'); 101 $grid.isotope({ 102 filter: filterValue 103 }); 104 }); 105 } 106 }); 107 108 /*------------------------------------- 109 Banner Slider 110 -------------------------------------*/ 111 if ($('#banner-bg-slider').length > 0) { 112 $('#banner-bg-slider').owlCarousel({ 113 singleItem: true, 114 slideSpeed: 200, 115 stopOnHover: true, 116 //autoPlay: 3000, 117 navigation: false, 118 navigationText: ['<i class="fa fa-angle-left"></i>', '<i class="fa fa-angle-right"></i>'], 119 pagination: false, 120 transitionStyle: "fade" 121 }); 122 } 123 124 if ($('#banner-slider').length > 0) { 125 $('#banner-slider').owlCarousel({ 126 singleItem: true, 127 slideSpeed: 300, 128 stopOnHover: true, 129 autoPlay: 5000, 130 navigation:true, 131 navigationText: ['<i class="fa fa-angle-left"></i>', '<i class="fa fa-angle-right"></i>'], 132 pagination: false, 133 }); 134 } 135 136 /*------------------------------------- 137 Generic Carousel 138 -------------------------------------*/ 139 $('.elh-generic-carousel').each(function () { 140 if (!$(this).hasClass('elh-generic-4')) { 141 $(this).owlCarousel({ 142 items: 3, 143 itemsDesktop: [1199, 3], 144 itemsDesktopSmall: [991, 2], 145 itemsMobile: [639, 1], 146 slideSpeed: 200, 147 stopOnHover: true, 148 //autoPlay: 3000, 149 navigation: true, 150 navigationText: ['<i class="fa fa-angle-left"></i>', '<i class="fa fa-angle-right"></i>'], 151 pagination: false, 152 }); 153 } else { 154 $(this).owlCarousel({ 155 items: 4, 156 itemsDesktop: [1199, 4], 157 itemsDesktopSmall: [991, 2], 158 itemsMobile: [579, 1], 159 slideSpeed: 200, 160 stopOnHover: true, 161 //autoPlay: 3000, 162 navigation: true, 163 navigationText: ['<i class="fa fa-angle-left"></i>', '<i class="fa fa-angle-right"></i>'], 164 pagination: false, 165 }); 166 } 167 });
168 169 /*------------------------------------- 170 Single Carousel 171 -------------------------------------*/ 172 $('.elh-single-carousel').each(function () { 173 $(this).owlCarousel({ 174 singleItem: true, 175 slideSpeed: 200, 176 stopOnHover: true, 177 autoPlay: 3000, 178 navigation: true, 179 navigationText: ['<i class="fa fa-angle-left"></i>', '<i class="fa fa-angle-right"></i>'], 180 pagination: false, 181 }); 182 }); 183 184 /*------------------------------------- 185 Instructors Carousel 186 -------------------------------------*/ 187 $('.elh-instructor-carousel').each(function () { 188 $(this).owlCarousel({ 189 items: 4, 190 itemsDesktop: [1199, 3], 191 itemsDesktopSmall: [991, 3], 192 itemsTablet: [768, 3], 193 itemsTabletSmall: [579, 2], 194 itemsMobile: [479, 1], 195 slideSpeed: 200, 196 stopOnHover: true, 197 autoPlay: 3000, 198 navigation: true, 199 navigationText: ['<i class="fa fa-chevron-left"></i>', '<i class="fa fa-chevron-right"></i>'], 200 pagination: false, 201 }); 202 }); 203 204 /*------------------------------------- 205 Gallery Carousel 206 -------------------------------------*/ 207 if ($('#elh-gallery-carousel').length > 0) { 208 $('#elh-gallery-carousel').owlCarousel({ 209 items: 5, 210 itemsDesktop: [1199, 5], 211 itemsDesktopSmall: [991, 3], 212 itemsMobile: [579, 2], 213 slideSpeed: 200, 214 stopOnHover: true, 215 autoPlay: 3000, 216 navigation: false, 217 navigationText: ['<i class="fa fa-chevron-left"></i>', '<i class="fa fa-chevron-right"></i>'], 218 pagination: false, 219 }); 220 } 221 222 /*------------------------------------- 223 Country Flag Carousel 224 -------------------------------------*/ 225 if ($('#elh-country-flag-slider').length > 0) { 226 $('#elh-country-flag-slider').owlCarousel({ 227 items: 6, 228 itemsDesktop: [1199, 4], 229 itemsDesktopSmall: [991, 4], 230 itemsTablet: [768, 4], 231 itemsTabletSmall: [579, 3], 232 itemsMobile: [479, 2], 233 slideSpeed: 200, 234 stopOnHover: true, 235 //autoPlay: 3000, 236 navigation: false, 237 pagination: false, 238 }); 239 } 240 241 /*------------------------------------- 242 Instructor comment carousel 243 -------------------------------------*/ 244 if ($('#instructor-comment-carousel').length > 0) { 245 $('#instructor-comment-carousel').owlCarousel({ 246 singleItem: true, 247 slideSpeed: 200, 248 stopOnHover: true, 249 autoPlay: 3000, 250 navigation: false, 251 pagination: false, 252 }); 253 } 254 255 /*------------------------------------- 256 Testimonial Slick Carousel 257 -------------------------------------*/ 258 $('.elh-testimonial-main').slick({ 259 slidesToShow: 1, 260 slidesToScroll: 1, 261 arrows: false, 262 fade: true, 263 asNavFor: '.elh-testimonial-nav-thumbs' 264 }); 265 $('.elh-testimonial-nav-thumbs').slick({ 266 slidesToShow: 3, 267 slidesToScroll: 1, 268 asNavFor: '.elh-testimonial-main', 269 dots: false, 270 focusOnSelect: true, 271 centerMode: true, 272 centerPadding: '0px', 273 arrows: false, 274 }); 275 276 /*------------------------------------- 277 Single Product Gallery 278 -------------------------------------*/ 279 if ($('#elh-single-product-gallery').length > 0) { 280 $('#elh-single-product-gallery').owlCarousel({ 281 singleItem: true, 282 slideSpeed: 200, 283 stopOnHover: true, 284 //autoPlay: 3000, 285 navigation: true, 286 navigationText: ['<i class="fa fa-angle-left"></i>', '<i class="fa fa-angle-right"></i>'], 287 pagination: false, 288 }); 289 } 290 291 /*------------------------------------- 292 Count To 293 -------------------------------------*/ 294 function animateCountTo(ct) { 295 if ($.fn.visible && $(ct).visible() && !$(ct).hasClass('animated')) { 296 $(ct).countTo({ 297 speed: 2000 298 }); 299 $(ct).addClass('animated'); 300 } 301 } 302 303 function initCountTo() { 304 var counter = $('.elh-count'); 305 counter.each(function () { 306 animateCountTo(this); 307 }); 308 } 309
310 initCountTo(); 311 312 /*------------------------------------- 313 Count Down 314 -------------------------------------*/ 315 $('.countdown').each(function () { 316 var endTime = $(this).data('time'); 317 $(this).countdown(endTime, function (tm) { 318 var countTxt = ''; 319 countTxt += '<span class="section_count"><span class="section_count_data"><span class="count-data"><span class="tcount days">%D </span><span class="text">Days</span></span></span></span>'; 320 countTxt += '<span class="section_count"><span class="section_count_data"><span class="count-data"><span class="tcount hours">%H</span><span class="text">Hours</span></span></span></span>'; 321 countTxt += '<span class="section_count"><span class="section_count_data"><span class="count-data"><span class="tcount minutes">%M</span><span class="text">Minutes</span></span></span></span>'; 322 countTxt += '<span class="section_count"><span class="section_count_data"><span class="count-data"><span class="tcount seconds">%S</span><span class="text">Seconds</span></span></span></span>'; 323 324 $(this).html(tm.strftime(countTxt)); 325 }); 326 }); 327 328 /*-------------------------------------- 329 Plyr Video 330 ---------------------------------------*/ 331 plyr.setup(); 332 333 /*------------------------------------- 334 Magnific Popup 335 -------------------------------------*/ 336 $('.image-large, .elh-gallery').magnificPopup({ 337 type: 'image', 338 delegate: 'a', 339 gallery: { 340 enabled: true 341 } 342 }); 343 $('.video-play, .open-map').magnificPopup({ 344 type: 'iframe' 345 }); 346 $.extend(true, $.magnificPopup.defaults, { 347 iframe: { 348 patterns: { 349 youtube: { 350 index: 'youtube.com/', 351 id: 'v=', 352 src: 'https://www.youtube.com/embed/%id%?autoplay=1' 353 }, 354 vimeo: { 355 index: 'vimeo.com/', 356 id: '/', 357 src: '//player.vimeo.com/video/%id%?autoplay=1' 358 }, 359 gmaps: { 360 index: '//maps.google.', 361 src: '%id%&output=embed' 362 } 363 } 364 } 365 }); 366 367 /*------------------------------------- 368 Rating Form 369 -------------------------------------*/ 370 function ratingChange(rc) { 371 $('.elh-rating-inputs label').removeClass('elh-rate-on'); 372 $(rc).parent('label').prevAll().addBack().addClass('elh-rate-on'); 373 } 374 $('input[name=rate-value]').on('click', function () { 375 ratingChange(this); 376 }); 377 378 /*------------------------------------- 379 Sidebar Affix 380 -------------------------------------*/ 381 if ($('#sidebar-affix').length > 0) { 382 $('#sidebar-affix').affix({ 383 offset: { 384 top: function () { 385 return (this.top = $('#course-sidebar').offset().top); 386 }, 387 bottom: function () { 388 return (this.bottom = $('body').height() - $('#course-sidebar').offset().top - $('#elh-course-container').outerHeight(true)); 389 } 390 } 391 }); 392 } 393 394 /*----------------------------------- 395 Contact Form 396 -----------------------------------*/ 397 // Function for email address validation 398 function isValidEmail(emailAddress) { 399 var pattern = new RegExp(/^(("[\w-\s]+")|([\w-]+(?:\.[\w-]+)*)|("[\w-\s]+")([\w-]+(?:\.[\w-]+)*))(@((?:[\w-]+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$)|(@\[?((25[0-5]\.|2[0-4][0-9]\.|1[0-9]{2}\.|[0-9]{1,2}\.))((25[0-5]|2[0-4][0-9]|1[0-9]{2}|[0-9]{1,2})\.){2}(25[0-5]|2[0-4][0-9]|1[0-9]{2}|[0-9]{1,2})\]?$)/i); 400 401 return pattern.test(emailAddress); 402 403 } 404 $("#contactForm").on('submit', function (e) { 405 e.preventDefault(); 406 var data = { 407 name: $("#name").val(), 408 email: $("#email").val(), 409 phone: $("#phone").val(), 410 phone: $("#subject").val(), 411 message: $("#message").val() 412 }; 413 414 if (isValidEmail(data['email']) && (data['message'].length > 1) && (data['name'].length > 1) && (data['phone'].length > 1) && (data['phone'].length > 1)) { 415 $.ajax({
416 type: "POST", 417 url: "sendmail.php", 418 data: data, 419 success: function () { 420 $('#contactForm .input-success').delay(500).fadeIn(1000); 421 $('#contactForm .input-error').fadeOut(500); 422 } 423 }); 424 } else { 425 $('#contactForm .input-error').delay(500).fadeIn(1000); 426 $('#contactForm .input-success').fadeOut(500); 427 } 428 429 return false; 430 }); 431 432 /*----------------------------------- 433 Subscription 434 -----------------------------------*/ 435 $(".elh-subscribe-form").ajaxChimp({ 436 callback: mailchimpResponse, 437 url: "http://codepassenger.us10.list-manage.com/subscribe/post?u=6b2e008d85f125cf2eb2b40e9&id=6083876991" // Replace your mailchimp post url inside double quote "". 438 }); 439 440 function mailchimpResponse(resp) { 441 if (resp.result === 'success') { 442 443 $('.newsletter-success').html(resp.msg).fadeIn().delay(3000).fadeOut(); 444 445 } else if (resp.result === 'error') { 446 $('.newsletter-error').html(resp.msg).fadeIn().delay(3000).fadeOut(); 447 } 448 } 449 450 451 /*------------------------------------- 452 Lesson Page 453 -------------------------------------*/ 454 455 /*** Lesson show and hide ***/ 456 function lessonShowHide() { 457 $('#lessonListWrap').toggleClass('lesson-list-showing'); 458 } 459 460 $('#lessonListToggle').on('click', function () { 461 lessonShowHide(); 462 $(this).children('.fa').toggleClass('fa-list fa-close'); 463 $('#lessonContent .plyr-video').css('max-width', $(window).height() * 1.7776); 464 }); 465 466 $('#lessonContent .plyr-video').css('max-width', $(window).height() * 1.7776); 467 468 var nlTimer; 469 $('#lessonContentWrap').on('mousemove', function () { 470 $('#navbar-lesson').addClass('show-navbar-lesson'); 471 try { 472 clearTimeout(nlTimer); 473 } catch (e) {} 474 nlTimer = setTimeout(function () { 475 $('#navbar-lesson').removeClass('show-navbar-lesson'); 476 }, 2000); 477 }); 478 479 $('#lessonContentWrap').on('mouseout', function () { 480 $('#navbar-lesson').removeClass('show-navbar-lesson'); 481 }); 482 483 /*** Lesson Change ***/ 484 function lessonVidChange(lessonVid) { 485 var elhVidId = $(lessonVid).data('elhvideo'); 486 if ($(lessonVid).data('elhvidtype') == 'vimeo') { 487 $('#lessonPlayer').html('<div class="elh-run-player" data-type="vimeo" data-video-id="' + elhVidId + '"></div>'); 488 } else if ($(lessonVid).data('elhvidtype') == 'youtube') { 489 $('#lessonPlayer').html('<div class="elh-run-player" data-type="youtube" data-video-id="' + elhVidId + '"></div>'); 490 } else { 491 $('#lessonPlayer').html('<video class="elh-run-player" controls><source src="' + elhVidId + '" type="video/mp4"></video>'); 492 } 493 plyr.setup('.elh-run-player', { 494 //autoplay: true, 495 }); 496 } 497 498 $('#lessonListWrap .elh-lesson-item > a').on('click', function (lessonClick) { 499 lessonClick.preventDefault(); 500 lessonVidChange(this); 501 $('#lessonListWrap .elh-lesson-item > a').removeClass('running-lesson'); 502 $(this).addClass('running-lesson'); 503 }); 504 505 lessonVidChange('#lessonListWrap .elh-lesson-item > .running-lesson'); 506 507 /*------------------------------------- 508 Window Events 509 -------------------------------------*/ 510 $(window).on('scroll', function () { 511 initCountTo(); 512 }); 513 514 $(window).on('resize orientationchange', function () { 515 navbarCollapse(); 516 $('#lessonContent .plyr-video').css('max-width', $(window).height() * 1.7776); 517 }); 518});
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.