Optimize load time
This commit is contained in:
parent
81856ba7d9
commit
8337b4b817
45 changed files with 84 additions and 76 deletions
1
content/assets/css/all.css
Normal file
1
content/assets/css/all.css
Normal file
|
|
@ -0,0 +1 @@
|
|||
<%= all_css @config[:stylesheets] %>
|
||||
72
content/assets/css/colorful.css
Normal file
72
content/assets/css/colorful.css
Normal file
|
|
@ -0,0 +1,72 @@
|
|||
/* pygments-css colorful */
|
||||
code[class^='language-'] .hll:not([id^='MathJax']) { background-color: #ffffcc }
|
||||
code[class^='language-'] .c:not([id^='MathJax']) { color: #808080 } /* Comment */
|
||||
code[class^='language-'] .err:not([id^='MathJax']) { color: #F00000; background-color: #F0A0A0 } /* Error */
|
||||
code[class^='language-'] .k:not([id^='MathJax']) { color: #008000; font-weight: bold } /* Keyword */
|
||||
code[class^='language-'] .o:not([id^='MathJax']) { color: #303030 } /* Operator */
|
||||
code[class^='language-'] .cm:not([id^='MathJax']) { color: #808080 } /* Comment.Multiline */
|
||||
code[class^='language-'] .cp:not([id^='MathJax']) { color: #507090 } /* Comment.Preproc */
|
||||
code[class^='language-'] .c1:not([id^='MathJax']) { color: #808080 } /* Comment.Single */
|
||||
code[class^='language-'] .cs:not([id^='MathJax']) { color: #cc0000; font-weight: bold } /* Comment.Special */
|
||||
code[class^='language-'] .gd:not([id^='MathJax']) { color: #A00000 } /* Generic.Deleted */
|
||||
code[class^='language-'] .ge:not([id^='MathJax']) { font-style: italic } /* Generic.Emph */
|
||||
code[class^='language-'] .gr:not([id^='MathJax']) { color: #FF0000 } /* Generic.Error */
|
||||
code[class^='language-'] .gh:not([id^='MathJax']) { color: #000080; font-weight: bold } /* Generic.Heading */
|
||||
code[class^='language-'] .gi:not([id^='MathJax']) { color: #00A000 } /* Generic.Inserted */
|
||||
code[class^='language-'] .go:not([id^='MathJax']) { color: #808080 } /* Generic.Output */
|
||||
code[class^='language-'] .gp:not([id^='MathJax']) {
|
||||
color: #c65d09;
|
||||
font-weight: bold;
|
||||
/* NOTE: Hacks to allow copy-paste */
|
||||
-webkit-touch-callout: none;
|
||||
-webkit-user-select: none;
|
||||
-khtml-user-select: none;
|
||||
-moz-user-select: none;
|
||||
-ms-user-select: none;
|
||||
user-select: none;
|
||||
} /* Generic.Prompt */
|
||||
code[class^='language-'] .gs:not([id^='MathJax']) { font-weight: bold } /* Generic.Strong */
|
||||
code[class^='language-'] .gu:not([id^='MathJax']) { color: #800080; font-weight: bold } /* Generic.Subheading */
|
||||
code[class^='language-'] .gt:not([id^='MathJax']) { color: #0040D0 } /* Generic.Traceback */
|
||||
code[class^='language-'] .kc:not([id^='MathJax']) { color: #008000; font-weight: bold } /* Keyword.Constant */
|
||||
code[class^='language-'] .kd:not([id^='MathJax']) { color: #008000; font-weight: bold } /* Keyword.Declaration */
|
||||
code[class^='language-'] .kn:not([id^='MathJax']) { color: #008000; font-weight: bold } /* Keyword.Namespace */
|
||||
code[class^='language-'] .kp:not([id^='MathJax']) { color: #003080; font-weight: bold } /* Keyword.Pseudo */
|
||||
code[class^='language-'] .kr:not([id^='MathJax']) { color: #008000; font-weight: bold } /* Keyword.Reserved */
|
||||
code[class^='language-'] .kt:not([id^='MathJax']) { color: #303090; font-weight: bold } /* Keyword.Type */
|
||||
code[class^='language-'] .m:not([id^='MathJax']) { color: #6000E0; font-weight: bold } /* Literal.Number */
|
||||
code[class^='language-'] .s:not([id^='MathJax']) { background-color: #fff0f0 } /* Literal.String */
|
||||
code[class^='language-'] .na:not([id^='MathJax']) { color: #0000C0 } /* Name.Attribute */
|
||||
code[class^='language-'] .nb:not([id^='MathJax']) { color: #007020 } /* Name.Builtin */
|
||||
code[class^='language-'] .nc:not([id^='MathJax']) { color: #B00060; font-weight: bold } /* Name.Class */
|
||||
code[class^='language-'] .no:not([id^='MathJax']) { color: #003060; font-weight: bold } /* Name.Constant */
|
||||
code[class^='language-'] .nd:not([id^='MathJax']) { color: #505050; font-weight: bold } /* Name.Decorator */
|
||||
code[class^='language-'] .ni:not([id^='MathJax']) { color: #800000; font-weight: bold } /* Name.Entity */
|
||||
code[class^='language-'] .ne:not([id^='MathJax']) { color: #F00000; font-weight: bold } /* Name.Exception */
|
||||
code[class^='language-'] .nf:not([id^='MathJax']) { color: #0060B0; font-weight: bold } /* Name.Function */
|
||||
code[class^='language-'] .nl:not([id^='MathJax']) { color: #907000; font-weight: bold } /* Name.Label */
|
||||
code[class^='language-'] .nn:not([id^='MathJax']) { color: #0e84b5; font-weight: bold } /* Name.Namespace */
|
||||
code[class^='language-'] .nt:not([id^='MathJax']) { color: #007000 } /* Name.Tag */
|
||||
code[class^='language-'] .nv:not([id^='MathJax']) { color: #906030 } /* Name.Variable */
|
||||
code[class^='language-'] .ow:not([id^='MathJax']) { color: #000000; font-weight: bold } /* Operator.Word */
|
||||
code[class^='language-'] .w:not([id^='MathJax']) { color: #bbbbbb } /* Text.Whitespace */
|
||||
code[class^='language-'] .mf:not([id^='MathJax']) { color: #6000E0; font-weight: bold } /* Literal.Number.Float */
|
||||
code[class^='language-'] .mh:not([id^='MathJax']) { color: #005080; font-weight: bold } /* Literal.Number.Hex */
|
||||
code[class^='language-'] .mi:not([id^='MathJax']) { color: #0000D0; font-weight: bold } /* Literal.Number.Integer */
|
||||
code[class^='language-'] .mo:not([id^='MathJax']) { color: #4000E0; font-weight: bold } /* Literal.Number.Oct */
|
||||
code[class^='language-'] .sb:not([id^='MathJax']) { background-color: #fff0f0 } /* Literal.String.Backtick */
|
||||
code[class^='language-'] .sc:not([id^='MathJax']) { color: #0040D0 } /* Literal.String.Char */
|
||||
code[class^='language-'] .sd:not([id^='MathJax']) { color: #D04020 } /* Literal.String.Doc */
|
||||
code[class^='language-'] .s2:not([id^='MathJax']) { background-color: #fff0f0 } /* Literal.String.Double */
|
||||
code[class^='language-'] .se:not([id^='MathJax']) { color: #606060; font-weight: bold; background-color: #fff0f0 } /* Literal.String.Escape */
|
||||
code[class^='language-'] .sh:not([id^='MathJax']) { background-color: #fff0f0 } /* Literal.String.Heredoc */
|
||||
code[class^='language-'] .si:not([id^='MathJax']) { background-color: #e0e0e0 } /* Literal.String.Interpol */
|
||||
code[class^='language-'] .sx:not([id^='MathJax']) { color: #D02000; background-color: #fff0f0 } /* Literal.String.Other */
|
||||
code[class^='language-'] .sr:not([id^='MathJax']) { color: #000000; background-color: #fff0ff } /* Literal.String.Regex */
|
||||
code[class^='language-'] .s1:not([id^='MathJax']) { background-color: #fff0f0 } /* Literal.String.Single */
|
||||
code[class^='language-'] .ss:not([id^='MathJax']) { color: #A06000 } /* Literal.String.Symbol */
|
||||
code[class^='language-'] .bp:not([id^='MathJax']) { color: #007020 } /* Name.Builtin.Pseudo */
|
||||
code[class^='language-'] .vc:not([id^='MathJax']) { color: #306090 } /* Name.Variable.Class */
|
||||
code[class^='language-'] .vg:not([id^='MathJax']) { color: #d07000; font-weight: bold } /* Name.Variable.Global */
|
||||
code[class^='language-'] .vi:not([id^='MathJax']) { color: #3030B0 } /* Name.Variable.Instance */
|
||||
code[class^='language-'] .il:not([id^='MathJax']) { color: #0000D0; font-weight: bold } /* Literal.Number.Integer.Long */
|
||||
8
content/assets/css/cotton_candy.css
Normal file
8
content/assets/css/cotton_candy.css
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
#main code, code * { color: #675D69; }
|
||||
code[class^='language-'] .k:not([id^='MathJax']) { color: #143A77; }
|
||||
code[class^='language-'] .kp:not([id^='MathJax']) { color: #8C5DC7; }
|
||||
code[class^='language-'] .kd:not([id^='MathJax']) { color: #8C5DC7; }
|
||||
code[class^='language-'] .mi:not([id^='MathJax']) { color: #8C5DC7; }
|
||||
code[class^='language-'] .s:not([id^='MathJax']) { color: #0060B0; }
|
||||
code[class^='language-'] .c:not([id^='MathJax']) { color: #91B9A3; }
|
||||
code[class^='language-'] .o:not([id^='MathJax']) { color: #009DE7; }
|
||||
133
content/assets/css/main.css
Normal file
133
content/assets/css/main.css
Normal file
|
|
@ -0,0 +1,133 @@
|
|||
body {
|
||||
background: #F5F7F6;
|
||||
color: #000000;
|
||||
margin: 0; padding: 0;
|
||||
max-width: 720px;
|
||||
|
||||
text-rendering: optimizelegibility;
|
||||
|
||||
font-family: Palatino, serif;
|
||||
line-height: 20px;
|
||||
}
|
||||
|
||||
#sidebar {
|
||||
margin: 15px;
|
||||
float: left;
|
||||
width: 205px;
|
||||
padding: 10px 0;
|
||||
|
||||
background-color: #FFF;
|
||||
box-shadow: 0px 0px 5px 0px rgba(0,0,0,0.5);
|
||||
|
||||
transition: margin-left 1s;
|
||||
}
|
||||
|
||||
#sidebar.collapsed { margin-left: -180px; }
|
||||
|
||||
#sidebar ul { padding: 0 1em; margin: 0; list-style-type: none; }
|
||||
#sidebar li:before { content: '⁃'; padding-right: 0.5em; color: black; }
|
||||
#sidebar li.visited:before { content: '✔'; padding-right: 0.2em; color: green; }
|
||||
|
||||
|
||||
.abs-hamburger {
|
||||
position: relative;
|
||||
width: 0; height: 0;
|
||||
}
|
||||
.nav-toggle {
|
||||
position: absolute;
|
||||
left: 175px;
|
||||
width: 25px; height: 25px;
|
||||
cursor: pointer;
|
||||
margin-right: 5px;
|
||||
margin-bottom: 5px;
|
||||
}
|
||||
.nav-toggle span,
|
||||
.nav-toggle span:before,
|
||||
.nav-toggle span:after {
|
||||
border-radius: 1px;
|
||||
height: 5px;
|
||||
width: 25px;
|
||||
background: white;
|
||||
position: absolute;
|
||||
display: block;
|
||||
content: '';
|
||||
box-shadow: inset 0px 0px 2px 0px #000;
|
||||
}
|
||||
.nav-toggle span:before { top: -8px; }
|
||||
.nav-toggle span:after { bottom: -8px; }
|
||||
.nav-toggle span { margin-top: 9.5px; }
|
||||
|
||||
|
||||
#nextprev {
|
||||
overflow: hidden;
|
||||
padding: .5em 1em;
|
||||
}
|
||||
|
||||
.text-icon { font-size: 5em; }
|
||||
#arrow-prev { float: left; }
|
||||
#arrow-next { float: right; }
|
||||
|
||||
|
||||
article {
|
||||
margin: 15px;
|
||||
|
||||
transition: max-width 1s;
|
||||
}
|
||||
article.expanded { max-width: 680px; }
|
||||
|
||||
|
||||
a { text-decoration: none; }
|
||||
a:link, a:visited { color: #B45D47; }
|
||||
a:hover { color: #FE3B3B; }
|
||||
|
||||
a.disabled, a:link.disabled, a:visited.disabled { color: #999; pointer-events: none; }
|
||||
a:hover.disabled { color: #888; }
|
||||
|
||||
|
||||
pre, code { font-family: Monaco, Menlo, Consolas, "Courier New", monospace; }
|
||||
code {
|
||||
border-radius: 1px;
|
||||
background-color: #FFF;
|
||||
padding: 0.2em;
|
||||
}
|
||||
pre code {
|
||||
display: block;
|
||||
padding: 1em;
|
||||
white-space: pre-wrap;
|
||||
}
|
||||
|
||||
|
||||
h1, h2, h3, h4, h5, h6 { line-height: 125%; }
|
||||
|
||||
|
||||
footer {
|
||||
margin-top: 50px;
|
||||
clear: both;
|
||||
|
||||
text-align: center;
|
||||
color: #777;
|
||||
}
|
||||
footer ul { list-style: none; margin: 0; padding: 0; }
|
||||
footer li { display: inline; }
|
||||
footer li+li:before { content: '|'; }
|
||||
footer a:link, footer a:visited { color: #777; }
|
||||
footer a:hover { color: #999; }
|
||||
|
||||
.notransition {
|
||||
-webkit-transition: none !important;
|
||||
-moz-transition: none !important;
|
||||
-o-transition: none !important;
|
||||
-ms-transition: none !important;
|
||||
transition: none !important;
|
||||
}
|
||||
|
||||
|
||||
@media screen and (min-width: 925px) {
|
||||
body { margin: 0 auto; }
|
||||
body #sidebar.collapsed, body #sidebar { margin-left: -205px; }
|
||||
body article.expanded, body article { max-width: none; width: none; min-width: none; }
|
||||
}
|
||||
|
||||
@media screen and (max-width: 1200px) {
|
||||
body { margin-right: 0; }
|
||||
}
|
||||
1
content/assets/css/normalize.css
vendored
Normal file
1
content/assets/css/normalize.css
vendored
Normal file
|
|
@ -0,0 +1 @@
|
|||
/*! normalize.css v3.0.3 | MIT License | github.com/necolas/normalize.css */html{font-family:sans-serif;-ms-text-size-adjust:100%;-webkit-text-size-adjust:100%}body{margin:0}article,aside,details,figcaption,figure,footer,header,hgroup,main,menu,nav,section,summary{display:block}audio,canvas,progress,video{display:inline-block;vertical-align:baseline}audio:not([controls]){display:none;height:0}[hidden],template{display:none}a{background-color:transparent}a:active,a:hover{outline:0}abbr[title]{border-bottom:1px dotted}b,strong{font-weight:bold}dfn{font-style:italic}h1{font-size:2em;margin:.67em 0}mark{background:#ff0;color:#000}small{font-size:80%}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}sup{top:-0.5em}sub{bottom:-0.25em}img{border:0}svg:not(:root){overflow:hidden}figure{margin:1em 40px}hr{box-sizing:content-box;height:0}pre{overflow:auto}code,kbd,pre,samp{font-family:monospace,monospace;font-size:1em}button,input,optgroup,select,textarea{color:inherit;font:inherit;margin:0}button{overflow:visible}button,select{text-transform:none}button,html input[type="button"],input[type="reset"],input[type="submit"]{-webkit-appearance:button;cursor:pointer}button[disabled],html input[disabled]{cursor:default}button::-moz-focus-inner,input::-moz-focus-inner{border:0;padding:0}input{line-height:normal}input[type="checkbox"],input[type="radio"]{box-sizing:border-box;padding:0}input[type="number"]::-webkit-inner-spin-button,input[type="number"]::-webkit-outer-spin-button{height:auto}input[type="search"]{-webkit-appearance:textfield;box-sizing:content-box}input[type="search"]::-webkit-search-cancel-button,input[type="search"]::-webkit-search-decoration{-webkit-appearance:none}fieldset{border:1px solid silver;margin:0 2px;padding:.35em .625em .75em}legend{border:0;padding:0}textarea{overflow:auto}optgroup{font-weight:bold}table{border-collapse:collapse;border-spacing:0}td,th{padding:0}
|
||||
1
content/assets/js/all.js
Normal file
1
content/assets/js/all.js
Normal file
|
|
@ -0,0 +1 @@
|
|||
<%= all_js @config[:scripts] %>
|
||||
74
content/assets/js/main.js
Normal file
74
content/assets/js/main.js
Normal file
|
|
@ -0,0 +1,74 @@
|
|||
function setVisibleTags(){
|
||||
var tocLinks = document.querySelectorAll("#sidebar a:link, a:visited");
|
||||
for(var i = 0; i < tocLinks.length; i++){
|
||||
if(localStorage.getItem(tocLinks[i].getAttribute("href")) != null){
|
||||
tocLinks[i].parentNode.classList.add("visited");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function updateSidebar(notransition) {
|
||||
if (notransition) {
|
||||
document.querySelectorAll("#sidebar")[0].classList.add("notransition");
|
||||
document.querySelectorAll("article")[0].classList.add("notransition");
|
||||
}
|
||||
localStorage.setItem("openside", window.sidebarExpanded);
|
||||
if (!window.sidebarExpanded) {
|
||||
document.querySelectorAll("#sidebar")[0].classList.add("collapsed");
|
||||
document.querySelectorAll("article")[0].classList.add("expanded");
|
||||
} else {
|
||||
document.querySelectorAll("#sidebar")[0].classList.remove("collapsed");
|
||||
document.querySelectorAll("article")[0].classList.remove("expanded");
|
||||
}
|
||||
if (notransition) {
|
||||
setTimeout(function(){
|
||||
document.querySelectorAll("#sidebar")[0].classList.remove("notransition");
|
||||
document.querySelectorAll("article")[0].classList.remove("notransition");
|
||||
}, 100);
|
||||
}
|
||||
}
|
||||
|
||||
function sidebarClick() {
|
||||
window.sidebarExpanded = !window.sidebarExpanded;
|
||||
updateSidebar(false);
|
||||
}
|
||||
|
||||
function getNextPrev() {
|
||||
// thanks iznogoodd from #nim @ freenode.net
|
||||
var links = document.querySelectorAll('#sidebar a[href]');
|
||||
|
||||
var nav = {prev: null, next: null};
|
||||
for(var i = 0; i < links.length; i++){
|
||||
var item = links.item(i);
|
||||
if(item && item.getAttribute('href') === window.location.pathname){
|
||||
nav.prev = links.item(i - 1) && links.item(i - 1).getAttribute('href');
|
||||
nav.next = links.item(i + 1) && links.item(i + 1).getAttribute('href');
|
||||
return nav;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function updateNextPrevButtons() {
|
||||
var nav = getNextPrev();
|
||||
|
||||
var prev = document.getElementById("arrow-prev");
|
||||
var next = document.getElementById("arrow-next");
|
||||
|
||||
if (nav.prev != null) { prev.classList.remove("disabled"); prev.href = nav.prev; }
|
||||
if (nav.next != null) { next.classList.remove("disabled"); next.href = nav.next; }
|
||||
}
|
||||
|
||||
|
||||
var isMobile = window.screen.width < 720;
|
||||
if (localStorage.getItem("openside") === null) {
|
||||
window.sidebarExpanded = !isMobile;
|
||||
} else {
|
||||
window.sidebarExpanded = (localStorage.getItem("openside") === "true");
|
||||
}
|
||||
|
||||
localStorage.setItem(window.location.pathname, true);
|
||||
window.onload = function(){
|
||||
updateSidebar(true);
|
||||
setVisibleTags();
|
||||
updateNextPrevButtons();
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue