-
Notifications
You must be signed in to change notification settings - Fork 0
/
PerfiLoader.min.js
1 lines (1 loc) · 1.42 KB
/
PerfiLoader.min.js
1
(function(e,t){var n={enabled:!0,size:32,fillParent:!1,className:"perfi-loader-preloader"},r=function(e,n){e=e===t?"body":e;var r=$(e),i=r.prev().hasClass(n.className),s=n.className+"-image";if(r.length>0&&!i&&n.enabled){var o=r.offset(),u=r.fullWidth(),a=r.fullHeight(),f=$("<div/>");f.addClass(n.className),f.addClass("preloader"+n.size);var l=$("<i/>");l.addClass(s),f.append(l),r.before(f);if(n.fillParent)f.css({width:"100%",height:"100%",position:"absolute",top:"0",left:"0"}),l.css({top:"50%","margin-top":"-"+n.size/2+"px","margin-left":"auto",position:"relative"});else{f.width(u).height(a).offset(o);var c=o.left+(u/2-n.size/2),h=o.top+(a/2-n.size/2);f.find("."+s).offset({left:c,top:h})}}else i&&!n.enabled&&r.prev().remove()};$.fn.fullWidth=function(){var e=0;return $(this).each(function(){var t=$(this),n=t.width();n+=parseInt(t.css("padding-left"),10)+parseInt(t.css("padding-right"),10),n+=parseInt(t.css("borderLeftWidth"),10)+parseInt(t.css("borderRightWidth"),10),e+=n}),e},$.fn.fullHeight=function(){var e=0;return $(this).each(function(){var t=$(this),n=t.height();n+=parseInt(t.css("padding-top"),10)+parseInt(t.css("padding-bottom"),10),n+=parseInt(t.css("borderTopWidth"),10)+parseInt(t.css("borderBottomWidth"),10),e+=n}),e},$.fn.preloader=function(e,i,s){var o={};e!==t&&(typeof e=="object"?o=e:(o.enabled=e,i!==t&&(o.size=i),s!==t&&(o.fillParent=s))),o=$.extend($.extend({},n),o),$(this).each(function(e,t){r(t,o)})}})(window);