/
Ladlen
/
tiles
Обзор
Документация
Войти
/
Ladlen
/
tiles
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
master
web/js/loading.min.js
1 строка
3 KB
Dolgov Dmitriy
fin
24 фев 2017, 12:44
24 фев 2017, 12:44
3d269c1
Код
Авторство
О чём код?
"use strict";!function(a){var b=100,c={top:function(a){var c=document.createElement("div");c.setAttribute("id","_loading"),c.style.position="absolute",c.style.width=b+"px",c.style.height="0px",c.style.top="50%",c.style.left="50%",c.style["z-index"]=99999,c.style["text-align"]="center";for(var d in a)"width"==d&&(c.style[d]=a[d]+"px",b=a[d]),"height"==d&&(c.style[d]=a[d]+"px");var e=document.body.clientWidth,f=(e-b)/2;return c.style.left=f+"px",c}};c["line-pulse"]=function(){for(var a=c.top({width:"100",height:"20"}),b=0;b<4;b++){var d=document.createElement("div");a.appendChild(d)}return a.setAttribute("class","line-pulse"),a},c["jump-pulse"]=function(){for(var a=c.top({width:"100",height:"20"}),b=0;b<4;b++){var d=document.createElement("div");a.appendChild(d)}return a.setAttribute("class","jump-pulse"),a},c["circle-turn"]=function(){var a=document.createElement("div"),b=c.top({width:"25",height:"25"});return b.appendChild(a),b.setAttribute("class","circle-turn"),b},c["circle-turn-scale"]=function(){var a=document.createElement("div"),b=c.top({width:"25",height:"25"});return b.appendChild(a),b.setAttribute("class","circle-turn-scale"),b},c["circle-fade"]=function(){for(var a=c.top({width:"50",height:"72"}),b=0;b<8;b++){var d=document.createElement("div");a.appendChild(d)}return a.setAttribute("class","circle-fade"),a},c["square-flip"]=function(){for(var a=c.top({width:"50",height:"0"}),b=0;b<1;b++){var d=document.createElement("div");a.appendChild(d)}return a.setAttribute("class","square-flip"),a},c["line-scale"]=function(){for(var a=c.top({width:"60",height:"40"}),b=0;b<5;b++){var d=document.createElement("div");a.appendChild(d)}return a.setAttribute("class","line-scale"),a},a.showLoading=function(){var b={name:"line-pulse",maskClick:!1,callback:function(){}};if(arguments)if("string"==typeof arguments[0])b.name=arguments[0];else if("object"==typeof arguments[0])for(var d in arguments[0])b[d]=arguments[0][d];a.hideLoading();var e=document.createElement("div");e.setAttribute("id","_mask"),e.style.position="fixed",e.style.top="0",e.style.left="0",e.style.bottom="0",e.style.right="0",e.style.overflow="hidden",e.style["z-index"]=99998,e.style["background-color"]="#000",e.style.opacity=.6,e.style.zoom=1,b.allowHide&&e.addEventListener("click",function(){a.hideLoading()},!1);var f=document.getElementsByTagName("body")[0];f.appendChild(e),f.appendChild(c[b.name]()),b.callback()},a.hideLoading=function(){var a=document.getElementById("_mask"),b=document.getElementById("_loading");"undefined"!=typeof a&&null===a&&"undefined"!=typeof b&&null===b||(a.remove(),b.remove())}}(window);