From 3c6cb7f29631dfcdd954e7cbd5d2370efe7eb827 Mon Sep 17 00:00:00 2001 From: olOwOlo <26087907+olOwOlo@users.noreply.github.com> Date: Sun, 27 Aug 2017 22:38:42 +0800 Subject: =?UTF-8?q?=F0=9F=8E=89=20first=20commit?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/.babelrc | 10 + src/css/_base.scss | 98 ++++++ src/css/_common/_animation.scss | 153 +++++++++ src/css/_common/_normalize.scss | 427 ++++++++++++++++++++++++ src/css/_common/_utils.scss | 23 ++ src/css/_custom/_custom.scss | 4 + src/css/_partial/_404.scss | 25 ++ src/css/_partial/_archive.scss | 101 ++++++ src/css/_partial/_back-to-top.scss | 24 ++ src/css/_partial/_categories.scss | 43 +++ src/css/_partial/_footer.scss | 10 + src/css/_partial/_footer/_copyright.scss | 23 ++ src/css/_partial/_footer/_social.scss | 19 ++ src/css/_partial/_header.scss | 19 ++ src/css/_partial/_header/_logo.scss | 18 + src/css/_partial/_header/_menu.scss | 35 ++ src/css/_partial/_iconfont.scss | 96 ++++++ src/css/_partial/_mobile.scss | 77 +++++ src/css/_partial/_pagination.scss | 36 ++ src/css/_partial/_post.scss | 23 ++ src/css/_partial/_post/_code.scss | 177 ++++++++++ src/css/_partial/_post/_content.scss | 101 ++++++ src/css/_partial/_post/_copyright.scss | 17 + src/css/_partial/_post/_footer.scss | 74 ++++ src/css/_partial/_post/_header.scss | 39 +++ src/css/_partial/_post/_reward.scss | 48 +++ src/css/_partial/_post/_toc.scss | 46 +++ src/css/_partial/_slideout.scss | 33 ++ src/css/_partial/_tags.scss | 46 +++ src/css/_variables.scss | 343 +++++++++++++++++++ src/css/style.scss | 19 ++ src/fonts/chancery/apple-chancery-webfont.eot | Bin 0 -> 26058 bytes src/fonts/chancery/apple-chancery-webfont.svg | 228 +++++++++++++ src/fonts/chancery/apple-chancery-webfont.ttf | Bin 0 -> 60780 bytes src/fonts/chancery/apple-chancery-webfont.woff | Bin 0 -> 30256 bytes src/fonts/chancery/apple-chancery-webfont.woff2 | Bin 0 -> 23532 bytes src/js/even.js | 167 +++++++++ src/js/main.js | 14 + src/package.json | 28 ++ src/webpack.config.js | 56 ++++ 40 files changed, 2700 insertions(+) create mode 100644 src/.babelrc create mode 100644 src/css/_base.scss create mode 100644 src/css/_common/_animation.scss create mode 100644 src/css/_common/_normalize.scss create mode 100644 src/css/_common/_utils.scss create mode 100644 src/css/_custom/_custom.scss create mode 100644 src/css/_partial/_404.scss create mode 100644 src/css/_partial/_archive.scss create mode 100644 src/css/_partial/_back-to-top.scss create mode 100644 src/css/_partial/_categories.scss create mode 100644 src/css/_partial/_footer.scss create mode 100644 src/css/_partial/_footer/_copyright.scss create mode 100644 src/css/_partial/_footer/_social.scss create mode 100644 src/css/_partial/_header.scss create mode 100644 src/css/_partial/_header/_logo.scss create mode 100644 src/css/_partial/_header/_menu.scss create mode 100644 src/css/_partial/_iconfont.scss create mode 100644 src/css/_partial/_mobile.scss create mode 100644 src/css/_partial/_pagination.scss create mode 100644 src/css/_partial/_post.scss create mode 100644 src/css/_partial/_post/_code.scss create mode 100644 src/css/_partial/_post/_content.scss create mode 100644 src/css/_partial/_post/_copyright.scss create mode 100644 src/css/_partial/_post/_footer.scss create mode 100644 src/css/_partial/_post/_header.scss create mode 100644 src/css/_partial/_post/_reward.scss create mode 100644 src/css/_partial/_post/_toc.scss create mode 100644 src/css/_partial/_slideout.scss create mode 100644 src/css/_partial/_tags.scss create mode 100644 src/css/_variables.scss create mode 100644 src/css/style.scss create mode 100644 src/fonts/chancery/apple-chancery-webfont.eot create mode 100644 src/fonts/chancery/apple-chancery-webfont.svg create mode 100644 src/fonts/chancery/apple-chancery-webfont.ttf create mode 100644 src/fonts/chancery/apple-chancery-webfont.woff create mode 100644 src/fonts/chancery/apple-chancery-webfont.woff2 create mode 100644 src/js/even.js create mode 100644 src/js/main.js create mode 100644 src/package.json create mode 100644 src/webpack.config.js (limited to 'src') diff --git a/src/.babelrc b/src/.babelrc new file mode 100644 index 0000000..2645a84 --- /dev/null +++ b/src/.babelrc @@ -0,0 +1,10 @@ +{ + "presets": ["es2015","stage-2"], + "plugins": [ + ["transform-runtime", { + "polyfill": false, + "regenerator": true + }] + ], + "ignore": [] +} diff --git a/src/css/_base.scss b/src/css/_base.scss new file mode 100644 index 0000000..0e1c342 --- /dev/null +++ b/src/css/_base.scss @@ -0,0 +1,98 @@ +@import '_common/normalize'; + +html { + font-size: $global-font-size; + box-sizing: border-box; +} + +body { + padding: 0; + margin: 0; + font-family: $global-font-family; + font-weight: normal; + -webkit-font-smoothing: antialiased; + -moz-osx-font-smoothing: grayscale; + line-height: $global-lineheight; + color: $global-font-color; + background: $global-background; + scroll-behavior: smooth; + border-top: 3px solid $theme-color; +} + +@include max-screen() { + body { + border-top: 0; + } +} + +::selection { + background: $theme-color; + color: #fff; +} + +// ::-webkit-scrollbar { +// width: 8px; +// height: 6px; +// } + +// ::-webkit-scrollbar-thumb { +// background: lighten($theme-color, 10%); +// border-radius: 5px; +// } + +// ::-webkit-scrollbar-track { +// background: rgba(211, 211, 211, 0.4); +// border-radius: 5px; +// } + +img { + max-width: 100%; + height: auto; + display: inline-block; + vertical-align: middle; +} + +a { + color: $global-font-color; + text-decoration: none; +} + +@each $header, $size in $global-headings { + #{$header} { + font-size: $size; + font-family: $global-serif-font-family; + } +} + +.container { + margin: 0 auto; + width: $global-body-width; +} + +@include max-screen() { + .container { + width: 100%; + box-shadow: -1px -5px 5px $gray; + } +} + +.content-wrapper { + padding: $global-container-padding; +} + +// make video fluid: +// https://css-tricks.com/NetMag/FluidWidthVideo/Article-FluidWidthVideo.php +// class video-container is the wrapper used by hexo youtube tag plugin +.video-container { + position: relative; + padding-bottom: 56.25%; /* 16:9 */ + padding-top: 25px; + height: 0; +} +.video-container iframe { + position: absolute; + top: 0; + left: 0; + width: 100%; + height: 100%; +} \ No newline at end of file diff --git a/src/css/_common/_animation.scss b/src/css/_common/_animation.scss new file mode 100644 index 0000000..2c3934c --- /dev/null +++ b/src/css/_common/_animation.scss @@ -0,0 +1,153 @@ +@mixin underline-from-center() { + display: inline-block; + vertical-align: middle; + transform: translateZ(0); + backface-visibility: hidden; + box-shadow: 0 0 1px transparent; + position: relative; + overflow: hidden; + + &:before { + content: ''; + position: absolute; + z-index: -1; + height: 2px; + bottom: 0; + left: 51%; + right: 51%; + background: $theme-color; + transition-duration: 0.2s; + transition-property: right, left; + transition-timing-function: ease-out; + } + + &.active, + &:active, + &:focus, + &:hover { + &:before { + right: 0; + left: 0; + } + } +} + +@mixin mobile-menu-icon() { + @keyframes clickfirst { + 0% { + transform: translateY(6px) rotate(0deg); + + } + + 100% { + transform: translateY(0) rotate(45deg); + } + } + + @keyframes clickmid { + 0% { + opacity: 1; + } + + 100% { + opacity: 0; + } + } + + @keyframes clicklast { + 0% { + transform: translateY(-6px) rotate(0deg); + } + + 100% { + transform: translateY(0) rotate(-45deg); + } + } + + @keyframes outfirst { + 0% { + transform: translateY(0) rotate(-45deg); + } + + 100% { + transform: translateY(-6px) rotate(0deg); + } + } + + @keyframes outmid { + 0% { + opacity: 0; + } + + 100% { + opacity: 1; + } + } + + @keyframes outlast { + 0% { + transform: translateY(0) rotate(45deg); + } + + 100% { + transform: translateY(6px) rotate(0deg); + } + } + + span { + position: absolute; + left: calc((100% - 20px) / 2); + top: calc((100% - 1px) / 2); + width: 20px; + height: 1px; + background-color: $theme-color; + + &:nth-child(1) { + transform: translateY(6px) rotate(0deg); + } + + &:nth-child(3) { + transform: translateY(-6px) rotate(0deg); + } + } + + &.icon-click { + span:nth-child(1) { + animation-duration: 0.5s; + animation-fill-mode: both; + animation-name: clickfirst; + } + + span:nth-child(2) { + animation-duration: 0.2s; + animation-fill-mode: both; + animation-name: clickmid; + } + + span:nth-child(3) { + animation-duration: 0.5s; + animation-fill-mode: both; + animation-name: clicklast; + } + } + + &.icon-out { + span:nth-child(1) { + animation-duration: 0.5s; + animation-fill-mode: both; + animation-name: outfirst; + } + + span:nth-child(2) { + animation-duration: 0.2s; + animation-fill-mode: both; + animation-name: outmid; + } + + span:nth-child(3) { + animation-duration: 0.5s; + animation-fill-mode: both; + animation-name: outlast; + } + } +} \ No newline at end of file diff --git a/src/css/_common/_normalize.scss b/src/css/_common/_normalize.scss new file mode 100644 index 0000000..81c6f31 --- /dev/null +++ b/src/css/_common/_normalize.scss @@ -0,0 +1,427 @@ +/*! normalize.css v3.0.2 | MIT License | git.io/normalize */ + +/** + * 1. Set default font family to sans-serif. + * 2. Prevent iOS text size adjust after orientation change, without disabling + * user zoom. + */ + +html { + font-family: sans-serif; /* 1 */ + -ms-text-size-adjust: 100%; /* 2 */ + -webkit-text-size-adjust: 100%; /* 2 */ +} + +/** + * Remove default margin. + */ + +body { + margin: 0; +} + +/* HTML5 display definitions + ========================================================================== */ + +/** + * Correct `block` display not defined for any HTML5 element in IE 8/9. + * Correct `block` display not defined for `details` or `summary` in IE 10/11 + * and Firefox. + * Correct `block` display not defined for `main` in IE 11. + */ + +article, +aside, +details, +figcaption, +figure, +footer, +header, +hgroup, +main, +menu, +nav, +section, +summary { + display: block; +} + +/** + * 1. Correct `inline-block` display not defined in IE 8/9. + * 2. Normalize vertical alignment of `progress` in Chrome, Firefox, and Opera. + */ + +audio, +canvas, +progress, +video { + display: inline-block; /* 1 */ + vertical-align: baseline; /* 2 */ +} + +/** + * Prevent modern browsers from displaying `audio` without controls. + * Remove excess height in iOS 5 devices. + */ + +audio:not([controls]) { + display: none; + height: 0; +} + +/** + * Address `[hidden]` styling not present in IE 8/9/10. + * Hide the `template` element in IE 8/9/11, Safari, and Firefox < 22. + */ + +[hidden], +template { + display: none; +} + +/* Links + ========================================================================== */ + +/** + * Remove the gray background color from active links in IE 10. + */ + +a { + background-color: transparent; +} + +/** + * Improve readability when focused and also mouse hovered in all browsers. + */ + +a:active, +a:hover { + outline: 0; +} + +/* Text-level semantics + ========================================================================== */ + +/** + * Address styling not present in IE 8/9/10/11, Safari, and Chrome. + */ + +abbr[title] { + border-bottom: 1px dotted; +} + +/** + * Address style set to `bolder` in Firefox 4+, Safari, and Chrome. + */ + +b, +strong { + font-weight: bold; +} + +/** + * Address styling not present in Safari and Chrome. + */ + +dfn { + font-style: italic; +} + +/** + * Address variable `h1` font-size and margin within `section` and `article` + * contexts in Firefox 4+, Safari, and Chrome. + */ + +h1 { + font-size: 2em; + margin: 0.67em 0; +} + +/** + * Address styling not present in IE 8/9. + */ + +mark { + background: #ff0; + color: #000; +} + +/** + * Address inconsistent and variable font size in all browsers. + */ + +small { + font-size: 80%; +} + +/** + * Prevent `sub` and `sup` affecting `line-height` in all browsers. + */ + +sub, +sup { + font-size: 75%; + line-height: 0; + position: relative; + vertical-align: baseline; +} + +sup { + top: -0.5em; +} + +sub { + bottom: -0.25em; +} + +/* Embedded content + ========================================================================== */ + +/** + * Remove border when inside `a` element in IE 8/9/10. + */ + +img { + border: 0; +} + +/** + * Correct overflow not hidden in IE 9/10/11. + */ + +svg:not(:root) { + overflow: hidden; +} + +/* Grouping content + ========================================================================== */ + +/** + * Address margin not present in IE 8/9 and Safari. + */ + +figure { + margin: 1em 40px; +} + +/** + * Address differences between Firefox and other browsers. + */ + +hr { + -moz-box-sizing: content-box; + box-sizing: content-box; + height: 0; +} + +/** + * Contain overflow in all browsers. + */ + +pre { + overflow: auto; +} + +/** + * Address odd `em`-unit font size rendering in all browsers. + */ + +code, +kbd, +pre, +samp { + font-family: monospace, monospace; + font-size: 1em; +} + +/* Forms + ========================================================================== */ + +/** + * Known limitation: by default, Chrome and Safari on OS X allow very limited + * styling of `select`, unless a `border` property is set. + */ + +/** + * 1. Correct color not being inherited. + * Known issue: affects color of disabled elements. + * 2. Correct font properties not being inherited. + * 3. Address margins set differently in Firefox 4+, Safari, and Chrome. + */ + +button, +input, +optgroup, +select, +textarea { + color: inherit; /* 1 */ + font: inherit; /* 2 */ + margin: 0; /* 3 */ +} + +/** + * Address `overflow` set to `hidden` in IE 8/9/10/11. + */ + +button { + overflow: visible; +} + +/** + * Address inconsistent `text-transform` inheritance for `button` and `select`. + * All other form control elements do not inherit `text-transform` values. + * Correct `button` style inheritance in Firefox, IE 8/9/10/11, and Opera. + * Correct `select` style inheritance in Firefox. + */ + +button, +select { + text-transform: none; +} + +/** + * 1. Avoid the WebKit bug in Android 4.0.* where (2) destroys native `audio` + * and `video` controls. + * 2. Correct inability to style clickable `input` types in iOS. + * 3. Improve usability and consistency of cursor style between image-type + * `input` and others. + */ + +button, +html input[type="button"], /* 1 */ +input[type="reset"], +input[type="submit"] { + -webkit-appearance: button; /* 2 */ + cursor: pointer; /* 3 */ +} + +/** + * Re-set default cursor for disabled elements. + */ + +button[disabled], +html input[disabled] { + cursor: default; +} + +/** + * Remove inner padding and border in Firefox 4+. + */ + +button::-moz-focus-inner, +input::-moz-focus-inner { + border: 0; + padding: 0; +} + +/** + * Address Firefox 4+ setting `line-height` on `input` using `!important` in + * the UA stylesheet. + */ + +input { + line-height: normal; +} + +/** + * It's recommended that you don't attempt to style these elements. + * Firefox's implementation doesn't respect box-sizing, padding, or width. + * + * 1. Address box sizing set to `content-box` in IE 8/9/10. + * 2. Remove excess padding in IE 8/9/10. + */ + +input[type="checkbox"], +input[type="radio"] { + box-sizing: border-box; /* 1 */ + padding: 0; /* 2 */ +} + +/** + * Fix the cursor style for Chrome's increment/decrement buttons. For certain + * `font-size` values of the `input`, it causes the cursor style of the + * decrement button to change from `default` to `text`. + */ + +input[type="number"]::-webkit-inner-spin-button, +input[type="number"]::-webkit-outer-spin-button { + height: auto; +} + +/** + * 1. Address `appearance` set to `searchfield` in Safari and Chrome. + * 2. Address `box-sizing` set to `border-box` in Safari and Chrome + * (include `-moz` to future-proof). + */ + +input[type="search"] { + -webkit-appearance: textfield; /* 1 */ + -moz-box-sizing: content-box; + -webkit-box-sizing: content-box; /* 2 */ + box-sizing: content-box; +} + +/** + * Remove inner padding and search cancel button in Safari and Chrome on OS X. + * Safari (but not Chrome) clips the cancel button when the search input has + * padding (and `textfield` appearance). + */ + +input[type="search"]::-webkit-search-cancel-button, +input[type="search"]::-webkit-search-decoration { + -webkit-appearance: none; +} + +/** + * Define consistent border, margin, and padding. + */ + +fieldset { + border: 1px solid #c0c0c0; + margin: 0 2px; + padding: 0.35em 0.625em 0.75em; +} + +/** + * 1. Correct `color` not being inherited in IE 8/9/10/11. + * 2. Remove padding so people aren't caught out if they zero out fieldsets. + */ + +legend { + border: 0; /* 1 */ + padding: 0; /* 2 */ +} + +/** + * Remove default vertical scrollbar in IE 8/9/10/11. + */ + +textarea { + overflow: auto; +} + +/** + * Don't inherit the `font-weight` (applied by a rule above). + * NOTE: the default cannot safely be changed in Chrome and Safari on OS X. + */ + +optgroup { + font-weight: bold; +} + +/* Tables + ========================================================================== */ + +/** + * Remove most spacing between table cells. + */ + +table { + border-collapse: collapse; + border-spacing: 0; +} + +td, +th { + padding: 0; +} \ No newline at end of file diff --git a/src/css/_common/_utils.scss b/src/css/_common/_utils.scss new file mode 100644 index 0000000..1c7b777 --- /dev/null +++ b/src/css/_common/_utils.scss @@ -0,0 +1,23 @@ +@mixin clearfix() { + &:before, + &:after { + content: " "; + display: table; + } + + &:after { + clear: both; + } +} + +@mixin min-screen($min-width: $global-body-width) { + @media screen and (min-width: $min-width) { + @content; + } +} + +@mixin max-screen($max-width: $global-body-width) { + @media screen and (max-width: $max-width) { + @content; + } +} diff --git a/src/css/_custom/_custom.scss b/src/css/_custom/_custom.scss new file mode 100644 index 0000000..f7cbb5a --- /dev/null +++ b/src/css/_custom/_custom.scss @@ -0,0 +1,4 @@ +// ============================== +// Custom style +// ============================== +// You can override the variables in _variables.scss to customize the style diff --git a/src/css/_partial/_404.scss b/src/css/_partial/_404.scss new file mode 100644 index 0000000..63eb465 --- /dev/null +++ b/src/css/_partial/_404.scss @@ -0,0 +1,25 @@ +// ============================== +// Archive +// ============================= + +.not-found { + text-align: center; + + .error-emoji { + color: #363636; + font-size: 3rem; + } + + .error-text { + color: #797979; + font-size: 1.25rem; + } + + .error-link { + margin-top: 2rem; + + a { + color: $theme-color; + } + } +} \ No newline at end of file diff --git a/src/css/_partial/_archive.scss b/src/css/_partial/_archive.scss new file mode 100644 index 0000000..9019225 --- /dev/null +++ b/src/css/_partial/_archive.scss @@ -0,0 +1,101 @@ +// ============================== +// Archive +// ============================= + +.archive { + margin: $archive-margin; + max-width: $archive-max-width; + + .archive-title { + font-family: $global-serif-font-family; + + &.tag, + &.category { + margin: 15px 0; + } + + .archive-name { + margin: 0; + display: inline-block; + font-weight: 400; + font-size: $archive-name-font-size; + line-height: $archive-name-font-size + 2px; + } + + .archive-post-counter { + display: none; + color: $dark-gray; + } + } + + .collection-title { + font-family: $global-serif-font-family; + + .archive-year { + margin: 15px 0; + font-weight: 400; + font-size: $collection-title-font-size; + line-height: $collection-title-font-size + 2px; + } + } + + .archive-post { + padding: $archive-post-padding; + border-left: $archive-post-border-left; + + .archive-post-time { + margin-right: 10px; + color: $dark-gray; + } + + .archive-post-title { + + .archive-post-link { + color: $theme-color; + } + } + + &::first-child { + margin-top: 10px; + } + + &:hover { + border-left: $archive-post-hover-border-left; + transition: $archive-post-hover-transition; + transform: $archive-post-hover-transform; + + .archive-post-time { + color: darken($dark-gray, 10%); + } + + .archive-post-title .archive-post-link { + color: darken($theme-color, 10%); + } + } + } +} + +@include max-screen() { + .archive { + margin-left: auto; + margin-right: auto; + + .archive-title .archive-name { + font-size: $archive-name-font-size - 4px; + } + + .collection-title .archive-year { + margin: 10px 0; + font-size: $collection-title-font-size - 4px; + } + + .archive-post { + padding: $archive-post-mobile-padding; + + .archive-post-time { + font-size: $archive-post-mobile-time-font-size; + display: block; + } + } + } +} diff --git a/src/css/_partial/_back-to-top.scss b/src/css/_partial/_back-to-top.scss new file mode 100644 index 0000000..ee67aa2 --- /dev/null +++ b/src/css/_partial/_back-to-top.scss @@ -0,0 +1,24 @@ +// ============================== +// Back to top +// ============================= + +.back-to-top { + display: none; + position: fixed; + right: 20px; + bottom: 20px; + transition-property: transform; + transition-timing-function: ease-out; + transition-duration: 0.3s; + z-index: 10; + + &:hover { + transform: translateY(-5px); + } +} + +@include max-screen() { + .back-to-top { + display: none !important; + } +} \ No newline at end of file diff --git a/src/css/_partial/_categories.scss b/src/css/_partial/_categories.scss new file mode 100644 index 0000000..f9c413d --- /dev/null +++ b/src/css/_partial/_categories.scss @@ -0,0 +1,43 @@ + +.categories { + margin: 2em 0 3em; + text-align: center; + font-family: $global-serif-font-family; + + .categories-title { + display: inline-block; + font-size: $categories-title-size; + color: $theme-color; + border-bottom: $categories-title-border-bottom; + } + + .categories-tags { + margin: 10px 0; + + .category-link { + display: inline-block; + position: relative; + margin: $categories-tags-link-margin; + word-wrap: break-word; + transition-duration: 0.2s; + transition-property: transform; + transition-timing-function: ease-out; + + .category-count { + display: inline-block; + position: relative; + top: -8px; + right: -2px; + color: $theme-color; + font-size: $category-count-font-size; + } + + &:active, + &:focus, + &:hover { + color: $theme-color; + transform: scale(1.1); + } + } + } +} \ No newline at end of file diff --git a/src/css/_partial/_footer.scss b/src/css/_partial/_footer.scss new file mode 100644 index 0000000..1f8cdae --- /dev/null +++ b/src/css/_partial/_footer.scss @@ -0,0 +1,10 @@ +// ============================== +// Post footer +// ============================= + +.footer { + margin-top: $footer-margin-top; + + @import "_footer/social"; + @import "_footer/copyright"; +} \ No newline at end of file diff --git a/src/css/_partial/_footer/_copyright.scss b/src/css/_partial/_footer/_copyright.scss new file mode 100644 index 0000000..7d33fe3 --- /dev/null +++ b/src/css/_partial/_footer/_copyright.scss @@ -0,0 +1,23 @@ +// ============================== +// Copyright +// ============================= + +.copyright { + margin: $copyright-margin; + color: $dark-gray; + text-align: center; + font-family: $global-serif-font-family; + + .hexo-link, + .theme-link { + color: $theme-color; + } + + .copyright-year { + display: block; + + .heart { + font-size: 14px; + } + } +} \ No newline at end of file diff --git a/src/css/_partial/_footer/_social.scss b/src/css/_partial/_footer/_social.scss new file mode 100644 index 0000000..a23eb69 --- /dev/null +++ b/src/css/_partial/_footer/_social.scss @@ -0,0 +1,19 @@ +// ============================== +// Social +// ============================= + +.social-links { + text-align: center; + + .iconfont { + font-size: $social-icon-font-size; + + & + .iconfont { + margin-left: $social-link-margin-left; + } + + &:hover { + color: $theme-color; + } + } +} \ No newline at end of file diff --git a/src/css/_partial/_header.scss b/src/css/_partial/_header.scss new file mode 100644 index 0000000..d81f17c --- /dev/null +++ b/src/css/_partial/_header.scss @@ -0,0 +1,19 @@ +// ============================== +// Header +// ============================== + +.header { + @include clearfix; + padding: $header-padding; + + @import '_header/logo'; + @import '_header/menu'; +} + + +@include max-screen() { + .header { + padding: 50px 0 0; + text-align: center; + } +} diff --git a/src/css/_partial/_header/_logo.scss b/src/css/_partial/_header/_logo.scss new file mode 100644 index 0000000..cd6435f --- /dev/null +++ b/src/css/_partial/_header/_logo.scss @@ -0,0 +1,18 @@ +// ============================== +// Logo +// ============================= + +.logo-wrapper { + float: left; + + .logo { + font-size: $logo-font-size; + font-family: $logo-font-family; + } +} + +@include max-screen() { + .logo-wrapper { + display: none; + } +} diff --git a/src/css/_partial/_header/_menu.scss b/src/css/_partial/_header/_menu.scss new file mode 100644 index 0000000..7209c80 --- /dev/null +++ b/src/css/_partial/_header/_menu.scss @@ -0,0 +1,35 @@ +// ============================== +// Menu +// ============================= + +.site-navbar { + float: right; + + .menu { + display: inline-block; + position: relative; + padding-left: 0; + padding-right: 25px; + font-family: $global-serif-font-family; + + .menu-item { + display: inline-block; + + & + .menu-item { + margin-left: $menu-item-margin-left;; + } + + @include underline-from-center; + } + + .menu-item-link { + font-size: $menu-link-font-size; + } + } +} + +@include max-screen() { + .site-navbar { + display: none; + } +} diff --git a/src/css/_partial/_iconfont.scss b/src/css/_partial/_iconfont.scss new file mode 100644 index 0000000..3f3c794 --- /dev/null +++ b/src/css/_partial/_iconfont.scss @@ -0,0 +1,96 @@ +// ============================== +// Iconfont +// ============================== + +@font-face { + font-family: 'iconfont'; /* project id 96542 */ + src: url('//at.alicdn.com/t/font_96542_d5q5xyswt0kq33di.eot'); + src: url('//at.alicdn.com/t/font_96542_d5q5xyswt0kq33di.eot?#iefix') format('embedded-opentype'), + url('//at.alicdn.com/t/font_96542_d5q5xyswt0kq33di.woff') format('woff'), + url('//at.alicdn.com/t/font_96542_d5q5xyswt0kq33di.ttf') format('truetype'), + url('//at.alicdn.com/t/font_96542_d5q5xyswt0kq33di.svg#iconfont') format('svg'); +} + +.iconfont { + font-family: "iconfont" !important; + font-style: normal; + -webkit-font-smoothing: antialiased; + -webkit-text-stroke-width: 0.2px; + -moz-osx-font-smoothing: grayscale; + cursor: pointer; +} + +.icon-douban:before { + content: "\e610"; +} +.icon-tumblr:before { + content: "\e69f"; + font-size: .85em; + position: relative; + top: -4px; +} +.icon-linkedin:before { + content: "\e60d"; + position: relative; + top: -4px; +} +.icon-twitter:before { + content: "\e600"; +} +.icon-weibo:before { + content: "\e602"; +} +.icon-stack-overflow:before { + content: "\e603"; + font-size: .85em; + position: relative; + top: -4px; +} +.icon-email:before { + content: "\e605"; + position: relative; + top: -2px; +} +.icon-facebook:before { + content: "\e601"; + font-size: .95em; + position: relative; + top: -2px; +} +.icon-github:before { + content: "\e606"; + position: relative; + top: -3px; +} +.icon-rss:before { + content: "\e604"; +} +.icon-google:before { + content: "\e609"; +} +.icon-zhihu:before { + content: "\e607"; + font-size: .9em; + position: relative; + top: -2px; +} +.icon-pocket:before { + content: "\e856"; +} + +/* Generic Icon */ +.icon-heart:before { + content: "\e608"; +} +.icon-right:before { + content: "\e60a"; +} +.icon-left:before { + content: "\e60b"; +} +.icon-up:before { + content: "\e60c"; +} +.icon-close:before { + content: "\e60f"; +} diff --git a/src/css/_partial/_mobile.scss b/src/css/_partial/_mobile.scss new file mode 100644 index 0000000..26e4c76 --- /dev/null +++ b/src/css/_partial/_mobile.scss @@ -0,0 +1,77 @@ +// ============================== +// Mobile Navbar +// ============================== + +.mobile-navbar { + display: none; + position: fixed; + top: 0; + left: 0; + width: 100%; + height: $mobile-navbar-height; + background: $white; + box-shadow: 0px 2px 2px $gray; + text-align: center; + transition: transform 300ms ease; + z-index: 99; + + &.fixed-open { + transform: translate3d(180px, 0px, 0px); + } + + .mobile-header-logo { + display: inline-block; + margin-right: 50px; + + .logo { + font-size: 22px; + line-height: $mobile-navbar-height; + font-family: $logo-font-family; + } + } + + .mobile-navbar-icon { + color: $theme-color; + height: $mobile-navbar-height; + width: $mobile-navbar-height; + font-size: 24px; + text-align: center; + float: left; + position: relative; + transition: background 0.5s; + + @include mobile-menu-icon(); + } +} + +.mobile-menu { + background-color: rgba($deputy-color, 0.5); + + .mobile-menu-list { + position: relative; + list-style: none; + margin-top: 50px; + padding: 0; + border-top: 1px solid $deputy-color; + + .mobile-menu-item { + padding: 10px 30px; + border-bottom: 1px solid $deputy-color; + } + + a { + font-size: 18px; + font-family: $global-serif-font-family; + + &:hover { + color: $theme-color; + } + } + } +} + +@include max-screen() { + .mobile-navbar { + display: block; + } +} diff --git a/src/css/_partial/_pagination.scss b/src/css/_partial/_pagination.scss new file mode 100644 index 0000000..c58f8db --- /dev/null +++ b/src/css/_partial/_pagination.scss @@ -0,0 +1,36 @@ +// ============================== +// Pagination +// ============================== + +.pagination { + margin: $pagination-margin; + @include clearfix; + + .prev, + .next { + font-weight: 600; + font-size: $pagination-font-size; + font-family: $global-serif-font-family; + transition-property: transform; + transition-timing-function: ease-out; + transition-duration: 0.3s; + } + + .prev { + float: left; + + &:hover { + color: $theme-color; + transform: translateX(-4px); + } + } + + .next { + float: right; + + &:hover { + color: $theme-color; + transform: translateX(4px); + } + } +} \ No newline at end of file diff --git a/src/css/_partial/_post.scss b/src/css/_partial/_post.scss new file mode 100644 index 0000000..4109d95 --- /dev/null +++ b/src/css/_partial/_post.scss @@ -0,0 +1,23 @@ +// ============================== +// Post +// ============================== + +.posts { + margin-bottom: $post-list-margin-bottom; + border-bottom: $post-border; +} + +.post { + padding: $post-padding; + + & + .post { + border-top: $post-border; + } + + @import '_post/header'; + @import '_post/toc'; + @import '_post/content'; + @import '_post/copyright'; + @import '_post/reward'; + @import '_post/footer'; +} \ No newline at end of file diff --git a/src/css/_partial/_post/_code.scss b/src/css/_partial/_post/_code.scss new file mode 100644 index 0000000..ff4439f --- /dev/null +++ b/src/css/_partial/_post/_code.scss @@ -0,0 +1,177 @@ +code, pre { + padding: 7px; + font-size: $code-font-size; + font-family: $code-font-family; + background: $code-background; +} + +code { + padding: 3px 5px; + border-radius: 4px; + color: $code-color; +} + +.highlight { + margin: 1em 0; + border-radius: 5px; + overflow-x: auto; + box-shadow: 1px 1px 2px rgba(0,0,0,0.125); + position: relative; + + table { + position: relative; + + &::after { + position: absolute; + top: 0; + right: 0; + left: 0; + padding: 2px 7px; + font-size: $code-font-size; + font-weight: bold; + color: darken($gray, 10%); + background: darken($code-background, 3%); + content: 'Code'; + } + } + + @each $sign, $text in $code-type-list { + &.#{$sign} > table::after { + content: $text; + } + + &.#{$sign} > figcaption > span::after { + content: ' · ' + $text; + } + + &.#{$sign} figcaption + table { + &::after { + display: none; + } + } + } + + figcaption { + position: absolute; + top: 0; + width: 100%; + padding: 2px 7px; + font-size: $code-font-size; + font-weight: bold; + color: darken($gray, 10%); + background: darken($code-background, 3%); + z-index: 20; + overflow-x: hidden; + box-sizing: border-box; + + & > a { + position: absolute; + right: 0; + display: inline-box; + margin-right: 7px; + font-weight: 400; + + &:hover { + text-decoration: none; + border: 0; + } + } + } + + .code { + pre { + margin: 0; + padding: 30px 10px 10px; + } + } + + .gutter { + width: 10px; + color: $gray; + + pre { + margin: 0; + padding: 30px 7px 10px; + } + } + + .line { + // Fix code block null line height and + // Synchronous gutter and code line highly. + height: round($code-font-size * 1.5); + } + + table, tr, td { + margin: 0; + padding: 0; + width: 100%; + border-collapse: collapse; + } + + .code { + .hljs-comment, + .hljs-quote { + color: map-get($code-highlight-color, comment); + } + + .hljs-keyword, + .hljs-selector-tag, + .hljs-addition { + color: map-get($code-highlight-color, keyword); + } + + .hljs-number, + .hljs-string, + .hljs-meta .hljs-meta-string, + .hljs-literal, + .hljs-doctag, + .hljs-regexp { + color: map-get($code-highlight-color, number); + } + + .hljs-title, + .hljs-section, + .hljs-name, + .hljs-selector-id, + .hljs-selector-class { + color: map-get($code-highlight-color, title); + } + + .hljs-attribute, + .hljs-attr, + .hljs-variable, + .hljs-template-variable, + .hljs-class .hljs-title, + .hljs-type { + color: map-get($code-highlight-color, attribute); + } + + .hljs-symbol, + .hljs-bullet, + .hljs-subst, + .hljs-meta, + .hljs-meta .hljs-keyword, + .hljs-selector-attr, + .hljs-selector-pseudo, + .hljs-link { + color: map-get($code-highlight-color, symbol); + } + + .hljs-built_in, + .hljs-deletion { + color: map-get($code-highlight-color, built_in); + } + + .hljs-formula { + background: map-get($code-highlight-color, formula); + } + + .hljs-emphasis { + font-style: italic; + } + + .hljs-strong { + font-weight: bold; + } + } +} diff --git a/src/css/_partial/_post/_content.scss b/src/css/_partial/_post/_content.scss new file mode 100644 index 0000000..d680762 --- /dev/null +++ b/src/css/_partial/_post/_content.scss @@ -0,0 +1,101 @@ +// ============================== +// Post content +// ============================== + +.post-content { + word-wrap: break-word; + + @for $i from 1 through 6 { + h#{$i} { + font-weight: 400; + font-family: $global-serif-font-family; + } + } + + a { + color: $theme-color; + word-break: break-all; + + &:hover { + border-bottom: $content-link-border; + } + + &.fancybox { + border: 0; + } + } + + blockquote { + margin: 2em 0; + padding: 10px 20px; + position: relative; + color: rgba(#34495e, 0.8); + background-color: $content-blockquote-backgroud; + border-left: $content-blockquote-border-left; + box-shadow: 1px 1px 2px rgba(0,0,0,0.125); + + p { + margin: 0; + } + } + + img { + display: inline-block; + max-width: 100%; + } + + > table { + max-width: 100%; + margin: 10px 0; + border-spacing: 0; + box-shadow: 2px 2px 3px rgba(0,0,0,.125); + + th, td { + padding: 5px 15px; + border: 1px double $content-table-border-color; + } + } + + @import 'code'; + + .read-more { + .read-more-link { + color: $theme-color; + font-size: 1.1em; + font-family: $global-serif-font-family; + + &:hover { + border-bottom: $post-readMore-border-bottom; + } + } + } + + kbd { + display: inline-block; + padding: 0.25em; + background-color: #fafafa; + border: 1px solid #dbdbdb; + border-bottom-color: #b5b5b5; + border-radius: 3px; + box-shadow: inset 0 -1px 0 #b5b5b5; + font-size: 0.8em; + line-height: 1.25; + font-family: "SFMono-Regular","Liberation Mono","Roboto Mono",Menlo,Monaco,Consolas,"Courier New",Courier,monospace; + color: #4a4a4a; + } + + dl dt::after { + content: ':'; + } + + figure figcaption h4 { + color: #b5b5b5; + font-size: 0.9rem; + text-align: center; + } + + .task-list { + list-style: none; + padding-left: 1.5rem; + } +} diff --git a/src/css/_partial/_post/_copyright.scss b/src/css/_partial/_post/_copyright.scss new file mode 100644 index 0000000..29ac0c7 --- /dev/null +++ b/src/css/_partial/_post/_copyright.scss @@ -0,0 +1,17 @@ +.post-copyright { + margin-top: 20px; + padding-top: 10px; + border-top: 1px dashed $light-gray; + + .copyright-item { + margin: 5px 0; + + &.lincese { + font-weight: bold; + } + + a { + text-decoration: underline; + } + } +} diff --git a/src/css/_partial/_post/_footer.scss b/src/css/_partial/_post/_footer.scss new file mode 100644 index 0000000..012110f --- /dev/null +++ b/src/css/_partial/_post/_footer.scss @@ -0,0 +1,74 @@ +// ============================== +// Post footer +// ============================== + +.post-footer { + margin-top: $post-footer-margin-top; + border-top: $post-footer-border-top; + font-family: $global-serif-font-family; + + .post-tags { + padding: $post-tags-padding; + + a { + margin-right: 5px; + color: $theme-color; + word-break: break-all; + + &::before { + content: '#'; + } + } + } + + .post-nav { + margin: 1em 0; + @include clearfix; + + .prev, + .next { + font-weight: 600; + font-size: $post-nav-font-size; + font-family: $global-serif-font-family; + transition-property: transform; + transition-timing-function: ease-out; + transition-duration: 0.3s; + } + + .prev { + float: left; + + &:hover { + color: $theme-color; + transform: translateX(-4px); + } + } + + .next { + float: right; + + &:hover { + color: $theme-color; + transform: translateX(4px); + } + } + + .nav-mobile { + display: none; + } + } +} + +@include max-screen() { + .post-footer { + .post-nav { + .nav-default { + display: none; + } + + .nav-mobile { + display: inline; + } + } + } +} \ No newline at end of file diff --git a/src/css/_partial/_post/_header.scss b/src/css/_partial/_post/_header.scss new file mode 100644 index 0000000..c9ac667 --- /dev/null +++ b/src/css/_partial/_post/_header.scss @@ -0,0 +1,39 @@ +.post-header { + margin-bottom: 20px; + + .post-title { + margin: 0; + font-size: $post-title-font-size; + font-weight: $post-title-font-weight; + font-family: $global-serif-font-family; + } + + .post-link { + @include underline-from-center; + } + + .post-meta { + .post-time { + font-size: 15px; + color: $post-time-font-color; + } + + .post-category { + display: inline; + font-size: 14px; + color: $post-category-font-color; + + &::before { + content: '·'; + } + + a { + color: inherit; + + &:hover { + color: $theme-color; + } + } + } + } +} diff --git a/src/css/_partial/_post/_reward.scss b/src/css/_partial/_post/_reward.scss new file mode 100644 index 0000000..55728e7 --- /dev/null +++ b/src/css/_partial/_post/_reward.scss @@ -0,0 +1,48 @@ +.post-reward { + margin-top: 20px; + padding-top: 10px; + text-align: center; + border-top: 1px dashed $light-gray; + + .reward-button { + margin: 15px 0; + padding: 3px 7px; + display: inline-block; + color: $theme-color; + border: 1px solid $theme-color; + border-radius: 5px; + cursor: pointer; + + &:hover { + color: $white; + background-color: $theme-color; + transition: 0.5s; + } + } + + #reward:checked { + & ~ .qr-code { + display: block; + } + + & ~ .reward-button { + display: none; + } + } + + .qr-code { + display: none; + margin-top: 15px; + + .qr-code-image { + display: inline-block; + min-width: 200px; + width: 40%; + } + + .image { + width: 200px; + height: 200px; + } + } +} \ No newline at end of file diff --git a/src/css/_partial/_post/_toc.scss b/src/css/_partial/_post/_toc.scss new file mode 100644 index 0000000..b5958c0 --- /dev/null +++ b/src/css/_partial/_post/_toc.scss @@ -0,0 +1,46 @@ +.post-toc { + position: absolute; + width: $post-toc-width; + margin-left: $post-toc-margin-left; + padding: 10px; + font-family: $global-serif-font-family; + border-radius: 5px; + background: $post-toc-backgroud; + box-shadow: 1px 1px 2px rgba(0,0,0,0.125); + word-wrap: break-word; + box-sizing: border-box; + + .post-toc-title { + margin: 0 10px; + font-size: $post-toc-title-size; + font-weight: 400; + text-transform: uppercase; + } + + .post-toc-content { + font-size: $post-toc-content; + + >nav>ul { + margin: 10px 0; + } + + ul { + padding-left: 20px; + list-style: $post-toc-list-style; + + ul { + padding-left: 15px; + } + } + + .toc-link.active { + color: $theme-color; + } + } +} + +@include max-screen($toc-max-sreen-width) { + .post-toc { + display: none; + } +} diff --git a/src/css/_partial/_slideout.scss b/src/css/_partial/_slideout.scss new file mode 100644 index 0000000..2dc757d --- /dev/null +++ b/src/css/_partial/_slideout.scss @@ -0,0 +1,33 @@ +// ============================== +// slideout (https://github.com/mango/slideout) +// ============================== + +.slideout-menu { + position: fixed; + top: 0; + left: 0px; + bottom: 0; + width: 180px; + min-height: 100vh; + overflow-y: hidden; + -webkit-overflow-scrolling: touch; + z-index: 0; + display: none; +} + +.slideout-panel { + position: relative; + z-index: 1; + background-color: $white; + min-height: 100vh; +} + +.slideout-open, +.slideout-open body, +.slideout-open .slideout-panel { + overflow: hidden; +} + +.slideout-open .slideout-menu { + display: block; +} diff --git a/src/css/_partial/_tags.scss b/src/css/_partial/_tags.scss new file mode 100644 index 0000000..e32a90e --- /dev/null +++ b/src/css/_partial/_tags.scss @@ -0,0 +1,46 @@ +// ============================== +// Tags +// ============================= + +.tag-cloud { + margin: 2em 0 3em; + text-align: center; + font-family: $global-serif-font-family; + + .tag-cloud-title { + display: inline-block; + font-size: $tag-cloud-title-size; + color: $theme-color; + border-bottom: $tag-cloud-title-border-bottom; + } + + .tag-cloud-tags { + margin: 10px 0; + + a { + display: inline-block; + position: relative; + margin: $tag-cloud-tags-link-margin; + word-wrap: break-word; + transition-duration: 0.2s; + transition-property: transform; + transition-timing-function: ease-out; + + .tag-count { + display: inline-block; + position: relative; + top: -8px; + right: -2px; + color: $theme-color; + font-size: $category-count-font-size; + } + + &:active, + &:focus, + &:hover { + color: $theme-color; + transform: scale(1.1); + } + } + } +} \ No newline at end of file diff --git a/src/css/_variables.scss b/src/css/_variables.scss new file mode 100644 index 0000000..07b78e5 --- /dev/null +++ b/src/css/_variables.scss @@ -0,0 +1,343 @@ +// ============================== +// Variables +// ============================== + +// ========== Theme Color ========== // +// Config here to change theme color +// Default | Mint Green | Cobalt Blue | Hot Pink | Dark Violet +$theme-color-config: 'Default'; + +// Default theme color map +$theme-color-map: ( + 'Default': #c05b4d #f8f5ec, + 'Mint Green': #16982B #f5f5f5, + 'Cobalt Blue': #0047AB #f0f2f5, + 'Hot Pink': #FF69B4 #f8f5f5, + 'Dark Violet': #9932CC #f5f4fa +); + +// Check theme color config. +// if it does not exist, use default theme color. +@if not(map-has-key($theme-color-map, $theme-color-config)) { + $theme-color-config: 'Default'; +} +$theme-color-list: map-get($theme-color-map, $theme-color-config); + +// Default theme color of the site. +$theme-color: nth($theme-color-list, 1) !default; + +// Deputy theme color of the site. +$deputy-color: nth($theme-color-list, 2) !default; + + +// ========== Color ========== // +$black: #0a0a0a !default; +$white: #fefefe !default; +$light-gray: #e6e6e6 !default; +$gray: #cacaca !default; +$dark-gray: #8a8a8a !default; + + +// ========== Global ========== // +// Text color of the body. +$global-font-color: #34495e !default; + +// Font size attribute applied to '' and ''. +$global-font-size: 16px !default; + +// Global width of ''. +$global-body-width: 800px !default; + +// Padding of container main +$global-container-padding: 0 20px !default; + +// Default line height for all type. `$global-lineheight` is 24px while `$global-font-size` is 16px. +$global-lineheight: 1.5 !default; + +// Font family of the site. +$global-font-family: 'Source Sans Pro', 'Helvetica Neue', Arial, sans-serif !default; + +// Serif font family of the site. +$global-serif-font-family: Athelas, STHeiti, Microsoft Yahei, serif !default; + +// Background color of the site. +$global-background: $white !default; + +// Headings font size of the site. +$global-headings: ( + h1: 26px, + h2: 24px, + h3: 20px, + h4: 16px, + h5: 14px, + h6: 14px +) !default; + + +// ========== Header ========== // +// Padding of the site header. +$header-padding: 20px 20px !default; + +// Font family: Chancery +@font-face { + font-family: 'Chancery'; + src: url('../fonts/chancery/apple-chancery-webfont.eot'); + src: local('Apple Chancery'), url('../fonts/chancery/apple-chancery-webfont.eot?#iefix') format('embedded-opentype'), + url('../fonts/chancery/apple-chancery-webfont.woff2') format('woff2'), + url('../fonts/chancery/apple-chancery-webfont.woff') format('woff'), + url('../fonts/chancery/apple-chancery-webfont.ttf') format('truetype'), + url('../fonts/chancery/apple-chancery-webfont.svg#apple-chancery') format('svg'); + font-weight: lighter; + font-style: normal; +} + +// Font size of the logo. +$logo-font-size: 48px !default; + +// Font family of the logo. +$logo-font-family: 'Chancery', cursive, LiSu, sans-serif !default; + +// Margin of menu item. +$menu-item-margin-left: 10px !default; + +// Margin of menu item in mobile. +$menu-item-mobile-margin: 5px !default; + +// Font size of menu item link. +$menu-link-font-size: 18px !default; + +// Height of the mobile header. +$mobile-navbar-height: 50px !default; + +// ========== Post ========== // +// Margin bottom of post list. +$post-list-margin-bottom: 20px !default; + +// Padding of the post. +$post-padding: 1.5em 0 !default; + +// Border top of the post + post. +$post-border: 1px solid $light-gray !default; + +// Font size of post title. +$post-title-font-size: 27px !default; + +// Font weight of post title. +$post-title-font-weight: 400 !default; + +// Margin top of the post meta (post time). +$post-meta-margin-top: 5px !default; + +// Font color of the post time. +$post-time-font-color: $dark-gray !default; + +// Font color of the post category +$post-category-font-color: $dark-gray !default; + +// Border bottom of the read more link when hover it. +$post-readMore-border-bottom: 1px solid $theme-color !default; + +// Margin top of the post footer. +$post-footer-margin-top: 20px !default; + +// Border top of post footer. +$post-footer-border-top: 1px solid $light-gray !default; + +// Padding of the post tags. +$post-tags-padding: 15px 0 !default; + +// Font size of post pagination. +$post-nav-font-size: 18px !default; + + +// ========== TOC ========== // +// Width of the post toc. +$post-toc-width: 200px !default; + +// Backgroud color of the post toc. +$post-toc-backgroud: rgba($deputy-color, 0.6) !default; + +// Margin left of the post toc. +$post-toc-margin-left: $global-body-width - 15px !default; + +// Font size of the post toc title. +$post-toc-title-size: 20px !default; + +// Font size of the post toc content. +$post-toc-content: 15px !default; + +// List style of the post toc list. +$post-toc-list-style: square !default; + +// Max screen media of the post toc. +$toc-max-sreen-width: 2 * $post-toc-width + $post-toc-margin-left !default; + +// ========== Content ========== // +// Headings anchor. +$content-headings-anchor: "" !default; + +// Border bottom of the link when hover it. +$content-link-border: 1px solid $theme-color !default; + +// Background color of the blockquote. +$content-blockquote-backgroud: rgba($theme-color, 0.05) !default; + +// Border left of the blockquote. +$content-blockquote-border-left: 3px solid rgba($theme-color, 0.3) !default; + +// Border color of the table. +$content-table-border-color: darken($deputy-color, 3%) !default; + +// ========== Code ========== // +// Color of the code. +$code-color: #c7254e !default; + +// Font size of code. +$code-font-size: 13px !default; + +// Font family of the code. +$code-font-family: Consolas, Monaco, Menlo, Consolas, monospace !default; + +// Color of code highlight, solarized. +$code-highlight-color: ( + comment: #93a1a1, + keyword: #859900, + number: #2aa198, + title: #268bd2, + attribute: #b58900, + symbol: #cb4b16, + built_in: #dc322f, + formula: #eee8d5 +) !default; + +// Code type list. +$code-type-list: ( + // Custom code type + language-html: "HTML", + language-coffeescript: "Coffeescript", + language-makefile: "Makefile", + language-markdown: "Markdown", + language-js: "JavaScript", + language-javascript: "JavaScript", + language-bash: "Bash", + language-css: "CSS", + language-java: "Java", + language-xml: "XML", + language-python: "Python", + language-json: "JSON", + language-ruby: "Ruby", + language-php: "PHP", + language-c: "C", + language-cpp: "C++", + language-cs: "C#", + language-objectivec: "Objective-C", + language-sql: "SQL", + language-http: "HTTP", + language-shell: "Shell", + + language-clojure: "Clojure", + language-elm: "elm", + language-erlang: "Erlang", + language-go: "Go", + language-groovy: "Groovy", + language-handlebars: "Handlebars", + language-haskell: "Haskell", + language-less: "Less", + language-lisp: "Lisp", + language-lua: "Lua", + language-matlab: "Matlab", + language-prolog: "Prolog", + language-rust: "Rust", + language-scss: "Scss", + language-scala: "Scala", + language-scheme: "Scheme", + language-stylus: "Stylus", + language-swift: "Swift", + language-typescript: "Typescript", + language-yml: "YAML", + language-yaml: "YAML", + language-toml: "TOML" +) !default; + +// Color of the code background. +$code-background: $deputy-color !default; + + +// ========== Pagination ========== // +// Margin of the pagination. +$pagination-margin: 2em 0 !default; + +// Font size of the pagination (Without post, post pagination see line 140). +$pagination-font-size: 20px !default; + + +// ========== Footer ========== // +// Margin top of the footer. +$footer-margin-top: 2em !default; + +// Margin left of the social link. +$social-link-margin-left: 10px !default; + +// Font size of the social icon. +$social-icon-font-size: 30px !default; + +// Margin of the copyright. +$copyright-margin: 10px 0 !default; + + +// ========== Archive ========== // +// Margin of the archive. +$archive-margin: 2em 0px !default; + +// Max width of the archive. +$archive-max-width: 550px !default; + +// Font size of the archive name. +$archive-name-font-size: 30px !default; + +// Font size of the collection title. +$collection-title-font-size: 28px !default; + +// Padding of the archive post. +$archive-post-padding: 3px 20px !default; + +// Padding of the archive post in mobile. +$archive-post-mobile-padding: 5px 10px !default; + +// Font size of the archive post time in mobile. +$archive-post-mobile-time-font-size: 13px !default; + +// Border left of the archive post, use $archive-post-hover-border-left when hover it. +$archive-post-border-left: 1px solid $gray !default; +$archive-post-hover-border-left: 3px solid $theme-color !default; + +// Transition of the archive post when hover it. +$archive-post-hover-transition: 0.2s ease-out !default; + +// Transform of the archive post when hover it. +$archive-post-hover-transform: translateX(4px) !default; + + +// ========== Tags ========== // +// Font soze of the tag cloud title. +$tag-cloud-title-size: 18px !default; + +// Border bottom of the tag cloud title. +$tag-cloud-title-border-bottom: 2px solid $theme-color !default; + +// Margin of the tag cloud tags link. +$tag-cloud-tags-link-margin: 5px 10px !default; + + +// ========== Categories ========== // +// Font soze of the categories title. +$categories-title-size: 18px !default; + +// Border bottom of the categories title. +$categories-title-border-bottom: 2px solid $theme-color !default; + +// Margin of the categories tags link. +$categories-tags-link-margin: 5px 10px !default; + +// Font size of the category count +$category-count-font-size: 12px !default; diff --git a/src/css/style.scss b/src/css/style.scss new file mode 100644 index 0000000..ac08217 --- /dev/null +++ b/src/css/style.scss @@ -0,0 +1,19 @@ +@import "_custom/custom"; +@import "_variables"; + +@import "_common/utils"; +@import "_common/animation"; + +@import "_base"; +@import "_partial/header"; +@import "_partial/post"; +@import "_partial/pagination"; +@import "_partial/footer"; +@import "_partial/archive"; +@import "_partial/tags"; +@import "_partial/categories"; +@import "_partial/iconfont"; +@import "_partial/slideout"; +@import "_partial/mobile"; +@import "_partial/back-to-top"; +@import "_partial/404"; diff --git a/src/fonts/chancery/apple-chancery-webfont.eot b/src/fonts/chancery/apple-chancery-webfont.eot new file mode 100644 index 0000000..39c3936 Binary files /dev/null and b/src/fonts/chancery/apple-chancery-webfont.eot differ diff --git a/src/fonts/chancery/apple-chancery-webfont.svg b/src/fonts/chancery/apple-chancery-webfont.svg new file mode 100644 index 0000000..2b18b6a --- /dev/null +++ b/src/fonts/chancery/apple-chancery-webfont.svg @@ -0,0 +1,228 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/src/fonts/chancery/apple-chancery-webfont.ttf b/src/fonts/chancery/apple-chancery-webfont.ttf new file mode 100644 index 0000000..8238aa4 Binary files /dev/null and b/src/fonts/chancery/apple-chancery-webfont.ttf differ diff --git a/src/fonts/chancery/apple-chancery-webfont.woff b/src/fonts/chancery/apple-chancery-webfont.woff new file mode 100644 index 0000000..e476776 Binary files /dev/null and b/src/fonts/chancery/apple-chancery-webfont.woff differ diff --git a/src/fonts/chancery/apple-chancery-webfont.woff2 b/src/fonts/chancery/apple-chancery-webfont.woff2 new file mode 100644 index 0000000..922dfb3 Binary files /dev/null and b/src/fonts/chancery/apple-chancery-webfont.woff2 differ diff --git a/src/js/even.js b/src/js/even.js new file mode 100644 index 0000000..5538661 --- /dev/null +++ b/src/js/even.js @@ -0,0 +1,167 @@ +'use strict' + +var Even = {} + +Even.backToTop = function () { + var $backToTop = $('#back-to-top') + + $(window).scroll(function () { + if ($(window).scrollTop() > 100) { + $backToTop.fadeIn(1000) + } else { + $backToTop.fadeOut(1000) + } + }) + + $backToTop.click(function () { + $('body,html').animate({ scrollTop: 0 }) + }) +} + +Even.mobileNavbar = function () { + var $mobileNav = $('#mobile-navbar') + var $mobileNavIcon = $('.mobile-navbar-icon') + var slideout = new Slideout({ + 'panel': document.getElementById('mobile-panel'), + 'menu': document.getElementById('mobile-menu'), + 'padding': 180, + 'tolerance': 70 + }) + slideout.disableTouch() + + $mobileNavIcon.click(function () { + slideout.toggle() + }) + + slideout.on('beforeopen', function () { + $mobileNav.addClass('fixed-open') + $mobileNavIcon.addClass('icon-click').removeClass('icon-out') + }) + + slideout.on('beforeclose', function () { + $mobileNav.removeClass('fixed-open') + $mobileNavIcon.addClass('icon-out').removeClass('icon-click') + }) + + $('#mobile-panel').on('touchend', function () { + slideout.isOpen() && $mobileNavIcon.click() + }) +} + +Even.toc = function () { + var SPACING = 20 + var $toc = $('.post-toc') + var $footer = $('.post-footer') + + if ($toc.length) { + var minScrollTop = $toc.offset().top - SPACING + var maxScrollTop = $footer.offset().top - $toc.height() - SPACING + + var tocState = { + start: { + 'position': 'absolute', + 'top': minScrollTop + }, + process: { + 'position': 'fixed', + 'top': SPACING + }, + end: { + 'position': 'absolute', + 'top': maxScrollTop + } + } + + $(window).scroll(function () { + var scrollTop = $(window).scrollTop() + + if (scrollTop < minScrollTop) { + $toc.css(tocState.start) + } else if (scrollTop > maxScrollTop) { + $toc.css(tocState.end) + } else { + $toc.css(tocState.process) + } + }) + } + + var HEADERFIX = 30 + var $toclink = $('.toc-link') + var $headerlink = $('.headerlink') + + var headerlinkTop = $.map($headerlink, function (link) { + return $(link).offset().top + }) + + $(window).scroll(function () { + var scrollTop = $(window).scrollTop() + + for (var i = 0; i < $toclink.length; i++) { + var isLastOne = i + 1 === $toclink.length + var currentTop = headerlinkTop[i] - HEADERFIX + var nextTop = isLastOne ? Infinity : headerlinkTop[i + 1] - HEADERFIX + + if (currentTop < scrollTop && scrollTop <= nextTop) { + $($toclink[i]).addClass('active') + } else { + $($toclink[i]).removeClass('active') + } + } + }) +} + +Even.fancybox = function () { + if ($.fancybox) { + $('.post').each(function () { + $(this).find('img').each(function () { + $(this).wrap('') + }) + }) + + $('.fancybox').fancybox({ + openEffect: 'elastic', + closeEffect: 'elastic' + }) + } +} + +Even.highlight = function () { + const blocks = document.querySelectorAll('pre code') + for (const block of blocks) { + const classList = block.classList + const rootElement = block.parentElement + const lineCodes = block.innerHTML.split(/\n/).slice(0, -1) + const lineLength = lineCodes.length + + let codeLineHtml = '' + for (let i = 0; i < lineLength; i++) { + codeLineHtml += `
${i + 1}
` + } + + let codeHtml = '' + for (const lineCode of lineCodes) { + codeHtml += `
${lineCode}
` + } + + classList.add('highlight') + const figure = document.createElement('figure') + figure.classList = classList + figure.innerHTML = `
${codeLineHtml}
${codeHtml}
` + + rootElement.parentElement.replaceChild(figure, rootElement) + } +} + +Even.beforeToc = function () { + const links = document.querySelectorAll('#TableOfContents a') + for (const link of links) link.classList.add('toc-link') + + for (const num of [1, 2, 3, 4, 5, 6]) { + const headers = document.querySelectorAll('.post-content>h' + num) + for (const header of headers) { + header.innerHTML = `${header.innerHTML}` + } + } +} + +export {Even} diff --git a/src/js/main.js b/src/js/main.js new file mode 100644 index 0000000..f3531b7 --- /dev/null +++ b/src/js/main.js @@ -0,0 +1,14 @@ +import {Even} from './even.js' + +import '../css/style.scss' + +hljs.initHighlighting() +Even.highlight() + +$(document).ready(function () { + Even.backToTop() + Even.mobileNavbar() + Even.beforeToc() + Even.toc() + Even.fancybox() +}) diff --git a/src/package.json b/src/package.json new file mode 100644 index 0000000..5fd8f87 --- /dev/null +++ b/src/package.json @@ -0,0 +1,28 @@ +{ + "name": "even-src", + "version": "1.0.0", + "description": "even source file", + "main": "index.js", + "scripts": { + "start": "webpack" + }, + "author": "ahonn, olOwOlo", + "license": "MIT", + "devDependencies": { + "babel-core": "^6.26.0", + "babel-loader": "^7.1.2", + "babel-plugin-transform-runtime": "^6.23.0", + "babel-preset-es2015": "^6.24.1", + "babel-preset-stage-2": "^6.24.1", + "css-loader": "^0.28.5", + "expose-loader": "^0.7.3", + "extract-text-webpack-plugin": "^3.0.0", + "file-loader": "^0.11.2", + "node-sass": "^4.5.3", + "sass-loader": "^6.0.6", + "style-loader": "^0.18.2", + "uglifyjs-webpack-plugin": "^0.4.6", + "url-loader": "^0.5.9", + "webpack": "^3.5.5" + } +} diff --git a/src/webpack.config.js b/src/webpack.config.js new file mode 100644 index 0000000..5132b33 --- /dev/null +++ b/src/webpack.config.js @@ -0,0 +1,56 @@ +const path = require('path'); +const ExtractTextPlugin = require("extract-text-webpack-plugin"); +const UglifyJSPlugin = require('uglifyjs-webpack-plugin') + +// theme version +const version = 'v2.5.0' + +const extractSass = new ExtractTextPlugin({ + filename: `even.${version}.css` +}); + +module.exports = { + devtool: 'source-map', + entry: { + even: './js/main.js' + }, + output: { + path: path.join(__dirname, '../static/dist'), + filename: `[name].${version}.js` + }, + module: { + rules: [ + { + test: /\.js$/, + exclude: /node_modules/, + loader: 'babel-loader' + }, + { + test: /\.scss$/, + use: extractSass.extract({ + use: [{ + loader: 'css-loader', + options: { + minimize: true + } + }, { + loader: 'sass-loader' + }], + fallback: 'style-loader' + }) + }, + { + test: /\.(woff|woff2|eot|ttf|otf|svg)$/, + use: [ + 'file-loader?name=[path][name].[ext]' + ] + } + ] + }, + plugins: [ + extractSass, + new UglifyJSPlugin({ + sourceMap: true + }) + ] +} -- cgit v1.2.3