1 2 window.gelocationAsked = false; 3 4 $(document).ready(function(){ 5 6 // Locate User 7 /*var location = $.get('/wp-json/geolocate/geolocate?' + $.now(), function(response){ 8 9 if(response && response === 'NA') 10 { 11 console.log('redirect'); 12 window.location.href = "https://www.firstimpressionsecuritydoors.com/nationwide?utm_source=non_az_traffic"; 13 } 14 });*/ 15 16 17 /* Helpers & event handlers 18 -----------------------------------------------*/ 19 20 $('.header .bottom nav.desktop').removeClass('loading-menu'); 21 22 // Open external links in new window 23 $('a[rel="external"]').click(function(){ 24 window.open(this.href); 25 return false; 26 }); 27 28 $('[data-fancybox="gallery"]').fancybox({ 29 touch: false, 30 helpers : { 31 title: { 32 type: 'inside', 33 position: 'bottom' 34 } 35 }, 36 }); 37 38 function onPlayerReady(event) { 39 event.target.playVideo(); 40 //alert("play"); 41 } 42 43 $('.fancy-video').fancybox({ 44 helpers : { 45 title: { 46 type: 'inside', 47 position: 'bottom' 48 } 49 }, 50 youtube: { 51 autoplay: 1, // enable autoplay 52 }, 53 video: { 54 autoplay: false, 55 }, 56 afterShow: function( instance, current ) { 57 58 console.log('loaded'); 59 // Find the iframe ID 60 var id = $('.fancybox-iframe').attr('id'); 61 62 console.log(id); 63 64 // Create video player object and add event listeners 65 var player = new YT.Player(id, { 66 events: { 67 'onReady': onPlayerReady, 68 // 'onStateChange': onPlayerStateChange 69 } 70 }); 71 72 73 } 74 75 }); 76 77 78 79 // Open external links in new window 80 $('.overlay.disabled').click(function(){ 81 return false; 82 }); 83 84 // Open external links in new window 85 $('.chat-now').click(function(){ 86 $('#chat-widget-minimized').contents().find('button').trigger('click'); 87 //$("#apexchat_invitation_container_minimized_wrapper > div > div > div > div").click(); 88 return false; 89 }); 90 91 // Fancybox 92// $('.general-content *:not(.gallery) a:has(img)').attr('data-fancybox', ''); 93 $('.general-content *:not(.gallery) a:has(img)').removeAttr('data-fancybox'); 94 $('.general-content .gallery a:has(img)').attr('data-fancybox', 'gallery'); 95 96 // Share 97 $('[data-share]').click(shareThis); 98 99 // Read more 100 $('.page-header .read-more').click(function(e){ 101 e.preventDefault(); 102 $('.page-header .read-more').parents('.page-header').toggleClass('show-more'); 103 }); 104 105/* 106 // Add ZIP mask 107 $('header .zip input').mask('00000'); 108 $('#mobile-zip').mask('00000'); 109*/ 110 111 // Submenu wrapper 112 $('.menu-item-has-children > .sub-menu').wrap('<div class="sub-menu-wrapper" />'); 113 114 // Dot dot dot 115 $('.truncate').dotdotdot({}); 116 117 // Add to ideas 118 $(document).on('click', '.add-as-idea', function(e){ 119 120 e.preventDefault(); 121 e.stopImmediatePropagation(); 122 123 self = $(this); 124 action = self.data('action'); 125 126 if( action == 'add' ) { 127 $(this).addClass('active').data('action', 'remove'); 128 } else { 129 $(this).removeClass('active').data('action', 'add'); 130 } 131 132 $.get('/photo-gallery/?'+action+'='+self.data('id'), function(){ 133 134 if( $('body').hasClass('single-product') ) { 135 self.find('.label').html( action=='add' ? 'Remove from design ideas' : 'Add to design ideas' ); 136 } 137 138 }); 139 }); 140 141 // Remove from ideas 142 $('.page-ideas .item .delete').on('click', function(e){ 143 e.preventDefault(); 144 e.stopImmediatePropagation(); 145 item = $(this).parents('.item'); 146 item_id = $(this).data('id'); 147 if( confirm('Are you sure want to remove this item from your design ideas?') ) 148 { 149 item.remove(); 150 151 count = $('.page-ideas .item').length; 152 $('.count').html( count + (count > 1 ? ' Items' : ' Item') ); 153 154 $.get('/photo-gallery/?remove='+item_id, function( response ){ 155 156 if( !count ) { 157 window.location = window.location.href; 158 } else { 159 $('.gform_hidden input').val(response); 160 } 161 162 }); 163 } 164 }); 165 166 // Filter gallery 167 $('.page-gallery .filter input').on('change', function(){ 168 169 // Loading 170 $('.page-gallery .wrapper').html('<div class="loading"><i class="fa fa-refresh fa-spin"></i></div>'); 171 172 // Serialize 173// $.post('/photo-gallery/?ajax=1', $('.page-gallery .filter input:checked').serialize(), function(response){ 174 175 var suffix = ''; 176 177 if( $("#site-version").length > 0) 178 suffix = '&site=' + $("#site-version").val(); 179 180 if($(this).hasClass('videos')) { 181 var url = '/videos/?ajax=1' + suffix; 182 } 183 else { 184 var url = '/photo-gallery/?ajax=1' + suffix; 185 } 186 187 $.post( url, $('.page-gallery .filter input:checked').serialize(), function(response){ 188 189 $('.page-gallery .wrapper').html(response); 190 }); 191 192 if( $('.term-filter:checked').length >Â 0 ) { 193 $('#term-all').prop('checked', false); 194 $('#term-all').prev().removeClass('checked'); 195 } else { 196 $('#term-all').prop('checked', true); 197 $('#term-all').prev().addClass('checked'); 198 } 199 200 }); 201
202 $('.page-gallery #term-all').change(function(){ 203 $('.page-gallery input.term-filter').prop('checked', false).trigger('change'); 204 }); 205 206 $('.page-gallery .product-link').click(function(e){ 207 e.preventDefault(); 208 e.stopImmediatePropagation(); 209 window.location = $(this).attr('data-href'); 210 }); 211 212 213 // Filter products 214 $('.page-category .filters select').on('change', function(){ 215 216 value = $(this).val(); 217 218 if( jQuery.isArray(value) && value[0].search('all') >Â -1 ){ 219 return false; 220 } 221 222 // Loading 223 $('.page-category .wrapper').html('<div class="loading"><i class="fa fa-refresh fa-spin"></i></div>'); 224 225 // Serialize 226 $.post(window.location.href+'?ajax=1', $('.page-category .filters select').serialize(), function(response){ 227 $('.page-category .wrapper').html(response); 228 }); 229 230 }); 231 232 // Geolocation 233 $('header [name="zip"], #mobile-zip').focus(function(){ 234 235 if( navigator.geolocation &&Â !window.gelocationAsked ) 236 { 237 navigator.geolocation.getCurrentPosition(function(position){ 238 window.location = '/?city_search=1&latlng='+position.coords.latitude+','+position.coords.longitude; 239 }, function() { 240 window.gelocationAsked = true; 241 alert('We were unable to locate your position. Please enter your zip code.'); 242 }); 243 } 244 245 }); 246 247 // jConfirm defaults 248 if( typeof jconfirm !== 'undefined' ) 249 { 250 jconfirm.defaults = { 251 animation: 'bottom', 252 closeAnimation: 'bottom', 253 backgroundDismiss: true 254 } 255 } 256 257 window.ask_popup = $('#ask-popup').detach() 258 259 $('.ask-question').on('click', function(e){ 260 e.preventDefault(); 261 262 $.alert({ 263 title: 'Ask a question', 264 content: window.ask_popup.html(), 265 closeIcon: true 266 }); 267 268 }); 269 270 $('[href="#search-trigger"]').click(function(){ 271 $('.search-popup').addClass('show'); 272 setTimeout(function(){ 273 $('.search-popup input').focus(); 274 }, 500); 275 }); 276 277 $('.search-popup form').click(function(e){ 278 e.stopImmediatePropagation(); 279 }); 280 281 $('.search-popup').click(function(){ 282 $(this).removeClass('show'); 283 }); 284 285 286 if( typeof(gform) != 'undefined' ) 287 { 288 gform.addFilter('gform_file_upload_markup', function (html, file, up, strings, imagesUrl) { 289 290 var formId = up.settings.multipart_params.form_id, 291 fieldId = up.settings.multipart_params.field_id; 292 293 gform_unique_id = $('[name="gform_unique_id"]').val(); 294 295 html = ''; 296// html += '<div class="image" style="background-image:url('+gform_upload_path+'/'+gform_unique_id+'_input_5_'+file.target_name+');"></div>'; 297// html += '<div class="gform_delete" onclick="gformDeleteUploadedFile(' + formId + ',' + fieldId + ', this);"><svg version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" viewBox="0 0 486.4 486.4" style="enable-background:new 0 0 486.4 486.4;" xml:space="preserve"><path d="M446,70H344.8V53.5c0-29.5-24-53.5-53.5-53.5h-96.2c-29.5,0-53.5,24-53.5,53.5V70H40.4c-7.5,0-13.5,6-13.5,13.5S32.9,97,40.4,97h24.4v317.2c0,39.8,32.4,72.2,72.2,72.2h212.4c39.8,0,72.2-32.4,72.2-72.2V97H446c7.5,0,13.5-6,13.5-13.5S453.5,70,446,70z M168.6,53.5c0-14.6,11.9-26.5,26.5-26.5h96.2c14.6,0,26.5,11.9,26.5,26.5V70H168.6V53.5z M394.6,414.2c0,24.9-20.3,45.2-45.2,45.2H137c-24.9,0-45.2-20.3-45.2-45.2V97h302.9v317.2H394.6z"/><path d="M243.2,411c7.5,0,13.5-6,13.5-13.5V158.9c0-7.5-6-13.5-13.5-13.5s-13.5,6-13.5,13.5v238.5C229.7,404.9,235.7,411,243.2,411z"/><path d="M155.1,396.1c7.5,0,13.5-6,13.5-13.5V173.7c0-7.5-6-13.5-13.5-13.5s-13.5,6-13.5,13.5v208.9C141.6,390.1,147.7,396.1,155.1,396.1z"/><path d="M331.3,396.1c7.5,0,13.5-6,13.5-13.5V173.7c0-7.5-6-13.5-13.5-13.5s-13.5,6-13.5,13.5v208.9C317.8,390.1,323.8,396.1,331.3,396.1z"/></svg></div>'; 298 html += '<div class="gform_delete" onclick="gformDeleteUploadedFile(' + formId + ',' + fieldId + ', this);">Remove ' +file.target_name +'</div>'; 299 300 301 return html; 302 }); 303 } 304 305 $(document).on('click', '.popup .inner', function(e){ 306 e.stopImmediatePropagation(); 307 if( !$(e.target).parents('.box').length ) { 308 $('.popup').removeClass('show'); 309 $('input[name="input_6"]').datepicker('hide'); 310 } 311 }); 312 313 $('.popup .close').click(function(e){ 314 315 $(this).parents('.popup').removeClass('show'); 316 $('input[name="input_6"]').datepicker('hide'); 317 318 $(".header, .site-wrapper").css({"-webkit-filter": "none", "-moz-filter": "none", "-o-filter" : "none", "-ms-filter" : "none"}); 319 320 }); 321
322 $('.popup-show').click(function(e){ 323 e.preventDefault(); 324 $('#popup-book').addClass('show'); 325 }); 326 327 $('.popup-show-tx').click(function(e){ 328 e.preventDefault(); 329 $('#popup-book-tx').addClass('show'); 330 }); 331 332 $('.popup-promos-1').click(function(e){ 333 e.preventDefault(); 334 $('#popup-promos-1').addClass('show'); 335 }); 336 337 $('.popup-promos-2').click(function(e){ 338 e.preventDefault(); 339 $('#popup-promos-2').addClass('show'); 340 }); 341 342 $('.popup-promos-3').click(function(e){ 343 e.preventDefault(); 344 $('#popup-promos-3').addClass('show'); 345 }); 346 347 $('.popup-promos-4').click(function(e){ 348 e.preventDefault(); 349 $('#popup-promos-4').addClass('show'); 350 }); 351 352 $('.popup-promos-5').click(function(e){ 353 e.preventDefault(); 354 $('#popup-promos-5').addClass('show'); 355 }); 356 357 $('.popup-promos-6').click(function(e){ 358 e.preventDefault(); 359 $('#popup-promos-6').addClass('show'); 360 }); 361 362 $('.popup-promos-7').click(function(e){ 363 e.preventDefault(); 364 $('#popup-promos-7').addClass('show'); 365 }); 366 367 $('.popup-promos-8').click(function(e){ 368 e.preventDefault(); 369 $('#popup-promos-8').addClass('show'); 370 }); 371 372 $('.popup-promos-9').click(function(e){ 373 e.preventDefault(); 374 $('#popup-promos-9').addClass('show'); 375 }); 376 377 378 $('.popup-promos-10').click(function(e){ 379 e.preventDefault(); 380 $('#popup-promos-10').addClass('show'); 381 }); 382 383 $('.popup-promos-11').click(function(e){ 384 e.preventDefault(); 385 $('#popup-promos-11').addClass('show'); 386 }); 387 388 $('.popup-promos-12').click(function(e){ 389 e.preventDefault(); 390 $('#popup-promos-12').addClass('show'); 391 }); 392 393 $('.popup-promos-13').click(function(e){ 394 e.preventDefault(); 395 $('#popup-promos-13').addClass('show'); 396 }); 397 398 $('.popup-promos-14').click(function(e){ 399 e.preventDefault(); 400 $('#popup-promos-14').addClass('show'); 401 }); 402 403 $('.popup-promos-15').click(function(e){ 404 e.preventDefault(); 405 $('#popup-promos-15').addClass('show'); 406 }); 407 408 $('.popup-promos-16').click(function(e){ 409 e.preventDefault(); 410 $('#popup-promos-16').addClass('show'); 411 }); 412 413 $('.popup-promos-17').click(function(e){ 414 e.preventDefault(); 415 $('#popup-promos-17').addClass('show'); 416 }); 417 418 $('.popup-promos-18').click(function(e){ 419 e.preventDefault(); 420 $('#popup-promos-18').addClass('show'); 421 }); 422 423 $('.popup-promos-19').click(function(e){ 424 e.preventDefault(); 425 $('#popup-promos-19').addClass('show'); 426 }); 427 428 429 $('.popup-promos-open').click(function(e){ 430 e.preventDefault(); 431 $('#popup-promos-' + $(this).attr('data-popup')).addClass('show'); 432 }); 433 434 $('.popup-covid').click(function(e){ 435 e.preventDefault(); 436 $('#popup-covid').addClass('show'); 437 }); 438 439 $('.popup-mobile').click(function(e){ 440 e.preventDefault(); 441 $('#popup-mobile').addClass('show'); 442 }); 443 444 $('.popup-newsletter').click(function(e){ 445 e.preventDefault(); 446 $('#popup-catalog').addClass('show'); 447 }); 448 449 $('.popup-checklist').click(function(e){ 450 e.preventDefault(); 451 $('#popup-checklist').addClass('show'); 452 }); 453 454 $('.popup-showroom').click(function(e){ 455 e.preventDefault(); 456 $('#popup-showroom').addClass('show'); 457 }); 458 459 if( $('body').hasClass('home') ||Â $('body').hasClass('single-location') ) { 460 //$('#popup-catalog').addClass('show'); 461 } 462 463 464 /* Swipers 465 -----------------------------------------------*/ 466 467 // Hero 468 if( $('.home-hero .swiper-container').length ) 469 { 470 heroSlidesCount = parseInt($('.home-hero .swiper-container').data('count')); 471 472 var swiper = new Swiper('.home-hero .swiper-container', { 473 slidesPerView: 1, 474 effect: 'fade', 475 autoplay: { 476 delay: 5000, 477 }, 478 navigation: { 479 nextEl: '.home-hero .swiper-nav .next', 480 prevEl: '.home-hero .swiper-nav .prev', 481 }, 482 pagination: heroSlidesCount == 1 ? false : { 483 el: '.home-hero .swiper-pagination', 484 clickable: true, 485 type: 'bullets', 486 }, 487 fadeEffect: { 488 crossFade: true 489 }, 490 autoplay: heroSlidesCount == 1 ? false : { 491 dleay: 4000 492 }, 493 observer: true, 494 loop: true, 495 watchOverflow: true, 496 breakpoints: { 497 480: { 498 autoHeight: true 499 } 500 } 501 }); 502 } 503 504 // City services 505 if( $('.city-services .swiper-container').length ) 506 { 507 var swiper = new Swiper('.city-services .swiper-container', { 508 slidesPerView: 6, 509 navigation: { 510 nextEl: '.city-services .swiper-nav .next', 511 prevEl: '.city-services .swiper-nav .prev', 512 }, 513 autoplay: { 514 dleay: 4000 515 }, 516 loop: true, 517 breakpoints: { 518 1850: { 519 slidesPerView: 5, 520 }, 521 1450: { 522 slidesPerView: 4, 523 }, 524 1150: { 525 slidesPerView: 3, 526 }, 527 767: { 528 slidesPerView: 2, 529 }, 530 600: { 531 slidesPerView: 1, 532 autoHeight: true 533 } 534 } 535 }); 536 } 537 538 // City FAQ 539 if( $('.city-faq .swiper-container').length ) 540 { 541 var swiper = new Swiper('.city-faq .swiper-container', { 542 slidesPerView: 1, 543 navigation: { 544 nextEl: '.city-faq .swiper-nav .next', 545 prevEl: '.city-faq .swiper-nav .prev', 546 }, 547 loop: true, 548 effect: 'fade', 549 fadeEffect: { 550 crossFade: true 551 }, 552 breakpoints: { 553 850: { 554 autoHeight: true 555 } 556 } 557 }); 558 } 559 560 // Recently viewed 561 if( $('.page-product .recently-viewed .swiper-container').length ) 562 { 563 var swiper = new Swiper('.page-product .recently-viewed .swiper-container', { 564 slidesPerView: 3, 565 navigation: { 566 nextEl: '.page-product .recently-viewed .swiper-nav .next', 567 prevEl: '.page-product .recently-viewed .swiper-nav .prev', 568 }, 569 spaceBetween: 40, 570 breakpoints: { 571 1250: { 572 slidesPerView: 2, 573 spaceBetween: 20, 574 } 575 } 576 }); 577 } 578 579 // Showrooms 580 if( $('.page-showrooms .swiper-container').length ) 581 { 582 var swiper = new Swiper('.page-showrooms .swiper-container', { 583 slidesPerView: 5, 584 navigation: { 585 nextEl: '.page-showrooms .swiper-nav .next', 586 prevEl: '.page-showrooms .swiper-nav .prev', 587 }, 588 spaceBetween: 15, 589 loop: false, 590 breakpoints: { 591 1850: { 592 slidesPerView: 5, 593 }, 594 1450: { 595 slidesPerView: 4, 596 }, 597 1150: { 598 slidesPerView: 3, 599 }, 600 1023: { 601 slidesPerView: 2, 602 }, 603 600: { 604 slidesPerView: 1, 605 autoHeight: true 606 } 607 } 608 }); 609 } 610 611 // Home blog 612 if( $('.home-news .swiper-container').length ) 613 { 614 var swiper = new Swiper('.home-news .swiper-container', { 615 slidesPerView: 3, 616 /*navigation: { 617 nextEl: '.city-services .swiper-nav .next', 618 prevEl: '.city-services .swiper-nav .prev', 619 },*/ 620 spaceBetween: 40, 621 loop: false, 622 breakpoints: { 623 1023: { 624 slidesPerView: 2 625 }, 626 600: { 627 slidesPerView: 1 628 }, 629 }, 630 pagination: { 631 el: '.swiper-pagination', 632 type: 'bullets', 633 clickable: true 634 } 635 }); 636 637 setTimeout(function(){ $(window).trigger('resize'); }, 2000); 638 } 639 640 641 // Home blog 642 if( $('.mp4 .swiper-container').length ) 643 { 644 var swiper = new Swiper('.mp4 .swiper-container', { 645 slidesPerView: 4, 646 /*navigation: { 647 nextEl: '.city-services .swiper-nav .next', 648 prevEl: '.city-services .swiper-nav .prev', 649 },*/ 650 spaceBetween: 20, 651 loop: true, 652 video: { 653 controls: 1 654 }, 655 navigation: { 656 nextEl: '.mp4 .swiper-nav .next', 657 prevEl: '.mp4 .swiper-nav .prev', 658 }, 659 breakpoints: { 660 1023: { 661 slidesPerView: 4 662 }, 663 600: { 664 slidesPerView: 2 665 }, 666 400: { 667 slidesPerView: 1 668 }, 669 }, 670 pagination: { 671 el: '.swiper-pagination', 672 type: 'bullets', 673 clickable: true 674 } 675 }); 676 677 setTimeout(function(){ $(window).trigger('resize'); }, 2000); 678 } 679 680 681 682 683 684 /* Layout 685 -----------------------------------------------*/ 686 687 $('input[type="checkbox"]').checkbox(); 688 $('input[type="radio"]').radiobox(); 689 $('select:not(".select2")').selectbox(); 690 691 $(document).bind('gform_post_render', function(event, form_id){ 692 $('#gform_wrapper_'+form_id+' input[type="checkbox"]').checkbox(); 693 $('#gform_wrapper_'+form_id+' input[type="radio"]').radiobox(); 694 $('#gform_wrapper_'+form_id+' select:not(".select2")').selectbox(); 695 }); 696 697 $('.select2').each(function(){ 698 $(this).select2({ 699 placeholder: $(this).attr('placeholder'), 700 maximumSelectionLength: 4 701 }).on('select2:select', function(e){ 702 if( e.params.data.text == 'All Styles' ){ 703 $(this).val('').trigger('change'); 704 } 705 }); 706 }); 707 708 // Tabs 709 $('.page-product .product-tabs').tabs(); 710 711 712 /* Navigation 713 -----------------------------------------------*/ 714 715 // Bars 716 $('header .bars').click(function(){ 717 $('body').toggleClass('opened-menu'); 718 }); 719 720 $('.mobile-menu li.menu-item-has-children > a').click(function(){ 721 $('.mobile-menu').addClass('show-dropdown'); 722 $(this.parentNode).find('.sub-menu').show(); 723 return false;
724 }); 725 726 $('.mobile-menu .back').click(function(){ 727 $('.mobile-menu').removeClass('show-dropdown'); 728 setTimeout(function(){ 729 $('.mobile-menu .sub-menu').hide(); 730 }, 400) 731 return false; 732 }); 733 734 735 $('a[href*="#"]:not([href="#"]):not([href^="#tab-content-"]').click(function() { 736 var offset = -200; 737 if (location.pathname.replace(/^\//,'') == this.pathname.replace(/^\//,'') && location.hostname == this.hostname) { 738 var target = $(this.hash); 739 target = target.length ? target : $('[name=' + this.hash.slice(1) +']'); 740 if (target.length) { 741 $('html, body').animate({ 742 scrollTop: target.offset().top + offset 743 }, 1000); 744 return false; 745 } 746 } 747 }); 748 749 750 751 }); 752 753 754 $(window).on('load resize', function(){ 755 756 equalHeight($('.page-contact .list .item .content')); 757 //equalHeight($('.page-showrooms .list .item .content .details')); 758 //equalHeight($('.page-showrooms .list .item .content .title')); 759 760 }); 761 762 763 $('.hide-notice').click(function() { 764 765 var expires; 766 var days = 2; 767 var date = new Date(); 768 date.setTime(date.getTime() + (days * 24 * 60 * 60 * 1000)); 769 expires = "; expires=" + date.toGMTString(); 770 771 document.cookie = encodeURIComponent('notice') + "=" + encodeURIComponent('hide') + expires + "; path=/"; 772 773 $('.covid-notice').fadeOut(); 774 775 }); 776 777 /* Functions 778 -----------------------------------------------*/ 779 780 /* 781 * Equal element heights 782 */ 783 function equalHeight(group) 784 { 785 var tallest = 0; 786 group.css('minHeight', 0); 787 group.each(function() { 788 var thisHeight = $(this).outerHeight(); 789 if(thisHeight > tallest) { 790 tallest = thisHeight; 791 } 792 }); 793 group.css('minHeight', tallest); 794 } 795 796 /* 797 * Radiobox 798 */ 799 $.fn.radiobox = function(){ 800 return this.each(function(){ 801 802 // Element 803 var elem = $(this); 804 805 // Group ID 806 var gid = elem.attr('name'); 807 808 // UID 809 var uid = 'rb-'+gid+'-'+elem.index()+'-'+elem.attr('id')+'-helper'; 810 811 // Insert helper element 812 var wrapper = $('<span id="'+uid+'" class="radiobox '+( elem.prop('checked') ? 'checked' : '' )+'" data-radio-group="'+gid+'"><span class="inn"></span></span>').insertBefore(elem); 813 814 // Hide original element 815 elem.css('display', 'none'); 816 817 // Add event handler for wrapper 818 wrapper.on('click', function(){ 819 $('.radiobox[data-radio-group="'+gid+'"]').removeClass('checked'); 820 elem.prop('checked', true); 821 elem.trigger('change'); 822 }); 823 824 // Add event handler for element 825 elem.on('change', function(){ 826 $('.radiobox[data-radio-group="'+gid+'"]').removeClass('checked'); 827 if( elem.prop('checked') ){ 828 wrapper.addClass('checked'); 829 } else { 830 wrapper.removeClass('checked'); 831 } 832 }); 833 834 }); 835 } 836 837 /* 838 * Checkbox style 839 */ 840 841 $.fn.checkbox = function(){ 842 return this.each(function() { 843 844 // Element 845 var elem = $(this); 846 847 // UID 848 var uid = elem.attr('id')+'-helper'; 849 850 // Insert helper element 851 var wrapper = $('<span id="'+uid+'" class="checkbox '+( elem.prop('checked') ? 'checked' : '' )+'"><span class="inn"></span></span>').insertBefore(elem); 852 853 // Hide original element 854 elem.css('display', 'none'); 855 856 // Add event handler for wrapper 857 wrapper.on('click', function(){ 858 if( elem.prop('checked') ){ 859 elem.prop('checked', false); 860 } else { 861 elem.prop('checked', true); 862 } 863 elem.trigger('change'); 864 }); 865 866 // Add event handler for element 867 elem.on('change', function(){ 868 if( elem.prop('checked') ){ 869 wrapper.addClass('checked'); 870 } else { 871 wrapper.removeClass('checked'); 872 } 873 }); 874 875 }); 876 } 877 878 879 /* 880 * jQuery Tabs 881 */ 882 883 $.fn.tabs = function(){ 884 return this.each(function() { 885 886 // Wrapper 887 var wrapper = $(this); 888 889 // Nav 890 var nav = wrapper.find('ul.tabs-nav'); 891 892 // Content container 893 var content_container = wrapper.find('.tabs-content-container'); 894 895 // Set initial min height 896 // content_container.css('minHeight', wrapper.find('.tab-content.active').height()); 897 898 // Attach event handler 899 nav.find('a').click(function(){ 900 901 // Next tab ID 902 next_tab_id = $(this).attr('href'); 903 904 // Find next tab 905 next_tab = wrapper.find(next_tab_id); 906 907 // Clone next tab 908 next_tab_clone = next_tab.clone(); 909 910 // Insert into DOM 911 content_container.append(next_tab_clone); 912 913 // Change CSS to get height 914 next_tab_clone.css({ 915 position: 'absolute', 916 visibility: 'hidden', 917 display: 'block' 918 }); 919 920 // Get height 921 next_tab_height = next_tab_clone.height(); 922 923 // Remove clone element 924 next_tab_clone.remove(); 925 926 // Remove active tab's class 927 nav.find('.active').removeClass('active'); 928
929 // Add active class to next tab 930 $(this).parents('li').addClass('active'); 931 932 // Hide active tab content 933 wrapper.find('.tab-content.active').fadeOut(300, function(){ 934 935 // Remove active class 936 $(this).removeClass('active'); 937 938 939 next_tab.fadeIn(300, function(){ 940 $(this).addClass('active'); 941 }); 942 943 944 // Change wrapper height 945// content_container.animate({ /*minHeight: next_tab_height*/ }, function(){ 946 947 // Show next tabIndex 948 949// }); 950 951 }); 952 953 return false; 954 955 }); 956 957 }); 958 } 959 960 961 /* 962 * Share 963 */ 964 function shareThis() 965 { 966 var $this = $(this); 967 var service = $this.data('share'); 968 var link = $this.data('url') ? $this.data('url') : $('meta[property="og:url"]').attr('content'); 969 var og_title = $this.data('title') ? $this.data('title') : $('meta[property="og:title"]').attr('content'); 970 var og_image = $this.data('image') ? $this.data('title') : $('meta[property="og:image"]').attr('content'); 971 var og_desc = $this.data('description') ? $this.data('description') : $('meta[property="og:description"]').attr('content'); 972 973 if(service == 'facebook'){ window.open('https://www.facebook.com/sharer/sharer.php?u='+link, 'wnd_fb', 'status=1, height=350, width=650, resizable=1'); } 974 if(service == 'gplus'){ window.open('https://plus.google.com/share?url='+link, 'wnd_fb', 'status=1, height=350, width=650, resizable=1'); } 975 if(service == 'linkedin'){ window.open('https://www.linkedin.com/shareArticle?mini=true&url='+link+'&title='+og_title+'&summary='+og_desc+'&source=', 'wnd_in', 'status=1, height=350, width=600, resizable=1'); } 976 if(service == 'pinterest'){ window.open('https://pinterest.com/pin/create/button/?url='+link+'&media='+og_image+'&description='+og_title, 'wnd_pt', 'status=1, height=350, width=650, resizable=1'); } 977 if(service == 'tumblr'){ window.open('http://www.tumblr.com/share/link?url='+link+'&name='+og_title+'&description='+og_desc, 'wnd_tr', 'status=1, height=400, width=500, resizable=1'); } 978 if(service == 'twitter'){ window.open('https://twitter.com/home?status=:+'+link, 'wnd_tw', 'status=1, height=350, width=650, resizable=1'); $.get(site_url+'/?share_count_tracker=twitter:'+$this.data('id')); } 979 if(service == 'email'){ window.location = 'mailto:?subject='+og_title+'&body=Hello,%0D%0A%0D%0Alook at this product: '+link; } 980 981 return false; 982 }
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.