diff options
author | amazingrise <8315221+AmazingRise@users.noreply.github.com> | 2019-11-22 16:30:28 +0300 |
---|---|---|
committer | amazingrise <8315221+AmazingRise@users.noreply.github.com> | 2019-11-22 16:30:28 +0300 |
commit | 3b517cf4a58e56ce7582f311b4df65b096ee9172 (patch) | |
tree | e9fb28a92bd7199cd1cd4f8cacfe28eae2a0b29c | |
parent | 999e81b8105a5eda4a1bdca61afbb204ebbb397f (diff) |
Introduce journal.js successfully.
-rw-r--r-- | layouts/_default/baseof.html | 5 | ||||
-rw-r--r-- | layouts/partials/head.html | 17 | ||||
-rw-r--r-- | static/js/journal.js | 68 |
3 files changed, 45 insertions, 45 deletions
diff --git a/layouts/_default/baseof.html b/layouts/_default/baseof.html index d8194a5..9b4fe3e 100644 --- a/layouts/_default/baseof.html +++ b/layouts/_default/baseof.html @@ -2,13 +2,16 @@ <html> {{- partial "head.html" . -}} <body> + <div id="app"> + {{- partial "header.html" . -}} {{- partial "sidebar.html" . -}} {{- partial "extrabar.html" . -}} - {{- partial "header.html" . -}} + <div id="content"> {{- block "main" . }}{{- end }} </div> </div> + <script src="/js/journal.js"></script> </body> </html> diff --git a/layouts/partials/head.html b/layouts/partials/head.html index 4e49851..7b569cb 100644 --- a/layouts/partials/head.html +++ b/layouts/partials/head.html @@ -9,21 +9,20 @@ <meta name="theme-color" content="#ffffff"> <script src="https://cdn.jsdelivr.net/npm/jquery@3.3.1/dist/jquery.min.js" - integrity="sha256-FgpCb/KJQlLNfOu91ta32o/NMZxltwRo8QtmkMRdAu8=" crossorigin="anonymous"></script> +integrity="sha256-FgpCb/KJQlLNfOu91ta32o/NMZxltwRo8QtmkMRdAu8=" crossorigin="anonymous"></script> <script src="https://cdn.jsdelivr.net/npm/popper.js@1.14.4/dist/umd/popper.min.js" - integrity="sha256-EGs9T1xMHdvM1geM8jPpoo8EZ1V1VRsmcJz8OByENLA=" crossorigin="anonymous"></script> +integrity="sha256-EGs9T1xMHdvM1geM8jPpoo8EZ1V1VRsmcJz8OByENLA=" crossorigin="anonymous"></script> <script src="https://cdn.jsdelivr.net/npm/bootstrap@4.1.3/dist/js/bootstrap.min.js" - integrity="sha256-VsEqElsCHSGmnmHXGQzvoWjWwoznFSZc6hs7ARLRacQ=" crossorigin="anonymous"></script> -<script src="https://cdn.jsdelivr.net/npm/vue@2.5.17/dist/vue.min.js" - integrity="sha256-FtWfRI+thWlNz2sB3SJbwKx5PgMyKIVgwHCTwa3biXc=" crossorigin="anonymous"></script> +integrity="sha256-VsEqElsCHSGmnmHXGQzvoWjWwoznFSZc6hs7ARLRacQ=" crossorigin="anonymous"></script> <script src="https://cdn.jsdelivr.net/npm/smooth-scroll@14.2.1/dist/smooth-scroll.polyfills.min.js" - integrity="sha256-CI4Gq5E0io1Pv0xM3qPM+NUIOhbIBvC3GiN1Y4KhXpw=" crossorigin="anonymous"></script> +integrity="sha256-CI4Gq5E0io1Pv0xM3qPM+NUIOhbIBvC3GiN1Y4KhXpw=" crossorigin="anonymous"></script> <!-- Originally comes from head_includes.ejs --> <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@4.1.3/dist/css/bootstrap.min.css" integrity="sha256-eSi1q2PG6J7g7ib17yAaWMcrr5GrtohYChqibrV7PBE=" crossorigin="anonymous"> <!-- favicon --> <link rel="icon" href="{{ .Site.Params.favicon }}"> - -<link rel="stylesheet" type="text/css" href="/css/journal.css"> +<script src="https://cdn.jsdelivr.net/npm/vue@2.5.17/dist/vue.min.js" + integrity="sha256-FtWfRI+thWlNz2sB3SJbwKx5PgMyKIVgwHCTwa3biXc=" crossorigin="anonymous"></script> +<link rel="stylesheet" href="/css/journal.css?99999999"> <!-- {{ with resources.Get "/scss/journal.scss" }} <style >{{ .Content | safeCSS }}</style> @@ -33,8 +32,6 @@ {{ $styles := resources.Get "scss/journal.scss" | toCSS | minify | fingerprint }} <link rel="stylesheet" href="{{ $styles.Permalink }}" integrity="{{ $styles.Data.Integrity }}" media="screen"> -<script src="/js/journal.js"></script> - <script src="/js/loadCSS.js"></script> <script> loadCSS("https://fonts.googleapis.com/css?family=Lora|Montserrat|Fira+Mono|Material+Icons"); diff --git a/static/js/journal.js b/static/js/journal.js index 39c2c9a..50927c6 100644 --- a/static/js/journal.js +++ b/static/js/journal.js @@ -9,41 +9,41 @@ app = new Vue({ mounted: false, }, methods: { - sgn(t, x) { - let k = 1. / (1. - 2 * t); - if (x <= t) return 0; - else if (x >= 1 - t) return 1; - else { - return k * (x - t); - } - }, - handleScroll() { - this.scrollY = window.scrollY; - this.navOpacity = this.sgn(.0, Math.min(1, Math.max(0, window.scrollY / (this.pageHeadHeight() - this.navBarHeight() * 0.8)))); - const {navBar, navBackground, navTitle, extraContainer, streamContainer} = this.$refs; + sgn(t, x) { + let k = 1. / (1. - 2 * t); + if (x <= t) return 0; + else if (x >= 1 - t) return 1; + else { + return k * (x - t); + } + }, + handleScroll() { + this.scrollY = window.scrollY; + this.navOpacity = this.sgn(.0, Math.min(1, Math.max(0, window.scrollY / (this.pageHeadHeight() - this.navBarHeight() * 0.8)))); + const {navBar, navBackground, navTitle, extraContainer, streamContainer} = this.$refs; - if (this.navOpacity >= 1) { - navBackground.style.opacity = 1; - navTitle.style.opacity = 1; - } else { - navBackground.style.opacity = 0; - navTitle.style.opacity = 0; - } - }, - handleResize() { - const {navBar, navBackground, navTitle, extraContainer, streamContainer} = this.$refs; - extraContainer.style.left = (streamContainer.offsetWidth - extraContainer.offsetWidth) + 'px'; - }, - navBarHeight() { - return this.$refs.navBar.offsetHeight; - }, - pageHeadHeight() { - return this.$refs.pageHead.offsetHeight; - }, - toggleDrawer() { - this.isDrawerOpen = !this.isDrawerOpen; - document.getElementsByTagName('html')[0].style.overflow = this.isDrawerOpen ? 'hidden' : 'unset'; - }, + if (this.navOpacity >= 1) { + navBackground.style.opacity = 1; + navTitle.style.opacity = 1; + } else { + navBackground.style.opacity = 0; + navTitle.style.opacity = 0; + } + }, + handleResize() { + const {navBar, navBackground, navTitle, extraContainer, streamContainer} = this.$refs; + extraContainer.style.left = (streamContainer.offsetWidth - extraContainer.offsetWidth) + 'px'; + }, + navBarHeight() { + return this.$refs.navBar.offsetHeight; + }, + pageHeadHeight() { + return this.$refs.pageHead.offsetHeight; + }, + toggleDrawer() { + this.isDrawerOpen = !this.isDrawerOpen; + document.getElementsByTagName('html')[0].style.overflow = this.isDrawerOpen ? 'hidden' : 'unset'; + }, }, created() { window.addEventListener('scroll', this.handleScroll); |