whisper.cat/weboasis/stocks/assets/js/script.min.js

11 lines
43 KiB
JavaScript
Raw Normal View History

2023-10-05 23:28:32 +11:00
/**
* Stock Screener
* --------------------
* Version 1.7.0, built on Tuesday, November 21, 2017
* Copyright (c) Financial Apps and Plugins <info@financialplugins.com>. All rights reserved.
* Demo: http://financialplugins.com/products/stock-screener/
* Purchase: https://codecanyon.net/item/stock-screener/18297488?ref=financialtechnology
* Like: https://www.facebook.com/financialplugins/
*/
function numberWithCommas(e){var a=e.toString().split(".");return a[0]=a[0].replace(/\B(?=(\d{3})+(?!\d))/g,","),a.join(".")}function render_cell_numshort_colored(e,a,t,r){switch(data_new=e,val=e,is_convert=!1,val[val.length-1]){case"K":val=1e3*val.slice(0,-1),is_convert=!0;break;case"M":val=1e6*val.slice(0,-1),is_convert=!0;break;case"B":val=1e9*val.slice(0,-1),is_convert=!0;break;case"%":val=val.slice(0,-1)}return isNaN(val)||(val=parseFloat(val),data_new=is_convert?numberFormat(val):numberWithCommas(val.toFixed(2)),val>0?data_new='<span class="font-green">'+data_new+"</span>":val<0&&(data_new='<span class="font-red">'+data_new+"</span>")),data_new}function render_cell_numshort(e,a,t,r){switch(data_new=e,is_convert=!1,val=e,val[val.length-1]){case"K":val=1e3*val.slice(0,-1),is_convert=!0;break;case"M":val=1e6*val.slice(0,-1),is_convert=!0;break;case"B":val=1e9*val.slice(0,-1),is_convert=!0;break;case"%":val=val.slice(0,-1)}return isNaN(val)||(val=parseFloat(val),data_new=is_convert?numberFormat(val):numberWithCommas(val.toFixed(2))),data_new}function render_cell_numshort_colored_int(e,a,t,r){switch(data_new=e,val=e,is_convert=!1,val[val.length-1]){case"K":val=1e3*val.slice(0,-1),is_convert=!0;break;case"M":val=1e6*val.slice(0,-1),is_convert=!0;break;case"B":val=1e9*val.slice(0,-1),is_convert=!0;break;case"%":val=val.slice(0,-1)}return isNaN(val)||(val=parseFloat(val),data_new=is_convert?numberFormat(val,0):numberWithCommas(val.toFixed(0)),val>0?data_new='<span class="font-green">'+data_new+"</span>":val<0&&(data_new='<span class="font-red">'+data_new+"</span>")),data_new}function render_cell_numshort_int(e,a,t,r){switch(data_new=e,is_convert=!1,val=e,val[val.length-1]){case"K":val=1e3*val.slice(0,-1),is_convert=!0;break;case"M":val=1e6*val.slice(0,-1),is_convert=!0;break;case"B":val=1e9*val.slice(0,-1),is_convert=!0;break;case"%":val=val.slice(0,-1)}return isNaN(val)||(val=parseFloat(val),data_new=is_convert?numberFormat(val,0):numberWithCommas(val.toFixed(0))),data_new}function render_cell_percent_colored(e,a,t,r){switch(data_new=e,val=e,val[val.length-1]){case"K":val=1e3*val.slice(0,-1);break;case"M":val=1e6*val.slice(0,-1);break;case"B":val=1e9*val.slice(0,-1);break;case"%":val=val.slice(0,-1)}return isNaN(val)||(val=parseFloat(val),val>0?data_new='<span class="font-green">'+numberFormat(val)+"%</span>":val<0?data_new='<span class="font-red">'+numberFormat(val)+"%</span>":data_new=numberFormat(val)+"%"),data_new}function render_cell_percent(e,a,t,r){switch(data_new=e,val=e,val[val.length-1]){case"K":val=1e3*val.slice(0,-1);break;case"M":val=1e6*val.slice(0,-1);break;case"B":val=1e9*val.slice(0,-1);break;case"%":val=val.slice(0,-1)}return isNaN(val)||(val=parseFloat(val),data_new=numberFormat(val)+"%"),data_new}function render_cell_percent_colored_int(e,a,t,r){switch(data_new=e,val=e,val[val.length-1]){case"K":val=1e3*val.slice(0,-1);break;case"M":val=1e6*val.slice(0,-1);break;case"B":val=1e9*val.slice(0,-1);break;case"%":val=val.slice(0,-1)}return isNaN(val)||(val=parseFloat(val),val>0?data_new='<span class="font-green">'+numberFormat(val,0)+"%</span>":val<0?data_new='<span class="font-red">'+numberFormat(val,0)+"%</span>":data_new=numberFormat(val,0)+"%"),data_new}function render_cell_percent_int(e,a,t,r){switch(data_new=e,val=e,val[val.length-1]){case"K":val=1e3*val.slice(0,-1);break;case"M":val=1e6*val.slice(0,-1);break;case"B":val=1e9*val.slice(0,-1);break;case"%":val=val.slice(0,-1)}return isNaN(val)||(val=parseFloat(val),data_new=numberFormat(val,0)+"%"),data_new}function stringFill(e,a,t,r){return"undefined"==typeof a&&(a=2),"undefined"==typeof t&&(t="0"),"undefined"==typeof r&&(r=-1),e=e.toString(),e.length>=a?e:(1==r?e:"")+new Array(e.length+(a-e.length)).join(t).toString()+(r==-1?e:"")}function timeFormat(e){return isNaN(e)?e:(h=Math.floor(e/60),m=e%60,t="am",h>12&&(t="pm",h-=12),h.toFixed().toString()+":"+stringFill(m.toFixed())+t)}function dateFormat(e){return new Date(1e3*e).toString("MM/dd/yyyy")}function getUnique(e){for(var a={},t=[],r=0,l=e.length;r<l;++r)a.hasOwnProperty(e[r])||(t.push(e[r]),a[e[r
left:slider_lbl_range_to.position().left})},0),l.append($("#ui-datepicker-div")),$("#ui-datepicker-div").hide()}})),slider.slider({step:.001,range:!0,orientation:"horizontal",min:parseFloat(g),max:parseFloat(b),values:[parseFloat(cur_min),parseFloat(cur_max)],slide:function(e,a){document.activeElement!=slider_lbl_range_from[0]&&slider_lbl_range_from.val(f(a.values[0])),document.activeElement!=slider_lbl_range_to[0]&&slider_lbl_range_to.val(f(a.values[1])),clearTimeout(s),s=setTimeout(function(){void 0==filter_data[cur_market]&&(filter_data[cur_market]={}),void 0==filter_data[cur_market][cur_tab]&&(filter_data[cur_market][cur_tab]={}),void 0==filter_data[cur_market][cur_tab][n]&&(filter_data[cur_market][cur_tab][n]={}),filter_data[cur_market][cur_tab][n].min=(a.values[0]>1e3||a.values[0]<-1e3)&&Math.round(a.values[0])==Math.round(g)||parseFloat(g).toFixed(2)==parseFloat(a.values[0]).toFixed(2)?void 0:parseFloat(parseFloat(a.values[0]).toFixed(2)),filter_data[cur_market][cur_tab][n].max=(a.values[1]>1e3||a.values[1]<-1e3)&&Math.round(a.values[1])==Math.round(b)||parseFloat(b).toFixed(2)==parseFloat(a.values[1]).toFixed(2)?void 0:parseFloat(parseFloat(a.values[1]).toFixed(2)),void 0!=filter_data[cur_market][cur_tab][n].min||void 0!=filter_data[cur_market][cur_tab][n].max?(tbl_api.draw(),$(".column-"+n).addClass("filter-set"),filter_data[cur_market][cur_tab][n].min==filter_data[cur_market][cur_tab][n].max||void 0==filter_data[cur_market][cur_tab][n].min&&filter_data[cur_market][cur_tab][n].max==g||void 0==filter_data[cur_market][cur_tab][n].max&&filter_data[cur_market][cur_tab][n].min==b?$(".column-"+n+" .filter-desc").html(" = "+f(a.values[1])):void 0==filter_data[cur_market][cur_tab][n].min?$(".column-"+n+" .filter-desc").html(" < "+f(a.values[1])):void 0==filter_data[cur_market][cur_tab][n].max?$(".column-"+n+" .filter-desc").html(" > "+f(a.values[0])):$(".column-"+n+" .filter-desc").html(f(a.values[0])+" - "+f(a.values[1]))):($(".column-"+n).removeClass("filter-set"),$(".column-"+n+" .filter-desc").html(""),filter_data[cur_market][cur_tab][n]=void 0,tbl_api.draw())},300)}}),slider_lbl_range_from.on("keyup change",function(){if(v=$(this).val(),d)v=new Date(v),"Invalid Date"!=v&&(v=v.getTime()/1e3,slider.slider("values",0,v)),slider_lbl_range_from.focus();else if(o)r=/^\d{1,2}\:\d\d(am|pm){0,1}$/,v=v.toString().replace(" ",""),r.test(v)&&(h=0,m=0,"am"==v.slice(-2)?(h=12,v=v.slice(0,-2)):"pm"==v.slice(-2)&&(v=v.slice(0,-2)),h+=parseInt(v.split(":")[0]),m+=parseInt(v.split(":")[1]),v=60*h+m,slider.slider("values",0,v));else if(c)v=parseFloat(v),isNaN(v)||slider.slider("values",0,v);else{switch(v[v.length-1]){case"K":v=1e3*v.slice(0,-1);break;case"M":v=1e6*v.slice(0,-1);break;case"B":v=1e9*v.slice(0,-1)}v=parseFloat(v),isNaN(v)||slider.slider("values",0,v)}slider.slider("option","slide")(null,{values:slider.slider("values")})}),slider_lbl_range_to.on("keyup change",function(){if(v=$(this).val(),d)v=new Date(v),"Invalid Date"!=v&&(v=v.getTime()/1e3,slider.slider("values",1,v)),slider_lbl_range_to.focus();else if(o)r=/^\d{1,2}\:\d\d(am|pm){0,1}$/,v=v.toString().replace(" ",""),r.test(v)&&(h=0,m=0,"am"==v.slice(-2)?(h=12,v=v.slice(0,-2)):"pm"==v.slice(-2)&&(v=v.slice(0,-2)),h+=parseInt(v.split(":")[0]),m+=parseInt(v.split(":")[1]),v=60*h+m,slider.slider("values",1,v));else if(c)v=parseFloat(v),isNaN(v)||slider.slider("values",1,v);else{switch(v[v.length-1]){case"K":v=1e3*v.slice(0,-1);break;case"M":v=1e6*v.slice(0,-1);break;case"B":v=1e9*v.slice(0,-1)}v=parseFloat(v),isNaN(v)||slider.slider("values",1,v)}slider.slider("option","slide")(null,{values:slider.slider("values")})}));reset_btn.click(function(){void 0==filter_data[cur_market]&&(filter_data[cur_market]={}),void 0==filter_data[cur_market][cur_tab]&&(filter_data[cur_market][cur_tab]={}),filter_data[cur_market][cur_tab][n]=void 0,tbl_api.draw(),$(".column-"+n).removeClass("filter-set"),$(".column-"+n+" .filter-desc").html(""),f_close()}),tab_idx=2,l.find("*",function(){$(this).attr("tabindex",tab_idx),tab_idx++}),$("body").append(l),p?(l.css("left","0"),l.css("right","0"),