mirror of
https://github.com/the-djmaze/snappymail.git
synced 2026-11-03 02:48:49 +03:00
cleanup Progress.js
This commit is contained in:
parent
c9d444250f
commit
d28e193556
3 changed files with 27 additions and 64 deletions
2
vendors/Progress.js/minified/progress.min.js
vendored
2
vendors/Progress.js/minified/progress.min.js
vendored
|
|
@ -1 +1 @@
|
|||
(e=>{function t(e){void 0!==e.length?this._targetElement=e:this._targetElement=[e],void 0===window._progressjsId&&(window._progressjsId=1),void 0===window._progressjsIntervals&&(window._progressjsIntervals={}),this._options={theme:"rainloop",overlayMode:!1,considerTransition:!0}}function r(){void 0!==this._onBeforeStartCallback&&this._onBeforeStartCallback.call(this),function(){if(!document.querySelector(".progressjs-container")){var e=document.createElement("div");e.className="progressjs-container",document.body.appendChild(e)}}.call(this);for(var e=0,t=this._targetElement.length;e<t;e++)s.call(this,this._targetElement[e])}function s(e){if(!e.hasAttribute("data-progressjs")){var t=function(e){var t={};"body"===e.tagName.toLowerCase()?(t.width=e.clientWidth,t.height=e.clientHeight):(t.width=e.offsetWidth,t.height=e.offsetHeight);var r=0,s=0;for(;e&&!isNaN(e.offsetLeft)&&!isNaN(e.offsetTop);)r+=e.offsetLeft,s+=e.offsetTop,e=e.offsetParent;return t.top=s,t.left=r,t}.call(this,e);e.setAttribute("data-progressjs",window._progressjsId);var r=document.createElement("div");r.className="progressjs-progress progressjs-theme-"+this._options.theme,"body"===e.tagName.toLowerCase()?r.style.position="fixed":r.style.position="absolute",r.setAttribute("data-progressjs",window._progressjsId);var s=document.createElement("div");s.className="progressjs-inner";var o=document.createElement("div");o.className="progressjs-percent",o.innerHTML="1%",s.appendChild(o),this._options.overlayMode&&"body"===e.tagName.toLowerCase()?(r.style.left=0,r.style.right=0,r.style.top=0,r.style.bottom=0):(r.style.left=t.left+"px",r.style.top=t.top+"px",r.style.width=t.width+"px",this._options.overlayMode&&(r.style.height=t.height+"px")),r.appendChild(s),document.querySelector(".progressjs-container").appendChild(r),n(e,1),++window._progressjsId}}function n(e,t){t>=100&&(t=100),e.hasAttribute("data-progressjs")&&setTimeout(function(){var r=o(e);r.style.width=parseInt(t)+"%",r=r.querySelector(".progressjs-percent");var s=parseInt(r.innerHTML.replace("%",""));!function(e,t,r){var s=!0;t>r&&(s=!1);var n=10;!function e(t,r,o){var i=Math.abs(r-o);n=i<3?30:i<20?20:1,r-o!=0&&(t.innerHTML=(s?++r:--r)+"%",setTimeout(function(){e(t,r,o)},n))}(e,t,r)}(r,s,parseInt(t))},50)}function o(e){var t=parseInt(e.getAttribute("data-progressjs"));return document.querySelector('.progressjs-container > .progressjs-progress[data-progressjs="'+t+'"] > .progressjs-inner')}function i(){void 0!==this._onBeforeEndCallback&&(!0===this._options.considerTransition?o(this._targetElement[0]).addEventListener(function(){var e,t=document.createElement("fakeelement"),r={transition:"transitionend",OTransition:"oTransitionEnd",MozTransition:"transitionend",WebkitTransition:"webkitTransitionEnd"};for(e in r)if(void 0!==t.style[e])return r[e]}(),this._onBeforeEndCallback,!1):this._onBeforeEndCallback.call(this));for(var e=parseInt(this._targetElement[0].getAttribute("data-progressjs")),t=0,r=this._targetElement.length;t<r;t++){var s=this._targetElement[t],i=o(s);if(!i)return;var a=parseInt(i.style.width.replace("%","")),l=1;a<100&&(n.call(this,s,100),l=500),function(e,t){setTimeout(function(){e.parentNode.className+=" progressjs-end",setTimeout(function(){e.parentNode.parentNode.removeChild(e.parentNode),t.removeAttribute("data-progressjs")},1e3)},l)}(i,s)}if(window._progressjsIntervals[e])try{clearInterval(window._progressjsIntervals[e]),window._progressjsIntervals[e]=null,delete window._progressjsIntervals[e]}catch(e){}}var a=function(e){if("object"==typeof e)return new t(e);if("string"==typeof e){var r=document.querySelectorAll(e);if(r)return new t(r);throw new Error("There is no element with given selector.")}return new t(document.body)};a.version="0.1.0",a.fn=t.prototype={start:function(){return r.call(this),this},set:function(e){return function(e){for(var t=0,r=this._targetElement.length;t<r;t++)n.call(this,this._targetElement[t],e)}.call(this,e),this},end:function(){return i.call(this),this},onbeforeend:function(e){if("function"!=typeof e)throw new Error("Provided callback for onbeforeend was not a function");return this._onBeforeEndCallback=e,this}},e.progressJs=a})(this);
|
||||
(e=>{function t(e){void 0!==e.length?this._targetElement=e:this._targetElement=[e],void 0===window._progressjsId&&(window._progressjsId=1),void 0===window._progressjsIntervals&&(window._progressjsIntervals={}),this._options={theme:"rainloop",overlayMode:!1,considerTransition:!0}}function r(){(function(){if(!document.querySelector(".progressjs-container")){var e=document.createElement("div");e.className="progressjs-container",document.body.appendChild(e)}}).call(this);var e=this;e._targetElement.forEach(t=>(function(e){if(e.hasAttribute("data-progressjs"))return;var t=function(e){var t={},r=0,s=0;"body"===e.tagName.toLowerCase()?(t.width=e.clientWidth,t.height=e.clientHeight):(t.width=e.offsetWidth,t.height=e.offsetHeight);for(;e&&!isNaN(e.offsetLeft)&&!isNaN(e.offsetTop);)r+=e.offsetLeft,s+=e.offsetTop,e=e.offsetParent;return t.top=s,t.left=r,t}.call(this,e);e.setAttribute("data-progressjs",window._progressjsId);var r=document.createElement("div");r.className="progressjs-progress progressjs-theme-"+this._options.theme,r.style.position="body"===e.tagName.toLowerCase()?"fixed":"absolute",r.setAttribute("data-progressjs",window._progressjsId);var o=document.createElement("div");o.className="progressjs-inner";var n=document.createElement("div");n.className="progressjs-percent",n.innerHTML="1%",o.appendChild(n),this._options.overlayMode&&"body"===e.tagName.toLowerCase()?(r.style.left=0,r.style.right=0,r.style.top=0,r.style.bottom=0):(r.style.left=t.left+"px",r.style.top=t.top+"px",r.style.width=t.width+"px",this._options.overlayMode&&(r.style.height=t.height+"px"));r.appendChild(o),document.querySelector(".progressjs-container").appendChild(r),s(e,1),++window._progressjsId}).call(e,t))}function s(e,t){t>=100&&(t=100),e.hasAttribute("data-progressjs")&&setTimeout(()=>{var r=o(e);r.style.width=parseInt(t)+"%",r=r.querySelector(".progressjs-percent");var s=parseInt(r.innerHTML.replace("%",""));((e,t,r)=>{var s=!0;t>r&&(s=!1);var o=10;!function e(t,r,n){var i=Math.abs(r-n);o=i<3?30:i<20?20:1,r-n!=0&&(t.innerHTML=(s?++r:--r)+"%",setTimeout(()=>e(t,r,n),o))}(e,t,r)})(r,s,parseInt(t))},50)}function o(e){var t=parseInt(e.getAttribute("data-progressjs"));return document.querySelector('.progressjs-container > .progressjs-progress[data-progressjs="'+t+'"] > .progressjs-inner')}var n=function(e){if("object"==typeof e)return new t(e);if("string"==typeof e){var r=document.querySelectorAll(e);if(r)return new t(r);throw new Error("There is no element with given selector.")}return new t(document.body)};n.version="0.1.0",n.fn=t.prototype={start:function(){return r.call(this),this},set:function(e){return function(e){var t=this;t._targetElement.forEach(r=>s.call(t,r,e))}.call(this,e),this},end:function(){return function(){void 0!==this._onBeforeEndCallback&&(!0===this._options.considerTransition?o(this._targetElement[0]).addEventListener("transitionend",this._onBeforeEndCallback,!1):this._onBeforeEndCallback.call(this));var e=parseInt(this._targetElement[0].getAttribute("data-progressjs")),t=this;if(t._targetElement.forEach(e=>{var r=o(e);if(r){var n=parseInt(r.style.width.replace("%","")),i=1;n<100&&(s.call(t,e,100),i=500),((e,t)=>{setTimeout(()=>{e.parentNode.className+=" progressjs-end",setTimeout(()=>{e.parentNode.parentNode.removeChild(e.parentNode),t.removeAttribute("data-progressjs")},1e3)},i)})(r,e)}}),window._progressjsIntervals[e])try{clearInterval(window._progressjsIntervals[e]),window._progressjsIntervals[e]=null,delete window._progressjsIntervals[e]}catch(e){}}.call(this),this},onbeforeend:function(e){if("function"!=typeof e)throw new Error("Provided callback for onbeforeend was not a function");return this._onBeforeEndCallback=e,this}},e.progressJs=n})(this);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue