Improve javascript

This commit is contained in:
Track3 2018-12-30 11:52:17 +08:00
parent efb0b592a0
commit 4fb41e8a9a
10 changed files with 5 additions and 16 deletions

View file

@ -71,7 +71,7 @@ const toggleToc = () => {
document.getElementById('toc').classList.toggle('show-toc');
}
if (haveHeader == true) {
if (document.getElementById('site-header') !== null) {
document.getElementById('menu-btn').addEventListener('click', mobileMenuToggle);
window.addEventListener('scroll', throttle(() => {

View file

@ -13,7 +13,3 @@
</div>
</div>
{{ end }}
{{ define "footer" }}
<script>let haveHeader = false;</script>
{{ end }}

View file

@ -30,5 +30,4 @@
{{ define "footer" }}
{{ partialCached "footer.html" . }}
<script>let haveHeader = true;</script>
{{ end }}

View file

@ -18,5 +18,4 @@
{{ define "footer" }}
{{ partialCached "footer.html" . }}
<script>let haveHeader = true;</script>
{{ end }}

View file

@ -24,7 +24,3 @@
</div>
</div>
{{ end }}
{{ define "footer" }}
<script>let haveHeader = false;</script>
{{ end }}

View file

@ -58,5 +58,4 @@
{{ define "footer" }}
{{ partialCached "footer.html" . }}
<script>let haveHeader = true;</script>
{{ end }}

View file

@ -5,4 +5,4 @@ mobileMenuVisible=false;}}
const showFeaturedImg=()=>{document.getElementById('bg-img').classList.add('show-bg-img');}
const showContent=()=>{document.getElementById('bg-img').classList.remove('show-bg-img');}
const toggleToc=()=>{document.getElementById('toc').classList.toggle('show-toc');}
if(haveHeader==true){document.getElementById('menu-btn').addEventListener('click',mobileMenuToggle);window.addEventListener('scroll',throttle(()=>{autoHideHeader();if(mobileMenuVisible==true){mobileMenuToggle();}},250));}
if(document.getElementById('site-header')!==null){document.getElementById('menu-btn').addEventListener('click',mobileMenuToggle);window.addEventListener('scroll',throttle(()=>{autoHideHeader();if(mobileMenuVisible==true){mobileMenuToggle();}},250));}

View file

@ -1 +1 @@
{"Target":"js/main.min.7fb60d49ca60edf9439e867daffe2481a9722cacdbe91e2a8b3c84c36d540bab.js","MediaType":"application/javascript","Data":{"Integrity":"sha256-f7YNScpg7flDnoZ9r/4kgalyLKzb6R4qizyEw21UC6s="}}
{"Target":"js/main.min.de4d516d3e45a2fbe013b06aa4292cd08f6f04d55e780c03d9009bd99b05dcd4.js","MediaType":"application/javascript","Data":{"Integrity":"sha256-3k1RbT5FovvgE7BqpCks0I9vBNVeeAwD2QCb2ZsF3NQ="}}

File diff suppressed because one or more lines are too long

View file

@ -1 +1 @@
{"Target":"css/style.min.e8eb45143fbe384978af8c624bc9641cf39138512edefb3d2a494b743ed28a95.css","MediaType":"text/css","Data":{"Integrity":"sha256-6OtFFD++OEl4r4xiS8lkHPOROFEu3vs9KklLdD7SipU="}}
{"Target":"css/style.min.135fc8fad10a71b52484489246b4082f46d6e09f1e54f16e3f9c3b1dd208db01.css","MediaType":"text/css","Data":{"Integrity":"sha256-E1/I+tEKcbUkhEiSRrQIL0bW4J8eVPFuP5w7HdII2wE="}}