9 lines
		
	
	
		
			3.6 KiB
		
	
	
	
		
			JavaScript
		
	
	
		
			Executable File
		
	
	
	
	
			
		
		
	
	
			9 lines
		
	
	
		
			3.6 KiB
		
	
	
	
		
			JavaScript
		
	
	
		
			Executable File
		
	
	
	
	
/*!
 | 
						|
 * Ladda 1.0.1 (2017-07-11, 22:53)
 | 
						|
 * http://lab.hakim.se/ladda
 | 
						|
 * MIT licensed
 | 
						|
 *
 | 
						|
 * Copyright (C) 2017 Hakim El Hattab, http://hakim.se
 | 
						|
 */
 | 
						|
 | 
						|
!function(t,e){"object"==typeof exports?module.exports=e(require("spin.js")):"function"==typeof define&&define.amd?define(["spin"],e):t.Ladda=e(t.Spinner)}(this,function(t){"use strict";function e(t){if(void 0!==t){if(/ladda-button/i.test(t.className)||(t.className+=" ladda-button"),t.hasAttribute("data-style")||t.setAttribute("data-style","expand-right"),!t.querySelector(".ladda-label")){var e=document.createElement("span");e.className="ladda-label",i(t,e)}var a,n=t.querySelector(".ladda-spinner");n||((n=document.createElement("span")).className="ladda-spinner"),t.appendChild(n);var s,u={start:function(){return a||(a=r(t)),t.setAttribute("disabled",""),t.setAttribute("data-loading",""),clearTimeout(s),a.spin(n),this.setProgress(0),this},startAfter:function(t){return clearTimeout(s),s=setTimeout(function(){u.start()},t),this},stop:function(){return t.removeAttribute("disabled"),t.removeAttribute("data-loading"),clearTimeout(s),a&&(s=setTimeout(function(){a.stop()},1e3)),this},toggle:function(){return this.isLoading()?this.stop():this.start(),this},setProgress:function(e){e=Math.max(Math.min(e,1),0);var a=t.querySelector(".ladda-progress");0===e&&a&&a.parentNode?a.parentNode.removeChild(a):(a||((a=document.createElement("div")).className="ladda-progress",t.appendChild(a)),a.style.width=(e||0)*t.offsetWidth+"px")},enable:function(){return this.stop(),this},disable:function(){return this.stop(),t.setAttribute("disabled",""),this},isLoading:function(){return t.hasAttribute("data-loading")},remove:function(){clearTimeout(s),t.removeAttribute("disabled",""),t.removeAttribute("data-loading",""),a&&(a.stop(),a=null);for(var e=0,n=o.length;e<n;e++)if(u===o[e]){o.splice(e,1);break}}};return o.push(u),u}console.warn("Ladda button target must be defined.")}function a(t,e){for(;t.parentNode&&t.tagName!==e;)t=t.parentNode;return e===t.tagName?t:void 0}function n(t){for(var e=["input","textarea","select"],a=[],n=0;n<e.length;n++)for(var r=t.getElementsByTagName(e[n]),i=0;i<r.length;i++)r[i].hasAttribute("required")&&a.push(r[i]);return a}function r(e){var a,n,r=e.offsetHeight;0===r&&(r=parseFloat(window.getComputedStyle(e).height)),r>32&&(r*=.8),e.hasAttribute("data-spinner-size")&&(r=parseInt(e.getAttribute("data-spinner-size"),10)),e.hasAttribute("data-spinner-color")&&(a=e.getAttribute("data-spinner-color")),e.hasAttribute("data-spinner-lines")&&(n=parseInt(e.getAttribute("data-spinner-lines"),10));var i=.2*r,o=.6*i,s=i<7?2:3;return new t({color:a||"#fff",lines:n||12,radius:i,length:o,width:s,zIndex:"auto",top:"auto",left:"auto",className:""})}function i(t,e){var a=document.createRange();a.selectNodeContents(t),a.surroundContents(e),t.appendChild(e)}var o=[];return{bind:function(t,r){r=r||{};var i=[];"string"==typeof t?i=document.querySelectorAll(t):"object"==typeof t&&"string"==typeof t.nodeName&&(i=[t]);for(var o=0;o<i.length;o++)!function(){var t=i[o];if("function"==typeof t.addEventListener){var s=e(t),u=-1;t.addEventListener("click",function(e){var i=!0,o=a(t,"FORM");if(void 0!==o)if("function"==typeof o.checkValidity)i=o.checkValidity();else for(var d=n(o),l=0;l<d.length;l++)""===d[l].value.replace(/^\s+|\s+$/g,"")&&(i=!1),"checkbox"!==d[l].type&&"radio"!==d[l].type||d[l].checked||(i=!1),"email"===d[l].type&&(i=/^[a-zA-Z0-9_.+-]+@[a-zA-Z0-9-]+\.[a-zA-Z0-9-.]+$/.test(d[l].value));i&&(s.startAfter(1),"number"==typeof r.timeout&&(clearTimeout(u),u=setTimeout(s.stop,r.timeout)),"function"==typeof r.callback&&r.callback.apply(null,[s]))},!1)}}()},create:e,stopAll:function(){for(var t=0,e=o.length;t<e;t++)o[t].stop()}}}); |