Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: support toc reward and view counter
- Loading branch information
Showing
20 changed files
with
224 additions
and
72 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
5 changes: 4 additions & 1 deletion
5
resources/_gen/assets/js/scripts/index.js_d3f53f09220d597dac26fe7840c31fc9.content
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,6 @@ | ||
var html=document.querySelector('html');var body=document.querySelector('body');var menuToggle=document.querySelector('.menu-toggle');var menuIcon=document.querySelector('.icon-menu');var siteMenu=document.querySelector('.site-menu');var socialMenu=document.querySelector('.social-menu');var toTopBtn=document.querySelector('.to-top');menuToggle&&menuToggle.addEventListener('click',function(){siteMenu.classList.toggle('collapsed');socialMenu.classList.toggle('collapsed');menuIcon.classList.toggle('icon-menu');menuIcon.classList.toggle('icon-close');var expandStatus=menuToggle.getAttribute('aria-expanded');if(expandStatus==='false')menuToggle.setAttribute('aria-expanded','true');else menuToggle.setAttribute('aria-expanded','false');});var zoomables=document.querySelectorAll('.zoomable > img, img.zoomable');zoomables.length&&mediumZoom(zoomables);function randomErrorEmoji(){var error=document.getElementsByClassName('error-emoji')[0];var emojiArray=['\\(o_o)/','(o^^)o','(˚Δ˚)b','(^-^*)','(≥o≤)','(^_^)b','(·_·)',"(='X'=)",'(>_<)','(;-;)','\\(^Д^)/',];if(error){var errorEmoji=emojiArray[Math.floor(Math.random()*emojiArray.length)];error.appendChild(document.createTextNode(errorEmoji));}};randomErrorEmoji();var lastPosition=0;var ticking=false;window.addEventListener('scroll',function(){lastPosition=body.scrollTop===0?html.scrollTop:body.scrollTop;if(!ticking){window.requestAnimationFrame(function(){if(lastPosition>=600){toTopBtn.classList.remove('is-hide');}else{toTopBtn.classList.add('is-hide');} | ||
var html=document.querySelector('html');var body=document.querySelector('body');var menuToggle=document.querySelector('.menu-toggle');var menuIcon=document.querySelector('.icon-menu');var siteMenu=document.querySelector('.site-menu');var socialMenu=document.querySelector('.social-menu');var toTopBtn=document.querySelector('.to-top');var tocMenu=document.querySelector('#TableOfContents');var collapseBtn=document.querySelector('.toc-btn');var rewardBtn=document.querySelector(".reward-btn");var rewardWay=document.querySelector(".reward-ways");rewardBtn&&rewardBtn.addEventListener('click',function(){rewardWay.classList.toggle('reward-ways-collapsed');}) | ||
collapseBtn&&collapseBtn.addEventListener('click',function(){var collapse=tocMenu.classList.contains('toc-menu-collapsed');collapseBtn.innerHTML=!collapse?'显示目录':'隐藏目录' | ||
tocMenu.classList.toggle('toc-menu-collapsed');}) | ||
menuToggle&&menuToggle.addEventListener('click',function(){siteMenu.classList.toggle('collapsed');socialMenu.classList.toggle('collapsed');menuIcon.classList.toggle('icon-menu');menuIcon.classList.toggle('icon-close');var expandStatus=menuToggle.getAttribute('aria-expanded');if(expandStatus==='false')menuToggle.setAttribute('aria-expanded','true');else menuToggle.setAttribute('aria-expanded','false');});var zoomables=document.querySelectorAll('.zoomable > img, img.zoomable');zoomables.length&&mediumZoom(zoomables);function randomErrorEmoji(){var error=document.getElementsByClassName('error-emoji')[0];var emojiArray=['\\(o_o)/','(o^^)o','(˚Δ˚)b','(^-^*)','(≥o≤)','(^_^)b','(·_·)',"(='X'=)",'(>_<)','(;-;)','\\(^Д^)/',];if(error){var errorEmoji=emojiArray[Math.floor(Math.random()*emojiArray.length)];error.appendChild(document.createTextNode(errorEmoji));}};randomErrorEmoji();var lastPosition=0;var ticking=false;window.addEventListener('scroll',function(){lastPosition=body.scrollTop===0?html.scrollTop:body.scrollTop;if(!ticking){window.requestAnimationFrame(function(){if(lastPosition>=600){toTopBtn.classList.remove('is-hide');}else{toTopBtn.classList.add('is-hide');} | ||
ticking=false;});} | ||
ticking=true;});var scroll=new SmoothScroll('a[href*="#"]');toTopBtn&&toTopBtn.addEventListener('click',function(){scroll.animateScroll(0);}); |
2 changes: 1 addition & 1 deletion
2
resources/_gen/assets/scss/styles/main.scss_b95b077eb505d5c0aff8055eaced30ad.content
Large diffs are not rendered by default.
Oops, something went wrong.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.