1/** 2 * @package WordPress 3 * @subpackage Social Activity 4 * @version 1.3.4 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_gallery, .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_gallery ul li, .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 .format-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 $('.blog.columns, .blog.timeline').waypoint(function (dir) { 522 if (dir === 'down') { 523 var el = $(this), 524 items = el.find('article.post'), 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'), 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 $('.blog.columns, .blog.timeline').find('article.post').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_counters.stats_type_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 : 16, 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') : '#ebebeb'; 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_counters.stats_type_circles').find('.cmsms_stat').easyPieChart( { 650 size : 180, 651 lineWidth : 16, 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') : '#ebebeb'; 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_stats.stats_mode_counters.stats_type_numbers').waypoint(function () { 675 var i = 1; 676 677 678 $(this).find('.cmsms_stat').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_stat_counter').text(~~val); 693 } 694 } ); 695 }, 500 * i); 696 697 698 i += 1; 699 } ); 700 }, { 701 offset : '100%' 702 } ); 703 } else { 704 $('.cmsms_stats.stats_mode_counters.stats_type_numbers').find('.cmsms_stat').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_stat_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_but').bind('click', function () {
769 var searchWrap = $(this).parents('.header_mid .search_wrap'), 770 headerNav = $(this).parents('.header_mid').find('nav'), 771 respNav = $(this).parents('.header_mid').find('.resp_nav_wrap'), 772 headerSlogan = $(this).parents('.header_mid').find('.slogan_wrap'), 773 headerSocial = $(this).parents('.header_mid').find('.social_wrap'); 774 775 776 if (searchWrap.hasClass('search_opened')) { 777 searchWrap.removeClass('search_opened'); 778 779 headerNav.removeClass('nav_closed'); 780 781 respNav.removeClass('resp_nav_closed') 782 783 headerSlogan.removeClass('slogan_closed'); 784 785 headerSocial.removeClass('social_closed'); 786 } else { 787 searchWrap.addClass('search_opened'); 788 789 headerNav.addClass('nav_closed'); 790 791 respNav.addClass('resp_nav_closed') 792 793 headerSlogan.addClass('slogan_closed'); 794 795 headerSocial.addClass('social_closed'); 796 } 797 } ); 798 } )(jQuery); 799 800 801 802 /* Header Top Hide Toggle */ 803 (function ($) { 804 $('.header_top_but').on('click', function () { 805 var headerTopBut = $(this), 806 headerTopButArrow = headerTopBut.find('> span'), 807 headerTopOuter = headerTopBut.parents('.header_top').find('.header_top_outer'); 808 809 if (headerTopBut.hasClass('opened')) { 810 headerTopOuter.slideUp(); 811 812 headerTopButArrow.removeClass('cmsms_top_arrow').addClass('cmsms_bot_arrow'); 813 814 headerTopBut.removeClass('opened').addClass('closed'); 815 } else if (headerTopBut.hasClass('closed')) { 816 headerTopOuter.slideDown(); 817 818 headerTopButArrow.removeClass('cmsms_bot_arrow').addClass('cmsms_top_arrow'); 819 820 headerTopBut.removeClass('closed').addClass('opened'); 821 } 822 } ); 823 } )(jQuery); 824 825 826 827 /* Fixed Header Function Start */ 828 (function ($) { 829 $('#header').cmsmsFixedHeaderScroll(); 830 } )(jQuery); 831 832 833 834 /* Row Parallax Function Start */ 835 (function ($) { 836 $(window).on('load', function () { 837 if ( 838 !checker.os.iphone && 839 !checker.os.ipad && 840 !checker.os.ipod && 841 !checker.os.android && 842 !checker.os.blackberry 843 ) { 844 if (checker.ua.safari) { 845 if (checker.ua.chrome || checker.os.mac) { 846 setTimeout(function () { 847 $.stellar( { 848 horizontalScrolling : false, 849 verticalOffset : 30, 850 parallaxElements : false 851 } ); 852 }, 1500); 853 854 855 $(window).on('debouncedresize', function () { 856 if ($(window).width() < 1024) { 857 $.stellar('destroy'); 858 } else { 859 $.stellar( { 860 horizontalScrolling : false, 861 verticalOffset : 30, 862 parallaxElements : false 863 } ); 864 } 865 } ); 866 } 867 } else { 868 setTimeout(function () { 869 $.stellar( { 870 horizontalScrolling : false, 871 verticalOffset : 30, 872 parallaxElements : false 873 } ); 874 }, 1500); 875 876 877 $(window).on('debouncedresize', function () { 878 if ($(window).width() < 1024) { 879 $.stellar('destroy'); 880 } else { 881 $.stellar( { 882 horizontalScrolling : false, 883 verticalOffset : 30, 884 parallaxElements : false 885 } ); 886 } 887 } ); 888 } 889 } else { 890 $('div.cmsms_row').css('background-attachment', 'scroll'); 891 } 892 } ); 893 } )(jQuery); 894 895 896 897 /* One Page Navigation */ 898 (function ($) { 899 function cmsms_get_offset_val() { 900 var cmsms_wpAdminBar = $('#wpadminbar').outerHeight(), 901 cmsms_offset_val = (cmsms_wpAdminBar !== undefined) ? cmsms_wpAdminBar : 0; 902 903 904 if ($('#page').hasClass('fixed_header')) { 905 var header_mid_data_height = $('.header_mid').data('height'), 906 header_mid_height = header_mid_data_height - (header_mid_data_height / 3), 907 header_bot_data_height = $('.header_bot').data('height'), 908 header_bot_data_height = (header_bot_data_height !== undefined) ? header_bot_data_height : 0; 909 910 911 cmsms_offset_val = cmsms_offset_val + header_mid_height + header_bot_data_height - 1; 912 } 913 914 915 return cmsms_offset_val; 916 } 917 918 919 var cmsms_window_hash = window.location.hash; 920 921 if ($(cmsms_window_hash).length > 0) { 922 setTimeout(function () { 923 $('html, body').animate( { 924 scrollTop: $(cmsms_window_hash).offset().top - cmsms_get_offset_val() + 1 925 }, 800); 926 }, 800); 927 } 928 929 930 $('body').scrollspy({target: '#navigation'}); 931 932 933 $('#navigation a').on('click', function(event) { 934 if (this.hash !== "") { 935 event.preventDefault(); 936 937 938 var hash = this.hash, 939 linkHref = $(this).attr('href'); 940 941 942 if ($(hash).length > 0) { 943 $('html, body').animate( {
944 scrollTop: $(hash).offset().top - cmsms_get_offset_val() + 1 945 }, 800, function() { 946 if (history.pushState) { 947 history.pushState(null, null, hash); 948 } 949 } ); 950 } else if (!$('body').hasClass('cmsms_custom_page_menu')) { 951 if ( 952 linkHref.indexOf(hash) !== -1 && 953 linkHref.slice(0, linkHref.indexOf(hash)) !== cmsms_script.site_url && 954 linkHref !== hash 955 ) { 956 window.location.href = linkHref; 957 } else { 958 window.location.href = cmsms_script.site_url + hash; 959 } 960 } 961 } 962 } ); 963 } )(jQuery); 964 965 966 967 /* Notise Close Button */ 968 (function ($) { 969 $('.cmsms_notice a.notice_close').on('click', function () { 970 $(this).parents('.cmsms_notice').fadeOut(500, function () { 971 $(this).remove(); 972 } ); 973 974 975 return false; 976 } ); 977 } )(jQuery); 978 979 980 981 /* Popular, Latest and Related Posts */ 982 (function ($) { 983 $('.related_posts > ul li a').on('click', function (g) { 984 var rposts = $(this).parents('.related_posts'), 985 index = $(this).parents('li').index(); 986 987 988 rposts.find('ul > li > a').removeClass('current'); 989 990 $(this).addClass('current'); 991 992 993 rposts.find('.related_posts_content').find('div.related_posts_content_tab').not('div.related_posts_content_tab:eq(' + index + ')').slideUp(); 994 995 rposts.find('.related_posts_content').find('div.related_posts_content_tab:eq(' + index + ')').slideDown(); 996 997 998 g.preventDefault(); 999 } ); 1000 } )(jQuery); 1001 1002 1003 1004 /* Toggles */ 1005 (function ($) { 1006 $('.cmsms_toggles .cmsms_toggle_title a').on('click', function (i) { 1007 var active_toggle = $(this).parents('.cmsms_toggles').find('.cmsms_toggle_wrap.current_toggle .cmsms_toggle'), 1008 toggle = $(this).parents('.cmsms_toggle_wrap'), 1009 acc = ($(this).parents('.cmsms_toggles').hasClass('toggles_mode_accordion')) ? true : false, 1010 dropDown = toggle.find('.cmsms_toggle'); 1011 1012 1013 if (toggle.hasClass('current_toggle')) { 1014 dropDown.slideUp('fast', function () { 1015 toggle.removeClass('current_toggle'); 1016 } ); 1017 } else { 1018 if (acc) { 1019 active_toggle.slideUp('fast', function () { 1020 active_toggle.parents('.cmsms_toggle_wrap').removeClass('current_toggle'); 1021 } ); 1022 } 1023 1024 dropDown.slideDown('fast', function () { 1025 toggle.addClass('current_toggle'); 1026 } ); 1027 } 1028 1029 1030 i.preventDefault(); 1031 1032 1033 setTimeout(function () { 1034 jQuery('body').trigger('debouncedresize'); 1035 }, 300); 1036 } ); 1037 1038 1039 $('.cmsms_toggles .cmsms_toggles_filter a').on('click', function (i) { 1040 var filter_wrap = $(this).parents('.cmsms_toggles_filter'), 1041 filter = $(this).data('key'), 1042 toggle = $(this).parents('.cmsms_toggles').find('.cmsms_toggle_wrap'); 1043 1044 1045 if ($(this).is(':not(.current_filter)')) { 1046 filter_wrap.find('a').removeClass('current_filter'); 1047 1048 1049 $(this).addClass('current_filter'); 1050 1051 1052 toggle.filter('[data-tags~="' + filter + '"]').slideDown('fast'); 1053 1054 1055 toggle.filter(':not([data-tags~="' + filter + '"])').slideUp('fast'); 1056 1057 1058 toggle.filter(':not([data-tags~="' + filter + '"])').removeClass('current_toggle').find('.cmsms_toggle').removeAttr('style'); 1059 } 1060 1061 1062 i.preventDefault(); 1063 } ); 1064 } )(jQuery); 1065 1066 1067 1068 /* Tabs */ 1069 (function ($) { 1070 $('.cmsms_tabs ul.cmsms_tabs_list li a').on('click', function (t) { 1071 var tabs_parent = $(this).parents('.cmsms_tabs'), 1072 tabs = tabs_parent.find('.cmsms_tabs_wrap'), 1073 index = $(this).parents('li').index(); 1074 1075 1076 tabs_parent.find('.cmsms_tabs_list > .current_tab').removeClass('current_tab'); 1077 1078 1079 $(this).parents('li').addClass('current_tab'); 1080 1081 1082 tabs.find('.cmsms_tab').not(':eq(' + index + ')').slideUp('fast', function () { 1083 $(this).removeClass('active_tab'); 1084 } ); 1085 1086 1087 tabs.find('.cmsms_tab:eq(' + index + ')').slideDown('fast', function () { 1088 $(this).addClass('active_tab'); 1089 } ); 1090 1091 1092 t.preventDefault(); 1093 1094 1095 setTimeout(function () { 1096 jQuery('body').trigger('debouncedresize'); 1097 }, 300); 1098 } ); 1099 } )(jQuery); 1100 1101 1102 1103 /* YouTube Iframe Fix */ 1104 (function ($) { 1105 var iframe = $('iframe[src*="youtube.com"]'); 1106 1107 1108 iframe.each(function () { 1109 var current = $(this), 1110 src = current.attr('src'); 1111 1112 1113 if (src) { 1114 if (src.indexOf('?') !== -1) { 1115 src += "&wmode=opaque"; 1116 } else { 1117 src += "?wmode=opaque"; 1118 } 1119 1120 1121 current.attr('src', src); 1122 } 1123 } ); 1124 } )(jQuery); 1125} ); 1126 1127 1128 1129/* Like Button */ 1130function cmsmsLike(postID) { 1131 "use strict"; 1132 1133 if (postID !== '') { 1134 var likeButton = jQuery('#cmsmsLike-' + postID), 1135 data = { 1136 action : 'cmsms_ajax_like', 1137 id : postID, 1138 nonce : cmsms_script.nonce_ajax_like 1139 }; 1140 1141 1142 likeButton.find('> span').text('...'); 1143
1144 1145 jQuery.post(cmsms_script.ajaxurl, data, function(response) { 1146 likeButton.find('> span').text(response); 1147 1148 1149 likeButton.addClass('active'); 1150 1151 1152 likeButton.attr( { 1153 onclick : 'return false;' 1154 } ); 1155 } ); 1156 } 1157 1158 1159 return false; 1160} 1161 1162 1163"use strict"; 1164 1165/* Correct OS & Browser Check */ 1166var ua = navigator.userAgent, 1167 checker = { 1168 os : { 1169 iphone : ua.match(/iPhone/), 1170 ipod : ua.match(/iPod/), 1171 ipad : ua.match(/iPad/), 1172 blackberry : ua.match(/BlackBerry/), 1173 android : ua.match(/(Android|Linux armv6l|Linux armv7l)/), 1174 linux : ua.match(/Linux/), 1175 win : ua.match(/Windows/), 1176 mac : ua.match(/Macintosh/) 1177 }, 1178 ua : { 1179 ie : ua.match(/MSIE/), 1180 ie6 : ua.match(/MSIE 6.0/), 1181 ie7 : ua.match(/MSIE 7.0/), 1182 ie8 : ua.match(/MSIE 8.0/), 1183 ie9 : ua.match(/MSIE 9.0/), 1184 ie10 : ua.match(/MSIE 10.0/), 1185 ie11 : ua.match(/MSIE 11.0/), 1186 opera : ua.match(/Opera/), 1187 firefox : ua.match(/Firefox/), 1188 chrome : ua.match(/Chrome/), 1189 safari : ua.match(/(Safari|BlackBerry)/) 1190 } 1191 }; 1192 1193 1194 1195/* Correct Image Load Check */ 1196function isImageOk(img) { 1197 "use strict"; 1198 1199 if (!img.complete) { 1200 return false; 1201 } 1202 1203 1204 if (typeof img.naturalWidth !== undefined && img.naturalWidth === 0) { 1205 return 'stop'; 1206 } 1207 1208 1209 return true; 1210} 1211 1212 1213 1214/* Check Whether the Numbers are Approximately Equal */ 1215function checkN(a, b, x) { 1216 "use strict"; 1217 1218 if ((a > b && a - x <= b) || (b > a && b - x <= a)){ 1219 return true; 1220 } else { 1221 return false; 1222 } 1223} 1224 1225 1226 1227/* Uniq ID */ 1228function uniqID() { 1229 "use strict"; 1230 1231 return Math.round(new Date().getTime() + (Math.random() * 1000000)); 1232}
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.