From 09650d7d0bd215ab5da9d8dbbc7cdc91b9aec6f7 Mon Sep 17 00:00:00 2001 From: Aiden X Date: Tue, 15 Sep 2020 01:16:55 +0800 Subject: build: prettier check --- assets/js/less.js | 68 ++++++++++++++++++++++++++++------------------ assets/scss/_dark.scss | 8 +++--- assets/scss/_font.scss | 49 +++++++++++++++++++++------------ assets/scss/_footer.scss | 7 ++--- assets/scss/_heaader.scss | 4 +-- assets/scss/_single.scss | 27 ++++++++++++------ assets/scss/_taxonomy.scss | 4 +-- assets/scss/less.scss | 26 ++++++++++++------ 8 files changed, 119 insertions(+), 74 deletions(-) (limited to 'assets') diff --git a/assets/js/less.js b/assets/js/less.js index 3221f4a..d7bb79b 100644 --- a/assets/js/less.js +++ b/assets/js/less.js @@ -1,40 +1,54 @@ -const $btnDark = document.getElementById('btn-dark') -const $body = document.getElementsByTagName('body') -$btnDark.addEventListener('click', e => { - e.preventDefault() - $body[0].classList.toggle('dark') - if (getCookie('dark') === "") { - setCookie('dark', 'true', 7 * 24 * 60 * 60) - } else { - removeCookie('dark') - } +if (document.querySelector(".single-toc")) { + tocbot.init({ + // Where to render the table of contents. + tocSelector: ".single-toc", + // Where to grab the headings to build the table of contents. + contentSelector: ".single-content", + // Which headings to grab inside of the contentSelector element. + headingSelector: "h1, h2, h3", + // For headings inside relative or absolute positioned containers within content. + hasInnerContainers: false, + collapseDepth: 4, + }) +} + +const $btnDark = document.getElementById("btn-dark") +const $body = document.getElementsByTagName("body") +$btnDark.addEventListener("click", (e) => { + e.preventDefault() + $body[0].classList.toggle("dark") + if (getCookie("dark") === "") { + setCookie("dark", "true", 7 * 24 * 60 * 60) + } else { + removeCookie("dark") + } }) -if (getCookie('dark') === 'true') { - $body[0].classList.add('dark') +if (getCookie("dark") === "true") { + $body[0].classList.add("dark") } function setCookie(key, value, second) { - let d = new Date(); - d.setTime(d.getTime() + (second * 1000)); - let expires = "expires=" + d.toGMTString(); - document.cookie = key + "=" + value + "; " + expires + "; path=/"; + let d = new Date() + d.setTime(d.getTime() + second * 1000) + let expires = "expires=" + d.toGMTString() + document.cookie = key + "=" + value + "; " + expires + "; path=/" } function removeCookie(key) { - let d = new Date(); - d.setTime(d.getTime() - 1); - let expires = "expires=" + d.toGMTString(); - document.cookie = key + "=;" + expires + "; path=/"; + let d = new Date() + d.setTime(d.getTime() - 1) + let expires = "expires=" + d.toGMTString() + document.cookie = key + "=;" + expires + "; path=/" } function getCookie(key) { - let name = key + "="; - let ca = document.cookie.split(';'); - for (let i = 0; i < ca.length; i++) { - let c = ca[i].trim(); - if (c.indexOf(name) === 0) return c.substring(name.length, c.length); - } + let name = key + "=" + let ca = document.cookie.split(";") + for (let i = 0; i < ca.length; i++) { + let c = ca[i].trim() + if (c.indexOf(name) === 0) return c.substring(name.length, c.length) + } - return ""; + return "" } diff --git a/assets/scss/_dark.scss b/assets/scss/_dark.scss index 3d28e9d..584b4a4 100644 --- a/assets/scss/_dark.scss +++ b/assets/scss/_dark.scss @@ -1,4 +1,3 @@ - .dark { background: #16171c; @@ -16,7 +15,8 @@ } } - .post-title, .single-title { + .post-title, + .single-title { color: #d0d0d0; } @@ -26,7 +26,7 @@ .is-active-li { & > a { - color: #f0f0f0!important; + color: #f0f0f0 !important; } } -} \ No newline at end of file +} diff --git a/assets/scss/_font.scss b/assets/scss/_font.scss index 82d8eb0..d5a421b 100644 --- a/assets/scss/_font.scss +++ b/assets/scss/_font.scss @@ -1,27 +1,40 @@ - /* monda-regular */ @font-face { - font-family: 'Monda'; + font-family: "Monda"; font-style: normal; - src: url('//lib.baomitu.com/fonts/monda/monda-regular.eot'); /* IE9 Compat Modes */ - src: local('Monda'), local('Monda-Normal'), - url('//lib.baomitu.com/fonts/monda/monda-regular.eot?#iefix') format('embedded-opentype'), /* IE6-IE8 */ - url('//lib.baomitu.com/fonts/monda/monda-regular.woff2') format('woff2'), /* Super Modern Browsers */ - url('//lib.baomitu.com/fonts/monda/monda-regular.woff') format('woff'), /* Modern Browsers */ - url('//lib.baomitu.com/fonts/monda/monda-regular.ttf') format('truetype'), /* Safari, Android, iOS */ - url('//lib.baomitu.com/fonts/monda/monda-regular.svg#Monda') format('svg'); /* Legacy iOS */ + src: url("//lib.baomitu.com/fonts/monda/monda-regular.eot"); /* IE9 Compat Modes */ + src: local("Monda"), local("Monda-Normal"), + url("//lib.baomitu.com/fonts/monda/monda-regular.eot?#iefix") + format("embedded-opentype"), + /* IE6-IE8 */ url("//lib.baomitu.com/fonts/monda/monda-regular.woff2") + format("woff2"), + /* Super Modern Browsers */ + url("//lib.baomitu.com/fonts/monda/monda-regular.woff") format("woff"), + /* Modern Browsers */ url("//lib.baomitu.com/fonts/monda/monda-regular.ttf") + format("truetype"), + /* Safari, Android, iOS */ + url("//lib.baomitu.com/fonts/monda/monda-regular.svg#Monda") format("svg"); /* Legacy iOS */ } /* merriweather-regular */ @font-face { - font-family: 'Merriweather'; + font-family: "Merriweather"; font-style: normal; font-weight: regular; - src: url('//lib.baomitu.com/fonts/merriweather/merriweather-regular.eot'); /* IE9 Compat Modes */ - src: local('Merriweather'), local('Merriweather-Normal'), - url('//lib.baomitu.com/fonts/merriweather/merriweather-regular.eot?#iefix') format('embedded-opentype'), /* IE6-IE8 */ - url('//lib.baomitu.com/fonts/merriweather/merriweather-regular.woff2') format('woff2'), /* Super Modern Browsers */ - url('//lib.baomitu.com/fonts/merriweather/merriweather-regular.woff') format('woff'), /* Modern Browsers */ - url('//lib.baomitu.com/fonts/merriweather/merriweather-regular.ttf') format('truetype'), /* Safari, Android, iOS */ - url('//lib.baomitu.com/fonts/merriweather/merriweather-regular.svg#Merriweather') format('svg'); /* Legacy iOS */ -} \ No newline at end of file + src: url("//lib.baomitu.com/fonts/merriweather/merriweather-regular.eot"); /* IE9 Compat Modes */ + src: local("Merriweather"), local("Merriweather-Normal"), + url("//lib.baomitu.com/fonts/merriweather/merriweather-regular.eot?#iefix") + format("embedded-opentype"), + /* IE6-IE8 */ + url("//lib.baomitu.com/fonts/merriweather/merriweather-regular.woff2") + format("woff2"), + /* Super Modern Browsers */ + url("//lib.baomitu.com/fonts/merriweather/merriweather-regular.woff") + format("woff"), + /* Modern Browsers */ + url("//lib.baomitu.com/fonts/merriweather/merriweather-regular.ttf") + format("truetype"), + /* Safari, Android, iOS */ + url("//lib.baomitu.com/fonts/merriweather/merriweather-regular.svg#Merriweather") + format("svg"); /* Legacy iOS */ +} diff --git a/assets/scss/_footer.scss b/assets/scss/_footer.scss index a3db990..471a9fd 100644 --- a/assets/scss/_footer.scss +++ b/assets/scss/_footer.scss @@ -1,18 +1,17 @@ - footer { padding: 20px 0; @include flex-y-center; justify-content: center; text-align: center; - color: #5D5C5C; + color: #5d5c5c; font-size: 14px; a { - color: #5D5C5C; + color: #5d5c5c; } .copyright { margin-left: 20px; margin-right: 20px; } -} \ No newline at end of file +} diff --git a/assets/scss/_heaader.scss b/assets/scss/_heaader.scss index f18bbfe..fc62299 100644 --- a/assets/scss/_heaader.scss +++ b/assets/scss/_heaader.scss @@ -23,10 +23,10 @@ a { padding: 10px 14px; - color: #4C4E4D; + color: #4c4e4d; &:hover { color: var(--theme-color); } } -} \ No newline at end of file +} diff --git a/assets/scss/_single.scss b/assets/scss/_single.scss index 1989361..831b6d5 100644 --- a/assets/scss/_single.scss +++ b/assets/scss/_single.scss @@ -1,7 +1,6 @@ - .single { line-height: 2; - color: #4C4E4D; + color: #4c4e4d; font-size: 16px; display: flex; @@ -14,7 +13,9 @@ margin-bottom: 10px; font-size: 30px; font-weight: 500; - font-family: 'Monda', -apple-system, BlinkMacSystemFont, PingFang SC, Hiragino Sans GB, Microsoft YaHei, "\5FAE\8F6F\96C5\9ED1", helvetica neue, helvetica, ubuntu, roboto, noto, segoe ui, Arial, sans-serif; + font-family: "Monda", -apple-system, BlinkMacSystemFont, PingFang SC, + Hiragino Sans GB, Microsoft YaHei, "\5FAE\8F6F\96C5\9ED1", helvetica neue, + helvetica, ubuntu, roboto, noto, segoe ui, Arial, sans-serif; @include mobile { font-size: 26px; } @@ -48,11 +49,18 @@ margin: 30px 0 30px; } - h1, h2, h3, h4, h5, h6 { + h1, + h2, + h3, + h4, + h5, + h6 { font-weight: 600; outline: none; margin: 30px 0 30px; - font-family: 'Monda', -apple-system, BlinkMacSystemFont, PingFang SC, Hiragino Sans GB, Microsoft YaHei, "\5FAE\8F6F\96C5\9ED1", helvetica neue, helvetica, ubuntu, roboto, noto, segoe ui, Arial, sans-serif; + font-family: "Monda", -apple-system, BlinkMacSystemFont, PingFang SC, + Hiragino Sans GB, Microsoft YaHei, "\5FAE\8F6F\96C5\9ED1", helvetica neue, + helvetica, ubuntu, roboto, noto, segoe ui, Arial, sans-serif; } h1 { @@ -71,7 +79,8 @@ font-size: 20px; } - ol, ul { + ol, + ul { list-style: inherit; padding-left: 20px; } @@ -102,7 +111,7 @@ } .toc-list-item { - transition: color .2s; + transition: color 0.2s; } .toc-link { @@ -116,7 +125,6 @@ margin: 5px 0; } - .toc-list-item { margin-bottom: 5px; @include text-truncate; @@ -132,7 +140,8 @@ padding-left: 0; } - ol, ul { + ol, + ul { list-style: none; } } diff --git a/assets/scss/_taxonomy.scss b/assets/scss/_taxonomy.scss index 7871ca3..697615b 100644 --- a/assets/scss/_taxonomy.scss +++ b/assets/scss/_taxonomy.scss @@ -2,5 +2,5 @@ font-size: 20px; margin-bottom: 50px; color: #909090; - font-family: 'Monda', -apple-system, sans-serif; -} \ No newline at end of file + font-family: "Monda", -apple-system, sans-serif; +} diff --git a/assets/scss/less.scss b/assets/scss/less.scss index ccf35ce..884e8ab 100644 --- a/assets/scss/less.scss +++ b/assets/scss/less.scss @@ -1,10 +1,14 @@ @import "../../node_modules/@forever9/lego/lego"; -$breakpoints: (md:856px); -$container-max-widths: (md: 800px,); +$breakpoints: ( + md: 856px, +); +$container-max-widths: ( + md: 800px, +); @mixin mobile() { @include media-down(map-get($breakpoints, md)) { - @content + @content; } } @@ -20,8 +24,11 @@ $container-max-widths: (md: 800px,); @include column($grid-gap: 30px); @include gen-grids(); - -@mixin offset($name: is-offset, $column-number: 12, $breakpoints: $breakpoints) { +@mixin offset( + $name: is-offset, + $column-number: 12, + $breakpoints: $breakpoints +) { @for $i from 1 through $column-number { .#{$name}-#{$i} { margin-left: percentage($i / $column-number); @@ -46,7 +53,9 @@ html { } body { - font-family: "Merriweather", -apple-system, BlinkMacSystemFont, PingFang SC, Hiragino Sans GB, Microsoft YaHei, "\5FAE\8F6F\96C5\9ED1", helvetica neue, helvetica, ubuntu, roboto, noto, segoe ui, Arial, sans-serif; + font-family: "Merriweather", -apple-system, BlinkMacSystemFont, PingFang SC, + Hiragino Sans GB, Microsoft YaHei, "\5FAE\8F6F\96C5\9ED1", helvetica neue, + helvetica, ubuntu, roboto, noto, segoe ui, Arial, sans-serif; background: #fff; } @@ -63,7 +72,6 @@ a { text-decoration: none; } - .posts { margin-bottom: 80px; } @@ -88,7 +96,9 @@ a { } .post-title { - font-family: 'Monda', -apple-system, BlinkMacSystemFont, PingFang SC, Hiragino Sans GB, Microsoft YaHei, "\5FAE\8F6F\96C5\9ED1", helvetica neue, helvetica, ubuntu, roboto, noto, segoe ui, Arial, sans-serif; + font-family: "Monda", -apple-system, BlinkMacSystemFont, PingFang SC, + Hiragino Sans GB, Microsoft YaHei, "\5FAE\8F6F\96C5\9ED1", helvetica neue, + helvetica, ubuntu, roboto, noto, segoe ui, Arial, sans-serif; } .year { -- cgit v1.2.3