1/** 2 * Stock Market Charts 3 * --------------------------------------------- 4 * Version 1.1.0, built on Thursday, February 8, 2018 5 * Copyright (c) Financial Apps and Plugins <[email protected]>. All rights reserved. 6 * Demo: https://financialplugins.com/products/stock-market-charts 7 * Purchase: https://codecanyon.net/item/stock-market-charts-for-wordpress/21154327?ref=financialtechnology 8 * Like: https://www.facebook.com/financialplugins/ 9 */ 10"use strict";var stockMarketChartsPlugin=function(e,a){function o(o,i,n,d){function c(a){if(t("addComparison",a),"undefined"!=typeof f)if(u(),e.inArray(a,g)==-1)e.ajax({url:smcGlobals.ajaxUrl,method:"post",dataType:"json",data:{action:smcGlobals.ajaxGetData,symbol:a,range:n}}).done(function(e){if(t("response",e),e.success){g.push(a);var o={title:e.symbol,assetSymbol:a,compared:!0,fieldMappings:[{fromField:"value",toField:"value"},{fromField:"volume",toField:"volume"}],dataProvider:e.data,categoryField:"time"};f.dataSets.push(o),f.comparedDataSets.push(o),f.validateData(),m()}else setTimeout(function(){m()},3e3)});else{for(var o=0;o<f.dataSets.length;o++)f.dataSets[o].assetSymbol==a&&(f.dataSets[o].compared=!0);f.validateData(),m()}}function p(e){t("deleteComparison",e);for(var a=0;a<f.dataSets.length;a++)f.dataSets[a].assetSymbol==e&&(f.dataSets[a].compared=!1);f.validateData()}function u(){}function m(){}function h(e,a){var o;if("candlestick"==a.type){var t=AmCharts.formatNumber(e.values.open,{precision:-1,decimalSeparator:d.decimalSeparator||".",thousandsSeparator:d.thousandsSeparator||","},d.precision||2),r=AmCharts.formatNumber(e.values.high,{precision:-1,decimalSeparator:d.decimalSeparator||".",thousandsSeparator:d.thousandsSeparator||","},d.precision||2),l=AmCharts.formatNumber(e.values.low,{precision:-1,decimalSeparator:d.decimalSeparator||".",thousandsSeparator:d.thousandsSeparator||","},d.precision||2),s=AmCharts.formatNumber(e.values.close,{precision:-1,decimalSeparator:d.decimalSeparator||".",thousandsSeparator:d.thousandsSeparator||","},d.precision||2);o='<div class="amcharts-tooltip"><div>'+a.title+"</div><table><tbody><tr><td>"+(smcGlobals.text.open||"Open")+":</td><td><b>"+t+"</b></td></tr><tr><td>"+(smcGlobals.text.high||"High")+":</td><td><b>"+r+"</b></td></tr><tr><td>"+(smcGlobals.text.low||"Low")+":</td><td><b>"+l+"</b></td></tr><tr><td>"+(smcGlobals.text.close||"Close")+":</td><td><b>"+s+"</b></td></tr></tbody></table></div>"}else{var i=AmCharts.formatNumber(e.values.value,{precision:-1,decimalSeparator:d.decimalSeparator||".",thousandsSeparator:d.thousandsSeparator||","},d.precision||2);o='<div class="amcharts-tooltip">'+a.title+": <b>"+i+"</b></div>"}return o}var f,g=[],b=[],y=e("#"+o),v=((new Date).getUTCHours(),(new Date).getUTCMinutes(),{"1
10D":{period:"mm",count:300},"1W":{period:"DD",count:7},"2W":{period:"DD",count:14},"1M":{period:"MM",count:1},"3M":{period:"MM",count:3},"6M":{period:"MM",count:6},YTD:{period:"YTD"},"1Y":{period:"YYYY",count:1},"2Y":{period:"YYYY",count:2},"5Y":{period:"YYYY",count:5},ALL:{period:"MAX"}});for(var C in v)v.hasOwnProperty(C)&&("undefined"!=typeof smcGlobals.text.amCharts&&"undefined"!=typeof smcGlobals.text.amCharts.periods?v[C].label=smcGlobals.text.amCharts.periods[C]:v[C].label=C);d=d||{},t("chartSettings",i,n,d),y.css({width:d.width||"100%",height:d.height||"500px",fontSize:d.fontSize||14,color:d.color||"#383838",background:d.backgroundColor||"#fff"}),y.prepend('<div class="'+l+'-chart-comparison"> <select class="'+s+'" multiple="multiple"></select></div><div id="'+o+'-chart" class="'+l+'-chart"></div>');var S=y.find("."+s);S.stockMarketChartsPlugin().initAssetAutocomplete();var x={type:"stock",language:smcGlobals.lang||"en",mouseWheelScrollEnabled:d.mouseWheelZoomEnabled||!1,categoryAxesSettings:{minPeriod:"mm",color:d.color||"#383838",gridColor:d.gridColor||"#e0e0e0",gridAlpha:d.gridAlpha||.8,gridThickness:"undefined"!=typeof d.gridThickness?d.gridThickness:1,groupToPeriods:["15mm","30mm","DD","WW","MM"],equalSpacing:!0,minHorizontalGap:100,autoGridCount:!0,dateFormats:[{period:"fff",format:"JJ:NN:SS"},{period:"ss",format:"JJ:NN:SS"},{period:"mm",format:"JJ:NN"},{period:"hh",format:"JJ:NN"},{period:"DD",format:"DD MMM"},{period:"WW",format:"DD MMM"},{period:"MM",format:"MMM YY"},{period:"YYYY",format:"YYYY"}]},dataSets:[{dataLoader:{url:smcGlobals.ajaxUrl+"?action="+smcGlobals.ajaxGetData+"&symbol="+i+"&range="+n,format:"json",postProcess:function(e,a,o){return t("response",e),e.data}},title:i,fieldMappings:[{fromField:"value",toField:"value"},{fromField:"volume",toField:"volume"}],categoryField:"time"}],panelsSettings:{usePrefixes:d.usePrefixes||!1,fontSize:d.fontSize||14,marginTop:d.marginTop||0,marginRight:d.marginRight||10,marginBottom:d.marginBottom||0,marginLeft:d.marginLeft||10,backgroundColor:d.backgroundColor,backgroundAlpha:0,startDuration:0,thousandsSeparator:d.thousandsSeparator||",",decimalSeparator:d.decimalSeparator||".",precision:d.precision||2,percentPrecision:d.precision||2,creditsPosition:"bottom-left"},panels:[{showCategoryAxis:!0,title:d.primaryPanelTitle||"Price",percentHeight:70,drawingIconsEnabled:!0,eraseAll:!0,stockGraphs:[{id:"mainGraph",type:d.primaryChartType||"smoothedLine",valueField:"value",lineColor:d.primaryLineColor||"#00842c",fillAlphas:d.primaryLineColorAlpha||.15,lineThickness:"undefined"!=typeof d.primaryLineThickness?d.primaryLineThickness:2,comparable:!0,compareGraph:{type:d.primaryChartType&&"candlestick"!=d.primaryChartType?d.primaryChartType:"smoothedLine",fillAlphas:d.primaryLineColorAlpha||.15,lineThickness:"undefined"!=typeof d.primaryLineThickness?d.primaryLineThickness:2,balloonText:"[[title]]: <b>[[value]]</b>"},balloonFunction:h,compareGraphBalloonFunction:h,useDataSetColors:!1}],stockLegend:{enabled:"undefined"==typeof d.legendEnabled||d.legendEnabled,color:d.color||"#383838",fontSize:d.fontSize||14,backgroundColor:d.backgroundColor||"#fff",backgroundAlpha:0,useGraphSettings:!0,equalWidths:!1,valueWidth:150,valueText:"[[value]] ",valueTextRegular:"[[value]] ",valueTextComparing:"[[percents.value]]%",periodValueText:"[[value.close]]",periodValueTextRegular:"[[value.close]]",periodValueTextComparing:"[[percents.value.close]]%"},valueAxes:[{position:"right",color:d.color||"#383838",gridColor:d.gridColor||"#e0e0e0",gridAlpha:d.gridAlpha||.8,gridThickness:"undefined"!=typeof d.gridThickness?d.gridThickness:1}]},{title:d.secondaryPanelTitle||"Volume",percentHeight:30,precision:0,stockGraphs:[{valueField:"volume",type:d.secondaryChartType||"column",showBalloon:!0,lineColor:d.secondaryLineColor||"#00842c",fillAlphas:d.secondaryLineColorAlpha||.15,lineThickness:"undefined"!=typeof d.secondaryLineThickness?d.secondaryLineThickness:1,balloonText:"[[title]]: <b>[[value]]</b>",useDataSetColors:!1,comparable:!0,periodValue:"Sum",compareGraph:{type:d.secondaryChartType||"column",fillAlphas:d.secondaryLineColorAlpha||.15,lineThickness:"undefined"!=typeof d.secondaryLineThickness?d.secondaryLineThickness:1,balloonText:"[[title]]: <b>[[value]]</b>"}}],stockLegend:{color:d.color||"#383838",valueText:"[[value]]",valueTextRegular:"[[value]]",valueTextComparing:"[[percents.value]]%",periodValueText:"[[value.close]]",periodValueTextRegular:"[[value.close]]",periodValueTextComparing:"[[percents.value.close]]%"},valueAxes:[{position:"right",color:d.color||"#383838",gridColor:d.gridColor||"#e0e0e0",gridAlpha:d.gridAlpha||.8,gridThickness:"undefined"!=typeof d.gridThickness?d.gridThickness:1}]}],chartScrollbarSettings:{graph:"mainGraph",graphType:"smoothedLine",enabled:"undefined"==typeof d.scrollbarEnabled||d.scrollbarEnabled,color:d.color||"#383838",backgroundColor:d.scrollbarBackgroun
10dColor||"#e8e8e8",backgroundAlpha:1,selectedBackgroundColor:d.scrollbarSelectedBackgroundColor||"#f7f7f7",selectedBackgroundAlpha:1,graphFillColor:d.scrollbarGraphFillColor||"#004c19",graphFillAlpha:1,selectedGraphFillColor:d.scrollbarSelectedGraphFillColor||"#00aa38",selectedGraphFillAlpha:1,gridColor:d.gridColor||"#e0e0e0",gridAlpha:d.gridAlpha||.8,gridThickness:"undefined"!=typeof d.gridThickness?d.gridThickness:1},chartCursorSettings:{enabled:"undefined"==typeof d.cursorEnabled||d.cursorEnabled,cursorColor:d.cursorColor||"#ba0000",cursorAlpha:d.cursorAlpha||.8,valueLineAlpha:d.cursorAlpha||.8,valueBalloonsEnabled:!0,graphBulletSize:1,valueLineBalloonEnabled:!0,valueLineEnabled:!0,categoryBalloonColor:d.cursorColor||"#ba0000",categoryBalloonAlpha:d.cursorAlpha||.8},periodSelector:{position:"top",periodsText:"",inputFieldsEnabled:!1,periods:[]},dataSetSelector:{position:""},comparedDataSets:[],"export":{enabled:"undefined"==typeof d.exportEnabled||d.exportEnabled,position:"top-right"},listeners:[{event:"init",method:function(){}}]};"candlestick"==d.primaryChartType&&(x.panels[0].stockGraphs[0].openField="open",x.panels[0].stockGraphs[0].lowField="low",x.panels[0].stockGraphs[0].highField="high",x.panels[0].stockGraphs[0].closeField="value",x.panels[0].stockGraphs[0].proCandlesticks=!0,x.dataSets[0].fieldMappings.push({fromField:"open",toField:"open"}),x.dataSets[0].fieldMappings.push({fromField:"low",toField:"low"}),x.dataSets[0].fieldMappings.push({fromField:"high",toField:"high"}));for(var T="undefined"!=typeof d.periods?d.periods.split(","):["1W","1M","6M","1Y","ALL"],k=d.defaultPeriod||"1M",G=0;G<T.length;G++){var A=T[G];"undefined"!=typeof v[A]&&(x.periodSelector.periods[G]=v[A],A==k?x.periodSelector.periods[G].selected=!0:x.periodSelector.periods[G].selected=!1)}f=a.makeChart(o+"-chart",x),S.on("change",function(){var a=e(this),o=a.val();if(o){var t=r(b,o),l=r(o,b);t.length&&p(t[0]),l.length&&c(l[0]),b=o}else{for(var s=0;s<b.length;s++)p(b[s]);b=[]}})}function t(){smcGlobals.debug&&console.log("SMC",arguments)}function r(e,a){return a?e.filter(function(e){return a.indexOf(e)<0}):[]}t("smcGlobals",smcGlobals);var l=smcGlobals.code,s=l+"-asset-autocomplete";return"undefined"!=typeof smcGlobals.lang&&"undefined"!=typeof smcGlobals.text.amCharts&&"undefined"!=typeof smcGlobals.text.amCharts["export"]&&(a.translations["export"][smcGlobals.lang]=smcGlobals.text.amCharts["export"]),"undefined"!=typeof smcGlobals.lang&&"undefined"!=typeof smcGlobals.text.amCharts&&"undefined"!=typeof smcGlobals.text.amCharts.dataLoader&&(a.translations.dataLoader[smcGlobals.lang]=smcGlobals.text.amCharts.dataLoader),e.fn.stockMarketChartsPlugin=function(){var a=this,o=e(this);return{initAssetAutocomplete:function(){return a.select2({allowClear:!!o.attr("multiple"),placeholder:"undefined"!=typeof smcGlobals.text.select2?smcGlobals.text.select2.placeholder:"Symbol or asset name",containerCssClass:l+"-select2-container",dropdownCssClass:l+"-select2-dropdown",ajax:{url:smcGlobals.ajaxUrl,dataType:"json",delay:250,data:function(e){return{action:smcGlobals.ajaxSymbolAutocomplete,q:e.term}},processResults:function(e,a){return a.page=a.page||1,{results:e}},cache:!0},language:{noResults:function(){return"undefined"!=typeof smcGlobals.text.select2?smcGlobals.text.select2.search_not_found:"No results found"},errorLoading:function(){return"undefined"!=typeof smcGlobals.text.select2?smcGlobals.text.select2.search_error:"There was an error, please try again."},inputTooShort:function(){return"undefined"!=typeof smcGlobals.text.select2?smcGlobals.text.select2.search_short:"Enter at least 2 characters"},searching:function(){return"undefined"!=typeof smcGlobals.text.select2?smcGlobals.text.select2.searching:"Searching..."}},escapeMarkup:function(e){return e},minimumInputLength:1,templateResult:function(e){return e.loading?e.name:'<div class="smc-symbol-search-row"> <span class="smc-symbol-search-symbol">'+e.id+'</span> <span class="smc-symbol-search-exch">'+e["class"]+" - "+e.exchange+"</span></div><div>"+e.name+"</div>"},templateSelection:function(e){return e.id}})}}},{buildChart:o,log:t}}(jQuery,AmCharts);
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.