Files
le-journal-d-un-podcast/assets/js/embed-widget-ticker-tape.js
T
2021-06-17 05:28:44 -04:00

2 lines
11 KiB
JavaScript

!function(){"use strict";var t,e=function(t,i){return(e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i])})(t,i)};var i=((t={})["color-brand"]="#2196f3",t["color-gull-gray"]="#9db2bd",t["color-scooter"]="#38acdb",t["color-curious-blue"]="#299dcd",t);var r=document.createElement("a");function n(t){r.href=t,r.host||(r.href=r.href);var e=r.host;r.pathname;return"http:"===r.protocol&&(e=e.replace(/:80$/,"")),"https:"===r.protocol&&(e=e.replace(/:443$/,"")),{host:e,pathname:("/"===r.pathname[0]?"":"/")+r.pathname,href:r.href}}var o,a,s={events:{width:510,height:600,isTransparent:!1,hideImportanceIndicator:!1,autosize:!1},hotlists:{width:400,height:600,isTransparent:!1,dateRange:"12M",showSymbolLogo:!1},screener:{width:1100,height:512,defaultColumn:"overview",defaultScreen:"general",market:"forex",showToolbar:!0,isTransparent:!1},tickers:{isTransparent:!1,showSymbolLogo:!1},financials:{width:480,height:830,autosize:!1,symbol:"NASDAQ:AAPL",isTransparent:!1,displayMode:"regular",largeChartUrl:""},"crypto-mkt-screener":{width:1e3,height:490,defaultColumn:"overview",market:"crypto",screener_type:"crypto_mkt",displayCurrency:"USD",isTransparent:!1},"forex-cross-rates":{width:770,height:400,isTransparent:!1,currencies:["EUR","USD","JPY","GBP","CHF","AUD","CAD","NZD","CNY"],frameElementId:null,autosize:!1},"forex-heat-map":{width:770,height:400,isTransparent:!1,currencies:["EUR","USD","JPY","GBP","CHF","AUD","CAD","NZD","CNY"],frameElementId:null,autosize:!1},"market-overview":{width:400,height:650,isTransparent:!1,dateRange:"12M",showSymbolLogo:!0},"market-quotes":{width:770,height:450,isTransparent:!1,showSymbolLogo:!1},"mini-symbol-overview":{width:350,height:220,symbol:"FX:EURUSD",dateRange:"12M",trendLineColor:"#37a6ef",underLineColor:"#e3f2fd",isTransparent:!1,autosize:!1,largeChartUrl:""},"single-quote":{width:350,symbol:"FX:EURUSD",isTransparent:!1},"symbol-profile":{width:480,height:650,symbol:"NASDAQ:AAPL",isTransparent:!1},"symbol-info":{width:1e3,symbol:"NASDAQ:AAPL",isTransparent:!1},"technical-analysis":{interval:"1m",width:425,isTransparent:!1,height:450,symbol:"NASDAQ:AAPL",showIntervalTabs:!0},"ticker-tape":{isTransparent:!1,displayMode:"adaptive",showSymbolLogo:!1}};!function(t){!function(t){t.SetSymbol="set-symbol",t.SetInterval="set-interval"}(t.Names||(t.Names={}))}(o||(o={})),function(t){!function(t){t.SymbolClick="tv-widget-symbol-click",t.WidgetLoad="tv-widget-load",t.ResizeIframe="tv-widget-resize-iframe",t.NoData="tv-widget-no-data"}(t.Names||(t.Names={}))}(a||(a={}));var c=["locale","symbol"],h=function(){var t=this;this._getScriptsInfo().forEach((function(e){t._replaceScript(e)}))},l={widgetId:{configurable:!0},widgetUtmName:{configurable:!0},defaultSettings:{configurable:!0},propertiesToWorkWith:{configurable:!0},propertiesToSkipInHash:{configurable:!0},propertiesToAddToGetParams:{configurable:!0}};l.widgetId.get=function(){throw new Error("Method must be overridden")},l.widgetUtmName.get=function(){return this.widgetId},l.defaultSettings.get=function(){return s[this.widgetId]},l.propertiesToWorkWith.get=function(){return[]},h.prototype.filterRawSettings=function(t){var e=this,i={};return Object.keys(t).forEach((function(r){-1!==e.propertiesToWorkWith.indexOf(r)&&(i[r]=t[r])})),i},l.propertiesToSkipInHash.get=function(){return["customer","locale"]},l.propertiesToAddToGetParams.get=function(){return["locale"]},h.prototype._getScriptsInfo=function(){var t=function(){if(document.currentScript)return document.currentScript.src;for(var t=document.getElementsByTagName("script"),e=0;e<t.length;e++)if("interactive"===t[e].readyState)return t[e].src;try{throw new Error}catch(r){var i=/\((.*?):\d+:\d+\)\s*$/m.exec(r.stack);if(i)return i[1]}return null}();if(!t)return console.error("Could not self-replace the script, widget embedding has been aborted"),[];for(var e=n(t),i=e.host,r=e.href,o=document.getElementsByTagName("script"),a=[],s=0;s<o.length;s++){var c=o.item(s);c.src&&n(c.src).href===r&&a.push(c)}var h,l=(void 0===(h=i)&&(h=location.host),-1!==["i18n.tradingview.com","partial.tradingview.com","www.tradingview.com","wwwcn.tradingview.com"].indexOf(h)||-1!==["d33t3vvu2t2yu5.cloudfront.net","dwq4do82y8xi7.cloudfront.net","s.tradingview.com","s3.tradingview.com"].indexOf(h)||h.match(/^[a-z]{2}\.tradingview\.com/)||h.match(/prod-[^.]+.tradingview.com/)?"battle":h.includes("tradingview.com")||h.includes("staging")?"staging":h.match(/webcharts/)?"staging_local":(h.match(/^localhost(:\d+)?$/),"local"));return a.map((function(t){return{scriptHost:i,scriptEnv:l,scriptElement:t}}))},h.prototype._replaceScript=function(t){var e=this,r=t.scriptEnv,n=t.scriptHost,o=t.scriptElement;this.script=o;var s=this._scriptContentToJSON(),c=function(t){if(null===t)return null;var e=t.querySelector("#tradingview-copyright"),i=t.querySelector("#tradingview-quotes"),r=e||i;return r&&t.removeChild(r),r}(this.script.parentNode),h=!!this.script.parentNode.querySelector(".tradingview-widget-copyright");this.hasCopyright=c||h,s&&(this.settings=this.filterRawSettings(s)),s&&this._isValidSettings()||(console.error("Invalid settings provided, fall back to defaults"),this.settings=this.filterRawSettings(this.defaultSettings));var l,d="32px",p=isNaN(this.settings.height)?this.settings.height:this.settings.height+"px",g=isNaN(this.settings.width)?this.settings.width:this.settings.width+"px",u=this.script.parentNode.classList.contains("tradingview-widget-container");this.script.parentNode&&u?this.iframeContainer=this.script.parentNode:this.iframeContainer=document.createElement("div"),this.iframeContainer.style.width=g,this.iframeContainer.style.height=p,this.iframeContainer.appendChild(((l=document.createElement("style")).innerHTML="\n\t.tradingview-widget-copyright {\n\t\tfont-size: 13px !important;\n\t\tline-height: 32px !important;\n\t\ttext-align: center !important;\n\t\tvertical-align: middle !important;\n\t\tfont-family: 'Trebuchet MS', Arial, sans-serif !important;\n\t\tcolor: "+i["color-gull-gray"]+" !important;\n\t}\n\n\t.tradingview-widget-copyright .blue-text {\n\t\tcolor: "+i["color-brand"]+" !important;\n\t}\n\n\t.tradingview-widget-copyright a {\n\t\ttext-decoration: none !important;\n\t\tcolor: "+i["color-gull-gray"]+" !important;\n\t}\n\n\t.tradingview-widget-copyright a:visited {\n\t\tcolor: "+i["color-gull-gray"]+" !important;\n\t}\n\n\t.tradingview-widget-copyright a:hover .blue-text {\n\t\tcolor: "+i["color-scooter"]+" !important;\n\t}\n\n\t.tradingview-widget-copyright a:active .blue-text {\n\t\tcolor: "+i["color-curious-blue"]+" !important;\n\t}\n\n\t.tradingview-widget-copyright a:visited .blue-text {\n\t\tcolor: "+i["color-brand"]+" !important;\n\t}\n\t",l));var m=c&&!this.settings.whitelabel,f=this.hasCopyright?"calc("+p+" - "+"32px)":p;this.settings.utm_source=location.hostname,this.settings.utm_medium=h?"widget_new":"widget",this.settings.utm_campaign=this.widgetUtmName,this.iframe=this._createIframe(f,g,n,r,o.id);var w=this.iframeContainer.querySelector(".tradingview-widget-container__widget");if(w?(this.script.parentNode.replaceChild(this.iframe,w),this.script.parentNode.removeChild(this.script)):u?(this.iframeContainer.appendChild(this.iframe),this.script.parentNode.removeChild(this.script)):(this.iframeContainer.appendChild(this.iframe),this.script.parentNode.replaceChild(this.iframeContainer,this.script)),function(t,e,i){var r=e.contentWindow;if(!r)return console.error("Cannot listen to the event from the provided iframe, contentWindow is not available"),function(){};function n(e){e.source&&e.source===r&&e.data&&e.data.name&&e.data.name===t&&i(e.data.data)}window.addEventListener("message",n,!1)}(a.Names.ResizeIframe,this.iframe,(function(t){t.width&&(e.iframe.style.width=t.width+"px",e.iframeContainer.style.width=t.width+"px"),e.iframe.style.height=t.height+"px",e.iframeContainer.style.height=t.height+(e.hasCopyright?32:0)+"px"})),m){var y=document.createElement("div");y.style.height=d,y.style.lineHeight=d,y.style.width=g,y.style.textAlign="center",y.style.verticalAlign="middle",y.innerHTML=c.innerHTML,this.iframeContainer.appendChild(y)}},h.prototype._iframeSrcBase=function(t,e){var i="https://s.tradingview.com";return this.settings.useWidgetHost?i="https://www.tradingview-widget.com":"local"===e?i="http://"+t:"staging"===e&&(i=-1!==t.indexOf("beta.tradingview.com")?"https://betacdn.tradingview.com":"https://"+t),i+="/embed-widget/"+this.widgetId+"/",this.settings.customer&&-1!==this.propertiesToSkipInHash.indexOf("customer")&&(i+=this.settings.customer+"/"),i},h.prototype._isValidSettings=function(){var t=function(t){if(void 0===t)return!0;var e=parseInt(t)+"%"==t+"";return parseInt(t)+""==t+""||e||"auto"===t};return t(this.settings.width)&&t(this.settings.height)},h.prototype._buildGetQueryString=function(){var t=this.propertiesToAddToGetParams.filter((function(t){return-1!==c.indexOf(t)}));return 0===t.length?"":"?"+function(t){var e=[];for(var i in t)t.hasOwnProperty(i)&&null!=t[i]&&e.push({key:i,pair:encodeURIComponent(i)+"="+encodeURIComponent(t[i])});return e.sort((function(t,e){return t.key>e.key?1:t.key<e.key?-1:0})).map((function(t){return t.pair})).join("&")}(function(t,e){for(var i=Object.create(Object.getPrototypeOf(t)),r=0,n=e;r<n.length;r++){var o=n[r];Object.prototype.hasOwnProperty.call(t,o)&&(i[o]=t[o])}return i}(this.settings,t))},h.prototype._buildHashString=function(t){var e=this,i={};return t&&(i.frameElementId=t),Object.keys(this.settings).forEach((function(t){-1===e.propertiesToSkipInHash.indexOf(t)&&(i[t]=e.settings[t])})),Object.keys(i).length>0?"#"+encodeURIComponent(JSON.stringify(i)):""},h.prototype._scriptContentToJSON=function(){var t=this.script.innerHTML.trim();try{return JSON.parse(t)}catch(e){return console.error("Widget settings parse error: "+e),null}},h.prototype._createIframe=function(t,e,i,r,n){var o=document.createElement("iframe");n&&(o.id=n),this.settings.enableScrolling||o.setAttribute("scrolling","no"),o.setAttribute("allowtransparency",!0),o.setAttribute("frameborder",0),o.style.boxSizing="border-box",o.style.height=t,o.style.width=e;var a=this._iframeSrcBase(i,r)+this._buildGetQueryString()+this._buildHashString(n);return o.setAttribute("src",a),o},Object.defineProperties(h.prototype,l);var d,p=767;!function(t){t.Adaptive="adaptive",t.Regular="regular",t.Compact="compact"}(d||(d={}));var g=p;new(function(t){function i(){return null!==t&&t.apply(this,arguments)||this}return function(t,i){function r(){this.constructor=t}e(t,i),t.prototype=null===i?Object.create(i):(r.prototype=i.prototype,new r)}(i,t),Object.defineProperty(i.prototype,"widgetId",{get:function(){return"ticker-tape"},enumerable:!1,configurable:!0}),i.prototype.filterRawSettings=function(e){void 0!==e.theme&&(e.colorTheme=e.theme);var i,r,n,o,a,s,c,h=t.prototype.filterRawSettings.call(this,e);h.width="100%";try{i=this.script.parentNode.getBoundingClientRect().width}finally{h.height=(r=e.displayMode,n=e.isTransparent,o=this.hasCopyright,a=i,c=r===d.Adaptive&&a?a<=g:r===d.Compact,s=c?72:44,n||(s+=2),o&&(s+=32),s)}return h},Object.defineProperty(i.prototype,"propertiesToWorkWith",{get:function(){return["symbols","locale","showSymbolLogo","colorTheme","isTransparent","largeChartUrl","displayMode","customer","useWidgetHost"]},enumerable:!1,configurable:!0}),i}(h))}();