var embeddedQuotesConfigVars = { jsonQuoteUrl: "https://fastquote.fidelity.com/service/quote/json", componentGetUrl: "https://qr.fidelity.com/embeddedquotes/components/get", componentMgetUrl: "https://qr.fidelity.com/embeddedquotes/components/mget", staticfiles : "https://scs.fidelity.com", productid : "default" }; if(typeof embeddedQuotesConfig!="undefined"){ if(typeof embeddedQuotesConfig["jsonQuoteUrl"]!="undefined"){ embeddedQuotesConfigVars["jsonQuoteUrl"]=embeddedQuotesConfig["jsonQuoteUrl"]; } if(typeof embeddedQuotesConfig["componentGetUrl"]!="undefined"){ embeddedQuotesConfigVars["componentGetUrl"]=embeddedQuotesConfig["componentGetUrl"]; } if(typeof embeddedQuotesConfig["componentMgetUrl"]!="undefined"){ embeddedQuotesConfigVars["componentMgetUrl"]=embeddedQuotesConfig["componentMgetUrl"]; } if(typeof embeddedQuotesConfig["componentMgetUrl"]!="undefined"){ embeddedQuotesConfigVars["staticfiles"]=embeddedQuotesConfig["staticfiles"]; } if(typeof fmrProductid!="undefined"){ embeddedQuotesConfigVars["productid"]=fmrProductid; } } function initDefaultEventingImpl(){ try{ var _1=fmr.rct.Container.getInstance().getProvider("eventing"); if(_1){ } } catch(err){ fmr.rct.Container.getInstance().addProvider(new fmr.rct.Provider("eventing")); fmr.rct.Container.getInstance().getProvider("eventing").addServiceProvider(new fmr.rct.eventing.DojoEventingImpl()); fmr.rct.Eventing.getInstance("init").setDefaultProvider("dojo"); } }; dojo.addOnLoad(function(){ fmr.rct.sal.ServiceFactory.addConfig("jsonpQuoting",{facade:{clazz:"fmr.rct.sal.GenericFacade"},handler:{clazz:"fmr.rct.sal.jsonp.DojoJsonpHandler",request:{clazz:"fmr.rct.sal.GenericRequest"},url:embeddedQuotesConfigVars["jsonQuoteUrl"],callbackParamName:"callback",incomingFilters:[{clazz:"fmr.rct.sal.filters.JsonPollingFilter"}]}}); }); dojo.addOnLoad(function(){ fmr.rct.sal.ServiceFactory.addConfig("jsonpMget",{facade:{clazz:"fmr.rct.sal.GenericFacade"},handler:{clazz:"fmr.rct.sal.jsonp.DojoJsonpHandler",request:{clazz:"fmr.rct.sal.GenericRequest"},url:embeddedQuotesConfigVars["componentMgetUrl"],callbackParamName:"callback"}}); }); var quoteEventing; dojo.addOnLoad(function(){ initDefaultEventingImpl(); quoteEventing=new QuoteEventingImpl(); fmr.rct.Container.getInstance().addProvider(new fmr.rct.Provider("quoting")); fmr.rct.Container.getInstance().getProvider("quoting").addServiceProvider(quoteEventing); fmr.rct.Eventing.getInstance().subscribe("onFmrAttachEnd",quoteEventing,"start"); fmrAttach(); }); function QuoteEventingImpl(_2){ this.ServiceProviderName="quotes"; this._quotables=new Array(); this._topics=new Array(); this._marketStatus=0; this._pollingLimit=-1; this._request=null; }; QuoteEventingImpl.prototype.publish=function(_3,_4){ if(arguments.length!=2){ throw new Error("Invalid number of arguments."); } if(typeof (_3)!="string"){ throw new Error("Topic value must be string."); } dojo.publish(_3,[_4]); }; QuoteEventingImpl.prototype.subscribe=function(_5,_6,_7){ if(arguments.length!=3){ throw new Error("Invalid number of arguments."); } if(typeof (_6)!="object"){ throw new Error("_targetObj value must be an object."); } if(typeof (_7)!="string"){ throw new Error("taretFunc value must be a string."); } var _8=_5.split(":"); var _9=_8[0]; var _a=_8[1]; if(_9&&_a){ if(_9=="MARKET_CLOSE"){ quoteEventing._marketStatus="1"; }else{ this._addQuotable(_9); } this._topics.push(_5); return dojo.subscribe(_5,_6,_7); } throw new Error("Unexpected topic format."); }; QuoteEventingImpl.prototype.unsubscribe=function(_b){ if(arguments.length!=1){ throw new Error("Invalid number of arguments."); } dojo.unsubscribe(_b); }; QuoteEventingImpl.prototype._addQuotable=function(_c){ for(var j in this._quotables){ if(this._quotables[j]==_c){ return false; } } this._quotables.push(_c); return true; }; var render=function(_d,_e){ var q=_d["QUOTES"]; for(var i=0;i<_e._topics.length;i++){ var _f=_e._topics[i]; var _10=_f.split(":"); var _11=_10[0]; var _12=_10[1]; if(_11&&_12){ if(_11=="MARKET_CLOSE"){ fmr.rct.Eventing.getInstance("quotes").publish(_f,_d["MARKET_CLOSE"]); }else{ var _13=q[_11]; if(!_13){ continue; } if(!_13[_12]){ } quotefield=_13[_12]; fmr.rct.Eventing.getInstance("quotes").publish(_f,[quotefield,_13]); } }else{ throw new Error("Invalid topic "+_f+" in subscribed list"); } } }; QuoteEventingImpl.prototype.quoteResponder={onResponse:function(_14,_15){ var _16=_15.result.JSON; var q=_14.quoteEventingInstance; render(_16,q); if(q._pollingLimit==-1){ if(typeof _16["POLLING_CONTROL"]=="undefined"){ console.log("no polling control, defaulting limit to 120000"); q._pollingLimit=120000; }else{ q._pollingLimit=_16["POLLING_CONTROL"]["LIMIT"]; } if(q._pollingLimit>0){ setTimeout("quoteEventing.stop()",q._pollingLimit); } } return _15; },onFault:function(_17,_18){ throw new Error("quoteResponder fault"); }}; var getQuotes=function(_19){ var _1a=_19._quotables.toString(); service=fmr.rct.sal.ServiceFactory.getService("jsonpQuoting"); request=service.getRequest({responder:_19.quoteResponder,preventCache:true,pollingInterval:60000,params:{"productid":"embeddedquotes","subproductid":embeddedQuotesConfigVars["productid"],"market_close":quoteEventing._marketStatus,"symbols":_1a}}); request.quoteEventingInstance=_19; _19._request=request; request.send(); }; QuoteEventingImpl.prototype._timerFunction=function(_1b){ return (function(){ getQuotes(_1b); }); }; QuoteEventingImpl.prototype._setQuoteTimer=function(_1c){ var _1d=this._timerFunction(this); if(_1c){ setTimeout(_1d,_1c); } }; QuoteEventingImpl.prototype.stop=function(){ this._request.cancel(); }; QuoteEventingImpl.prototype.start=function(){ this._getQuotables(); if(this._quotables.length!=0){ this._setQuoteTimer(100); } }; QuoteEventingImpl.prototype._getQuotables=function(){ dojo.query("span[quotefield]").forEach(function(_1e){ var _1f=_1e.getAttribute("quotefield"); var _20=_1e.getAttribute("quotehandler"); var _21=_1f.split(":"); var _22=_21[0]; var _23=_21[1]; var _24=_21[2]; if(_23&&_24){ var _25=_23+":"+_24; if(_20){ if(_22=="QUOTES"){ _1e.quoteEventHandler=function(_26,_27){ window[_20].apply(_1e,[_1e,_26,_27]); }; fmr.rct.Eventing.getInstance("quotes").subscribe(_25,_1e,"quoteEventHandler"); }else{ if(_22=="MARKET_STATUS"){ _1e.quoteEventHandler=function(_28,_29){ window[_20].apply(_1e,[_1e,_28,_29]); }; fmr.rct.Eventing.getInstance("quotes").subscribe(_25,_1e,"quoteEventHandler"); } } }else{ _1e.quoteEventHandler=function(_2a){ if(typeof _2a[0]!="undefined"){ _1e.innerHTML=_2a[0]; } }; fmr.rct.Eventing.getInstance("quotes").subscribe(_25,_1e,"quoteEventHandler"); } }else{ console.log("malformed quotefield ('"+_1f+"'), skipping"); } }); }; function publishComponents(_2b){ mget=_2b["MGET"]; for(var i in mget){ fmr.rct.Eventing.getInstance().publish(i,[mget[i]]); } fmr.rct.Eventing.getInstance().publish("onFmrAttachEnd",[new Date()]); try{ var a=dojo.query(".ofSnapBricklet"); for(var i=0;ib)-(a0){ _2e=_2e+"&"; } _2e=_2e+_30; } return _2e; }; }; var mgetResponder={onResponse:function(_31,_32){ var _33=_32.result.JSON; publishComponents(_33); return _32; },onFault:function(_34,_35){ fmr.rct.Eventing.getInstance().publish("onFmrAttachEnd",[new Date()]); }}; function fmrAttach(_36){ var a="fmr-attach-component"; var p="fmr-param-"; var _37=new Array(); var _38=0; dojo.query("span["+a+"]",_36).forEach(function(_39){ var _3a=new Array(); for(var i=0;i<_39.attributes.length;i++){ var _3b=_39.attributes[i].nodeName; if(_3b.substr(0,p.length)==p){ var _3c=_3b.substr(p.length); var _3d=_39.attributes[i].nodeValue; _3a[_3c]=_3d; } } _3a["component"]=_39.getAttribute(a); _3a["_sequence"]=_38++; var _3e=new fmrAttachObj(); _3e.params=_3a; _37.push(_3e); _39.fmrAttachHandler=function(_3f){ __fmrAttach_currentComponent_innerHTML__=this.innerHTML; this.innerHTML=_3f; dojo.query("script",this).forEach(function(_40){ eval(_40.text); }); __fmrAttach_currentComponent_innerHTML__=null; }; fmr.rct.Eventing.getInstance().subscribe(_3e.toQuery(),_39,"fmrAttachHandler"); }); if(_37.length==0){ fmr.rct.Eventing.getInstance().publish("onFmrAttachEnd",[new Date()]); return; } var _41=new Array(); var _42=20; for(var i=0;i<_37.length;i++){ _41.push(_37[i].toQuery(true)); if(i>0&&i%_42==0){ sendMget(_41); _41=new Array(); } } if(_41.length>0){ sendMget(_41); } }; function sendMget(_43){ service=fmr.rct.sal.ServiceFactory.getService("jsonpMget"); request=service.getRequest({responder:mgetResponder,preventCache:true,params:{"productid":embeddedQuotesConfigVars["productid"],"get":_43}}); request.send(); }; var GLOBAL_CONFIG={displayOrientation:fmr.rct.ui.DisplayObject.ORIENTATION_RIGHT,hideConfig:{duration:100},displayConfig:{duration:200,properties:{opacity:{end:100}}},hMargin:0,vMargin:0,watchDelay:200,triggerHoverClass:"ofToolTipHover",triggerEvents:"onfocus,onmouseover"}; function predisplay(argObj) { argObj.forcedPosition = true; var isOR = (argObj.displayOrientation == fmr.rct.ui.DisplayObject.ORIENTATION_RIGHT); var rect = argObj.triggerNode.getBoundingClientRect(); var winSize = getEQViewWindowSize(); var windowWidth = winSize.width; var msWidth = 265; var ax = windowWidth - rect.left; if(isOR && (ax < msWidth) ) //snap will cut on the right side { argObj.displayOrientation = fmr.rct.ui.DisplayObject.ORIENTATION_LEFT; } } function rePositionSnap(argObj, argSymSeq, argScCode) { var isOR = (argObj.displayOrientation == fmr.rct.ui.DisplayObject.ORIENTATION_RIGHT); var isOL = (argObj.displayOrientation == fmr.rct.ui.DisplayObject.ORIENTATION_LEFT); if (isOL || isOR) { var rect = argObj.triggerNode.getBoundingClientRect(); var ofWrapper = dojo.query(".ofBubbleWrapper", argObj.displayNode)[0] var tdOfWrapper = dojo.query("td.TDofBubbleWrapper", argObj.displayNode)[0] var ofWrapRect = dojo.coords(ofWrapper); var ele = argObj.displayNode; var winSize = getEQViewWindowSize(); var windowHeight = winSize.height; var windowWidth = winSize.width; var msHeight = ofWrapRect.h; var msWidth = argObj._displayCoords.w; var trigY = windowYscroll() + rect.top; var trigX = isOR ? rect.right : rect.left; if (windowHeight > msHeight) { var ax = windowWidth - rect.left;//is sufficient width available for display var _fc = dojo.coords(dojo.query(".bubbleTopColumn", argObj.displayNode)[0]).h; var trigH2 = argObj._triggerCoords.h / 2; var c = msHeight/2; var b = rect.top + trigH2; var a = windowHeight - b; var d = 0; var posY = 0; var rePosReqd = false; if (a < c) { d = c-a; posY = trigY - ofWrapRect.h/2 - d - trigH2; rePosReqd = true; } else if (b < c) { d = c-b; if (b > (_fc + 20)) { posY = windowYscroll() } else { posY = windowYscroll() - _fc; } rePosReqd = true; } if ( dojo.isIE < 8 && isOL && argScCode == "E" ) { tdOfWrapper.style.position = "relative"; tdOfWrapper.style.left = "10px"; } //re position snap vertical alignment if(rePosReqd) { ele.style.position="absolute"; ele.style.top = posY + "px"; } var dispBound = ele.getBoundingClientRect(); var arrowY = (( rect.top - dispBound.top - 22 - 1 - 8 + trigH2) ); if(arrowY < 0){ ele.style.top = posY + arrowY + 'px'; arrowY = 0; } if (isOL && rePosReqd) { argObj._rightArrow.style.top = arrowY + "px"; } else if (isOR && rePosReqd) { argObj._leftArrow.style.top = arrowY + "px"; } } } } function windowYscroll() { return window.pageYOffset || document.body.scrollTop || document.documentElement.scrollTop || 0; } function getEQViewWindowSize() { var _110 = 0, _111 = 0; if (typeof (window.innerWidth) == "number") { _110 = window.innerWidth; _111 = window.innerHeight; } else { if (document.documentElement && (document.documentElement.clientWidth || document.documentElement.clientHeight)) { _110 = document.documentElement.clientWidth; _111 = document.documentElement.clientHeight; } else { if (document.body && (document.body.clientWidth || document.body.clientHeight)) { _110 = document.body.clientWidth; _111 = document.body.clientHeight; } } } var _112 = {width: _110, height: _111}; return _112; } //to fix oversized minisnap document.write("");