PageSourceSearch

https://www.weisay.com/blog/wp-content/themes/weisayliubai/assets/js/weisay.min.js?ver=0.8.28

js weisay.com collected 2026-10-02 11:26:51 UTC 9,636 bytes, 1 lines download raw bytes

1jQuery(function($){'use strict';const $window=$(window);const $body=$('body');const $htmlBody=$('html, body');const $rollTop=$('.roll-top');const $rollCom=$('.roll-com');const $comments=$('#comments');const SCROLL_THRESHOLD=1000;const ANIMATION_SPEED=800;const FADE_SPEED=200;let isVisible=null;function updateRollTop(){const shouldShow=$window.scrollTop()>SCROLL_THRESHOLD;if(shouldShow!==isVisible){isVisible=shouldShow;$rollTop.toggleClass('show',isVisible)}}$window.on('scroll',updateRollTop);updateRollTop();$rollTop.on('click',function(e){e.preventDefault();$htmlBody.stop().animate({scrollTop:0},ANIMATION_SPEED)});if($comments.length){$rollCom.on('click',function(e){e.preventDefault();$htmlBody.stop().animate({scrollTop:$comments.offset().top},ANIMATION_SPEED)})}const $tocLinks=$('.toc-nav a');const $tocTitles=$('[id^="title-"]');const $tocContent=$('.article-content');if($tocTitles.length&&$tocContent.length){const TITLE_OFFSET=30;const CONTENT_OFFSET=80;const DEBOUNCE_DELAY=80;let titleOffsets=[];let currentId='';let contentBottom=0;const linkMap={};$tocLinks.each(function(){linkMap[this.hash]=$(this)});function debounce(fn,delay){let timer;return function(){clearTimeout(timer);timer=setTimeout(fn,delay)}}function updateOffsets(){titleOffsets.length=0;$tocTitles.each(function(){titleOffsets.push({id:this.id,top:$(this).offset().top})});contentBottom=$tocContent.offset().top+$tocContent.outerHeight()}function updateCurrent(){const scrollTop=$window.scrollTop();if(scrollTop>contentBottom+CONTENT_OFFSET){if(currentId&&linkMap['#'+currentId]){linkMap['#'+currentId].removeClass('current')}currentId='';return}let newCurrent='';for(let i=titleOffsets.length-1;i>=0;i--){if(scrollTop>=titleOffsets[i].top-TITLE_OFFSET){newCurrent=titleOffsets[i].id;break}}if(newCurrent===currentId){return}if(currentId&&linkMap['#'+currentId]){linkMap['#'+currentId].removeClass('current')}if(newCurrent&&linkMap['#'+newCurrent]){linkMap['#'+newCurrent].addClass('current')}currentId=newCurrent}function refresh(){updateOffsets();updateCurrent()}const debouncedRefresh=debounce(refresh,DEBOUNCE_DELAY);refresh();$window.on('scroll',updateCurrent);$window.on('resize',debouncedRefresh);$window.on('load',refresh);if(window.ResizeObserver){const observer=new ResizeObserver(debouncedRefresh);observer.observe($tocContent[0])}}$('.toc-nav').on('click','a[href^="#"]',function(e){const id=$(this).attr('href');const $id=$(id);if(!$id.length){return}e.preventDefault();const pos=$id.offset().top-20;$htmlBody.stop().animate({scrollTop:pos},300)});$('.accordion-box').on('click','.accordion-head',function(){const $head=$(this);const $content=$head.next();$content.stop(true,true).slideToggle(200,function(){$head.toggleClass('accordion-show',$content.is(':visible'))})});$body.on("click","a[rel~='external']",function(e){e.preventDefault();window.open(this.href)});PrismInitCodeFold();$body.on('click','.code-toggle-btn',function(){const $btn=$(this);const $pre=$btn.prev('pre');if($btn.attr('data-state')==='collapsed'){$pre.addClass('code-expanded');$pre.find('.code-mask').hide();$btn.html('收起<i class="iconfont codetoggleicon">&#xe61a;</i>').attr('data-state','expanded')}else{$pre.removeClass('code-expanded');$pre.find('.code-mask').show();$btn.html('展开<i class="iconfont codetoggleicon">&#xe61b;</i>').attr('data-state','collapsed');$htmlBody.stop().animate({scrollTop:$btn.offset().top-100},0)}});LiubaiFixPagination();const $hamburgerBtn=$('#hamburger-btn');const $navClose=$('#mobile-nav-close');const $mainNav=$('#main-nav');const $overlay=$('#nav-overlay');function isPlaceholderLink($link){const href=($link.attr('href')||'').trim().toLowerCase();return(href===''||href==='#'||href.startsWith('javascript'))}function openNav(){$mainNav.addClass('open animate');$overlay.addClass('active');$body.css('overflow','hidden');$hamburgerBtn.attr('aria-expanded','true')}let navAnimateTimer;function closeNav(){$mainNav.removeClass('open');$overlay.removeClass('active');$body.css('overflow','');$hamburgerBtn.attr('aria-expanded','false');clearTimeout(navAnimateTimer);navAnimateTimer=setTimeout(function(){$mainNav.removeClass('animate')},400)}function closeNavAndCollapse(){closeNav();$mainNav.find('.children.open').removeClass('open').closest('li').removeClass('open')}function toggleSubMenu($parentLi){const $subList=$parentLi.children('ul.children');if(!$subList.length){return}const isOpen=$subList.hasClass('open');if(isOpen){$subList.removeClass('open');$parentLi.removeClass('open')}else{$subList.addClass('open');$parentLi.addClass('open')}}$hamburgerBtn.on('click',function(e){e.stopPropagation();openNav()});$navClose.on('click',function(e){e.stopPropagation();closeNavAndCollapse()});$overlay.on('click',function(e){if(e.target===this){closeNavAndCollapse()}});$('.nav-menu > li:has(ul.children) > a').on('click',function(e){if(!$mainNav.hasClass('open')){return}const $this=$(this);const $parentLi=$this.closest('li');const rect=e.currentTarget.getBoundingClientRect();const clickX=e.clientX-rect.left;const isArrowArea=clickX>rect.width*0.7;if(isPlaceholderLink($this)){e.preventDefault();toggleSubMenu($parentLi);return}if(isArrowArea){e.preventDefault();toggleSubMenu($parentLi);return}e.preventDefault();const targetUrl=$this.attr('href');closeNavAndCollapse();setTimeout(function(){window.location.href=targetUrl},300)});$('.nav-menu .children li a').on('click',function(e){if(!$mainNav.hasClass('open')){return}const $this=$(this);if(isPlaceholderLink($this)){e.preventDefault();closeNavAndCollapse();return}e.preventDefault();const targetUrl=$this.attr('href');closeNavAndCollapse();setTimeout(function(){window.location.href=targetUrl},300)});let navResizeTimer;$window.on('resize',function(){clearTimeout(navResizeTimer);navResizeTimer=setTimeout(function(){if($window.width()>=768&&$mainNav.hasClass('open')){closeNavAndCollapse()}},200)});$('.nav-menu a').each(function(){const $link=$(this);if(isPlaceholderLink($link)){$link.addClass('placeholder-link')}});const $searchTrigger=$('#search-trigger');const $searchOverlay=$('#search-overlay');const $searchModalClose=$('#search-modal-close');const $searchInput=$('#search-input');if($searchTrigger.length&&$searchOverlay.length&&$searchModalClose.length&&$searchInput.length){function openSearchModal(){$searchOverlay.addClass('active');$body.css('overflow','hidden');setTimeout(function(){$searchInput.trigger('focus')},100)}function closeSearchModal(){$searchOverlay.removeClass('active');$body.css('overflow','');$searchInput.val('')}$searchTrigger.on('click',openSearchModal);$searchModalClose.on('click',closeSearchModal);$searchOverlay.on('click',function(e){if(e.target===this){closeSearchModal()}});$(document).on('keydown.search',function(e){if(e.key==='Escape'&&$searchOverlay.hasClass('active')){closeSearchModal()}})}});(function(){var bar=document.getElementById('reading-progress');if(!bar)return;var ticking=false;function measure(){var doc=document.documentElement;var max=doc.scrollHeight-doc.clientHeight;if(max<=0)return 0;var y=window.pageYOffset||doc.scrollTop;return Math.min(1,Math.max(0,y/max))}function paint(){ticking=false;bar.style.transform='scaleX('+measure()+')'}function onScroll(){if(ticking)return;ticking=true;requestAnimationFrame(paint)}window.addEventListener('scroll',onScroll,{passive:true});window.addEventListener('resize',onScroll);if(window.ResizeObserver){new ResizeObserver(onScroll).observe(document.body)}paint()})();document.addEventListener("DOMContentLoaded",()=>
1{const toc=document.querySelector(".toc-details");const summary=toc?.querySelector(".toc-summary");if(!toc||!summary)return;const hideToc=toc.querySelector(".toc-hide");if(hideToc){hideToc.addEventListener("click",(e)=>{e.preventDefault();e.stopPropagation();toc.closest(".article-body-toc")?.classList.add("toc-hidden")})}const mq=window.matchMedia("(min-width: 992px)");let needsReset=true;const sync=(fromResize=false)=>{if(mq.matches){toc.open=true}else if(needsReset||fromResize){toc.open=false;needsReset=false}};summary.addEventListener("click",(e)=>{if(mq.matches){e.preventDefault();toc.open=true}});sync(true);mq.addEventListener("change",()=>{sync(true)});window.addEventListener("pageshow",()=>{if(mq.matches){toc.open=true}})});function LiubaiFixPagination(){jQuery('.pagination').each(function(){var $pagination=jQuery(this);if(!$pagination.children().length){$pagination.hide();return}if(!$pagination.find('.prev').length){$pagination.prepend('<span class="prev disabled" aria-disabled="true"><i class="iconfont previcon">&#xe65d;</i><span class="prev-text">上一页</span></span>')}if(!$pagination.find('.next').length){$pagination.append('<span class="next disabled" aria-disabled="true"><span class="next-text">下一页</span><i class="iconfont nexticon">&#xe65e;</i></span>')}})}function PrismInitCodeFold(root){const CODE_LINE_LIMIT=10;jQuery(root||document).find('pre.line-numbers').each(function(){const $pre=jQuery(this);const codeLines=$pre.find('code').text().split('\n').length;if(codeLines>CODE_LINE_LIMIT){if($pre.next('.code-toggle-btn').length)return;$pre.append('<div class="code-mask"></div>');$pre.after('<div class="code-toggle-btn" data-state="collapsed">展开<i class="iconfont codetoggleicon">&#xe61b;</i></div>')}else{$pre.addClass('code-expanded')}})}if(navigator.userAgentData&&navigator.userAgentData.getHighEntropyValues){navigator.userAgentData.getHighEntropyValues(['platformVersion']).then(ua=>{if(navigator.userAgentData.platform==='Windows'){const major=parseInt(ua.platformVersion.split('.')[0],10);if(major>=13){document.cookie='win11=true;path=/;SameSite=Lax'}}}).catch(()=>{})}

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.