1// window.location.replace("https://xuxin123.com"); 2(function ($) { 3 // To top button 4 $("#back-to-top").on('click', function () { 5 $('body, html').animate({ scrollTop: 0 }, 600); 6 }); 7 8 // Nav bar toggle 9 $('#main-nav-toggle').on('click', function () { 10 $('.nav-container-inner').slideToggle(); 11 }); 12 13 // Caption 14 $('.article-entry').each(function(i) { 15 $(this).find('img').each(function() { 16 if (this.alt && !(!!$.prototype.justifiedGallery && $(this).parent('.justified-gallery').length)) { 17 $(this).after('<span class="caption">' + this.alt + '</span>'); 18 } 19 20 // 对äºå·²ç»å å«å¨é¾æ¥å çå¾çä¸éç¨lightGallery 21 if ($(this).parent().prop("tagName") !== 'A') { 22 $(this).wrap('<a href="' + this.src + '" title="' + this.alt + '" class="gallery-item"></a>'); 23 } 24 }); 25 26 }); 27 if (typeof lightGallery != 'undefined') { 28 var options = { 29 selector: '.gallery-item', 30 }; 31 $('.article-entry').each(function(i, entry) { 32 lightGallery(entry, options); 33 }); 34 lightGallery($('.article-gallery')[0], options); 35 } 36 if (!!$.prototype.justifiedGallery) { // if justifiedGallery method is defined 37 var options = { 38 rowHeight: 140, 39 margins: 4, 40 lastRow: 'justify' 41 }; 42 $('.justified-gallery').justifiedGallery(options); 43 } 44 45 // Sidebar expend 46 $('#sidebar .sidebar-toggle').click(function () { 47 if($('#sidebar').hasClass('expend')) { 48 $('#sidebar').removeClass('expend'); 49 } else { 50 $('#sidebar').addClass('expend'); 51 } 52 }); 53 54 55 // Remove extra main nav wrap 56 $('.main-nav-list > li').unwrap(); 57 58 // Highlight current nav item 59 $('#main-nav > li > .main-nav-list-link').each(function () { 60 if($('.page-title-link').length > 0){ 61 if ($(this).html().toUpperCase() == $('.page-title-link').html().toUpperCase()) { 62 $(this).addClass('current'); 63 } else if ($(this).attr('href') == $('.page-title-link').attr('data-url')) { 64 $(this).addClass('current'); 65 } 66 } 67 }); 68 69 // Auto hide main nav menus 70 function autoHideMenus(){ 71 var max_width = $('.nav-container-inner').width() - 10; 72 var main_nav_width = $('#main-nav').width(); 73 var sub_nav_width = $('#sub-nav').width(); 74 if (main_nav_width + sub_nav_width > max_width) { 75 // If more link not exists 76 if ($('.main-nav-more').length == 0) { 77 $(['<li class="main-nav-list-item top-level-menu main-nav-more">', 78 '<a class="main-nav-list-link" href="javascript:;">More</a>', 79 '<ul class="main-nav-list-child">', 80 '</ul></li>'].join('')).appendTo($('#main-nav')); 81 // Bind hover event 82 $('.main-nav-more').hover(function () { 83 if($(window).width() < 480) { 84 return; 85 } 86 $(this).children('.main-nav-list-child').slideDown('fast'); 87 }, function () { 88 if($(window).width() < 480) { 89 return; 90 } 91 $(this).children('.main-nav-list-child').slideUp('fast'); 92 }); 93 } 94 var child_count = $('#main-nav').children().length; 95 for (var i = child_count - 2; i >= 0; i--) { 96 var element = $('#main-nav').children().eq(i); 97 if (main_nav_width + sub_nav_width > max_width) { 98 element.prependTo($('.main-nav-more > ul')); 99 main_nav_width = $('#main-nav').width(); 100 } else { 101 return; 102 } 103 } 104 } 105 // Nav bar is wide enough 106 if ($('.main-nav-more').length > 0) { 107 $('.main-nav-more > ul').children().appendTo($('#main-nav')); 108 $('.main-nav-more').remove(); 109 } 110 } 111 autoHideMenus(); 112 113 $(window).resize(function () { 114 autoHideMenus(); 115 }); 116 117 // Fold second-level menu 118 $('.main-nav-list-item').hover(function () { 119 if ($(window).width() < 480) { 120 return; 121 } 122 $(this).children('.main-nav-list-child').slideDown('fast'); 123 }, function () { 124 if ($(window).width() < 480) { 125 return; 126 }
127 $(this).children('.main-nav-list-child').slideUp('fast'); 128 }); 129 130 // Add second-level menu mark 131 $('.main-nav-list-item').each(function () { 132 if ($(this).find('.main-nav-list-child').length > 0) { 133 $(this).addClass('top-level-menu'); 134 } 135 }); 136})(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.