1// JavaScript Document 2 3 4 $(window).on('load', function() { 5 6 "use strict"; 7 8 /*----------------------------------------------------*/ 9 /* Preloader 10 /*----------------------------------------------------*/ 11 12 $("#loader").delay(100).fadeOut(); 13 $("#loader-wrapper").delay(100).fadeOut("fast"); 14 15 //$(window).stellar({}); 16 }); 17 18 19 $(window).on('scroll', function() { 20 21 "use strict"; 22 23 /*----------------------------------------------------*/ 24 /* Navigtion Menu Scroll 25 /*----------------------------------------------------*/ 26 27 var b = $(window).scrollTop(); 28 29 if( b > 72 ){ 30 $(".navbar").addClass("scroll"); 31 } else { 32 $(".navbar").removeClass("scroll"); 33 } 34 35 36 }); 37 38 $(document).ready(function() { 39 40 "use strict"; 41 42 /*----------------------------------------------------*/ 43 /* Mobile Menu Toggle 44 /*----------------------------------------------------*/ 45 46 $('.navbar-nav li.nav-item.nl-simple').on('click', function() { 47 $('#navbarSupportedContent').css("height", "1px").removeClass("in").addClass("collapse"); 48 $('#navbarSupportedContent').removeClass("show"); 49 }); 50 51 /*----------------------------------------------------*/ 52 /* Accordion 53 /*----------------------------------------------------*/ 54 55 $(function () { 56 if ($('.accordion-list').length) { 57 $('.accordion-list').on('click', '.accordion-title', function (e) { 58 e.preventDefault(); 59 // remove siblings activities 60 $(this).closest('.accordion-list-item').siblings().removeClass('open').addClass('close').find('.accordion-desc').slideUp(); 61 $(this).closest('.accordion-list-item').siblings().find('i').addClass('pe-7s-angle-right').removeClass('pe-7s-angle-down'); 62 63 // add slideToggle into this 64 $(this).closest('.accordion-list-item').toggleClass('open').removeClass('close').find('.accordion-desc').slideToggle(); 65 $(this).find('i').toggleClass('pe-7s-angle-down pe-7s-angle-right'); 66 }); 67 } 68 }); 69 70 /*----------------------------------------------------*/ 71 /* OnScroll Animation 72 /*----------------------------------------------------*/ 73 74 $('.animated').appear(function() { 75 76 var elem = $(this); 77 var animation = elem.data('animation'); 78 79 if ( !elem.hasClass('visible') ) { 80 var animationDelay = elem.data('animation-delay'); 81 if ( animationDelay ) { 82 setTimeout(function(){ 83 elem.addClass( animation + " visible" ); 84 }, animationDelay); 85 86 } else { 87 elem.addClass( animation + " visible" ); 88 } 89 } 90 91 }); 92 93 94 /*----------------------------------------------------*/ 95 /* Animated Scroll To Anchor 96 /*----------------------------------------------------*/ 97 98 $('.header a[href^="#"], .page a.btn[href^="#"], .page a.internal-link[href^="#"]').on('click', function (e) { 99 100 e.preventDefault(); 101 102 var target = this.hash, 103 $target = jQuery(target); 104 105 $('html, body').stop().animate({ 106 'scrollTop': $target.offset().top - 60 // - 200px (nav-height) 107 }, 'slow', 'easeInSine', function () { 108 window.location.hash = '1' + target; 109 }); 110 111 }); 112 113 114 /*----------------------------------------------------*/ 115 /* ScrollUp 116 /*----------------------------------------------------*/ 117 118 $.scrollUp = function (options) { 119 120 // Defaults 121 var defaults = { 122 scrollName: 'scrollUp', // Element ID 123 topDistance: 600, // Distance from top before showing element (px) 124 topSpeed: 800, // Speed back to top (ms) 125 animation: 'fade', // Fade, slide, none 126 animationInSpeed: 200, // Animation in speed (ms) 127 animationOutSpeed: 200, // Animation out speed (ms) 128 scrollText: '', // Text for element 129 scrollImg: false, // Set true to use image 130 activeOverlay: false // Set CSS color to display scrollUp active point, e.g '#00FFFF' 131 }; 132 133 var o = $.extend({}, defaults, options), 134 scrollId = '#' + o.scrollName; 135 136 // Create element 137 $('<a/>', { 138 id: o.scrollName, 139 href: '#top', 140 title: o.scrollText 141 }).appendTo('body'); 142 143 // If not using an image display text 144 if (!o.scrollImg) { 145 $(scrollId).text(o.scrollText); 146 } 147 148 // Minium CSS to make the magic happen 149 $(scrollId).css({'display':'none','position': 'fixed','z-index': '2147483647'}); 150 151 // Active point overlay 152 if (o.activeOverlay) { 153 $("body").append("<div id='"+ o.scrollName +"-active'></div>"); 154 $(scrollId+"-active").css({ 'position': 'absolute', 'top': o.topDistance+'px', 'width': '100%', 'border-top': '1px dotted '+o.activeOverlay, 'z-index': '2147483647' }); 155 } 156 157 // Scroll function 158 $(window).on('scroll', function(){ 159 switch (o.animation) { 160 case "fade": 161 $( ($(window).scrollTop() > o.topDistance) ? $(scrollId).fadeIn(o.animationInSpeed) : $(scrollId).fadeOut(o.animationOutSpeed) ); 162 break; 163 case "slide": 164 $( ($(window).scrollTop() > o.topDistance) ? $(scrollId).slideDown(o.animationInSpeed) : $(scrollId).slideUp(o.animationOutSpeed) ); 165 break; 166 default: 167 $( ($(window).scrollTop() > o.topDistance) ? $(scrollId).show(0) : $(scrollId).hide(0) ); 168 } 169 }); 170 171 // To the top 172 $(scrollId).on('click', function(event){ 173 $('html, body').animate({scrollTop:0}, o.topSpeed); 174 event.preventDefault(); 175 }); 176 177 }; 178 179 $.scrollUp(); 180 181 182 /*----------------------------------------------------*/ 183 /* Video Link Lightbox 184 /*----------------------------------------------------*/ 185 186 $('.video-popup').magnificPopup({ 187 type: 'iframe', 188 189 iframe: { 190 patterns: { 191 youtube: { 192 193 index: 'youtube.com', 194 src: 'https://www.youtube.com/embed/kuceVNBTJio' 195 196 } 197 } 198 } 199 }); 200 201 202 /*----------------------------------------------------*/ 203 /* Statistic Counter 204 /*----------------------------------------------------*/ 205 206 $('.statistic-number').each(function () { 207 $(this).appear(function() { 208 $(this).prop('Counter',0).animate({ 209 Counter: $(this).text() 210 }, { 211 duration: 4000, 212 easing: 'swing', 213 step: function (now) { 214 $(this).text(Math.ceil(now)); 215 } 216 }); 217 },{accX: 0, accY: 0}); 218 }); 219 220 221 /*----------------------------------------------------*/ 222 /* Testimonials Rotator Slick Carousel
223 /*----------------------------------------------------*/ 224 225 $('#reviews-1 .center, #reviews-2 .center').slick({ 226 centerMode: true, 227 autoplay: true, 228 centerPadding: '0px', 229 speed: 800, 230 slidesToShow: 3, 231 dots: true, 232 responsive: [ 233 { 234 breakpoint: 1199, 235 settings: { 236 arrows: false, 237 centerMode: true, 238 centerPadding: '0px', 239 slidesToShow: 3 240 } 241 }, 242 { 243 breakpoint: 991, 244 settings: { 245 arrows: false, 246 centerMode: true, 247 centerPadding: '0px', 248 slidesToShow: 3 249 } 250 }, 251 { 252 breakpoint: 800, 253 settings: { 254 arrows: false, 255 centerMode: true, 256 centerPadding: '0px', 257 slidesToShow: 1 258 } 259 }, 260 { 261 breakpoint: 767, 262 settings: { 263 arrows: false, 264 centerMode: true, 265 centerPadding: '0px', 266 slidesToShow: 1 267 } 268 }, 269 { 270 breakpoint: 648, 271 settings: { 272 arrows: false, 273 centerMode: true, 274 centerPadding: '0px', 275 slidesToShow: 1 276 } 277 } 278 ] 279 }); 280 281 282 /*----------------------------------------------------*/ 283 /* Screens Carousel Slick 284 /*----------------------------------------------------*/ 285 286 287 /*----------------------------------------------------*/ 288 /* Contact Form Validation 289 /*----------------------------------------------------*/ 290 291 $(".contact-form").validate({ 292 rules:{ 293 name:{ 294 required: true, 295 minlength: 1, 296 maxlength: 16, 297 }, 298 email:{ 299 required: true, 300 email: true, 301 }, 302 message:{ 303 required: true, 304 minlength: 2, 305 } 306 }, 307 messages:{ 308 name:{ 309 required: "Please enter no more than (1) characters" 310 }, 311 email:{ 312 required: "We need your email address to contact you", 313 email: "Your email address must be in the format of [email protected]" 314 }, 315 message:{ 316 required: "Please enter no more than (2) characters" 317 }, 318 } 319 }); 320 321 322 /*----------------------------------------------------*/ 323 /* Comment Form Validation 324 /*----------------------------------------------------*/ 325 326 $(".comment-form").validate({ 327 rules:{ 328 name:{ 329 required: true, 330 minlength: 1, 331 maxlength: 16, 332 }, 333 email:{ 334 required: true, 335 email: true, 336 }, 337 message:{ 338 required: true, 339 minlength: 2, 340 } 341 }, 342 messages:{ 343 name:{ 344 required: "Please enter no more than (1) characters" 345 }, 346 email:{ 347 required: "We need your email address to contact you", 348 email: "Your email address must be in the format of [email protected]" 349 }, 350 message:{ 351 required: "Please enter no more than (2) characters" 352 }, 353 } 354 }); 355 356 357 /*----------------------------------------------------*/ 358 /* Bottom Quick Form 359 /*----------------------------------------------------*/ 360 361 $('.bottom-form-header').parent().delay(1000).animate({bottom: '-311px'}, 1000, function(){ 362 $(this).find('.bottom-form-header').addClass('closed'); 363 }); 364 365 366 $('.bottom-form-header').click(function(){ 367 if ($(this).hasClass('closed')){ 368 $(this).next('.bottom-form-holder').css({display:'block'}).parent().animate({bottom: 0}, 1000, function(){ 369 $(this).find('.bottom-form-header').removeClass('closed'); 370 }); 371 } else { 372 $(this).parent().animate({bottom: '-311px'}, 1000, function(){ 373 $(this).find('.bottom-form-header').addClass('closed'); 374 }); 375 } 376 377 return false; 378 }); 379 380 381 /*----------------------------------------------------*/ 382 /* Newsletter Subscribe Form 383 /*----------------------------------------------------*/ 384 385 $('.newsletter-form').ajaxChimp({ 386 language: 'cm', 387 url: 'https://dsathemes.us3.list-manage.com/subscribe/post?u=af1a6c0b23340d7b339c085b4&id=344a494a6e' 388 //http://xxx.xxx.list-manage.com/subscribe/post?u=xxx&id=xxx 389 }); 390 391 392 $.ajaxChimp.translations.cm = { 393 'submit': 'Submitting...', 394 0: 'We have sent you a confirmation email', 395 1: 'Please enter your email address', 396 2: 'An email address must contain a single @',
397 3: 'The domain portion of the email address is invalid (the portion after the @: )', 398 4: 'The username portion of the email address is invalid (the portion before the @: )', 399 5: 'This email address looks fake or invalid. Please enter a real email address' 400 }; 401 402 /*----------------------------------------------------*/ 403 /* Search 404 /*----------------------------------------------------*/ 405 406 $(".searchterm").on('keyup', function (e) { 407 if (e.key === 'Enter' || e.keyCode === 13) { 408 search(); 409 } 410 }); 411 412 /* if ('serviceWorker' in navigator) { 413 window.addEventListener('load', () => { 414 navigator.serviceWorker.register('/service-worker.js') 415 .then((registration) => { 416 console.log('ServiceWorker registration successful with scope: ', registration.scope); 417 }) 418 .catch((error) => { 419 console.log('ServiceWorker registration failed: ', error); 420 }); 421 }); 422 } */ 423 }); 424 425 function search(){ 426 var term = ''; 427 if($('.searchterm:eq(0)').val() != ''){ 428 term = $('.searchterm:eq(0)').val() 429 } else { 430 term = $('.searchterm:eq(1)').val() 431 } 432 if(term.trim() == ''){ 433 alert('Search term cannot be blank!') 434 return false; 435 } 436 location.href='search/?term='+term.trim() 437 }
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.