function ClickIndexChart(n){var i=$(n).attr("data-index-code");const r=i.split("."),t=r[0];t&&(window.location.href=WCFrontpage.Link.URL_Stock_10_02_06+"?symbol="+t)}function BindChartData(n){var u=!0,f=null,t;n.dataPoint.length>0&&(f=n.dataPoint[0].DateObj());f==null&&(u=!1);t=null;n.dataPoint.length>0&&(t=n.dataPoint[n.dataPoint.length-1].DateObj());t==null&&(u=!1);u&&f.getDate()==t.getDate()&&f.getHours()>=13&&(u=!1);u||(t=new Date);for(var d=n.symbol,e=null,y=null,o=null,s=null,p=null,h=null,w=null,a="",c=[],b=new Date(t.getFullYear(),t.getMonth(),t.getDate(),9,35,0),g=new Date(t.getFullYear(),t.getMonth(),t.getDate(),12,0,0),k=new Date(t.getFullYear(),t.getMonth(),t.getDate(),13,5,0),nt=new Date(t.getFullYear(),t.getMonth(),t.getDate(),16,0,0),r=b;r<=nt;){r>g&&r0?(i=i[0],r==b&&(w=i.PC),a==""&&(a=i.Month()+i.Day()),c.push({x:l,y:i.C,t:v}),(e==null||i.H>e)&&(e=i.H),(o==null||i.C>o)&&(o=i.C,y=l),(s==null||i.L0)for(i=0;i0)for(o=0;o<\/div>").html(n).text()}function u(n,t){var r={},u;return n==0?r={s:null,status:n}:(u=3,u=t.s11=="SHEx"?2:3,r={status:n,id:"",s:"",name:"",callput:"",marketID:"",type:"",exchangeMarket:"",dp:function(){return this.exchangeMarket=="SHEx"?2:3},prev_close:"",last:"",change:function(){var n=null,u=null,t="",i=this.getPrevClose(),r=this.last.replace(",","");return!isNaN(i)&&!isNaN(r)&&parseFloat(r)>0&&parseFloat(i)>0?(_chg=parseFloat(r)-parseFloat(i),_pctChg=_chg/parseFloat(i)*100,n=_chg.toFixed(this.dp()),u=Math.abs(_pctChg).toFixed(3)+"%",n>0?(t="+",n=t+n):t=n<0?"-":"",{c:n,pc:u,cs:t,_c:_chg,_pc:_pctChg}):{c:"N/A",pc:"N/A",cs:"",_c:0,_pc:0}},ipoOfferingPrice:"",listingDate:"",getPrevClose:function(){var n,i,t;return this.ipoOfferingPrice==""||this.listingDate==""?this.prev_close.replace(",",""):this.listingDate!=""&&((n=new Date(this.listingDate+"T00:00:00+08:00"),i=new Date,n.isTheSameDate(i))||n.getDay()==5&&(n.setDate(n.getDate()+3),t=new Date(n.getTime()),t.setHours(t.getHours()+6),t>i))?this.ipoOfferingPrice.replace(",",""):this.prev_close.replace(",","")}},r.id=i(t.s0,r.id),r.s=i(t.s1,r.s),r.name=o(s(t,"s2","s3","s4")),r.callput=i(t.s31,r.callput),r.marketID=i(t.s8,r.marketID),r.type=h(r.marketID),r.exchangeMarket=i(t.s11,r.exchangeMarket),r.ipoOfferingPrice=i(t.s114,r.ipoOfferingPrice),r.listingDate=i(t.s115,r.listingDate),r.prev_close=i(t.d1,r.prev_close),r.last=i(t.d2,r.last)),r}function r(n){return n==null||typeof n=="undefined"?!0:!1}function i(n,t){return r(n)?t:n}function s(t,i,u,f){var e=n.lang=="sc"?u:n.lang=="en"?f:i;return r(t[e])?"":t[e]}function h(n){var t="";switch(n){case"23":t="Warrant";break;case"24":t="CBBC"}return t}var f=n.url||hostUrl;$.ajax({url:f+"/g2ce/Quote/getQuote?format=json"+n.token,data:{grp0:n.symbol+"|"+n.group0},async:!0,dataType:"json",error:function(n,i){typeof t=="function"&&t({status:"E",msg:i})},success:function(n){var i=e(n);typeof t=="function"&&(n&&n.length!=0?t({status:"S",data:i}):t({status:"N"}))}})}function GetStockHistory(){var t=$("#stocksHisContent tbody"),i=AAUtility.GetWCSymbolListCookie(),n,r,u;if(i&&i.length>0&&i[0].length>0){for(n="",r=0;r=5)break;i[x].s5=i[x].s.replace(".HK","");r+='';r+='
<\/div>';r+="
"+h(i[x].name)+"<\/span>
";r+=''+i[x].s+"<\/a><\/div><\/td>";r+=''+o(i[x].last)+"<\/span><\/td>";r+=""+e(i[x].change())+"<\/td><\/tr>";u++}t.append(r+"");t.is(":empty")||$("#stocksHisContent").show()}}function e(n){var t=n.cs=="+"?"pos":n.cs=="-"?"neg":"unc";return''+n.cs+n.pc+"<\/span>"}function o(n){let t=parseFloat(n);return isNaN(t)?"N/A":t.toFixed(3)}function s(n,t){var i="";switch(n){case"Warrant":switch(t){case"C":i="dc_call20";break;case"P":i="dc_put20"}break;case"CBBC":switch(t){case"C":i="dc_bull20";break;case"P":i="dc_bear20"}}return i}function y(n,t,i,r){try{switch(n){case"EN":let n=t,u="";switch(i){case"Warrant":let t=n.lastIndexOf("@");if(t!==-1){let i=n.substring(0,t),r=i.substring(2),f=r.trim().replace(/^-+|-+$/g,"");u=f}else console.log("'@' not found in the string.");break;case"CBBC":let i=n.lastIndexOf("R"+r);if(i!==-1){let t=n.substring(0,i),r=t.substring(2),f=r.trim().replace(/^_+|_+$/g,"");u=f}else console.log("'R"+r+"' not found in the string.")}return u;default:return t.substring(0,2)}}catch(u){console.log("FormatUnderlying: "+u)}return""}function h(n){if(n!==null&&n!==undefined){var t=n.toString();return WCFrontpage.Lang==="EN"?c(t,12).replace("...",""):t.length>6?t.substring(0,6).replace("...",""):t}return""}function c(n,t){let i=0,u="",r="";u=n.includes(" ")?n.substring(n.indexOf(" "),n.length-n.indexOf(" ")):n;try{for(let n=0;nt)break}return i=n?l:a,t.yAxis.plotLines[1].label.y=10),t.yAxis.max=p,n>u&&(o=u)),f!=null&&(t.yAxis.plotLines[2].value=f,c&&(t.yAxis.plotLines[2].label.text=parseInt(f).toLocaleString("en"),t.yAxis.plotLines[2].label.style.color=f>=n?l:a,t.yAxis.plotLines[2].label.y=-3),t.yAxis.min=w,n0&&this.yAxis[0].plotLinesAndBands.length>0&&this.yAxis[0].plotLinesAndBands[0].label!=null&&$(this.yAxis[0].plotLinesAndBands[0].label.element).html("
"+parseInt(this.yAxis[0].plotLinesAndBands[0].label.textStr).toLocaleString("en")+"<\/div>")})}catch(g){console.log(g.message)}}var u={width:60,height:40,tick:3,enablePrevCloseLabel:!0,enableHighLowLabel:!0,enableXAxisLabel:!0},r=$(this),v=r.attr("data-width")||u.width,y=r.attr("data-height")||u.height,b=r.attr("data-symbol"),e=r.attr("data-prev-close"),k=r.attr("data-high"),d=r.attr("data-low"),o=n.label&&n.label.x||115,s=n.tick||u.tick,h=typeof n.enablePrevCloseLabel=="boolean"?n.enablePrevCloseLabel:u.enablePrevCloseLabel,c=typeof n.enableHighLowLabel=="boolean"?n.enableHighLowLabel:u.enableHighLowLabel,p=typeof n.enableXAxisLabel=="boolean"?n.enableXAxisLabel:u.enableXAxisLabel,f;s==5?f=[0,29,65]:s==3&&(f=[0,49,109]);var l="#118a5b",a="#ec6579",i=n.data,t={chart:{marginRight:5,marginLeft:5,marginTop:7,marginBottom:20,spacing:[0,0,0,0],backgroundColor:"transparent",type:"area"},rangeSelector:{selected:1},credits:{enabled:!1},legend:{enabled:!1},title:{text:null},plotOptions:{area:{borderColor:"#0473A8",color:"#0473A8",threshold:null,startOnTick:!1,endOnTick:!1,fillColor:{linearGradient:{x1:0,x2:0,y1:0,y2:1},stops:[[0,"#3193B8"],[1,"#FFFFFF"]]}},series:{connectNulls:!0,animation:{duration:500}}},xAxis:{labels:{enabled:!0,formatter:function(){return""},style:{fontSize:12,fontFamily:"arial",color:"#a0a0a0"},y:14},title:{text:null},gridLineWidth:0,lineWidth:1,lineColor:"#e9e9e9",tickWidth:0,tickPositions:f,plotLines:[{label:{enabled:!1},title:{text:null}}]},yAxis:{labels:{enabled:!1},title:{text:null},gridLineWidth:0,startOnTick:!1,endOnTick:!1,plotLines:[{label:{enabled:!1,x:0,y:3,useHTML:!0,style:{fontSize:12,fontFamily:"helvetica",color:"#000"},formatter:function(){return this.options.label.text}},color:"#999999",width:1,value:10,dashStyle:"dot",title:{text:null},zIndex:999},{label:{enabled:!0,style:{fontSize:12,fontFamily:"helvetica",color:"#5ec47e"},x:o,y:0},color:"transparent",width:1,title:{text:null},zIndex:999},{label:{enabled:!0,style:{fontSize:12,fontFamily:"helvetica",color:"#5ec47e"},y:0,x:o},color:"transparent",width:1,title:{text:null},zIndex:999}]},tooltip:{enabled:!1},series:[{marker:{enabled:!1},enableMouseTracking:!1,color:"green",tooltip:{valueDecimals:2},lineWidth:1,data:null}]};t=$.extend(!0,{},t,n.chartOption);p||(t.chart.marginBottom=5,t.xAxis.lineWidth=0,t.xAxis.labels.enabled=!1);w()};var IntradayChartData=function(){function t(){this.ID=null;this.D=null;this.O=null;this.H=null;this.L=null;this.C=null;this.V=null;this.T=null;this.PC=null;this.Period=null;this.Month=function(){if(this.D!=null){var n=this.D.split(" ");return n[0].split("/")[0]}return""};this.Day=function(){if(this.D!=null){var n=this.D.split(" ");return n[0].split("/")[1]}return""};this.Hour=function(){if(this.D!=null){var n=this.D.split(" ");return n[1].split(":")[0]}return""};this.Minute=function(){if(this.D!=null){var n=this.D.split(" ");return n[1].split(":")[1]}return""};this.Second=function(){if(this.D!=null){var n=this.D.split(" ");return n[1].split(":")[2]}return""};this.DateString=function(){return this.D!=null?this.Month()+"/"+this.Day()+" "+this.Hour()+":"+this.Minute():""};this.DateObj=function(){if(this.D!=null){var n=new Date;return n.setMonth(parseInt(this.Month(),10)-1),n.setDate(parseInt(this.Day(),10)),n.setHours(parseInt(this.Hour(),10)),n.setMinutes(parseInt(this.Minute(),10)),n.setSeconds(parseInt(this.Second(),10)),n.setMilliseconds(0),n}return null}}function i(n){return typeof n!="undefined"&&n.indexOf(".")>=0?n.substr(n.lastIndexOf(".")+1):""}function r(){return new Date(ServerDate)}function u(t,u,f){var h=[],l=[],o=[],v=[],c,e,a,s,b,k,y,p;for(h=t.split("!"),l=h.length>=1?h[0].split("|"):[],o=h.length>=2?h[1].split("|"):[],v=l.length>2?l.slice(2,l.length):[],o=o.length>0?o.slice(0,o.length):[],b=v.length,k=o.length,c=null,y=0;ytt||(n.AddDataPoint(a,parseFloat(e[2]),parseFloat(e[3]),parseFloat(e[4]),parseFloat(e[5]),parseFloat(e[6]),parseFloat(e[7]),c),c=parseFloat(e[5])));h=null;l=null;o=null;v=null;c=null;e=null;a=null;s=null}var n=this;this.symbol="";this.period=7;this.dataType="R";this.ServerTime=null;this.InitialDate=null;this.dataPoint=[];this.dataID=0;this.histDataPoint=[];this.histDataID=0;this.Clear=function(){this.dataPoint=[];this.dataID=0;this.histDataPoint=[];this.histDataID=0};this.BindData=function(n,t,i,r){this.Clear();this.symbol=i;this.period=t;this.dataType=r||"R";n.indexOf("|")>=0&&(n=n.substr(n.indexOf("|"),n.length));u(n,r,i)};this.AddHistDataPoint=function(n,i,r,u,f,e,o,s){var h=new t;h.ID=this.histDataID++;h.D=n;h.O=i;h.H=r;h.L=u;h.C=f;h.V=e;h.T=o;h.PC=s;h.Period=this.period;this.histDataPoint.push(h)};this.AddDataPoint=function(n,i,r,u,f,e,o,s){var h=new t;h.ID=this.dataID++;h.D=n;h.O=i;h.H=r;h.L=u;h.C=f;h.V=e;h.T=o;h.PC=s;h.Period=this.period;this.dataPoint.push(h)}}