diff options
| author | Fuwn <[email protected]> | 2020-11-08 21:01:55 -0800 |
|---|---|---|
| committer | Fuwn <[email protected]> | 2020-11-08 21:01:55 -0800 |
| commit | 6f4d4f283affaf50b4c242b1ff0a275c22af81e6 (patch) | |
| tree | d8e3fed1b3e2dc8ab9db4a5229f8bcba28548599 | |
| parent | fix: make tweet this https (diff) | |
| download | blog-6f4d4f283affaf50b4c242b1ff0a275c22af81e6.tar.xz blog-6f4d4f283affaf50b4c242b1ff0a275c22af81e6.zip | |
feat: (desc)
feat:
- 404 redirect
- darkmode boilerplate
- konami ee
- "back to home" to "back home"
- "read on" to "read more"
- id main stylesheets for later darkmode
- console log ee and darmode extension
| -rw-r--r-- | netlify.toml | 5 | ||||
| -rw-r--r-- | public/css/style.dark.css | 247 | ||||
| -rw-r--r-- | public/css/tomorrow.dark.min.css | 75 | ||||
| -rw-r--r-- | public/js/konami.js | 48 | ||||
| -rw-r--r-- | templates/article.ejs | 2 | ||||
| -rw-r--r-- | templates/index.ejs | 2 | ||||
| -rw-r--r-- | templates/layout.ejs | 10 |
7 files changed, 385 insertions, 4 deletions
diff --git a/netlify.toml b/netlify.toml index a689fe2..fb14bbc 100644 --- a/netlify.toml +++ b/netlify.toml @@ -5,3 +5,8 @@ # force = true # [redirects.headers] # X-From = "Netlify" + +[[redirects]] + from = "/*" + to = "/" + status = "404" diff --git a/public/css/style.dark.css b/public/css/style.dark.css new file mode 100644 index 0000000..b3b004b --- /dev/null +++ b/public/css/style.dark.css @@ -0,0 +1,247 @@ +body { + color: rgb(232, 220, 199); + background-color: #1b1b1a; + font-size: 20px; +} + +body, +code { + font-family: "Inconsolata", monospace; +} + +h1, +h2, +h3 { + font-size: inherit; + display: inline; + font-weight: bold; +} + +h2::before { + content: "## "; +} + +h3::before { + content: "### "; +} + +p { + margin: 30px 0; +} + +h1 + p, +h2 + p, +h3 + p { + margin-top: 0; +} + +p.listing { + margin-top: 0; +} + +hr { + margin: 0; + border: none; +} + +hr::after { + content: "---"; + display: block; + text-align: center; +} + +.main { + box-sizing: border-box; + width: 650px; + padding: 30px; + margin: 40px auto; +} + +.blog-title { + border-bottom: 1px solid #ccc; + margin-bottom: 40px; +} + +.article { + margin: 34px 0; + line-height: 1.6; +} + +a, +a:visited { + color: rgb(217, 129, 112); + text-decoration: none; +} + +a:hover { + text-decoration: underline; +} + +a:focus { + background-color: #9d261d; + color: #fff; + outline: none; + text-decoration: none; +} + +a:active { + background-color: #6f2a20; + color: #fff4e0 !important; +} + +a:visited { + background-color: #6f2a20; +} + +.date { + float: right; + color: rgb(170, 158, 137); + font-style: italic; +} + +.tweet { + float: right; +} + +code { + background-color: rgb(38, 38, 37); +} + +pre { + border-left: 1px solid rgb(67, 67, 64) !important; + position: relative; + left: -20px; + padding-left: 20px; + /* overflow-x: scroll; */ +} + +pre code { + background-color: rgb(27, 27, 26); + display: block; +} + +img { + border: 2px solid black; + width: 100%; +} + +.flex { + display: -webkit-flex; + display: -moz-box; + display: -ms-flexbox; + display: flex; + width: 100%; + + flex-flow: row wrap; + -webkit-justify-content: center; + justify-content: center; +} + +.demo { + border: 2px solid #000; + box-sizing: border-box; + margin: 20px 0; + padding: 40px 0; +} + +.flash-item { + animation: flash 8s linear 0s infinite; + -webkit-animation: flash 8s linear 0s infinite; + -moz-animation: flash 8s linear 0s infinite; + -o-animation: flash 8s linear 0s infinite; +} + +.sr-only { + border: 0; + clip: rect(0, 0, 0, 0); + height: 1px; + margin: -1px; + overflow: hidden; + padding: 0; + position: absolute; + width: 1px; +} + +@keyframes flash { + 0% { + opacity: 1; + } + 10% { + opacity: 0.1; + } + 20% { + opacity: 1; + } +} +@-webkit-keyframes flash { + 0% { + opacity: 1; + } + 10% { + opacity: 0.1; + } + 20% { + opacity: 1; + } +} +@-moz-keyframes flash { + 0% { + opacity: 1; + } + 10% { + opacity: 0.1; + } + 20% { + opacity: 1; + } +} +@-o-keyframes flash { + 0% { + opacity: 1; + } + 10% { + opacity: 0.1; + } + 20% { + opacity: 1; + } +} + +@media (max-width: 480px) { + body { + font-size: 20px; + line-height: 1.4; + } + + .main { + width: 100%; + padding: 10px; + margin-top: 0; + } + + .article { + margin-top: 30px; + } + + .date { + float: none; + display: block; + } + + .sep { + display: none; + } + + header a { + display: block; + } +} + +::selection { + background-color: #1b4e8a !important; + color: #fff4e0 !important; +} + +* { + scrollbar-color: #242523 #4e4e4a; +} diff --git a/public/css/tomorrow.dark.min.css b/public/css/tomorrow.dark.min.css new file mode 100644 index 0000000..bc4460d --- /dev/null +++ b/public/css/tomorrow.dark.min.css @@ -0,0 +1,75 @@ +.hljs-comment { + color: rgb(175, 162, 141); +} +.hljs-variable, +.hljs-attribute, +.hljs-tag, +.hljs-regexp, +.ruby .hljs-constant, +.xml .hljs-tag .hljs-title, +.xml .hljs-pi, +.xml .hljs-doctype, +.html .hljs-doctype, +.css .hljs-id, +.css .hljs-class, +.css .hljs-pseudo { + color: rgb(200, 93, 84); +} +.hljs-number, +.hljs-preprocessor, +.hljs-pragma, +.hljs-built_in, +.hljs-literal, +.hljs-params, +.language-prolog .hljs-symbol, +.hljs-constant { + color: rgb(237, 160, 80); +} +.ruby .hljs-class .hljs-title, +.css .hljs-rule .hljs-attribute { + color: #eab700; /* Unchanged */ +} +.hljs-string, +.hljs-value, +.hljs-inheritance, +.hljs-header, +.hljs-name, +.ruby .hljs-symbol, +.xml .hljs-cdata { + color: rgb(250, 255, 138); +} +.hljs-title, +.css .hljs-hexcolor { + color: rgb(143, 195, 185); +} +.hljs-function, +.python .hljs-decorator, +.python .hljs-title, +.ruby .hljs-function .hljs-title, +.ruby .hljs-title .hljs-keyword, +.perl .hljs-sub, +.javascript .hljs-title, +.coffeescript .hljs-title { + color: rgb(142, 167, 184); +} +.hljs-keyword, +.javascript .hljs-function { + color: rgb(156, 120, 160); +} +.hljs { + display: block; + overflow-x: auto; + background: white; + color: #4d4d4c; + padding: 0.5em; + -webkit-text-size-adjust: none; +} +.coffeescript .javascript, +.javascript .xml, +.tex .hljs-formula, +.xml .javascript, +.xml .vbscript, +.xml .css, +.xml .hljs-cdata { + opacity: 0.5; +} diff --git a/public/js/konami.js b/public/js/konami.js new file mode 100644 index 0000000..5f09304 --- /dev/null +++ b/public/js/konami.js @@ -0,0 +1,48 @@ +const allowedKeys = { + 37: "left", + 38: "up", + 39: "right", + 40: "down", + 65: 'a', + 66: 'b' +}; +const konamiCode = ["up", "up", "down", "down", "left", "right", "left", "right", 'b', 'a']; +let konamiCodePosition = 0; +let cheatState = false; + +document.addEventListener("keydown", (event) => { + if (event.keyCode === 8) { + event.preventDefault(); + return false; + } +}); + +document.addEventListener("keydown", (e) => { + let key = allowedKeys[e.keyCode]; + let requiredKey = konamiCode[konamiCodePosition]; + + if (key == requiredKey) { + konamiCodePosition++; + + if (konamiCodePosition == konamiCode.length) { + Cheats(); + konamiCodePosition = 0; + } + } else { konamiCodePosition = 0; } +}); + +const swapStyleSheet = (id, sheet) => { + document.getElementById(id).setAttribute("href", sheet); +}; + +const Cheats = () => { + if (!cheatState) { + swapStyleSheet("main-style", ""); + swapStyleSheet("hl-style", ""); + cheatState = !cheatState; + } else if (cheatState) { + swapStyleSheet("main-style", "/css/style.css"); + swapStyleSheet("hl-style", "/css/tomorrow.min.css"); + cheatState = !cheatState; + } +}; diff --git a/templates/article.ejs b/templates/article.ejs index 880bd1e..dc3540b 100644 --- a/templates/article.ejs +++ b/templates/article.ejs @@ -34,6 +34,6 @@ -- <br><br> <a target="_blank" rel="noopener" href="<%= tweetUrl %>" class="tweet">tweet this</a> - <a href="/">« back to home</a> + <a href="/">« back home</a> </footer> </article> diff --git a/templates/index.ejs b/templates/index.ejs index 0bbbfdf..b369862 100644 --- a/templates/index.ejs +++ b/templates/index.ejs @@ -12,7 +12,7 @@ <p class="listing"> <%- (article.description || article.summary).replace(/<.?p>/g, "") %> <a href="<%= article.route %>"> - <span aria-hidden="true">read on »</span> + <span aria-hidden="true">read more »</span> <span class="sr-only">continue reading this article</span> </a> </p> diff --git a/templates/layout.ejs b/templates/layout.ejs index 484c56e..fda9694 100644 --- a/templates/layout.ejs +++ b/templates/layout.ejs @@ -6,8 +6,8 @@ <%= title %> </title> - <link rel="stylesheet" href="/css/style.css"> - <link rel="stylesheet" href="/css/tomorrow.min.css"> + <link rel="stylesheet" id="main-style" href="/css/style.css"> + <link rel="stylesheet" id="hl-style" href="/css/tomorrow.min.css"> <link rel="stylesheet" href="/css/demos/clicking.css"> <link rel="stylesheet" href="/css/demos/hover.css"> <link rel="stylesheet" href="/css/demos/shared.css"> @@ -110,6 +110,7 @@ <script async src="/js/flasher.js"></script> <script async src="/js/demos/clicking.js"></script> <script async src="/js/demos/hover.js"></script> + <script async src="/js/konami.js"></script> <% if (typeof isEditor !== "undefined" && isEditor) { %> <script src="/editor/ejs.min.js"></script> @@ -117,6 +118,11 @@ <script src="/editor/marked.min.js"></script> <script src="/editor/editor.js"></script> <% } %> + + <script defer> + console.log("Wanna see a cool, but unfinished easter egg? Hint: Konami Code."); + console.log("Also, since I haven't gotten around to adding a dark mode, this blog is best read with the Dark Reader browser extension."); + </script> </body> </html> |