add project to github

This commit is contained in:
Amie Chen 2018-01-12 06:31:18 -08:00
commit 3d89464db5
9 changed files with 1039 additions and 0 deletions

22
README.md Executable file
View File

@ -0,0 +1,22 @@
# Scribbler - a responsive HTML template for coding projects and documentations
Scribbler is a responsive HTML/CSS/Javascript template designed for developers who want to set up a small landing page and a documentation/usage page for their coding projects. It is developed with vanilla javascript and many great CSS3 features, such as CSS variables and CSS grid. With performance and simplicity in mind, the template is built without any extra overhead of libraries and is easy to customize.
The template is made by [Amie Chen](http://amie-chen.com) exclusively for Codrops.
## Live Demo
insert live demo link here
## Credits
* [Highlight.js](https://highlightjs.org/)
* [Google Fonts - Nunito](https://fonts.google.com/specimen/Nunito+Sans)
* [Font Awesome v4](http://fontawesome.io/)
## Misc
Follow Amie: [Dribbble](http://www.dribbble.com/amiechen01), [Github](https://github.com/amiechen), [Website](http://amie-chen.com/)
Follow Codrops: [Twitter](http://www.twitter.com/codrops), [Facebook](http://www.facebook.com/pages/Codrops/159107397912), [Google+](https://plus.google.com/101095823814290637419), [GitHub](https://github.com/codrops), [Pinterest](http://www.pinterest.com/codrops/)
[© Codrops 2018](http://www.codrops.com)

101
doc.html Executable file
View File

@ -0,0 +1,101 @@
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<meta name="description" content="">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Scribbler Documentation - a code documentation page template for codrops</title>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css">
<link href="https://fonts.googleapis.com/css?family=Nunito+Sans:300,400,600,700,800,900" rel="stylesheet">
<link rel="stylesheet" href="scribbler-global.css">
<link rel="stylesheet" href="scribbler-doc.css">
<link rel="author" href="humans.txt">
</head>
<body>
<div class="doc__bg"></div>
<nav class="header">
<h1 class="logo">Scribbler <span class="logo__thin">Doc</span></h1>
<ul class="menu">
<div class="menu__item toggle"><span></span></div>
<li class="menu__item"><a href="" class="link link--dark"><i class="fa fa-github"></i> Github</a></li>
<li class="menu__item"><a href="index.html" class="link link--dark"><i class="fa fa-home"></i> Home</a></li>
</ul>
</nav>
<div class="wrapper">
<aside class="doc__nav">
<ul>
<li class="js-btn selected">Get Started</li>
<li class="js-btn">Configuration</li>
<li class="js-btn">Keybindings</li>
<li class="js-btn">Issues</li>
</ul>
</aside>
<article class="doc__content">
<section class="js-section">
<h3 class="section__title">Get Started</h3>
<p>Learn how to configure settings for Scribbler, such as your syntax highlighting preference and the default saving folder location.</p>
<h3 class="section__title">Installation</h3>
<div class="code__block code__block--notabs">
<pre class="code code--block">
<code>
$ scribbler ——config
{
“encryption”: true,
“highlighting“: true,
“prettyTable”: false,
“font”: [“Helvetica”, “sans-serif”],
“folder”: “~/Desktop“
}
</code>
</pre>
</div>
</section>
<section class="js-section">
<h3 class="section__title">Configuration</h3>
<p>Learn how to configure settings for Scribbler, such as your syntax highlighting preference and the default saving folder location.</p>
<table id="customers">
<tr>
<th>Options</th>
<th>Value</th>
<th>Default</th>
</tr>
<tr>
<td>encryption</td>
<td>encrypt all notes before saving. If turned on, it requires password to open the file.</td>
<td>false</td>
</tr>
<tr>
<td>highlighting</td>
<td>Show syntax highlight on markdown text.</td>
<td>true</td>
</tr>
<tr>
<td>prettyTable</td>
<td>Render table with Scribblers pretty table style.</td>
<td>true</td>
</tr>
</table>
<p>Malis percipitur an pro. Pro aperiam persequeris at, at sonet sensibus mei, id mea postulant definiebas concludaturque. Id qui malis abhorreant, mazim melius quo et. At eam altera dolorum, case dicant lobortis ius te, ad vel affert oportere reprehendunt. Quo no verterem deseruisse, mea brute postea te, ne per tacimates suavitate vituperatoribus.</p>
<hr />
</section>
<section class="js-section">
<h3 class="section__title">Keybindings</h3>
<p>Lorem ipsum dolor sit amet, scripta tibique indoctum sit ei, mel inani aeterno ad. Facer oratio ex per. At eam movet verear, in sea brute patrioque disputando, usu nonumes torquatos an. Ex his quaerendum intellegebat, ut vel homero accusam. Eum at debet tibique, in vocibus temporibus adversarium sed. Porro verear eu vix, ne usu tation vituperata.</p>
<p>Malis percipitur an pro. Pro aperiam persequeris at, at sonet sensibus mei, id mea postulant definiebas concludaturque. Id qui malis abhorreant, mazim melius quo et. At eam altera dolorum, case dicant lobortis ius te, ad vel affert oportere reprehendunt. Quo no verterem deseruisse, mea brute postea te, ne per tacimates suavitate vituperatoribus.</p>
<p>Malis percipitur an pro. Pro aperiam persequeris at, at sonet sensibus mei, id mea postulant definiebas concludaturque. Id qui malis abhorreant, mazim melius quo et. At eam altera dolorum, case dicant lobortis ius te, ad vel affert oportere reprehendunt. Quo no verterem deseruisse, mea brute postea te, ne per tacimates suavitate vituperatoribus.</p>
<hr />
</section>
<section class="js-section">
<h3 class="section__title">Issues</h3>
<p>Lorem ipsum dolor sit amet, scripta tibique indoctum sit ei, mel inani aeterno ad. Facer oratio ex per. At eam movet verear, in sea brute patrioque disputando, usu nonumes torquatos an. Ex his quaerendum intellegebat, ut vel homero accusam. Eum at debet tibique, in vocibus temporibus adversarium sed. Porro verear eu vix, ne usu tation vituperata.</p>
<p>Malis percipitur an pro. Pro aperiam persequeris at, at sonet sensibus mei, id mea postulant definiebas concludaturque. Id qui malis abhorreant, mazim melius quo et. At eam altera dolorum, case dicant lobortis ius te, ad vel affert oportere reprehendunt. Quo no verterem deseruisse, mea brute postea te, ne per tacimates suavitate vituperatoribus.</p>
</section>
</article>
</div>
<footer class="footer">Scribbler is a free HTML template created exclusively for <a href="https://tympanus.net/codrops/" target="_blank" class="link link--light">Codrops</a>.</footer>
<script src="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/9.12.0/highlight.min.js"></script>
<script>hljs.initHighlightingOnLoad();</script>
<script src="scribbler.js"></script>
</body>
</html>

149
index.html Executable file
View File

@ -0,0 +1,149 @@
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<meta name="description" content="">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Scribbler - a codding landing page template for codrops</title>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css">
<link href="https://fonts.googleapis.com/css?family=Nunito+Sans:300,400,600,700,800,900" rel="stylesheet">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/9.12.0/styles/railscasts.min.css">
<link rel="stylesheet" href="scribbler-global.css">
<link rel="stylesheet" href="scribbler-landing.css">
<link rel="author" href="humans.txt">
</head>
<body>
<nav>
<div class="logo"></div>
<ul class="menu">
<div class="menu__item toggle"><span></span></div>
<li class="menu__item"><a href="doc.html" class="link link--dark"><i class="fa fa-book"></i> Documentation</a></li>
<li class="menu__item"><a href="" class="link link--dark"><i class="fa fa-github"></i> Github</a></li>
</ul>
</nav>
<div class="hero">
<h1 class="hero__title">Scribbler</h1>
<p class="hero__description">Take your markdown notes in terminal</p>
</div>
<div class="hero__terminal">
<pre>
<!-- Place your demo code here -->
<code class="shell-session demo">hyperyolo ~ $ </code>
</pre>
</div>
<div class="wrapper">
<div class="installation">
<h3 class="section__title">Installation</h3>
<div class="tab__container">
<ul>
<li class="tab active" data-tab="mac">mac</li>
<li class="tab" data-tab="linux">linux</li>
<li class="tab" data-tab="win">win</li>
</ul>
<pre class="nohighlight code">
<code class="tab__pane active mac">$ brew install scribbler</code>
<code class="tab__pane linux">$ apt-get install scribbler</code>
<code class="tab__pane win">$ gem install scribbler</code>
</pre>
</div>
</div>
<div class="feature">
<div class="feature__item">
<h3 class="section__title">Fast & Light</h3>
<p>Start writing your notes immediately in any terminal! No more time wasted on navigating and opening your text editor.</p>
</div>
<div class="feature__item">
<h3 class="section__title">File Syncing</h3>
<p>Save your file in Dropbox then you can access to it from anywhere.</p>
</div>
<div class="feature__item">
<h3 class="section__title">Secure</h3>
<p>Encrypt your notes optionally. No one can get to your secrets! </p>
</div>
<div class="feature__item">
<h3 class="section__title">Configuration</h3>
<p>Maintain all your settings in a single <span class="code code--inline">config.json</span> file. Never need to redo the setting every single time jotting down a note.</p>
</div>
<div class="feature__item">
<h3 class="section__title">Highlightings</h3>
<p>For better readability, scribbler has a clean, beautiful color scheme allow you to scan files fast.</p>
</div>
<div class="feature__item">
<h3 class="section__title">Keybindings</h3>
<p>You can expect common keybindings for scribbler. Customize <span class="code code--inline">bindings.json</span> for your own liking! </p>
</div>
</div>
<div class="keybinding">
<ul class="keybinding__detail">
<h3 class="keybinding__title">Default Keybindings</h3>
<li>Quit without saving <span class="keybinding__label">Ctrl+C</span></li>
<li>Save <span class="keybinding__label">Cmd+S</span></li>
<li>Save and Quit <span class="keybinding__label">Ctrl+D</span></li>
<li>Undo <span class="keybinding__label">Cmd+Z</span></li>
</ul>
<ul class="keybinding__detail">
<h3 class="keybinding__title">Markdown Keybindings</h3>
<li><span class="keybinding__label">Ctrl+A</span> Insert Link Markdown</li>
<li><span class="keybinding__label">Ctrl+I</span> Insert Image Markdown</li>
<li><span class="keybinding__label">Ctrl+V</span> Insert YouTube Video</li>
<li><span class="keybinding__label">Ctrl+T</span> Insert Table</li>
</ul>
</div>
<div class="callout">
<p>Read our documentation for advanced keybindings and customization</p>
<a href="doc.html" class="button--primary">Documentation</a>
</div>
</div>
<div class="changelog">
<div class="wrapper">
<h3 class="section__title">Changelog</h3>
<div class="changelog__item">
<div class="changelog__meta">
<h4 class="changelog__title">v0.7</h4>
<small class="changelog__date">10/12/2017</small>
</div>
<div class="changelog__detail">
<ul>
<li>Improving the writing workflow with better key bindings</li>
<li>Design updates</li>
<li>SSL Verification for web hooks</li>
<li>Render Emoji</li>
</ul>
</div>
</div>
<div class="changelog__item">
<div class="changelog__meta">
<h4 class="changelog__title">v0.6</h4>
<small class="changelog__date">7/30/2017</small>
</div>
<div class="changelog__detail">
<ul>
<li>Adding Unicode support</li>
<li>Basic text highlighting</li>
<li>Fresh Design</li>
</ul>
</div>
</div>
<div class="changelog__item">
<div class="changelog__meta">
<h4 class="changelog__title">v0.5</h4>
<small class="changelog__date">5/10/2017</small>
</div>
<div class="changelog__detail">
<ul>
<li>Save default md file in new folders</li>
<li>Ability to quick search on existing notes</li>
</ul>
</div>
</div>
<div class="changelog__callout">
<a href="#" class="button--secondary">Checkout Full Log</a>
</div>
</div>
</div>
<footer class="footer">Scribbler is a free HTML template created exclusively for <a href="https://tympanus.net/codrops/" target="_blank" class="link link--light">Codrops</a>.</footer>
<script src="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/9.12.0/highlight.min.js"></script>
<script>hljs.initHighlightingOnLoad();</script>
<script src="scribbler.js"></script>
</body>
</html>

14
logo.svg Executable file
View File

@ -0,0 +1,14 @@
<?xml version="1.0" encoding="UTF-8"?>
<svg width="92px" height="30px" viewBox="0 0 92 30" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
<!-- Generator: Sketch 48.2 (47327) - http://www.bohemiancoding.com/sketch -->
<title>logo</title>
<desc>Created with Sketch.</desc>
<defs></defs>
<g id="Landing-Page" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd" transform="translate(-29.000000, -22.000000)">
<g id="logo" transform="translate(29.000000, 22.000000)">
<circle id="Oval" fill="#FEEFCE" cx="47" cy="15" r="15"></circle>
<rect id="Rectangle-2" fill="#FFE4E4" x="0" y="2" width="27" height="27"></rect>
<polygon id="Triangle" fill="#D5E2CF" points="78.5 2 92 29 65 29"></polygon>
</g>
</g>
</svg>

After

Width:  |  Height:  |  Size: 836 B

115
scribbler-doc.css Executable file
View File

@ -0,0 +1,115 @@
html, body {
display: flex;
flex-direction: column;
min-height: 100vh;
}
/* layout */
.header {
border-bottom: 1px solid var(--code-bg-color);
grid-template-columns: 1fr 150px 60% 1fr;
}
.wrapper {
display: flex;
flex-grow: 1;
}
/* logo */
.logo {
font-weight: 900;
color: var(--primary-color);
font-size: 1.4em;
grid-column: 2;
}
.logo__thin {
font-weight: 300;
}
/* menu */
.menu {
grid-template-columns: 1fr 180px 60% 1fr;
}
.menu__item {
padding: 1.5rem 1rem;
}
/* doc */
.doc__bg {
position: fixed;
top: 0;
left: 0;
bottom: 0;
width: 28%;
background-color: var(--bg-color);
z-index: -1;
}
.doc__nav {
flex-basis: 20%;
font-weight: 200;
}
.doc__nav ul {
list-style: none;
padding-left: 0;
line-height: 1.8;
}
.doc__nav ul.fixed {
position: fixed;
top: 2rem;
}
.doc__nav li:hover {
color: var(--primary-color-light);
cursor: pointer;
transition: color .3s ease-in-out;
}
.doc__nav .selected {
color: var(--accent-color);
position: relative;
}
.doc__nav .selected:after {
position: absolute;
content: "";
width: 1rem;
height: 1rem;
background-color: var(--accent-color);
left: -1.5rem;
top: 0.3rem;
}
.doc__content {
flex-basis: 80%;
padding: 0 0 5rem 1rem;
}
@media (max-width: 750px) {
.wrapper {
flex-direction: column;
}
.doc__content {
padding-left: 0;
}
.doc__nav ul {
border-bottom: 1px solid var(--code-bg-color);
padding-bottom: 0.5rem;
}
.doc__nav ul.fixed {
/* nutralized the fixed menu for mobile*/
position: relative;
top: 0;
}
.doc__nav li {
display: inline-block;
padding-right: 1rem;
}
.doc__nav .selected:after {
display: none;
}
}

312
scribbler-global.css Executable file
View File

@ -0,0 +1,312 @@
/* css variables*/
:root {
--primary-color: #432E30;
--primary-color-light: #8E7474;
--accent-color: #FE6A6B;
--accent-color-light: #FFE4E4;
--accent-color-dark: #B94B4C;
--white-color: #FAFBFC;
--light-gray-color: #C6CBD1;
--medium-gray-color: #959DA5;
--dark-gray-color: #444D56;
--bg-color: #F8F8FA;
--code-bg-color: #F0E8E8;
}
/* normalized */
html, body {
padding: 0;
margin: 0;
font-family: 'Nunito Sans', sans-serif;
background-color: white;
}
p {
font-weight: 300;
color: #4A4A4A;
}
a, a:hover {
text-decoration: none;
color: var(--primary-color);
}
hr {
padding: 1rem 0;
border: 0;
border-bottom: 1px solid var(--bg-color);
}
* {
box-sizing: border-box;
}
/* global components */
/* typography */
.section__title {
color: var(--primary-color);
}
/* tabs */
.tab__container {
position: relative;
}
.tab__container > ul {
position: absolute;
list-style: none;
margin: 0;
right: 1rem;
top: -2rem;
}
.tab__container .code {
white-space: normal;
padding: 1rem 1.5rem;
}
.tab {
display: inline-block;
padding: 0.3rem 0.5rem;
font-weight: 200;
cursor: pointer;
}
.tab.active {
border-bottom: 1px solid var(--primary-color);
font-weight: 700;
display: inline-block;
}
.tab__pane {
display: none;
}
.tab__pane.active {
display: block;
}
/* code */
.code {
border-radius: 3px;
font-family: Space Mono, SFMono-Regular, Menlo,Monaco, Consolas, Liberation Mono, Courier New, monospace;
background: var(--bg-color);
border: 1px solid var(--code-bg-color);
color: var(--primary-color-light);
}
.code--block {
white-space: pre-line;
padding: 0 1.5rem;
}
.code--inline {
padding: 3px 6px;
font-size: 80%;
}
/* buttons */
.button--primary {
padding: 10px 22px;
background-color: var(--accent-color);
color: white;
position: relative;
text-decoration: none;
border: 0;
transition: all .3s ease-out;
}
.button--primary:after {
position: absolute;
content: "";
width: 1rem;
height: 1rem;
background-color: var(--accent-color-light);
right: -0.4rem;
top: -0.4rem;
transition: all 0.3s ease-out;
}
.button--primary:hover {
text-shadow: 0px 1px 1px var(--accent-color-dark);
color: white;
transform: translate3D(0, -3px, 0);
}
.button--primary:hover::after {
transform: rotate(90deg);
}
.button--secondary {
padding: 10px 22px;
border: 2px solid var(--primary-color);
transition: all 0.5s ease-out;
}
.button--secondary:hover {
border-color: var(--accent-color);
color: var(--accent-color);
}
/* links */
.link {
text-decoration: none;
transition: all 0.3s ease-out;
}
.link:hover {
color: var(--accent-color);
}
.link--dark {
color: var(--primary-color);
}
.link--light {
color: var(--accent-color);
}
/* menu */
nav {
display: grid;
grid-template-columns: 70px auto;
}
.menu {
margin: 0;
text-align: right;
overflow: hidden;
list-style: none;
}
.toggle {
display: none;
position: relative;
}
.toggle span,
.toggle span:before,
.toggle span:after {
content: '';
position: absolute;
height: 2px;
width: 18px;
border-radius: 2px;
background: var(--primary-color);
display: block;
cursor: pointer;
transition: all 0.3s ease-in-out;
right: 0;
}
.toggle span:before {
top: -6px;
}
.toggle span:after {
bottom: -6px;
}
.toggle.open span{
background-color: transparent;
}
.toggle.open span:before,
.toggle.open span:after {
top: 0;
}
.toggle.open span:before {
transform: rotate(45deg);
}
.toggle.open span:after {
transform: rotate(-45deg);
}
.menu__item {
padding: 1rem;
display: inline-block;
}
.menu__item.toggle {
display: none;
}
/* table */
table {
border-collapse: collapse;
width: 100%;
transition: color .3s ease-out;
margin-bottom: 2rem;
}
table td, table th {
border: 1px solid var(--code-bg-color);
padding: 0.8rem;
font-weight: 300;
}
table th {
text-align: left;
background-color: white;
border-color: white;
border-bottom-color: var(--code-bg-color);
}
table td:first-child {
background-color: var(--bg-color);
font-weight: 600;
}
@media screen and (max-width: 600px) {
nav {
grid-template-columns: 70px auto;
}
.menu__item{
display: none;
}
.menu__item.toggle {
display: inline-block;
}
.menu {
text-align: right;
padding: 0.5rem 1rem;
}
.toggle {
display: block;
}
.menu.responsive .menu__item:not(:first-child) {
display: block;
padding: 0 0 0.5rem 0;
}
}
/* layout */
.wrapper {
margin: 0 auto;
width: 70%;
}
.footer {
text-align: center;
background-color: var(--primary-color);
padding: 2rem;
color: white;
}
@keyframes fadeUp {
0% {
opacity: 0;
transform: translate3d(0,30px,0);
}
100% {
transform: translate3d(0,0,0);
}
}

180
scribbler-landing.css Executable file
View File

@ -0,0 +1,180 @@
/* nav specialized to landing page */
.logo {
background: url('logo.svg') no-repeat;
background-size: contain;
margin: 1rem 0 0 1rem;
}
nav {
background-color: var(--bg-color);
}
/* hero section */
.hero {
text-align: center;
background-color: var(--bg-color);
padding: 2rem 0 10rem 0;
}
.hero__title {
font-weight: 900;
color: var(--primary-color);
}
.hero__description {
margin: -1rem auto 2rem auto;
}
.hero__terminal {
width: 60%;
margin: -11rem auto 3rem auto;
text-align: left;
color: white;
padding: 0 1rem;
border-radius: 4px;
background-color: #232323;
min-height: 285px;
animation: fadeUp 2s;
box-shadow: 0px 12px 36.8px 9.2px rgba(0, 0, 0, 0.1);
}
.hero__terminal pre {
white-space: pre-line;
padding-top: 1rem;
}
/* feature section */
.feature {
display: flex;
flex-wrap: wrap;
}
.feature__item {
max-width: calc(33% - 20px);
margin: 0 20px 0 0;
}
.feature__item .section__title {
margin-bottom: 0;
}
.feature__item p {
margin-top: 0.5rem;
}
/* keybinding section */
.keybinding {
margin-top: 3rem;
display: flex;
}
.keybinding__detail {
position: relative;
border: 1px solid var(--code-bg-color);
flex-basis: 50%;
padding: 2rem 1rem 1rem 1rem;
list-style: none;
line-height: 2rem;
}
.keybinding__detail:first-child {
text-align: right;
padding-right: 1rem;
}
.keybinding__detail:last-child {
padding-left: 1rem;
margin-left: -1px;
}
.keybinding__detail:first-child .keybinding__title {
position: absolute;
right: 0.5rem;
top: -2rem;
background-color: white;
padding: 0 0.5rem;
}
.keybinding__detail:last-child .keybinding__title {
position: absolute;
left: 0.5rem;
top: -2rem;
background-color: white;
padding: 0 0.5rem;
}
.keybinding__label {
background: var(--white-color);
border: 1px solid var(--light-gray-color);
box-shadow: 0 1px 0 0 var(--medium-gray-color);
border-radius: 3px;
font-family: Courier;
font-size: 0.7rem;
color: var(--dark-gray-color);
padding: 3px 3px 1px 3px;
vertical-align: middle;
}
/* callout section */
.callout {
text-align: center;
padding: 1rem 0 3rem 0;
}
.callout .button--primary {
display: inline-block;
margin-top: 0.5rem;
}
/* changelog section */
.changelog {
background-color: var(--bg-color);
padding: 2rem 0;
}
.changelog__item {
display: flex;
}
.changelog__meta {
flex-basis: 25%;
}
.changelog__meta small {
color: var(--primary-color-light);
font-weight: 200;
letter-spacing: 1px;
}
.changelog__title {
margin-bottom: 0;
}
.changelog__callout {
margin: 3rem auto 2rem auto;
text-align: center;
}
@media (max-width: 750px) {
.hero__terminal {
width: 70%;
}
.tab__container > ul {
right: auto;
left: 0;
padding-left: 0;
}
.tab__container .code {
margin-top: 2rem;
}
.feature, .keybinding, .changelog__item {
flex-direction: column;
}
.feature__item {
max-width: 100%;
margin: 0;
}
.keybinding {
font-size: 0.8rem;
}
}

146
scribbler.js Executable file
View File

@ -0,0 +1,146 @@
// utilities
var get = function (selector, scope) {
scope = scope ? scope : document;
return scope.querySelector(selector);
};
var getAll = function (selector, scope) {
scope = scope ? scope : document;
return scope.querySelectorAll(selector);
};
// setup typewriter effect in the terminal demo
if (document.getElementsByClassName('demo').length > 0) {
var i = 0;
var txt = `scribbler
[Entry mode; press Ctrl+D to save and quit; press Ctrl+C to quit without saving]
###todo for new year dinner party
- milk
- butter
- green onion
- lots and lots of kiwis 🥝`;
var speed = 60;
function typeItOut () {
if (i < txt.length) {
document.getElementsByClassName('demo')[0].innerHTML += txt.charAt(i);
i++;
setTimeout(typeItOut, speed);
}
}
setTimeout(typeItOut, 1800);
}
// toggle tabs on codeblock
window.addEventListener("load", function() {
// get all tab_containers in the document
var tabContainers = getAll(".tab__container");
// bind click event to each tab container
for (var i = 0; i < tabContainers.length; i++) {
tabContainers[i].addEventListener("click", tabClick);
}
// each click event is scoped to the tab_container
function tabClick (event) {
var scope = event.currentTarget;
var clickedTab = event.target;
var tabs = getAll('.tab', scope);
var panes = getAll('.tab__pane', scope);
var activePane = get(`.${clickedTab.getAttribute('data-tab')}`, scope);
// remove all active tab classes
for (var i = 0; i < tabs.length; i++) {
tabs[i].classList.remove('active');
}
// remove all active pane classes
for (var i = 0; i < panes.length; i++) {
panes[i].classList.remove('active');
}
// apply active classes on desired tab and pane
clickedTab.classList.add('active');
activePane.classList.add('active');
}
});
//in page scrolling for documentaiton page
var btns = getAll('.js-btn');
var sections = getAll('.js-section');
function setActiveLink(event) {
// remove all active tab classes
for (var i = 0; i < btns.length; i++) {
btns[i].classList.remove('selected');
}
event.target.classList.add('selected');
}
function smoothScrollTo(element, event) {
setActiveLink(event);
window.scrollTo({
'behavior': 'smooth',
'top': element.offsetTop - 20,
'left': 0
});
}
if (btns.length && sections.length > 0) {
// for (var i = 0; i<btns.length; i++) {
// btns[i].addEventListener('click', function(event) {
// smoothScrollTo(sections[i], event);
// });
// }
btns[0].addEventListener('click', function (event) {
smoothScrollTo(sections[0], event);
});
btns[1].addEventListener('click', function (event) {
smoothScrollTo(sections[1], event);
});
btns[2].addEventListener('click', function (event) {
smoothScrollTo(sections[2], event);
});
btns[3].addEventListener('click', function (event) {
smoothScrollTo(sections[3], event);
});
}
// fix menu to page-top once user starts scrolling
window.addEventListener('scroll', function () {
var docNav = get('.doc__nav > ul');
if( docNav) {
if (window.pageYOffset > 63) {
docNav.classList.add('fixed');
} else {
docNav.classList.remove('fixed');
}
}
});
// responsive navigation
var topNav = document.querySelector('.menu');
var icon = document.querySelector('.toggle');
window.addEventListener('load', function(){
function showNav() {
if (topNav.className === 'menu') {
topNav.className += ' responsive';
icon.className += ' open';
} else {
topNav.className = 'menu';
icon.classList.remove('open');
}
}
icon.addEventListener('click', showNav);
});

BIN
sketch/scribbler.sketch Executable file

Binary file not shown.