YetiForceCompany/YetiForceCRM

View on GitHub
public_html/layouts/resources/ProgressIndicator.min.js

Summary

Maintainability
A
0 mins
Test Coverage
'use strict';

/*+***********************************************************************************
 * The contents of this file are subject to the vtiger CRM Public License Version 1.0
 * ("License"); You may not use this file except in compliance with the License
 * The Original Code is:  vtiger CRM Open Source
 * The Initial Developer of the Original Code is vtiger.
 * Portions created by vtiger are Copyright (C) vtiger.
 * All Rights Reserved.
 *************************************************************************************/"use strict";(function($){var ProgressIndicatorHelper=function(){var thisInstance=this;this.defaults={position:"append",mode:"show",blockInfo:{elementToBlock:"body"},message:""},this.imageContainerCss={"text-align":"center"},this.blockOverlayCSS={opacity:.8,"background-color":"#fff"},this.blockCss={border:"","background-color":"","background-clip":"border-box","border-radius":"2px"},this.showTopCSS={width:"25%",left:"37.5%",position:"fixed",top:"4.5%","z-index":"100000"},this.showOnTop=!1,this.init=function(element){var options=1<arguments.length&&void 0!==arguments[1]?arguments[1]:{};return thisInstance.options=$.extend(!0,this.defaults,options),thisInstance.blockOverlayCSS=Object.assign(thisInstance.blockOverlayCSS,options.blockOverlayCSS?options.blockOverlayCSS:{}),thisInstance.container=element,thisInstance.position=options.position,"undefined"!=typeof options.imageContainerCss&&(thisInstance.imageContainerCss=$.extend(!0,this.imageContainerCss,options.imageContainerCss)),this.isBlockMode()&&(thisInstance.elementToBlock=$(thisInstance.options.blockInfo.elementToBlock)),this},this.initActions=function(){"show"==this.options.mode?this.show():"hide"==this.options.mode&&this.hide();},this.isPageBlockMode=function(){return !!("undefined"!=typeof this.elementToBlock&&this.elementToBlock.is("body"))},this.isBlockMode=function(){return !("undefined"==typeof this.options.blockInfo||!0!=this.options.blockInfo.enabled)},this.show=function(){var className="bigLoading";!0==this.options.smallLoadingImage&&(className="smallLoading"),this.isBlockMode()&&(className+=" blockProgressContainer");var imageHtml="<div class=\"imageHolder "+className+"\"><div class=\"sk-cube-grid\"><div class=\"sk-cube sk-cube1\"></div><div class=\"sk-cube sk-cube2\"></div><div class=\"sk-cube sk-cube3\"></div><div class=\"sk-cube sk-cube4\"></div><div class=\"sk-cube sk-cube5\"></div><div class=\"sk-cube sk-cube6\"></div><div class=\"sk-cube sk-cube7\"></div><div class=\"sk-cube sk-cube8\"></div><div class=\"sk-cube sk-cube9\"></div></div></div>",jQImageHtml=jQuery(imageHtml).css(this.imageContainerCss),jQMessage=thisInstance.options.message;if(!1!==jQMessage){0==jQMessage.length&&(jQMessage=app.vtranslate("JS_LOADING_PLEASE_WAIT")),jQMessage instanceof jQuery||(jQMessage=jQuery("<span></span>").html(jQMessage));var messageContainer=jQuery("<div class=\"message\"></div>").append(jQMessage);}switch(jQImageHtml.append(messageContainer),this.isBlockMode()&&jQImageHtml.addClass("blockMessageContainer"),thisInstance.position){case"prepend":thisInstance.container.prepend(jQImageHtml);break;case"html":thisInstance.container.html(jQImageHtml);break;case"replace":thisInstance.container.replaceWith(jQImageHtml);break;default:thisInstance.container.append(jQImageHtml);}this.isBlockMode()&&(thisInstance.blockedElement=thisInstance.elementToBlock,thisInstance.isPageBlockMode()?$.blockUI({message:thisInstance.container,overlayCSS:thisInstance.blockOverlayCSS,css:thisInstance.blockCss,onBlock:thisInstance.options.blockInfo.onBlock}):thisInstance.elementToBlock.block({message:thisInstance.container,overlayCSS:thisInstance.blockOverlayCSS,css:thisInstance.blockCss})),thisInstance.showOnTop&&this.container.css(this.showTopCSS).appendTo("body");},this.hide=function(){$(".imageHolder",this.container).remove(),"undefined"!=typeof this.blockedElement&&(this.isPageBlockMode()?$.unblockUI():this.blockedElement.unblock()),this.container.removeData("progressIndicator");};};//Change the z-index of the block overlay value
$.fn.progressIndicator=function(options){var element=this;return 0>=this.length&&(element=jQuery("body")),element.each(function(index,element){var progressIndicatorInstance,jQueryObject=$(element);"undefined"==typeof jQueryObject.data("progressIndicator")?(progressIndicatorInstance=new ProgressIndicatorHelper,jQueryObject.data("progressIndicator",progressIndicatorInstance)):progressIndicatorInstance=jQueryObject.data("progressIndicator"),progressIndicatorInstance.init(jQueryObject,options).initActions();})},$.progressIndicator=function(options){var progressImageContainer=jQuery("<div></div>"),progressIndicatorInstance=new ProgressIndicatorHelper;return progressIndicatorInstance.init(progressImageContainer,options),progressIndicatorInstance.isBlockMode()||(progressIndicatorInstance.showOnTop=!0),progressIndicatorInstance.initActions(),progressImageContainer.data("progressIndicator",progressIndicatorInstance)},$.blockUI.defaults.baseZ=1e4;})(jQuery);
//# sourceMappingURL=ProgressIndicator.min.js.map