Server IP : 85.193.89.191 / Your IP : 3.137.173.197 Web Server : Apache System : Linux 956367-cx40159.tmweb.ru 3.10.0-1160.105.1.el7.x86_64 #1 SMP Thu Dec 7 15:39:45 UTC 2023 x86_64 User : bitrix ( 600) PHP Version : 8.1.27 Disable Function : NONE MySQL : OFF | cURL : OFF | WGET : ON | Perl : ON | Python : ON | Sudo : ON | Pkexec : ON Directory : /home/bitrix/www/bitrix/js/scale/ |
Upload File : |
/** * Class BX.Scale.LoadBar * Role's LoadBar control */ ;(function(window) { if (BX.Scale.LoadBar) return; /** * Class BX.Scale.LoadBar * @constructor */ BX.Scale.LoadBar = function (id) { this.id = id; this.domObj = null; this.value = 0; }; //Dom prototype object to copy from BX.Scale.LoadBar.prototype.protoObj = null; /** * Returns and creates (if need) prototype object * @returns {domNode} */ BX.Scale.LoadBar.prototype.getProtoObj = function() { if(BX.Scale.LoadBar.prototype.protoObj === null) { BX.Scale.LoadBar.prototype.protoObj = document.createElement("div"); BX.addClass(BX.Scale.LoadBar.prototype.protoObj, "adm-scale-item-state"); BX.addClass(BX.Scale.LoadBar.prototype.protoObj, "adm-scale-0"); for(var i=100; i>=5; i-=5) { var span = document.createElement("span"); BX.addClass(span, "adm-state-item"); BX.addClass(span, "adm-state-item-"+i); BX.Scale.LoadBar.prototype.protoObj.appendChild(span); } } return BX.Scale.LoadBar.prototype.protoObj; }; /** * Returns DOM object contains server data * @returns {object} */ BX.Scale.LoadBar.prototype.getDomObj = function() { if(!this.domObj) { this.domObj = this.getProtoObj().cloneNode(true); this.domObj.id = this.id; } return this.domObj; }; /** * Sets the bar value * @param value * @returns {boolean} */ BX.Scale.LoadBar.prototype.setValue = function(value) { if(!this.domObj) return false; value = parseInt(value); value = Math.round(value/5)*5; BX.removeClass(this.domObj, "adm-scale-"+this.value); if(value < 0) this.value = 0; else if(value > 100) this.value = 100; else this.value = value; BX.addClass(this.domObj, "adm-scale-"+this.value); return value; }; })(window);