1/** 2 * @package WordPress 3 * @subpackage Music Band 4 * @version 1.2.0 5 * 6 * Theme Custom Scripts 7 * Created by CMSMasters 8 * 9 */ 10 11 12jQuery(document).ready(function() { 13 "use strict"; 14 15 /* Add Class To Row */ 16 (function ($) { 17 $('.cmsms_row_margin').each(function () { 18 var cmsms_column = $(this).find('.cmsms_column').eq(0); 19 20 21 if ( 22 cmsms_column.hasClass('one_half') && 23 cmsms_column.next().hasClass('one_half') 24 ) { 25 $(this).addClass('cmsms_1212'); 26 } else if ( 27 cmsms_column.hasClass('one_third') && 28 cmsms_column.next().hasClass('two_third') 29 ) { 30 $(this).addClass('cmsms_1323'); 31 } else if ( 32 cmsms_column.hasClass('two_third') && 33 cmsms_column.next().hasClass('one_third') 34 ) { 35 $(this).addClass('cmsms_2313'); 36 } else if ( 37 cmsms_column.hasClass('one_fourth') && 38 cmsms_column.next().hasClass('three_fourth') 39 ) { 40 $(this).addClass('cmsms_1434'); 41 } else if ( 42 cmsms_column.hasClass('three_fourth') && 43 cmsms_column.next().hasClass('one_fourth') 44 ) { 45 $(this).addClass('cmsms_3414'); 46 } else if ( 47 cmsms_column.hasClass('one_third') && 48 cmsms_column.next().hasClass('one_third') && 49 cmsms_column.next().next().hasClass('one_third') 50 ) { 51 $(this).addClass('cmsms_131313'); 52 } else if ( 53 cmsms_column.hasClass('one_half') && 54 cmsms_column.next().hasClass('one_fourth') && 55 cmsms_column.next().next().hasClass('one_fourth') 56 ) { 57 $(this).addClass('cmsms_121414'); 58 } else if ( 59 cmsms_column.hasClass('one_fourth') && 60 cmsms_column.next().hasClass('one_half') && 61 cmsms_column.next().next().hasClass('one_fourth') 62 ) { 63 $(this).addClass('cmsms_141214'); 64 } else if ( 65 cmsms_column.hasClass('one_fourth') && 66 cmsms_column.next().hasClass('one_fourth') && 67 cmsms_column.next().next().hasClass('one_half') 68 ) { 69 $(this).addClass('cmsms_141412'); 70 } else if ( 71 cmsms_column.hasClass('one_fourth') && 72 cmsms_column.next().hasClass('one_fourth') && 73 cmsms_column.next().next().hasClass('one_fourth') && 74 cmsms_column.next().next().next().hasClass('one_fourth') 75 ) { 76 $(this).addClass('cmsms_14141414'); 77 } else { 78 $(this).addClass('cmsms_11'); 79 } 80 } ); 81 } )(jQuery); 82 83 84 85 /* Scroll Top */ 86 (function ($) { 87 $(window).scroll(function () { 88 if ($(this).scrollTop() > 200) { 89 $('#slide_top').filter(':hidden').fadeIn('fast'); 90 } else { 91 $('#slide_top').filter(':visible').fadeOut('fast'); 92 } 93 } ); 94 95 96 $('.divider a, #slide_top').on('click', function () { 97 $('html, body').animate( { 98 scrollTop : 0 99 }, 'slow'); 100 101 102 return false; 103 } ); 104 } )(jQuery); 105 106 107 108 /* Lightbox Classes Adding */ 109 (function ($) { 110 $('.widget_custom_flickr_entries').each(function () { 111 var flickrUniqID = uniqID(); 112 113 114 $(this).find('.flickr_badge_image a').each(function () { 115 var src = $(this).find('img').attr('src'), 116 title = $(this).find('img').attr('title'), 117 src_full = src.replace(/_s.jpg/g, '.jpg'); 118 119 120 $(this).removeAttr('href').attr( { 121 href : src_full, 122 title : title, 123 rel : 'ilightbox[flickr_' + flickrUniqID + ']' 124 } ); 125 } ); 126 } ); // Flickr Widget Lightbox 127 128 129 $('.gallery').each(function () { 130 var galUniqID = uniqID(); 131 132 133 $(this).find('a').each(function () { 134 var linkHref = $(this).attr('href'), 135 lastDotPos = linkHref.lastIndexOf('.'), 136 imgFormat = linkHref.slice(lastDotPos + 1); 137 138 139 if (imgFormat.length <= 5) { 140 $(this).attr('rel', 'ilightbox[wp_gal_' + galUniqID + ']'); 141 } 142 } ); 143 } ); // WordPress Default Gallery Shortcode Lightbox 144 } )(jQuery); 145 146 147 148 /* iLightBox Init */ 149 (function ($) { 150 var ilightbox_settings = { 151 skin : cmsms_script.ilightbox_skin, 152 path : cmsms_script.ilightbox_path, 153 infinite : (cmsms_script.ilightbox_infinite == '1') ? true : false, 154 keepAspectRatio : (cmsms_script.ilightbox_aspect_ratio == '1') ? true : false, 155 mobileOptimizer : (cmsms_script.ilightbox_mobile_optimizer == '1') ? true : false, 156 maxScale : Number(cmsms_script.ilightbox_max_scale), 157 minScale : Number(cmsms_script.ilightbox_min_scale), 158 innerToolbar : (cmsms_script.ilightbox_inner_toolbar == '1') ? true : false, 159 smartRecognition : (cmsms_script.ilightbox_mobile_optimizer == '1') ? true : false, 160 fullAlone : (cmsms_script.ilightbox_fullscreen_one_slide == '1') ? true : false, 161 fullViewPort : cmsms_script.ilightbox_fullscreen_viewport, 162 controls : { 163 toolbar : (cmsms_script.ilightbox_controls_toolbar == '1') ? true : false, 164 arrows : (cmsms_script.ilightbox_controls_arrows == '1') ? true : false, 165 fullscreen : (cmsms_script.ilightbox_controls_fullscreen == '1') ? true : false, 166 thumbnail : (cmsms_script.ilightbox_controls_thumbnail == '1') ? true : false, 167 keyboard : (cmsms_script.ilightbox_controls_keyboard == '1') ? true : false, 168 mousewheel : (cmsms_script.ilightbox_controls_mousewheel == '1') ? true : false, 169 swipe : (cmsms_script.ilightbox_controls_swipe == '1') ? true : false, 170 slideshow : (cmsms_script.ilightbox_controls_slideshow == '1') ? true : false 171 }, 172 text : { 173 close : cmsms_script.ilightbox_close_text, 174 enterFullscreen : cmsms_script.ilightbox_enter_fullscreen_text, 175 exitFullscreen : cmsms_script.ilightbox_exit_fullscreen_text, 176 slideShow : cmsms_script.ilightbox_slideshow_text, 177 next : cmsms_script.ilightbox_next_text, 178 previous : cmsms_script.ilightbox_previous_text 179 }, 180 errors : { 181 loadImage : cmsms_script.ilightbox_load_image_error, 182 loadContents : cmsms_script.ilightbox_load_contents_error, 183 missingPlugin : cmsms_script.ilightbox_missing_plugin_error 184 } 185 }, 186 gallery_array = [], 187 gallery_id = ''; 188 189 190 $('[rel="ilightbox"]').each(function () { 191 $(this).iLightBox(ilightbox_settings); 192 } ); 193 194 195 $('[rel^="ilightbox["]').each(function () { 196 if ($(this).closest('.cmsms_more_items_loader').length === 0) { 197 var item_rel = $(this).attr('rel'); 198 199 200 if ($.inArray(item_rel, gallery_array) === -1) { 201 gallery_array.push(item_rel); 202 } 203 } 204 } ); 205 206 207 $.each(gallery_array, function (gallery_array, gallery_id) { 208 $('[rel="' + gallery_id + '"]').iLightBox(ilightbox_settings); 209 } ); 210 } )(jQuery); 211 212 213 214 /* Shortcodes Animation Run */ 215 (function ($) { 216 if ( 217 !checker.os.iphone && 218 !checker.os.ipod && 219 !checker.os.ipad && 220 !checker.os.blackberry && 221 !checker.os.android 222 ) { 223 $('[data-animation]').waypoint(function (dir) { 224 if (dir === 'down') { 225 var el = $(this), 226 animation = el.data('animation'),
227 delay = (el.data('delay')) ? el.data('delay') : 0; 228 229 230 setTimeout(function () { 231 el.addClass(animation + ' animated'); 232 }, delay); 233 } 234 }, { 235 offset : '100%' 236 } ).waypoint(function (dir) { 237 if (dir === 'up') { 238 var el = $(this), 239 animation = el.data('animation'), 240 delay = (el.data('delay')) ? el.data('delay') : 0; 241 242 243 setTimeout(function () { 244 el.addClass(animation + ' animated'); 245 }, delay); 246 } 247 }, { 248 offset : '25%' 249 } ); 250 } else { 251 $('[data-animation]').addClass('animated'); 252 } 253 254 255 if ( 256 !checker.os.iphone && 257 !checker.os.ipod && 258 !checker.os.ipad && 259 !checker.os.blackberry && 260 !checker.os.android 261 ) { 262 $('.cmsms_icon_box').waypoint(function (dir) { 263 if (dir === 'down') { 264 var el = $(this); 265 266 267 el.addClass('shortcode_animated'); 268 } 269 }, { 270 offset : '100%' 271 } ).waypoint(function (dir) { 272 if (dir === 'up') { 273 var el = $(this); 274 275 276 el.addClass('shortcode_animated'); 277 } 278 }, { 279 offset : '25%' 280 } ); 281 } else { 282 $('.cmsms_icon_box').addClass('shortcode_animated'); 283 } 284 285 286 if ( 287 !checker.os.iphone && 288 !checker.os.ipod && 289 !checker.os.ipad && 290 !checker.os.blackberry && 291 !checker.os.android 292 ) { 293 $('.cmsms_icon_list_items.cmsms_icon_list_type_block').waypoint(function (dir) { 294 if (dir === 'down') { 295 var el = $(this), 296 items = el.find('li'), 297 delay = 500, 298 i = 1; 299 300 301 items.each(function () { 302 var item = $(this); 303 304 305 setTimeout(function () { 306 item.addClass('shortcode_animated'); 307 }, delay * i); 308 309 310 i += 1; 311 } ); 312 } 313 }, { 314 offset : '100%' 315 } ).waypoint(function (dir) { 316 if (dir === 'up') { 317 var el = $(this), 318 items = el.find('li'), 319 delay = 500, 320 i = 1; 321 322 323 items.each(function () { 324 var item = $(this); 325 326 327 setTimeout(function () { 328 item.addClass('shortcode_animated'); 329 }, delay * i); 330 331 332 i += 1; 333 } ); 334 } 335 }, { 336 offset : '25%' 337 } ); 338 } else { 339 $('.cmsms_icon_list_items .cmsms_icon_list_item').addClass('shortcode_animated'); 340 } 341 342 343 if ( 344 !checker.os.iphone && 345 !checker.os.ipod && 346 !checker.os.ipad && 347 !checker.os.blackberry && 348 !checker.os.android 349 ) { 350 $('.cmsms_hover_slider').waypoint(function (dir) { 351 if (dir === 'down') { 352 var el = $(this), 353 items = el.find('li'), 354 delay = 300, 355 i = 1; 356 357 358 items.each(function () { 359 var item = $(this); 360 361 362 setTimeout(function () { 363 item.addClass('shortcode_animated'); 364 }, delay * i); 365 366 367 i += 1; 368 } ); 369 } 370 }, { 371 offset : '100%' 372 } ).waypoint(function (dir) { 373 if (dir === 'up') { 374 var el = $(this), 375 items = el.find('li'), 376 delay = 300, 377 i = 1; 378 379 380 items.each(function () { 381 var item = $(this); 382 383 384 setTimeout(function () { 385 item.addClass('shortcode_animated'); 386 }, delay * i); 387 388 389 i += 1; 390 } ); 391 } 392 }, { 393 offset : '25%' 394 } ); 395 } else { 396 $('.cmsms_hover_slider ul li').addClass('shortcode_animated'); 397 } 398 399 400 if ( 401 !checker.os.iphone && 402 !checker.os.ipod && 403 !checker.os.ipad && 404 !checker.os.blackberry && 405 !checker.os.android 406 ) { 407 $('.cmsms_profile.vertical').waypoint(function (dir) { 408 if (dir === 'down') { 409 var el = $(this), 410 items = el.find('article'), 411 delay = 500, 412 i = 1; 413 414 415 items.each(function () { 416 var item = $(this); 417 418 419 setTimeout(function () { 420 item.addClass('shortcode_animated'); 421 }, delay * i); 422 423 424 i += 1; 425 } ); 426 } 427 }, { 428 offset : '100%' 429 } ).waypoint(function (dir) { 430 if (dir === 'up') { 431 var el = $(this), 432 items = el.find('article'),
433 delay = 500, 434 i = 1; 435 436 437 items.each(function () { 438 var item = $(this); 439 440 441 setTimeout(function () { 442 item.addClass('shortcode_animated'); 443 }, delay * i); 444 445 446 i += 1; 447 } ); 448 } 449 }, { 450 offset : '25%' 451 } ); 452 } else { 453 $('.cmsms_profile.vertical .profile').addClass('shortcode_animated'); 454 } 455 456 457 if ( 458 !checker.os.iphone && 459 !checker.os.ipod && 460 !checker.os.ipad && 461 !checker.os.blackberry && 462 !checker.os.android 463 ) { 464 $('.cmsms_clients_grid').waypoint(function (dir) { 465 if (dir === 'down') { 466 var el = $(this), 467 items = el.find('.cmsms_clients_item'), 468 delay = 300, 469 i = 1; 470 471 472 items.each(function () { 473 var item = $(this); 474 475 476 setTimeout(function () { 477 item.addClass('shortcode_animated'); 478 }, delay * i); 479 480 481 i += 1; 482 } ); 483 } 484 }, { 485 offset : '100%' 486 } ).waypoint(function (dir) { 487 if (dir === 'up') { 488 var el = $(this), 489 items = el.find('.cmsms_clients_item'), 490 delay = 300, 491 i = 1; 492 493 494 items.each(function () { 495 var item = $(this); 496 497 498 setTimeout(function () { 499 item.addClass('shortcode_animated'); 500 }, delay * i); 501 502 503 i += 1; 504 } ); 505 } 506 }, { 507 offset : '25%' 508 } ); 509 } else { 510 $('.cmsms_clients_grid').find('.cmsms_clients_item').addClass('shortcode_animated'); 511 } 512 513 514 if ( 515 !checker.os.iphone && 516 !checker.os.ipod && 517 !checker.os.ipad && 518 !checker.os.blackberry && 519 !checker.os.android 520 ) { 521 $('.cmsms_gallery, .blog.columns, .blog.timeline').waypoint(function (dir) { 522 if (dir === 'down') { 523 var el = $(this), 524 items = el.find('article.post, .cmsms_gallery_item'), 525 itemsCount = items.length, 526 delay = 300, 527 i = 1; 528 529 530 var newTime = setInterval(function () { 531 if (el.hasClass('isotope')) { 532 clearInterval(newTime); 533 } else { 534 return false; 535 } 536 537 538 items.each(function () { 539 var item = $(this); 540 541 542 setTimeout(function () { 543 item.addClass('shortcode_animated'); 544 }, delay * i); 545 546 547 i += 1; 548 549 550 if (i === itemsCount) { 551 setTimeout(function () { 552 $(window).trigger('resize'); 553 }, delay * i); 554 } 555 } ); 556 }, 300); 557 } 558 }, { 559 offset : '100%' 560 } ).waypoint(function (dir) { 561 if (dir === 'up') { 562 var el = $(this), 563 items = el.find('article.post, .cmsms_gallery_item'), 564 itemsCount = items.length, 565 delay = 300, 566 i = 1; 567 568 569 var newTime = setInterval(function () { 570 if (el.hasClass('isotope')) { 571 clearInterval(newTime); 572 } else { 573 return false; 574 } 575 576 577 items.each(function () { 578 var item = $(this); 579 580 581 setTimeout(function () { 582 item.addClass('shortcode_animated'); 583 }, delay * i); 584 585 586 i += 1; 587 588 589 if (i === itemsCount) { 590 setTimeout(function () { 591 $(window).trigger('resize'); 592 }, delay * i); 593 } 594 } ); 595 }, 300); 596 } 597 }, { 598 offset : '25%' 599 } ); 600 } else { 601 $('.cmsms_gallery, .blog.columns, .blog.timeline').find('article.post, .cmsms_gallery_item').addClass('shortcode_animated'); 602 } 603 } )(jQuery); 604 605 606 607 /* Stats Run */ 608 (function ($) { 609 if ( 610 !checker.os.iphone && 611 !checker.os.ipod && 612 !checker.os.ipad && 613 !checker.os.blackberry && 614 !checker.os.android && 615 !checker.ua.ie9 616 ) { 617 $('.cmsms_stats.stats_mode_circles').waypoint(function () { 618 var i = 1; 619 620 621 $(this).find('.cmsms_stat').each(function () { 622 var el = $(this); 623 624 625 setTimeout(function () { 626 el.easyPieChart( { 627 size : 180, 628 lineWidth : 4, 629 lineCap : 'square', 630 animate : 1000, 631 scaleColor : false, 632 trackColor : false, 633 barColor : function () { 634 return ($(this.el).data('bar-color')) ? $(this.el).data('bar-color') : '#00e5cd'; 635 }, 636 onStep : function (from, to, val) { 637 $(this.el).find('.cmsms_stat_counter').text(~~val); 638 } 639 } ); 640 }, 500 * i); 641 642 643 i += 1; 644 } ); 645 }, { 646 offset : '100%' 647 } ); 648 } else { 649 $('.cmsms_stats.stats_mode_circles').find('.cmsms_stat').easyPieChart( { 650 size : 180, 651 lineWidth : 4, 652 lineCap : 'square', 653 animate : 1000, 654 scaleColor : false, 655 trackColor : false, 656 barColor : function () { 657 return ($(this.el).data('bar-color')) ? $(this.el).data('bar-color') : '#00e5cd'; 658 }, 659 onStep : function (from, to, val) { 660 $(this.el).find('.cmsms_stat_counter').text(~~val); 661 } 662 } ); 663 } 664 665 666 if ( 667 !checker.os.iphone && 668 !checker.os.ipod && 669 !checker.os.ipad && 670 !checker.os.blackberry && 671 !checker.os.android && 672 !checker.ua.ie9 673 ) { 674 $('.cmsms_counters').waypoint(function () { 675 var i = 1; 676 677 678 $(this).find('.cmsms_counter').each(function () { 679 var el = $(this); 680 681 682 setTimeout(function () { 683 el.easyPieChart( { 684 size : 180, 685 lineWidth : 0, 686 lineCap : 'square', 687 animate : 1500, 688 scaleColor : false, 689 trackColor : false, 690 barColor : '#ffffff', 691 onStep : function (from, to, val) { 692 $(this.el).find('.cmsms_counter_counter').text(~~val); 693 } 694 } ); 695 }, 500 * i); 696 697 698 i += 1; 699 } ); 700 }, { 701 offset : '100%' 702 } ); 703 } else { 704 $('.cmsms_counters').find('.cmsms_counter').easyPieChart( { 705 size : 180, 706 lineWidth : 0, 707 lineCap : 'square', 708 animate : 1500, 709 scaleColor : false, 710 trackColor : false, 711 barColor : '#ffffff', 712 onStep : function (from, to, val) { 713 $(this.el).find('.cmsms_counter_counter').text(~~val); 714 } 715 } ); 716 } 717 718 719 if ( 720 !checker.os.iphone && 721 !checker.os.ipod && 722 !checker.os.ipad && 723 !checker.os.blackberry && 724 !checker.os.android && 725 !checker.ua.ie9 726 ) { 727 $('.cmsms_stats.stats_mode_bars').waypoint(function () { 728 $(this).addClass('shortcode_animated').find('.cmsms_stat').each(function () { 729 var el = $(this); 730 731 732 el.easyPieChart( { 733 size : 180, 734 lineWidth : 0, 735 lineCap : 'square', 736 animate : 1500, 737 scaleColor : false, 738 trackColor : false, 739 barColor : '#ffffff', 740 onStep : function (from, to, val) { 741 $(this.el).find('.cmsms_stat_counter').text(~~val); 742 } 743 } ); 744 } ); 745 }, { 746 offset : '100%' 747 } ); 748 } else { 749 $('.cmsms_stats.stats_mode_bars').addClass('shortcode_animated').find('.cmsms_stat').easyPieChart( { 750 size : 180, 751 lineWidth : 0, 752 lineCap : 'square', 753 animate : 1500, 754 scaleColor : false, 755 trackColor : false, 756 barColor : '#ffffff', 757 onStep : function (from, to, val) { 758 $(this.el).find('.cmsms_stat_counter').text(~~val); 759 } 760 } ); 761 } 762 } )(jQuery); 763 764 765 766 /* Header Search Toggle */ 767 (function ($) { 768 $('#header .header_mid .search_bar_wrap button').on('click', function () {
769 var searchWrap = $(this).parents('.search_wrap'), 770 headerNav = $(this).parents('.header_mid').find('nav'), 771 respNav = $(this).parents('.header_mid').find('.resp_nav_wrap'), 772 searchInput = $(this).parents('.header_mid').find('.search_bar_wrap input[type=search]'), 773 searchButton = $(this).parents('.header_mid').find('.search_bar_wrap button'); 774 775 776 if (searchWrap.hasClass('search_opened')) { 777 searchWrap.removeClass('search_opened'); 778 779 780 searchButton.removeClass('cmsms_search_cancel'); 781 782 783 setTimeout(function () { 784 searchButton.addClass('cmsms_theme_icon_search').attr('type', 'submit'); 785 }, 1000); 786 } else { 787 searchWrap.addClass('search_opened'); 788 789 790 searchButton.removeClass('cmsms_theme_icon_search'); 791 792 793 setTimeout(function () { 794 searchButton.addClass('cmsms_search_cancel').attr('type', 'button'); 795 }, 1000); 796 797 798 searchInput.focus(); 799 } 800 801 802 return false; 803 } ); 804 } )(jQuery); 805 806 807 808 /* Header Top Hide Toggle */ 809 (function ($) { 810 $('.header_top_but').on('click', function () { 811 var headerTopBut = $(this), 812 headerTopButArrow = headerTopBut.find('> span'), 813 headerTopOuter = headerTopBut.parents('.header_top').find('.header_top_outer'); 814 815 if (headerTopBut.hasClass('opened')) { 816 headerTopOuter.slideUp(); 817 818 headerTopButArrow.removeClass('cmsms_theme_icon_slide_top').addClass('cmsms_theme_icon_slide_bottom'); 819 820 headerTopBut.removeClass('opened').addClass('closed'); 821 } else if (headerTopBut.hasClass('closed')) { 822 headerTopOuter.slideDown(); 823 824 headerTopButArrow.removeClass('cmsms_theme_icon_slide_bottom').addClass('cmsms_theme_icon_slide_top'); 825 826 headerTopBut.removeClass('closed').addClass('opened'); 827 } 828 } ); 829 } )(jQuery); 830 831 832 833 /* Fixed Header Function Start */ 834 (function ($) { 835 $('#header').cmsmsFixedHeaderScroll(); 836 } )(jQuery); 837 838 839 840 /* Row Parallax Function Start */ 841 (function ($) { 842 $(window).load(function () { 843 if ( 844 !checker.os.iphone && 845 !checker.os.ipad && 846 !checker.os.ipod && 847 !checker.os.android && 848 !checker.os.blackberry 849 ) { 850 if (checker.ua.safari) { 851 if (checker.ua.chrome || checker.os.mac) { 852 setTimeout(function () { 853 $.stellar( { 854 horizontalScrolling : false, 855 verticalOffset : 30, 856 parallaxElements : false 857 } ); 858 }, 1500); 859 860 861 $(window).on('debouncedresize', function () { 862 if ($(window).width() < 1024) { 863 $.stellar('destroy'); 864 } else { 865 $.stellar( { 866 horizontalScrolling : false, 867 verticalOffset : 30, 868 parallaxElements : false 869 } ); 870 } 871 } ); 872 } 873 } else { 874 setTimeout(function () { 875 $.stellar( { 876 horizontalScrolling : false, 877 verticalOffset : 30, 878 parallaxElements : false 879 } ); 880 }, 1500); 881 882 883 $(window).on('debouncedresize', function () { 884 if ($(window).width() < 1024) { 885 $.stellar('destroy'); 886 } else { 887 $.stellar( { 888 horizontalScrolling : false, 889 verticalOffset : 30, 890 parallaxElements : false 891 } ); 892 } 893 } ); 894 } 895 } else { 896 $('div.cmsms_row').css('background-attachment', 'scroll'); 897 } 898 } ); 899 } )(jQuery); 900 901 902 903 /* One Page Navigation */ 904 (function ($) { 905 function cmsms_get_offset_val() { 906 var cmsms_wpAdminBar = $('#wpadminbar').outerHeight(), 907 cmsms_offset_val = (cmsms_wpAdminBar !== undefined) ? cmsms_wpAdminBar : 0; 908 909 910 if ($('#page').hasClass('fixed_header')) { 911 var header_mid_data_height = $('.header_mid').data('height'), 912 header_mid_height = header_mid_data_height - (header_mid_data_height / 3), 913 914 header_bot_data_height = $('.header_bot').data('height'), 915 header_bot_data_height = (header_bot_data_height !== undefined) ? header_bot_data_height : 0; 916 917 918 cmsms_offset_val = cmsms_offset_val + header_mid_height + header_bot_data_height - 1; 919 } 920 921 922 return cmsms_offset_val; 923 } 924 925 926 var cmsms_window_hash = window.location.hash; 927 928 if ($(cmsms_window_hash).length > 0) { 929 setTimeout(function () { 930 $('html, body').animate( { 931 scrollTop: $(cmsms_window_hash).offset().top - cmsms_get_offset_val() + 1 932 }, 800); 933 }, 800); 934 } 935 936 937 $('body').scrollspy({target: '#navigation'}); 938 939 940 $('#navigation a').on('click', function(event) { 941 if (this.hash !== "") { 942 event.preventDefault(); 943 944 945 var hash = this.hash, 946 linkHref = $(this).attr('href'); 947 948 949 if ($(hash).length > 0) { 950 $('html, body').animate( {
951 scrollTop: $(hash).offset().top - cmsms_get_offset_val() + 1 952 }, 800, function() { 953 if (history.pushState) { 954 history.pushState(null, null, hash); 955 } 956 } ); 957 } else if (!$('body').hasClass('cmsms_custom_page_menu')) { 958 if ( 959 linkHref.indexOf(hash) !== -1 && 960 linkHref.slice(0, linkHref.indexOf(hash)) !== cmsms_script.site_url && 961 linkHref !== hash 962 ) { 963 window.location.href = linkHref; 964 } else { 965 window.location.href = cmsms_script.site_url + hash; 966 } 967 } 968 } 969 } ); 970 } )(jQuery); 971 972 973 974 /* Notise Close Button */ 975 (function ($) { 976 $('.cmsms_notice a.notice_close').on('click', function () { 977 $(this).parents('.cmsms_notice').fadeOut(500, function () { 978 $(this).remove(); 979 } ); 980 981 982 return false; 983 } ); 984 } )(jQuery); 985 986 987 988 /* Toggles */ 989 (function ($) { 990 $('.cmsms_toggles .cmsms_toggle_title a').on('click', function (i) { 991 var active_toggle = $(this).parents('.cmsms_toggles').find('.cmsms_toggle_wrap.current_toggle .cmsms_toggle'), 992 toggle = $(this).parents('.cmsms_toggle_wrap'), 993 acc = ($(this).parents('.cmsms_toggles').hasClass('toggles_mode_accordion')) ? true : false, 994 dropDown = toggle.find('.cmsms_toggle'); 995 996 997 if (toggle.hasClass('current_toggle')) { 998 dropDown.slideUp('fast', function () { 999 toggle.removeClass('current_toggle'); 1000 } ); 1001 } else { 1002 if (acc) { 1003 active_toggle.slideUp('fast', function () { 1004 active_toggle.parents('.cmsms_toggle_wrap').removeClass('current_toggle'); 1005 } ); 1006 } 1007 1008 dropDown.slideDown('fast', function () { 1009 toggle.addClass('current_toggle'); 1010 } ); 1011 } 1012 1013 1014 i.preventDefault(); 1015 } ); 1016 1017 1018 $('.cmsms_toggles .cmsms_toggles_filter a').on('click', function (i) { 1019 var filter_wrap = $(this).parents('.cmsms_toggles_filter'), 1020 filter = $(this).data('key'), 1021 toggle = $(this).parents('.cmsms_toggles').find('.cmsms_toggle_wrap'); 1022 1023 1024 if ($(this).is(':not(.current_filter)')) { 1025 filter_wrap.find('a').removeClass('current_filter'); 1026 1027 1028 $(this).addClass('current_filter'); 1029 1030 1031 toggle.filter('[data-tags~="' + filter + '"]').slideDown('fast'); 1032 1033 1034 toggle.filter(':not([data-tags~="' + filter + '"])').slideUp('fast'); 1035 1036 1037 toggle.filter(':not([data-tags~="' + filter + '"])').removeClass('current_toggle').find('.cmsms_toggle').removeAttr('style'); 1038 } 1039 1040 1041 i.preventDefault(); 1042 1043 setTimeout(function () { 1044 jQuery('body').trigger('debouncedresize'); 1045 }, 300); 1046 } ); 1047 } )(jQuery); 1048 1049 1050 1051 /* Tabs */ 1052 (function ($) { 1053 $('.cmsms_tabs ul.cmsms_tabs_list li a').on('click', function (t) { 1054 var tabs_parent = $(this).parents('.cmsms_tabs'), 1055 tabs = tabs_parent.find('.cmsms_tabs_wrap'), 1056 index = $(this).parents('li').index(); 1057 1058 1059 tabs_parent.find('.cmsms_tabs_list > .current_tab').removeClass('current_tab'); 1060 1061 1062 $(this).parents('li').addClass('current_tab'); 1063 1064 1065 tabs.find('.cmsms_tab').not(':eq(' + index + ')').slideUp('fast', function () { 1066 $(this).removeClass('active_tab'); 1067 } ); 1068 1069 1070 tabs.find('.cmsms_tab:eq(' + index + ')').slideDown('fast', function () { 1071 $(this).addClass('active_tab'); 1072 } ); 1073 1074 1075 t.preventDefault(); 1076 1077 setTimeout(function () { 1078 jQuery('body').trigger('debouncedresize'); 1079 }, 300); 1080 } ); 1081 } )(jQuery); 1082 1083 1084 1085 /* Share Buttons */ 1086 (function ($) { 1087 $('.share_posts a, .share_wrap a:not(.cmsms_pinterest_button)').bind('click', function (e) { 1088 var screenSize = { 1089 width : screen.width, 1090 height : screen.height 1091 }, 1092 windowWidth = 650, 1093 windowHeight = 350, 1094 windowTop = (screenSize.height / 2) - (windowHeight / 2), 1095 windowLeft = (screenSize.width / 2) - (windowWidth / 2), 1096 socialHref = $(this).attr('href'), 1097 newWindow = 'width = ' + windowWidth + ', height = ' + windowHeight + ', top = ' + windowTop + ', left = ' + windowLeft + ', resizable = no, status = no, titlebar = no, toolbar = no, location = no'; 1098 1099 1100 e.preventDefault(); 1101 1102 1103 return window.open(socialHref, '_blank', newWindow); 1104 } ); 1105 } )(jQuery); 1106 1107 1108 1109 /* YouTube Iframe Fix */ 1110 (function ($) { 1111 var iframe = $('iframe[src*="youtube.com"]'); 1112 1113 1114 iframe.each(function () { 1115 var current = $(this), 1116 src = current.attr('src'); 1117 1118 1119 if (src) { 1120 if (src.indexOf('?') !== -1) { 1121 src += "&wmode=opaque"; 1122 } else { 1123 src += "?wmode=opaque"; 1124 } 1125 1126 1127 current.attr('src', src); 1128 } 1129 } ); 1130 } )(jQuery); 1131 1132 1133 /* View Button */ 1134 function cmsmsView() { 1135 var viewButton = jQuery('.cmsmsView'); 1136 1137 if (viewButton.hasClass('no_active')) { 1138 var postID = viewButton.attr('id').replace(/cmsmsView-/g, ''), 1139 data = { 1140 action : 'cmsms_ajax_view', 1141 id : postID, 1142 nonce : cmsms_script.nonce_ajax_view 1143 }; 1144 1145 1146 if (postID !== '') { 1147 viewButton.find('> span').text('...'); 1148 1149 1150 jQuery.post(cmsms_script.ajaxurl, data, function(response) { 1151 viewButton.find('> span').text(response); 1152 1153 1154 viewButton.removeClass('no_active'); 1155 1156 viewButton.addClass('active'); 1157 } ); 1158 } 1159 } 1160 1161 1162 return false; 1163 } 1164 1165 cmsmsView(); 1166} ); 1167 1168 1169 1170jQuery(document).ready(function() { 1171 (function ($) { 1172 $('.cmsms_profile.horizontal .pl_content_wrap').on('click', function() { 1173 $('*:not(this)').removeClass('cmsms_mobile_hover'); 1174 1175 1176 $(this).addClass('cmsms_mobile_hover'); 1177 } ); 1178 } )(jQuery); 1179} ); 1180 1181 1182 1183/* Like Button */ 1184function cmsmsLike(postID) { 1185 "use strict"; 1186 1187 if (postID !== '') { 1188 var likeButton = jQuery('#cmsmsLike-' + postID), 1189 data = { 1190 action : 'cmsms_ajax_like', 1191 id : postID, 1192 nonce : cmsms_script.nonce_ajax_like 1193 }; 1194 1195 1196 likeButton.find('> span').text('...'); 1197 1198 1199 jQuery.post(cmsms_script.ajaxurl, data, function(response) { 1200 likeButton.find('> span').text(response); 1201 1202 1203 likeButton.addClass('active'); 1204 1205 1206 likeButton.attr( { 1207 onclick : 'return false;' 1208 } ); 1209 } ); 1210 } 1211 1212 1213 return false; 1214} 1215 1216 1217"use strict"; 1218 1219/* Correct OS & Browser Check */ 1220var ua = navigator.userAgent, 1221 checker = { 1222 os : { 1223 iphone : ua.match(/iPhone/), 1224 ipod : ua.match(/iPod/), 1225 ipad : ua.match(/iPad/), 1226 blackberry : ua.match(/BlackBerry/), 1227 android : ua.match(/(Android|Linux armv6l|Linux armv7l)/), 1228 linux : ua.match(/Linux/), 1229 win : ua.match(/Windows/), 1230 mac : ua.match(/Macintosh/) 1231 }, 1232 ua : { 1233 ie : ua.match(/MSIE/), 1234 ie6 : ua.match(/MSIE 6.0/), 1235 ie7 : ua.match(/MSIE 7.0/), 1236 ie8 : ua.match(/MSIE 8.0/), 1237 ie9 : ua.match(/MSIE 9.0/), 1238 ie10 : ua.match(/MSIE 10.0/), 1239 ie11 : ua.match(/MSIE 11.0/), 1240 opera : ua.match(/Opera/), 1241 firefox : ua.match(/Firefox/), 1242 chrome : ua.match(/Chrome/), 1243 safari : ua.match(/(Safari|BlackBerry)/) 1244 } 1245 }; 1246 1247 1248 1249/* Correct Image Load Check */ 1250function isImageOk(img) { 1251 "use strict"; 1252 1253 if (!img.complete) { 1254 return false; 1255 } 1256 1257
1258 if (typeof img.naturalWidth !== undefined && img.naturalWidth === 0) { 1259 return 'stop'; 1260 } 1261 1262 1263 return true; 1264} 1265 1266 1267 1268/* Check Whether the Numbers are Approximately Equal */ 1269function checkN(a, b, x) { 1270 "use strict"; 1271 1272 if ((a > b && a - x <= b) || (b > a && b - x <= a)){ 1273 return true; 1274 } else { 1275 return false; 1276 } 1277} 1278 1279 1280/* Run Pinterest Widget */ 1281if (jQuery('.cmsms_pinterest_button').length > 0) { 1282 (function() { 1283 window.PinIt = window.PinIt || { loaded:false }; 1284 1285 if (window.PinIt.loaded) { 1286 return; 1287 } 1288 1289 window.PinIt.loaded = true; 1290 1291 function async_load(){ 1292 var s = document.createElement("script"); 1293 s.type = "text/javascript"; 1294 s.async = true; 1295 s.src = "//assets.pinterest.com/js/pinit.js"; 1296 1297 var x = document.getElementsByTagName("script")[0]; 1298 1299 1300 x.parentNode.insertBefore(s, x); 1301 } 1302 1303 if (window.attachEvent) { 1304 window.attachEvent("onload", async_load); 1305 } else { 1306 window.addEventListener("load", async_load, false); 1307 } 1308 })(); 1309} 1310 1311 1312/* Uniq ID */ 1313function uniqID() { 1314 "use strict"; 1315 1316 return Math.round(new Date().getTime() + (Math.random() * 1000000)); 1317} 1318
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.