function getInternetExplorerVersion() { var rv = -1; if (navigator.appName == 'Microsoft Internet Explorer') { var ua = navigator.userAgent; var re = new RegExp("MSIE ([0-9]{1,}[\.0-9]{0,})"); if (re.exec(ua) != null) rv = parseFloat( RegExp.$1 ); } else if (navigator.appName == 'Netscape') { var ua = navigator.userAgent; var re = new RegExp("Trident/.*rv:([0-9]{1,}[\.0-9]{0,})"); if (re.exec(ua) != null) rv = parseFloat( RegExp.$1 ); } return rv; } var ieVersion = getInternetExplorerVersion(); if (ieVersion != 7 && ieVersion != 8) { document.write(""); document.write(""); document.write(""); } 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; } } //enable disable default params values updateWithDefaultParamConfig(_3a); _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,"eqV2":"true","needMiniChart":"true"}}); 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; var mn = windowHeight - ofWrapRect.y - msHeight; if (mn < 0) { posY = windowHeight - msHeight - 22 + windowYscroll(); var arrowPY = windowHeight - rect.top - trigH2 - 12; if (arrowPY < 0) { posY = posY - arrowPY; } rePosReqd = true; } /*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(""); function updateWithDefaultParamConfig(_3a) { if (_3a["symbol"] && window.defConfParam) { for (var key in window.defConfParam) { if (_3a[key] == undefined) { _3a[key] = defConfParam[key]; } } } } var mgetResponderWithoutAttachEnd={ onResponse:function(_31,data){ var jsonData=data.result.JSON; publishComponentsWithoutAttachEnd(jsonData); return data; }, onFault:function(_34,_35){ // Do nothing } }; function publishComponentsWithoutAttachEnd(gets){ mget=gets["MGET"]; for(var i in mget){ fmr.rct.Eventing.getInstance().publish(i,[mget[i]]); } } function customsendMget(getsArray){ service=fmr.rct.sal.ServiceFactory.getService("jsonpMget"); request=service.getRequest({responder:mgetResponderWithoutAttachEnd,preventCache:true,params:{"productid":embeddedQuotesConfigVars["productid"],"get":getsArray,"eqV2":"true"}}); request.send(); } function attachMSEvents(node, argChunkSize, argRunCustomSendMGet) { // attribute name to identify it is an attach declaration var a = 'fmr-attach-component'; // prefix for attribute names that are parameters var p = 'fmr-param-'; // an array of all the discovered components in the order we encounter them var compObjs = new Array(); // needed to create the internal 'sequence' parameter dojo.query ("span[" + a + "]", node).forEach ( function (inputElement) { // collect all the fmr-param's for this component // these are identified by the prefix 'p' (e.g., fmr-param) var component = new Array(); for (var i = 0; i < inputElement.attributes.length; i++) { var attribName = inputElement.attributes[i].nodeName; if (attribName.substr(0, p.length) == p) { // actual parameter name is the string with the prefix removed var paramName = attribName.substr(p.length); var paramValue = inputElement.attributes[i].nodeValue; component[paramName] = paramValue; } } //enable disable default params values updateWithDefaultParamConfig(component); // the component name itself becomes a parameter too component['component'] = inputElement.getAttribute(a); // make each component request unique by providing a sequence id if (typeof window.minisnapCompNumber === "undefined") { window.minisnapCompNumber = 200; } // this is simply just the loop counter component['_sequence'] = minisnapCompNumber++; //initially s was named as _sequence // use a handy object to keep it tidy var compObj = new fmrAttachObj(); compObj.params = component; // add to our collection compObjs.push(compObj); // make a generic handler function part of the node inputElement.fmrAttachHandler = function (dataIn) { // the original innerHTML is made available to components by saving it // to a pre-determined global (a nasty long one to avoid var clashes) __fmrAttach_currentComponent_innerHTML__ = this.innerHTML; this.innerHTML = dataIn; dojo.query("script", this).forEach ( function(inputScript) { eval(inputScript.text); } ); // clear the var so next component doesnt get it by accident __fmrAttach_currentComponent_innerHTML__ = null; }; // subscribe to the component request key // when the component is available the event will be published and then all nodes that // are listening will get it attached to them. fmr.rct.Eventing.getInstance().subscribe(compObj.toQuery(), inputElement, "fmrAttachHandler"); } ); if (compObjs.length == 0) { // If there are no components, then we are done so let everyone know. // We dont need to bother calling the server, just return out of here. fmr.rct.Eventing.getInstance().publish ("onFmrAttachEnd", [new Date()]); return; } // Chunk the compObjs into multiple mget requests so that we don't end up making a // single request with an insanely long url, which could hit the limit in IE and // lead to a failure. var gets = new Array(); var chunkSize = argChunkSize || 20; for (var i = 0; i < compObjs.length; i++) { gets.push(compObjs[i].toQuery(true)); // use compact form if (i > 0 && i % chunkSize == 0){ if (argRunCustomSendMGet){ customsendMget(gets); } else{ sendMget(gets); } gets = new Array(); // start clean for next chunk } } if (gets.length > 0) { if (argRunCustomSendMGet){ customsendMget(gets); } else{ sendMget(gets); } // send the remainder } } function triggerMeasurement(argSecType) { //trigger Measurement calls var securityClass = secAbbreviations[argSecType] || argSecType; if (typeof jQuery=='undefined') { console.log("JQuery loading still somehow failed. Measurement triggers will not be fired"); } else { // jQuery was already loaded jQuery(document).trigger('TMS_TRIGGER','EQ_Minisnap_' + securityClass); } } dojo.addOnLoad(function(){ if(typeof jQuery=='undefined') { var headTag = document.getElementsByTagName("head")[0]; var jqTag = document.createElement('script'); jqTag.type = 'text/javascript'; jqTag.src = 'https://scs.fidelity.com/products/minichart/scripts/jquery-1.11.1.min.js'; headTag.appendChild(jqTag); } }); //Security classification abbreviations used for measurement trigger var secAbbreviations = { "CommonStock" : "CS", "PreferredStock" : "PS", "CEF" : "CEF", "ETF" : "ETF", "M" : "MF", "R" : "MMF", "A" : "ANN", "O" : "OPN", "I" : "INDEX" }; //checks if the DTT div/scripts are loaded. If not, it will continue with the current flow else it will call the seed function in dtt script function seedDtt(urlobj){ if(typeof seedATicket == 'function'){ var jsonInput = ""; var queryString = (urlobj.href).split('?'); //splitting a string will create a Javascript obj/JSON obj queryString = queryString[1].split('&'); var i; //create a JSON format string jsonInput = "[{"; for(i = 0; i < queryString.length; i++){ jsonInput += '"' +queryString[i].split('=')[0] + '":"' +queryString[i].split('=')[1] + '"'; if(i <(queryString.length-1)){ jsonInput += ','; } } jsonInput += "}]"; seedATicket(JSON.parse(jsonInput)); return false; } else{ //go to the href url return true; } };