Current state

This commit is contained in:
2026-02-07 08:23:18 +01:00
commit 0a4372c40d
22479 changed files with 1553543 additions and 0 deletions

View File

@@ -0,0 +1,330 @@
/*!
* Ladda
* http://lab.hakim.se/ladda
* MIT licensed
*
* Copyright (C) 2013 Hakim El Hattab, http://hakim.se
*/
/*************************************
* CONFIG
*/
/*************************************
* MIXINS
*/
/*************************************
* BUTTON BASE
*/
.ladda-button {
position: relative; }
/* Spinner animation */
.ladda-button .ladda-spinner {
position: absolute;
z-index: 2;
display: inline-block;
width: 32px;
height: 32px;
top: 50%;
margin-top: -16px;
opacity: 0;
pointer-events: none; }
/* Button label */
.ladda-button .ladda-label {
position: relative;
z-index: 3; }
/* Progress bar */
.ladda-button .ladda-progress {
position: absolute;
width: 0;
height: 100%;
left: 0;
top: 0;
background: rgba(0, 0, 0, 0.2);
visibility: hidden;
opacity: 0;
-webkit-transition: 0.1s linear all !important;
-moz-transition: 0.1s linear all !important;
-ms-transition: 0.1s linear all !important;
-o-transition: 0.1s linear all !important;
transition: 0.1s linear all !important; }
.ladda-button[data-loading] .ladda-progress {
opacity: 1;
visibility: visible; }
/*************************************
* EASING
*/
.ladda-button,
.ladda-button .ladda-spinner,
.ladda-button .ladda-label {
-webkit-transition: 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275) all !important;
-moz-transition: 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275) all !important;
-ms-transition: 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275) all !important;
-o-transition: 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275) all !important;
transition: 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275) all !important; }
.ladda-button[data-style=zoom-in],
.ladda-button[data-style=zoom-in] .ladda-spinner,
.ladda-button[data-style=zoom-in] .ladda-label,
.ladda-button[data-style=zoom-out],
.ladda-button[data-style=zoom-out] .ladda-spinner,
.ladda-button[data-style=zoom-out] .ladda-label {
-webkit-transition: 0.3s ease all !important;
-moz-transition: 0.3s ease all !important;
-ms-transition: 0.3s ease all !important;
-o-transition: 0.3s ease all !important;
transition: 0.3s ease all !important; }
/*************************************
* EXPAND LEFT
*/
.ladda-button[data-style=expand-right] .ladda-spinner {
right: 14px; }
.ladda-button[data-style=expand-right][data-size="s"] .ladda-spinner, .ladda-button[data-style=expand-right][data-size="xs"] .ladda-spinner {
right: 4px; }
.ladda-button[data-style=expand-right][data-loading] {
padding-right: 56px; }
.ladda-button[data-style=expand-right][data-loading] .ladda-spinner {
opacity: 1; }
.ladda-button[data-style=expand-right][data-loading][data-size="s"], .ladda-button[data-style=expand-right][data-loading][data-size="xs"] {
padding-right: 40px; }
/*************************************
* EXPAND RIGHT
*/
.ladda-button[data-style=expand-left] .ladda-spinner {
left: 14px; }
.ladda-button[data-style=expand-left][data-size="s"] .ladda-spinner, .ladda-button[data-style=expand-left][data-size="xs"] .ladda-spinner {
left: 4px; }
.ladda-button[data-style=expand-left][data-loading] {
padding-left: 56px; }
.ladda-button[data-style=expand-left][data-loading] .ladda-spinner {
opacity: 1; }
.ladda-button[data-style=expand-left][data-loading][data-size="s"], .ladda-button[data-style=expand-left][data-loading][data-size="xs"] {
padding-left: 40px; }
/*************************************
* EXPAND UP
*/
.ladda-button[data-style=expand-up] {
overflow: hidden; }
.ladda-button[data-style=expand-up] .ladda-spinner {
top: -32px;
left: 50%;
margin-left: -16px; }
.ladda-button[data-style=expand-up][data-loading] {
padding-top: 54px; }
.ladda-button[data-style=expand-up][data-loading] .ladda-spinner {
opacity: 1;
top: 14px;
margin-top: 0; }
.ladda-button[data-style=expand-up][data-loading][data-size="s"], .ladda-button[data-style=expand-up][data-loading][data-size="xs"] {
padding-top: 32px; }
.ladda-button[data-style=expand-up][data-loading][data-size="s"] .ladda-spinner, .ladda-button[data-style=expand-up][data-loading][data-size="xs"] .ladda-spinner {
top: 4px; }
/*************************************
* EXPAND DOWN
*/
.ladda-button[data-style=expand-down] {
overflow: hidden; }
.ladda-button[data-style=expand-down] .ladda-spinner {
top: 62px;
left: 50%;
margin-left: -16px; }
.ladda-button[data-style=expand-down][data-size="s"] .ladda-spinner, .ladda-button[data-style=expand-down][data-size="xs"] .ladda-spinner {
top: 40px; }
.ladda-button[data-style=expand-down][data-loading] {
padding-bottom: 54px; }
.ladda-button[data-style=expand-down][data-loading] .ladda-spinner {
opacity: 1; }
.ladda-button[data-style=expand-down][data-loading][data-size="s"], .ladda-button[data-style=expand-down][data-loading][data-size="xs"] {
padding-bottom: 32px; }
/*************************************
* SLIDE LEFT
*/
.ladda-button[data-style=slide-left] {
overflow: hidden; }
.ladda-button[data-style=slide-left] .ladda-label {
position: relative; }
.ladda-button[data-style=slide-left] .ladda-spinner {
left: 100%;
margin-left: -16px; }
.ladda-button[data-style=slide-left][data-loading] .ladda-label {
opacity: 0;
left: -100%; }
.ladda-button[data-style=slide-left][data-loading] .ladda-spinner {
opacity: 1;
left: 50%; }
/*************************************
* SLIDE RIGHT
*/
.ladda-button[data-style=slide-right] {
overflow: hidden; }
.ladda-button[data-style=slide-right] .ladda-label {
position: relative; }
.ladda-button[data-style=slide-right] .ladda-spinner {
right: 100%;
margin-left: -16px; }
.ladda-button[data-style=slide-right][data-loading] .ladda-label {
opacity: 0;
left: 100%; }
.ladda-button[data-style=slide-right][data-loading] .ladda-spinner {
opacity: 1;
left: 50%; }
/*************************************
* SLIDE UP
*/
.ladda-button[data-style=slide-up] {
overflow: hidden; }
.ladda-button[data-style=slide-up] .ladda-label {
position: relative; }
.ladda-button[data-style=slide-up] .ladda-spinner {
left: 50%;
margin-left: -16px;
margin-top: 1em; }
.ladda-button[data-style=slide-up][data-loading] .ladda-label {
opacity: 0;
top: -1em; }
.ladda-button[data-style=slide-up][data-loading] .ladda-spinner {
opacity: 1;
margin-top: -16px; }
/*************************************
* SLIDE DOWN
*/
.ladda-button[data-style=slide-down] {
overflow: hidden; }
.ladda-button[data-style=slide-down] .ladda-label {
position: relative; }
.ladda-button[data-style=slide-down] .ladda-spinner {
left: 50%;
margin-left: -16px;
margin-top: -2em; }
.ladda-button[data-style=slide-down][data-loading] .ladda-label {
opacity: 0;
top: 1em; }
.ladda-button[data-style=slide-down][data-loading] .ladda-spinner {
opacity: 1;
margin-top: -16px; }
/*************************************
* ZOOM-OUT
*/
.ladda-button[data-style=zoom-out] {
overflow: hidden; }
.ladda-button[data-style=zoom-out] .ladda-spinner {
left: 50%;
margin-left: -16px;
-webkit-transform: scale(2.5);
-moz-transform: scale(2.5);
-ms-transform: scale(2.5);
-o-transform: scale(2.5);
transform: scale(2.5); }
.ladda-button[data-style=zoom-out] .ladda-label {
position: relative;
display: inline-block; }
.ladda-button[data-style=zoom-out][data-loading] .ladda-label {
opacity: 0;
-webkit-transform: scale(0.5);
-moz-transform: scale(0.5);
-ms-transform: scale(0.5);
-o-transform: scale(0.5);
transform: scale(0.5); }
.ladda-button[data-style=zoom-out][data-loading] .ladda-spinner {
opacity: 1;
-webkit-transform: none;
-moz-transform: none;
-ms-transform: none;
-o-transform: none;
transform: none; }
/*************************************
* ZOOM-IN
*/
.ladda-button[data-style=zoom-in] {
overflow: hidden; }
.ladda-button[data-style=zoom-in] .ladda-spinner {
left: 50%;
margin-left: -16px;
-webkit-transform: scale(0.2);
-moz-transform: scale(0.2);
-ms-transform: scale(0.2);
-o-transform: scale(0.2);
transform: scale(0.2); }
.ladda-button[data-style=zoom-in] .ladda-label {
position: relative;
display: inline-block; }
.ladda-button[data-style=zoom-in][data-loading] .ladda-label {
opacity: 0;
-webkit-transform: scale(2.2);
-moz-transform: scale(2.2);
-ms-transform: scale(2.2);
-o-transform: scale(2.2);
transform: scale(2.2); }
.ladda-button[data-style=zoom-in][data-loading] .ladda-spinner {
opacity: 1;
-webkit-transform: none;
-moz-transform: none;
-ms-transform: none;
-o-transform: none;
transform: none; }
/*************************************
* CONTRACT
*/
.ladda-button[data-style=contract] {
overflow: hidden;
width: 100px; }
.ladda-button[data-style=contract] .ladda-spinner {
left: 50%;
margin-left: -16px; }
.ladda-button[data-style=contract][data-loading] {
border-radius: 50%;
width: 52px; }
.ladda-button[data-style=contract][data-loading] .ladda-label {
opacity: 0; }
.ladda-button[data-style=contract][data-loading] .ladda-spinner {
opacity: 1; }
/*************************************
* OVERLAY
*/
.ladda-button[data-style=contract-overlay] {
overflow: hidden;
width: 100px;
box-shadow: 0px 0px 0px 3000px rgba(0, 0, 0, 0); }
.ladda-button[data-style=contract-overlay] .ladda-spinner {
left: 50%;
margin-left: -16px; }
.ladda-button[data-style=contract-overlay][data-loading] {
border-radius: 50%;
width: 52px;
/*outline: 10000px solid rgba( 0, 0, 0, 0.5 );*/
box-shadow: 0px 0px 0px 3000px rgba(0, 0, 0, 0.8); }
.ladda-button[data-style=contract-overlay][data-loading] .ladda-label {
opacity: 0; }
.ladda-button[data-style=contract-overlay][data-loading] .ladda-spinner {
opacity: 1; }

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,392 @@
/** Contains the default Ladda button theme styles */
/*!
* Ladda
* http://lab.hakim.se/ladda
* MIT licensed
*
* Copyright (C) 2013 Hakim El Hattab, http://hakim.se
*/
/*************************************
* CONFIG
*/
/*************************************
* MIXINS
*/
/*************************************
* BUTTON BASE
*/
.ladda-button {
position: relative; }
/* Spinner animation */
.ladda-button .ladda-spinner {
position: absolute;
z-index: 2;
display: inline-block;
width: 32px;
height: 32px;
top: 50%;
margin-top: -16px;
opacity: 0;
pointer-events: none; }
/* Button label */
.ladda-button .ladda-label {
position: relative;
z-index: 3; }
/* Progress bar */
.ladda-button .ladda-progress {
position: absolute;
width: 0;
height: 100%;
left: 0;
top: 0;
background: rgba(0, 0, 0, 0.2);
visibility: hidden;
opacity: 0;
-webkit-transition: 0.1s linear all !important;
-moz-transition: 0.1s linear all !important;
-ms-transition: 0.1s linear all !important;
-o-transition: 0.1s linear all !important;
transition: 0.1s linear all !important; }
.ladda-button[data-loading] .ladda-progress {
opacity: 1;
visibility: visible; }
/*************************************
* EASING
*/
.ladda-button,
.ladda-button .ladda-spinner,
.ladda-button .ladda-label {
-webkit-transition: 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275) all !important;
-moz-transition: 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275) all !important;
-ms-transition: 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275) all !important;
-o-transition: 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275) all !important;
transition: 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275) all !important; }
.ladda-button[data-style=zoom-in],
.ladda-button[data-style=zoom-in] .ladda-spinner,
.ladda-button[data-style=zoom-in] .ladda-label,
.ladda-button[data-style=zoom-out],
.ladda-button[data-style=zoom-out] .ladda-spinner,
.ladda-button[data-style=zoom-out] .ladda-label {
-webkit-transition: 0.3s ease all !important;
-moz-transition: 0.3s ease all !important;
-ms-transition: 0.3s ease all !important;
-o-transition: 0.3s ease all !important;
transition: 0.3s ease all !important; }
/*************************************
* EXPAND LEFT
*/
.ladda-button[data-style=expand-right] .ladda-spinner {
right: 14px; }
.ladda-button[data-style=expand-right][data-size="s"] .ladda-spinner, .ladda-button[data-style=expand-right][data-size="xs"] .ladda-spinner {
right: 4px; }
.ladda-button[data-style=expand-right][data-loading] {
padding-right: 56px; }
.ladda-button[data-style=expand-right][data-loading] .ladda-spinner {
opacity: 1; }
.ladda-button[data-style=expand-right][data-loading][data-size="s"], .ladda-button[data-style=expand-right][data-loading][data-size="xs"] {
padding-right: 40px; }
/*************************************
* EXPAND RIGHT
*/
.ladda-button[data-style=expand-left] .ladda-spinner {
left: 14px; }
.ladda-button[data-style=expand-left][data-size="s"] .ladda-spinner, .ladda-button[data-style=expand-left][data-size="xs"] .ladda-spinner {
left: 4px; }
.ladda-button[data-style=expand-left][data-loading] {
padding-left: 56px; }
.ladda-button[data-style=expand-left][data-loading] .ladda-spinner {
opacity: 1; }
.ladda-button[data-style=expand-left][data-loading][data-size="s"], .ladda-button[data-style=expand-left][data-loading][data-size="xs"] {
padding-left: 40px; }
/*************************************
* EXPAND UP
*/
.ladda-button[data-style=expand-up] {
overflow: hidden; }
.ladda-button[data-style=expand-up] .ladda-spinner {
top: -32px;
left: 50%;
margin-left: -16px; }
.ladda-button[data-style=expand-up][data-loading] {
padding-top: 54px; }
.ladda-button[data-style=expand-up][data-loading] .ladda-spinner {
opacity: 1;
top: 14px;
margin-top: 0; }
.ladda-button[data-style=expand-up][data-loading][data-size="s"], .ladda-button[data-style=expand-up][data-loading][data-size="xs"] {
padding-top: 32px; }
.ladda-button[data-style=expand-up][data-loading][data-size="s"] .ladda-spinner, .ladda-button[data-style=expand-up][data-loading][data-size="xs"] .ladda-spinner {
top: 4px; }
/*************************************
* EXPAND DOWN
*/
.ladda-button[data-style=expand-down] {
overflow: hidden; }
.ladda-button[data-style=expand-down] .ladda-spinner {
top: 62px;
left: 50%;
margin-left: -16px; }
.ladda-button[data-style=expand-down][data-size="s"] .ladda-spinner, .ladda-button[data-style=expand-down][data-size="xs"] .ladda-spinner {
top: 40px; }
.ladda-button[data-style=expand-down][data-loading] {
padding-bottom: 54px; }
.ladda-button[data-style=expand-down][data-loading] .ladda-spinner {
opacity: 1; }
.ladda-button[data-style=expand-down][data-loading][data-size="s"], .ladda-button[data-style=expand-down][data-loading][data-size="xs"] {
padding-bottom: 32px; }
/*************************************
* SLIDE LEFT
*/
.ladda-button[data-style=slide-left] {
overflow: hidden; }
.ladda-button[data-style=slide-left] .ladda-label {
position: relative; }
.ladda-button[data-style=slide-left] .ladda-spinner {
left: 100%;
margin-left: -16px; }
.ladda-button[data-style=slide-left][data-loading] .ladda-label {
opacity: 0;
left: -100%; }
.ladda-button[data-style=slide-left][data-loading] .ladda-spinner {
opacity: 1;
left: 50%; }
/*************************************
* SLIDE RIGHT
*/
.ladda-button[data-style=slide-right] {
overflow: hidden; }
.ladda-button[data-style=slide-right] .ladda-label {
position: relative; }
.ladda-button[data-style=slide-right] .ladda-spinner {
right: 100%;
margin-left: -16px; }
.ladda-button[data-style=slide-right][data-loading] .ladda-label {
opacity: 0;
left: 100%; }
.ladda-button[data-style=slide-right][data-loading] .ladda-spinner {
opacity: 1;
left: 50%; }
/*************************************
* SLIDE UP
*/
.ladda-button[data-style=slide-up] {
overflow: hidden; }
.ladda-button[data-style=slide-up] .ladda-label {
position: relative; }
.ladda-button[data-style=slide-up] .ladda-spinner {
left: 50%;
margin-left: -16px;
margin-top: 1em; }
.ladda-button[data-style=slide-up][data-loading] .ladda-label {
opacity: 0;
top: -1em; }
.ladda-button[data-style=slide-up][data-loading] .ladda-spinner {
opacity: 1;
margin-top: -16px; }
/*************************************
* SLIDE DOWN
*/
.ladda-button[data-style=slide-down] {
overflow: hidden; }
.ladda-button[data-style=slide-down] .ladda-label {
position: relative; }
.ladda-button[data-style=slide-down] .ladda-spinner {
left: 50%;
margin-left: -16px;
margin-top: -2em; }
.ladda-button[data-style=slide-down][data-loading] .ladda-label {
opacity: 0;
top: 1em; }
.ladda-button[data-style=slide-down][data-loading] .ladda-spinner {
opacity: 1;
margin-top: -16px; }
/*************************************
* ZOOM-OUT
*/
.ladda-button[data-style=zoom-out] {
overflow: hidden; }
.ladda-button[data-style=zoom-out] .ladda-spinner {
left: 50%;
margin-left: -16px;
-webkit-transform: scale(2.5);
-moz-transform: scale(2.5);
-ms-transform: scale(2.5);
-o-transform: scale(2.5);
transform: scale(2.5); }
.ladda-button[data-style=zoom-out] .ladda-label {
position: relative;
display: inline-block; }
.ladda-button[data-style=zoom-out][data-loading] .ladda-label {
opacity: 0;
-webkit-transform: scale(0.5);
-moz-transform: scale(0.5);
-ms-transform: scale(0.5);
-o-transform: scale(0.5);
transform: scale(0.5); }
.ladda-button[data-style=zoom-out][data-loading] .ladda-spinner {
opacity: 1;
-webkit-transform: none;
-moz-transform: none;
-ms-transform: none;
-o-transform: none;
transform: none; }
/*************************************
* ZOOM-IN
*/
.ladda-button[data-style=zoom-in] {
overflow: hidden; }
.ladda-button[data-style=zoom-in] .ladda-spinner {
left: 50%;
margin-left: -16px;
-webkit-transform: scale(0.2);
-moz-transform: scale(0.2);
-ms-transform: scale(0.2);
-o-transform: scale(0.2);
transform: scale(0.2); }
.ladda-button[data-style=zoom-in] .ladda-label {
position: relative;
display: inline-block; }
.ladda-button[data-style=zoom-in][data-loading] .ladda-label {
opacity: 0;
-webkit-transform: scale(2.2);
-moz-transform: scale(2.2);
-ms-transform: scale(2.2);
-o-transform: scale(2.2);
transform: scale(2.2); }
.ladda-button[data-style=zoom-in][data-loading] .ladda-spinner {
opacity: 1;
-webkit-transform: none;
-moz-transform: none;
-ms-transform: none;
-o-transform: none;
transform: none; }
/*************************************
* CONTRACT
*/
.ladda-button[data-style=contract] {
overflow: hidden;
width: 100px; }
.ladda-button[data-style=contract] .ladda-spinner {
left: 50%;
margin-left: -16px; }
.ladda-button[data-style=contract][data-loading] {
border-radius: 50%;
width: 52px; }
.ladda-button[data-style=contract][data-loading] .ladda-label {
opacity: 0; }
.ladda-button[data-style=contract][data-loading] .ladda-spinner {
opacity: 1; }
/*************************************
* OVERLAY
*/
.ladda-button[data-style=contract-overlay] {
overflow: hidden;
width: 100px;
box-shadow: 0px 0px 0px 3000px rgba(0, 0, 0, 0); }
.ladda-button[data-style=contract-overlay] .ladda-spinner {
left: 50%;
margin-left: -16px; }
.ladda-button[data-style=contract-overlay][data-loading] {
border-radius: 50%;
width: 52px;
/*outline: 10000px solid rgba( 0, 0, 0, 0.5 );*/
box-shadow: 0px 0px 0px 3000px rgba(0, 0, 0, 0.8); }
.ladda-button[data-style=contract-overlay][data-loading] .ladda-label {
opacity: 0; }
.ladda-button[data-style=contract-overlay][data-loading] .ladda-spinner {
opacity: 1; }
/*************************************
* CONFIG
*/
/*************************************
* BUTTON THEME
*/
.ladda-button {
background: #666;
border: 0;
padding: 14px 18px;
font-size: 18px;
cursor: pointer;
color: #fff;
border-radius: 2px;
border: 1px solid transparent;
-webkit-appearance: none;
-webkit-font-smoothing: antialiased;
-webkit-tap-highlight-color: rgba(0, 0, 0, 0); }
.ladda-button:hover {
border-color: rgba(0, 0, 0, 0.07);
background-color: #888; }
.ladda-button[data-color=green] {
background: #2aca76; }
.ladda-button[data-color=green]:hover {
background-color: #38d683; }
.ladda-button[data-color=blue] {
background: #53b5e6; }
.ladda-button[data-color=blue]:hover {
background-color: #69bfe9; }
.ladda-button[data-color=red] {
background: #ea8557; }
.ladda-button[data-color=red]:hover {
background-color: #ed956e; }
.ladda-button[data-color=purple] {
background: #9973c2; }
.ladda-button[data-color=purple]:hover {
background-color: #a685ca; }
.ladda-button[data-color=mint] {
background: #16a085; }
.ladda-button[data-color=mint]:hover {
background-color: #19b698; }
.ladda-button[disabled], .ladda-button[data-loading] {
border-color: rgba(0, 0, 0, 0.07);
cursor: default;
background-color: #999; }
.ladda-button[disabled]:hover, .ladda-button[data-loading]:hover {
cursor: default;
background-color: #999; }
.ladda-button[data-size=xs] {
padding: 4px 8px; }
.ladda-button[data-size=xs] .ladda-label {
font-size: 0.7em; }
.ladda-button[data-size=s] {
padding: 6px 10px; }
.ladda-button[data-size=s] .ladda-label {
font-size: 0.9em; }
.ladda-button[data-size=l] .ladda-label {
font-size: 1.2em; }
.ladda-button[data-size=xl] .ladda-label {
font-size: 1.5em; }

View File

@@ -0,0 +1,157 @@
(function(root, factory) {
if (typeof exports === "object") {
module.exports = factory();
} else if (typeof define === "function" && define.amd) {
define([ "spin" ], factory);
} else {
root.Ladda = factory(root.Spinner);
}
})(this, function(Spinner) {
"use strict";
var ALL_INSTANCES = [];
function create(button) {
if (typeof button === "undefined") {
console.warn("Ladda button target must be defined.");
return;
}
if (!button.querySelector(".ladda-label")) {
button.innerHTML = '<span class="ladda-label">' + button.innerHTML + "</span>";
}
var spinner = createSpinner(button);
var spinnerWrapper = document.createElement("span");
spinnerWrapper.className = "ladda-spinner";
button.appendChild(spinnerWrapper);
var timer;
var instance = {
start: function() {
button.setAttribute("disabled", "");
button.setAttribute("data-loading", "");
clearTimeout(timer);
spinner.spin(spinnerWrapper);
this.setProgress(0);
return this;
},
startAfter: function(delay) {
clearTimeout(timer);
timer = setTimeout(function() {
instance.start();
}, delay);
return this;
},
stop: function() {
button.removeAttribute("disabled");
button.removeAttribute("data-loading");
clearTimeout(timer);
timer = setTimeout(function() {
spinner.stop();
}, 1e3);
return this;
},
toggle: function() {
if (this.isLoading()) {
this.stop();
} else {
this.start();
}
return this;
},
setProgress: function(progress) {
progress = Math.max(Math.min(progress, 1), 0);
var progressElement = button.querySelector(".ladda-progress");
if (progress === 0 && progressElement && progressElement.parentNode) {
progressElement.parentNode.removeChild(progressElement);
} else {
if (!progressElement) {
progressElement = document.createElement("div");
progressElement.className = "ladda-progress";
button.appendChild(progressElement);
}
progressElement.style.width = (progress || 0) * button.offsetWidth + "px";
}
},
enable: function() {
this.stop();
return this;
},
disable: function() {
this.stop();
button.setAttribute("disabled", "");
return this;
},
isLoading: function() {
return button.hasAttribute("data-loading");
}
};
ALL_INSTANCES.push(instance);
return instance;
}
function bind(target, options) {
options = options || {};
var targets = [];
if (typeof target === "string") {
targets = toArray(document.querySelectorAll(target));
} else if (typeof target === "object" && typeof target.nodeName === "string") {
targets = [ target ];
}
for (var i = 0, len = targets.length; i < len; i++) {
(function() {
var element = targets[i];
if (typeof element.addEventListener === "function") {
var instance = create(element);
var timeout = -1;
element.addEventListener("click", function() {
instance.startAfter(1);
if (typeof options.timeout === "number") {
clearTimeout(timeout);
timeout = setTimeout(instance.stop, options.timeout);
}
if (typeof options.callback === "function") {
options.callback.apply(null, [ instance ]);
}
}, false);
}
})();
}
}
function stopAll() {
for (var i = 0, len = ALL_INSTANCES.length; i < len; i++) {
ALL_INSTANCES[i].stop();
}
}
function createSpinner(button) {
var height = button.offsetHeight, spinnerColor;
if (height > 32) {
height *= .8;
}
if (button.hasAttribute("data-spinner-size")) {
height = parseInt(button.getAttribute("data-spinner-size"), 10);
}
if (button.hasAttribute("data-spinner-color")) {
spinnerColor = button.getAttribute("data-spinner-color");
}
var lines = 12, radius = height * .2, length = radius * .6, width = radius < 7 ? 2 : 3;
return new Spinner({
color: spinnerColor || "#fff",
lines: lines,
radius: radius,
length: length,
width: width,
zIndex: "auto",
top: "auto",
left: "auto",
className: ""
});
}
function toArray(nodes) {
var a = [];
for (var i = 0; i < nodes.length; i++) {
a.push(nodes[i]);
}
return a;
}
return {
bind: bind,
create: create,
stopAll: stopAll
};
});

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1 @@
!function(a,b){"object"==typeof exports?module.exports=b():"function"==typeof define&&define.amd?define(["spin"],b):a.Ladda=b(a.Spinner)}(this,function(a){"use strict";function b(a){if("undefined"==typeof a)return console.warn("Ladda button target must be defined."),void 0;a.querySelector(".ladda-label")||(a.innerHTML='<span class="ladda-label">'+a.innerHTML+"</span>");var b=e(a),c=document.createElement("span");c.className="ladda-spinner",a.appendChild(c);var d,f={start:function(){return a.setAttribute("disabled",""),a.setAttribute("data-loading",""),clearTimeout(d),b.spin(c),this.setProgress(0),this},startAfter:function(a){return clearTimeout(d),d=setTimeout(function(){f.start()},a),this},stop:function(){return a.removeAttribute("disabled"),a.removeAttribute("data-loading"),clearTimeout(d),d=setTimeout(function(){b.stop()},1e3),this},toggle:function(){return this.isLoading()?this.stop():this.start(),this},setProgress:function(b){b=Math.max(Math.min(b,1),0);var c=a.querySelector(".ladda-progress");0===b&&c&&c.parentNode?c.parentNode.removeChild(c):(c||(c=document.createElement("div"),c.className="ladda-progress",a.appendChild(c)),c.style.width=(b||0)*a.offsetWidth+"px")},enable:function(){return this.stop(),this},disable:function(){return this.stop(),a.setAttribute("disabled",""),this},isLoading:function(){return a.hasAttribute("data-loading")}};return g.push(f),f}function c(a,c){c=c||{};var d=[];"string"==typeof a?d=f(document.querySelectorAll(a)):"object"==typeof a&&"string"==typeof a.nodeName&&(d=[a]);for(var e=0,g=d.length;g>e;e++)!function(){var a=d[e];if("function"==typeof a.addEventListener){var f=b(a),g=-1;a.addEventListener("click",function(){f.startAfter(1),"number"==typeof c.timeout&&(clearTimeout(g),g=setTimeout(f.stop,c.timeout)),"function"==typeof c.callback&&c.callback.apply(null,[f])},!1)}}()}function d(){for(var a=0,b=g.length;b>a;a++)g[a].stop()}function e(b){var c,d=b.offsetHeight;d>32&&(d*=.8),b.hasAttribute("data-spinner-size")&&(d=parseInt(b.getAttribute("data-spinner-size"),10)),b.hasAttribute("data-spinner-color")&&(c=b.getAttribute("data-spinner-color"));var e=12,f=.2*d,g=.6*f,h=7>f?2:3;return new a({color:c||"#fff",lines:e,radius:f,length:g,width:h,zIndex:"auto",top:"auto",left:"auto",className:""})}function f(a){for(var b=[],c=0;c<a.length;c++)b.push(a[c]);return b}var g=[];return{bind:c,create:b,stopAll:d}});

View File

@@ -0,0 +1,218 @@
(function(root, factory) {
if (typeof exports == "object") module.exports = factory(); else if (typeof define == "function" && define.amd) define(factory); else root.Spinner = factory();
})(this, function() {
"use strict";
var prefixes = [ "webkit", "Moz", "ms", "O" ], animations = {}, useCssAnimations;
function createEl(tag, prop) {
var el = document.createElement(tag || "div"), n;
for (n in prop) el[n] = prop[n];
return el;
}
function ins(parent) {
for (var i = 1, n = arguments.length; i < n; i++) parent.appendChild(arguments[i]);
return parent;
}
var sheet = function() {
var el = createEl("style", {
type: "text/css"
});
ins(document.getElementsByTagName("head")[0], el);
return el.sheet || el.styleSheet;
}();
function addAnimation(alpha, trail, i, lines) {
var name = [ "opacity", trail, ~~(alpha * 100), i, lines ].join("-"), start = .01 + i / lines * 100, z = Math.max(1 - (1 - alpha) / trail * (100 - start), alpha), prefix = useCssAnimations.substring(0, useCssAnimations.indexOf("Animation")).toLowerCase(), pre = prefix && "-" + prefix + "-" || "";
if (!animations[name]) {
sheet.insertRule("@" + pre + "keyframes " + name + "{" + "0%{opacity:" + z + "}" + start + "%{opacity:" + alpha + "}" + (start + .01) + "%{opacity:1}" + (start + trail) % 100 + "%{opacity:" + alpha + "}" + "100%{opacity:" + z + "}" + "}", sheet.cssRules.length);
animations[name] = 1;
}
return name;
}
function vendor(el, prop) {
var s = el.style, pp, i;
if (s[prop] !== undefined) return prop;
prop = prop.charAt(0).toUpperCase() + prop.slice(1);
for (i = 0; i < prefixes.length; i++) {
pp = prefixes[i] + prop;
if (s[pp] !== undefined) return pp;
}
}
function css(el, prop) {
for (var n in prop) el.style[vendor(el, n) || n] = prop[n];
return el;
}
function merge(obj) {
for (var i = 1; i < arguments.length; i++) {
var def = arguments[i];
for (var n in def) if (obj[n] === undefined) obj[n] = def[n];
}
return obj;
}
function pos(el) {
var o = {
x: el.offsetLeft,
y: el.offsetTop
};
while (el = el.offsetParent) o.x += el.offsetLeft, o.y += el.offsetTop;
return o;
}
var defaults = {
lines: 12,
length: 7,
width: 5,
radius: 10,
rotate: 0,
corners: 1,
color: "#000",
direction: 1,
speed: 1,
trail: 100,
opacity: 1 / 4,
fps: 20,
zIndex: 2e9,
className: "spinner",
top: "auto",
left: "auto",
position: "relative"
};
function Spinner(o) {
if (typeof this == "undefined") return new Spinner(o);
this.opts = merge(o || {}, Spinner.defaults, defaults);
}
Spinner.defaults = {};
merge(Spinner.prototype, {
spin: function(target) {
this.stop();
var self = this, o = self.opts, el = self.el = css(createEl(0, {
className: o.className
}), {
position: o.position,
width: 0,
zIndex: o.zIndex
}), mid = o.radius + o.length + o.width, ep, tp;
if (target) {
target.insertBefore(el, target.firstChild || null);
tp = pos(target);
ep = pos(el);
css(el, {
left: (o.left == "auto" ? tp.x - ep.x + (target.offsetWidth >> 1) : parseInt(o.left, 10) + mid) + "px",
top: (o.top == "auto" ? tp.y - ep.y + (target.offsetHeight >> 1) : parseInt(o.top, 10) + mid) + "px"
});
}
el.setAttribute("role", "progressbar");
self.lines(el, self.opts);
if (!useCssAnimations) {
var i = 0, start = (o.lines - 1) * (1 - o.direction) / 2, alpha, fps = o.fps, f = fps / o.speed, ostep = (1 - o.opacity) / (f * o.trail / 100), astep = f / o.lines;
(function anim() {
i++;
for (var j = 0; j < o.lines; j++) {
alpha = Math.max(1 - (i + (o.lines - j) * astep) % f * ostep, o.opacity);
self.opacity(el, j * o.direction + start, alpha, o);
}
self.timeout = self.el && setTimeout(anim, ~~(1e3 / fps));
})();
}
return self;
},
stop: function() {
var el = this.el;
if (el) {
clearTimeout(this.timeout);
if (el.parentNode) el.parentNode.removeChild(el);
this.el = undefined;
}
return this;
},
lines: function(el, o) {
var i = 0, start = (o.lines - 1) * (1 - o.direction) / 2, seg;
function fill(color, shadow) {
return css(createEl(), {
position: "absolute",
width: o.length + o.width + "px",
height: o.width + "px",
background: color,
boxShadow: shadow,
transformOrigin: "left",
transform: "rotate(" + ~~(360 / o.lines * i + o.rotate) + "deg) translate(" + o.radius + "px" + ",0)",
borderRadius: (o.corners * o.width >> 1) + "px"
});
}
for (;i < o.lines; i++) {
seg = css(createEl(), {
position: "absolute",
top: 1 + ~(o.width / 2) + "px",
transform: o.hwaccel ? "translate3d(0,0,0)" : "",
opacity: o.opacity,
animation: useCssAnimations && addAnimation(o.opacity, o.trail, start + i * o.direction, o.lines) + " " + 1 / o.speed + "s linear infinite"
});
if (o.shadow) ins(seg, css(fill("#000", "0 0 4px " + "#000"), {
top: 2 + "px"
}));
ins(el, ins(seg, fill(o.color, "0 0 1px rgba(0,0,0,.1)")));
}
return el;
},
opacity: function(el, i, val) {
if (i < el.childNodes.length) el.childNodes[i].style.opacity = val;
}
});
function initVML() {
function vml(tag, attr) {
return createEl("<" + tag + ' xmlns="urn:schemas-microsoft.com:vml" class="spin-vml">', attr);
}
sheet.addRule(".spin-vml", "behavior:url(#default#VML)");
Spinner.prototype.lines = function(el, o) {
var r = o.length + o.width, s = 2 * r;
function grp() {
return css(vml("group", {
coordsize: s + " " + s,
coordorigin: -r + " " + -r
}), {
width: s,
height: s
});
}
var margin = -(o.width + o.length) * 2 + "px", g = css(grp(), {
position: "absolute",
top: margin,
left: margin
}), i;
function seg(i, dx, filter) {
ins(g, ins(css(grp(), {
rotation: 360 / o.lines * i + "deg",
left: ~~dx
}), ins(css(vml("roundrect", {
arcsize: o.corners
}), {
width: r,
height: o.width,
left: o.radius,
top: -o.width >> 1,
filter: filter
}), vml("fill", {
color: o.color,
opacity: o.opacity
}), vml("stroke", {
opacity: 0
}))));
}
if (o.shadow) for (i = 1; i <= o.lines; i++) seg(i, -2, "progid:DXImageTransform.Microsoft.Blur(pixelradius=2,makeshadow=1,shadowopacity=.3)");
for (i = 1; i <= o.lines; i++) seg(i);
return ins(el, g);
};
Spinner.prototype.opacity = function(el, i, val, o) {
var c = el.firstChild;
o = o.shadow && o.lines || 0;
if (c && i + o < c.childNodes.length) {
c = c.childNodes[i + o];
c = c && c.firstChild;
c = c && c.firstChild;
if (c) c.opacity = val;
}
};
}
var probe = css(createEl("group"), {
behavior: "url(#default#VML)"
});
if (!vendor(probe, "transform") && probe.adj) initVML(); else useCssAnimations = vendor(probe, "animation");
return Spinner;
});

View File

@@ -0,0 +1,5 @@
/* Spin */
!function(a,b){"object"==typeof exports?module.exports=b():"function"==typeof define&&define.amd?define(b):a.Spinner=b()}(this,function(){"use strict";function a(a,b){var c,d=document.createElement(a||"div");for(c in b)d[c]=b[c];return d}function b(a){for(var b=1,c=arguments.length;c>b;b++)a.appendChild(arguments[b]);return a}function c(a,b,c,d){var e=["opacity",b,~~(100*a),c,d].join("-"),f=.01+c/d*100,g=Math.max(1-(1-a)/b*(100-f),a),h=j.substring(0,j.indexOf("Animation")).toLowerCase(),i=h&&"-"+h+"-"||"";return l[e]||(m.insertRule("@"+i+"keyframes "+e+"{0%{opacity:"+g+"}"+f+"%{opacity:"+a+"}"+(f+.01)+"%{opacity:1}"+(f+b)%100+"%{opacity:"+a+"}100%{opacity:"+g+"}}",m.cssRules.length),l[e]=1),e}function d(a,b){var c,d,e=a.style;if(void 0!==e[b])return b;for(b=b.charAt(0).toUpperCase()+b.slice(1),d=0;d<k.length;d++)if(c=k[d]+b,void 0!==e[c])return c}function e(a,b){for(var c in b)a.style[d(a,c)||c]=b[c];return a}function f(a){for(var b=1;b<arguments.length;b++){var c=arguments[b];for(var d in c)void 0===a[d]&&(a[d]=c[d])}return a}function g(a){for(var b={x:a.offsetLeft,y:a.offsetTop};a=a.offsetParent;)b.x+=a.offsetLeft,b.y+=a.offsetTop;return b}function h(a){return"undefined"==typeof this?new h(a):(this.opts=f(a||{},h.defaults,n),void 0)}function i(){function c(b,c){return a("<"+b+' xmlns="urn:schemas-microsoft.com:vml" class="spin-vml">',c)}m.addRule(".spin-vml","behavior:url(#default#VML)"),h.prototype.lines=function(a,d){function f(){return e(c("group",{coordsize:j+" "+j,coordorigin:-i+" "+-i}),{width:j,height:j})}function g(a,g,h){b(l,b(e(f(),{rotation:360/d.lines*a+"deg",left:~~g}),b(e(c("roundrect",{arcsize:d.corners}),{width:i,height:d.width,left:d.radius,top:-d.width>>1,filter:h}),c("fill",{color:d.color,opacity:d.opacity}),c("stroke",{opacity:0}))))}var h,i=d.length+d.width,j=2*i,k=2*-(d.width+d.length)+"px",l=e(f(),{position:"absolute",top:k,left:k});if(d.shadow)for(h=1;h<=d.lines;h++)g(h,-2,"progid:DXImageTransform.Microsoft.Blur(pixelradius=2,makeshadow=1,shadowopacity=.3)");for(h=1;h<=d.lines;h++)g(h);return b(a,l)},h.prototype.opacity=function(a,b,c,d){var e=a.firstChild;d=d.shadow&&d.lines||0,e&&b+d<e.childNodes.length&&(e=e.childNodes[b+d],e=e&&e.firstChild,e=e&&e.firstChild,e&&(e.opacity=c))}}var j,k=["webkit","Moz","ms","O"],l={},m=function(){var c=a("style",{type:"text/css"});return b(document.getElementsByTagName("head")[0],c),c.sheet||c.styleSheet}(),n={lines:12,length:7,width:5,radius:10,rotate:0,corners:1,color:"#000",direction:1,speed:1,trail:100,opacity:.25,fps:20,zIndex:2e9,className:"spinner",top:"auto",left:"auto",position:"relative"};h.defaults={},f(h.prototype,{spin:function(b){this.stop();var c,d,f=this,h=f.opts,i=f.el=e(a(0,{className:h.className}),{position:h.position,width:0,zIndex:h.zIndex}),k=h.radius+h.length+h.width;if(b&&(b.insertBefore(i,b.firstChild||null),d=g(b),c=g(i),e(i,{left:("auto"==h.left?d.x-c.x+(b.offsetWidth>>1):parseInt(h.left,10)+k)+"px",top:("auto"==h.top?d.y-c.y+(b.offsetHeight>>1):parseInt(h.top,10)+k)+"px"})),i.setAttribute("role","progressbar"),f.lines(i,f.opts),!j){var l,m=0,n=(h.lines-1)*(1-h.direction)/2,o=h.fps,p=o/h.speed,q=(1-h.opacity)/(p*h.trail/100),r=p/h.lines;!function s(){m++;for(var a=0;a<h.lines;a++)l=Math.max(1-(m+(h.lines-a)*r)%p*q,h.opacity),f.opacity(i,a*h.direction+n,l,h);f.timeout=f.el&&setTimeout(s,~~(1e3/o))}()}return f},stop:function(){var a=this.el;return a&&(clearTimeout(this.timeout),a.parentNode&&a.parentNode.removeChild(a),this.el=void 0),this},lines:function(d,f){function g(b,c){return e(a(),{position:"absolute",width:f.length+f.width+"px",height:f.width+"px",background:b,boxShadow:c,transformOrigin:"left",transform:"rotate("+~~(360/f.lines*i+f.rotate)+"deg) translate("+f.radius+"px,0)",borderRadius:(f.corners*f.width>>1)+"px"})}for(var h,i=0,k=(f.lines-1)*(1-f.direction)/2;i<f.lines;i++)h=e(a(),{position:"absolute",top:1+~(f.width/2)+"px",transform:f.hwaccel?"translate3d(0,0,0)":"",opacity:f.opacity,animation:j&&c(f.opacity,f.trail,k+i*f.direction,f.lines)+" "+1/f.speed+"s linear infinite"}),f.shadow&&b(h,e(g("#000","0 0 4px #000"),{top:"2px"})),b(d,b(h,g(f.color,"0 0 1px rgba(0,0,0,.1)")));return d},opacity:function(a,b,c){b<a.childNodes.length&&(a.childNodes[b].style.opacity=c)}});var o=e(a("group"),{behavior:"url(#default#VML)"});return!d(o,"transform")&&o.adj?i():j=d(o,"animation"),h});
/* Lada */
!function(a,b){"object"==typeof exports?module.exports=b():"function"==typeof define&&define.amd?define(["spin"],b):a.Ladda=b(a.Spinner)}(this,function(a){"use strict";function b(a){if("undefined"==typeof a)return console.warn("Ladda button target must be defined."),void 0;a.querySelector(".ladda-label")||(a.innerHTML='<span class="ladda-label">'+a.innerHTML+"</span>");var b=e(a),c=document.createElement("span");c.className="ladda-spinner",a.appendChild(c);var d,f={start:function(){return a.setAttribute("disabled",""),a.setAttribute("data-loading",""),clearTimeout(d),b.spin(c),this.setProgress(0),this},startAfter:function(a){return clearTimeout(d),d=setTimeout(function(){f.start()},a),this},stop:function(){return a.removeAttribute("disabled"),a.removeAttribute("data-loading"),clearTimeout(d),d=setTimeout(function(){b.stop()},1e3),this},toggle:function(){return this.isLoading()?this.stop():this.start(),this},setProgress:function(b){b=Math.max(Math.min(b,1),0);var c=a.querySelector(".ladda-progress");0===b&&c&&c.parentNode?c.parentNode.removeChild(c):(c||(c=document.createElement("div"),c.className="ladda-progress",a.appendChild(c)),c.style.width=(b||0)*a.offsetWidth+"px")},enable:function(){return this.stop(),this},disable:function(){return this.stop(),a.setAttribute("disabled",""),this},isLoading:function(){return a.hasAttribute("data-loading")}};return g.push(f),f}function c(a,c){c=c||{};var d=[];"string"==typeof a?d=f(document.querySelectorAll(a)):"object"==typeof a&&"string"==typeof a.nodeName&&(d=[a]);for(var e=0,g=d.length;g>e;e++)!function(){var a=d[e];if("function"==typeof a.addEventListener){var f=b(a),g=-1;a.addEventListener("click",function(){f.startAfter(1),"number"==typeof c.timeout&&(clearTimeout(g),g=setTimeout(f.stop,c.timeout)),"function"==typeof c.callback&&c.callback.apply(null,[f])},!1)}}()}function d(){for(var a=0,b=g.length;b>a;a++)g[a].stop()}function e(b){var c,d=b.offsetHeight;d>32&&(d*=.8),b.hasAttribute("data-spinner-size")&&(d=parseInt(b.getAttribute("data-spinner-size"),10)),b.hasAttribute("data-spinner-color")&&(c=b.getAttribute("data-spinner-color"));var e=12,f=.2*d,g=.6*f,h=7>f?2:3;return new a({color:c||"#fff",lines:e,radius:f,length:g,width:h,zIndex:"auto",top:"auto",left:"auto",className:""})}function f(a){for(var b=[],c=0;c<a.length;c++)b.push(a[c]);return b}var g=[];return{bind:c,create:b,stopAll:d}});