1/** 2 * @package YJSG Framework 3 * @copyright Copyright(C) since 2007 Youjoomla.com. All Rights Reserved. 4 * @author YouJoomla 5 * @license http://www.gnu.org/licenses/gpl-2.0.html GNU/GPLv2 only 6 * @websites http://www.youjoomla.com | http://www.yjsimplegrid.com 7 */ 8;window.onerror = function(msg, url, line, col, error) { 9 var extra = !col ? '' : '\ncolumn: ' + col; 10 extra += !error ? '' : '\nerror: ' + error; 11 url +=':'+line; 12 console.log("Error: " + msg + "\nurl: " + url + "\nline: " + line + extra); 13 14 var html = document.documentElement; 15 16 if (html.classList.contains('yjsg-preloader-active')) { 17 html.classList.remove('yjsg-preloader-active'); 18 } 19 20}; 21(function($, window, document, undefined) { 22 23 "use strict"; 24 25 var pluginName = "YjsgSite", 26 defaults = { 27 bsversion: "", 28 yversion: "", 29 menuanimation: '', 30 compileme: '', 31 menuanimationspeed: 300 32 }; 33 34 function Plugin(element, options) { 35 this.element = element; 36 37 this.settings = $.extend({}, defaults, options); 38 this._defaults = defaults; 39 this._name = pluginName; 40 this.init(); 41 } 42 43 44 $.extend(Plugin.prototype, { 45 init: function() { 46 47 var self = this; 48 49 this.bsversion = bootstrapv; 50 this.yversion = yver; 51 this.yjsglegacy = yjsglegacy; 52 this.yjsgrtl = yjsgrtl; 53 this.compileme = compileme; 54 this.haspreloader = $('.yjsg-preloader').length > 0 ? true : false; 55 56 if (typeof menuanimation != 'undefined') { 57 58 this.menuanimation = menuanimation; 59 60 } else { 61 62 this.menuanimation = ''; 63 } 64 65 if (typeof menuanimationspeed != 'undefined') { 66 67 this.menuanimationspeed = menuanimationspeed; 68 69 } else { 70 71 this.menuanimationspeed = self.settings.menuanimationspeed; 72 } 73 74 self.offCanvas(); 75 self.fontResize(); 76 self.yjsgInitAnimations( this.haspreloader ); 77 self.setHeadersize(); 78 self.yjsgScroll(); 79 self.yjsgAccordion(); 80 self.yjsgSimpleTabs(); 81 self.customChrome(); 82 self.ajaxRecompile(); 83 self.siteTypo(); 84 self.conflictsFix(); 85 self.bootstrapJs(); 86 self.ieNotices(); 87 prettyPrint(); 88 89 if (this.yjsglegacy == 0) { 90 self.animateMenus(); 91 } 92 93 window.yjsgCloseModal = function (getElem) { 94 SqueezeBox.close(); 95 }; 96 97 self.yjsgRating(); 98 self.yjsgMedia(); 99 self.yjsgLightbox(); 100 self.yjsgSticky(); 101 102 103 }, 104 105 yjsgInitOnLoad: function (){ 106 107 var self = this; 108 self.yjsgPreloader(); 109 110 }, 111 112 yjsgInitAnimations: function (haspreloader){ 113 114 var self = this; 115 116 // yjsgPreloader will init these 117 if (!haspreloader) { 118 119 YjsgSetTimeout(function (){ 120 self.yjsgAnimations(); 121 },20); 122 } 123 }, 124 125 yjsgPreloader: function() { 126 127 var self = this; 128 129 if (self.haspreloader) { 130 131 var $init_delay = 0; 132 var $delay = $('.yjsg-preloader').attr('data-delay'); 133 var $onclick = $('.yjsg-preloader').attr('data-onclick'); 134 var $delay2 = parseInt($delay) + 1200; 135 136 if(!$('.yjsg-preloader').hasClass('leave-fade')){ 137 $init_delay = 350; 138 } 139 140 YjsgSetTimeout(function() { 141 142 $('html').toggleClass('yjsg-preloader-active'); 143 144 YjsgSetTimeout(function() { 145 146 self.yjsgAnimations(); 147 148 }, $init_delay ); 149 150 }, $delay); 151 152 YjsgSetTimeout(function() { 153 $('.yjsg-preloader').addClass('finished'); 154 }, $delay2); 155 156 } 157 }, 158 159 yjsgSticky: function () { 160 161 var self = this; 162 163 $('.yjsg-sticky').each(function (index, element) { 164 165 var el = $(this), 166 effect = el.data('effect'), 167 hide = el.data('hide'), 168 pushed = el.data('pushed'), 169 offset = el.data('offset'), 170 active = false; 171 172 if (hide == 'yes') { 173 el.addClass('fixed'); 174 } 175 if (pushed > 0) { 176 177 el.css('margin-top', pushed); 178 } 179 180 $(document).on("scroll", function (evt) { 181 182 if ($(window).scrollTop() >= offset) { 183 184 el.addClass('fixed'); 185 186 if (effect == 'slide') { 187 el.slideDown(400); 188 } 189 if (effect == 'fade') { 190 el.fadeIn(400); 191 } 192 193 active = true; 194 195 } else if (active) { 196 197 if (effect == 'slide') {
198 el.stop(true).slideUp(300, function (e) { 199 200 el.removeClass('fixed'); 201 if (hide == 'no') { 202 el.removeAttr('style'); 203 } 204 }); 205 } 206 if (effect == 'fade') { 207 208 el.stop(true).fadeOut(300, function (e) { 209 210 el.removeClass('fixed'); 211 212 if (hide == 'no') { 213 el.removeAttr('style'); 214 } 215 216 }); 217 } 218 219 active = false; 220 221 } 222 223 }); 224 225 }); 226 227 228 var lastScrollId, 229 stickyMenu = $("[data-sticky-menu]"), 230 topMenuHeight = stickyMenu.outerHeight() * 2, 231 stickyItems = stickyMenu.find("a.yjscroll"), 232 scrollItems = stickyItems.map(function(){ 233 var yjscroll = $($(this).attr("href")); 234 if (yjscroll.length) { return yjscroll; } 235 }); 236 $(window).scroll(function(){ 237 var fromTop = $(this).scrollTop() + topMenuHeight * 2 ; 238 239 var cur = scrollItems.map(function(){ 240 if ($(this).offset().top < fromTop) 241 return this; 242 }); 243 cur = cur[cur.length-1]; 244 var id = cur && cur.length ? cur[0].id : ""; 245 246 if (lastScrollId !== id && id !="") { 247 lastScrollId = id; 248 stickyItems.removeClass("active-scroll"); 249 $("[href=#"+id+"]").addClass("active-scroll"); 250 } 251 }); 252 253 254 }, 255 256 yjsgLightbox: function () { 257 258 var self = this; 259 260 if (typeof ($.fn.magnificPopup) == 'undefined') return; 261 262 if(typeof lgtr != 'undefined'){ 263 $.extend(true, $.magnificPopup.defaults, { 264 tClose: lgtr.magnificpopup_close, 265 tLoading: lgtr.magnificpopup_loading, 266 gallery: { 267 tPrev: lgtr.magnificpopup_prev, 268 tNext: lgtr.magnificpopup_next, 269 tCounter: lgtr.magnificpopup_counter 270 }, 271 image: { tError: lgtr.magnificpopup_errorimage }, 272 ajax: { tError: lgtr.magnificpopup_errorajax } 273 }); 274 } 275 276 $('.yjsg-lightbox-gallery').each(function () { 277 $(this).find('a').magnificPopup({ 278 type: 'image', 279 mainClass: 'mfp-with-zoom', 280 zoom: { 281 enabled: true, 282 duration: 300, 283 easing: 'ease-in-out', 284 opener: function (openerElement) { 285 return openerElement.is('img') ? openerElement : openerElement.find('img'); 286 } 287 }, 288 gallery: { 289 enabled: true 290 } 291 }); 292 }); 293 294 $("*[class*='yjsg-lightbox-items']").magnificPopup({ 295 type: 'image', 296 mainClass: 'mfp-with-zoom', 297 zoom: { 298 enabled: true, 299 duration: 300, 300 easing: 'ease-in-out', 301 opener: function (openerElement) { 302 return openerElement.is('img') ? openerElement : openerElement.find('img'); 303 } 304 }, 305 gallery: { 306 enabled: true 307 } 308 }); 309 310 $('.yjsg-lightbox').magnificPopup({ 311 type: 'image', 312 closeOnContentClick: true, 313 closeBtnInside: false, 314 fixedContentPos: true, 315 mainClass: 'mfp-no-margins mfp-with-zoom', 316 image: { 317 verticalFit: true 318 }, 319 zoom: { 320 enabled: true, 321 duration: 300 322 } 323 }); 324 325 $('.yjsg-link-lightbox').magnificPopup({ 326 type: 'image', 327 mainClass: 'mfp-fade' 328 }); 329 330 331 $('.yjsg-link-lightbox-gallery').magnificPopup({ 332 type: 'image', 333 mainClass: 'mfp-fade', 334 gallery: { 335 enabled: true 336 } 337 }); 338 339 340 $('.yjsg-iframe-lightbox').magnificPopup({ 341 type: 'iframe', 342 mainClass: 'mfp-fade', 343 iframe: self.yjsgMagnificIframeExtend(), 344 }); 345 346 347 }, 348 349 yjsgMagnificIframeExtend: function ($counter){ 350 351 var self = this; 352 var $start = 0; 353 354 var $markup ='<div class="mfp-iframe-scaler">'; 355 $markup +='<div class="mfp-close"></div>'; 356 $markup +='<iframe class="mfp-iframe" frameborder="0" allow="accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe>'; 357 $markup +='</div>'; 358 $markup +='<div class="mfp-bottom-bar">'; 359 $markup +='<div class="mfp-title"></div>'; 360 361 if( $counter ){ 362 $markup +='<div class="mfp-counter"></div>'; 363 } 364 365 $markup +='</div>'; 366 367 var $iframe = { 368 markup: $markup , 369 patterns: { 370 youtube: { 371 index: 'youtu', 372 id: function(url) { 373 374 var m = url.match( /^.*(?:youtu.be\/|v\/|e\/|u\/\w+\/|embed\/|v=)([^#\&\?]*).*/ ); 375 if ( !m || !m[1] ) return null; 376 377 if(url.indexOf('t=') != - 1){ 378 379 var $split = url.split('t='); 380 var hms = $split[1].replace('h',':').replace('m',':').replace('s',''); 381 var a = hms.split(':'); 382 383 if (a.length == 1){ 384 385 $start = a[0]; 386 387 } else if (a.length == 2){ 388 389 $start = (+a[0]) * 60 + (+a[1]); 390 391 } else if (a.length == 3){ 392 393 $start = (+a[0]) * 60 * 60 + (+a[1]) * 60 + (+a[2]); 394 395 } 396 } 397 398 var suffix = '?autoplay=1'; 399 400 if( $start > 0 ){ 401 402 suffix = '?start=' + $start + '&autoplay=1'; 403 } 404 405 return m[1] + suffix; 406 }, 407 src: 'https://www.youtube.com/embed/%id%' 408 }, 409 vimeo: { 410 index: 'vimeo.com/', 411 id: function(url) { 412 var m = url.match(/(https?:\/\/)?(www.)?(player.)?vimeo.com\/([a-z]*\/)*([0-9]{6,11})[?]?.*/); 413 if ( !m || !m[5] ) return null; 414 415 var suffix; 416 if(url.indexOf('#t=') != - 1){ 417 var $split = url.split('#t='); 418 suffix = '#t='+$split[1].replace('?api=1&autoplay=1',''); 419 } 420 421 var id = m[5] + '?autoplay=1'+ suffix; 422 return id; 423 }, 424 src: 'https://player.vimeo.com/video/%id%' 425 } 426 } 427 }; 428 429 return $iframe; 430 431 }, 432 433 yjsgMedia: function () { 434 435 var self = this; 436 if (typeof mejs != 'undefined') { 437 $('.yjsg-media').mediaelementplayer(); 438 } 439 440 }, 441 442 yjsgRating: function () { 443 444 var self = this; 445 446 $('.view-article .yjsg-rate').on('click', function (event) { 447 event.preventDefault(); 448 var datarating = $(this).data('rating'); 449 $('.yjsg-user-rating').val(datarating); 450 $('.yjsg-rating-form').submit(); 451 452 }); 453 454 }, 455 456 offCanvas: function () { 457 458 var self = this; 459 var openPoz; 460 var openMargin; 461 var closePoz; 462 var closeMargin; 463 var startCss; 464 465 $('.yjsg-offc-btn').on('click', function (e) { 466 467 e.preventDefault(); 468 469 var trigger = $(this), 470 width = trigger.data('width'),
471 overlay = trigger.data('yjsg-canvas'), 472 canvas = $(overlay).find('.yjsg-off_canvas_in'), 473 poz = trigger.data('position'); 474 475 startCss = { 476 width: width, 477 left: -width, 478 right: 'auto' 479 }; 480 481 openPoz = { 482 left: 0 483 }; 484 openMargin = { 485 marginLeft: width 486 }; 487 closePoz = { 488 left: -width 489 }; 490 closeMargin = { 491 marginLeft: 0 492 }; 493 494 if (poz == 'right') { 495 startCss = { 496 width: width, 497 right: -width, 498 left: 'auto' 499 }; 500 openPoz = { 501 right: 0 502 }; 503 openMargin = { 504 marginLeft: -width 505 }; 506 closePoz = { 507 right: -width 508 }; 509 closeMargin = { 510 marginLeft: 0 511 }; 512 513 } 514 515 if (self.yjsgrtl == 1) { 516 517 startCss = { 518 width: width, 519 right: -width, 520 left: 'auto' 521 }; 522 openPoz = { 523 right: 0 524 }; 525 openMargin = { 526 marginRight: width 527 }; 528 closePoz = { 529 right: -width 530 }; 531 closeMargin = { 532 marginRight: 0 533 }; 534 535 } 536 537 if (self.yjsgrtl == 1 && poz == 'right') { 538 539 startCss = { 540 width: width, 541 left: -width, 542 right: 'auto' 543 }; 544 openPoz = { 545 left: 0 546 }; 547 openMargin = { 548 marginRight: -width 549 }; 550 closePoz = { 551 left: -width 552 }; 553 closeMargin = { 554 marginRight: 0 555 }; 556 557 } 558 559 $(canvas).css(startCss).addClass('canvas_active').animate(openPoz, 400); 560 561 $(overlay).addClass('canvas_active').animate({ 562 backgroundColor: "rgba(0, 0, 0, 0.3)" 563 }, 400); 564 565 $('html').addClass('canvas_on').stop().animate(openMargin, 400); 566 e.stopImmediatePropagation(); 567 568 }); 569 570 $('body').on("click touchstart", ".closeCanvas,.yjsg-off_canvas", function (e) { 571 572 var target = $(e.target); 573 574 if (target.parents('.yjsg-off_canvas_in').length != 0 && !target.parents().hasClass('closeCanvas') || target.hasClass('yjsg-off_canvas_in')) return; 575 576 $('.yjsg-off_canvas').animate({ 577 backgroundColor: "rgba(0, 0, 0, 0)" 578 }, 400); 579 580 $('.yjsg-off_canvas_in').stop().animate(closePoz, 400, function () { 581 $(this).removeClass('canvas_active'); 582 $('.yjsg-off_canvas').removeClass('canvas_active'); 583 }); 584 $('html.canvas_on').stop().animate(closeMargin, 400, function () { 585 $(this).removeClass('canvas_on'); 586 }); 587 588 e.stopImmediatePropagation(); 589 }); 590 591 }, 592 593 ieNotices: function () { 594 595 var self = this; 596 597 if ($.cookie('ieNotice')) return; 598 $('#ie6Warning').css({ 599 'display': 'block', 600 'opacity': 0 601 }).animate({ 602 'top': 0, 603 'opacity': 1 604 }, 800); 605 606 $('#closeIe6Alert').on('click', function (event) { 607 event.preventDefault(); 608 $('#ie6Warning').animate({ 609 'display': 'none', 610 'top': -200, 611 'opacity': 0 612 }, 800); 613 $.cookie('ieNotice', true); 614 615 }); 616 617 }, 618 619 bootstrapJs: function () { 620 621 var self = this; 622 623 if (self.bsversion == 'bootstrapoff') { 624 return false; 625 } 626 if (self.bsversion == 'bootstrap2') { 627 $('.hasTip').each(function () { 628 var gettitle = $(this).attr("title"); 629 if (gettitle) { 630 $(this).removeClass('hasTip'); 631 $(this).addClass('addtips'); 632 $(this).attr('rel', 'tooltip'); 633 $(this).attr('data-placement', 'left'); 634 var parts = gettitle.split('::', 2); 635 $(this).attr("title", parts[0] + '<br />' + parts[1]); 636 } 637 }); 638 $('.addtips').tooltip({ 639 container: 'body' 640 }); 641 } 642 643 if (self.bsversion == 'bootstrap3') { 644 $('.hasTip').each(function () { 645 var gettitle = $(this).attr("title"); 646 if (gettitle) { 647 $(this).removeClass('hasTip'); 648 $(this).addClass('addtips'); 649 $(this).attr('data-placement', 'left'); 650 var parts = gettitle.split('::', 2); 651 $(this).attr("data-original-title", parts[1]); 652 $(this).attr('title', ''); 653 } 654 }); 655 $('.addtips').tooltip({ 656 container: 'body' 657 }); 658 } 659 660 }, 661 662
663 animateMenusShow: function (element,animation,animationspeed) { 664 665 var self = this; 666 667 if (element.hasClass("holdsgroup")) { 668 669 return false; 670 } 671 672 if (element.hasClass("level0") && $('.megadropline').length > 0) { 673 674 return false; 675 } 676 677 if (animation == 'fade') { 678 679 element.find('div.nogroup').first().hide().stop(true, true).toggle('fade', animationspeed, function () { 680 681 $(this).show(); 682 683 }); 684 685 } 686 if (animation == 'grow') { 687 688 element.find('div.nogroup > ul').first().addClass('growshown').hide().show('slide', { 689 direction: "up" 690 }, animationspeed, function () { 691 692 $(this).css('display', 'block'); 693 $(this).parent().css('display', 'block'); 694 695 }); 696 697 } 698 699 if (animation == 'revfade') { 700 701 var getTop = element.find('a').first().outerHeight(true); 702 703 if (element.hasClass("level0") || ($('.megadropline').length > 0 && element.hasClass("level1"))) { 704 705 element.find('div.nogroup').first().css({ 706 top: getTop * 2, 707 opacity: 0, 708 display: 'block' 709 710 }).stop(true, true).animate({ 711 'top': getTop, 712 'opacity': 1 713 }, animationspeed, function () { 714 715 $(this).css('display', 'block'); 716 717 }); 718 719 } else { 720 721 element.find('div.nogroup').first().css({ 722 top: getTop, 723 opacity: 0, 724 display: 'block' 725 726 }).stop(true, true).animate({ 727 'top': 0, 728 'opacity': 1 729 }, animationspeed, function () { 730 731 $(this).css('display', 'block'); 732 733 }); 734 735 } 736 737 } 738 }, 739 740 741 742 743 animateMenusHide: function (element,animation,animationspeed) { 744 745 var self = this; 746 747 if (element.hasClass("level0") && $('.megadropline').length > 0) { 748 749 return false; 750 } 751 752 if (animation == 'fade') { 753 754 element.find('div.nogroup').first().stop(true).toggle('fade', animationspeed, function () { 755 756 $(this).removeAttr('style'); 757 758 }); 759 760 } 761 762 if (animation == 'grow') { 763 764 element.find('.growshown').stop(true, true).hide('slide', { 765 direction: "up" 766 }, animationspeed, function () { 767 768 $(this).removeClass('growshown').removeAttr('style'); 769 $(this).parent().removeAttr('style'); 770 771 }); 772 773 } 774 775 if (animation == 'revfade') { 776 777 var getTop = element.find('a').first().outerHeight(true); 778 779 if (element.hasClass("level0") || ($('.megadropline').length > 0 && element.hasClass("level1"))) { 780 781 element.find('div.nogroup').first().stop().animate({ 782 'top': getTop + 20, 783 'opacity': 0 784 }, animationspeed, function () { 785 786 $(this).removeAttr('style'); 787 788 }); 789 790 } else { 791 792 element.find('div.nogroup').first().stop().animate({ 793 'top': getTop, 794 'opacity': 0 795 }, animationspeed, function () { 796 797 $(this).removeAttr('style'); 798 799 }); 800 801 } 802 803 } 804 805 806 807 }, 808 809 810 animateMenus: function () { 811 812 var self = this; 813 814 var animation = this.menuanimation; 815 var animationspeed = this.menuanimationspeed; 816 817 if ($('.activepath ').length == 1) { 818 819 $(".megadropline li.haschild.level0").hover(function () { 820 821 $(".megadropline ul.level1").hide().stop(true, true).toggle('fade', animationspeed, function () { 822 823 $(this).show(); 824 825 }); 826 827 }, function () { 828 829 $(".megadropline ul.level1").first().stop(true).toggle('fade', animationspeed, function () { 830 831 $(this).removeAttr('style'); 832 833 }); 834 }); 835 } 836 837 $("ul.yjsgmenu li.haschild").hover(function(e) { 838 839 self.animateMenusShow($(this),animation,animationspeed); 840 841 }, function(e) { 842 843 self.animateMenusHide($(this),animation,animationspeed); 844 845 }); 846 847 848 849 }, 850 851 fontResize: function () { 852 853 var self = this; 854 855 // font resize 856 var fontCookie = 'yjsg_fs_z' + fontc; 857 var fontMinSize = parseInt(site_f), // min allowed font size 858 fontMaxSize = 24, // max allowed font size 859 fontStep = 2, // step to increase font-size
860 currentFontSize = (parseInt($.cookie(fontCookie)) || parseInt(fontMinSize)), // gets current size, don't mess with this, 861 elements = ['body'], // list here all elements that will be affected. Classes must be selectors like .class 862 cookieDuration = 2; // cookie duration in days 863 864 $.each(elements, function (key, el) { 865 var element = $(el); 866 if (element) { 867 element.css({ 868 'font-size': currentFontSize + 'px' 869 }); 870 } 871 }); 872 $('#fontSizePlus').on('click', function (e) { 873 e.preventDefault(); 874 currentFontSize += fontStep; 875 if (currentFontSize > fontMaxSize) { 876 currentFontSize = fontMaxSize; 877 } 878 $.each(elements, function (key, elId) { 879 var element = $(elId); 880 if (element) { 881 element.animate({ 882 'font-size': currentFontSize + 'px' 883 }); 884 } 885 }); 886 $.cookie(fontCookie, currentFontSize, { 887 expires: cookieDuration, 888 path: '/' 889 }); 890 891 }); 892 $('#fontSizeMinus').on('click', function (e) { 893 e.preventDefault(); 894 currentFontSize -= fontStep; 895 if (currentFontSize < fontMinSize) { 896 currentFontSize = fontMinSize; 897 } 898 899 $.each(elements, function (key, elId) { 900 var element = $(elId); 901 if (element) { 902 element.animate({ 903 'font-size': currentFontSize + 'px' 904 }); 905 } 906 }); 907 $.cookie(fontCookie, currentFontSize, { 908 expires: cookieDuration, 909 path: '/' 910 }); 911 912 }); 913 $('#fontSizeReset').on('click', function (e) { 914 e.preventDefault(); 915 $.each(elements, function (key, elId) { 916 var element = $(elId); 917 if (element) { 918 element.animate({ 919 'font-size': fontMinSize + 'px' 920 }); 921 } 922 }); 923 currentFontSize = fontMinSize; 924 $.cookie(fontCookie, fontMinSize, { 925 expires: cookieDuration, 926 path: '/' 927 }); 928 }); 929 }, 930 931 conflictsFix: function () { 932 933 var self = this; 934 935 if (self.bsversion == 'bootstrap2') { 936 // bootstrap2 carousel slide fix 937 if (typeof jQuery != 'undefined' && typeof MooTools != 'undefined') { 938 Element.implement({ 939 slide: function (how, mode) { 940 return this; 941 } 942 }); 943 } 944 945 // dropdown bubling fix 946 $('a.dropdown-toggle, .dropdown-menu a').on('touchstart', function (e) { 947 e.stopPropagation(); 948 }); 949 } 950 951 952 // mootools bootstrap 3 show/hide/carousel/dropdown fix 953 if ((self.bsversion == 'bootstrap3' || self.bsversion == 'bootstrapoff') && window.MooTools && window.MooTools.More && Element && Element.implement) { 954 $('.collapse, .hasTooltip,.modal,.hasTip,.popover,.addtips,.yjpopover,.noHtmlTip').each(function () { 955 this.show = null; 956 this.hide = null 957 }); 958 $('.dropdown-menu').parent().each(function () { 959 this.show = null; 960 this.hide = null 961 }); 962 $('.carousel').each(function () { 963 this.slide = null; 964 }); 965 } 966 967 // fix tooltip/popover html output 968 969 if (self.bsversion == 'bootstrap3') { 970 971 if (typeof ($.fn.tooltip) != 'undefined') { 972 $.fn.tooltip.Constructor.DEFAULTS.html = true; 973 $.fn.tooltip.Constructor.DEFAULTS.container = 'body'; 974 975 } 976 977 if (typeof ($.fn.popover) != 'undefined') { 978 $.fn.popover.Constructor.DEFAULTS.html = true; 979 $.fn.popover.Constructor.DEFAULTS.container = 'body'; 980 } 981 } 982 983 //empty tooltip in case bs is off 984 if (typeof ($.fn.tooltip) == 'undefined') { 985 $.fn.tooltip = function () {}; 986 } 987 988 }, 989 990 yjsgSimpleTabs: function () { 991 992 var self = this; 993 994 $('.yjsgSimpleTabs ').each(function (index, element) { 995 996 var holder = $(this); 997 holder.find(".yjsgTabContent").hide(); 998 var navi = holder.find('.yjsgShortcodeTabs'); 999 var cont = holder.find('.yjsgShortcodeTabs'); 1000 var navih = navi.height(); 1001 holder.find(".activeContent").fadeIn(); 1002 1003 navi.find('li a').click(function (e) { 1004 e.preventDefault(); 1005 if ($(this).attr("class") == "active") { 1006 return 1007 } else { 1008 holder.find(".yjsgTabContent").hide(); 1009 navi.find("li").attr("class", ""); 1010 $(this).parent().attr("class", "active"); 1011 $($(this).attr('href')).fadeIn(); 1012 var activeh = $($(this).attr('href')).height(); 1013 1014 if (navih < activeh && (holder.hasClass('tabsleft') || holder.hasClass('tabsright'))) { 1015 1016 navi.height(activeh); 1017 1018 } else if (holder.hasClass('tabsleft') || holder.hasClass('tabsright')) { 1019 1020 navi.height(navih); 1021 } 1022 } 1023 }); 1024 1025 navi.find('li.active a').trigger('click'); 1026 1027 }); 1028 1029 }, 1030 1031 yjsgAccordion: function () { 1032 1033 var self = this; 1034 1035 $('.yjsgacc .parent').each(function (el) { 1036 1037 $(this).find('a').first().attr('href', 'javascript:;').addClass('yjsgtoggler'); 1038 1039 }); 1040 $('ul.yjsgacc > li:has(ul)').addClass("inactive_yjsgacc"); 1041 $('ul.yjsgacc > li:has(ul) ul').css('display', 'none'); 1042 1043 $('.yjsgtoggler').click(function () { 1044 1045 var checkElement = $(this).next(); 1046 1047 $('.yjsgacc li').removeClass('active_yjsgacc'); 1048 $(this).closest('li').addClass('active_yjsgacc').removeClass("inactive_yjsgacc"); 1049 1050 if ((checkElement.is('ul')) && (checkElement.is(':visible'))) { 1051 $(this).closest('li').removeClass('active_yjsgacc').addClass('inactive_yjsgacc'); 1052 checkElement.slideUp('normal'); 1053 } 1054 1055 if ((checkElement.is('ul')) && (!checkElement.is(':visible'))) { 1056 1057 if (!$("ul.yjsgacc").hasClass("notoggle")) { 1058 $('ul.yjsgacc ul:visible').slideUp('normal'); 1059 } 1060 checkElement.slideDown('normal'); 1061 } 1062 1063 if (checkElement.is('ul')) { 1064 return false; 1065 } else { 1066 return true; 1067 } 1068 }); 1069 1070 }, 1071 customChrome: function () { 1072 var self = this; 1073 1074 //tabs module chrome 1075 $('.yjsgbootstrap2 a[data-toggle="tab"],.yjsgbootstrap2 a[data-toggle="pill"]').on('shown', function (e) { 1076 1077 var target = $(e.target).attr('href'); 1078 var prevtarget = $(e.relatedTarget).attr('href'); 1079 $(target).css('display', 'none').fadeIn(800); // activated tab 1080 $(prevtarget).fadeOut(800); // previous tab 1081 1082 }); 1083 $('.yjsgbootstrap3 a[data-toggle="tab"],.yjsgbootstrap3 a[data-toggle="pill"]').on('shown.bs.tab', function (e) { 1084 1085 var target = $(e.target).attr('href'); 1086 var prevtarget = $(e.relatedTarget).attr('href'); 1087 $(target).css('display', 'none').fadeIn(800); // activated tab 1088 $(prevtarget).fadeOut(800); // previous tab 1089 1090 }); 1091 1092 //accordions module chrome 1093 $('.yjsgaccChrome').each(function (index, element) { 1094 1095 var holder = $(this); 1096 var opener = $(this).find('.yjsgaccTrigger a'); 1097 var active = $(this).find('.yjsgaccTrigger.active a'); 1098 var content = $(this).find('.yjsgaccContent'); 1099 1100 opener.on('click', function (event) { 1101 1102 event.preventDefault(); 1103 holder.find('.active').removeClass('active'); 1104 content.slideUp('normal'); 1105 1106 if ($(this).parent().next().is(':hidden') == true) { 1107 1108 $(this).parent().addClass('active'); 1109 $(this).parent().next().slideDown('normal'); 1110 } 1111 1112 }); 1113 1114 opener.on('mouseover', function () { 1115 $(this).parent().addClass('hovered'); 1116 }).on('mouseout', function () { 1117 $(this).parent().removeClass('hovered'); 1118 }); 1119 1120 active.trigger('click'); 1121 1122 }); 1123 1124 $('.yjsgtabs_chromeaction,.yjsgaccContent').fitVids(); 1125 1126 }, 1127 siteTypo: function () { 1128 1129 var self = this; 1130 1131 // placeholder 1132 if ($.browser.msie) { 1133 $('.inputbox').placeholder(); 1134 } 1135 1136 // close alerts 1137 $('.yjtb_close').on('click', function (e) { 1138 1139 $(this).parent().animate({ 1140 top: -1000 1141 }, 500, function () { 1142 $(this).hide(); 1143 }); 1144 1145 }); 1146 1147 // image fade 1148 var fadeParent = $('.yjt_fade'); 1149 fadeParent.each(function (el) { 1150 1151 var opacity = $(this).data('yjt_fadeto'); 1152 var speed = $(this).data('yjt_fadespeed'); 1153 1154 $(this).on('mouseenter', function (event) { 1155 1156 $(this).find('img').animate({ 1157 'opacity': opacity 1158 }, speed); 1159 1160 }).on('mouseleave', function (event) { 1161 1162 $(this).find('img').animate({ 1163 'opacity': 1 1164 }, speed); 1165 1166 }); 1167 1168 }); 1169 1170 }, 1171 1172 1173 yjsgScroll: function () { 1174 1175 var self = this; 1176 var before; 1177 var after; 1178 1179 $(".yjscroll").on('click', function (event) { 1180 1181 if($(this.hash).length == 0) return; 1182 1183 event.preventDefault(); 1184 1185 var el = $(this), 1186 before = el.data('before'), 1187 after = el.data('after'), 1188 element =$(this.hash) ; 1189 1190 if(!before){ 1191 before = 0; 1192 } 1193 if(!after){ 1194 after = 0; 1195 } 1196 var goTo = $(this.hash).offset().top - before + after; 1197 $('html, body').stop(true, true).animate({ 1198 scrollTop: goTo 1199 }, 800); 1200 1201 1202 }); 1203 1204 }, 1205 1206 yjsgRunAnimationsEffect: function($element){ 1207 1208 var self = this; 1209 var $effect = $element.data('anim-effect'); 1210 1211 $element.addClass('yjsg-animated ' + $effect); 1212 1213 if($effect == 'yjsg-anim-draw-svg'){ 1214 var $svg = $element.find('svg'); 1215 if($svg.length > 0){ 1216 var $duration = parseInt($element.data('anim-duration')); 1217 var $svg_id = $svg.attr('id'); 1218 new Vivus($svg_id, { 1219 duration: $duration / 10,
1220 pathTimingFunction: Vivus.EASE_OUT, 1221 animTimingFunction: Vivus.LINEAR, 1222 }); 1223 } 1224 1225 } 1226 1227 $element.one('webkitAnimationEnd mozAnimationEnd MSAnimationEnd oanimationend animationend',function(e) { 1228 $element.trigger('yjsg:animation:done').removeClass('yjsg-animated yjsg-animate ' + $effect).addClass('yjsg-animate-done'); 1229 $element.parents('.yjsg-animate-parent').addClass('yjsg-animate-parent-done'); 1230 }); 1231 1232 // Ken Burns 1233 if( $element.data('anim-kbe') ){ 1234 1235 $element 1236 .removeClass( 'yjsg-anim-kenburns-'+ $element.data('anim-kbe') ) 1237 .css({ 1238 'animation-duration' : '', 1239 '-webkit-animation-duration' : '', 1240 '-moz-animation-duration' : '', 1241 '-o-animation-duration' : '' 1242 }) 1243 .on('yjsg:animation:done',function(){ 1244 1245 $element.css({ 1246 'animation-duration' : parseFloat($element.data('anim-kbd')) + 's', 1247 '-webkit-animation-duration' : parseFloat($element.data('anim-kbd')) + 's', 1248 '-moz-animation-duration' : parseFloat($element.data('anim-kbd')) + 's', 1249 '-o-animation-duration' : parseFloat($element.data('anim-kbd')) + 's' 1250 }).addClass( 'yjsg-anim-kenburns-'+ $element.data('anim-kbe') ); 1251 1252 $element.one('webkitAnimationEnd mozAnimationEnd MSAnimationEnd oanimationend animationend',function(e) { 1253 $element.trigger('yjsg:kb:done').css({ 1254 'animation-duration' : '', 1255 '-webkit-animation-duration' : '', 1256 '-moz-animation-duration' : '', 1257 '-o-animation-duration' : '' 1258 }); 1259 }); 1260 //} 1261 }); 1262 1263 } 1264 }, 1265 1266 1267 yjsgAnimations: function(elements) { 1268 1269 var self = this; 1270 1271 var animate = '.yjsg-animate'; 1272 1273 if (elements) { 1274 1275 animate = elements; 1276 } 1277 1278 var $hasindexed = 0; 1279 1280 $(animate).each(function(index, element) { 1281 1282 var $this = $(this), 1283 $index = index + 1, 1284 $horiz = false; 1285 1286 $this.waypoint(function() { 1287 var $element = $(this), 1288 $elindex = $index, 1289 $delay = parseInt($element.data('anim-delay')); 1290 1291 if (isNaN($delay)) { 1292 $delay = 100; 1293 } 1294 1295 $elindex -= $hasindexed; 1296 1297 if ($elindex == 0 && !$element.parents('.yjsg-animate-parent').length == 0) { 1298 $elindex = 1; 1299 } 1300 1301 if($element.parents('.yjsg-items-grid').length == 0 && $element.parents('.yjsg-anim-auto-delay').length == 0) { 1302 1303 $elindex = 1; 1304 } 1305 1306 YjsgSetTimeout(function() { 1307 1308 self.yjsgRunAnimationsEffect( $element ); 1309 1310 $hasindexed = $index; 1311 1312 }, $elindex * $delay); 1313 }, { 1314 triggerOnce: true, 1315 offset: '99%' 1316 }); 1317 1318 }); 1319 1320 }, 1321 1322 roundNumber: function (num, dec) { 1323 1324 var self = this;
1325 var result = Math.round(num * Math.pow(10, dec)) / Math.pow(10, dec); 1326 return result; 1327 1328 }, 1329 1330 setHeadersize: function () { 1331 1332 var self = this; 1333 1334 if (self.yjsglegacy == 0) { 1335 return; 1336 } 1337 1338 var logo_out = self.roundNumber(logo_w / $('#header').width() * 100, 2); 1339 var grid_w = self.roundNumber(100 - logo_out, 2); 1340 if (typeof site_w_is_per != 'undefined') { 1341 1342 $('#logo').css('width', logo_out + '%'); 1343 $('#yjsgheadergrid').css('width', grid_w + '%'); 1344 1345 } 1346 1347 }, 1348 1349 ajaxRecompile: function () { 1350 1351 var self = this; 1352 if (self.compileme == 0 || self.compileme == 3 || self.compileme == 'undefined') return; 1353 1354 var currentLink = location.href; 1355 var foundhash = currentLink.match(/#/g); 1356 var hashpart = ''; 1357 1358 // in case of hash we need to change the currentLink 1359 if (foundhash) { 1360 1361 var splitLink = currentLink.split('#'); 1362 currentLink = splitLink[0]; 1363 1364 } 1365 1366 var sitepath = currentLink.indexOf("?") == -1 ? currentLink + '?recompile=1' : currentLink + '&recompile=1'; 1367 1368 $.ajax({
1369 type: "get", 1370 url: sitepath, 1371 cache: false, 1372 success: function (data, status, xhr) { 1373 location.reload(true); 1374 }, 1375 error: function (data) { 1376 1377 var msg = data.responseText; 1378 if (data.status === 503) { //Site is offline css is recompiled 1379 location.reload(true); 1380 return; 1381 } 1382 1383 var sysmsg = '<div class="yjtbox yjtb_red lineup">'; 1384 sysmsg += '<span class="yjtb_close"></span>'; 1385 sysmsg += '<span class="yjtboxicon fa fa-warning"></span>'; 1386 sysmsg += '<h4 class="yjtboxtitle">Compiler error:</h4>'; 1387 sysmsg += msg; 1388 sysmsg += '</div>'; 1389 1390 $('.yjsg-system-msg').html(sysmsg); 1391 1392 $('<div/>', { 1393 id: 'compilerMsg', 1394 html: msg 1395 }).appendTo('body'); 1396 1397 } 1398 }); 1399 1400 } 1401 1402 1403 1404 1405 }); 1406 1407 $.fn[pluginName] = function(options) { 1408 return this.each(function() { 1409 if (!$.data(this, 'plugin_' + pluginName)) { 1410 $.data(this, 'plugin_' + pluginName, new Plugin(this, options)); 1411 } else if (Plugin.prototype[options]) { 1412 $.data(this, 'plugin_' + pluginName)[options](); 1413 } 1414 }); 1415 } 1416 1417})(jQuery, window, document); // JavaScript Document 1418 1419(function($) { 1420 1421 $(document).on('ready', function(){ 1422 $(document).YjsgSite(); 1423 }); 1424 1425 $(window).on('load',function() { 1426 $(document).YjsgSite('yjsgInitOnLoad'); 1427 1428 $(window).on('resize', function() { 1429 $(document).YjsgSite('setHeadersize'); 1430 }); 1431 }); 1432 1433}(jQuery));
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.