diff options
author | amazingrise <8315221+AmazingRise@users.noreply.github.com> | 2021-05-14 07:37:14 +0300 |
---|---|---|
committer | amazingrise <8315221+AmazingRise@users.noreply.github.com> | 2021-05-14 07:37:14 +0300 |
commit | 67dcd4949d63350f71fdbcfbbe75b8b581dc07b7 (patch) | |
tree | b489a919d8f27590820b012822ee730a7ceb80dd /layouts | |
parent | 368250ef26613ab014bb78a2bbdea0f45cc8c4b7 (diff) |
Remove redundant scripts and improvements on toc.
Diffstat (limited to 'layouts')
-rw-r--r-- | layouts/partials/head.html | 6 | ||||
-rw-r--r-- | layouts/partials/journal.html | 18 |
2 files changed, 20 insertions, 4 deletions
diff --git a/layouts/partials/head.html b/layouts/partials/head.html index efbd13f..d142f2d 100644 --- a/layouts/partials/head.html +++ b/layouts/partials/head.html @@ -31,10 +31,6 @@ {{ template "_internal/google_analytics.html" . }} {{ end }} -<script src="{{"/vendor/js/jquery.min.js" | relURL}}" ></script> -<script src="{{"/vendor/js/popper.min.js" | relURL}}" ></script> -<script src="{{"/vendor/js/bootstrap.min.js" | relURL}}" ></script> -<script src="{{"/vendor/js/smooth-scroll.polyfills.min.js" | relURL}}" ></script> <link type="text/css" rel="stylesheet" href="{{"/vendor/css/bootstrap.min.css" | relURL}}"> <script src="{{"/vendor/js/vue.min.js" | relURL}}" ></script> @@ -72,7 +68,9 @@ {{ if .Site.Params.disableAutoCollapse }} <script src="{{"/js/toc.js" | relURL}}"></script> {{ else }} + <script src="{{"/vendor/js/jquery.min.js" | relURL}}" ></script> <script src="{{"/js/toc-collapse.js" | relURL}}"></script> + <script src="{{"/vendor/js/bootstrap.min.js" | relURL}}" ></script> {{ end }} {{ end }} diff --git a/layouts/partials/journal.html b/layouts/partials/journal.html index 95cdfe5..ea7ee66 100644 --- a/layouts/partials/journal.html +++ b/layouts/partials/journal.html @@ -59,6 +59,18 @@ app = new Vue({ document.cookie = "night=0;path=/"; document.body.classList.remove("night"); } + }, + throttle(callback, limit) { + var wait = false; + return function (...args) { + if (!wait) { + callback(...args); + wait = true; + setTimeout(function () { + wait = false; + }, limit); + } + } } }, created() { @@ -123,6 +135,12 @@ app = new Vue({ elem.classList.add("table-responsive"); elem.classList.add("table-hover"); }) + + {{ if and (not (.Params.disableToC) ) (.IsPage) }} + spy(); + window.addEventListener('wheel', this.throttle(spy,200), false); + {{ end }} + }, destroyed() { window.removeEventListener('scroll', this.handleScroll); |