123456 |
- // Licensed Materials - Property of IBM
- // IBM Cognos Products: hal
- // (C) Copyright IBM Corp. 2003, 2017.
- // US Government Users Restricted Rights - Use, duplication or disclosure restricted by GSA ADP Schedule Contract with IBM Corp.
- function C_Switch(_hBR1, _hEX1, _h2L1){this._hCR1=_hBR1;this._hCR1._hT22=this;this._h3L1=_h2L1;this._hFX1=_hEX1||{};this._hHC2();this.F_SetEnabled(true);};C_Switch.prototype.F_Detach=function(){this._hCR1.innerHTML="";this._hCR1=null;};C_Switch.prototype._hHC2=function(){var _hD72=(this._hFX1.shape=="round");var _hMZ1=this._hFX1.height?(new C_CSSLength(this._hFX1.height)).F_GetPixelValue():30;var _h852=80;var _hJE2="#"+(this._hCR1.id||this._hCR1.uniqueID);this._hCR1.innerHTML ="<STYLE>"+_hJE2+" > LABEL { width: " + _h852 + "px; height:" + _hMZ1 + "px; line-height:" + _hMZ1 + "px;" + ( this._hFX1.offColor?( " background-color:" + this._hFX1.offColor ):"" ) + "; border-radius:" + ( _hD72?( _hMZ1 / 2 ):0 ) + "px;}" +_hJE2+" > LABEL:after { width:" + ( _h852 / 2 ) + "px; background-color:" + ( this._hFX1.handleColor||"white" ) + ";}" +_hJE2+" > INPUT:checked + LABEL { " + ( this._hFX1.onColor?( "background-color:" + this._hFX1.onColor ):"" ) + ";}" +_hJE2+" > INPUT:checked + LABEL:after { margin-left:" + ( _h852 / 2 ) + "px;}" +"</STYLE>";this._hCR1.classList.add("clsSwitch");this._hCR1.classList.add(_hD72?"clsSwitchRound":"clsSwitchSquare");var d=this._hCR1.ownerDocument;this._hPE2=this._hCR1.appendChild(d.createElement("INPUT"));this._hPE2.type="checkbox";this._hPE2.id=this._hCR1.id+"__checkbox__";if(this._h3L1){this._hPE2.onclick=this._hT12.bind(this);}var lbl=this._hCR1.appendChild(d.createElement("LABEL"));lbl.setAttribute("for", this._hPE2.id);};C_Switch.prototype._hT12=function(e){this._h3L1();};C_Switch.prototype.F_IsOn=function(){return this._hPE2.checked;};C_Switch.prototype.F_SetOn=function(b){this._hPE2.checked=b;};C_Switch.prototype.F_SetEnabled=function(b){this._hPE2.disabled=!b;};
|