var pas = {}; var rtl = { version: 10501, quiet: false, debug_load_units: false, debug_rtti: false, $res : {}, debug: function(){ if (rtl.quiet || !console || !console.log) return; console.log(arguments); }, error: function(s){ rtl.debug('Error: ',s); throw s; }, warn: function(s){ rtl.debug('Warn: ',s); }, checkVersion: function(v){ if (rtl.version != v) throw "expected rtl version "+v+", but found "+rtl.version; }, hiInt: Math.pow(2,53), hasString: function(s){ return rtl.isString(s) && (s.length>0); }, isArray: function(a) { return Array.isArray(a); }, isFunction: function(f){ return typeof(f)==="function"; }, isModule: function(m){ return rtl.isObject(m) && rtl.hasString(m.$name) && (pas[m.$name]===m); }, isImplementation: function(m){ return rtl.isObject(m) && rtl.isModule(m.$module) && (m.$module.$impl===m); }, isNumber: function(n){ return typeof(n)==="number"; }, isObject: function(o){ var s=typeof(o); return (typeof(o)==="object") && (o!=null); }, isString: function(s){ return typeof(s)==="string"; }, getNumber: function(n){ return typeof(n)==="number"?n:NaN; }, getChar: function(c){ return ((typeof(c)==="string") && (c.length===1)) ? c : ""; }, getObject: function(o){ return ((typeof(o)==="object") || (typeof(o)==='function')) ? o : null; }, isTRecord: function(type){ return (rtl.isObject(type) && type.hasOwnProperty('$new') && (typeof(type.$new)==='function')); }, isPasClass: function(type){ return (rtl.isObject(type) && type.hasOwnProperty('$classname') && rtl.isObject(type.$module)); }, isPasClassInstance: function(type){ return (rtl.isObject(type) && rtl.isPasClass(type.$class)); }, hexStr: function(n,digits){ return ("000000000000000"+n.toString(16).toUpperCase()).slice(-digits); }, m_loading: 0, m_loading_intf: 1, m_intf_loaded: 2, m_loading_impl: 3, // loading all used unit m_initializing: 4, // running initialization m_initialized: 5, module: function(module_name, intfuseslist, intfcode, impluseslist, implcode){ if (rtl.debug_load_units) rtl.debug('rtl.module name="'+module_name+'" intfuses='+intfuseslist+' impluses='+impluseslist+' hasimplcode='+rtl.isFunction(implcode)); if (!rtl.hasString(module_name)) rtl.error('invalid module name "'+module_name+'"'); if (!rtl.isArray(intfuseslist)) rtl.error('invalid interface useslist of "'+module_name+'"'); if (!rtl.isFunction(intfcode)) rtl.error('invalid interface code of "'+module_name+'"'); if (!(impluseslist==undefined) && !rtl.isArray(impluseslist)) rtl.error('invalid implementation useslist of "'+module_name+'"'); if (!(implcode==undefined) && !rtl.isFunction(implcode)) rtl.error('invalid implementation code of "'+module_name+'"'); if (pas[module_name]) rtl.error('module "'+module_name+'" is already registered'); var module = pas[module_name] = { $name: module_name, $intfuseslist: intfuseslist, $impluseslist: impluseslist, $state: rtl.m_loading, $intfcode: intfcode, $implcode: implcode, $impl: null, $rtti: Object.create(rtl.tSectionRTTI) }; module.$rtti.$module = module; if (implcode) module.$impl = { $module: module, $rtti: module.$rtti }; }, exitcode: 0, run: function(module_name){ try { if (!rtl.hasString(module_name)) module_name='program'; if (rtl.debug_load_units) rtl.debug('rtl.run module="'+module_name+'"'); rtl.initRTTI(); var module = pas[module_name]; if (!module) rtl.error('rtl.run module "'+module_name+'" missing'); rtl.loadintf(module); rtl.loadimpl(module); if (module_name=='program'){ if (rtl.debug_load_units) rtl.debug('running $main'); var r = pas.program.$main(); if (rtl.isNumber(r)) rtl.exitcode = r; } } catch(re) { if (!rtl.showUncaughtExceptions) { throw re } else { if (!rtl.handleUncaughtException(re)) { rtl.showException(re); rtl.exitcode = 216; } } } return rtl.exitcode; }, showException : function (re) { var errMsg = rtl.hasString(re.$classname) ? re.$classname : ''; errMsg += ((errMsg) ? ': ' : '') + (re.hasOwnProperty('fMessage') ? re.fMessage : re); alert('Uncaught Exception : '+errMsg); }, handleUncaughtException: function (e) { if (rtl.onUncaughtException) { try { rtl.onUncaughtException(e); return true; } catch (ee) { return false; } } else { return false; } }, loadintf: function(module){ if (module.$state>rtl.m_loading_intf) return; // already finished if (rtl.debug_load_units) rtl.debug('loadintf: "'+module.$name+'"'); if (module.$state===rtl.m_loading_intf) rtl.error('unit cycle detected "'+module.$name+'"'); module.$state=rtl.m_loading_intf; // load interfaces of interface useslist rtl.loaduseslist(module,module.$intfuseslist,rtl.loadintf); // run interface if (rtl.debug_load_units) rtl.debug('loadintf: run intf of "'+module.$name+'"'); module.$intfcode(module.$intfuseslist); // success module.$state=rtl.m_intf_loaded; // Note: units only used in implementations are not yet loaded (not even their interfaces) }, loaduseslist: function(module,useslist,f){ if (useslist==undefined) return; var len = useslist.length; for (var i = 0; i=rtl.m_loading_impl) return; // already processing if (module.$state0){ o = this[newinstancefnname](fn,args); } else if(isFunc) { o = new this.$func(args); } else { o = Object.create(c); } if (o.$init) o.$init(); try{ if (typeof(fn)==="string"){ this[fn].apply(o,args); } else { fn.apply(o,args); }; if (o.AfterConstruction) o.AfterConstruction(); } catch($e){ // do not call BeforeDestruction if (o.Destroy) o.Destroy(); if (o.$final) o.$final(); throw $e; } return o; }; c.$destroy = function(fnname){ if (this.BeforeDestruction) this.BeforeDestruction(); if (this[fnname]) this[fnname](); if (this.$final) this.$final(); }; rtl.initClass(c,parent,name,initfn); if (isFunc){ function f(){} f.prototype = c; c.$func = f; c.$ancestorfunc = ancestor; } }, createHelper: function(parent,name,ancestor,initfn){ // create a helper, // ancestor must be null or a helper, var c = null; if (ancestor != null){ c = Object.create(ancestor); c.$ancestor = ancestor; // c.$ancestor === Object.getPrototypeOf(c) } else { c = { $ancestor: null }; }; parent[name] = c; c.$class = c; // Note: o.$class === Object.getPrototypeOf(o) c.$classname = name; parent = rtl.initStruct(c,parent,name); c.$fullname = parent.$name+'.'+name; // rtti var t = c.$module.$rtti.$Helper(c.$name,{ "helper": c }); c.$rtti = t; if (rtl.isObject(ancestor)) t.ancestor = ancestor.$rtti; if (!t.ancestor) t.ancestor = null; // init members initfn.call(c); }, tObjectDestroy: "Destroy", free: function(obj,name){ if (obj[name]==null) return null; obj[name].$destroy(rtl.tObjectDestroy); obj[name]=null; }, freeLoc: function(obj){ if (obj==null) return null; obj.$destroy(rtl.tObjectDestroy); return null; }, hideProp: function(o,p,v){ Object.defineProperty(o,p, { enumerable: false, configurable: true, writable: true }); if(arguments.length>2){ o[p]=v; } }, recNewT: function(parent,name,initfn,full){ // create new record type var t = {}; if (parent) parent[name] = t; var h = rtl.hideProp; if (full){ rtl.initStruct(t,parent,name); t.$record = t; h(t,'$record'); h(t,'$name'); h(t,'$parent'); h(t,'$module'); } initfn.call(t); if (!t.$new){ t.$new = function(){ return Object.create(t); }; } t.$clone = function(r){ return t.$new().$assign(r); }; h(t,'$new'); h(t,'$clone'); h(t,'$eq'); h(t,'$assign'); return t; }, is: function(instance,type){ return type.isPrototypeOf(instance) || (instance===type); }, isExt: function(instance,type,mode){ // mode===1 means instance must be a Pascal class instance // mode===2 means instance must be a Pascal class // Notes: // isPrototypeOf and instanceof return false on equal // isPrototypeOf does not work for Date.isPrototypeOf(new Date()) // so if isPrototypeOf is false test with instanceof // instanceof needs a function on right side if (instance == null) return false; // Note: ==null checks for undefined too if ((typeof(type) !== 'object') && (typeof(type) !== 'function')) return false; if (instance === type){ if (mode===1) return false; if (mode===2) return rtl.isPasClass(instance); return true; } if (type.isPrototypeOf && type.isPrototypeOf(instance)){ if (mode===1) return rtl.isPasClassInstance(instance); if (mode===2) return rtl.isPasClass(instance); return true; } if ((typeof type == 'function') && (instance instanceof type)) return true; return false; }, Exception: null, EInvalidCast: null, EAbstractError: null, ERangeError: null, EIntOverflow: null, EPropWriteOnly: null, raiseE: function(typename){ var t = rtl[typename]; if (t==null){ var mod = pas.SysUtils; if (!mod) mod = pas.sysutils; if (mod){ t = mod[typename]; if (!t) t = mod[typename.toLowerCase()]; if (!t) t = mod['Exception']; if (!t) t = mod['exception']; } } if (t){ if (t.Create){ throw t.$create("Create"); } else if (t.create){ throw t.$create("create"); } } if (typename === "EInvalidCast") throw "invalid type cast"; if (typename === "EAbstractError") throw "Abstract method called"; if (typename === "ERangeError") throw "range error"; throw typename; }, as: function(instance,type){ if((instance === null) || rtl.is(instance,type)) return instance; rtl.raiseE("EInvalidCast"); }, asExt: function(instance,type,mode){ if((instance === null) || rtl.isExt(instance,type,mode)) return instance; rtl.raiseE("EInvalidCast"); }, createInterface: function(module, name, guid, fnnames, ancestor, initfn){ //console.log('createInterface name="'+name+'" guid="'+guid+'" names='+fnnames); var i = ancestor?Object.create(ancestor):{}; module[name] = i; i.$module = module; i.$name = name; i.$fullname = module.$name+'.'+name; i.$guid = guid; i.$guidr = null; i.$names = fnnames?fnnames:[]; if (rtl.isFunction(initfn)){ // rtti if (rtl.debug_rtti) rtl.debug('createInterface '+i.$fullname); var t = i.$module.$rtti.$Interface(name,{ "interface": i, module: module }); i.$rtti = t; if (ancestor) t.ancestor = ancestor.$rtti; if (!t.ancestor) t.ancestor = null; initfn.call(i); } return i; }, strToGUIDR: function(s,g){ var p = 0; function n(l){ var h = s.substr(p,l); p+=l; return parseInt(h,16); } p+=1; // skip { g.D1 = n(8); p+=1; // skip - g.D2 = n(4); p+=1; // skip - g.D3 = n(4); p+=1; // skip - if (!g.D4) g.D4=[]; g.D4[0] = n(2); g.D4[1] = n(2); p+=1; // skip - for(var i=2; i<8; i++) g.D4[i] = n(2); return g; }, guidrToStr: function(g){ if (g.$intf) return g.$intf.$guid; var h = rtl.hexStr; var s='{'+h(g.D1,8)+'-'+h(g.D2,4)+'-'+h(g.D3,4)+'-'+h(g.D4[0],2)+h(g.D4[1],2)+'-'; for (var i=2; i<8; i++) s+=h(g.D4[i],2); s+='}'; return s; }, createTGUID: function(guid){ var TGuid = (pas.System)?pas.System.TGuid:pas.system.tguid; var g = rtl.strToGUIDR(guid,TGuid.$new()); return g; }, getIntfGUIDR: function(intfTypeOrVar){ if (!intfTypeOrVar) return null; if (!intfTypeOrVar.$guidr){ var g = rtl.createTGUID(intfTypeOrVar.$guid); if (!intfTypeOrVar.hasOwnProperty('$guid')) intfTypeOrVar = Object.getPrototypeOf(intfTypeOrVar); g.$intf = intfTypeOrVar; intfTypeOrVar.$guidr = g; } return intfTypeOrVar.$guidr; }, addIntf: function (aclass, intf, map){ function jmp(fn){ if (typeof(fn)==="function"){ return function(){ return fn.apply(this.$o,arguments); }; } else { return function(){ rtl.raiseE('EAbstractError'); }; } } if(!map) map = {}; var t = intf; var item = Object.create(t); if (!aclass.hasOwnProperty('$intfmaps')) aclass.$intfmaps = {}; aclass.$intfmaps[intf.$guid] = item; do{ var names = t.$names; if (!names) break; for (var i=0; i=-0x1fffffffffffff) && (i<=0x1fffffffffffff)) return i; rtl.raiseE('EIntOverflow'); }, rc: function(i,minval,maxval){ // range check integer if ((Math.floor(i)===i) && (i>=minval) && (i<=maxval)) return i; rtl.raiseE('ERangeError'); }, rcc: function(c,minval,maxval){ // range check char if ((typeof(c)==='string') && (c.length===1)){ var i = c.charCodeAt(0); if ((i>=minval) && (i<=maxval)) return c; } rtl.raiseE('ERangeError'); }, rcSetCharAt: function(s,index,c){ // range check setCharAt if ((typeof(s)!=='string') || (index<0) || (index>=s.length)) rtl.raiseE('ERangeError'); return rtl.setCharAt(s,index,c); }, rcCharAt: function(s,index){ // range check charAt if ((typeof(s)!=='string') || (index<0) || (index>=s.length)) rtl.raiseE('ERangeError'); return s.charAt(index); }, rcArrR: function(arr,index){ // range check read array if (Array.isArray(arr) && (typeof(index)==='number') && (index>=0) && (index2){ // arr,index1,index2,... arr=arr[index]; for (var i=2; i=0) && (index0){ item=stack[depth-1]; src = (item.src && item.src.length>item.i)?item.src[item.i]:null; } if (!src){ a = []; srclen = 0; oldlen = 0; } else if (src.$pas2jsrefcnt>0 || depth>=s){ a = []; srclen = src.length; oldlen = srclen; } else { a = src; srclen = 0; oldlen = a.length; } lastlen = stack[depth].dim; a.length = lastlen; if (depth>0){ item.a[item.i]=a; item.i++; if ((lastlen===0) && (item.i0){ if (depthlastlen) srclen=lastlen; if (rtl.isArray(defaultvalue)){ // array of dyn array for (var i=0; i0) && (stack[depth-1].i>=stack[depth-1].dim)){ depth--; }; if (depth===0){ if (dimmax===0) return a; return stack[0].a; } }while (true); }, arrayEq: function(a,b){ if (a===null) return b===null; if (b===null) return false; if (a.length!==b.length) return false; for (var i=0; isrcarray.length) end = srcarray.length; if (index>=end) return []; if (type===0){ return srcarray.slice(index,end); } else { var a = []; a.length = end-index; rtl.arrayClone(type,srcarray,index,end,a,0); return a; } }, setCharAt: function(s,index,c){ return s.substr(0,index)+c+s.substr(index+1); }, getResStr: function(mod,name){ var rs = mod.$resourcestrings[name]; return rs.current?rs.current:rs.org; }, createSet: function(){ var s = {}; for (var i=0; i newlen){ return s.substring(0,newlen); } else if (s.repeat){ // Note: repeat needs ECMAScript6! return s+' '.repeat(newlen-oldlen); } else { while (oldlen=width) return s; if (s.repeat){ // Note: repeat needs ECMAScript6! return ' '.repeat(width-l) + s; } else { while (l2){ return rtl.spaceLeft(d.toFixed(p),w); } else { // exponent width var pad = ""; var ad = Math.abs(d); if (ad<1.0e+10) { pad='00'; } else if (ad<1.0e+100) { pad='0'; } if (arguments.length<2) { w=9; } else if (w<9) { w=9; } var p = w-8; var s=(d>0 ? " " : "" ) + d.toExponential(p); s=s.replace(/e(.)/,'E$1'+pad); return rtl.spaceLeft(s,w); } }, valEnum: function(s, enumType, setCodeFn){ s = s.toLowerCase(); for (var key in enumType){ if((typeof(key)==='string') && (key.toLowerCase()===s)){ setCodeFn(0); return enumType[key]; } } setCodeFn(1); return 0; }, lw: function(l){ // fix longword bitwise operation return l<0?l+0x100000000:l; }, and: function(a,b){ var hi = 0x80000000; var low = 0x7fffffff; var h = (a / hi) & (b / hi); var l = (a & low) & (b & low); return h*hi + l; }, or: function(a,b){ var hi = 0x80000000; var low = 0x7fffffff; var h = (a / hi) | (b / hi); var l = (a & low) | (b & low); return h*hi + l; }, xor: function(a,b){ var hi = 0x80000000; var low = 0x7fffffff; var h = (a / hi) ^ (b / hi); var l = (a & low) ^ (b & low); return h*hi + l; }, shr: function(a,b){ if (a<0) a += rtl.hiInt; if (a<0x80000000) return a >> b; if (b<=0) return a; if (b>54) return 0; return Math.floor(a / Math.pow(2,b)); }, shl: function(a,b){ if (a<0) a += rtl.hiInt; if (b<=0) return a; if (b>54) return 0; var r = a * Math.pow(2,b); if (r <= rtl.hiInt) return r; return r % rtl.hiInt; }, initRTTI: function(){ if (rtl.debug_rtti) rtl.debug('initRTTI'); // base types rtl.tTypeInfo = { name: "tTypeInfo" }; function newBaseTI(name,kind,ancestor){ if (!ancestor) ancestor = rtl.tTypeInfo; if (rtl.debug_rtti) rtl.debug('initRTTI.newBaseTI "'+name+'" '+kind+' ("'+ancestor.name+'")'); var t = Object.create(ancestor); t.name = name; t.kind = kind; rtl[name] = t; return t; }; function newBaseInt(name,minvalue,maxvalue,ordtype){ var t = newBaseTI(name,1 /* tkInteger */,rtl.tTypeInfoInteger); t.minvalue = minvalue; t.maxvalue = maxvalue; t.ordtype = ordtype; return t; }; newBaseTI("tTypeInfoInteger",1 /* tkInteger */); newBaseInt("shortint",-0x80,0x7f,0); newBaseInt("byte",0,0xff,1); newBaseInt("smallint",-0x8000,0x7fff,2); newBaseInt("word",0,0xffff,3); newBaseInt("longint",-0x80000000,0x7fffffff,4); newBaseInt("longword",0,0xffffffff,5); newBaseInt("nativeint",-0x10000000000000,0xfffffffffffff,6); newBaseInt("nativeuint",0,0xfffffffffffff,7); newBaseTI("char",2 /* tkChar */); newBaseTI("string",3 /* tkString */); newBaseTI("tTypeInfoEnum",4 /* tkEnumeration */,rtl.tTypeInfoInteger); newBaseTI("tTypeInfoSet",5 /* tkSet */); newBaseTI("double",6 /* tkDouble */); newBaseTI("boolean",7 /* tkBool */); newBaseTI("tTypeInfoProcVar",8 /* tkProcVar */); newBaseTI("tTypeInfoMethodVar",9 /* tkMethod */,rtl.tTypeInfoProcVar); newBaseTI("tTypeInfoArray",10 /* tkArray */); newBaseTI("tTypeInfoDynArray",11 /* tkDynArray */); newBaseTI("tTypeInfoPointer",15 /* tkPointer */); var t = newBaseTI("pointer",15 /* tkPointer */,rtl.tTypeInfoPointer); t.reftype = null; newBaseTI("jsvalue",16 /* tkJSValue */); newBaseTI("tTypeInfoRefToProcVar",17 /* tkRefToProcVar */,rtl.tTypeInfoProcVar); // member kinds rtl.tTypeMember = {}; function newMember(name,kind){ var m = Object.create(rtl.tTypeMember); m.name = name; m.kind = kind; rtl[name] = m; }; newMember("tTypeMemberField",1); // tmkField newMember("tTypeMemberMethod",2); // tmkMethod newMember("tTypeMemberProperty",3); // tmkProperty // base object for storing members: a simple object rtl.tTypeMembers = {}; // tTypeInfoStruct - base object for tTypeInfoClass, tTypeInfoRecord, tTypeInfoInterface var tis = newBaseTI("tTypeInfoStruct",0); tis.$addMember = function(name,ancestor,options){ if (rtl.debug_rtti){ if (!rtl.hasString(name) || (name.charAt()==='$')) throw 'invalid member "'+name+'", this="'+this.name+'"'; if (!rtl.is(ancestor,rtl.tTypeMember)) throw 'invalid ancestor "'+ancestor+':'+ancestor.name+'", "'+this.name+'.'+name+'"'; if ((options!=undefined) && (typeof(options)!='object')) throw 'invalid options "'+options+'", "'+this.name+'.'+name+'"'; }; var t = Object.create(ancestor); t.name = name; this.members[name] = t; this.names.push(name); if (rtl.isObject(options)){ for (var key in options) if (options.hasOwnProperty(key)) t[key] = options[key]; }; return t; }; tis.addField = function(name,type,options){ var t = this.$addMember(name,rtl.tTypeMemberField,options); if (rtl.debug_rtti){ if (!rtl.is(type,rtl.tTypeInfo)) throw 'invalid type "'+type+'", "'+this.name+'.'+name+'"'; }; t.typeinfo = type; this.fields.push(name); return t; }; tis.addFields = function(){ var i=0; while(i0) ? S.substring(Index-1,Index+Size-1) : ""; }; this.Copy$1 = function (S, Index) { if (Index<1) Index = 1; return S.substr(Index-1); }; this.Delete = function (S, Index, Size) { var h = ""; if ((Index < 1) || (Index > S.get().length) || (Size <= 0)) return; h = S.get(); S.set($mod.Copy(h,1,Index - 1) + $mod.Copy$1(h,Index + Size)); }; this.Pos = function (Search, InString) { return InString.indexOf(Search)+1; }; this.Insert = function (Insertion, Target, Index) { var t = ""; if (Insertion === "") return; t = Target.get(); if (Index < 1) { Target.set(Insertion + t)} else if (Index > t.length) { Target.set(t + Insertion)} else Target.set($mod.Copy(t,1,Index - 1) + Insertion + $mod.Copy(t,Index,t.length)); }; this.upcase = function (c) { return c.toUpperCase(); }; this.val = function (S, NI, Code) { NI.set($impl.valint(S,-9007199254740991,9007199254740991,Code)); }; this.StringOfChar = function (c, l) { var Result = ""; var i = 0; if ((l>0) && c.repeat) return c.repeat(l); Result = ""; for (var $l = 1, $end = l; $l <= $end; $l++) { i = $l; Result = Result + c; }; return Result; }; this.Writeln = function () { var i = 0; var l = 0; var s = ""; l = arguments.length - 1; if ($impl.WriteCallBack != null) { for (var $l = 0, $end = l; $l <= $end; $l++) { i = $l; $impl.WriteCallBack(arguments[i],i === l); }; } else { s = $impl.WriteBuf; for (var $l1 = 0, $end1 = l; $l1 <= $end1; $l1++) { i = $l1; s = s + ("" + arguments[i]); }; console.log(s); $impl.WriteBuf = ""; }; }; this.Assigned = function (V) { return (V!=undefined) && (V!=null) && (!rtl.isArray(V) || (V.length > 0)); }; $mod.$init = function () { rtl.exitcode = 0; }; },null,function () { "use strict"; var $mod = this; var $impl = $mod.$impl; $impl.WriteBuf = ""; $impl.WriteCallBack = null; $impl.valint = function (S, MinVal, MaxVal, Code) { var Result = 0; var x = 0.0; if (S === "") { Code.set(1); return Result; }; x = Number(S); if (isNaN(x)) { var $tmp = $mod.Copy(S,1,1); if ($tmp === "$") { x = Number("0x" + $mod.Copy$1(S,2))} else if ($tmp === "&") { x = Number("0o" + $mod.Copy$1(S,2))} else if ($tmp === "%") { x = Number("0b" + $mod.Copy$1(S,2))} else { Code.set(1); return Result; }; }; if (isNaN(x) || (x !== $mod.Int(x))) { Code.set(1)} else if ((x < MinVal) || (x > MaxVal)) { Code.set(2)} else { Result = $mod.Trunc(x); Code.set(0); }; return Result; }; }); rtl.module("Types",["System"],function () { "use strict"; var $mod = this; },[]); rtl.module("JS",["System","Types"],function () { "use strict"; var $mod = this; }); rtl.module("RTLConsts",["System"],function () { "use strict"; var $mod = this; $mod.$resourcestrings = {SArgumentMissing: {org: 'Missing argument in format "%s"'}, SInvalidFormat: {org: 'Invalid format specifier : "%s"'}, SInvalidArgIndex: {org: 'Invalid argument index in format: "%s"'}, SListCapacityError: {org: "List capacity (%s) exceeded."}, SListCountError: {org: "List count (%s) out of bounds."}, SListIndexError: {org: "List index (%s) out of bounds"}, SInvalidName: {org: 'Invalid component name: "%s"'}, SDuplicateName: {org: 'Duplicate component name: "%s"'}, SErrInvalidInteger: {org: 'Invalid integer value: "%s"'}}; }); rtl.module("SysUtils",["System","RTLConsts","JS"],function () { "use strict"; var $mod = this; var $impl = $mod.$impl; this.FreeAndNil = function (Obj) { var o = null; o = Obj.get(); if (o === null) return; Obj.set(null); o.$destroy("Destroy"); }; rtl.recNewT($mod,"TFormatSettings",function () { this.CurrencyDecimals = 0; this.CurrencyFormat = 0; this.CurrencyString = ""; this.DateSeparator = ""; this.DecimalSeparator = ""; this.LongDateFormat = ""; this.LongTimeFormat = ""; this.NegCurrFormat = 0; this.ShortDateFormat = ""; this.ShortTimeFormat = ""; this.ThousandSeparator = ""; this.TimeAMString = ""; this.TimePMString = ""; this.TimeSeparator = ""; this.TwoDigitYearCenturyWindow = 0; this.InitLocaleHandler = null; this.$new = function () { var r = Object.create(this); r.DateTimeToStrFormat = rtl.arraySetLength(null,"",2); r.LongDayNames = rtl.arraySetLength(null,"",7); r.LongMonthNames = rtl.arraySetLength(null,"",12); r.ShortDayNames = rtl.arraySetLength(null,"",7); r.ShortMonthNames = rtl.arraySetLength(null,"",12); return r; }; this.$eq = function (b) { return (this.CurrencyDecimals === b.CurrencyDecimals) && (this.CurrencyFormat === b.CurrencyFormat) && (this.CurrencyString === b.CurrencyString) && (this.DateSeparator === b.DateSeparator) && rtl.arrayEq(this.DateTimeToStrFormat,b.DateTimeToStrFormat) && (this.DecimalSeparator === b.DecimalSeparator) && (this.LongDateFormat === b.LongDateFormat) && rtl.arrayEq(this.LongDayNames,b.LongDayNames) && rtl.arrayEq(this.LongMonthNames,b.LongMonthNames) && (this.LongTimeFormat === b.LongTimeFormat) && (this.NegCurrFormat === b.NegCurrFormat) && (this.ShortDateFormat === b.ShortDateFormat) && rtl.arrayEq(this.ShortDayNames,b.ShortDayNames) && rtl.arrayEq(this.ShortMonthNames,b.ShortMonthNames) && (this.ShortTimeFormat === b.ShortTimeFormat) && (this.ThousandSeparator === b.ThousandSeparator) && (this.TimeAMString === b.TimeAMString) && (this.TimePMString === b.TimePMString) && (this.TimeSeparator === b.TimeSeparator) && (this.TwoDigitYearCenturyWindow === b.TwoDigitYearCenturyWindow); }; this.$assign = function (s) { this.CurrencyDecimals = s.CurrencyDecimals; this.CurrencyFormat = s.CurrencyFormat; this.CurrencyString = s.CurrencyString; this.DateSeparator = s.DateSeparator; this.DateTimeToStrFormat = s.DateTimeToStrFormat.slice(0); this.DecimalSeparator = s.DecimalSeparator; this.LongDateFormat = s.LongDateFormat; this.LongDayNames = s.LongDayNames.slice(0); this.LongMonthNames = s.LongMonthNames.slice(0); this.LongTimeFormat = s.LongTimeFormat; this.NegCurrFormat = s.NegCurrFormat; this.ShortDateFormat = s.ShortDateFormat; this.ShortDayNames = s.ShortDayNames.slice(0); this.ShortMonthNames = s.ShortMonthNames.slice(0); this.ShortTimeFormat = s.ShortTimeFormat; this.ThousandSeparator = s.ThousandSeparator; this.TimeAMString = s.TimeAMString; this.TimePMString = s.TimePMString; this.TimeSeparator = s.TimeSeparator; this.TwoDigitYearCenturyWindow = s.TwoDigitYearCenturyWindow; return this; }; this.GetJSLocale = function () { return Intl.DateTimeFormat().resolvedOptions().locale; }; this.Create = function () { var Result = $mod.TFormatSettings.$new(); Result.$assign($mod.TFormatSettings.Create$1($mod.TFormatSettings.GetJSLocale())); return Result; }; this.Create$1 = function (ALocale) { var Result = $mod.TFormatSettings.$new(); Result.LongDayNames = $impl.DefaultLongDayNames.slice(0); Result.ShortDayNames = $impl.DefaultShortDayNames.slice(0); Result.ShortMonthNames = $impl.DefaultShortMonthNames.slice(0); Result.LongMonthNames = $impl.DefaultLongMonthNames.slice(0); Result.DateTimeToStrFormat[0] = "c"; Result.DateTimeToStrFormat[1] = "f"; Result.DateSeparator = "-"; Result.TimeSeparator = ":"; Result.ShortDateFormat = "yyyy-mm-dd"; Result.LongDateFormat = "ddd, yyyy-mm-dd"; Result.ShortTimeFormat = "hh:nn"; Result.LongTimeFormat = "hh:nn:ss"; Result.DecimalSeparator = "."; Result.ThousandSeparator = ","; Result.TimeAMString = "AM"; Result.TimePMString = "PM"; Result.TwoDigitYearCenturyWindow = 50; Result.CurrencyFormat = 0; Result.NegCurrFormat = 0; Result.CurrencyDecimals = 2; Result.CurrencyString = "$"; if ($mod.TFormatSettings.InitLocaleHandler != null) $mod.TFormatSettings.InitLocaleHandler($mod.UpperCase(ALocale),$mod.TFormatSettings.$clone(Result)); return Result; }; },true); rtl.createClass($mod,"Exception",pas.System.TObject,function () { this.LogMessageOnCreate = false; this.$init = function () { pas.System.TObject.$init.call(this); this.fMessage = ""; this.FJSError = null; }; this.$final = function () { this.FJSError = undefined; pas.System.TObject.$final.call(this); }; this.Create$1 = function (Msg) { this.fMessage = Msg; this.FJSError = new Error(); if (this.LogMessageOnCreate) pas.System.Writeln("Created exception ",this.$classname," with message: ",Msg); return this; }; this.CreateFmt = function (Msg, Args) { this.Create$1($mod.Format(Msg,Args)); return this; }; }); rtl.createClass($mod,"EExternal",$mod.Exception,function () { }); rtl.createClass($mod,"EInvalidCast",$mod.Exception,function () { }); rtl.createClass($mod,"EConvertError",$mod.Exception,function () { }); rtl.createClass($mod,"EIntError",$mod.EExternal,function () { }); rtl.createClass($mod,"ERangeError",$mod.EIntError,function () { }); rtl.createClass($mod,"EExternalException",$mod.EExternal,function () { }); rtl.createClass($mod,"EAbstractError",$mod.Exception,function () { }); this.TrimLeft = function (S) { return S.replace(/^[\s\uFEFF\xA0\x00-\x1f]+/,''); }; this.UpperCase = function (s) { return s.toUpperCase(); }; this.LowerCase = function (s) { return s.toLowerCase(); }; this.CompareText = function (s1, s2) { var l1 = s1.toLowerCase(); var l2 = s2.toLowerCase(); if (l1>l2){ return 1; } else if (l1= "0")) ChPos += 1; if (ChPos > Len) $impl.DoFormatError(1,Fmt); if (Fmt.charAt(ChPos - 1) === "*") { if (Index === 255) { ArgN = ArgPos} else { ArgN = Index; Index += 1; }; if ((ChPos > OldPos) || (ArgN > (rtl.length(Args) - 1))) $impl.DoFormatError(1,Fmt); ArgPos = ArgN + 1; var $tmp = Args[ArgN].VType; if ($tmp === 0) { Value = Args[ArgN].VJSValue} else if ($tmp === 19) { Value = Args[ArgN].VJSValue} else { $impl.DoFormatError(1,Fmt); }; ChPos += 1; } else { if (OldPos < ChPos) { pas.System.val(pas.System.Copy(Fmt,OldPos,ChPos - OldPos),{get: function () { return Value; }, set: function (v) { Value = v; }},{get: function () { return Code; }, set: function (v) { Code = v; }}); if (Code > 0) $impl.DoFormatError(1,Fmt); } else Value = -1; }; }; function ReadIndex() { if (Fmt.charAt(ChPos - 1) !== ":") { ReadInteger()} else Value = 0; if (Fmt.charAt(ChPos - 1) === ":") { if (Value === -1) $impl.DoFormatError(2,Fmt); Index = Value; Value = -1; ChPos += 1; }; }; function ReadLeft() { if (Fmt.charAt(ChPos - 1) === "-") { Left = true; ChPos += 1; } else Left = false; }; function ReadWidth() { ReadInteger(); if (Value !== -1) { Width = Value; Value = -1; }; }; function ReadPrec() { if (Fmt.charAt(ChPos - 1) === ".") { ChPos += 1; ReadInteger(); if (Value === -1) Value = 0; Prec = Value; }; }; Index = 255; Width = -1; Prec = -1; Value = -1; ChPos += 1; if (Fmt.charAt(ChPos - 1) === "%") { Result = "%"; return Result; }; ReadIndex(); ReadLeft(); ReadWidth(); ReadPrec(); Result = pas.System.upcase(Fmt.charAt(ChPos - 1)); return Result; }; function Checkarg(AT, err) { var Result = false; Result = false; if (Index === 255) { DoArg = ArgPos} else DoArg = Index; ArgPos = DoArg + 1; if ((DoArg > (rtl.length(Args) - 1)) || (Args[DoArg].VType !== AT)) { if (err) $impl.DoFormatError(3,Fmt); ArgPos -= 1; return Result; }; Result = true; return Result; }; Result = ""; Len = Fmt.length; ChPos = 1; OldPos = 1; ArgPos = 0; while (ChPos <= Len) { while ((ChPos <= Len) && (Fmt.charAt(ChPos - 1) !== "%")) ChPos += 1; if (ChPos > OldPos) Result = Result + pas.System.Copy(Fmt,OldPos,ChPos - OldPos); if (ChPos < Len) { Fchar = ReadFormat(); var $tmp = Fchar; if ($tmp === "D") { if (Checkarg(0,false)) { ToAdd = $mod.IntToStr(Args[DoArg].VJSValue)} else if (Checkarg(19,true)) ToAdd = $mod.IntToStr(Args[DoArg].VJSValue); Width = Math.abs(Width); Index = Prec - ToAdd.length; if (ToAdd.charAt(0) !== "-") { ToAdd = pas.System.StringOfChar("0",Index) + ToAdd} else pas.System.Insert(pas.System.StringOfChar("0",Index + 1),{get: function () { return ToAdd; }, set: function (v) { ToAdd = v; }},2); } else if ($tmp === "U") { if (Checkarg(0,false)) { ToAdd = $mod.IntToStr(Args[DoArg].VJSValue >>> 0)} else if (Checkarg(19,true)) ToAdd = $mod.IntToStr(Args[DoArg].VJSValue); Width = Math.abs(Width); Index = Prec - ToAdd.length; ToAdd = pas.System.StringOfChar("0",Index) + ToAdd; } else if ($tmp === "E") { if (Checkarg(12,false)) { ToAdd = $mod.FloatToStrF$1(Args[DoArg].VJSValue / 10000,2,3,Prec,aSettings)} else if (Checkarg(3,true)) ToAdd = $mod.FloatToStrF$1(Args[DoArg].VJSValue,2,3,Prec,aSettings); } else if ($tmp === "F") { if (Checkarg(12,false)) { ToAdd = $mod.FloatToStrF$1(Args[DoArg].VJSValue / 10000,0,9999,Prec,aSettings)} else if (Checkarg(3,true)) ToAdd = $mod.FloatToStrF$1(Args[DoArg].VJSValue,0,9999,Prec,aSettings); } else if ($tmp === "G") { if (Checkarg(12,false)) { ToAdd = $mod.FloatToStrF$1(Args[DoArg].VJSValue / 10000,1,Prec,3,aSettings)} else if (Checkarg(3,true)) ToAdd = $mod.FloatToStrF$1(Args[DoArg].VJSValue,1,Prec,3,aSettings); } else if ($tmp === "N") { if (Checkarg(12,false)) { ToAdd = $mod.FloatToStrF$1(Args[DoArg].VJSValue / 10000,3,9999,Prec,aSettings)} else if (Checkarg(3,true)) ToAdd = $mod.FloatToStrF$1(Args[DoArg].VJSValue,3,9999,Prec,aSettings); } else if ($tmp === "M") { if (Checkarg(12,false)) { ToAdd = $mod.FloatToStrF$1(Args[DoArg].VJSValue / 10000,4,9999,Prec,aSettings)} else if (Checkarg(3,true)) ToAdd = $mod.FloatToStrF$1(Args[DoArg].VJSValue,4,9999,Prec,aSettings); } else if ($tmp === "S") { if (Checkarg(18,false)) { Hs = Args[DoArg].VJSValue} else if (Checkarg(9,true)) Hs = Args[DoArg].VJSValue; Index = Hs.length; if ((Prec !== -1) && (Index > Prec)) Index = Prec; ToAdd = pas.System.Copy(Hs,1,Index); } else if ($tmp === "P") { if (Checkarg(0,false)) { ToAdd = $mod.IntToHex(Args[DoArg].VJSValue,8)} else if (Checkarg(0,true)) ToAdd = $mod.IntToHex(Args[DoArg].VJSValue,16); } else if ($tmp === "X") { if (Checkarg(0,false)) { vq = Args[DoArg].VJSValue; Index = 16; } else if (Checkarg(19,true)) { vq = Args[DoArg].VJSValue; Index = 31; }; if (Prec > Index) { ToAdd = $mod.IntToHex(vq,Index)} else { Index = 1; while ((rtl.shl(1,Index * 4) <= vq) && (Index < 16)) Index += 1; if (Index > Prec) Prec = Index; ToAdd = $mod.IntToHex(vq,Prec); }; } else if ($tmp === "%") ToAdd = "%"; if (Width !== -1) if (ToAdd.length < Width) if (!Left) { ToAdd = pas.System.StringOfChar(" ",Width - ToAdd.length) + ToAdd} else ToAdd = ToAdd + pas.System.StringOfChar(" ",Width - ToAdd.length); Result = Result + ToAdd; }; ChPos += 1; OldPos = ChPos; }; return Result; }; var Alpha = rtl.createSet(null,65,90,null,97,122,95); var AlphaNum = rtl.unionSet(Alpha,rtl.createSet(null,48,57)); var Dot = "."; this.IsValidIdent = function (Ident, AllowDots, StrictDots) { var Result = false; var First = false; var I = 0; var Len = 0; Len = Ident.length; if (Len < 1) return false; First = true; Result = false; I = 1; while (I <= Len) { if (First) { if (!(Ident.charCodeAt(I - 1) in Alpha)) return Result; First = false; } else if (AllowDots && (Ident.charAt(I - 1) === Dot)) { if (StrictDots) { if (I >= Len) return Result; First = true; }; } else if (!(Ident.charCodeAt(I - 1) in AlphaNum)) return Result; I = I + 1; }; Result = true; return Result; }; this.TStringReplaceFlag = {"0": "rfReplaceAll", rfReplaceAll: 0, "1": "rfIgnoreCase", rfIgnoreCase: 1}; this.StringReplace = function (aOriginal, aSearch, aReplace, Flags) { var Result = ""; var REFlags = ""; var REString = ""; REFlags = ""; if (0 in Flags) REFlags = "g"; if (1 in Flags) REFlags = REFlags + "i"; REString = aSearch.replace(new RegExp($impl.RESpecials,"g"),"\\$1"); Result = aOriginal.replace(new RegExp(REString,REFlags),aReplace); return Result; }; this.IntToStr = function (Value) { var Result = ""; Result = "" + Value; return Result; }; this.TryStrToInt$2 = function (S, res) { var Result = false; Result = $impl.IntTryStrToInt(S,res,$mod.FormatSettings.DecimalSeparator); return Result; }; this.StrToInt = function (S) { var Result = 0; var R = 0; if (!$mod.TryStrToInt$2(S,{get: function () { return R; }, set: function (v) { R = v; }})) throw $mod.EConvertError.$create("CreateFmt",[rtl.getResStr(pas.RTLConsts,"SErrInvalidInteger"),pas.System.VarRecs(18,S)]); Result = R; return Result; }; this.IntToHex = function (Value, Digits) { var Result = ""; Result = ""; if (Value < 0) if (Value<0) Value = 0xFFFFFFFF + Value + 1; Result=Value.toString(16); Result = $mod.UpperCase(Result); while (Result.length < Digits) Result = "0" + Result; return Result; }; this.TFloatFormat = {"0": "ffFixed", ffFixed: 0, "1": "ffGeneral", ffGeneral: 1, "2": "ffExponent", ffExponent: 2, "3": "ffNumber", ffNumber: 3, "4": "ffCurrency", ffCurrency: 4}; this.FloatToStrF$1 = function (Value, format, Precision, Digits, aSettings) { var Result = ""; var TS = ""; var DS = ""; DS = aSettings.DecimalSeparator; TS = aSettings.ThousandSeparator; var $tmp = format; if ($tmp === 1) { Result = $impl.FormatGeneralFloat(Value,Precision,DS)} else if ($tmp === 2) { Result = $impl.FormatExponentFloat(Value,Precision,Digits,DS)} else if ($tmp === 0) { Result = $impl.FormatFixedFloat(Value,Digits,DS)} else if ($tmp === 3) { Result = $impl.FormatNumberFloat(Value,Digits,DS,TS)} else if ($tmp === 4) Result = $impl.FormatNumberCurrency(Value * 10000,Digits,aSettings); if ((format !== 4) && (Result.length > 1) && (Result.charAt(0) === "-")) $impl.RemoveLeadingNegativeSign({get: function () { return Result; }, set: function (v) { Result = v; }},DS,TS); return Result; }; this.OnGetEnvironmentVariable = null; this.OnGetEnvironmentString = null; this.OnGetEnvironmentVariableCount = null; this.TimeSeparator = ""; this.DateSeparator = ""; this.ShortDateFormat = ""; this.LongDateFormat = ""; this.ShortTimeFormat = ""; this.LongTimeFormat = ""; this.DecimalSeparator = ""; this.ThousandSeparator = ""; this.TimeAMString = ""; this.TimePMString = ""; this.ShortMonthNames = rtl.arraySetLength(null,"",12); this.LongMonthNames = rtl.arraySetLength(null,"",12); this.ShortDayNames = rtl.arraySetLength(null,"",7); this.LongDayNames = rtl.arraySetLength(null,"",7); this.FormatSettings = $mod.TFormatSettings.$new(); this.CurrencyFormat = 0; this.NegCurrFormat = 0; this.CurrencyDecimals = 0; this.CurrencyString = ""; this.TStringSplitOptions = {"0": "None", None: 0, "1": "ExcludeEmpty", ExcludeEmpty: 1}; rtl.createHelper($mod,"TStringHelper",null,function () { this.GetLength = function () { var Result = 0; Result = this.get().length; return Result; }; this.IndexOf$1 = function (AValue) { var Result = 0; Result = $mod.TStringHelper.IndexOf$5.call(this,AValue,0,$mod.TStringHelper.GetLength.call(this)); return Result; }; this.IndexOf$5 = function (AValue, StartIndex, ACount) { var Result = 0; var S = ""; S = pas.System.Copy(this.get(),StartIndex + 1,ACount); Result = pas.System.Pos(AValue,S) - 1; if (Result !== -1) Result = Result + StartIndex; return Result; }; this.IndexOfAny$3 = function (AnyOf, StartIndex) { var Result = 0; Result = $mod.TStringHelper.IndexOfAny$5.call(this,AnyOf,StartIndex,$mod.TStringHelper.GetLength.call(this)); return Result; }; this.IndexOfAny$5 = function (AnyOf, StartIndex, ACount) { var Result = 0; var i = 0; var L = 0; i = StartIndex + 1; L = (i + ACount) - 1; if (L > $mod.TStringHelper.GetLength.call(this)) L = $mod.TStringHelper.GetLength.call(this); Result = -1; while ((Result === -1) && (i <= L)) { if ($impl.HaveChar(this.get().charAt(i - 1),AnyOf)) Result = i - 1; i += 1; }; return Result; }; this.IndexOfAnyUnquoted$1 = function (AnyOf, StartQuote, EndQuote, StartIndex) { var Result = 0; Result = $mod.TStringHelper.IndexOfAnyUnquoted$2.call(this,AnyOf,StartQuote,EndQuote,StartIndex,$mod.TStringHelper.GetLength.call(this)); return Result; }; this.IndexOfAnyUnquoted$2 = function (AnyOf, StartQuote, EndQuote, StartIndex, ACount) { var Result = 0; var I = 0; var L = 0; var Q = 0; Result = -1; L = (StartIndex + ACount) - 1; if (L > $mod.TStringHelper.GetLength.call(this)) L = $mod.TStringHelper.GetLength.call(this); I = StartIndex + 1; Q = 0; if (StartQuote === EndQuote) { while ((Result === -1) && (I <= L)) { if (this.get().charAt(I - 1) === StartQuote) Q = 1 - Q; if ((Q === 0) && $impl.HaveChar(this.get().charAt(I - 1),AnyOf)) Result = I - 1; I += 1; }; } else { while ((Result === -1) && (I <= L)) { if (this.get().charAt(I - 1) === StartQuote) { Q += 1} else if ((this.get().charAt(I - 1) === EndQuote) && (Q > 0)) Q -= 1; if ((Q === 0) && $impl.HaveChar(this.get().charAt(I - 1),AnyOf)) Result = I - 1; I += 1; }; }; return Result; }; this.Replace$2 = function (OldValue, NewValue) { var Result = ""; Result = $mod.TStringHelper.Replace$3.call(this,OldValue,NewValue,rtl.createSet(0)); return Result; }; this.Replace$3 = function (OldValue, NewValue, ReplaceFlags) { var Result = ""; Result = $mod.StringReplace(this.get(),OldValue,NewValue,rtl.refSet(ReplaceFlags)); return Result; }; this.Split = function (Separators) { var Result = []; Result = $mod.TStringHelper.Split$1.call(this,$mod.TStringHelper.ToCharArray$1.call({get: function () { return Separators; }, set: function (v) { rtl.raiseE("EPropReadOnly"); }})); return Result; }; this.Split$1 = function (Separators) { var Result = []; Result = $mod.TStringHelper.Split$21.call(this,Separators,"\x00","\x00",$mod.TStringHelper.GetLength.call(this) + 1,0); return Result; }; var BlockSize = 10; this.Split$21 = function (Separators, AQuoteStart, AQuoteEnd, ACount, Options) { var $Self = this; var Result = []; var S = ""; function NextSep(StartIndex) { var Result = 0; if (AQuoteStart !== "\x00") { Result = $mod.TStringHelper.IndexOfAnyUnquoted$1.call({get: function () { return S; }, set: function (v) { S = v; }},Separators,AQuoteStart,AQuoteEnd,StartIndex)} else Result = $mod.TStringHelper.IndexOfAny$3.call({get: function () { return S; }, set: function (v) { S = v; }},Separators,StartIndex); return Result; }; function MaybeGrow(Curlen) { if (rtl.length(Result) <= Curlen) Result = rtl.arraySetLength(Result,"",rtl.length(Result) + 10); }; var Sep = 0; var LastSep = 0; var Len = 0; var T = ""; S = $Self.get(); Result = rtl.arraySetLength(Result,"",10); Len = 0; LastSep = 0; Sep = NextSep(0); while ((Sep !== -1) && ((ACount === 0) || (Len < ACount))) { T = $mod.TStringHelper.Substring$1.call($Self,LastSep,Sep - LastSep); if ((T !== "") || !(1 === Options)) { MaybeGrow(Len); Result[Len] = T; Len += 1; }; LastSep = Sep + 1; Sep = NextSep(LastSep); }; if ((LastSep <= $mod.TStringHelper.GetLength.call($Self)) && ((ACount === 0) || (Len < ACount))) { T = $mod.TStringHelper.Substring.call($Self,LastSep); if ((T !== "") || !(1 === Options)) { MaybeGrow(Len); Result[Len] = T; Len += 1; }; }; Result = rtl.arraySetLength(Result,"",Len); return Result; }; this.Substring = function (AStartIndex) { var Result = ""; Result = $mod.TStringHelper.Substring$1.call(this,AStartIndex,$mod.TStringHelper.GetLength.call(this) - AStartIndex); return Result; }; this.Substring$1 = function (AStartIndex, ALen) { var Result = ""; Result = pas.System.Copy(this.get(),AStartIndex + 1,ALen); return Result; }; this.ToCharArray$1 = function () { var Result = []; Result = $mod.TStringHelper.ToCharArray$2.call(this,0,$mod.TStringHelper.GetLength.call(this)); return Result; }; this.ToCharArray$2 = function (AStartIndex, ALen) { var Result = []; var I = 0; Result = rtl.arraySetLength(Result,"",ALen); for (var $l = 0, $end = ALen - 1; $l <= $end; $l++) { I = $l; Result[I] = this.get().charAt((AStartIndex + I + 1) - 1); }; return Result; }; }); $mod.$init = function () { (function () { $impl.InitGlobalFormatSettings(); })(); $impl.DoClassRef($mod.EInvalidCast); $impl.DoClassRef($mod.EAbstractError); $impl.DoClassRef($mod.ERangeError); $mod.ShortMonthNames = $impl.DefaultShortMonthNames.slice(0); $mod.LongMonthNames = $impl.DefaultLongMonthNames.slice(0); $mod.ShortDayNames = $impl.DefaultShortDayNames.slice(0); $mod.LongDayNames = $impl.DefaultLongDayNames.slice(0); }; },null,function () { "use strict"; var $mod = this; var $impl = $mod.$impl; $impl.DefaultShortMonthNames = ["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"]; $impl.DefaultLongMonthNames = ["January","February","March","April","May","June","July","August","September","October","November","December"]; $impl.DefaultShortDayNames = ["Sun","Mon","Tue","Wed","Thu","Fri","Sat"]; $impl.DefaultLongDayNames = ["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"]; $impl.feInvalidFormat = 1; $impl.feMissingArgument = 2; $impl.feInvalidArgIndex = 3; $impl.DoFormatError = function (ErrCode, fmt) { var $tmp = ErrCode; if ($tmp === 1) { throw $mod.EConvertError.$create("CreateFmt",[rtl.getResStr(pas.RTLConsts,"SInvalidFormat"),pas.System.VarRecs(18,fmt)])} else if ($tmp === 2) { throw $mod.EConvertError.$create("CreateFmt",[rtl.getResStr(pas.RTLConsts,"SArgumentMissing"),pas.System.VarRecs(18,fmt)])} else if ($tmp === 3) throw $mod.EConvertError.$create("CreateFmt",[rtl.getResStr(pas.RTLConsts,"SInvalidArgIndex"),pas.System.VarRecs(18,fmt)]); }; $impl.maxdigits = 15; $impl.ReplaceDecimalSep = function (S, DS) { var Result = ""; var P = 0; P = pas.System.Pos(".",S); if (P > 0) { Result = pas.System.Copy(S,1,P - 1) + DS + pas.System.Copy(S,P + 1,S.length - P)} else Result = S; return Result; }; $impl.FormatGeneralFloat = function (Value, Precision, DS) { var Result = ""; var P = 0; var PE = 0; var Q = 0; var Exponent = 0; if ((Precision === -1) || (Precision > 15)) Precision = 15; Result = rtl.floatToStr(Value,Precision + 7); Result = $mod.TrimLeft(Result); P = pas.System.Pos(".",Result); if (P === 0) return Result; PE = pas.System.Pos("E",Result); if (PE === 0) { Result = $impl.ReplaceDecimalSep(Result,DS); return Result; }; Q = PE + 2; Exponent = 0; while (Q <= Result.length) { Exponent = ((Exponent * 10) + Result.charCodeAt(Q - 1)) - 48; Q += 1; }; if (Result.charAt((PE + 1) - 1) === "-") Exponent = -Exponent; if (((P + Exponent) < PE) && (Exponent > -6)) { Result = rtl.strSetLength(Result,PE - 1); if (Exponent >= 0) { for (var $l = 0, $end = Exponent - 1; $l <= $end; $l++) { Q = $l; Result = rtl.setCharAt(Result,P - 1,Result.charAt((P + 1) - 1)); P += 1; }; Result = rtl.setCharAt(Result,P - 1,"."); P = 1; if (Result.charAt(P - 1) === "-") P += 1; while ((Result.charAt(P - 1) === "0") && (P < Result.length) && (pas.System.Copy(Result,P + 1,DS.length) !== DS)) pas.System.Delete({get: function () { return Result; }, set: function (v) { Result = v; }},P,1); } else { pas.System.Insert(pas.System.Copy("00000",1,-Exponent),{get: function () { return Result; }, set: function (v) { Result = v; }},P - 1); Result = rtl.setCharAt(Result,P - Exponent - 1,Result.charAt(P - Exponent - 1 - 1)); Result = rtl.setCharAt(Result,P - 1,"."); if (Exponent !== -1) Result = rtl.setCharAt(Result,P - Exponent - 1 - 1,"0"); }; Q = Result.length; while ((Q > 0) && (Result.charAt(Q - 1) === "0")) Q -= 1; if (Result.charAt(Q - 1) === ".") Q -= 1; if ((Q === 0) || ((Q === 1) && (Result.charAt(0) === "-"))) { Result = "0"} else Result = rtl.strSetLength(Result,Q); } else { while (Result.charAt(PE - 1 - 1) === "0") { pas.System.Delete({get: function () { return Result; }, set: function (v) { Result = v; }},PE - 1,1); PE -= 1; }; if (Result.charAt(PE - 1 - 1) === DS) { pas.System.Delete({get: function () { return Result; }, set: function (v) { Result = v; }},PE - 1,1); PE -= 1; }; if (Result.charAt((PE + 1) - 1) === "+") { pas.System.Delete({get: function () { return Result; }, set: function (v) { Result = v; }},PE + 1,1)} else PE += 1; while (Result.charAt((PE + 1) - 1) === "0") pas.System.Delete({get: function () { return Result; }, set: function (v) { Result = v; }},PE + 1,1); }; Result = $impl.ReplaceDecimalSep(Result,DS); return Result; }; $impl.FormatExponentFloat = function (Value, Precision, Digits, DS) { var Result = ""; var P = 0; DS = $mod.FormatSettings.DecimalSeparator; if ((Precision === -1) || (Precision > 15)) Precision = 15; Result = rtl.floatToStr(Value,Precision + 7); while (Result.charAt(0) === " ") pas.System.Delete({get: function () { return Result; }, set: function (v) { Result = v; }},1,1); P = pas.System.Pos("E",Result); if (P === 0) { Result = $impl.ReplaceDecimalSep(Result,DS); return Result; }; P += 2; if (Digits > 4) Digits = 4; Digits = (Result.length - P - Digits) + 1; if (Digits < 0) { pas.System.Insert(pas.System.Copy("0000",1,-Digits),{get: function () { return Result; }, set: function (v) { Result = v; }},P)} else while ((Digits > 0) && (Result.charAt(P - 1) === "0")) { pas.System.Delete({get: function () { return Result; }, set: function (v) { Result = v; }},P,1); if (P > Result.length) { pas.System.Delete({get: function () { return Result; }, set: function (v) { Result = v; }},P - 2,2); break; }; Digits -= 1; }; Result = $impl.ReplaceDecimalSep(Result,DS); return Result; }; $impl.FormatFixedFloat = function (Value, Digits, DS) { var Result = ""; if (Digits === -1) { Digits = 2} else if (Digits > 18) Digits = 18; Result = rtl.floatToStr(Value,0,Digits); if ((Result !== "") && (Result.charAt(0) === " ")) pas.System.Delete({get: function () { return Result; }, set: function (v) { Result = v; }},1,1); Result = $impl.ReplaceDecimalSep(Result,DS); return Result; }; $impl.FormatNumberFloat = function (Value, Digits, DS, TS) { var Result = ""; var P = 0; if (Digits === -1) { Digits = 2} else if (Digits > 15) Digits = 15; Result = rtl.floatToStr(Value,0,Digits); if ((Result !== "") && (Result.charAt(0) === " ")) pas.System.Delete({get: function () { return Result; }, set: function (v) { Result = v; }},1,1); P = pas.System.Pos(".",Result); if (P <= 0) P = Result.length + 1; Result = $impl.ReplaceDecimalSep(Result,DS); P -= 3; if ((TS !== "") && (TS !== "\x00")) while (P > 1) { if (Result.charAt(P - 1 - 1) !== "-") pas.System.Insert(TS,{get: function () { return Result; }, set: function (v) { Result = v; }},P); P -= 3; }; return Result; }; $impl.RemoveLeadingNegativeSign = function (AValue, DS, aThousandSeparator) { var Result = false; var i = 0; var TS = ""; var StartPos = 0; Result = false; StartPos = 2; TS = aThousandSeparator; for (var $l = StartPos, $end = AValue.get().length; $l <= $end; $l++) { i = $l; Result = (AValue.get().charCodeAt(i - 1) in rtl.createSet(48,DS.charCodeAt(),69,43)) || (AValue.get().charAt(i - 1) === TS); if (!Result) break; }; if (Result && (AValue.get().charAt(0) === "-")) pas.System.Delete(AValue,1,1); return Result; }; $impl.FormatNumberCurrency = function (Value, Digits, aSettings) { var Result = ""; var Negative = false; var P = 0; var CS = ""; var DS = ""; var TS = ""; DS = aSettings.DecimalSeparator; TS = aSettings.ThousandSeparator; CS = aSettings.CurrencyString; if (Digits === -1) { Digits = aSettings.CurrencyDecimals} else if (Digits > 18) Digits = 18; Result = rtl.floatToStr(Value / 10000,0,Digits); Negative = Result.charAt(0) === "-"; if (Negative) pas.System.Delete({get: function () { return Result; }, set: function (v) { Result = v; }},1,1); P = pas.System.Pos(".",Result); if (TS !== "") { if (P !== 0) { Result = $impl.ReplaceDecimalSep(Result,DS)} else P = Result.length + 1; P -= 3; while (P > 1) { pas.System.Insert(TS,{get: function () { return Result; }, set: function (v) { Result = v; }},P); P -= 3; }; }; if (Negative) $impl.RemoveLeadingNegativeSign({get: function () { return Result; }, set: function (v) { Result = v; }},DS,TS); if (!Negative) { var $tmp = aSettings.CurrencyFormat; if ($tmp === 0) { Result = CS + Result} else if ($tmp === 1) { Result = Result + CS} else if ($tmp === 2) { Result = CS + " " + Result} else if ($tmp === 3) Result = Result + " " + CS; } else { var $tmp1 = aSettings.NegCurrFormat; if ($tmp1 === 0) { Result = "(" + CS + Result + ")"} else if ($tmp1 === 1) { Result = "-" + CS + Result} else if ($tmp1 === 2) { Result = CS + "-" + Result} else if ($tmp1 === 3) { Result = CS + Result + "-"} else if ($tmp1 === 4) { Result = "(" + Result + CS + ")"} else if ($tmp1 === 5) { Result = "-" + Result + CS} else if ($tmp1 === 6) { Result = Result + "-" + CS} else if ($tmp1 === 7) { Result = Result + CS + "-"} else if ($tmp1 === 8) { Result = "-" + Result + " " + CS} else if ($tmp1 === 9) { Result = "-" + CS + " " + Result} else if ($tmp1 === 10) { Result = Result + " " + CS + "-"} else if ($tmp1 === 11) { Result = CS + " " + Result + "-"} else if ($tmp1 === 12) { Result = CS + " " + "-" + Result} else if ($tmp1 === 13) { Result = Result + "-" + " " + CS} else if ($tmp1 === 14) { Result = "(" + CS + " " + Result + ")"} else if ($tmp1 === 15) Result = "(" + Result + " " + CS + ")"; }; return Result; }; $impl.RESpecials = "([\\$\\+\\[\\]\\(\\)\\\\\\.\\*\\^\\?\\|])"; $impl.IntTryStrToInt = function (S, res, aSep) { var Result = false; var Radix = 10; var N = ""; var J = undefined; N = S; if ((pas.System.Pos(aSep,N) !== 0) || (pas.System.Pos(".",N) !== 0)) return false; var $tmp = pas.System.Copy(N,1,1); if ($tmp === "$") { Radix = 16} else if ($tmp === "&") { Radix = 8} else if ($tmp === "%") Radix = 2; if ((Radix !== 16) && (pas.System.Pos("e",$mod.LowerCase(N)) !== 0)) return false; if (Radix !== 10) pas.System.Delete({get: function () { return N; }, set: function (v) { N = v; }},1,1); J = parseInt(N,Radix); Result = !isNaN(J); if (Result) res.set(Math.floor(J)); return Result; }; $impl.InitGlobalFormatSettings = function () { $mod.FormatSettings.$assign($mod.TFormatSettings.Create()); $mod.TimeSeparator = $mod.FormatSettings.TimeSeparator; $mod.DateSeparator = $mod.FormatSettings.DateSeparator; $mod.ShortDateFormat = $mod.FormatSettings.ShortDateFormat; $mod.LongDateFormat = $mod.FormatSettings.LongDateFormat; $mod.ShortTimeFormat = $mod.FormatSettings.ShortTimeFormat; $mod.LongTimeFormat = $mod.FormatSettings.LongTimeFormat; $mod.DecimalSeparator = $mod.FormatSettings.DecimalSeparator; $mod.ThousandSeparator = $mod.FormatSettings.ThousandSeparator; $mod.TimeAMString = $mod.FormatSettings.TimeAMString; $mod.TimePMString = $mod.FormatSettings.TimePMString; $mod.CurrencyFormat = $mod.FormatSettings.CurrencyFormat; $mod.NegCurrFormat = $mod.FormatSettings.NegCurrFormat; $mod.CurrencyDecimals = $mod.FormatSettings.CurrencyDecimals; $mod.CurrencyString = $mod.FormatSettings.CurrencyString; }; $impl.HaveChar = function (AChar, AList) { var Result = false; var I = 0; I = 0; Result = false; while (!Result && (I < rtl.length(AList))) { Result = AList[I] === AChar; I += 1; }; return Result; }; $impl.DoClassRef = function (C) { if (C === null) ; }; }); rtl.module("Classes",["System","RTLConsts","Types","SysUtils","JS"],function () { "use strict"; var $mod = this; var $impl = $mod.$impl; rtl.createClass($mod,"EListError",pas.SysUtils.Exception,function () { }); rtl.createClass($mod,"EComponentError",pas.SysUtils.Exception,function () { }); rtl.createClass($mod,"TFPList",pas.System.TObject,function () { this.$init = function () { pas.System.TObject.$init.call(this); this.FList = []; this.FCount = 0; this.FCapacity = 0; }; this.$final = function () { this.FList = undefined; pas.System.TObject.$final.call(this); }; this.Get = function (Index) { var Result = undefined; if ((Index < 0) || (Index >= this.FCount)) this.RaiseIndexError(Index); Result = this.FList[Index]; return Result; }; this.SetCapacity = function (NewCapacity) { if (NewCapacity < this.FCount) this.$class.Error(rtl.getResStr(pas.RTLConsts,"SListCapacityError"),"" + NewCapacity); if (NewCapacity === this.FCapacity) return; this.FList = rtl.arraySetLength(this.FList,undefined,NewCapacity); this.FCapacity = NewCapacity; }; this.SetCount = function (NewCount) { if (NewCount < 0) this.$class.Error(rtl.getResStr(pas.RTLConsts,"SListCountError"),"" + NewCount); if (NewCount > this.FCount) { if (NewCount > this.FCapacity) this.SetCapacity(NewCount); }; this.FCount = NewCount; }; this.RaiseIndexError = function (Index) { this.$class.Error(rtl.getResStr(pas.RTLConsts,"SListIndexError"),"" + Index); }; this.Destroy = function () { this.Clear(); pas.System.TObject.Destroy.call(this); }; this.Add = function (Item) { var Result = 0; if (this.FCount === this.FCapacity) this.Expand(); this.FList[this.FCount] = Item; Result = this.FCount; this.FCount += 1; return Result; }; this.Clear = function () { if (rtl.length(this.FList) > 0) { this.SetCount(0); this.SetCapacity(0); }; }; this.Delete = function (Index) { if ((Index < 0) || (Index >= this.FCount)) this.$class.Error(rtl.getResStr(pas.RTLConsts,"SListIndexError"),"" + Index); this.FCount = this.FCount - 1; this.FList.splice(Index,1); this.FCapacity -= 1; }; this.Error = function (Msg, Data) { throw $mod.EListError.$create("CreateFmt",[Msg,pas.System.VarRecs(18,Data)]); }; this.Expand = function () { var Result = null; var IncSize = 0; if (this.FCount < this.FCapacity) return this; IncSize = 4; if (this.FCapacity > 3) IncSize = IncSize + 4; if (this.FCapacity > 8) IncSize = IncSize + 8; if (this.FCapacity > 127) IncSize += this.FCapacity >>> 2; this.SetCapacity(this.FCapacity + IncSize); Result = this; return Result; }; this.IndexOf = function (Item) { var Result = 0; var C = 0; Result = 0; C = this.FCount; while ((Result < C) && (this.FList[Result] != Item)) Result += 1; if (Result >= C) Result = -1; return Result; }; this.Last = function () { var Result = undefined; if (this.FCount === 0) { Result = null} else Result = this.Get(this.FCount - 1); return Result; }; this.Remove = function (Item) { var Result = 0; Result = this.IndexOf(Item); if (Result !== -1) this.Delete(Result); return Result; }; }); rtl.createClass($mod,"TPersistent",pas.System.TObject,function () { }); this.TOperation = {"0": "opInsert", opInsert: 0, "1": "opRemove", opRemove: 1}; this.TComponentStateItem = {"0": "csLoading", csLoading: 0, "1": "csReading", csReading: 1, "2": "csWriting", csWriting: 2, "3": "csDestroying", csDestroying: 3, "4": "csDesigning", csDesigning: 4, "5": "csAncestor", csAncestor: 5, "6": "csUpdating", csUpdating: 6, "7": "csFixups", csFixups: 7, "8": "csFreeNotification", csFreeNotification: 8, "9": "csInline", csInline: 9, "10": "csDesignInstance", csDesignInstance: 10}; this.TComponentStyleItem = {"0": "csInheritable", csInheritable: 0, "1": "csCheckPropAvail", csCheckPropAvail: 1, "2": "csSubComponent", csSubComponent: 2, "3": "csTransient", csTransient: 3}; rtl.createClass($mod,"TComponent",$mod.TPersistent,function () { this.$init = function () { $mod.TPersistent.$init.call(this); this.FOwner = null; this.FName = ""; this.FTag = 0; this.FComponents = null; this.FFreeNotifies = null; this.FComponentState = {}; this.FComponentStyle = {}; }; this.$final = function () { this.FOwner = undefined; this.FComponents = undefined; this.FFreeNotifies = undefined; this.FComponentState = undefined; this.FComponentStyle = undefined; $mod.TPersistent.$final.call(this); }; this.Insert = function (AComponent) { if (!(this.FComponents != null)) this.FComponents = $mod.TFPList.$create("Create"); this.FComponents.Add(AComponent); AComponent.FOwner = this; }; this.Remove = function (AComponent) { AComponent.FOwner = null; if (this.FComponents != null) { this.FComponents.Remove(AComponent); if (this.FComponents.FCount === 0) { this.FComponents.$destroy("Destroy"); this.FComponents = null; }; }; }; this.RemoveNotification = function (AComponent) { if (this.FFreeNotifies !== null) { this.FFreeNotifies.Remove(AComponent); if (this.FFreeNotifies.FCount === 0) { this.FFreeNotifies.$destroy("Destroy"); this.FFreeNotifies = null; this.FComponentState = rtl.excludeSet(this.FComponentState,8); }; }; }; this.SetReference = function (Enable) { var aField = null; var aValue = null; var aOwner = null; if (this.FName === "") return; if (this.FOwner != null) { aOwner = this.FOwner; aField = this.FOwner.$class.FieldAddress(this.FName); if (aField != null) { if (Enable) { aValue = this} else aValue = null; aOwner["" + aField["name"]] = aValue; }; }; }; this.ChangeName = function (NewName) { this.FName = NewName; }; this.Notification = function (AComponent, Operation) { var C = 0; if (Operation === 1) this.RemoveFreeNotification(AComponent); if (!(this.FComponents != null)) return; C = this.FComponents.FCount - 1; while (C >= 0) { rtl.getObject(this.FComponents.Get(C)).Notification(AComponent,Operation); C -= 1; if (C >= this.FComponents.FCount) C = this.FComponents.FCount - 1; }; }; this.SetDesigning = function (Value, SetChildren) { var Runner = 0; if (Value) { this.FComponentState = rtl.includeSet(this.FComponentState,4)} else this.FComponentState = rtl.excludeSet(this.FComponentState,4); if ((this.FComponents != null) && SetChildren) for (var $l = 0, $end = this.FComponents.FCount - 1; $l <= $end; $l++) { Runner = $l; rtl.getObject(this.FComponents.Get(Runner)).SetDesigning(Value,true); }; }; this.SetName = function (NewName) { if (this.FName === NewName) return; if ((NewName !== "") && !pas.SysUtils.IsValidIdent(NewName,false,false)) throw $mod.EComponentError.$create("CreateFmt",[rtl.getResStr(pas.RTLConsts,"SInvalidName"),pas.System.VarRecs(18,NewName)]); if (this.FOwner != null) { this.FOwner.ValidateRename(this,this.FName,NewName)} else this.ValidateRename(null,this.FName,NewName); this.SetReference(false); this.ChangeName(NewName); this.SetReference(true); }; this.ValidateRename = function (AComponent, CurName, NewName) { if ((AComponent !== null) && (pas.SysUtils.CompareText(CurName,NewName) !== 0) && (AComponent.FOwner === this) && (this.FindComponent(NewName) !== null)) throw $mod.EComponentError.$create("CreateFmt",[rtl.getResStr(pas.RTLConsts,"SDuplicateName"),pas.System.VarRecs(18,NewName)]); if ((4 in this.FComponentState) && (this.FOwner !== null)) this.FOwner.ValidateRename(AComponent,CurName,NewName); }; this.ValidateContainer = function (AComponent) { AComponent.ValidateInsert(this); }; this.ValidateInsert = function (AComponent) { if (AComponent === null) ; }; this.Create$1 = function (AOwner) { this.FComponentStyle = rtl.createSet(0); if (AOwner != null) AOwner.InsertComponent(this); return this; }; this.Destroy = function () { var I = 0; var C = null; this.Destroying(); if (this.FFreeNotifies != null) { I = this.FFreeNotifies.FCount - 1; while (I >= 0) { C = rtl.getObject(this.FFreeNotifies.Get(I)); this.FFreeNotifies.Delete(I); C.Notification(this,1); if (this.FFreeNotifies === null) { I = 0} else if (I > this.FFreeNotifies.FCount) I = this.FFreeNotifies.FCount; I -= 1; }; pas.SysUtils.FreeAndNil({p: this, get: function () { return this.p.FFreeNotifies; }, set: function (v) { this.p.FFreeNotifies = v; }}); }; this.DestroyComponents(); if (this.FOwner !== null) this.FOwner.RemoveComponent(this); pas.System.TObject.Destroy.call(this); }; this.BeforeDestruction = function () { if (!(3 in this.FComponentState)) this.Destroying(); }; this.DestroyComponents = function () { var acomponent = null; while (this.FComponents != null) { acomponent = rtl.getObject(this.FComponents.Last()); this.Remove(acomponent); acomponent.$destroy("Destroy"); }; }; this.Destroying = function () { var Runner = 0; if (3 in this.FComponentState) return; this.FComponentState = rtl.includeSet(this.FComponentState,3); if (this.FComponents != null) for (var $l = 0, $end = this.FComponents.FCount - 1; $l <= $end; $l++) { Runner = $l; rtl.getObject(this.FComponents.Get(Runner)).Destroying(); }; }; this.FindComponent = function (AName) { var Result = null; var I = 0; Result = null; if ((AName === "") || !(this.FComponents != null)) return Result; for (var $l = 0, $end = this.FComponents.FCount - 1; $l <= $end; $l++) { I = $l; if (pas.SysUtils.CompareText(rtl.getObject(this.FComponents.Get(I)).FName,AName) === 0) { Result = rtl.getObject(this.FComponents.Get(I)); return Result; }; }; return Result; }; this.RemoveFreeNotification = function (AComponent) { this.RemoveNotification(AComponent); AComponent.RemoveNotification(this); }; this.InsertComponent = function (AComponent) { AComponent.ValidateContainer(this); this.ValidateRename(AComponent,"",AComponent.FName); if (AComponent.FOwner !== null) AComponent.FOwner.RemoveComponent(AComponent); this.Insert(AComponent); if (4 in this.FComponentState) AComponent.SetDesigning(true,true); this.Notification(AComponent,0); }; this.RemoveComponent = function (AComponent) { this.Notification(AComponent,1); this.Remove(AComponent); AComponent.SetDesigning(false,true); this.ValidateRename(AComponent,AComponent.FName,""); }; var $r = this.$rtti; $r.addProperty("Name",6,rtl.string,"FName","SetName"); $r.addProperty("Tag",0,rtl.nativeint,"FTag","FTag",{Default: 0}); }); this.RegisterFindGlobalComponentProc = function (AFindGlobalComponent) { if (!($impl.FindGlobalComponentList != null)) $impl.FindGlobalComponentList = $mod.TFPList.$create("Create"); if ($impl.FindGlobalComponentList.IndexOf(AFindGlobalComponent) < 0) $impl.FindGlobalComponentList.Add(AFindGlobalComponent); }; $mod.$init = function () { $impl.ClassList = new Object(); }; },[],function () { "use strict"; var $mod = this; var $impl = $mod.$impl; $impl.ClassList = null; $impl.FindGlobalComponentList = null; }); rtl.module("weborworker",["System","JS","Types"],function () { "use strict"; var $mod = this; }); rtl.module("Web",["System","Types","JS","weborworker"],function () { "use strict"; var $mod = this; $mod.$rtti.$ExtClass("TJSHTMLElement"); $mod.$rtti.$ExtClass("TJSMouseEvent"); rtl.createHelper($mod,"TJSEventHelper",null,function () { this.GetTargetElement = function () { var Result = null; Result = this.target; return Result; }; this.GetTargetHTMLElement = function () { var Result = null; Result = this.target; return Result; }; }); $mod.$rtti.$ExtClass("TJSHTMLElement",{ancestor: $mod.$rtti["TJSElement"], jsclass: "HTMLElement"}); $mod.$rtti.$ExtClass("TJSHTMLAnchorElement",{ancestor: $mod.$rtti["TJSHTMLElement"], jsclass: "HTMLAnchorElement"}); $mod.$rtti.$ExtClass("TJSMouseEvent",{ancestor: $mod.$rtti["TJSUIEvent"], jsclass: "MouseEvent"}); }); rtl.module("CustApp",["System","Classes","SysUtils","Types","JS"],function () { "use strict"; var $mod = this; rtl.createClass($mod,"TCustomApplication",pas.Classes.TComponent,function () { this.$init = function () { pas.Classes.TComponent.$init.call(this); this.FExceptObjectJS = undefined; this.FTerminated = false; this.FOptionChar = ""; this.FCaseSensitiveOptions = false; this.FStopOnException = false; this.FExceptionExitCode = 0; this.FExceptObject = null; }; this.$final = function () { this.FExceptObject = undefined; pas.Classes.TComponent.$final.call(this); }; this.Create$1 = function (AOwner) { pas.Classes.TComponent.Create$1.call(this,AOwner); this.FOptionChar = "-"; this.FCaseSensitiveOptions = true; this.FStopOnException = false; return this; }; this.HandleException = function (Sender) { var E = null; var Tmp = null; Tmp = null; E = this.FExceptObject; if ((E === null) && pas.System.Assigned(this.FExceptObjectJS)) { if (rtl.isExt(this.FExceptObjectJS,Error,1)) { Tmp = pas.SysUtils.EExternalException.$create("Create$1",[rtl.getObject(this.FExceptObjectJS).message])} else if (rtl.isExt(this.FExceptObjectJS,Object,1) && rtl.getObject(this.FExceptObjectJS).hasOwnProperty("message")) { Tmp = pas.SysUtils.EExternalException.$create("Create$1",["" + rtl.getObject(this.FExceptObjectJS)["message"]])} else Tmp = pas.SysUtils.EExternalException.$create("Create$1",[JSON.stringify(this.FExceptObjectJS)]); E = Tmp; }; try { this.ShowException(E); if (this.FStopOnException) this.Terminate$1(this.FExceptionExitCode); } finally { Tmp = rtl.freeLoc(Tmp); }; if (Sender === null) ; }; this.Initialize = function () { this.FTerminated = false; }; this.Run = function () { do { this.FExceptObject = null; this.FExceptObjectJS = null; try { this.DoRun(); } catch ($e) { if (pas.SysUtils.Exception.isPrototypeOf($e)) { var E = $e; this.FExceptObject = E; this.FExceptObjectJS = E; this.HandleException(this); } else { this.FExceptObject = null; this.FExceptObjectJS = $e; this.HandleException(this); } }; break; } while (!this.FTerminated); }; this.Terminate$1 = function (AExitCode) { this.FTerminated = true; rtl.exitcode = AExitCode; }; }); }); rtl.module("BrowserApp",["System","Classes","SysUtils","Types","JS","Web","CustApp"],function () { "use strict"; var $mod = this; var $impl = $mod.$impl; rtl.createClass($mod,"TBrowserApplication",pas.CustApp.TCustomApplication,function () { this.$init = function () { pas.CustApp.TCustomApplication.$init.call(this); this.FShowExceptions = false; }; this.GetHTMLElement = function (aID) { var Result = null; Result = document.getElementById(aID); if ((Result === null) && this.LogGetElementErrors()) pas.System.Writeln("Could not find element with ID ",aID); return Result; }; this.DoRun = function () { }; this.LogGetElementErrors = function () { var Result = false; Result = true; return Result; }; this.Create$1 = function (aOwner) { pas.CustApp.TCustomApplication.Create$1.call(this,aOwner); this.FShowExceptions = true; if ($impl.AppInstance === null) { $impl.AppInstance = this; pas.Classes.RegisterFindGlobalComponentProc($impl.DoFindGlobalComponent); }; return this; }; this.Destroy = function () { if ($impl.AppInstance === this) $impl.AppInstance = null; pas.Classes.TComponent.Destroy.call(this); }; this.ShowException = function (E) { var S = ""; if (E !== null) { S = E.$classname + ": " + E.fMessage} else if (this.FExceptObjectJS) S = rtl.getObject(this.FExceptObjectJS).toString(); S = "Unhandled exception caught: " + S; if (this.FShowExceptions) window.alert(S); pas.System.Writeln(S); }; this.HandleException = function (Sender) { if (pas.SysUtils.Exception.isPrototypeOf(this.FExceptObject)) this.ShowException(this.FExceptObject); pas.CustApp.TCustomApplication.HandleException.call(this,Sender); }; }); this.ReloadEnvironmentStrings = function () { var I = 0; var S = ""; var N = ""; var A = []; var P = []; if ($impl.EnvNames != null) pas.SysUtils.FreeAndNil({p: $impl, get: function () { return this.p.EnvNames; }, set: function (v) { this.p.EnvNames = v; }}); $impl.EnvNames = new Object(); S = window.location.search; S = pas.System.Copy(S,2,S.length - 1); A = S.split("&"); for (var $l = 0, $end = rtl.length(A) - 1; $l <= $end; $l++) { I = $l; P = A[I].split("="); N = pas.SysUtils.LowerCase(decodeURIComponent(P[0])); if (rtl.length(P) === 2) { $impl.EnvNames[N] = decodeURIComponent(P[1])} else if (rtl.length(P) === 1) $impl.EnvNames[N] = ""; }; }; this.SetCommandLineParams = function (aExe, Pars) { var I = 0; $impl.Params[0] = window.location.pathname; for (var $l = 0, $end = rtl.length(Pars) - 1; $l <= $end; $l++) { I = $l; $impl.Params[1 + I] = Pars[I]; }; }; this.ReloadParamStrings = function () { var ParsLine = ""; var Pars = []; ParsLine = pas.System.Copy$1(window.location.hash,2); if (ParsLine !== "") { Pars = pas.SysUtils.TStringHelper.Split$1.call({get: function () { return ParsLine; }, set: function (v) { ParsLine = v; }},["\/"])} else Pars = rtl.arraySetLength(Pars,"",0); $impl.Params = rtl.arraySetLength($impl.Params,"",1 + rtl.length(Pars)); $mod.SetCommandLineParams(window.location.pathname,Pars); }; $mod.$init = function () { pas.System.IsConsole = true; pas.System.OnParamCount = $impl.GetParamCount; pas.System.OnParamStr = $impl.GetParamStr; $mod.ReloadEnvironmentStrings(); $mod.ReloadParamStrings(); pas.SysUtils.OnGetEnvironmentVariable = $impl.MyGetEnvironmentVariable; pas.SysUtils.OnGetEnvironmentVariableCount = $impl.MyGetEnvironmentVariableCount; pas.SysUtils.OnGetEnvironmentString = $impl.MyGetEnvironmentString; }; },null,function () { "use strict"; var $mod = this; var $impl = $mod.$impl; $impl.EnvNames = null; $impl.Params = []; $impl.AppInstance = null; $impl.GetParamCount = function () { var Result = 0; Result = rtl.length($impl.Params) - 1; return Result; }; $impl.GetParamStr = function (Index) { var Result = ""; if ((Index >= 0) && (Index < rtl.length($impl.Params))) Result = $impl.Params[Index]; return Result; }; $impl.MyGetEnvironmentVariable = function (EnvVar) { var Result = ""; var aName = ""; aName = pas.SysUtils.LowerCase(EnvVar); if ($impl.EnvNames.hasOwnProperty(aName)) { Result = "" + $impl.EnvNames[aName]} else Result = ""; return Result; }; $impl.MyGetEnvironmentVariableCount = function () { var Result = 0; Result = rtl.length(Object.getOwnPropertyNames($impl.EnvNames)); return Result; }; $impl.MyGetEnvironmentString = function (Index) { var Result = ""; Result = "" + $impl.EnvNames[Object.getOwnPropertyNames($impl.EnvNames)[Index]]; return Result; }; $impl.DoFindGlobalComponent = function (aName) { var Result = null; if ($impl.AppInstance != null) { Result = $impl.AppInstance.FindComponent(aName)} else Result = null; return Result; }; }); rtl.module("program",["System","JS","Classes","SysUtils","Web","BrowserApp"],function () { "use strict"; var $mod = this; rtl.recNewT($mod,"WebPageviewRecord",function () { this.referrer_host = ""; this.referrer = ""; this.is_log = false; this.$eq = function (b) { return (this.referrer_host === b.referrer_host) && (this.referrer === b.referrer) && (this.is_log === b.is_log); }; this.$assign = function (s) { this.referrer_host = s.referrer_host; this.referrer = s.referrer; this.is_log = s.is_log; return this; }; }); rtl.recNewT($mod,"postWebPageviewRecord",function () { this.behavior_type = ""; this.zshy_user_login_id = ""; this.$new = function () { var r = Object.create(this); r.properties = $mod.WebPageviewRecord.$new(); return r; }; this.$eq = function (b) { return this.properties.$eq(b.properties) && (this.behavior_type === b.behavior_type) && (this.zshy_user_login_id === b.zshy_user_login_id); }; this.$assign = function (s) { this.properties.$assign(s.properties); this.behavior_type = s.behavior_type; this.zshy_user_login_id = s.zshy_user_login_id; return this; }; }); rtl.recNewT($mod,"bannerRecord",function () { this.jump_url = ""; this.image_url = ""; this.cname = ""; this.$eq = function (b) { return (this.jump_url === b.jump_url) && (this.image_url === b.image_url) && (this.cname === b.cname); }; this.$assign = function (s) { this.jump_url = s.jump_url; this.image_url = s.image_url; this.cname = s.cname; return this; }; var $r = $mod.$rtti.$Record("bannerRecord",{}); $r.addField("jump_url",rtl.string); $r.addField("image_url",rtl.string); $r.addField("cname",rtl.string); }); rtl.createClass($mod,"TAjax",pas.System.TObject,function () { this.$init = function () { pas.System.TObject.$init.call(this); this.FXmlHttpRequest = null; }; this.$final = function () { this.FXmlHttpRequest = undefined; pas.System.TObject.$final.call(this); }; this.SetOnLoad = function (AValue) { this.FXmlHttpRequest.addEventListener("load",rtl.createSafeCallback(null,AValue)); }; this.Create$1 = function () { this.FXmlHttpRequest = new XMLHttpRequest(); return this; }; this.Destroy = function () { }; this.Open = function (AMethod, AUrl) { this.FXmlHttpRequest.open(AMethod,AUrl,true); this.FXmlHttpRequest.send(); }; this.GET = function (aurl) { this.Open("GET",aurl); }; this.POST = function (aurl, body) { try { this.FXmlHttpRequest.open("POST",aurl,true); this.FXmlHttpRequest.setRequestHeader("Content-Type","application\/json"); this.FXmlHttpRequest.send(body); } catch ($e) { }; }; }); rtl.createClass($mod,"mytest",pas.BrowserApp.TBrowserApplication,function () { this.DoRun = function () { pas.BrowserApp.TBrowserApplication.DoRun.call(this); }; this.domytest = function () { }; }); rtl.createClass($mod,"hysso",pas.BrowserApp.TBrowserApplication,function () { this.$init = function () { pas.BrowserApp.TBrowserApplication.$init.call(this); this.ssologin = null; this.ssoreg = null; this.ssoname = null; this.ssonameH = null; this.ifssologed = null; this.ssolixgxx = null; this.ssolixxmm = null; this.ssolicard = null; this.ssologout = null; this.ssologoutH = null; this.closeBtn = null; this.gohelp = null; this.poptologin = null; this.chaxunxuefen1 = null; this.mpar = ""; this.popupPics = []; this.popupIdx = 0; this.pcPopupBaseUrl = ""; }; this.$final = function () { this.ssologin = undefined; this.ssoreg = undefined; this.ssoname = undefined; this.ssonameH = undefined; this.ifssologed = undefined; this.ssolixgxx = undefined; this.ssolixxmm = undefined; this.ssolicard = undefined; this.ssologout = undefined; this.ssologoutH = undefined; this.closeBtn = undefined; this.gohelp = undefined; this.poptologin = undefined; this.chaxunxuefen1 = undefined; this.popupPics = undefined; pas.BrowserApp.TBrowserApplication.$final.call(this); }; this.DoRun = function () { pas.BrowserApp.TBrowserApplication.DoRun.call(this); this.pcPopupBaseUrl = "https:\/\/mednews.91huayi.com"; try { this.ifssologed = this.GetHTMLElement("ifssologed"); this.ssolicard = this.GetHTMLElement("ssolicard"); this.ssolixgxx = this.GetHTMLElement("ssolixgxx"); this.ssolixxmm = this.GetHTMLElement("ssolixxmm"); this.ssologout = this.GetHTMLElement("ssologout"); this.ssologoutH = this.GetHTMLElement("ssologoutH"); this.ssoname = this.GetHTMLElement("ssoname"); this.ssonameH = this.GetHTMLElement("ssonameH"); this.ssologin = this.GetHTMLElement("ssologin"); this.ssoreg = this.GetHTMLElement("ssoreg"); this.gohelp = this.GetHTMLElement("gohelp"); this.chaxunxuefen1 = this.GetHTMLElement("chaxunxuefen1"); if (this.ssolicard != null) this.ssolicard.onclick = rtl.createSafeCallback(this,"funssolicard"); if (this.ssolixgxx != null) this.ssolixgxx.onclick = rtl.createSafeCallback(this,"funssolixgxx"); if (this.ssolixxmm != null) this.ssolixxmm.onclick = rtl.createSafeCallback(this,"funssolixxmm"); if (this.ssologout != null) this.ssologout.onclick = rtl.createSafeCallback(this,"funssologout"); if (this.ssologoutH != null) this.ssologoutH.onclick = rtl.createSafeCallback(this,"funssologout"); if (this.ssologin != null) this.ssologin.onclick = rtl.createSafeCallback(this,"funssologin"); if (this.ssoreg != null) this.ssoreg.onclick = rtl.createSafeCallback(this,"fungoreg"); if (this.gohelp != null) this.gohelp.onclick = rtl.createSafeCallback(this,"fungohelp"); if (this.ifssologed != null) this.ifssologed.hidden = true; this.getzhinanList(); this.closeBtn = this.GetHTMLElement("closeBtn"); if (this.closeBtn != null) this.closeBtn.onclick = rtl.createSafeCallback(this,"closeLoginGuidClick"); this.poptologin = this.GetHTMLElement("poptologin"); if (this.poptologin != null) this.poptologin.onclick = rtl.createSafeCallback(this,"loginGuidTologinClick"); this.searchYYBS(); this.clearBanners(); if (window.location.hostname === "www.91huayi.com") this.GetBannerImgsFromSC(); this.bindPoints(); this.WebPageview(); this.verifyToken(); this.setRZINFO(); window.onmessage = rtl.createSafeCallback(this,"getmsg"); if (window.location.hostname === "www.91huayi.com") this.needLoginHref(); $mod.mytest.domytest(); this.checkPCPopupDismissed(); } finally { }; }; this.funssolixgxx = function (aEvent) { var Result = false; var uid = ""; var token = ""; token = ""; uid = ""; { uid=getCookie('xsign'); token=getCookie('cookie_user_ticket'); }; window.open("https:\/\/wxmp.91huayi.com\/toUpdateUserInfo?userId=" + uid + "&token=" + token); return Result; }; this.funssolixxmm = function (aEvent) { var Result = false; var uid_ = ""; var userloginname = ""; var token = ""; uid_ = ""; { uid_=getCookie('rememberUserID'); userloginname=getCookie('userloginname'); token=getCookie('cookie_user_ticket'); }; window.open("https:\/\/hyuser.91huayi.com\/AccountCenter\/setpwd.aspx?tag=91huayi&uid=" + uid_ + "&user_name=" + userloginname + "&token=" + token); return Result; }; this.funssolicard = function (aEvent) { var Result = false; window.open("https:\/\/cme45.91huayi.com\/pages\/buy_card.aspx"); return Result; }; this.funssologout = function (aEvent) { var $Self = this; var Result = false; $Self.del91huayicok("rememberUserID"); $Self.del91huayicok("rememberLoginUser"); $Self.del91huayicok("province"); $Self.del91huayicok("xsign"); window.location.href = "https:\/\/hysso.91huayi.com\/logout?loginUrl=https:\/\/www.91huayi.com\/index.html"; return Result; }; this.funssologin = function (aEvent) { var Result = false; if (window.location.hostname === "www.91huayi.com") window.location.href = "https:\/\/hysso.91huayi.com\/checkLogin?returnUrl=https:\/\/hysslogin.91huayi.com" + "\/callBack\/ticket?homeUrl=https%253A%252F%252Fxkjspc.91huayi.com%252Findex%253Fchannel_id%253DA81EBBD8-C593-4D56-A0BB-B17701073FB7%2526source%253Dhygw"; if (window.location.hostname === "pcmsg.91huayi.com") window.location.href = "https:\/\/hysso.91huayi.com\/checkLogin?returnUrl=https:\/\/hysslogin.91huayi.com\/callBack\/ticket?homeUrl=https:\/\/pcmsg.91huayi.com\/pc\/msg"; if (window.location.hostname === "91huayi.com") { window.location.href = "https:\/\/hysso.91huayi.com\/checkLogin?returnUrl=https:\/\/hysslogin.91huayi.com" + "\/callBack\/ticket?homeUrl=https%253A%252F%252Fxkjspc.91huayi.com%252Findex%253Fchannel_id%253DA81EBBD8-C593-4D56-A0BB-B17701073FB7%2526source%253Dhygw"; }; return Result; }; this.fungoreg = function (aEvent) { var Result = false; { window.location.href='https://wxmp.91huayi.com/toRegisterStatic?tag=91huayi'; }; return Result; }; this.fungohelp = function (aEvent) { var Result = false; var usin = ""; var uid = ""; var urlstr = ""; usin = ""; uid = ""; urlstr = ""; { usin=getCookie('xsign'); uid=getCookie('rememberUserID'); }; if ((usin == null) || (usin == undefined) || (usin === "")) { window.location.href = "https:\/\/hysso.91huayi.com\/checkLogin?returnUrl=https:\/\/hysslogin.91huayi.com\/" + "callBack\/ticket?homeUrl=https:\/\/www.91huayi.com\/index.html%26source=hygw"; } else { urlstr = "https:\/\/zzfk.91huayi.com\/question\/SubQuestion.html?userId="; urlstr = urlstr + uid; urlstr = urlstr + "&sign=" + usin + "&skipType=1&platformId=C1F9312C-078B-4D6C-A4D6-72FDF6A32205&source=cme"; window.open(urlstr); }; return Result; }; this.threeDrugTypeButton = function (aEvent) { var Result = false; this.searchYYBS(); return Result; }; this.threeDrugTypepp = function (aEvent) { var Result = false; var uid = ""; uid = ""; { uid=getCookie('rememberUserID'); }; window.open(pas.Web.TJSEventHelper.GetTargetElement.call(aEvent).getAttribute("tid")); return Result; }; this.searchZNYP = function (aEvent) { var Result = false; var s = ""; var uid = ""; var url = ""; var tm = null; url = "https:\/\/medhelper.91huayi.com\/indexSearch?searchName=%s&tag=drug"; tm = window.document.getElementById("znypserach"); if (tm != null) { s = tm.value} else s = ""; s = encodeURIComponent(s); url = pas.SysUtils.Format(url,pas.System.VarRecs(18,s)); { uid=getCookie('rememberUserID'); }; if ((uid == null) || (uid == undefined) || (uid === "")) { Result = this.openLoginGuideEx2(url); } else window.open(url); return Result; }; this.topOnenav = function (aEvent) { var $Self = this; var Result = false; var userid = ""; var aj = null; var str = ""; var ttstr = ""; var url = ""; var userid2 = ""; var tme = null; function savepi01(Event) { var Result = false; if (ttstr === "首页") { window.location.href = url} else window.open(url); return Result; }; Result = false; str = '{"properties":"{\\"product_name\\":\\"华医网官网\\",\\"the_end\\":\\"web\\",' + '\\"top_navigation_bar_name\\":\\"%s\\"}",' + '"behavior_type":"%s","zshy_user_login_id":"%s","person_id":"%s"}'; { userid=getCookie('rememberUserID'); } { userid2=getCookie('loginid');}; tme = pas.Web.TJSEventHelper.GetTargetHTMLElement.call(aEvent); if (tme != null) { ttstr = tme.textContent} else ttstr = ""; tme = pas.Web.TJSEventHelper.GetTargetHTMLElement.call(aEvent); if (tme != null) { url = tme.href} else url = ""; if ((userid != null) && (userid != undefined) && (userid !== "")) { str = pas.SysUtils.Format(str,pas.System.VarRecs(18,ttstr,18,"TopNavigationClick",18,userid2,18,userid)); aj = $mod.TAjax.$create("Create$1"); aj.SetOnLoad(rtl.createSafeCallback(null,savepi01)); aj.POST($mod.SCPOINTURL,str); if (ttstr === "找工作") { url = "https:\/\/hysso.91huayi.com\/checkLogin?returnUrl=https:\/\/hysslogin.91huayi.com" + "\/callBack\/ticket?homeUrl=https:\/\/www.huayijob.com\/index"; }; aj.FXmlHttpRequest.addEventListener("error",rtl.createSafeCallback(null,savepi01)); Result = false; } else { if ((ttstr === "首页") || (ttstr === "继续教育") || (ttstr === "临床指南") || (ttstr === "用药帮手") || (ttstr === "找工作") || (ttstr === "学术热点")) { Result = $Self.openLoginGuideEx(url); } else Result = true; }; return Result; }; this.add_nav_href = function (aEvent) { var $Self = this; var Result = false; var userid = ""; var aj = null; var str = ""; var url = ""; var st = ""; var tme = null; var userid2 = ""; function savepi01(Event) { var Result = false; pas.System.Writeln(Event.target.responseText); if (url !== "") window.location.href = url; return Result; }; Result = false; str = '{"properties":"{\\"product_name\\":\\"华医网官网\\",\\"the_end\\":\\"web\\",' + '\\"side_navigation_bar_name\\":\\"%s\\"}",' + '"behavior_type":"%s","zshy_user_login_id":"%s","person_id":"%s"}'; { userid=getCookie('rememberUserID'); } { userid2=getCookie('loginid');}; tme = pas.Web.TJSEventHelper.GetTargetHTMLElement.call(aEvent); if (tme != null) { url = tme.href; st = tme.textContent; } else { url = ""; st = ""; }; st = pas.SysUtils.TStringHelper.Replace$2.call({get: function () { return st; }, set: function (v) { st = v; }},"\r",""); st = pas.SysUtils.TStringHelper.Replace$2.call({get: function () { return st; }, set: function (v) { st = v; }},"\n",""); st = pas.SysUtils.TStringHelper.Replace$2.call({get: function () { return st; }, set: function (v) { st = v; }},"\t",""); if ((userid != null) && (userid != undefined) && (userid !== "")) { str = pas.SysUtils.Format(str,pas.System.VarRecs(18,st,18,"SideNavigationClick",18,userid2,18,userid)); aj = $mod.TAjax.$create("Create$1"); aj.SetOnLoad(rtl.createSafeCallback(null,savepi01)); aj.POST($mod.SCPOINTURL,str); aj.FXmlHttpRequest.addEventListener("error",rtl.createSafeCallback(null,savepi01)); Result = false; } else { if (st === "继续教育") { Result = $Self.openLoginGuideEx(url); } else Result = true; }; return Result; }; this.bannerimg = function (aEvent) { var $Self = this; var Result = false; var userid = ""; var aj = null; var str = ""; var st = ""; var url = ""; var tmpe = null; var userid2 = ""; function savepi01(Event) { var Result = false; pas.System.Writeln(Event.target.responseText); if (url !== "") window.open(url); return Result; }; Result = false; str = '{"properties":"{\\"product_name\\":\\"华医网官网\\",\\"the_end\\":\\"web\\",' + '\\"belonging_location\\":\\"顶部大图\\",\\"homepage_banner_name\\":\\"%s\\",\\"banner_type\\":\\"轮播图\\"}",' + '"behavior_type":"%s","zshy_user_login_id":"%s","person_id":"%s"}'; { userid=getCookie('rememberUserID'); } { userid2=getCookie('loginid');}; tmpe = pas.Web.TJSEventHelper.GetTargetElement.call(aEvent).parentElement; st = tmpe.getAttribute("_title_"); st = pas.SysUtils.TStringHelper.Replace$2.call({get: function () { return st; }, set: function (v) { st = v; }},"\t",""); url = pas.Web.TJSEventHelper.GetTargetHTMLElement.call(aEvent).parentElement.href; if ((url == undefined) || (url == null) || (url === "")) { url = pas.Web.TJSEventHelper.GetTargetHTMLElement.call(aEvent).href; }; if ((userid != null) && (userid != undefined) && (userid !== "")) { str = pas.SysUtils.Format(str,pas.System.VarRecs(18,st,18,"HomePageBannerClick",18,userid2,18,userid)); aj = $mod.TAjax.$create("Create$1"); aj.SetOnLoad(rtl.createSafeCallback(null,savepi01)); aj.POST($mod.SCPOINTURL,str); aj.FXmlHttpRequest.addEventListener("error",rtl.createSafeCallback(null,savepi01)); Result = false; } else { Result = $Self.openLoginGuideEx(url); }; return Result; }; this.curr_topTwonav = function (aEvent) { var $Self = this; var Result = false; var userid = ""; var aj = null; var str = ""; var url = ""; var userid2 = ""; function savepi01(Event) { var Result = false; pas.System.Writeln(Event.target.responseText); if (url !== "") window.open(url); return Result; }; Result = false; str = '{"properties":"{\\"product_name\\":\\"华医网官网\\",\\"the_end\\":\\"web\\",' + '\\"subject_name\\":\\"%s\\"}",' + '"behavior_type":"%s","zshy_user_login_id":"%s","person_id":"%s"}'; { userid=getCookie('rememberUserID'); } { userid2=getCookie('loginid');}; url = pas.Web.TJSEventHelper.GetTargetHTMLElement.call(aEvent).href; if ((userid != null) && (userid != undefined) && (userid !== "")) { str = pas.SysUtils.Format(str,pas.System.VarRecs(18,pas.Web.TJSEventHelper.GetTargetHTMLElement.call(aEvent).textContent,18,"subjectNavigationBrowse",18,userid2,18,userid)); aj = $mod.TAjax.$create("Create$1"); aj.SetOnLoad(rtl.createSafeCallback(null,savepi01)); aj.POST($mod.SCPOINTURL,str); aj.FXmlHttpRequest.addEventListener("error",rtl.createSafeCallback(null,savepi01)); Result = false; } else { Result = $Self.openLoginGuideEx(url); }; return Result; }; this.channelimg = function (aEvent) { var $Self = this; var Result = false; var userid = ""; var aj = null; var str = ""; var ttstr = ""; var url = ""; var userid2 = ""; function savepi01(Event) { var Result = false; pas.System.Writeln(Event.target.responseText); if (url !== "") window.open(url); return Result; }; Result = false; str = '{"properties":"{\\"product_name\\":\\"华医网官网\\",\\"the_end\\":\\"web\\",' + '\\"menu_name\\":\\"%s\\"}",' + '"behavior_type":"%s","zshy_user_login_id":"%s","person_id":"%s"}'; { userid=getCookie('rememberUserID'); } { userid2=getCookie('loginid');}; ttstr = pas.Web.TJSEventHelper.GetTargetElement.call(aEvent).parentElement.getAttribute("_title_"); url = pas.Web.TJSEventHelper.GetTargetHTMLElement.call(aEvent).href; if ((url == undefined) || (url == null) || (url === "")) { url = pas.Web.TJSEventHelper.GetTargetHTMLElement.call(aEvent).parentElement.href; }; if (ttstr === "找工作") { url = "https:\/\/www.huayijob.com\/index"; }; if ((userid != null) && (userid != undefined) && (userid !== "")) { str = pas.SysUtils.Format(str,pas.System.VarRecs(18,ttstr,18,"MenuBarBrowse",18,userid2,18,userid)); aj = $mod.TAjax.$create("Create$1"); aj.SetOnLoad(rtl.createSafeCallback(null,savepi01)); aj.POST($mod.SCPOINTURL,str); aj.FXmlHttpRequest.addEventListener("error",rtl.createSafeCallback(null,savepi01)); Result = false; } else { if ((ttstr === "学术热点") || (ttstr === "助学工具") || (ttstr === "找工作")) { $Self.openLoginGuideEx2(url)} else Result = true; }; return Result; }; this.advertimg = function (aEvent) { var $Self = this; var Result = false; var userid = ""; var aj = null; var str = ""; var url = ""; var st = ""; var userid2 = ""; function savepi01(Event) { var Result = false; pas.System.Writeln(Event.target.responseText); if (url !== "") window.open(url); return Result; }; Result = false; if (pas.Web.TJSEventHelper.GetTargetElement.call(aEvent).parentElement.getAttribute("Class") === "advertimg1") { str = '{"properties":"{\\"product_name\\":\\"华医网官网\\",\\"the_end\\":\\"web\\",' + '\\"belonging_location\\":\\"腰部广告\\",\\"homepage_banner_name\\":\\"%s\\"}",' + '"behavior_type":"%s","zshy_user_login_id":"%s","person_id":"%s"}'} else str = '{"properties":"{\\"product_name\\":\\"华医网官网\\",\\"the_end\\":\\"web\\",' + '\\"belonging_location\\":\\"底部广告\\",\\"homepage_banner_name\\":\\"%s\\"}",' + '"behavior_type":"%s","zshy_user_login_id":"%s","person_id":"%s"}'; { userid=getCookie('rememberUserID'); } { userid2=getCookie('loginid');}; st = pas.Web.TJSEventHelper.GetTargetElement.call(aEvent).parentElement.getAttribute("_title_"); st = pas.SysUtils.TStringHelper.Replace$2.call({get: function () { return st; }, set: function (v) { st = v; }},"\t",""); url = pas.Web.TJSEventHelper.GetTargetHTMLElement.call(aEvent).href; if ((url == undefined) || (url == null) || (url === "")) { url = pas.Web.TJSEventHelper.GetTargetHTMLElement.call(aEvent).parentElement.href; }; if ((userid != null) && (userid != undefined) && (userid !== "")) { str = pas.SysUtils.Format(str,pas.System.VarRecs(18,st,18,"HomePageBannerClick",18,userid2,18,userid)); aj = $mod.TAjax.$create("Create$1"); aj.SetOnLoad(rtl.createSafeCallback(null,savepi01)); aj.POST($mod.SCPOINTURL,str); aj.FXmlHttpRequest.addEventListener("error",rtl.createSafeCallback(null,savepi01)); Result = false; } else { Result = $Self.openLoginGuideEx(url); }; return Result; }; this.getmsg = function (Event) { var $Self = this; var Result = false; var userid = ""; var ifxtc = 0; var msg = null; var bd = null; var msgpop = null; var zbpoptologin = null; var zbtitle = null; var zbmsg = null; var gourl = ""; function zbbtn(aEvent) { var Result = false; window.open(gourl); msgpop.style.setProperty("display","none"); return Result; }; function zbbtn2(aEvent) { var Result = false; msgpop.style.setProperty("display","none"); return Result; }; ifxtc = 0; { if (event.data === 'closeIframe') { ifxtc=1; const iframe = document.getElementById('frarcxtc'); iframe.remove(); } }; { if (event.data && typeof event.data === 'object' && event.data.type === 'pc-popup-close') { var overlay = document.getElementById('pcPopupOverlay'); if (overlay) overlay.style.display = 'none'; var d = new Date(); d.setTime(d.getTime() + (24 * 60 * 60 * 1000)); document.cookie = 'zxpctc=1; expires=' + d.toUTCString() + '; path=/'; if (event.data.noShow === true) { var pid = getCookie('rememberUserID'); if (pid) { var xhr = new XMLHttpRequest(); xhr.open('POST', pcPopupBaseUrl + '/api/popup/dismiss?person_id=' + encodeURIComponent(pid), true); xhr.send(); } } } }; if (("" + Event["origin"]) === "https:\/\/xkjspc.91huayi.com") { msg = rtl.getObject(Event["data"]); msg = rtl.getObject(msg["data"]); if (msg["code"] == 16) { bd = rtl.getObject(msg["body"]); msgpop = $Self.GetHTMLElement("zbpopup"); zbtitle = $Self.GetHTMLElement("zbtitle"); zbmsg = $Self.GetHTMLElement("zbmsg"); zbpoptologin = $Self.GetHTMLElement("zbpoptologin"); zbtitle.textContent = "" + bd["watch_tip_title"]; zbmsg.textContent = "" + bd["watch_tip_msg"]; gourl = "" + bd["identity_url"]; msgpop.style.setProperty("display","block"); if (pas.SysUtils.TStringHelper.GetLength.call({get: function () { return gourl; }, set: function (v) { gourl = v; }}) > 10) { zbpoptologin.textContent = "去认证"; zbpoptologin.onclick = rtl.createSafeCallback(null,zbbtn); } else { zbpoptologin.textContent = "我知道了"; zbpoptologin.onclick = rtl.createSafeCallback(null,zbbtn2); }; }; Result = false; } else { if (ifxtc === 0) { if (("" + Event["origin"]) !== "https:\/\/www.huayijob.com") { Result = false; } else { { userid=getCookie('rememberUserID'); }; { if (typeof event.data !== 'string' || event.data === '[object Object]') { return false; } }; if ((userid != null) && (userid != undefined) && (userid !== "")) { window.open("" + Event["data"]); } else Result = $Self.openLoginGuideEx2("" + Event["data"]); }; }; }; return Result; }; this.closeRCW = function (Event) { var $Self = this; var Result = false; function savepi001(Event) { var Result = false; return Result; }; var id = ""; var ccs = ""; var pid = ""; var cci = 0; var tcstr = ""; var aj = null; var userid2 = ""; pid = ""; { pid=getCookie('rememberUserID'); { userid2=getCookie('loginid');} }; tcstr = '{"properties":"{\\"product_name\\":\\"首页人才弹窗关闭\\",\\"the_end\\":\\"web\\",\\"web_channel\\":\\"官网\\"}",' + '"behavior_type":"JobHomepageClose","zshy_user_login_id":"%s","person_id":"%s"}'; tcstr = pas.SysUtils.Format(tcstr,pas.System.VarRecs(18,userid2,18,pid)); aj = $mod.TAjax.$create("Create$1"); aj.SetOnLoad(rtl.createSafeCallback(null,savepi001)); aj.POST($mod.SCPOINTURL,tcstr); id = ""; ccs = ""; window.document.getElementById("popupjob").style.setProperty("display","none"); { id=window.rcwindowid; ccs=getCookie(id); }; if ((ccs === "") || (ccs == null) || (ccs == undefined)) ccs = "0"; cci = pas.SysUtils.StrToInt(ccs); ccs = pas.SysUtils.IntToStr(cci + 1); { writeCookieRCWeek(id,ccs); }; return Result; }; this.goRCWS = function (Event) { var $Self = this; var Result = false; function savepi001(Event) { var Result = false; var url = ""; url = ""; {url=window.rcopenurl;}; window.document.getElementById("popupjob").style.setProperty("display","none"); window.open(url); return Result; }; var pid = ""; var tcstr = ""; var aj = null; var userid2 = ""; pid = ""; { pid=getCookie('rememberUserID'); { userid2=getCookie('loginid');} }; tcstr = '{"properties":"{\\"product_name\\":\\"首页人才弹窗点击\\",\\"the_end\\":\\"web\\",\\"web_channel\\":\\"官网\\"}",' + '"behavior_type":"JobHomepageClick","zshy_user_login_id":"%s","person_id":"%s"}'; tcstr = pas.SysUtils.Format(tcstr,pas.System.VarRecs(18,userid2,18,pid)); aj = $mod.TAjax.$create("Create$1"); aj.SetOnLoad(rtl.createSafeCallback(null,savepi001)); aj.POST($mod.SCPOINTURL,tcstr); return Result; }; this.smallRCSUB = function (Event) { var Result = false; var pid = ""; var tms = ""; var tcstr = ""; var aj = null; pid = ""; tms = this.GetSelectedDate("jdtest"); { pid=getCookie('rememberUserID'); }; tcstr = '{"person_id": "%s",' + '"user_id": "",' + '"work_time": "%s"}'; tcstr = pas.SysUtils.Format(tcstr,pas.System.VarRecs(18,pid,18,tms)); aj = $mod.TAjax.$create("Create$1"); aj.POST("https:\/\/mobile.huayijob.com\/baseuserinfo\/submit\/temp",tcstr); window.document.getElementById("rc_small_pop").style.setProperty("display","none"); return Result; }; this.smallRCClose = function (Event) { var Result = false; window.document.getElementById("rc_small_pop").style.setProperty("display","none"); return Result; }; var _urul = "https:\/\/pcmsg.91huayi.com\/api\/getMsgNum?userId="; this.pcmsg = function () { var $Self = this; function getpcmsg(Event) { var Result = false; var j = null; var s = ""; var cc = 0; var pcm = null; var pca = null; function pcmsgo(aEvent) { var Result = false; window.open("https:\/\/pcmsg.91huayi.com\/pc\/msg"); return Result; }; Result = true; s = Event.target.responseText; j = JSON.parse(s); pcm = $Self.GetHTMLElement("pcmsgcc"); pca = $Self.GetHTMLElement("pcmsg"); if ((pcm !== null) && (pca !== null)) { cc = Math.floor(j["num"]); if (cc > 99) { pcm.textContent = "99+"} else pcm.textContent = pas.SysUtils.IntToStr(cc); if (cc === 0) { pcm.style.setProperty("display","none")} else pcm.style.setProperty("display","block"); pca.setAttribute("href",""); pca.onclick = rtl.createSafeCallback(null,pcmsgo); }; return Result; }; var pid = ""; var aj = null; { pid=getCookie('loginid'); }; if ((pid != null) && (pid !== "") && (pid != undefined)) { aj = $mod.TAjax.$create("Create$1"); aj.SetOnLoad(rtl.createSafeCallback(null,getpcmsg)); aj.GET(_urul + pid); }; }; this.verifyToken = function () { var $Self = this; function doVerifyToken(Event) { var Result = false; var j = null; var s = ""; var loginid = undefined; var lStatus = 0; var id = undefined; var Name = undefined; var province = undefined; var sign = undefined; var userloginname = undefined; lStatus = Event.target.status; s = Event.target.responseText; if (lStatus === 200) if (s === "error") { $Self.setNotLogin(); } else { $Self.ifssologed.hidden = false; $Self.ssologin.hidden = true; $Self.ssoreg.hidden = true; j = JSON.parse(Event.target.responseText); id = j["id"]; Name = j["Name"]; province = j["province"]; sign = j["sign"]; loginid = j["userid"]; userloginname = j["userloginname"]; { writeCookie('rememberUserID',id); writeCookie91huayi('rememberUserID',id); writeCookie('rememberLoginUser',name); writeCookie('province',province); writeCookie('xsign',sign); writeCookie91huayi('xsign',sign); writeCookie91huayi('loginid',loginid); writeCookie91huayi('userloginname',userloginname); }; $Self.checkRCWINDOW(); $Self.ssoname.textContent = "" + Name; $Self.ssonameH.textContent = "" + Name; $Self.chaxunxuefen1.href = "http:\/\/kjptwsw.91huayi.com"; $Self.chaxunxuefen1.hidden = false; $Self.ssologoutH.hidden = false; var $tmp = "" + province; if ($tmp === "湖北省") { $Self.chaxunxuefen1.href = "http:\/\/kjpt.wsglw.net"} else if ($tmp === "重庆市") { $Self.chaxunxuefen1.href = "http:\/\/183.230.146.12:20000"} else if ($tmp === "湖南省") { $Self.chaxunxuefen1.href = "https:\/\/hunan.wsglw.net"} else if ($tmp === "陕西省") { $Self.chaxunxuefen1.href = "https:\/\/kjjy.snhic.cn:8005\/kjptwsw"} else if ($tmp === "广西省") { $Self.chaxunxuefen1.href = "https:\/\/jxjy.wsjkw.gxzf.gov.cn\/kjptwsw"} else if ($tmp === "山西省") { $Self.chaxunxuefen1.href = "http:\/\/218.26.86.33:9922\/Hylogin"} else if ($tmp === "上海市") { $Self.chaxunxuefen1.hidden = true} else if ($tmp === "安徽省") { $Self.chaxunxuefen1.href = "https:\/\/ahkjpt.wsglw.net\/"} else if ($tmp === "四川省") { $Self.chaxunxuefen1.href = "http:\/\/202.61.90.26\/gateway\/home.html"} else if ($tmp === "贵州省") { $Self.chaxunxuefen1.href = "http:\/\/gzcme.yiboshi.com"} else if ($tmp === "山东省") { $Self.chaxunxuefen1.href = "http:\/\/124.133.43.209:8019\/admin\/login\/person"} else if ($tmp === "甘肃省") { $Self.chaxunxuefen1.href = "https:\/\/kjpt.wsglw.net"} else if ($tmp === "浙江省") { $Self.chaxunxuefen1.href = "https:\/\/cme.wsjkw.zj.gov.cn"} else if ($tmp === "福建省") { $Self.chaxunxuefen1.href = "https:\/\/220.160.53.27:18021\/kjptwsw"} else if ($tmp === "广东省") { $Self.chaxunxuefen1.href = "http:\/\/gdkjpt.91huayi.com"} else if ($tmp === "吉林省") { $Self.chaxunxuefen1.href = "https:\/\/jilin.wsglw.net"} else if ($tmp === "海南省") { $Self.chaxunxuefen1.href = "https:\/\/kjpt.wsglw.net"} else if ($tmp === "青海省") { $Self.chaxunxuefen1.href = "https:\/\/kjpt.wsglw.net\/"} else if ($tmp === "宁夏回族自治区") { $Self.chaxunxuefen1.href = "https:\/\/kjpt.wsglw.net\/"} else if ($tmp === "内蒙古自治区") { $Self.chaxunxuefen1.href = "https:\/\/kjpt.wsglw.net\/"} else if ($tmp === "辽宁省") { $Self.chaxunxuefen1.href = "https:\/\/cme41.91huayi.com\/pages\/study_info_list.aspx"} else if ($tmp === "河南省") $Self.chaxunxuefen1.href = "http:\/\/222.143.64.114:443"; $mod.mytimer_ = window.setInterval(rtl.createSafeCallback($Self,"refreshToken"),60000); $Self.bindLoginGuidClick(); $Self.pcmsg(); $Self.fetchPopupImages(); }; return Result; }; var token = ""; var aj = null; var _code = ""; var tid = ""; var frmjob = null; var divjob = null; try { _code = window.location.search; _code = pas.SysUtils.TStringHelper.Substring.call({get: function () { return _code; }, set: function (v) { _code = v; }},1); _code = pas.SysUtils.TStringHelper.Split.call({get: function () { return _code; }, set: function (v) { _code = v; }},"=")[1]; window.console.log(pas.SysUtils.TStringHelper.IndexOf$1.call({p: window.location, get: function () { return this.p.search; }, set: function (v) { this.p.search = v; }},"code")); if ((_code != undefined) && (_code !== "") && (_code.length < 10)) { if ((_code !== "0") && (pas.SysUtils.TStringHelper.IndexOf$1.call({p: window.location, get: function () { return this.p.search; }, set: function (v) { this.p.search = v; }},"code") > 0)) { if (_code === "1") window.alert("登录失败\uFF0C请重新登录。"); if (_code === "2") { { alert('登录失败,请注册。').then(function(){window.location.href='https://wxmp.91huayi.com/toRegisterStatic?tag=91huayi'}); }; }; $Self.setNotLogin(); $Self.bindLoginGuidClick(); }; } else { { token=getCookie('cookie_user_ticket'); tid=getCookie('rememberUserID'); }; if ((token == null) || (token === "") || (token == undefined)) { $Self.setNotLogin(); divjob = window.document.getElementById("hyjob"); frmjob = window.document.createElement("iframe"); frmjob.src = "https:\/\/www.huayijob.com\/home?personId="; frmjob.height = "564px"; frmjob.width = "100%"; frmjob.setAttribute("frameborder","0"); divjob.appendChild(frmjob); $Self.bindLoginGuidClick(); } else { tid = "100"; divjob = window.document.getElementById("hyjob"); frmjob = window.document.createElement("iframe"); frmjob.src = "https:\/\/www.huayijob.com\/home?personId="; frmjob.height = "564px"; frmjob.width = "100%"; frmjob.setAttribute("frameborder","0"); if (divjob !== null) divjob.appendChild(frmjob); aj = $mod.TAjax.$create("Create$1"); aj.SetOnLoad(rtl.createSafeCallback(null,doVerifyToken)); aj.GET("https:\/\/yxpk.91huayi.com\/HYSSOFORofficial\/getToken?token=" + token); }; }; } catch ($e) { }; }; this.hyotherverifytoken = function () { var $Self = this; function dothertoken(Event) { var Result = false; var j = null; var s = ""; var lStatus = 0; var id = undefined; var Name = undefined; var province = undefined; var sign = undefined; var userloginname = undefined; lStatus = Event.target.status; s = Event.target.responseText; if (lStatus === 200) if (s === "error") {} else { $Self.ifssologed.hidden = false; $Self.ssologin.hidden = true; $Self.ssoreg.hidden = true; j = JSON.parse(Event.target.responseText); id = j["id"]; Name = j["Name"]; province = j["province"]; sign = j["sign"]; userloginname = j["userloginname"]; { writeCookie('rememberUserID',id); writeCookie91huayi('rememberUserID',id); writeCookie('rememberLoginUser',name); writeCookie('province',province); writeCookie('xsign',sign); writeCookie91huayi('xsign',sign); writeCookie91huayi('userloginname',userloginname); }; }; return Result; }; var token = ""; var aj = null; { token=getCookie('cookie_user_ticket'); }; if ((token == null) || (token == undefined) || (token !== "")) {} else { aj = $mod.TAjax.$create("Create$1"); aj.SetOnLoad(rtl.createSafeCallback(null,dothertoken)); aj.GET("https:\/\/yxpk.91huayi.com\/HYSSOFORofficial\/getToken?token=" + token); }; }; this.refreshToken = function () { var $Self = this; function dorefreshToken(Event) { var Result = false; if ((Event.target.status !== 200) || (Event.target.response == "error")) { window.clearInterval($mod.mytimer_); $Self.del91huayicok("rememberUserID"); $Self.del91huayicok("rememberLoginUser"); $Self.del91huayicok("province"); $Self.del91huayicok("xsign"); window.location.href = "https:\/\/hysso.91huayi.com\/logout?loginUrl=https:\/\/www.91huayi.com\/index.html"; }; return Result; }; var token = ""; var aj = null; { token=getCookie('cookie_user_ticket'); }; if (token == null) { $Self.ifssologed.hidden = true; $Self.ssologin.hidden = false; $Self.ssoreg.hidden = false; DELCOOKIE ('rememberUserID'); DELCOOKIE ('rememberLoginUser'); DELCOOKIE ('province'); DELCOOKIE ('xsign'); $Self.bindLoginGuidClick(); } else { $Self.ifssologed.hidden = false; $Self.ssologin.hidden = true; $Self.ssoreg.hidden = true; aj = $mod.TAjax.$create("Create$1"); aj.SetOnLoad(rtl.createSafeCallback(null,dorefreshToken)); aj.GET("https:\/\/yxpk.91huayi.com\/HYSSOFORofficial\/refreshToken?token=" + token); }; }; this.setNotLogin = function () { var pcm = null; var pca = null; var s = ""; this.ifssologed.hidden = true; this.ssologin.hidden = false; this.ssoreg.hidden = false; this.ssologoutH.hidden = true; { try { delCookie('rememberUserID'); delCookie('rememberLoginUser'); delCookie('province'); delCookie('xsign'); del91huayicok('rememberUserID'); del91huayicok('rememberLoginUser'); del91huayicok('province'); del91huayicok('xsign'); } catch (err) { // console.error(err); } }; pcm = this.GetHTMLElement("pcmsgcc"); pca = this.GetHTMLElement("pcmsg"); if (pcm !== null) { pcm.textContent = ""; }; if (pca !== null) { s = "https:\/\/hysso.91huayi.com\/checkLogin?returnUrl=https:\/\/hysslogin.91huayi.com" + "\/callBack\/ticket?homeUrl=https%253A%252F%252Fxkjspc.91huayi.com%252Findex%253Fchannel_id%253DA81EBBD8-C593-4D56-A0BB-B17701073FB7%2526source%253Dhygw"; pca.setAttribute("href",s); }; }; var mystr = '
  • <\/i>%S<\/a><\/li>'; this.getzhinanList = function () { var $Self = this; function getznls(Event) { var Result = false; var zne = null; var s = ""; var j = null; var lStatus = 0; var A = []; var i = 0; zne = window.document.getElementById("rank"); if (zne !== null) zne.innerHTML = ""; lStatus = Event.target.status; j = JSON.parse(Event.target.responseText); A = j["data"]; for (var $l = 0, $end = rtl.length(A) - 1; $l <= $end; $l++) { i = $l; s = s + pas.SysUtils.Format(mystr,pas.System.VarRecs(18,"" + A[i]["pcGuideDetailsUrl"] + "&accessSource=recommend",18,"" + A[i]["guideName"])); }; if (zne !== null) zne.innerHTML = s; $Self.bindLoginGuidClick(); return Result; }; var aj = null; aj = $mod.TAjax.$create("Create$1"); aj.SetOnLoad(rtl.createSafeCallback(null,getznls)); aj.GET("https:\/\/guideline.91huayi.com\/web\/guide\/core\/listGuideCoreByHyw"); }; var mys = "%s查询\uFF0C点击查看详情"; this.searchYYBS = function () { var $Self = this; function getyybs(Event) { var Result = false; var j = null; var dj = null; var pp = null; var btn = null; pp = window.document.getElementById("threeDrugType"); btn = window.document.getElementById("threeDrugTypeButton"); j = JSON.parse(Event.target.responseText); dj = rtl.getObject(j["data"]); if (pp != null) pp.onclick = rtl.createSafeCallback($Self,"threeDrugTypepp"); if (btn != null) btn.onclick = rtl.createSafeCallback($Self,"threeDrugTypeButton"); if (pp != null) { pp.setAttribute("tid","" + dj["targetUrl"]); pp.textContent = pas.SysUtils.Format(mys,pas.System.VarRecs(18,"" + dj["typeName"])); }; return Result; }; var aj = null; try { aj = $mod.TAjax.$create("Create$1"); aj.SetOnLoad(rtl.createSafeCallback(null,getyybs)); aj.GET("https:\/\/medhelper.91huayi.com\/prod-api\/drug\/threeDrugType"); window.document.getElementById("znypserachbtn").onclick = rtl.createSafeCallback($Self,"searchZNYP"); } catch ($e) { }; }; this.bindPoints = function () { var ls = null; var i = 0; ls = window.document.getElementsByClassName("topOnenav"); for (var $l = 0, $end = ls.length - 1; $l <= $end; $l++) { i = $l; ls.item(i).onclick = rtl.createSafeCallback(this,"topOnenav"); }; ls = window.document.getElementsByClassName("add_nav_href"); for (var $l1 = 0, $end1 = ls.length - 1; $l1 <= $end1; $l1++) { i = $l1; ls.item(i).onclick = rtl.createSafeCallback(this,"add_nav_href"); }; ls = window.document.getElementsByClassName("nofollow"); for (var $l2 = 0, $end2 = ls.length - 1; $l2 <= $end2; $l2++) { i = $l2; ls.item(i).onclick = rtl.createSafeCallback(this,"add_nav_href"); }; ls = window.document.getElementsByClassName("curr topTwonav"); for (var $l3 = 0, $end3 = ls.length - 1; $l3 <= $end3; $l3++) { i = $l3; ls.item(i).onclick = rtl.createSafeCallback(this,"curr_topTwonav"); }; ls = window.document.getElementsByClassName("topTwonav"); for (var $l4 = 0, $end4 = ls.length - 1; $l4 <= $end4; $l4++) { i = $l4; ls.item(i).onclick = rtl.createSafeCallback(this,"curr_topTwonav"); }; ls = window.document.getElementsByClassName("bannerimg"); for (var $l5 = 0, $end5 = ls.length - 1; $l5 <= $end5; $l5++) { i = $l5; ls.item(i).onclick = rtl.createSafeCallback(this,"bannerimg"); }; ls = window.document.getElementsByClassName("advertimg1"); for (var $l6 = 0, $end6 = ls.length - 1; $l6 <= $end6; $l6++) { i = $l6; ls.item(i).onclick = rtl.createSafeCallback(this,"advertimg"); }; ls = window.document.getElementsByClassName("advertimg2"); for (var $l7 = 0, $end7 = ls.length - 1; $l7 <= $end7; $l7++) { i = $l7; ls.item(i).onclick = rtl.createSafeCallback(this,"advertimg"); }; ls = window.document.getElementsByClassName("advertimg3"); for (var $l8 = 0, $end8 = ls.length - 1; $l8 <= $end8; $l8++) { i = $l8; ls.item(i).onclick = rtl.createSafeCallback(this,"advertimg"); }; ls = window.document.getElementsByClassName("channelimg"); for (var $l9 = 0, $end9 = ls.length - 1; $l9 <= $end9; $l9++) { i = $l9; ls.item(i).onclick = rtl.createSafeCallback(this,"channelimg"); }; }; this.WebPageview = function () { var $Self = this; function savepi(Event) { var Result = false; pas.System.Writeln(Event.target.responseText); return Result; }; var mr = $mod.postWebPageviewRecord.$new(); var userid = ""; var url = ""; var aj = null; var sbstr = ""; var userid2 = ""; try { sbstr = '{"properties":"{\\"referrer_host\\":\\"%s\\",\\"referrer\\":\\"%s\\",\\"is_log\\":true}",' + '"behavior_type":"WebPageview","zshy_user_login_id":"%s","person_id":"%s"}'; { userid=getCookie('rememberUserID'); } { userid2=getCookie('loginid');}; url = $mod.SCPOINTURL; if ((userid != null) && (userid != undefined) && (userid !== "")) { mr.properties.is_log = true; mr.properties.referrer = window.document.referrer; mr.properties.referrer_host = pas.SysUtils.TStringHelper.Split.call({a: pas.SysUtils.TStringHelper.Replace$2.call({a: pas.SysUtils.TStringHelper.Replace$2.call({p: window.document, get: function () { return this.p.referrer; }, set: function (v) { this.p.referrer = v; }},"http:\/\/",""), get: function () { return this.a; }, set: function (v) { this.a = v; }},"https:\/\/",""), get: function () { return this.a; }, set: function (v) { this.a = v; }},"\/")[0]; mr.zshy_user_login_id = userid; mr.behavior_type = "WebPageview"; sbstr = pas.SysUtils.Format(sbstr,pas.System.VarRecs(18,mr.properties.referrer_host,18,mr.properties.referrer,18,userid2,18,mr.zshy_user_login_id)); aj = $mod.TAjax.$create("Create$1"); aj.SetOnLoad(rtl.createSafeCallback(null,savepi)); aj.POST(url,sbstr); }; } catch ($e) { }; }; this.needLoginHrefClick = function (aEvent) { var Result = false; var tmpstr = ""; var url = ""; tmpstr = pas.Web.TJSEventHelper.GetTargetElement.call(aEvent).href; if (tmpstr == undefined) { tmpstr = pas.Web.TJSEventHelper.GetTargetElement.call(aEvent).parentElement.href; }; if (tmpstr == undefined) { tmpstr = pas.Web.TJSEventHelper.GetTargetElement.call(aEvent).parentElement.parentElement.href; }; url = "https:\/\/hysso.91huayi.com\/checkLogin?returnUrl=https:\/\/hysslogin.91huayi.com\/callBack\/ticket?homeUrl=" + tmpstr + "%26source=hygw"; window.open(url); return Result; }; this.openLoginGuide = function (aEvent) { var Result = false; var userid = ""; var tmpstr = ""; var loginguidcooke = ""; userid = ""; loginguidcooke = ""; { userid=getCookie('rememberUserID'); loginguidcooke=getCookie('loginGuid'); }; if (loginguidcooke === "yes") { tmpstr = "" + pas.Web.TJSEventHelper.GetTargetElement.call(aEvent)["hystr"]; if (tmpstr === "undefined") { tmpstr = "" + pas.Web.TJSEventHelper.GetTargetElement.call(aEvent).parentElement["hystr"]; }; if (tmpstr === "undefined") { tmpstr = "" + pas.Web.TJSEventHelper.GetTargetElement.call(aEvent).parentElement.parentElement["hystr"]; }; { if (typeof tmpstr === "string" && tmpstr !== "" && tmpstr !== "undefined") { window.location.href = tmpstr; } }; } else { if ((userid != null) && (userid != undefined) && (userid !== "")) { Result = true; } else { Result = false; tmpstr = "" + pas.Web.TJSEventHelper.GetTargetElement.call(aEvent)["hystr"]; if (tmpstr === "undefined") { tmpstr = "" + pas.Web.TJSEventHelper.GetTargetElement.call(aEvent).parentElement["hystr"]; }; if (tmpstr === "undefined") { tmpstr = "" + pas.Web.TJSEventHelper.GetTargetElement.call(aEvent).parentElement.parentElement["hystr"]; }; {window.BEFORELOGINDIVURL=tmpstr; }; window.document.getElementById("popup").style.setProperty("display","block"); }; }; return Result; }; this.openLoginGuideEx = function (url) { var Result = false; var loginguidcooke = ""; loginguidcooke = ""; { loginguidcooke=getCookie('loginGuid'); }; if (loginguidcooke === "yes") { Result = true; } else { Result = false; {window.BEFORELOGINDIVURL=url; }; window.document.getElementById("popup").style.setProperty("display","block"); }; return Result; }; this.openLoginGuideEx2 = function (url) { var Result = false; var loginguidcooke = ""; loginguidcooke = ""; { loginguidcooke=getCookie('loginGuid'); }; if (loginguidcooke === "yes") { { if (typeof url === "string" && url !== "" && url !== "undefined" && (url.startsWith("http") || url.startsWith("/"))) { window.location.href = url; } }; } else { Result = false; {window.BEFORELOGINDIVURL=url; }; window.document.getElementById("popup").style.setProperty("display","block"); }; return Result; }; this.closeLoginGuidClick = function (aEvent) { var Result = false; this.closeLoginGuide(); return Result; }; this.closeLoginGuide = function () { window.document.getElementById("popup").style.setProperty("display","none"); { writeCookieWeek('loginGuid','yes'); //window.location.href=window.BEFORELOGINDIVURL; window.open(window.BEFORELOGINDIVURL); }; }; this.loginGuidTologinClick = function (aevent) { var Result = false; window.document.getElementById("popup").style.setProperty("display","none"); this.loginGuideToLoginSSO(); return Result; }; this.loginGuideToLoginSSO = function () { window.document.getElementById("popup").style.setProperty("display","none"); { writeCookieWeek('loginGuid','yes'); }; window.location.href = "https:\/\/hysso.91huayi.com\/checkLogin?returnUrl=" + "https:\/\/hysslogin.91huayi.com\/callBack\/ticket?homeUrl=" + "https:\/\/www.91huayi.com\/index.html%26source=hygw"; }; this.bindLoginGuidClick = function () { var ls = null; var i = 0; var tmpstr = ""; var userid = ""; { userid=getCookie('rememberUserID'); }; if ((userid != null) && (userid != undefined) && (userid !== "")) { ls = window.document.getElementsByClassName("LOGINGUIDE"); for (var $l = 0, $end = ls.length - 1; $l <= $end; $l++) { i = $l; if ((ls.item(i)["hystr"] != undefined) && (("" + ls.item(i)["hystr"]) !== "")) { ls.item(i).href = "" + ls.item(i)["hystr"]; ls.item(i).removeEventListener("click",rtl.createCallback(this,"openLoginGuide")); }; }; } else { ls = window.document.getElementsByClassName("LOGINGUIDE"); for (var $l1 = 0, $end1 = ls.length - 1; $l1 <= $end1; $l1++) { i = $l1; if ((ls.item(i).href !== "#") && (ls.item(i).href !== "https:\/\/www.91huayi.com\/pcindex.html#") && ((ls.item(i)["hystr"] == undefined) || (("" + ls.item(i)["hystr"]) === ""))) { tmpstr = ls.item(i).href; ls.item(i).href = "#"; ls.item(i)["hystr"] = tmpstr; ls.item(i).onclick = rtl.createSafeCallback(this,"openLoginGuide"); }; }; }; }; this.needLoginHref = function () { var ls = null; var i = 0; try { ls = window.document.getElementsByClassName("needlogin"); for (var $l = 0, $end = ls.length - 1; $l <= $end; $l++) { i = $l; ls.item(i).onclick = rtl.createSafeCallback(this,"needLoginHrefClick"); }; } catch ($e) { }; }; this.checkRCWINDOW = function () { var $Self = this; function checkrc(Event) { var Result = false; function savepi001(Event) { var Result = false; return Result; }; var j = null; var s = ""; var suc = false; var id = ""; var url = ""; var lstatus = 0; var ccs = ""; var cci = 0; var ppid = ""; var scstr = ""; var ajj = null; var userid2 = ""; ppid = ""; lstatus = Event.target.status; s = Event.target.responseText; j = JSON.parse(Event.target.responseText); lstatus = Math.floor(j["code"]); if (lstatus === 201) { url = "" + j["data"]; window.document.getElementById("frarcxtc").style.setProperty("display","block"); window.document.getElementById("frarcxtc").setAttribute("src",url); }; if (lstatus === 200) { suc = !(j["success"] == false); id = "" + j["id"]; url = "" + j["data"]; if (suc === true) { { ccs=getCookie(id); }; if ((ccs == null) || (ccs === "") || (ccs == undefined)) ccs = "0"; cci = pas.SysUtils.StrToInt(ccs); if (cci < 3) { { window.rcwindowid=id; window.rcopenurl=url+'&returnUrl='+window.location.href; ppid=getCookie('rememberUserID'); } { userid2=getCookie('loginid');}; scstr = '{"properties":"{\\"product_name\\":\\"首页人才弹窗弹出\\",\\"the_end\\":\\"web\\",\\"web_channel\\":\\"官网\\"}",' + '"behavior_type":"JobHomepageShow","zshy_user_login_id":"%s","person_id":"%s"}'; scstr = pas.SysUtils.Format(scstr,pas.System.VarRecs(18,userid2,18,ppid)); ajj = $mod.TAjax.$create("Create$1"); ajj.SetOnLoad(rtl.createSafeCallback(null,savepi001)); ajj.POST($mod.SCPOINTURL,scstr); window.document.getElementById("popupjob").style.setProperty("display","block"); window.document.getElementById("rcclose").onclick = rtl.createSafeCallback($Self,"closeRCW"); window.document.getElementById("poptologinRC").onclick = rtl.createSafeCallback($Self,"goRCWS"); }; }; }; return Result; }; var aj = null; var url = ""; var pid = ""; pid = ""; { pid=getCookie('rememberUserID'); }; if ((pid == null) || (pid === "") || (pid == undefined)) {} else { url = "https:\/\/www.huayijob.com\/api\/additional\/information\/is\/complete?cme=0&personId=" + pid + "&returnUrl=" + window.location.href; aj = $mod.TAjax.$create("Create$1"); aj.SetOnLoad(rtl.createSafeCallback(null,checkrc)); aj.GET(url); }; }; this.GetBannerImgsFromSC = function () { var $Self = this; function processBanners(Event) { var Result = false; var i = 0; var j = 0; var reinfo = $mod.bannerRecord.$new(); var s = ""; var jsonObj = null; var A = []; s = Event.target.responseText; jsonObj = JSON.parse(Event.target.responseText); A = rtl.getObject(jsonObj["data"]); for (var $l = 0, $end = rtl.length(A) - 1; $l <= $end; $l++) { i = $l; j = i; jsonObj = A[i]; reinfo.cname = "" + jsonObj["title"]; reinfo.image_url = "" + jsonObj["imageUrl"]; reinfo.jump_url = "" + jsonObj["subTitle"]; $Self.CreateBannerImgAndLis(j,$mod.bannerRecord.$clone(reinfo)); }; { var bannerSlider = new Slider($('#banner_box'), { time: 4000, delay: 500, event: 'hover', auto: true, mode: 'slides', controller: $('#slides_focus'), activeControllerCls: 'selected' }); }; $Self.bindPoints(); return Result; }; var aj = null; var userid = ""; userid = ""; { userid=getCookie('rememberUserID'); }; aj = $mod.TAjax.$create("Create$1"); aj.SetOnLoad(rtl.createSafeCallback(null,processBanners)); aj.POST("https:\/\/xkjspc.91huayi.com\/hyChannelBanner\/listBySectionId?sectionId=section_id_8492119301142&loginId=" + userid,""); }; this.clearBanners = function () { }; this.CreateBannerImgAndLis = function (index, info) { var ul = null; var ol = null; var li = null; var a = null; var img = null; ul = this.GetHTMLElement("banner_box_ul"); ol = this.GetHTMLElement("slides_focus"); if ((ul != null) && (ol != null)) { li = document.createElement("li"); a = document.createElement("a"); a.className = "bannerimg"; a.setAttribute("title",info.cname); a.setAttribute("_title_",info.cname); a.setAttribute("href",info.jump_url); a.setAttribute("target","_blank"); img = document.createElement("img"); img.setAttribute("src",info.image_url); img.setAttribute("alt",info.cname); a.appendChild(img); li.appendChild(a); ul.insertBefore(li,ul.firstElementChild); li = document.createElement("li"); if (index === 0) { li.className = "selected"; }; ol.appendChild(li); }; }; this.checkIfPopSmallRC = function () { var $Self = this; function checkrc2(Event) { var Result = false; var j = null; var lStatus = 0; var s = ""; var code = 0; lStatus = Event.target.status; s = Event.target.responseText; if (lStatus === 200) { j = JSON.parse(Event.target.responseText); code = Math.floor(j["code"]); if (code === 200) { window.document.getElementById("rc_small_pop").style.setProperty("display","block"); $Self.InitDatePicker("jdtest"); window.document.getElementById("btn_rc_small_submit").onclick = rtl.createSafeCallback($Self,"smallRCSUB"); window.document.getElementById("rcclose2").onclick = rtl.createSafeCallback($Self,"smallRCClose"); }; }; return Result; }; var aj = null; var url = ""; var pid = ""; pid = ""; { pid=getCookie('rememberUserID'); }; if ((pid == null) || (pid === "") || (pid == undefined)) {} else { url = "https:\/\/mobile.huayijob.com\/baseuserinfo\/is\/pop\/up?person_id=" + pid; aj = $mod.TAjax.$create("Create$1"); aj.SetOnLoad(rtl.createSafeCallback(null,checkrc2)); aj.GET(url); }; }; this.InitDatePicker = function (elementID) { { jQuery("#"+elementID).datepicker({ dateFormat: 'yy-mm-dd', changeMonth: true, changeYear: true, yearRange: '1900:2030', monthNames: ['一月','二月','三月','四月','五月','六月','七月','八月','九月','十月','十一月','十二月'], monthNamesShort: ['1月','2月','3月','4月','5月','6月','7月','8月','9月','10月','11月','12月'], dayNamesMin: ['日','一','二','三','四','五','六'], prevText: '<上月', nextText: '下月>', currentText: '今天', closeText: '关闭' }); }; }; this.GetSelectedDate = function (elementID) { var Result = ""; var tmpstr = ""; tmpstr = ""; { tmpstr=jQuery("#"+elementID).datepicker('getDate'); }; Result = tmpstr; { Result = jQuery("#"+elementID).datepicker('getDate'); if (Result) { Result = jQuery.datepicker.formatDate('yy-mm-dd', Result); } else { Result = ''; } }; return Result; }; this.setRZINFO = function () { var $Self = this; function postRZ(Event) { var Result = false; var j = null; var jd = null; var s = ""; var lStatus = 0; var identity_auth_status = undefined; var identity_check_status = undefined; var rzheadimg = null; var rzlistimg = null; var rzurlhead = null; var rzurllist = null; var tokenrz = ""; var userid = ""; var ajgj = null; function postRZGJ(Event) { var Result = false; var ds = ""; var dj = null; ds = Event.target.responseText; dj = JSON.parse(Event.target.responseText); if (dj["data"] == false) { if (Math.floor(identity_check_status) === 1) { rzheadimg.src = "https:\/\/hywcmsht.91huayi.com\/images\/yrz_img_reddot_gj.png"; rzlistimg.src = "https:\/\/hywcmsht.91huayi.com\/images\/yrz_img_reddot_gj.png"; }; if (Math.floor(identity_check_status) === 0) { rzheadimg.src = "https:\/\/www.91huayi.com\/images\/shz_img.png"; rzlistimg.src = "https:\/\/www.91huayi.com\/images\/shz_img.png"; }; if ((Math.floor(identity_check_status) === 2) || (Math.floor(identity_check_status) === 4)) { rzheadimg.src = "https:\/\/hywcmsht.91huayi.com\/images\/wrz_img_reddot_gj.png"; rzlistimg.src = "https:\/\/hywcmsht.91huayi.com\/images\/wrz_img_reddot_gj.png"; }; } else { if ((Math.floor(identity_check_status) === 2) || (Math.floor(identity_check_status) === 4)) { rzheadimg.src = "https:\/\/hywcmsht.91huayi.com\/images\/wrz_img_reddot_gj.png"; rzlistimg.src = "https:\/\/hywcmsht.91huayi.com\/images\/wrz_img_reddot_gj.png"; }; }; return Result; }; { tokenrz=getCookie('cookie_user_ticket'); } { userid=getCookie('rememberUserID'); }; rzheadimg = window.document.getElementById("rzheadimg"); rzlistimg = window.document.getElementById("rzlistimg"); rzurlhead = window.document.getElementById("yzurlhead"); rzurllist = window.document.getElementById("rzurllist"); lStatus = Event.target.status; s = Event.target.responseText; if (lStatus === 200) if (s === "error") {} else { $Self.ifssologed.hidden = false; $Self.ssologin.hidden = true; $Self.ssoreg.hidden = true; j = JSON.parse(Event.target.responseText); jd = rtl.getObject(j["body"]); identity_auth_status = jd["identity_auth_status"]; identity_check_status = jd["identity_check_status"]; if (Math.floor(identity_check_status) === 4) { rzheadimg.src = "https:\/\/www.91huayi.com\/images\/wrz_img.png"; rzlistimg.src = "https:\/\/www.91huayi.com\/images\/wrz_img.png"; rzurlhead.target = "_blank"; rzurlhead.href = "https:\/\/ggxmcommon.91huayi.com\/common\/toIdentityForm?token=" + tokenrz; rzurllist.href = "https:\/\/ggxmcommon.91huayi.com\/common\/toIdentityForm?token=" + tokenrz; rzurllist.target = "_blank"; } else { rzurlhead.target = "_blank"; rzurlhead.href = "https:\/\/ggxmcommon.91huayi.com\/common\/toIdentityRes?token=" + tokenrz; rzurllist.href = "https:\/\/ggxmcommon.91huayi.com\/common\/toIdentityRes?token=" + tokenrz; rzurllist.target = "_blank"; }; if (Math.floor(identity_check_status) === 0) { rzheadimg.src = "https:\/\/www.91huayi.com\/images\/shz_img.png"; rzlistimg.src = "https:\/\/www.91huayi.com\/images\/shz_img.png"; }; if (Math.floor(identity_check_status) === 1) { rzheadimg.src = "https:\/\/www.91huayi.com\/images\/yrz_img.png"; rzlistimg.src = "https:\/\/www.91huayi.com\/images\/yrz_img.png"; }; if (Math.floor(identity_check_status) === 2) { rzheadimg.src = "https:\/\/www.91huayi.com\/images\/wrz_img.png"; rzlistimg.src = "https:\/\/www.91huayi.com\/images\/wrz_img.png"; }; }; ajgj = $mod.TAjax.$create("Create$1"); ajgj.SetOnLoad(rtl.createSafeCallback(null,postRZGJ)); ajgj.GET("https:\/\/mobile.huayijob.com\/user\/checkUserInfo\/basic-complete\/education-work-complete2\/" + userid); return Result; }; var token = ""; var aj = null; try { { token=getCookie('cookie_user_ticket'); }; if ((token == null) || (token == undefined) || (token === "")) {} else { aj = $mod.TAjax.$create("Create$1"); aj.SetOnLoad(rtl.createSafeCallback(null,postRZ)); aj.POST("https:\/\/ggxmcommon.91huayi.com\/common\/getIdentityStatus?token=" + token,""); }; } catch ($e) { }; }; this.del91huayicok = function (s) { { // 获取当前时间,转换为 GMT 格式字符串(设置为过去时间以使 Cookie 失效) const pastDate = new Date(0).toUTCString(); // 为了保证兼容性,同时尝试带点和不带点的根域名 const rootDomains = ['.91huayi.com', '91huayi.com']; rootDomains.forEach(domain => { // 使用 expires 方式删除(兼容性最好) document.cookie = `${s}=; expires=${pastDate}; domain=${domain}; path=/;`; // 使用 max-age 方式删除(H5 现代浏览器标准,0表示立即过期) document.cookie = `${s}=; max-age=0; domain=${domain}; path=/;`; }); console.log(`已尝试删除 91huayi.com 域名下的 Cookie: ${s}`); }; }; this.bindflzq = function () { var tmp = null; tmp = this.GetHTMLElement("flzq"); if (tmp !== null) tmp.onclick = rtl.createSafeCallback(this,"flzqClick"); tmp = this.GetHTMLElement("flzztcclose"); if (tmp !== null) tmp.onclick = rtl.createSafeCallback(this,"closeflzq"); tmp = this.GetHTMLElement("goflzq"); if (tmp !== null) tmp.onclick = rtl.createSafeCallback(this,"goflzq"); tmp = this.GetHTMLElement("flzztccancel"); if (tmp !== null) tmp.onclick = rtl.createSafeCallback(this,"closeflzq"); }; this.flzqClick = function (aEvent) { var $Self = this; var Result = false; var token = ""; var pid = ""; var aj = null; function doFlzq(Event) { var Result = false; var j = null; var jd = null; var s = ""; var lStatus = 0; var identity_check_status = undefined; var infoEl = null; var goEl = null; function jfmd() { var Result = false; var mdstr = ""; var userid = ""; var userid2 = ""; { userid=getCookie('rememberUserID'); } { userid2=getCookie('loginid');}; mdstr = '{"properties":"{\\"product_name\\":\\"华医网官网\\",\\"the_end\\":\\"web\\", \\"channel\\":\\"pc首页\\",' + '\\"source\\":\\"pc\\"}",' + '"behavior_type":"MeMyPointsClick","zshy_user_login_id":"%s","person_id":"%s"}'; mdstr = pas.SysUtils.Format(mdstr,pas.System.VarRecs(18,userid,18,userid2)); aj = $mod.TAjax.$create("Create$1"); aj.SetOnLoad(null); aj.POST($mod.SCPOINTURL,mdstr); return Result; }; infoEl = $Self.GetHTMLElement("flrzinfo"); goEl = $Self.GetHTMLElement("goflzq"); lStatus = Event.target.status; s = Event.target.responseText; if (lStatus !== 200) { if (infoEl !== null) infoEl.textContent = "网络异常\uFF0C请稍后重试"; return Result; }; if (s === "error") { if (infoEl !== null) infoEl.textContent = "认证信息获取失败\uFF0C请重新登录"; return Result; }; j = JSON.parse(s); jd = rtl.getObject(j["body"]); identity_check_status = jd["identity_check_status"]; if (Math.floor(identity_check_status) === 1) { window.open($mod.FLZQURL); jfmd(); } else { jfmd(); $Self.GetHTMLElement("flzqtc").style.setProperty("display","block"); if (Math.floor(identity_check_status) === 4) { if (infoEl !== null) infoEl.textContent = "请先完成认证"; if (goEl !== null) goEl.style.setProperty("display","block"); } else if (Math.floor(identity_check_status) === 0) { if (infoEl !== null) infoEl.textContent = "您的认证正在审核中\uFF0C请耐心等待"; if (goEl !== null) goEl.style.setProperty("display","none"); } else if (Math.floor(identity_check_status) === 2) { if (infoEl !== null) infoEl.textContent = "认证未通过\uFF0C请重新认证"; if (goEl !== null) goEl.style.setProperty("display","block"); } else { if (infoEl !== null) infoEl.textContent = "请先完成认证"; if (goEl !== null) goEl.style.setProperty("display","block"); }; }; return Result; }; Result = false; token = ""; pid = ""; { token=getCookie('cookie_user_ticket'); pid=getCookie('rememberUserID'); }; if ((token == null) || (token == undefined) || (token === "") || (pid == null) || (pid == undefined) || (pid === "")) { window.location.href = "https:\/\/hysso.91huayi.com\/checkLogin?returnUrl=https:\/\/hysslogin.91huayi.com" + "\/callBack\/ticket?homeUrl=https%253A%252F%252Fxkjspc.91huayi.com%252Findex%253Fchannel_id%253DA81EBBD8-C593-4D56-A0BB-B17701073FB7%2526source%253Dhygw"; return Result; }; aj = $mod.TAjax.$create("Create$1"); aj.SetOnLoad(rtl.createSafeCallback(null,doFlzq)); aj.POST("https:\/\/ggxmcommon.91huayi.com\/common\/getIdentityStatus?token=" + token,""); return Result; }; this.closeflzq = function (Event) { var Result = false; this.GetHTMLElement("flzqtc").style.setProperty("display","none"); return Result; }; this.goflzq = function (Event) { var Result = false; var tokenrz = ""; tokenrz = ""; { tokenrz=getCookie('cookie_user_ticket'); }; this.GetHTMLElement("flzqtc").style.setProperty("display","none"); window.open("https:\/\/ggxmcommon.91huayi.com\/common\/toIdentityForm?token=" + tokenrz); return Result; }; this.fetchPopupImages = function () { var $Self = this; function onFetchResponse(Event) { var Result = false; var s = ""; var jsonObj = null; var code = 0; var overlay = null; var img = null; s = Event.target.responseText; jsonObj = JSON.parse(s); code = Math.floor(jsonObj["code"]); if (code !== 200) return Result; $Self.popupPics = jsonObj["data"]; if (rtl.length($Self.popupPics) === 0) return Result; { var seenStr = ''; var name = 'popupSeenUrls='; var ca = document.cookie.split(';'); for (var i = 0; i < ca.length; i++) { var c = ca[i].trim(); if (c.indexOf(name) === 0) { seenStr = decodeURIComponent(c.substring(name.length)); } } if (seenStr) { var seenArr = seenStr.split(','); for (var i = $Self.popupPics.length - 1; i >= 0; i--) { if (seenArr.indexOf($Self.popupPics[i].imageUrl) >= 0) { $Self.popupPics.splice(i, 1); } } } }; if (rtl.length($Self.popupPics) === 0) return Result; $Self.popupIdx = 0; overlay = $Self.GetHTMLElement("imagePreviewOverlay"); if (overlay === null) return Result; img = $Self.GetHTMLElement("previewImg"); if (img !== null) img.src = "" + $Self.popupPics[0]["imageUrl"]; if (img !== null) img.onclick = rtl.createSafeCallback($Self,"previewImgClick"); overlay.onclick = rtl.createSafeCallback($Self,"closePreviewImgPopup"); overlay.style.setProperty("display","block"); return Result; }; var aj = null; var pid = ""; pid = ""; { pid=getCookie('rememberUserID'); }; if ((pid === "") || (pid == undefined) || (pid == null)) return; aj = $mod.TAjax.$create("Create$1"); aj.SetOnLoad(rtl.createSafeCallback(null,onFetchResponse)); aj.POST("https:\/\/xkjspc.91huayi.com\/hyChannelBanner\/listBySectionId?sectionId=section_id_8784370153918&loginId=" + pid,""); }; this.previewImgClick = function (Event) { var $Self = this; var Result = false; function savepi001(Event) { var Result = false; if (($Self.popupIdx >= 0) && ($Self.popupIdx < rtl.length($Self.popupPics))) { { var rawUrl = this.popupPics[this.popupIdx].subTitle; if (typeof rawUrl === "string" && rawUrl !== "" && rawUrl !== "undefined") { window.location.href = rawUrl; } }; }; return Result; }; var userid = ""; var userid2 = ""; var str = ""; var st = ""; var aj = null; { Event.stopPropagation(); }; str = '{"properties":"{\\"product_name\\":\\"华医网官网\\",\\"the_end\\":\\"web\\",' + '\\"belonging_location\\":\\"顶部大图\\",\\"homepage_banner_name\\":\\"%s\\",\\"banner_type\\":\\"弹窗\\"}",' + '"behavior_type":"%s","zshy_user_login_id":"%s","person_id":"%s"}'; { userid=getCookie('rememberUserID'); } { userid2=getCookie('loginid');}; st = ""; if (($Self.popupIdx >= 0) && ($Self.popupIdx < rtl.length($Self.popupPics))) { { st = this.popupPics[this.popupIdx].title; }; }; if ((userid != null) && (userid != undefined) && (userid !== "")) { str = pas.SysUtils.Format(str,pas.System.VarRecs(18,st,18,"HomePageBannerClick",18,userid2,18,userid)); aj = $mod.TAjax.$create("Create$1"); aj.SetOnLoad(rtl.createSafeCallback(null,savepi001)); aj.POST($mod.SCPOINTURL,str); }; return Result; }; this.closePreviewImgPopup = function (Event) { var Result = false; var overlay = null; var img = null; { Event.stopPropagation(); }; if ((this.popupIdx >= 0) && (this.popupIdx < rtl.length(this.popupPics))) { { var url = this.popupPics[this.popupIdx].imageUrl; var name = 'popupSeenUrls='; var seenStr = ''; var ca = document.cookie.split(';'); for (var i = 0; i < ca.length; i++) { var c = ca[i].trim(); if (c.indexOf(name) === 0) { seenStr = decodeURIComponent(c.substring(name.length)); } } if (seenStr.indexOf(url) < 0) { var arr = seenStr ? seenStr.split(',') : []; arr.push(url); var d = new Date(); d.setTime(d.getTime() + (24 * 60 * 60 * 1000)); document.cookie = 'popupSeenUrls=' + encodeURIComponent(arr.join(',')) + '; expires=' + d.toUTCString() + '; path=/'; } }; }; overlay = this.GetHTMLElement("imagePreviewOverlay"); if (overlay !== null) overlay.style.setProperty("display","none"); this.popupIdx = this.popupIdx + 1; if (this.popupIdx < rtl.length(this.popupPics)) { img = this.GetHTMLElement("previewImg"); if (img !== null) img.src = "" + this.popupPics[this.popupIdx]["imageUrl"]; if (overlay !== null) overlay.style.setProperty("display","block"); }; return Result; }; this.checkPCPopupDismissed = function () { var $Self = this; function onCheckDismissed(Event) { var Result = false; var s = ""; var showPopup = false; if (Event.target.status !== 200) return Result; s = Event.target.responseText; showPopup = false; { var res = JSON.parse(s); if (res.code === 0 && res.data && res.data.dismissed === false) { showPopup = true; } }; if (showPopup) $Self.showPCPopup(); return Result; }; var aj = null; var pid = ""; var pcPopupCookie = ""; pid = ""; pcPopupCookie = ""; { pcPopupCookie=getCookie('zxpctc'); }; if ((pcPopupCookie !== "") && (pcPopupCookie != undefined) && (pcPopupCookie != null)) return; { pid=getCookie('rememberUserID'); }; if ((pid === "") || (pid == undefined) || (pid == null)) { $Self.showPCPopup(); } else { aj = $mod.TAjax.$create("Create$1"); aj.SetOnLoad(rtl.createSafeCallback(null,onCheckDismissed)); aj.GET($Self.pcPopupBaseUrl + "\/api\/popup\/dismissed?person_id=" + pid); }; }; this.showPCPopup = function () { var overlay = null; var iframe = null; var pcPopupCookie = ""; var pid = ""; pid = ""; pcPopupCookie = ""; { pcPopupCookie=getCookie('zxpctc'); }; if ((pcPopupCookie !== "") && (pcPopupCookie != undefined) && (pcPopupCookie != null)) return; { pid=getCookie('rememberUserID'); }; if ((pid === "") || (pid == undefined) || (pid == null)) pid = ""; overlay = this.GetHTMLElement("pcPopupOverlay"); if (overlay === null) { overlay = document.createElement("div"); overlay.id = "pcPopupOverlay"; overlay.style.setProperty("position","fixed"); overlay.style.setProperty("top","0"); overlay.style.setProperty("left","0"); overlay.style.setProperty("right","0"); overlay.style.setProperty("bottom","0"); overlay.style.setProperty("z-index","9999"); iframe = document.createElement("iframe"); iframe.id = "pcPopupFrame"; iframe.src = this.pcPopupBaseUrl + "\/popup?person_id=" + pid + "&source=PC首页"; iframe.style.setProperty("border","none"); iframe.style.setProperty("width","100%"); iframe.style.setProperty("height","100%"); iframe.style.setProperty("background","transparent"); iframe.setAttribute("allow","same-origin"); overlay.appendChild(iframe); document.body.appendChild(overlay); } else { iframe = this.GetHTMLElement("pcPopupFrame"); if (iframe !== null) { iframe.src = this.pcPopupBaseUrl + "\/popup?person_id=" + pid + "&source=PC首页"; }; }; overlay.style.setProperty("display","block"); }; this.hidePCPopup = function () { var overlay = null; overlay = this.GetHTMLElement("pcPopupOverlay"); if (overlay !== null) overlay.style.setProperty("display","none"); { var d = new Date(); d.setTime(d.getTime() + (24 * 60 * 60 * 1000)); document.cookie = 'zxpctc=1; expires=' + d.toUTCString() + '; path=/'; }; }; var $r = this.$rtti; $r.addField("ssologin",pas.Web.$rtti["TJSHTMLElement"]); $r.addField("ssoreg",pas.Web.$rtti["TJSHTMLElement"]); $r.addField("ssoname",pas.Web.$rtti["TJSHTMLElement"]); $r.addField("ssonameH",pas.Web.$rtti["TJSHTMLElement"]); $r.addField("ifssologed",pas.Web.$rtti["TJSHTMLElement"]); $r.addField("ssolixgxx",pas.Web.$rtti["TJSHTMLElement"]); $r.addField("ssolixxmm",pas.Web.$rtti["TJSHTMLElement"]); $r.addField("ssolicard",pas.Web.$rtti["TJSHTMLElement"]); $r.addField("ssologout",pas.Web.$rtti["TJSHTMLElement"]); $r.addField("ssologoutH",pas.Web.$rtti["TJSHTMLElement"]); $r.addField("closeBtn",pas.Web.$rtti["TJSHTMLElement"]); $r.addField("gohelp",pas.Web.$rtti["TJSHTMLElement"]); $r.addField("poptologin",pas.Web.$rtti["TJSHTMLElement"]); $r.addField("chaxunxuefen1",pas.Web.$rtti["TJSHTMLAnchorElement"]); $r.addField("mpar",rtl.string); $r.addMethod("verifyToken",0,null); $r.addMethod("hyotherverifytoken",0,null); $r.addMethod("refreshToken",0,null); $r.addMethod("setNotLogin",0,null); $r.addMethod("getzhinanList",0,null); $r.addMethod("searchYYBS",0,null); $r.addMethod("bindPoints",0,null); $r.addMethod("WebPageview",0,null); $r.addMethod("needLoginHrefClick",1,[["aEvent",pas.Web.$rtti["TJSMouseEvent"]]],rtl.boolean); $r.addMethod("openLoginGuide",1,[["aEvent",pas.Web.$rtti["TJSMouseEvent"]]],rtl.boolean); $r.addMethod("openLoginGuideEx",1,[["url",rtl.string]],rtl.boolean); $r.addMethod("openLoginGuideEx2",1,[["url",rtl.string]],rtl.boolean); $r.addMethod("closeLoginGuidClick",1,[["aEvent",pas.Web.$rtti["TJSMouseEvent"]]],rtl.boolean); $r.addMethod("closeLoginGuide",0,null); $r.addMethod("loginGuidTologinClick",1,[["aevent",pas.Web.$rtti["TJSMouseEvent"]]],rtl.boolean); $r.addMethod("loginGuideToLoginSSO",0,null); $r.addMethod("bindLoginGuidClick",0,null); $r.addMethod("needLoginHref",0,null); $r.addMethod("checkRCWINDOW",0,null); $r.addMethod("GetBannerImgsFromSC",0,null); $r.addMethod("clearBanners",0,null); $r.addMethod("CreateBannerImgAndLis",0,[["index",rtl.longint],["info",$mod.$rtti["bannerRecord"]]]); $r.addMethod("checkIfPopSmallRC",0,null); $r.addMethod("InitDatePicker",0,[["elementID",rtl.string]]); $r.addMethod("GetSelectedDate",1,[["elementID",rtl.string]],rtl.string); $r.addMethod("setRZINFO",0,null); $r.addMethod("del91huayicok",0,[["s",rtl.string]]); $r.addMethod("bindflzq",0,null); $r.addMethod("flzqClick",1,[["aEvent",pas.Web.$rtti["TJSMouseEvent"]]],rtl.boolean); $r.addMethod("closeflzq",1,[["Event",pas.Web.$rtti["TJSMouseEvent"]]],rtl.boolean); $r.addMethod("goflzq",1,[["Event",pas.Web.$rtti["TJSMouseEvent"]]],rtl.boolean); $r.addMethod("fetchPopupImages",0,null); $r.addMethod("previewImgClick",1,[["Event",pas.Web.$rtti["TJSMouseEvent"]]],rtl.boolean); $r.addMethod("closePreviewImgPopup",1,[["Event",pas.Web.$rtti["TJSMouseEvent"]]],rtl.boolean); $r.addMethod("checkPCPopupDismissed",0,null); $r.addMethod("showPCPopup",0,null); $r.addMethod("hidePCPopup",0,null); }); this.mytimer_ = 0; this.FLZQURL = "https:\/\/integral.91huayi.com\/pc\/"; this.SCPOINTURL = "https:\/\/xkjspc.91huayi.com\/sc\/all\/purpose"; $mod.$main = function () { var $with = $mod.hysso.$create("Create$1",[null]); $with.Initialize(); $with.Run(); $with.bindflzq(); var $with1 = $mod.mytest.$create("Create$1",[null]); $with1.Initialize(); $with1.Run(); }; }); rtl.run(); //# sourceMappingURL=hyssologinguide.js.map