1$(function() { 2 const $body = $('body'); 3 const $darkModeSwitch = $('.switch-dark-mode'); 4 const $goToUp = $('#go-to-up'); 5 const $bigHeaderBanner = $('.big-header-banner'); 6 const $sidebar = $('#sidebar'); 7 const $sidebarNav = $('.sidebar-nav'); 8 const theme = {}; // Add theme object to avoid reference error 9 // 页é¢å è½½æ¶æ£æ¥ localStorage ä¸ç模å¼è®¾ç½® 10 $(document).ready(function() { 11 const darkModeEnabled = localStorage.getItem('darkMode') === 'true'; 12 if (darkModeEnabled) { 13 $body.addClass('io-black-mode'); 14 } 15 switch_mode(); // æ´æ°å¾æ åæé®æç¤º 16 }); 17 18 // è¿åé¡¶é¨ 19 (function(){ 20 var ticking = false; 21 function onScrollFrame(){ 22 var y = window.pageYOffset || document.documentElement.scrollTop || document.body.scrollTop || 0; 23 if (y >= 50) { 24 $goToUp.addClass('is-visible'); 25 $bigHeaderBanner.addClass('header-bg'); 26 } else { 27 $goToUp.removeClass('is-visible'); 28 $bigHeaderBanner.removeClass('header-bg'); 29 } 30 ticking = false; 31 } 32 window.addEventListener('scroll', function(){ 33 if (!ticking) { 34 ticking = true; 35 window.requestAnimationFrame(onScrollFrame); 36 } 37 }, { passive: true }); 38 onScrollFrame(); 39 })(); 40 41 $goToUp.click(function() { 42 window.scrollTo({ top: 0, behavior: 'smooth' }); 43 return false; 44 }); 45 46 // æ»åèå 47 $('.slider_menu').children("ul").children("li").not(".anchor").hover(function() { 48 $(this).addClass("hover"); 49 toTarget($(this).parent(), true, true); 50 }, function() { 51 $(this).removeClass("hover"); 52 }); 53 54 $('.slider_menu').mouseleave(function() { 55 const menu = $(this).children("ul"); 56 setTimeout(() => toTarget(menu, true, true), 50); 57 }); 58 59 function intoSlider() { 60 $(".slider_menu[sliderTab]").each(function() { 61 if (!$(this).hasClass('into')) { 62 const menu = $(this).children("ul"); 63 menu.prepend('<li class="anchor" style="position:absolute;width:0;height:28px"></li>'); 64 const target = menu.find('.active').parent(); 65 if (target.length) { 66 menu.children(".anchor").css({ 67 left: target.position().left + target.scrollLeft() + "px", 68 width: target.outerWidth() + "px", 69 height: target.height() + "px", 70 opacity: "1" 71 }); 72 } 73 $(this).addClass('into'); 74 } 75 }); 76 } 77 78 // ç²æ§é¡µè 79 function stickFooter() { 80 const $footer = $('.main-footer'); 81 $footer.attr('style', ''); 82 if ($footer.hasClass('text-xs')) { 83 const winHeight = $(window).height(); 84 const footerHeight = $footer.outerHeight(true); 85 const mainContentHeight = $footer.position().top + footerHeight; 86 if (winHeight > mainContentHeight - parseInt($footer.css('marginTop'), 10)) { 87 $footer.css({ marginTop: winHeight - mainContentHeight }); 88 } 89 } 90 } 91 92 // å¤ççªå£å¤§å°åå 93 (function(){ 94 var resizeTicking = false; 95 function onResizeFrame(){ 96 stickFooter(); 97 trigger_resizable(false); 98 resizeTicking = false; 99 } 100 window.addEventListener('resize', function(){ 101 if (!resizeTicking) { 102 resizeTicking = true; 103 window.requestAnimationFrame(onResizeFrame); 104 } 105 }, { passive: true }); 106 })(); 107 108 // ä¾§è¾¹æ æå°å 109 let isMin = false; 110 let isMobileMin = false; 111 112 $('#sidebar-switch').on('click', function() { 113 $('#sidebar').removeClass('mini-sidebar'); 114 }); 115 116 function trigger_resizable(isNoAnim) { 117 const winWidth = $(window).width(); 118 if ((theme.minNav == '1' && !isMin && winWidth > 767.98) || (!isMin && winWidth > 767.98 && winWidth < 1024)) { 119 $('#mini-button').prop('checked', false); 120 trigger_lsm_mini(isNoAnim); 121 isMin = true; 122 if (isMobileMin) { 123 $sidebar.addClass('mini-sidebar'); 124 $('.sidebar-nav .change-href').each(function() { 125 $(this).attr('href', $(this).data('change')); 126 }); 127 isMobileMin = false;
128 } 129 } else if ((theme.minNav != '1') && ((isMin && winWidth >= 1024) || (isMobileMin && !isMin && winWidth >= 1024))) { 130 $('#mini-button').prop('checked', true); 131 trigger_lsm_mini(isNoAnim); 132 isMin = false; 133 if (isMobileMin) { 134 isMobileMin = false; 135 } 136 } else if (winWidth < 767.98 && $sidebar.hasClass('mini-sidebar')) { 137 $sidebar.removeClass('mini-sidebar'); 138 isMobileMin = true; 139 isMin = false; 140 } 141 } 142 143 // èåæ æå°å 144 $('#mini-button').on('click', function() { 145 trigger_lsm_mini(false); 146 }); 147 148 function trigger_lsm_mini(isNoAnim) { 149 if ($('.header-mini-btn input[type="checkbox"]').prop("checked")) { 150 $('.sidebar-nav').removeClass('mini-sidebar'); 151 $('.sidebar-menu ul ul').hide(); 152 if (isNoAnim) { 153 $('.sidebar-nav').removeClass('animate-nav').width(220); 154 } else { 155 $('.sidebar-nav').width(170); 156 } 157 } else { 158 $('.sidebar-item.sidebar-show').removeClass('sidebar-show'); 159 $('.sidebar-menu ul').removeAttr('style'); 160 $('.sidebar-nav').addClass('mini-sidebar'); 161 $('.sidebar-nav .change-href').each(function() { 162 $(this).attr('href', $(this).data('change')); 163 }); 164 if (isNoAnim) { 165 $('.sidebar-nav').removeClass('animate-nav').width(60); 166 } else { 167 $('.sidebar-nav').width(60); 168 } 169 } 170 } 171 172 // æ¾ç¤ºäºçº§æ¬æµ®èå 173 $(document).on('mouseover', '.mini-sidebar .sidebar-menu ul:first>li', function() { 174 const offset = 2; 175 if ($(".sidebar-popup.second").length == 0) { 176 $("body").append("<div class='second sidebar-popup sidebar-menu-inner text-sm'><div></div></div>"); 177 } 178 $(".sidebar-popup.second>div").html($(this).html()); 179 $(".sidebar-popup.second").show(); 180 const top = $(this).offset().top - $(window).scrollTop() + offset; 181 const d = $(window).height() - $(".sidebar-popup.second>div").height(); 182 $(".sidebar-popup.second").stop().animate({ "top": Math.max(0, Math.min(top, d - 8)) }, 50); 183 }); 184 185 // éèæ¬æµ®èå颿¿ 186 $(document).on('mouseleave', '.mini-sidebar .sidebar-menu ul:first, .mini-sidebar .slimScrollBar, .second.sidebar-popup', function() { 187 $(".sidebar-popup.second").hide(); 188 }); 189 190 // 常驻äºçº§æ¬æµ®èå颿¿ 191 $(document).on('mouseover', '.mini-sidebar .slimScrollBar, .second.sidebar-popup', function() { 192 $(".sidebar-popup.second").show(); 193 }); 194 195 // Ajaxè¯·æ± 196 $(document).on('click', '.ajax-cm-home .ajax-cm', function(event) { 197 event.preventDefault(); 198 const $this = $(this); 199 const id = $this.data('id'); 200 const $box = $($this.attr('href')).children('.site-list'); 201 202 if ($box.children('.url-card').length === 0) { 203 $this.addClass('disabled'); 204 $.ajax({ 205 url: theme.ajaxurl, 206 type: 'POST', 207 dataType: 'html', 208 data: { 209 action: $this.data('action'), 210 term_id: id, 211 }, 212 cache: true, 213 }).done(function(response) { 214 if (response.trim()) { 215 const $url = $(response); 216 $box.html($url); 217 if (isPC()) { 218 $url.find('[data-toggle="tooltip"]').each(function(){ 219 var $t = $(this); 220 var placement = $t.data('placement') || 'top'; 221 var delay = $t.data('delay') || { show: 0, hide: 0 }; 222 $t.tooltip({ 223 trigger: 'hover', 224 placement: placement, 225 delay: delay, 226 animation: false, 227 container: 'body' 228 }); 229 }); 230 } 231 } 232 $this.removeClass('disabled'); 233 }).fail(function() { 234 $this.removeClass('disabled'); 235 }); 236 } 237 }); 238}); 239// æç´¢æ¨¡å
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.