clear out vendor directory, should be managed by frontend-dependicies module
This commit is contained in:
parent
95796dd556
commit
8a6083b6c1
|
@ -0,0 +1,4 @@
|
|||
# Ignore everything in this directory
|
||||
*
|
||||
# Except this file
|
||||
!.gitignore
|
|
@ -1,630 +0,0 @@
|
|||
/* Grayscale.css v:0.8.1 | MIT LICENSE | https://github.com/n2geoff/grayscale */
|
||||
|
||||
/* CSS Reset */
|
||||
|
||||
html {
|
||||
box-sizing: border-box;
|
||||
font-family: georgia, serif;
|
||||
font-size: 16px;
|
||||
line-height: 1.4em;
|
||||
color: #2A2A2A;
|
||||
-webkit-font-smoothing: antialiased;
|
||||
}
|
||||
|
||||
*,
|
||||
*:before,
|
||||
*:after {
|
||||
box-sizing: inherit;
|
||||
}
|
||||
|
||||
html,
|
||||
body {
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
body,
|
||||
html,
|
||||
span,
|
||||
div {
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
font-weight: normal;
|
||||
}
|
||||
|
||||
ol,
|
||||
ul {
|
||||
list-style: none;
|
||||
}
|
||||
|
||||
img,
|
||||
embed,
|
||||
iframe,
|
||||
object,
|
||||
audio,
|
||||
video {
|
||||
height: auto;
|
||||
max-width: 100%;
|
||||
border: none;
|
||||
}
|
||||
|
||||
table {
|
||||
border-collapse: collapse;
|
||||
border-spacing: 0;
|
||||
}
|
||||
|
||||
/* Blockquote */
|
||||
|
||||
.blockquote,
|
||||
.quote {
|
||||
border-left: 0.4em solid #E6E6E6;
|
||||
background-color: #F9F9F9;
|
||||
margin-left: 0;
|
||||
margin-right: 0;
|
||||
padding: 1em 1.5em;
|
||||
}
|
||||
|
||||
.blockquote *:last-child,
|
||||
.quote *:last-child {
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
/* Buttons */
|
||||
|
||||
.button,
|
||||
a.button,
|
||||
.button[type="submit"],
|
||||
.button[type="reset"],
|
||||
.button[type="button"] {
|
||||
position: relative;
|
||||
zoom: 1;
|
||||
line-height: normal;
|
||||
margin: 0;
|
||||
white-space: nowrap;
|
||||
vertical-align: top;
|
||||
text-align: center;
|
||||
cursor: pointer;
|
||||
-webkit-user-select: none;
|
||||
-moz-user-select: none;
|
||||
-ms-user-select: none;
|
||||
user-select: none;
|
||||
box-sizing: border-box;
|
||||
font-family: inherit;
|
||||
font-size: 1em;
|
||||
padding: .5em 1em;
|
||||
background-color: #F9F9F9;
|
||||
text-decoration: none;
|
||||
border: 1px solid #c6c6c6;
|
||||
}
|
||||
|
||||
.button.is-link {
|
||||
color: #101111;
|
||||
border-color: transparent;
|
||||
background-color: transparent;
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
.button.is-link:hover {
|
||||
background-image: none;
|
||||
text-decoration: underline;
|
||||
}
|
||||
|
||||
.button.is-rounded {
|
||||
border-radius: 5px;
|
||||
}
|
||||
|
||||
.button:hover,
|
||||
.button[type="submit"]:hover,
|
||||
.button[type="reset"]:hover,
|
||||
.button[type="button"]:hover {
|
||||
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='rgba(0,0,0,0)', endColorstr='#1a000000',GradientType=0);
|
||||
background-image: linear-gradient(transparent, rgba(0,0,0, 0.05) 40%, rgba(0,0,0, 0.10));
|
||||
}
|
||||
|
||||
.button:active,
|
||||
.button[type="submit"]:active,
|
||||
.button[type="reset"]:active,
|
||||
.button[type="button"]:active {
|
||||
box-shadow: 0 0 0 1px rgba(0,0,0, 0.15) inset, 0 0 6px rgba(0,0,0, 0.20) inset;
|
||||
border-color: #000;
|
||||
}
|
||||
|
||||
.button:focus,
|
||||
.button[type="submit"]:focus,
|
||||
.button[type="reset"]:focus,
|
||||
.button[type="button"]:focus {
|
||||
outline: 0;
|
||||
}
|
||||
|
||||
.is-disabled,
|
||||
.is-disabled:hover,
|
||||
.is-disabled:active,
|
||||
.is-disabled:focus {
|
||||
border: 1px solid #c6c6c6;
|
||||
background-image: none;
|
||||
filter: progid:DXImageTransform.Microsoft.gradient(enabled = false);
|
||||
filter: alpha(opacity=40);
|
||||
opacity: 0.40;
|
||||
cursor: not-allowed;
|
||||
box-shadow: none;
|
||||
}
|
||||
|
||||
a.button,
|
||||
a.button:active,
|
||||
a.button:visited {
|
||||
display: inline-block;
|
||||
color: inherit;
|
||||
}
|
||||
|
||||
/* Card Component */
|
||||
|
||||
.card {
|
||||
-webkit-box-orient: vertical;
|
||||
-webkit-box-direction: normal;
|
||||
-ms-flex-direction: column;
|
||||
flex-direction: column;
|
||||
overflow: hidden;
|
||||
-webkit-box-flex: 0;
|
||||
-ms-flex: 0 1 calc(50% - 0.5em);
|
||||
flex: 0 1 calc(50% - 0.5em);
|
||||
margin-bottom: 1em;
|
||||
}
|
||||
|
||||
.card-header {
|
||||
font-weight: bold;
|
||||
margin: 0;
|
||||
padding: .5em;
|
||||
}
|
||||
|
||||
.card-content {
|
||||
padding: 1em .5em;
|
||||
min-height: 100px;
|
||||
}
|
||||
|
||||
.card-footer {
|
||||
display: -webkit-box;
|
||||
display: -ms-flexbox;
|
||||
display: flex;
|
||||
-webkit-box-align: stretch;
|
||||
-ms-flex-align: stretch;
|
||||
align-items: stretch;
|
||||
border-top: 1px solid #dbdbdb;
|
||||
-webkit-box-flex: 1;
|
||||
-ms-flex: 1;
|
||||
flex: 1;
|
||||
}
|
||||
|
||||
.card-footer .card-footer-item {
|
||||
display: -webkit-box;
|
||||
display: -ms-flexbox;
|
||||
display: flex;
|
||||
-webkit-box-flex: 1;
|
||||
-ms-flex: 1 0 0;
|
||||
flex: 1 0 0;
|
||||
-webkit-box-align: center;
|
||||
-ms-flex-align: center;
|
||||
align-items: center;
|
||||
-webkit-box-pack: center;
|
||||
-ms-flex-pack: center;
|
||||
justify-content: center;
|
||||
margin: 0;
|
||||
padding: 1em;
|
||||
}
|
||||
|
||||
.card.is-shadowed {
|
||||
box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
|
||||
}
|
||||
|
||||
/* Forms */
|
||||
|
||||
.field,
|
||||
.textarea {
|
||||
font-size: 1em;
|
||||
height: 36px;
|
||||
width: 100%;
|
||||
padding: 6px 10px;
|
||||
/* The 6px vertically centers text on FF, ignored by Webkit */
|
||||
background-color: #F9F9F9;
|
||||
border: 1px solid #E6E6E6;
|
||||
box-shadow: none;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
.textarea {
|
||||
min-height: 6em;
|
||||
padding-top: 6px;
|
||||
padding-bottom: 6px;
|
||||
}
|
||||
|
||||
.field[type="checkbox"],
|
||||
.field[type="radio"] {
|
||||
position: relative;
|
||||
bottom: -3px;
|
||||
height: 16px;
|
||||
width: 16px;
|
||||
}
|
||||
|
||||
.field:hover,
|
||||
.textarea:hover {
|
||||
border: 1px solid #c6c6c6;
|
||||
outline: 0;
|
||||
}
|
||||
|
||||
.field:focus,
|
||||
.textarea:focus {
|
||||
border: 1px solid #787878;
|
||||
background-color: #FFF;
|
||||
outline: 0;
|
||||
}
|
||||
|
||||
.field-group,
|
||||
.group {
|
||||
display: -webkit-box;
|
||||
display: -ms-flexbox;
|
||||
display: flex;
|
||||
-ms-flex-pack: distribute;
|
||||
justify-content: space-around;
|
||||
}
|
||||
|
||||
.stack {
|
||||
display: -webkit-box;
|
||||
display: -ms-flexbox;
|
||||
display: flex;
|
||||
-webkit-box-orient: vertical;
|
||||
-webkit-box-direction: normal;
|
||||
-ms-flex-direction: column;
|
||||
flex-direction: column;
|
||||
}
|
||||
|
||||
.addon {
|
||||
display: -webkit-box;
|
||||
display: -ms-flexbox;
|
||||
display: flex;
|
||||
-webkit-box-pack: start;
|
||||
-ms-flex-pack: start;
|
||||
justify-content: flex-start;
|
||||
padding: 0 1em;
|
||||
line-height: 2em;
|
||||
vertical-align: middle;
|
||||
}
|
||||
|
||||
.label,
|
||||
.legend {
|
||||
display: block;
|
||||
padding: 0.5em 0;
|
||||
font-weight: 600;
|
||||
}
|
||||
|
||||
.fieldset {
|
||||
margin: .5em;
|
||||
padding: 0;
|
||||
border-width: 0;
|
||||
}
|
||||
|
||||
/* Layout Container */
|
||||
|
||||
.layout {
|
||||
margin: 0 auto;
|
||||
zoom: 1;
|
||||
letter-spacing: normal;
|
||||
word-spacing: normal;
|
||||
vertical-align: top;
|
||||
text-rendering: auto;
|
||||
}
|
||||
|
||||
.container {
|
||||
display: -webkit-box;
|
||||
display: -ms-flexbox;
|
||||
display: flex;
|
||||
-webkit-box-orient: vertical;
|
||||
-webkit-box-direction: normal;
|
||||
-ms-flex-direction: column;
|
||||
flex-direction: column;
|
||||
-ms-flex-wrap: nowrap;
|
||||
flex-wrap: nowrap;
|
||||
-webkit-box-pack: start;
|
||||
-ms-flex-pack: start;
|
||||
justify-content: flex-start;
|
||||
-webkit-box-align: stretch;
|
||||
-ms-flex-align: stretch;
|
||||
align-items: stretch;
|
||||
-ms-flex-line-pack: stretch;
|
||||
align-content: stretch;
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
.page {
|
||||
width: 90%;
|
||||
max-width: 1140px;
|
||||
margin: 0 auto;
|
||||
}
|
||||
|
||||
/* Flex-Based Grid Solution */
|
||||
|
||||
.row {
|
||||
display: -webkit-box;
|
||||
display: -ms-flexbox;
|
||||
display: flex;
|
||||
-webkit-box-orient: horizontal;
|
||||
-webkit-box-direction: normal;
|
||||
-ms-flex-direction: row;
|
||||
flex-direction: row;
|
||||
-ms-flex-wrap: nowrap;
|
||||
flex-wrap: nowrap;
|
||||
}
|
||||
|
||||
.column {
|
||||
display: -webkit-box;
|
||||
display: -ms-flexbox;
|
||||
display: flex;
|
||||
-webkit-box-orient: vertical;
|
||||
-webkit-box-direction: normal;
|
||||
-ms-flex-direction: column;
|
||||
flex-direction: column;
|
||||
-webkit-box-pack: justify;
|
||||
-ms-flex-pack: justify;
|
||||
justify-content: space-between;
|
||||
-webkit-box-flex: 1;
|
||||
-ms-flex: 1;
|
||||
flex: 1;
|
||||
}
|
||||
|
||||
.expand {
|
||||
-webkit-box-flex: 1;
|
||||
-ms-flex: 1 1 auto;
|
||||
flex: 1 1 auto;
|
||||
}
|
||||
|
||||
/* Precent-Based Grid Solution */
|
||||
|
||||
.column-100,
|
||||
.column-20,
|
||||
.column-25,
|
||||
.column-33,
|
||||
.column-50,
|
||||
.column-67 {
|
||||
display: inline;
|
||||
box-sizing: border-box;
|
||||
*margin-left: -0.04em;
|
||||
}
|
||||
|
||||
.column-20 {
|
||||
width: 20%;
|
||||
}
|
||||
|
||||
.column-25 {
|
||||
width: 25%;
|
||||
}
|
||||
|
||||
.column-33 {
|
||||
width: 33.33%;
|
||||
}
|
||||
|
||||
.column-50 {
|
||||
width: 50%;
|
||||
}
|
||||
|
||||
.column-67 {
|
||||
width: 67.67%;
|
||||
}
|
||||
|
||||
.column-100 {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
/* Navigation */
|
||||
|
||||
.navbar {
|
||||
display: -webkit-box;
|
||||
display: -ms-flexbox;
|
||||
display: flex;
|
||||
-webkit-box-orient: horizontal;
|
||||
-webkit-box-direction: normal;
|
||||
-ms-flex-direction: row;
|
||||
flex-direction: row;
|
||||
}
|
||||
|
||||
.navbar-item {
|
||||
display: -webkit-box;
|
||||
display: -ms-flexbox;
|
||||
display: flex;
|
||||
-webkit-box-orient: horizontal;
|
||||
-webkit-box-direction: normal;
|
||||
-ms-flex-direction: row;
|
||||
flex-direction: row;
|
||||
margin: 0 .5em;
|
||||
-webkit-box-align: bottom;
|
||||
-ms-flex-align: bottom;
|
||||
align-items: bottom;
|
||||
}
|
||||
|
||||
/* Tables */
|
||||
|
||||
.table {
|
||||
width: 100%;
|
||||
border-spacing: 0;
|
||||
}
|
||||
|
||||
.table thead tr th {
|
||||
border-bottom: 2px solid #c6c6c6;
|
||||
}
|
||||
|
||||
.table th,
|
||||
.table td {
|
||||
padding: .5em 0;
|
||||
text-align: left;
|
||||
border-bottom: 1px solid #c6c6c6;
|
||||
}
|
||||
|
||||
.table tr th:first-child,
|
||||
.table tr td:first-child {
|
||||
padding-left: .5em;
|
||||
}
|
||||
|
||||
.table.is-striped tbody tr:nth-child(odd) {
|
||||
background-color: #E6E6E6;
|
||||
}
|
||||
|
||||
.table.is-condensed th,
|
||||
table.is-condensed td {
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
.table.is-bordered td {
|
||||
border: 1px solid #E6E6E6;
|
||||
}
|
||||
|
||||
.table.is-bordered th {
|
||||
border: 1px solid #E6E6E6;
|
||||
border-bottom: 2px solid #E6E6E6;
|
||||
}
|
||||
|
||||
/* Typeography */
|
||||
|
||||
p {
|
||||
line-height: 1.4em;
|
||||
margin-top: 1.4em;
|
||||
}
|
||||
|
||||
/* Utilities */
|
||||
|
||||
.is-right {
|
||||
float: right;
|
||||
}
|
||||
|
||||
.is-left {
|
||||
float: left;
|
||||
}
|
||||
|
||||
.is-centered {
|
||||
margin: auto;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.is-inline {
|
||||
display: inline;
|
||||
}
|
||||
|
||||
.is-block {
|
||||
display: block;
|
||||
}
|
||||
|
||||
.is-bordered {
|
||||
border: 1px solid #E6E6E6;
|
||||
}
|
||||
|
||||
.is-divider,
|
||||
hr {
|
||||
border-top: 1px solid #E6E6E6;
|
||||
border-top: 1px solid #E6E6E6;
|
||||
}
|
||||
|
||||
.is-well {
|
||||
padding: 1em;
|
||||
}
|
||||
|
||||
.is-wall {
|
||||
padding: 0 .5em 0 .5em;
|
||||
}
|
||||
|
||||
.is-wide {
|
||||
width: 100%;
|
||||
margin: inherit 0;
|
||||
}
|
||||
|
||||
.is-tall {
|
||||
height: 100%;
|
||||
margin: 0 inherit;
|
||||
}
|
||||
|
||||
.is-fit {
|
||||
height: 100%;
|
||||
width: 100%;
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
.is-borderless {
|
||||
border: none;
|
||||
}
|
||||
|
||||
.is-clear {
|
||||
clear: both;
|
||||
}
|
||||
|
||||
.is-small {
|
||||
font-size: .8em;
|
||||
}
|
||||
|
||||
.is-large {
|
||||
font-size: 1.2em;
|
||||
}
|
||||
|
||||
.is-hidden {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.is-upper {
|
||||
text-transform: uppercase;
|
||||
}
|
||||
|
||||
.is-lower {
|
||||
text-transform: lowercase;
|
||||
}
|
||||
|
||||
.is-title {
|
||||
text-transform: capitalize;
|
||||
}
|
||||
|
||||
.is-indented {
|
||||
margin-left: 1em;
|
||||
}
|
||||
|
||||
.is-muted {
|
||||
color: #c6c6c6;
|
||||
}
|
||||
|
||||
/* Grayscale */
|
||||
|
||||
.is-white {
|
||||
background-color: #FFF;
|
||||
color: #2A2A2A;
|
||||
}
|
||||
|
||||
.is-lightest {
|
||||
background-color: #F9F9F9;
|
||||
color: #2A2A2A;
|
||||
}
|
||||
|
||||
.is-lighter {
|
||||
background-color: #E6E6E6;
|
||||
color: #2A2A2A;
|
||||
}
|
||||
|
||||
.is-light {
|
||||
background-color: #c6c6c6;
|
||||
color: #2A2A2A;
|
||||
}
|
||||
|
||||
.is-gray {
|
||||
background-color: #acacac;
|
||||
color: #101111;
|
||||
}
|
||||
|
||||
.is-dark {
|
||||
background-color: #787878;
|
||||
color: #F9F9F9;
|
||||
}
|
||||
|
||||
.is-darker {
|
||||
background-color: #545454;
|
||||
color: #F9F9F9;
|
||||
}
|
||||
|
||||
.is-darkest {
|
||||
background-color: #2A2A2A;
|
||||
color: #F9F9F9;
|
||||
}
|
||||
|
||||
.is-black {
|
||||
background-color: #101111;
|
||||
color: #F9F9F9;
|
||||
}
|
File diff suppressed because one or more lines are too long
|
@ -1,8 +0,0 @@
|
|||
/* Colors */
|
||||
|
||||
.is-primary {background-color: steelblue; color: #F9F9F9;}
|
||||
.is-secondary {background-color: #264863; color: #F9F9F9;}
|
||||
.is-accent {background-color: lightsteelblue; color: #2A2A2A;}
|
||||
.is-dangerous {background-color: indianred; color: #F9F9F9;}
|
||||
.is-safe {background-color: darkseagreen; color: #2A2A2A;}
|
||||
.is-warning {background-color: khaki; color: #2A2A2A;}
|
|
@ -1,486 +0,0 @@
|
|||
var route = (function () {
|
||||
'use strict';
|
||||
|
||||
var observable = function(el) {
|
||||
|
||||
/**
|
||||
* Extend the original object or create a new empty one
|
||||
* @type { Object }
|
||||
*/
|
||||
|
||||
el = el || {};
|
||||
|
||||
/**
|
||||
* Private variables
|
||||
*/
|
||||
var callbacks = {},
|
||||
slice = Array.prototype.slice;
|
||||
|
||||
/**
|
||||
* Public Api
|
||||
*/
|
||||
|
||||
// extend the el object adding the observable methods
|
||||
Object.defineProperties(el, {
|
||||
/**
|
||||
* Listen to the given `event` ands
|
||||
* execute the `callback` each time an event is triggered.
|
||||
* @param { String } event - event id
|
||||
* @param { Function } fn - callback function
|
||||
* @returns { Object } el
|
||||
*/
|
||||
on: {
|
||||
value: function(event, fn) {
|
||||
if (typeof fn == 'function')
|
||||
{ (callbacks[event] = callbacks[event] || []).push(fn); }
|
||||
return el
|
||||
},
|
||||
enumerable: false,
|
||||
writable: false,
|
||||
configurable: false
|
||||
},
|
||||
|
||||
/**
|
||||
* Removes the given `event` listeners
|
||||
* @param { String } event - event id
|
||||
* @param { Function } fn - callback function
|
||||
* @returns { Object } el
|
||||
*/
|
||||
off: {
|
||||
value: function(event, fn) {
|
||||
if (event == '*' && !fn) { callbacks = {}; }
|
||||
else {
|
||||
if (fn) {
|
||||
var arr = callbacks[event];
|
||||
for (var i = 0, cb; cb = arr && arr[i]; ++i) {
|
||||
if (cb == fn) { arr.splice(i--, 1); }
|
||||
}
|
||||
} else { delete callbacks[event]; }
|
||||
}
|
||||
return el
|
||||
},
|
||||
enumerable: false,
|
||||
writable: false,
|
||||
configurable: false
|
||||
},
|
||||
|
||||
/**
|
||||
* Listen to the given `event` and
|
||||
* execute the `callback` at most once
|
||||
* @param { String } event - event id
|
||||
* @param { Function } fn - callback function
|
||||
* @returns { Object } el
|
||||
*/
|
||||
one: {
|
||||
value: function(event, fn) {
|
||||
function on() {
|
||||
el.off(event, on);
|
||||
fn.apply(el, arguments);
|
||||
}
|
||||
return el.on(event, on)
|
||||
},
|
||||
enumerable: false,
|
||||
writable: false,
|
||||
configurable: false
|
||||
},
|
||||
|
||||
/**
|
||||
* Execute all callback functions that listen to
|
||||
* the given `event`
|
||||
* @param { String } event - event id
|
||||
* @returns { Object } el
|
||||
*/
|
||||
trigger: {
|
||||
value: function(event) {
|
||||
var arguments$1 = arguments;
|
||||
|
||||
|
||||
// getting the arguments
|
||||
var arglen = arguments.length - 1,
|
||||
args = new Array(arglen),
|
||||
fns,
|
||||
fn,
|
||||
i;
|
||||
|
||||
for (i = 0; i < arglen; i++) {
|
||||
args[i] = arguments$1[i + 1]; // skip first argument
|
||||
}
|
||||
|
||||
fns = slice.call(callbacks[event] || [], 0);
|
||||
|
||||
for (i = 0; fn = fns[i]; ++i) {
|
||||
fn.apply(el, args);
|
||||
}
|
||||
|
||||
if (callbacks['*'] && event != '*')
|
||||
{ el.trigger.apply(el, ['*', event].concat(args)); }
|
||||
|
||||
return el
|
||||
},
|
||||
enumerable: false,
|
||||
writable: false,
|
||||
configurable: false
|
||||
}
|
||||
});
|
||||
|
||||
return el
|
||||
|
||||
};
|
||||
|
||||
/**
|
||||
* Simple client-side router
|
||||
* @module riot-route
|
||||
*/
|
||||
|
||||
var RE_ORIGIN = /^.+?\/\/+[^/]+/,
|
||||
EVENT_LISTENER = 'EventListener',
|
||||
REMOVE_EVENT_LISTENER = 'remove' + EVENT_LISTENER,
|
||||
ADD_EVENT_LISTENER = 'add' + EVENT_LISTENER,
|
||||
HAS_ATTRIBUTE = 'hasAttribute',
|
||||
POPSTATE = 'popstate',
|
||||
HASHCHANGE = 'hashchange',
|
||||
TRIGGER = 'trigger',
|
||||
MAX_EMIT_STACK_LEVEL = 3,
|
||||
win = typeof window != 'undefined' && window,
|
||||
doc = typeof document != 'undefined' && document,
|
||||
hist = win && history,
|
||||
loc = win && (hist.location || win.location), // see html5-history-api
|
||||
prot = Router.prototype, // to minify more
|
||||
clickEvent = doc && doc.ontouchstart ? 'touchstart' : 'click',
|
||||
central = observable();
|
||||
|
||||
var
|
||||
started = false,
|
||||
routeFound = false,
|
||||
debouncedEmit,
|
||||
current,
|
||||
parser,
|
||||
secondParser,
|
||||
emitStack = [],
|
||||
emitStackLevel = 0;
|
||||
|
||||
/**
|
||||
* Default parser. You can replace it via router.parser method.
|
||||
* @param {string} path - current path (normalized)
|
||||
* @returns {array} array
|
||||
*/
|
||||
function DEFAULT_PARSER(path) {
|
||||
return path.split(/[/?#]/)
|
||||
}
|
||||
|
||||
/**
|
||||
* Default parser (second). You can replace it via router.parser method.
|
||||
* @param {string} path - current path (normalized)
|
||||
* @param {string} filter - filter string (normalized)
|
||||
* @returns {array} array
|
||||
*/
|
||||
function DEFAULT_SECOND_PARSER(path, filter) {
|
||||
var f = filter
|
||||
.replace(/\?/g, '\\?')
|
||||
.replace(/\*/g, '([^/?#]+?)')
|
||||
.replace(/\.\./, '.*');
|
||||
var re = new RegExp(("^" + f + "$"));
|
||||
var args = path.match(re);
|
||||
|
||||
if (args) { return args.slice(1) }
|
||||
}
|
||||
|
||||
/**
|
||||
* Simple/cheap debounce implementation
|
||||
* @param {function} fn - callback
|
||||
* @param {number} delay - delay in seconds
|
||||
* @returns {function} debounced function
|
||||
*/
|
||||
function debounce(fn, delay) {
|
||||
var t;
|
||||
return function () {
|
||||
clearTimeout(t);
|
||||
t = setTimeout(fn, delay);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the window listeners to trigger the routes
|
||||
* @param {boolean} autoExec - see route.start
|
||||
*/
|
||||
function start(autoExec) {
|
||||
debouncedEmit = debounce(emit, 1);
|
||||
win[ADD_EVENT_LISTENER](POPSTATE, debouncedEmit);
|
||||
win[ADD_EVENT_LISTENER](HASHCHANGE, debouncedEmit);
|
||||
doc[ADD_EVENT_LISTENER](clickEvent, click);
|
||||
|
||||
if (autoExec) { emit(true); }
|
||||
}
|
||||
|
||||
/**
|
||||
* Router class
|
||||
*/
|
||||
function Router() {
|
||||
this.$ = [];
|
||||
observable(this); // make it observable
|
||||
central.on('stop', this.s.bind(this));
|
||||
central.on('emit', this.e.bind(this));
|
||||
}
|
||||
|
||||
function normalize(path) {
|
||||
return path.replace(/^\/|\/$/, '')
|
||||
}
|
||||
|
||||
function isString(str) {
|
||||
return typeof str == 'string'
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the part after domain name
|
||||
* @param {string} href - fullpath
|
||||
* @returns {string} path from root
|
||||
*/
|
||||
function getPathFromRoot(href) {
|
||||
return (href || loc.href).replace(RE_ORIGIN, '')
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the part after base
|
||||
* @param {string} href - fullpath
|
||||
* @returns {string} path from base
|
||||
*/
|
||||
function getPathFromBase(href) {
|
||||
var base = route._.base;
|
||||
return base[0] === '#'
|
||||
? (href || loc.href || '').split(base)[1] || ''
|
||||
: (loc ? getPathFromRoot(href) : href || '').replace(base, '')
|
||||
}
|
||||
|
||||
function emit(force) {
|
||||
// the stack is needed for redirections
|
||||
var isRoot = emitStackLevel === 0;
|
||||
if (MAX_EMIT_STACK_LEVEL <= emitStackLevel) { return }
|
||||
|
||||
emitStackLevel++;
|
||||
emitStack.push(function() {
|
||||
var path = getPathFromBase();
|
||||
if (force || path !== current) {
|
||||
central[TRIGGER]('emit', path);
|
||||
current = path;
|
||||
}
|
||||
});
|
||||
|
||||
if (isRoot) {
|
||||
var first;
|
||||
while (first = emitStack.shift()) { first(); } // stack increses within this call
|
||||
emitStackLevel = 0;
|
||||
}
|
||||
}
|
||||
|
||||
function click(e) {
|
||||
if (
|
||||
e.which !== 1 // not left click
|
||||
|| e.metaKey || e.ctrlKey || e.shiftKey // or meta keys
|
||||
|| e.defaultPrevented // or default prevented
|
||||
) { return }
|
||||
|
||||
var el = e.target;
|
||||
while (el && el.nodeName !== 'A') { el = el.parentNode; }
|
||||
|
||||
if (
|
||||
!el || el.nodeName !== 'A' // not A tag
|
||||
|| el[HAS_ATTRIBUTE]('download') // has download attr
|
||||
|| !el[HAS_ATTRIBUTE]('href') // has no href attr
|
||||
|| el.target && el.target !== '_self' // another window or frame
|
||||
|| el.href.indexOf(loc.href.match(RE_ORIGIN)[0]) === -1 // cross origin
|
||||
) { return }
|
||||
|
||||
var base = route._.base;
|
||||
|
||||
if (el.href !== loc.href
|
||||
&& (
|
||||
el.href.split('#')[0] === loc.href.split('#')[0] // internal jump
|
||||
|| base[0] !== '#' && getPathFromRoot(el.href).indexOf(base) !== 0 // outside of base
|
||||
|| base[0] === '#' && el.href.split(base)[0] !== loc.href.split(base)[0] // outside of #base
|
||||
|| !go(getPathFromBase(el.href), el.title || doc.title) // route not found
|
||||
)) { return }
|
||||
|
||||
e.preventDefault();
|
||||
}
|
||||
|
||||
/**
|
||||
* Go to the path
|
||||
* @param {string} path - destination path
|
||||
* @param {string} title - page title
|
||||
* @param {boolean} shouldReplace - use replaceState or pushState
|
||||
* @returns {boolean} - route not found flag
|
||||
*/
|
||||
function go(path, title, shouldReplace) {
|
||||
// Server-side usage: directly execute handlers for the path
|
||||
if (!hist) { return central[TRIGGER]('emit', getPathFromBase(path)) }
|
||||
|
||||
path = route._.base + normalize(path);
|
||||
title = title || doc.title;
|
||||
// browsers ignores the second parameter `title`
|
||||
shouldReplace
|
||||
? hist.replaceState(null, title, path)
|
||||
: hist.pushState(null, title, path);
|
||||
// so we need to set it manually
|
||||
doc.title = title;
|
||||
routeFound = false;
|
||||
emit();
|
||||
return routeFound
|
||||
}
|
||||
|
||||
/**
|
||||
* Go to path or set action
|
||||
* a single string: go there
|
||||
* two strings: go there with setting a title
|
||||
* two strings and boolean: replace history with setting a title
|
||||
* a single function: set an action on the default route
|
||||
* a string/RegExp and a function: set an action on the route
|
||||
* @param {(string|function)} first - path / action / filter
|
||||
* @param {(string|RegExp|function)} second - title / action
|
||||
* @param {boolean} third - replace flag
|
||||
*/
|
||||
prot.m = function(first, second, third) {
|
||||
if (isString(first) && (!second || isString(second))) { go(first, second, third || false); }
|
||||
else if (second) { this.r(first, second); }
|
||||
else { this.r('@', first); }
|
||||
};
|
||||
|
||||
/**
|
||||
* Stop routing
|
||||
*/
|
||||
prot.s = function() {
|
||||
this.off('*');
|
||||
this.$ = [];
|
||||
};
|
||||
|
||||
/**
|
||||
* Emit
|
||||
* @param {string} path - path
|
||||
*/
|
||||
prot.e = function(path) {
|
||||
this.$.concat('@').some(function(filter) {
|
||||
var args = (filter === '@' ? parser : secondParser)(normalize(path), normalize(filter));
|
||||
if (typeof args != 'undefined') {
|
||||
this[TRIGGER].apply(null, [filter].concat(args));
|
||||
return routeFound = true // exit from loop
|
||||
}
|
||||
}, this);
|
||||
};
|
||||
|
||||
/**
|
||||
* Register route
|
||||
* @param {string} filter - filter for matching to url
|
||||
* @param {function} action - action to register
|
||||
*/
|
||||
prot.r = function(filter, action) {
|
||||
if (filter !== '@') {
|
||||
filter = '/' + normalize(filter);
|
||||
this.$.push(filter);
|
||||
}
|
||||
|
||||
this.on(filter, action);
|
||||
};
|
||||
|
||||
var mainRouter = new Router();
|
||||
var route = mainRouter.m.bind(mainRouter);
|
||||
|
||||
// adding base and getPathFromBase to route so we can access them in route.tag's script
|
||||
route._ = { base: null, getPathFromBase: getPathFromBase };
|
||||
|
||||
/**
|
||||
* Create a sub router
|
||||
* @returns {function} the method of a new Router object
|
||||
*/
|
||||
route.create = function() {
|
||||
var newSubRouter = new Router();
|
||||
// assign sub-router's main method
|
||||
var router = newSubRouter.m.bind(newSubRouter);
|
||||
// stop only this sub-router
|
||||
router.stop = newSubRouter.s.bind(newSubRouter);
|
||||
return router
|
||||
};
|
||||
|
||||
/**
|
||||
* Set the base of url
|
||||
* @param {(str|RegExp)} arg - a new base or '#' or '#!'
|
||||
*/
|
||||
route.base = function(arg) {
|
||||
route._.base = arg || '#';
|
||||
current = getPathFromBase(); // recalculate current path
|
||||
};
|
||||
|
||||
/** Exec routing right now **/
|
||||
route.exec = function() {
|
||||
emit(true);
|
||||
};
|
||||
|
||||
/**
|
||||
* Replace the default router to yours
|
||||
* @param {function} fn - your parser function
|
||||
* @param {function} fn2 - your secondParser function
|
||||
*/
|
||||
route.parser = function(fn, fn2) {
|
||||
if (!fn && !fn2) {
|
||||
// reset parser for testing...
|
||||
parser = DEFAULT_PARSER;
|
||||
secondParser = DEFAULT_SECOND_PARSER;
|
||||
}
|
||||
if (fn) { parser = fn; }
|
||||
if (fn2) { secondParser = fn2; }
|
||||
};
|
||||
|
||||
/**
|
||||
* Helper function to get url query as an object
|
||||
* @returns {object} parsed query
|
||||
*/
|
||||
route.query = function() {
|
||||
var q = {};
|
||||
var href = loc.href || current;
|
||||
href.replace(/[?&](.+?)=([^&]*)/g, function(_, k, v) { q[k] = v; });
|
||||
return q
|
||||
};
|
||||
|
||||
/** Stop routing **/
|
||||
route.stop = function () {
|
||||
if (started) {
|
||||
if (win) {
|
||||
win[REMOVE_EVENT_LISTENER](POPSTATE, debouncedEmit);
|
||||
win[REMOVE_EVENT_LISTENER](HASHCHANGE, debouncedEmit);
|
||||
doc[REMOVE_EVENT_LISTENER](clickEvent, click);
|
||||
}
|
||||
|
||||
central[TRIGGER]('stop');
|
||||
started = false;
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Start routing
|
||||
* @param {boolean} autoExec - automatically exec after starting if true
|
||||
*/
|
||||
route.start = function (autoExec) {
|
||||
if (!started) {
|
||||
if (win) {
|
||||
if (document.readyState === 'interactive' || document.readyState === 'complete') {
|
||||
start(autoExec);
|
||||
} else {
|
||||
document.onreadystatechange = function () {
|
||||
if (document.readyState === 'interactive') {
|
||||
// the timeout is needed to solve
|
||||
// a weird safari bug https://github.com/riot/route/issues/33
|
||||
setTimeout(function() { start(autoExec); }, 1);
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
started = true;
|
||||
}
|
||||
};
|
||||
|
||||
/** Prepare the router **/
|
||||
route.base();
|
||||
route.parser();
|
||||
|
||||
return route;
|
||||
|
||||
}());
|
|
@ -1 +0,0 @@
|
|||
var route=function(){"use strict";var e=function(u){u=u||{};var o={},l=Array.prototype.slice;Object.defineProperties(u,{on:{value:function(e,t){if(typeof t=="function"){(o[e]=o[e]||[]).push(t)}return u},enumerable:false,writable:false,configurable:false},off:{value:function(e,t){if(e=="*"&&!t){o={}}else{if(t){var n=o[e];for(var r=0,i;i=n&&n[r];++r){if(i==t){n.splice(r--,1)}}}else{delete o[e]}}return u},enumerable:false,writable:false,configurable:false},one:{value:function(e,t){function n(){u.off(e,n);t.apply(u,arguments)}return u.on(e,n)},enumerable:false,writable:false,configurable:false},trigger:{value:function(e){var t=arguments;var n=arguments.length-1,r=new Array(n),i,a,f;for(f=0;f<n;f++){r[f]=t[f+1]}i=l.call(o[e]||[],0);for(f=0;a=i[f];++f){a.apply(u,r)}if(o["*"]&&e!="*"){u.trigger.apply(u,["*",e].concat(r))}return u},enumerable:false,writable:false,configurable:false}});return u};var r=/^.+?\/\/+[^/]+/,t="EventListener",n="remove"+t,i="add"+t,a="hasAttribute",f="popstate",u="hashchange",o="trigger",l=3,s=typeof window!="undefined"&&window,c=typeof document!="undefined"&&document,h=s&&history,p=s&&(h.location||s.location),d=P.prototype,v=c&&c.ontouchstart?"touchstart":"click",m=e();var b=false,g=false,y,w,$,_,A=[],S=0;function x(e){return e.split(/[/?#]/)}function K(e,t){var n=t.replace(/\?/g,"\\?").replace(/\*/g,"([^/?#]+?)").replace(/\.\./,".*");var r=new RegExp("^"+n+"$");var i=e.match(r);if(i){return i.slice(1)}}function N(e,t){var n;return function(){clearTimeout(n);n=setTimeout(e,t)}}function O(e){y=N(q,1);s[i](f,y);s[i](u,y);c[i](v,B);if(e){q(true)}}function P(){this.$=[];e(this);m.on("stop",this.s.bind(this));m.on("emit",this.e.bind(this))}function T(e){return e.replace(/^\/|\/$/,"")}function E(e){return typeof e=="string"}function j(e){return(e||p.href).replace(r,"")}function k(e){var t=L._.base;return t[0]==="#"?(e||p.href||"").split(t)[1]||"":(p?j(e):e||"").replace(t,"")}function q(t){var e=S===0;if(l<=S){return}S++;A.push(function(){var e=k();if(t||e!==w){m[o]("emit",e);w=e}});if(e){var n;while(n=A.shift()){n()}S=0}}function B(e){if(e.which!==1||e.metaKey||e.ctrlKey||e.shiftKey||e.defaultPrevented){return}var t=e.target;while(t&&t.nodeName!=="A"){t=t.parentNode}if(!t||t.nodeName!=="A"||t[a]("download")||!t[a]("href")||t.target&&t.target!=="_self"||t.href.indexOf(p.href.match(r)[0])===-1){return}var n=L._.base;if(t.href!==p.href&&(t.href.split("#")[0]===p.href.split("#")[0]||n[0]!=="#"&&j(t.href).indexOf(n)!==0||n[0]==="#"&&t.href.split(n)[0]!==p.href.split(n)[0]||!D(k(t.href),t.title||c.title))){return}e.preventDefault()}function D(e,t,n){if(!h){return m[o]("emit",k(e))}e=L._.base+T(e);t=t||c.title;n?h.replaceState(null,t,e):h.pushState(null,t,e);c.title=t;g=false;q();return g}d.m=function(e,t,n){if(E(e)&&(!t||E(t))){D(e,t,n||false)}else if(t){this.r(e,t)}else{this.r("@",e)}};d.s=function(){this.off("*");this.$=[]};d.e=function(n){this.$.concat("@").some(function(e){var t=(e==="@"?$:_)(T(n),T(e));if(typeof t!="undefined"){this[o].apply(null,[e].concat(t));return g=true}},this)};d.r=function(e,t){if(e!=="@"){e="/"+T(e);this.$.push(e)}this.on(e,t)};var F=new P;var L=F.m.bind(F);L._={base:null,getPathFromBase:k};L.create=function(){var e=new P;var t=e.m.bind(e);t.stop=e.s.bind(e);return t};L.base=function(e){L._.base=e||"#";w=k()};L.exec=function(){q(true)};L.parser=function(e,t){if(!e&&!t){$=x;_=K}if(e){$=e}if(t){_=t}};L.query=function(){var r={};var e=p.href||w;e.replace(/[?&](.+?)=([^&]*)/g,function(e,t,n){r[t]=n});return r};L.stop=function(){if(b){if(s){s[n](f,y);s[n](u,y);c[n](v,B)}m[o]("stop");b=false}};L.start=function(e){if(!b){if(s){if(document.readyState==="interactive"||document.readyState==="complete"){O(e)}else{document.onreadystatechange=function(){if(document.readyState==="interactive"){setTimeout(function(){O(e)},1)}}}}b=true}};L.base();L.parser();return L}();
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
Loading…
Reference in New Issue