making header block
This commit is contained in:
parent
2a44193a89
commit
9df83d328d
7 changed files with 1629 additions and 9 deletions
|
@ -13,7 +13,9 @@ class WebsiteConfig {
|
|||
public title: string = "";
|
||||
public description: string = "";
|
||||
public background: string = "#218c74";
|
||||
public localization: string = "en";
|
||||
public accent: string = "#ffc107";
|
||||
public language: string = "en";
|
||||
public localization: string = "en-US";
|
||||
}
|
||||
|
||||
export async function loadConfig(): Promise<Config | null> {
|
||||
|
|
12
src/private/css/magma.css
Normal file
12
src/private/css/magma.css
Normal file
|
@ -0,0 +1,12 @@
|
|||
#header {
|
||||
margin-top: 10%;
|
||||
}
|
||||
|
||||
#footer {
|
||||
margin-bottom: 10%;
|
||||
}
|
||||
|
||||
#header-right {
|
||||
align-content: center;
|
||||
float: right;
|
||||
}
|
427
src/private/css/normalize.css
vendored
Normal file
427
src/private/css/normalize.css
vendored
Normal file
|
@ -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;
|
||||
}
|
418
src/private/css/skeleton.css
vendored
Normal file
418
src/private/css/skeleton.css
vendored
Normal file
|
@ -0,0 +1,418 @@
|
|||
/*
|
||||
* Skeleton V2.0.4
|
||||
* Copyright 2014, Dave Gamache
|
||||
* www.getskeleton.com
|
||||
* Free to use under the MIT license.
|
||||
* http://www.opensource.org/licenses/mit-license.php
|
||||
* 12/29/2014
|
||||
*/
|
||||
|
||||
|
||||
/* Table of contents
|
||||
––––––––––––––––––––––––––––––––––––––––––––––––––
|
||||
- Grid
|
||||
- Base Styles
|
||||
- Typography
|
||||
- Links
|
||||
- Buttons
|
||||
- Forms
|
||||
- Lists
|
||||
- Code
|
||||
- Tables
|
||||
- Spacing
|
||||
- Utilities
|
||||
- Clearing
|
||||
- Media Queries
|
||||
*/
|
||||
|
||||
|
||||
/* Grid
|
||||
–––––––––––––––––––––––––––––––––––––––––––––––––– */
|
||||
.container {
|
||||
position: relative;
|
||||
width: 100%;
|
||||
max-width: 960px;
|
||||
margin: 0 auto;
|
||||
padding: 0 20px;
|
||||
box-sizing: border-box; }
|
||||
.column,
|
||||
.columns {
|
||||
width: 100%;
|
||||
float: left;
|
||||
box-sizing: border-box; }
|
||||
|
||||
/* For devices larger than 400px */
|
||||
@media (min-width: 400px) {
|
||||
.container {
|
||||
width: 85%;
|
||||
padding: 0; }
|
||||
}
|
||||
|
||||
/* For devices larger than 550px */
|
||||
@media (min-width: 550px) {
|
||||
.container {
|
||||
width: 80%; }
|
||||
.column,
|
||||
.columns {
|
||||
margin-left: 4%; }
|
||||
.column:first-child,
|
||||
.columns:first-child {
|
||||
margin-left: 0; }
|
||||
|
||||
.one.column,
|
||||
.one.columns { width: 4.66666666667%; }
|
||||
.two.columns { width: 13.3333333333%; }
|
||||
.three.columns { width: 22%; }
|
||||
.four.columns { width: 30.6666666667%; }
|
||||
.five.columns { width: 39.3333333333%; }
|
||||
.six.columns { width: 48%; }
|
||||
.seven.columns { width: 56.6666666667%; }
|
||||
.eight.columns { width: 65.3333333333%; }
|
||||
.nine.columns { width: 74.0%; }
|
||||
.ten.columns { width: 82.6666666667%; }
|
||||
.eleven.columns { width: 91.3333333333%; }
|
||||
.twelve.columns { width: 100%; margin-left: 0; }
|
||||
|
||||
.one-third.column { width: 30.6666666667%; }
|
||||
.two-thirds.column { width: 65.3333333333%; }
|
||||
|
||||
.one-half.column { width: 48%; }
|
||||
|
||||
/* Offsets */
|
||||
.offset-by-one.column,
|
||||
.offset-by-one.columns { margin-left: 8.66666666667%; }
|
||||
.offset-by-two.column,
|
||||
.offset-by-two.columns { margin-left: 17.3333333333%; }
|
||||
.offset-by-three.column,
|
||||
.offset-by-three.columns { margin-left: 26%; }
|
||||
.offset-by-four.column,
|
||||
.offset-by-four.columns { margin-left: 34.6666666667%; }
|
||||
.offset-by-five.column,
|
||||
.offset-by-five.columns { margin-left: 43.3333333333%; }
|
||||
.offset-by-six.column,
|
||||
.offset-by-six.columns { margin-left: 52%; }
|
||||
.offset-by-seven.column,
|
||||
.offset-by-seven.columns { margin-left: 60.6666666667%; }
|
||||
.offset-by-eight.column,
|
||||
.offset-by-eight.columns { margin-left: 69.3333333333%; }
|
||||
.offset-by-nine.column,
|
||||
.offset-by-nine.columns { margin-left: 78.0%; }
|
||||
.offset-by-ten.column,
|
||||
.offset-by-ten.columns { margin-left: 86.6666666667%; }
|
||||
.offset-by-eleven.column,
|
||||
.offset-by-eleven.columns { margin-left: 95.3333333333%; }
|
||||
|
||||
.offset-by-one-third.column,
|
||||
.offset-by-one-third.columns { margin-left: 34.6666666667%; }
|
||||
.offset-by-two-thirds.column,
|
||||
.offset-by-two-thirds.columns { margin-left: 69.3333333333%; }
|
||||
|
||||
.offset-by-one-half.column,
|
||||
.offset-by-one-half.columns { margin-left: 52%; }
|
||||
|
||||
}
|
||||
|
||||
|
||||
/* Base Styles
|
||||
–––––––––––––––––––––––––––––––––––––––––––––––––– */
|
||||
/* NOTE
|
||||
html is set to 62.5% so that all the REM measurements throughout Skeleton
|
||||
are based on 10px sizing. So basically 1.5rem = 15px :) */
|
||||
html {
|
||||
font-size: 62.5%; }
|
||||
body {
|
||||
font-size: 1.5em; /* currently ems cause chrome bug misinterpreting rems on body element */
|
||||
line-height: 1.6;
|
||||
font-weight: 400;
|
||||
font-family: "Raleway", "HelveticaNeue", "Helvetica Neue", Helvetica, Arial, sans-serif;
|
||||
color: #222; }
|
||||
|
||||
|
||||
/* Typography
|
||||
–––––––––––––––––––––––––––––––––––––––––––––––––– */
|
||||
h1, h2, h3, h4, h5, h6 {
|
||||
margin-top: 0;
|
||||
margin-bottom: 2rem;
|
||||
font-weight: 300; }
|
||||
h1 { font-size: 4.0rem; line-height: 1.2; letter-spacing: -.1rem;}
|
||||
h2 { font-size: 3.6rem; line-height: 1.25; letter-spacing: -.1rem; }
|
||||
h3 { font-size: 3.0rem; line-height: 1.3; letter-spacing: -.1rem; }
|
||||
h4 { font-size: 2.4rem; line-height: 1.35; letter-spacing: -.08rem; }
|
||||
h5 { font-size: 1.8rem; line-height: 1.5; letter-spacing: -.05rem; }
|
||||
h6 { font-size: 1.5rem; line-height: 1.6; letter-spacing: 0; }
|
||||
|
||||
/* Larger than phablet */
|
||||
@media (min-width: 550px) {
|
||||
h1 { font-size: 5.0rem; }
|
||||
h2 { font-size: 4.2rem; }
|
||||
h3 { font-size: 3.6rem; }
|
||||
h4 { font-size: 3.0rem; }
|
||||
h5 { font-size: 2.4rem; }
|
||||
h6 { font-size: 1.5rem; }
|
||||
}
|
||||
|
||||
p {
|
||||
margin-top: 0; }
|
||||
|
||||
|
||||
/* Links
|
||||
–––––––––––––––––––––––––––––––––––––––––––––––––– */
|
||||
a {
|
||||
color: #1EAEDB; }
|
||||
a:hover {
|
||||
color: #0FA0CE; }
|
||||
|
||||
|
||||
/* Buttons
|
||||
–––––––––––––––––––––––––––––––––––––––––––––––––– */
|
||||
.button,
|
||||
button,
|
||||
input[type="submit"],
|
||||
input[type="reset"],
|
||||
input[type="button"] {
|
||||
display: inline-block;
|
||||
height: 38px;
|
||||
padding: 0 30px;
|
||||
color: #555;
|
||||
text-align: center;
|
||||
font-size: 11px;
|
||||
font-weight: 600;
|
||||
line-height: 38px;
|
||||
letter-spacing: .1rem;
|
||||
text-transform: uppercase;
|
||||
text-decoration: none;
|
||||
white-space: nowrap;
|
||||
background-color: transparent;
|
||||
border-radius: 4px;
|
||||
border: 1px solid #bbb;
|
||||
cursor: pointer;
|
||||
box-sizing: border-box; }
|
||||
.button:hover,
|
||||
button:hover,
|
||||
input[type="submit"]:hover,
|
||||
input[type="reset"]:hover,
|
||||
input[type="button"]:hover,
|
||||
.button:focus,
|
||||
button:focus,
|
||||
input[type="submit"]:focus,
|
||||
input[type="reset"]:focus,
|
||||
input[type="button"]:focus {
|
||||
color: #333;
|
||||
border-color: #888;
|
||||
outline: 0; }
|
||||
.button.button-primary,
|
||||
button.button-primary,
|
||||
input[type="submit"].button-primary,
|
||||
input[type="reset"].button-primary,
|
||||
input[type="button"].button-primary {
|
||||
color: #FFF;
|
||||
background-color: #33C3F0;
|
||||
border-color: #33C3F0; }
|
||||
.button.button-primary:hover,
|
||||
button.button-primary:hover,
|
||||
input[type="submit"].button-primary:hover,
|
||||
input[type="reset"].button-primary:hover,
|
||||
input[type="button"].button-primary:hover,
|
||||
.button.button-primary:focus,
|
||||
button.button-primary:focus,
|
||||
input[type="submit"].button-primary:focus,
|
||||
input[type="reset"].button-primary:focus,
|
||||
input[type="button"].button-primary:focus {
|
||||
color: #FFF;
|
||||
background-color: #1EAEDB;
|
||||
border-color: #1EAEDB; }
|
||||
|
||||
|
||||
/* Forms
|
||||
–––––––––––––––––––––––––––––––––––––––––––––––––– */
|
||||
input[type="email"],
|
||||
input[type="number"],
|
||||
input[type="search"],
|
||||
input[type="text"],
|
||||
input[type="tel"],
|
||||
input[type="url"],
|
||||
input[type="password"],
|
||||
textarea,
|
||||
select {
|
||||
height: 38px;
|
||||
padding: 6px 10px; /* The 6px vertically centers text on FF, ignored by Webkit */
|
||||
background-color: #fff;
|
||||
border: 1px solid #D1D1D1;
|
||||
border-radius: 4px;
|
||||
box-shadow: none;
|
||||
box-sizing: border-box; }
|
||||
/* Removes awkward default styles on some inputs for iOS */
|
||||
input[type="email"],
|
||||
input[type="number"],
|
||||
input[type="search"],
|
||||
input[type="text"],
|
||||
input[type="tel"],
|
||||
input[type="url"],
|
||||
input[type="password"],
|
||||
textarea {
|
||||
-webkit-appearance: none;
|
||||
-moz-appearance: none;
|
||||
appearance: none; }
|
||||
textarea {
|
||||
min-height: 65px;
|
||||
padding-top: 6px;
|
||||
padding-bottom: 6px; }
|
||||
input[type="email"]:focus,
|
||||
input[type="number"]:focus,
|
||||
input[type="search"]:focus,
|
||||
input[type="text"]:focus,
|
||||
input[type="tel"]:focus,
|
||||
input[type="url"]:focus,
|
||||
input[type="password"]:focus,
|
||||
textarea:focus,
|
||||
select:focus {
|
||||
border: 1px solid #33C3F0;
|
||||
outline: 0; }
|
||||
label,
|
||||
legend {
|
||||
display: block;
|
||||
margin-bottom: .5rem;
|
||||
font-weight: 600; }
|
||||
fieldset {
|
||||
padding: 0;
|
||||
border-width: 0; }
|
||||
input[type="checkbox"],
|
||||
input[type="radio"] {
|
||||
display: inline; }
|
||||
label > .label-body {
|
||||
display: inline-block;
|
||||
margin-left: .5rem;
|
||||
font-weight: normal; }
|
||||
|
||||
|
||||
/* Lists
|
||||
–––––––––––––––––––––––––––––––––––––––––––––––––– */
|
||||
ul {
|
||||
list-style: circle inside; }
|
||||
ol {
|
||||
list-style: decimal inside; }
|
||||
ol, ul {
|
||||
padding-left: 0;
|
||||
margin-top: 0; }
|
||||
ul ul,
|
||||
ul ol,
|
||||
ol ol,
|
||||
ol ul {
|
||||
margin: 1.5rem 0 1.5rem 3rem;
|
||||
font-size: 90%; }
|
||||
li {
|
||||
margin-bottom: 1rem; }
|
||||
|
||||
|
||||
/* Code
|
||||
–––––––––––––––––––––––––––––––––––––––––––––––––– */
|
||||
code {
|
||||
padding: .2rem .5rem;
|
||||
margin: 0 .2rem;
|
||||
font-size: 90%;
|
||||
white-space: nowrap;
|
||||
background: #F1F1F1;
|
||||
border: 1px solid #E1E1E1;
|
||||
border-radius: 4px; }
|
||||
pre > code {
|
||||
display: block;
|
||||
padding: 1rem 1.5rem;
|
||||
white-space: pre; }
|
||||
|
||||
|
||||
/* Tables
|
||||
–––––––––––––––––––––––––––––––––––––––––––––––––– */
|
||||
th,
|
||||
td {
|
||||
padding: 12px 15px;
|
||||
text-align: left;
|
||||
border-bottom: 1px solid #E1E1E1; }
|
||||
th:first-child,
|
||||
td:first-child {
|
||||
padding-left: 0; }
|
||||
th:last-child,
|
||||
td:last-child {
|
||||
padding-right: 0; }
|
||||
|
||||
|
||||
/* Spacing
|
||||
–––––––––––––––––––––––––––––––––––––––––––––––––– */
|
||||
button,
|
||||
.button {
|
||||
margin-bottom: 1rem; }
|
||||
input,
|
||||
textarea,
|
||||
select,
|
||||
fieldset {
|
||||
margin-bottom: 1.5rem; }
|
||||
pre,
|
||||
blockquote,
|
||||
dl,
|
||||
figure,
|
||||
table,
|
||||
p,
|
||||
ul,
|
||||
ol,
|
||||
form {
|
||||
margin-bottom: 2.5rem; }
|
||||
|
||||
|
||||
/* Utilities
|
||||
–––––––––––––––––––––––––––––––––––––––––––––––––– */
|
||||
.u-full-width {
|
||||
width: 100%;
|
||||
box-sizing: border-box; }
|
||||
.u-max-full-width {
|
||||
max-width: 100%;
|
||||
box-sizing: border-box; }
|
||||
.u-pull-right {
|
||||
float: right; }
|
||||
.u-pull-left {
|
||||
float: left; }
|
||||
|
||||
|
||||
/* Misc
|
||||
–––––––––––––––––––––––––––––––––––––––––––––––––– */
|
||||
hr {
|
||||
margin-top: 3rem;
|
||||
margin-bottom: 3.5rem;
|
||||
border-width: 0;
|
||||
border-top: 1px solid #E1E1E1; }
|
||||
|
||||
|
||||
/* Clearing
|
||||
–––––––––––––––––––––––––––––––––––––––––––––––––– */
|
||||
|
||||
/* Self Clearing Goodness */
|
||||
.container:after,
|
||||
.row:after,
|
||||
.u-cf {
|
||||
content: "";
|
||||
display: table;
|
||||
clear: both; }
|
||||
|
||||
|
||||
/* Media Queries
|
||||
–––––––––––––––––––––––––––––––––––––––––––––––––– */
|
||||
/*
|
||||
Note: The best way to structure the use of media queries is to create the queries
|
||||
near the relevant code. For example, if you wanted to change the styles for buttons
|
||||
on small devices, paste the mobile query code up in the buttons section and style it
|
||||
there.
|
||||
*/
|
||||
|
||||
|
||||
/* Larger than mobile */
|
||||
@media (min-width: 400px) {}
|
||||
|
||||
/* Larger than phablet (also point when grid becomes active) */
|
||||
@media (min-width: 550px) {}
|
||||
|
||||
/* Larger than tablet */
|
||||
@media (min-width: 750px) {}
|
||||
|
||||
/* Larger than desktop */
|
||||
@media (min-width: 1000px) {}
|
||||
|
||||
/* Larger than Desktop HD */
|
||||
@media (min-width: 1200px) {}
|
|
@ -1,12 +1,37 @@
|
|||
<!DOCTYPE html>
|
||||
<html lang="{{localization}}">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<title>{{title}}</title>
|
||||
<meta name="description" content="{{description}}"/>
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
</head>
|
||||
<html lang="{{language}}">
|
||||
|
||||
<body style="background: {{background}}"></body>
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<title>{{title}}</title>
|
||||
<meta name="description" content="{{description}}" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
|
||||
<link href="//fonts.googleapis.com/css?family=Raleway:400,300,600" rel="stylesheet" type="text/css">
|
||||
|
||||
<link rel="stylesheet" href="css/normalize.css">
|
||||
<link rel="stylesheet" href="css/skeleton.css">
|
||||
<link rel="stylesheet" href="css/magma.css">
|
||||
</head>
|
||||
|
||||
<body style="background: {{background}}">
|
||||
<div class="container">
|
||||
<div id="header" class="row">
|
||||
<div class="two-thirds column">
|
||||
<h5 id="clock"></h5>
|
||||
<h1><b id="welcome">Good afternoon!</b></h1>
|
||||
</b>
|
||||
</div>
|
||||
<div id="header-right" class="one-third column">
|
||||
<canvas id="weather-icon" width="50" height="50"></canvas>
|
||||
</div>
|
||||
</div>
|
||||
<div id="content" class="row"></div>
|
||||
<div id="footer" class="row"></div>
|
||||
</div>
|
||||
|
||||
<script src="js/skycons.js"></script>
|
||||
<script src="js/magma.js"></script>
|
||||
</body>
|
||||
|
||||
</html>
|
10
src/private/js/magma.js
Normal file
10
src/private/js/magma.js
Normal file
|
@ -0,0 +1,10 @@
|
|||
|
||||
var clock = document.getElementById("clock");
|
||||
const clockOptions = { weekday: 'long', year: 'numeric', month: 'long', day: 'numeric', hour: 'numeric', minute: 'numeric' };
|
||||
(function clockTick() {
|
||||
clock.innerText = new Date().toLocaleTimeString("vi-vn", clockOptions);
|
||||
setTimeout(clockTick, 2000);
|
||||
})();
|
||||
|
||||
var skycons = new Skycons({ "color": "pink" });
|
||||
skycons.add("weather-icon", Skycons.PARTLY_CLOUDY_DAY);
|
726
src/private/js/skycons.js
Normal file
726
src/private/js/skycons.js
Normal file
|
@ -0,0 +1,726 @@
|
|||
(function (global) {
|
||||
"use strict";
|
||||
|
||||
/* Set up a RequestAnimationFrame shim so we can animate efficiently FOR
|
||||
* GREAT JUSTICE. */
|
||||
var requestInterval, cancelInterval;
|
||||
|
||||
(function () {
|
||||
var raf = global.requestAnimationFrame ||
|
||||
global.webkitRequestAnimationFrame ||
|
||||
global.mozRequestAnimationFrame ||
|
||||
global.oRequestAnimationFrame ||
|
||||
global.msRequestAnimationFrame,
|
||||
caf = global.cancelAnimationFrame ||
|
||||
global.webkitCancelAnimationFrame ||
|
||||
global.mozCancelAnimationFrame ||
|
||||
global.oCancelAnimationFrame ||
|
||||
global.msCancelAnimationFrame;
|
||||
|
||||
if (raf && caf) {
|
||||
requestInterval = function (fn) {
|
||||
var handle = { value: null };
|
||||
|
||||
function loop() {
|
||||
handle.value = raf(loop);
|
||||
fn();
|
||||
}
|
||||
|
||||
loop();
|
||||
return handle;
|
||||
};
|
||||
|
||||
cancelInterval = function (handle) {
|
||||
caf(handle.value);
|
||||
};
|
||||
}
|
||||
|
||||
else {
|
||||
requestInterval = setInterval;
|
||||
cancelInterval = clearInterval;
|
||||
}
|
||||
}());
|
||||
|
||||
/* Catmull-rom spline stuffs. */
|
||||
/*
|
||||
function upsample(n, spline) {
|
||||
var polyline = [],
|
||||
len = spline.length,
|
||||
bx = spline[0],
|
||||
by = spline[1],
|
||||
cx = spline[2],
|
||||
cy = spline[3],
|
||||
dx = spline[4],
|
||||
dy = spline[5],
|
||||
i, j, ax, ay, px, qx, rx, sx, py, qy, ry, sy, t;
|
||||
|
||||
for(i = 6; i !== spline.length; i += 2) {
|
||||
ax = bx;
|
||||
bx = cx;
|
||||
cx = dx;
|
||||
dx = spline[i ];
|
||||
px = -0.5 * ax + 1.5 * bx - 1.5 * cx + 0.5 * dx;
|
||||
qx = ax - 2.5 * bx + 2.0 * cx - 0.5 * dx;
|
||||
rx = -0.5 * ax + 0.5 * cx ;
|
||||
sx = bx ;
|
||||
|
||||
ay = by;
|
||||
by = cy;
|
||||
cy = dy;
|
||||
dy = spline[i + 1];
|
||||
py = -0.5 * ay + 1.5 * by - 1.5 * cy + 0.5 * dy;
|
||||
qy = ay - 2.5 * by + 2.0 * cy - 0.5 * dy;
|
||||
ry = -0.5 * ay + 0.5 * cy ;
|
||||
sy = by ;
|
||||
|
||||
for(j = 0; j !== n; ++j) {
|
||||
t = j / n;
|
||||
|
||||
polyline.push(
|
||||
((px * t + qx) * t + rx) * t + sx,
|
||||
((py * t + qy) * t + ry) * t + sy
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
polyline.push(
|
||||
px + qx + rx + sx,
|
||||
py + qy + ry + sy
|
||||
);
|
||||
|
||||
return polyline;
|
||||
}
|
||||
|
||||
function downsample(n, polyline) {
|
||||
var len = 0,
|
||||
i, dx, dy;
|
||||
|
||||
for(i = 2; i !== polyline.length; i += 2) {
|
||||
dx = polyline[i ] - polyline[i - 2];
|
||||
dy = polyline[i + 1] - polyline[i - 1];
|
||||
len += Math.sqrt(dx * dx + dy * dy);
|
||||
}
|
||||
|
||||
len /= n;
|
||||
|
||||
var small = [],
|
||||
target = len,
|
||||
min = 0,
|
||||
max, t;
|
||||
|
||||
small.push(polyline[0], polyline[1]);
|
||||
|
||||
for(i = 2; i !== polyline.length; i += 2) {
|
||||
dx = polyline[i ] - polyline[i - 2];
|
||||
dy = polyline[i + 1] - polyline[i - 1];
|
||||
max = min + Math.sqrt(dx * dx + dy * dy);
|
||||
|
||||
if(max > target) {
|
||||
t = (target - min) / (max - min);
|
||||
|
||||
small.push(
|
||||
polyline[i - 2] + dx * t,
|
||||
polyline[i - 1] + dy * t
|
||||
);
|
||||
|
||||
target += len;
|
||||
}
|
||||
|
||||
min = max;
|
||||
}
|
||||
|
||||
small.push(polyline[polyline.length - 2], polyline[polyline.length - 1]);
|
||||
|
||||
return small;
|
||||
}
|
||||
*/
|
||||
|
||||
/* Define skycon things. */
|
||||
/* FIXME: I'm *really really* sorry that this code is so gross. Really, I am.
|
||||
* I'll try to clean it up eventually! Promise! */
|
||||
var KEYFRAME = 500,
|
||||
STROKE = 0.08,
|
||||
TAU = 2.0 * Math.PI,
|
||||
TWO_OVER_SQRT_2 = 2.0 / Math.sqrt(2);
|
||||
|
||||
function circle(ctx, x, y, r) {
|
||||
ctx.beginPath();
|
||||
ctx.arc(x, y, r, 0, TAU, false);
|
||||
ctx.fill();
|
||||
}
|
||||
|
||||
function line(ctx, ax, ay, bx, by) {
|
||||
ctx.beginPath();
|
||||
ctx.moveTo(ax, ay);
|
||||
ctx.lineTo(bx, by);
|
||||
ctx.stroke();
|
||||
}
|
||||
|
||||
function puff(ctx, t, cx, cy, rx, ry, rmin, rmax) {
|
||||
var c = Math.cos(t * TAU),
|
||||
s = Math.sin(t * TAU);
|
||||
|
||||
rmax -= rmin;
|
||||
|
||||
circle(
|
||||
ctx,
|
||||
cx - s * rx,
|
||||
cy + c * ry + rmax * 0.5,
|
||||
rmin + (1 - c * 0.5) * rmax
|
||||
);
|
||||
}
|
||||
|
||||
function puffs(ctx, t, cx, cy, rx, ry, rmin, rmax) {
|
||||
var i;
|
||||
|
||||
for (i = 5; i--;)
|
||||
puff(ctx, t + i / 5, cx, cy, rx, ry, rmin, rmax);
|
||||
}
|
||||
|
||||
function cloud(ctx, t, cx, cy, cw, s, color) {
|
||||
t /= 30000;
|
||||
|
||||
var a = cw * 0.21,
|
||||
b = cw * 0.12,
|
||||
c = cw * 0.24,
|
||||
d = cw * 0.28;
|
||||
|
||||
ctx.fillStyle = color;
|
||||
puffs(ctx, t, cx, cy, a, b, c, d);
|
||||
|
||||
ctx.globalCompositeOperation = 'destination-out';
|
||||
puffs(ctx, t, cx, cy, a, b, c - s, d - s);
|
||||
ctx.globalCompositeOperation = 'source-over';
|
||||
}
|
||||
|
||||
function sun(ctx, t, cx, cy, cw, s, color) {
|
||||
t /= 120000;
|
||||
|
||||
var a = cw * 0.25 - s * 0.5,
|
||||
b = cw * 0.32 + s * 0.5,
|
||||
c = cw * 0.50 - s * 0.5,
|
||||
i, p, cos, sin;
|
||||
|
||||
ctx.strokeStyle = color;
|
||||
ctx.lineWidth = s;
|
||||
ctx.lineCap = "round";
|
||||
ctx.lineJoin = "round";
|
||||
|
||||
ctx.beginPath();
|
||||
ctx.arc(cx, cy, a, 0, TAU, false);
|
||||
ctx.stroke();
|
||||
|
||||
for (i = 8; i--;) {
|
||||
p = (t + i / 8) * TAU;
|
||||
cos = Math.cos(p);
|
||||
sin = Math.sin(p);
|
||||
line(ctx, cx + cos * b, cy + sin * b, cx + cos * c, cy + sin * c);
|
||||
}
|
||||
}
|
||||
|
||||
function moon(ctx, t, cx, cy, cw, s, color) {
|
||||
t /= 15000;
|
||||
|
||||
var a = cw * 0.29 - s * 0.5,
|
||||
b = cw * 0.05,
|
||||
c = Math.cos(t * TAU),
|
||||
p = c * TAU / -16;
|
||||
|
||||
ctx.strokeStyle = color;
|
||||
ctx.lineWidth = s;
|
||||
ctx.lineCap = "round";
|
||||
ctx.lineJoin = "round";
|
||||
|
||||
cx += c * b;
|
||||
|
||||
ctx.beginPath();
|
||||
ctx.arc(cx, cy, a, p + TAU / 8, p + TAU * 7 / 8, false);
|
||||
ctx.arc(cx + Math.cos(p) * a * TWO_OVER_SQRT_2, cy + Math.sin(p) * a * TWO_OVER_SQRT_2, a, p + TAU * 5 / 8, p + TAU * 3 / 8, true);
|
||||
ctx.closePath();
|
||||
ctx.stroke();
|
||||
}
|
||||
|
||||
function rain(ctx, t, cx, cy, cw, s, color) {
|
||||
t /= 1350;
|
||||
|
||||
var a = cw * 0.16,
|
||||
b = TAU * 11 / 12,
|
||||
c = TAU * 7 / 12,
|
||||
i, p, x, y;
|
||||
|
||||
ctx.fillStyle = color;
|
||||
|
||||
for (i = 4; i--;) {
|
||||
p = (t + i / 4) % 1;
|
||||
x = cx + ((i - 1.5) / 1.5) * (i === 1 || i === 2 ? -1 : 1) * a;
|
||||
y = cy + p * p * cw;
|
||||
ctx.beginPath();
|
||||
ctx.moveTo(x, y - s * 1.5);
|
||||
ctx.arc(x, y, s * 0.75, b, c, false);
|
||||
ctx.fill();
|
||||
}
|
||||
}
|
||||
|
||||
function sleet(ctx, t, cx, cy, cw, s, color) {
|
||||
t /= 750;
|
||||
|
||||
var a = cw * 0.1875,
|
||||
i, p, x, y;
|
||||
|
||||
ctx.strokeStyle = color;
|
||||
ctx.lineWidth = s * 0.5;
|
||||
ctx.lineCap = "round";
|
||||
ctx.lineJoin = "round";
|
||||
|
||||
for (i = 4; i--;) {
|
||||
p = (t + i / 4) % 1;
|
||||
x = Math.floor(cx + ((i - 1.5) / 1.5) * (i === 1 || i === 2 ? -1 : 1) * a) + 0.5;
|
||||
y = cy + p * cw;
|
||||
line(ctx, x, y - s * 1.5, x, y + s * 1.5);
|
||||
}
|
||||
}
|
||||
|
||||
function snow(ctx, t, cx, cy, cw, s, color) {
|
||||
t /= 3000;
|
||||
|
||||
var a = cw * 0.16,
|
||||
b = s * 0.75,
|
||||
u = t * TAU * 0.7,
|
||||
ux = Math.cos(u) * b,
|
||||
uy = Math.sin(u) * b,
|
||||
v = u + TAU / 3,
|
||||
vx = Math.cos(v) * b,
|
||||
vy = Math.sin(v) * b,
|
||||
w = u + TAU * 2 / 3,
|
||||
wx = Math.cos(w) * b,
|
||||
wy = Math.sin(w) * b,
|
||||
i, p, x, y;
|
||||
|
||||
ctx.strokeStyle = color;
|
||||
ctx.lineWidth = s * 0.5;
|
||||
ctx.lineCap = "round";
|
||||
ctx.lineJoin = "round";
|
||||
|
||||
for (i = 4; i--;) {
|
||||
p = (t + i / 4) % 1;
|
||||
x = cx + Math.sin((p + i / 4) * TAU) * a;
|
||||
y = cy + p * cw;
|
||||
|
||||
line(ctx, x - ux, y - uy, x + ux, y + uy);
|
||||
line(ctx, x - vx, y - vy, x + vx, y + vy);
|
||||
line(ctx, x - wx, y - wy, x + wx, y + wy);
|
||||
}
|
||||
}
|
||||
|
||||
function fogbank(ctx, t, cx, cy, cw, s, color) {
|
||||
t /= 30000;
|
||||
|
||||
var a = cw * 0.21,
|
||||
b = cw * 0.06,
|
||||
c = cw * 0.21,
|
||||
d = cw * 0.28;
|
||||
|
||||
ctx.fillStyle = color;
|
||||
puffs(ctx, t, cx, cy, a, b, c, d);
|
||||
|
||||
ctx.globalCompositeOperation = 'destination-out';
|
||||
puffs(ctx, t, cx, cy, a, b, c - s, d - s);
|
||||
ctx.globalCompositeOperation = 'source-over';
|
||||
}
|
||||
|
||||
/*
|
||||
var WIND_PATHS = [
|
||||
downsample(63, upsample(8, [
|
||||
-1.00, -0.28,
|
||||
-0.75, -0.18,
|
||||
-0.50, 0.12,
|
||||
-0.20, 0.12,
|
||||
-0.04, -0.04,
|
||||
-0.07, -0.18,
|
||||
-0.19, -0.18,
|
||||
-0.23, -0.05,
|
||||
-0.12, 0.11,
|
||||
0.02, 0.16,
|
||||
0.20, 0.15,
|
||||
0.50, 0.07,
|
||||
0.75, 0.18,
|
||||
1.00, 0.28
|
||||
])),
|
||||
downsample(31, upsample(16, [
|
||||
-1.00, -0.10,
|
||||
-0.75, 0.00,
|
||||
-0.50, 0.10,
|
||||
-0.25, 0.14,
|
||||
0.00, 0.10,
|
||||
0.25, 0.00,
|
||||
0.50, -0.10,
|
||||
0.75, -0.14,
|
||||
1.00, -0.10
|
||||
]))
|
||||
];
|
||||
*/
|
||||
|
||||
var WIND_PATHS = [
|
||||
[
|
||||
-0.7500, -0.1800, -0.7219, -0.1527, -0.6971, -0.1225,
|
||||
-0.6739, -0.0910, -0.6516, -0.0588, -0.6298, -0.0262,
|
||||
-0.6083, 0.0065, -0.5868, 0.0396, -0.5643, 0.0731,
|
||||
-0.5372, 0.1041, -0.5033, 0.1259, -0.4662, 0.1406,
|
||||
-0.4275, 0.1493, -0.3881, 0.1530, -0.3487, 0.1526,
|
||||
-0.3095, 0.1488, -0.2708, 0.1421, -0.2319, 0.1342,
|
||||
-0.1943, 0.1217, -0.1600, 0.1025, -0.1290, 0.0785,
|
||||
-0.1012, 0.0509, -0.0764, 0.0206, -0.0547, -0.0120,
|
||||
-0.0378, -0.0472, -0.0324, -0.0857, -0.0389, -0.1241,
|
||||
-0.0546, -0.1599, -0.0814, -0.1876, -0.1193, -0.1964,
|
||||
-0.1582, -0.1935, -0.1931, -0.1769, -0.2157, -0.1453,
|
||||
-0.2290, -0.1085, -0.2327, -0.0697, -0.2240, -0.0317,
|
||||
-0.2064, 0.0033, -0.1853, 0.0362, -0.1613, 0.0672,
|
||||
-0.1350, 0.0961, -0.1051, 0.1213, -0.0706, 0.1397,
|
||||
-0.0332, 0.1512, 0.0053, 0.1580, 0.0442, 0.1624,
|
||||
0.0833, 0.1636, 0.1224, 0.1615, 0.1613, 0.1565,
|
||||
0.1999, 0.1500, 0.2378, 0.1402, 0.2749, 0.1279,
|
||||
0.3118, 0.1147, 0.3487, 0.1015, 0.3858, 0.0892,
|
||||
0.4236, 0.0787, 0.4621, 0.0715, 0.5012, 0.0702,
|
||||
0.5398, 0.0766, 0.5768, 0.0890, 0.6123, 0.1055,
|
||||
0.6466, 0.1244, 0.6805, 0.1440, 0.7147, 0.1630,
|
||||
0.7500, 0.1800
|
||||
],
|
||||
[
|
||||
-0.7500, 0.0000, -0.7033, 0.0195, -0.6569, 0.0399,
|
||||
-0.6104, 0.0600, -0.5634, 0.0789, -0.5155, 0.0954,
|
||||
-0.4667, 0.1089, -0.4174, 0.1206, -0.3676, 0.1299,
|
||||
-0.3174, 0.1365, -0.2669, 0.1398, -0.2162, 0.1391,
|
||||
-0.1658, 0.1347, -0.1157, 0.1271, -0.0661, 0.1169,
|
||||
-0.0170, 0.1046, 0.0316, 0.0903, 0.0791, 0.0728,
|
||||
0.1259, 0.0534, 0.1723, 0.0331, 0.2188, 0.0129,
|
||||
0.2656, -0.0064, 0.3122, -0.0263, 0.3586, -0.0466,
|
||||
0.4052, -0.0665, 0.4525, -0.0847, 0.5007, -0.1002,
|
||||
0.5497, -0.1130, 0.5991, -0.1240, 0.6491, -0.1325,
|
||||
0.6994, -0.1380, 0.7500, -0.1400
|
||||
]
|
||||
],
|
||||
WIND_OFFSETS = [
|
||||
{ start: 0.36, end: 0.11 },
|
||||
{ start: 0.56, end: 0.16 }
|
||||
];
|
||||
|
||||
function leaf(ctx, t, x, y, cw, s, color) {
|
||||
var a = cw / 8,
|
||||
b = a / 3,
|
||||
c = 2 * b,
|
||||
d = (t % 1) * TAU,
|
||||
e = Math.cos(d),
|
||||
f = Math.sin(d);
|
||||
|
||||
ctx.fillStyle = color;
|
||||
ctx.strokeStyle = color;
|
||||
ctx.lineWidth = s;
|
||||
ctx.lineCap = "round";
|
||||
ctx.lineJoin = "round";
|
||||
|
||||
ctx.beginPath();
|
||||
ctx.arc(x, y, a, d, d + Math.PI, false);
|
||||
ctx.arc(x - b * e, y - b * f, c, d + Math.PI, d, false);
|
||||
ctx.arc(x + c * e, y + c * f, b, d + Math.PI, d, true);
|
||||
ctx.globalCompositeOperation = 'destination-out';
|
||||
ctx.fill();
|
||||
ctx.globalCompositeOperation = 'source-over';
|
||||
ctx.stroke();
|
||||
}
|
||||
|
||||
function swoosh(ctx, t, cx, cy, cw, s, index, total, color) {
|
||||
t /= 2500;
|
||||
|
||||
var path = WIND_PATHS[index],
|
||||
a = (t + index - WIND_OFFSETS[index].start) % total,
|
||||
c = (t + index - WIND_OFFSETS[index].end) % total,
|
||||
e = (t + index) % total,
|
||||
b, d, f, i;
|
||||
|
||||
ctx.strokeStyle = color;
|
||||
ctx.lineWidth = s;
|
||||
ctx.lineCap = "round";
|
||||
ctx.lineJoin = "round";
|
||||
|
||||
if (a < 1) {
|
||||
ctx.beginPath();
|
||||
|
||||
a *= path.length / 2 - 1;
|
||||
b = Math.floor(a);
|
||||
a -= b;
|
||||
b *= 2;
|
||||
b += 2;
|
||||
|
||||
ctx.moveTo(
|
||||
cx + (path[b - 2] * (1 - a) + path[b] * a) * cw,
|
||||
cy + (path[b - 1] * (1 - a) + path[b + 1] * a) * cw
|
||||
);
|
||||
|
||||
if (c < 1) {
|
||||
c *= path.length / 2 - 1;
|
||||
d = Math.floor(c);
|
||||
c -= d;
|
||||
d *= 2;
|
||||
d += 2;
|
||||
|
||||
for (i = b; i !== d; i += 2)
|
||||
ctx.lineTo(cx + path[i] * cw, cy + path[i + 1] * cw);
|
||||
|
||||
ctx.lineTo(
|
||||
cx + (path[d - 2] * (1 - c) + path[d] * c) * cw,
|
||||
cy + (path[d - 1] * (1 - c) + path[d + 1] * c) * cw
|
||||
);
|
||||
}
|
||||
|
||||
else
|
||||
for (i = b; i !== path.length; i += 2)
|
||||
ctx.lineTo(cx + path[i] * cw, cy + path[i + 1] * cw);
|
||||
|
||||
ctx.stroke();
|
||||
}
|
||||
|
||||
else if (c < 1) {
|
||||
ctx.beginPath();
|
||||
|
||||
c *= path.length / 2 - 1;
|
||||
d = Math.floor(c);
|
||||
c -= d;
|
||||
d *= 2;
|
||||
d += 2;
|
||||
|
||||
ctx.moveTo(cx + path[0] * cw, cy + path[1] * cw);
|
||||
|
||||
for (i = 2; i !== d; i += 2)
|
||||
ctx.lineTo(cx + path[i] * cw, cy + path[i + 1] * cw);
|
||||
|
||||
ctx.lineTo(
|
||||
cx + (path[d - 2] * (1 - c) + path[d] * c) * cw,
|
||||
cy + (path[d - 1] * (1 - c) + path[d + 1] * c) * cw
|
||||
);
|
||||
|
||||
ctx.stroke();
|
||||
}
|
||||
|
||||
if (e < 1) {
|
||||
e *= path.length / 2 - 1;
|
||||
f = Math.floor(e);
|
||||
e -= f;
|
||||
f *= 2;
|
||||
f += 2;
|
||||
|
||||
leaf(
|
||||
ctx,
|
||||
t,
|
||||
cx + (path[f - 2] * (1 - e) + path[f] * e) * cw,
|
||||
cy + (path[f - 1] * (1 - e) + path[f + 1] * e) * cw,
|
||||
cw,
|
||||
s,
|
||||
color
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
var Skycons = function (opts) {
|
||||
this.list = [];
|
||||
this.interval = null;
|
||||
this.color = opts && opts.color ? opts.color : "black";
|
||||
this.resizeClear = !!(opts && opts.resizeClear);
|
||||
};
|
||||
|
||||
Skycons.CLEAR_DAY = function (ctx, t, color) {
|
||||
var w = ctx.canvas.width,
|
||||
h = ctx.canvas.height,
|
||||
s = Math.min(w, h);
|
||||
|
||||
sun(ctx, t, w * 0.5, h * 0.5, s, s * STROKE, color);
|
||||
};
|
||||
|
||||
Skycons.CLEAR_NIGHT = function (ctx, t, color) {
|
||||
var w = ctx.canvas.width,
|
||||
h = ctx.canvas.height,
|
||||
s = Math.min(w, h);
|
||||
|
||||
moon(ctx, t, w * 0.5, h * 0.5, s, s * STROKE, color);
|
||||
};
|
||||
|
||||
Skycons.PARTLY_CLOUDY_DAY = function (ctx, t, color) {
|
||||
var w = ctx.canvas.width,
|
||||
h = ctx.canvas.height,
|
||||
s = Math.min(w, h);
|
||||
|
||||
sun(ctx, t, w * 0.625, h * 0.375, s * 0.75, s * STROKE, color);
|
||||
cloud(ctx, t, w * 0.375, h * 0.625, s * 0.75, s * STROKE, color);
|
||||
};
|
||||
|
||||
Skycons.PARTLY_CLOUDY_NIGHT = function (ctx, t, color) {
|
||||
var w = ctx.canvas.width,
|
||||
h = ctx.canvas.height,
|
||||
s = Math.min(w, h);
|
||||
|
||||
moon(ctx, t, w * 0.667, h * 0.375, s * 0.75, s * STROKE, color);
|
||||
cloud(ctx, t, w * 0.375, h * 0.625, s * 0.75, s * STROKE, color);
|
||||
};
|
||||
|
||||
Skycons.CLOUDY = function (ctx, t, color) {
|
||||
var w = ctx.canvas.width,
|
||||
h = ctx.canvas.height,
|
||||
s = Math.min(w, h);
|
||||
|
||||
cloud(ctx, t, w * 0.5, h * 0.5, s, s * STROKE, color);
|
||||
};
|
||||
|
||||
Skycons.RAIN = function (ctx, t, color) {
|
||||
var w = ctx.canvas.width,
|
||||
h = ctx.canvas.height,
|
||||
s = Math.min(w, h);
|
||||
|
||||
rain(ctx, t, w * 0.5, h * 0.37, s * 0.9, s * STROKE, color);
|
||||
cloud(ctx, t, w * 0.5, h * 0.37, s * 0.9, s * STROKE, color);
|
||||
};
|
||||
|
||||
Skycons.SLEET = function (ctx, t, color) {
|
||||
var w = ctx.canvas.width,
|
||||
h = ctx.canvas.height,
|
||||
s = Math.min(w, h);
|
||||
|
||||
sleet(ctx, t, w * 0.5, h * 0.37, s * 0.9, s * STROKE, color);
|
||||
cloud(ctx, t, w * 0.5, h * 0.37, s * 0.9, s * STROKE, color);
|
||||
};
|
||||
|
||||
Skycons.SNOW = function (ctx, t, color) {
|
||||
var w = ctx.canvas.width,
|
||||
h = ctx.canvas.height,
|
||||
s = Math.min(w, h);
|
||||
|
||||
snow(ctx, t, w * 0.5, h * 0.37, s * 0.9, s * STROKE, color);
|
||||
cloud(ctx, t, w * 0.5, h * 0.37, s * 0.9, s * STROKE, color);
|
||||
};
|
||||
|
||||
Skycons.WIND = function (ctx, t, color) {
|
||||
var w = ctx.canvas.width,
|
||||
h = ctx.canvas.height,
|
||||
s = Math.min(w, h);
|
||||
|
||||
swoosh(ctx, t, w * 0.5, h * 0.5, s, s * STROKE, 0, 2, color);
|
||||
swoosh(ctx, t, w * 0.5, h * 0.5, s, s * STROKE, 1, 2, color);
|
||||
};
|
||||
|
||||
Skycons.FOG = function (ctx, t, color) {
|
||||
var w = ctx.canvas.width,
|
||||
h = ctx.canvas.height,
|
||||
s = Math.min(w, h),
|
||||
k = s * STROKE;
|
||||
|
||||
fogbank(ctx, t, w * 0.5, h * 0.32, s * 0.75, k, color);
|
||||
|
||||
t /= 5000;
|
||||
|
||||
var a = Math.cos((t) * TAU) * s * 0.02,
|
||||
b = Math.cos((t + 0.25) * TAU) * s * 0.02,
|
||||
c = Math.cos((t + 0.50) * TAU) * s * 0.02,
|
||||
d = Math.cos((t + 0.75) * TAU) * s * 0.02,
|
||||
n = h * 0.936,
|
||||
e = Math.floor(n - k * 0.5) + 0.5,
|
||||
f = Math.floor(n - k * 2.5) + 0.5;
|
||||
|
||||
ctx.strokeStyle = color;
|
||||
ctx.lineWidth = k;
|
||||
ctx.lineCap = "round";
|
||||
ctx.lineJoin = "round";
|
||||
|
||||
line(ctx, a + w * 0.2 + k * 0.5, e, b + w * 0.8 - k * 0.5, e);
|
||||
line(ctx, c + w * 0.2 + k * 0.5, f, d + w * 0.8 - k * 0.5, f);
|
||||
};
|
||||
|
||||
Skycons.prototype = {
|
||||
_determineDrawingFunction: function (draw) {
|
||||
if (typeof draw === "string")
|
||||
draw = Skycons[draw.toUpperCase().replace(/-/g, "_")] || null;
|
||||
|
||||
return draw;
|
||||
},
|
||||
add: function (el, draw) {
|
||||
var obj;
|
||||
|
||||
if (typeof el === "string")
|
||||
el = document.getElementById(el);
|
||||
|
||||
// Does nothing if canvas name doesn't exists
|
||||
if (el === null || el === undefined)
|
||||
return;
|
||||
|
||||
draw = this._determineDrawingFunction(draw);
|
||||
|
||||
// Does nothing if the draw function isn't actually a function
|
||||
if (typeof draw !== "function")
|
||||
return;
|
||||
|
||||
obj = {
|
||||
element: el,
|
||||
context: el.getContext("2d"),
|
||||
drawing: draw
|
||||
};
|
||||
|
||||
this.list.push(obj);
|
||||
this.draw(obj, KEYFRAME);
|
||||
},
|
||||
set: function (el, draw) {
|
||||
var i;
|
||||
|
||||
if (typeof el === "string")
|
||||
el = document.getElementById(el);
|
||||
|
||||
for (i = this.list.length; i--;)
|
||||
if (this.list[i].element === el) {
|
||||
this.list[i].drawing = this._determineDrawingFunction(draw);
|
||||
this.draw(this.list[i], KEYFRAME);
|
||||
return;
|
||||
}
|
||||
|
||||
this.add(el, draw);
|
||||
},
|
||||
remove: function (el) {
|
||||
var i;
|
||||
|
||||
if (typeof el === "string")
|
||||
el = document.getElementById(el);
|
||||
|
||||
for (i = this.list.length; i--;)
|
||||
if (this.list[i].element === el) {
|
||||
this.list.splice(i, 1);
|
||||
return;
|
||||
}
|
||||
},
|
||||
draw: function (obj, time) {
|
||||
var canvas = obj.context.canvas;
|
||||
|
||||
if (this.resizeClear)
|
||||
canvas.width = canvas.width;
|
||||
|
||||
else
|
||||
obj.context.clearRect(0, 0, canvas.width, canvas.height);
|
||||
|
||||
obj.drawing(obj.context, time, this.color);
|
||||
},
|
||||
play: function () {
|
||||
var self = this;
|
||||
|
||||
this.pause();
|
||||
this.interval = requestInterval(function () {
|
||||
var now = Date.now(),
|
||||
i;
|
||||
|
||||
for (i = self.list.length; i--;)
|
||||
self.draw(self.list[i], now);
|
||||
}, 1000 / 60);
|
||||
},
|
||||
pause: function () {
|
||||
if (this.interval) {
|
||||
cancelInterval(this.interval);
|
||||
this.interval = null;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
global.Skycons = Skycons;
|
||||
}(this));
|
Loading…
Add table
Reference in a new issue