G_CPTF.js 2.3 KB

123456
  1. // Licensed Materials - Property of IBM
  2. // IBM Cognos Products: hal
  3. // (C) Copyright IBM Corp. 2003, 2017.
  4. // US Government Users Restricted Rights - Use, duplication or disclosure restricted by GSA ADP Schedule Contract with IBM Corp.
  5. var G_CPTF={};G_CPTF.F_Init=function(_hND2){var d=U_XML.F_LoadString(this, _hND2, true, false);var _hBB2=d.documentElement;var _hCB2=_hBB2.selectSingleNode("mode");this._hDB2=_hCB2?_hCB2.getAttribute( "value" ):"normal";switch(this._hDB2){case "ids":break;case "prefixSuffix":this._hJ32=_hCB2.getAttribute("prefix");this._hK32=_hCB2.getAttribute("suffix");break;case "percentageGrowth":this._hUH=parseFloat(_hCB2.getAttribute("growth"));break;case "unicodeRange":this._h7F=parseInt(_hCB2.getAttribute("start"), 16);this._hUL=parseInt(_hCB2.getAttribute("end"), 16);this._hUH=parseFloat(_hCB2.getAttribute("growth"));break;case "normal":default:return;}G_ResManager.F_CPTF_GetString=G_ResManager.F_GetString;G_ResManager.F_CPTF_GetOptionalString=G_ResManager.F_GetOptionalString;G_ResManager.F_GetString=this.F_GetString;G_ResManager.F_GetOptionalString=this.F_GetOptionalString;};G_CPTF.F_InitFromSetting=function(){this._hDB2="percentageGrowth";this._hUH=0.3;G_ResManager.F_CPTF_GetString=G_ResManager.F_GetString;G_ResManager.F_CPTF_GetOptionalString=G_ResManager.F_GetOptionalString;G_ResManager.F_GetString=this.F_GetString;G_ResManager.F_GetOptionalString=this.F_GetOptionalString;};G_CPTF.F_GetString=function(ids){var s=this.F_CPTF_GetString(ids);return G_CPTF._hL32(ids, s);};G_CPTF.F_GetOptionalString=function(ids){var s=this.F_CPTF_GetOptionalString(ids);if(s){return G_CPTF._hL32(ids, s);}return null;};G_CPTF._hL32=function(ids,s){switch(this._hDB2){case "ids":return ids;case "prefixSuffix":return this._hJ32+s+this._hK32;case "percentageGrowth":return this._h58(s);case "unicodeRange":return this._hVH(s);}return s;};G_CPTF._h58=function(s){if(isNaN(this._hUH)){return;}if(this._hUH<0){return s.F_Truncate(s.length+Math.round(s.length*this._hUH), false);}var _h4Y1=Math.round((s.length*this._hUH)/ 2);s=s.F_PadLeft("x", s.length+_h4Y1);s=s.F_PadRight("x", s.length+_h4Y1);return s;};G_CPTF._hVH=function(s){var _hW71=this._hUL-this._h7F;var _hBZ1=s.length;s="";for(var i=0;i<_hBZ1;i++){s+= String.F_FromCharCode(this._h7F+Math.round((Math.random()*_hW71)));}return this._h58(s);};