Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/AmazingRise/hugo-theme-diary.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/static
diff options
context:
space:
mode:
authoramazingrise <8315221+AmazingRise@users.noreply.github.com>2019-11-22 16:30:28 +0300
committeramazingrise <8315221+AmazingRise@users.noreply.github.com>2019-11-22 16:30:28 +0300
commit3b517cf4a58e56ce7582f311b4df65b096ee9172 (patch)
treee9fb28a92bd7199cd1cd4f8cacfe28eae2a0b29c /static
parent999e81b8105a5eda4a1bdca61afbb204ebbb397f (diff)
Introduce journal.js successfully.
Diffstat (limited to 'static')
-rw-r--r--static/js/journal.js68
1 files changed, 34 insertions, 34 deletions
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);