コードページ (function($) { $.csv2table={ charset :
'utf-8', //デフォルトCSSをリセットする } $.fn.csv2table= function (url,setting){ if(!setting)var setting={}; if(op.row_sep=='\n')op.row_sep_reg='\r\n' //Custom Selectors //$(contents).before('<div
class="csv2table-loading"><img src="'+op.nowloadingImg+'">
'+op.nowloadingMsg+' </div>' ) var fetch_param= (url.indexOf("?") != -1) ?
"&":"?"; $.get(fetch_url,"",function(data,textStatus){ $.csv2table.wrtTable=function(colIndex,id,callback){ $.csv2table.reset=function(id){ function
orderWk(ary,sortType,colIndex){ function mkRowsAry(id,data,sortType,colIndex){ var
rowsAry=null,rewrite=true,//zanntei if(sortType &&
rewrite){ if(op.where){ var
sikis='',siki='',colValue='',value='',colNo=null; if(typeof
op.where[j].length=='number'){ } else
ok=errLog('op.where operetor'); if(value.match(/^==(.*)/g)){ } else
if(value.match(/^like\s*(.*)/g)){ var reg=
RegExp.$1; } else
if(chkThreeComma(_rowsAry[i][colNo])){ } else
{ } catch(e) { return; } if(eval(sikis) &&
ok)rowsAry.unshift(_rowsAry[i]); resetSortImg(id); if(op.limit){ var tableHtm=mkTable(id,rowsAry); return tableHtm; function
errLog(msg){ function
getColNoAndValue(opr,colNamesArry){ function chkCompOpr(siki){ function chkSiki(siki){ function
mkTable(id,rowsAry){ //見出し行の処理 var
si=$('#'+id+'-sortimg-'+k)[0], htm+= "<th
id='"+id+"-th-"+k+"'>" if(op.sortable) if(!op['th'+k])op['th'+k]=null;//memo of
sortType //data行の処理 var
tableHtm=$.csv2table._doc.getElementById(id) return tableHtm; } if(!dataAry)return ; sortType=sortType.toUpperCase(); var
ci=colIndex, (sortType=="D")? if(are3comma !=
'null'){ } else
{ if(!a[ci])
{ if(""+a[ci] === ""+b[ci])return
0; function
escapeStrComma(col_sep,row_sep,oj,removeDoubleQuote){ //mk dmy for comma in " var
reg='(["](.|(\r\n|\r|\n))*?(["]$|["][,('+op.row_sep_reg+')]))', escape=
oj.replace('""',dmystr_wDquote); } var
b=[],rowlen=r.length,collen=r[0].length; function
mkSelectedArray(data,col_sep,row_sep,select){ function
setDefault(settingName,val){ function chkThreeComma(data){ //$.csv2table.cssDefault.className_divなどを変えるとデフォルトCSSを変更できます function setCSS(id){ $('#'+id+'').css($.csv2table.cssDefault.className_div).addClass(op.className_div) var tableWith =
parseFloat($.csv2table.setting[id].width); $('#'+id+' table
th').css($.csv2table.cssDefault.className_table_th).addClass(op.className_table_th) var numTD=$('#'+id+' table
td:_csv2table_hoboNum') if(op.sortable){ function resetSortImg(id,index){ function useChart
(id,op,data,ary){ var chartdata =
{ ccchart.init(op.use_api_box,
chartdata); var jqc; })(jQuery);
name :
'csv2table',
version :
'0.02-b-4.7',
update :
'2014.4.25',
update :
'http://jsgt.org/lib/jquery/plugin/csv2table/v002/update.txt',
ver
: '<span class="csv2tableVersion"
style="color:#aaa"></span><script>jQuery(function($){
$(".csv2tableVersion").html("version:csv2table-"+$.csv2table.version)
})</script>',
blog :
'http://ngw.jp/~tato/wp/?p=163',
demo
:
'http://jsgt.org/lib/jquery/plugin/csv2table/v002/test.htm',
author
: 'Toshiro Takahashi',
lisence : 'Public Domain',
cssReset:
function(){
this.cssDefault =
{
className_div :
{},
className_table :
{},
className_table_th :
{},
className_table_td :
{},
className_hoboNum :
{},
className_sortMark :
{},
className_legends :
{}
}
},
//デフォルトCSS
$.csv2table.cssDefault.className_table_tdなどを変えることでデフォルトCSSを変更できます
cssDefault:
{
className_div :
{
'padding'
:
'10px',
'margin'
:
'1px'
},
className_table
: {
'border-collapse' :
'collapse',
'border-spacing'
:
'0px',
'margin-bottom'
: '10px'
},
className_table_th :
{
'border-color'
: '#eee #999 #777
#bbb',
'border-style'
:
'solid',
'border-width'
: '1px',
'background-color' :
'#ccc',
'font-size'
:
'12px',
'padding'
:
'4px',
'text-align'
: 'center'
},
className_table_td
:
{
'border-color'
: '#eee #aaa #999
#ccc',
'border-style'
:
'solid',
'border-width'
:
'1px',
'padding'
:
'8px',
'font-size'
:
'12px'
},
className_hoboNum
: {},
className_sortMark :
{
'font-family' :
'MS Pゴシック',
'text-decoration' :
'none'
},
className_legends
: {},
},
//画像
loadImg :
(new
Image()).src='data:image/gif;base64,R0lGODlhMAAwAPYAAHZ2dnp6epGRkaWlpaurq62trbCwsLW1tbm5ub6+vsLCwsXFxcrKyszMzNPT09TU1N7e3uHh4efn5+vr6+zs7PDw8PX19fr6+v///3t7e39/f4CAgIeHh4qKio2NjZKSkpWVlZ+fn6KioqioqK+vr7a2tru7u729vcvLy9LS0t/f3+Dg4Obm5vLy8vT09Pv7+3h4eIODg4iIiIyMjJCQkJeXl5ubm52dnampqdjY2LGxsX5+fomJiZaWlqGhodnZ2X19fYGBgZSUlJiYmJycnLKysnl5eaampqqqqqysrL+/v8DAwMbGxsnJydbW1u/v7/f39/n5+bq6us7OzuLi4gAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACH/C05FVFNDQVBFMi4wAwEAAAAh/i1NYWRlIGJ5IEtyYXNpbWlyYSBOZWpjaGV2YSAod3d3LmxvYWRpbmZvLm5ldCkAIfkEAAoA/wAsAAAAADAAMAAABf8gJo5kaZ5oqq5k9TwVK88lEgQIrcsGABS73WThOPV+J8eCEixRCgPCxFTwAUsTaGHaFFUOg4HiUqoiS4rwwdIdQQjRSNlnKEXgA0h7dEmEEWwjZnUjFghhCWR7IhJwBA8kR4QiD3BbiyQMaooYBgEAk4ZhDE0UgSVfClwikiQTCgdMJhWrJlkHEJwjFbqddCUXMcAQB5cnC2EDCRIsrSsSCXgLKA54UQzCKM4oFAzWBUUor9YH2SY9AZOzYGEEqiwRh2K9kb8oF2kECHIzFw8Htc4BSKdiAoIHp2jQK7ENRUJM9UBBbNJw4oyKQSo02MiRAT8VniQ+Y8CAYwMH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AAAAMAAwAAAH/4AYgoOEhYaHiImKi4QtVFQtjJKThVMDA1OUmpKWmJubKiQnL4adKIcPCxOfhRIyAEEqpZenhRMkAySrrIIUNAAAIi6Vl5mFCgMiJcO8gigwABrGgyjFhVQjAyOyzYIuIcBCkYOd0xguUpcKpN2CDxrAJ4RUCyhUhD+XI7vtgiPAMiQoepHO0ycKzGy9AkBi0QQFJSgccsHP0K0SKtgROgEsyI9FL8YReqGiRJGKhBaI0HYCZQshwERonPTw0oAFiB7g0odCJIYp8GCYW0QBRbZLJFIkenh0QAmRL0QAoyGRUYsSNkcoQGnoBRUp2dYRUhEEmBRJL5ANkHJv0osHUv+4FgEokNEEKQ9mTkpIaIIHYCP29jsGTMODwZ9aDAEWgi9iSSngAcDZzsUUFFMuX26L6MUAYEP0HqKiGXNmZlRsqq6ViIoMDWcZVVO9sm1q1bQYUckoaTZubi0ya978GAMV08N9Fl/OvLlzDKJ5RQcJl+unCSXyUvqqbrpbtWy9C2Jq82m3q1m3JkqxUxuKqt2KkliZS2nXBfrUP55w4ihliyRgJFoL4o2kHHQlnbSUY72UoJ8iFEB04DkTFHhIJ1KIR1BuiE1w1EeDHLcAZxg8kM0+g6V1iRR8lUMIOpeM0o8KJ5L4E4chHsVNMy6UsJICswzAmiAv4OcUg5rckgsmV7MNhQEFuJAAHy8TLGBfIU0eksICUzLn4nOKfAkmIo5AMuaYgQAAOw==',//'./img/icon-loadinfo.gif',
//Dafault loading IMG
sortNImg : (new
Image()).src='data:image/gif;base64,R0lGODlhCwAJAIAAAP///4GBgSH5BAUUAAAALAAAAAALAAkAAAIRhB2nGLnQ4or0WUbdyVZebRQAOw==',//'./img/icon-n.gif',
//Dafault sort IMG N
sortDImg : (new
Image()).src='data:image/gif;base64,R0lGODlhCwAJAIABADCCaPFzMCH+EUNyZWF0ZWQgd2l0aCBHSU1QACH5BAEKAAEALAAAAAALAAkAAAIOjI+pu+APEozqsUCvVgUAOw==',//'./img/icon-d-green.gif',
//Dafault sort IMG D
sortAImg : (new
Image()).src='data:image/gif;base64,R0lGODlhCwAJAIABADCCaPFzMCH5BAEKAAEALAAAAAALAAkAAAINjI+pCmsAF5xpWoezKwA7'
,//'./img/icon-a-green.gif', //Dafault sort IMG
A
setting :
[],
data :
[],
_rowsAry :
[],
_doc :
document,
err :
[],
f :
{
classifyByCol:function(id,colIndex,myCompAry,nolegend){
var
toj=$('table',$('#'+id)),oj=$('tr >
td:nth-child('+(colIndex+1)+')',toj)
if(!nolegend){
var
legend=($('#csv2table-legend-'+id).length==0)?
$('<div
class="csv2table-legends"
id="csv2table-legend-'+id+'"></div>'):$('#csv2table-legend-'+id);
toj.after(
legend.append(
$('<div
class="csv2table-legends"
id="csv2table-legend-'+id+'-'+colIndex+'"></div>')
.append($.csv2table._rowsAry[id][0][colIndex]+'
')
)
)
}
//Eg.
myCompAry is
[['>10','#eee'],['>30','#ddd'],['>50','#bbb']]
$.each(myCompAry,function(){
oj
.filter(':_csv2table_myComp('+this[0]+')')
.css('background',this[1])
if(!nolegend){
var
hanrei='<span
style="background-color:'+this[1]+'">'
+' </span>
'
$('#csv2table-legend-'+id+'-'+colIndex)
.append(hanrei+this[0].split('<').join('<')+' '
)
}
})
}
}
var
contents=$.fn.csv2table.el=this,id=this[0].id,
op =
$.csv2table.setting[id] =
$.extend({
url
: url,
//nowloadingImg
:
$.csv2table.loadImg,
//Image of now
loading...
//nowloadingMsg
:
'読み込中です...',
//Massege of now
loading...
sortNImg
:
$.csv2table.sortNImg,
//Sort IMG
N
sortDImg
:
$.csv2table.sortDImg,
//Sort IMG
D
sortAImg
:
$.csv2table.sortAImg,
//Sort IMG A
removeDoubleQuote :
true,
// remove " of
"hogehoge"
appendThead
:
null,
//Array. Append a Row of Thead.(e.g.
["Name","Address"])
col_midasi
:
0,
//
row_sep
:
'\n',
//Separator of rows. default
'\n'
col_sep
:
',',
//Separator(,|\t|;) of cols. default
','
sortable
:
true,
//col
sort
select
:
'*',
//select col lists. default '*' is all
cols.
orderBy
:
null,
//array of sort col.
orderBy:[[colNo|'colName','sortType']]
where
:
null,
//array of where : [{'ColName':'condition'}]
etc.
limit
:
null,
//array of limit :
[offset,len]
col0color
:
true,
//col[0] color sync jQchart
line_strokeStyle
numArignRight
:
true,
//Set the Number TD to "textAlign :
'right'"
onload
:
null,
//collback function (id,op,data,ary)
{}
use
:
null,
//
'jqchart:line#canvasID'
className_div
:
'csv2table-div',
//className
className_table :
'csv2table-table',
//className
className_table_th :
'csv2table-table-th',
//className
className_table_td :
'csv2table-table-td',
//className
className_hoboNum :
'csv2table-hoboNum',
//className
className_sortMark :
'csv2table-sortMark',
//className
className_legends :
'csv2table-legends'
//className
},setting);
if(op.use){
//use :
'jqchart:bar#canvasMyID',
op.use_api
= op.use.split(':')[0]
op.use_api_charttype =
op.use.split('#')[0]
op.use_api_type =
op.use_api_charttype.split(':')[1]
op.use_api_box
= op.use.split(':')[1].split('#')[1]
}
$.extend($.expr[":"],
{
//_csv2table_hoboNum is match to number or
Number-like (3 digit + comma)
//for Set the Number TD
to "textAlign : 'right'"
_csv2table_hoboNum :
function(a,i,m){
var b =
a.textContent||a.innerText||$(a).text()||"",
c
=
Number(
chkThreeComma(b).split(",").join("")
);
return
!isNaN(b) ||
!isNaN(c);
},
//
_csv2table_myComp
: function(a,i,m){
var b =
Number(
(a.textContent||a.innerText||$(a).text()||"")
.replace("
","")
.replace(/,/g,'')
);
return
typeof b=='number'?
eval(b+m[3]):false;
}
});
var fetch_url = url + fetch_param + (new
Date()).getTime(); //2013.04.11 Thanx MORI Shingo @babydaemons
if(op.appendThead)data=op.appendThead.join(op.col_sep)+op.row_sep+data;
$.csv2table.data[id]=data;
$(".csv2table-loading").fadeOut();
$(contents).css("display","none").html(mkRowsAry(id,data));
setCSS(id);
$(contents).fadeIn();
if(op.use_api=='jqchart'){
if(op.use_api_charttype=='jqchart:line')op.type=$.csv2table.setting[id].type='line';
else
if(op.use_api_charttype=='jqchart:bar')op.type=$.csv2table.setting[id].type='bar';
useChart(id,op,data,$.csv2table._rowsAry[id]);
}
else
if(op.use_api=='ccchart'){
if(op.use_api_type){
op.type=$.csv2table.setting[id].type=op.use_api_type;
}
else
return;
useChart(id,op,data,$.csv2table._rowsAry[id]);
}
if($.csv2table.setting[id].onload)$.csv2table.setting[id].onload(id,op,data,$.csv2table._rowsAry[id]);
},'html');
$("#"+id).html(mkRowsAry(id,$.csv2table._rowsAry[id],op['th'+colIndex],colIndex));
setCSS(id);
if(op.use_api=='jqchart'){
if(op.use_api_charttype=='jqchart:line')op.type=$.csv2table.setting[id].type='line';
else
if(op.use_api_charttype=='jqchart:bar')op.type=$.csv2table.setting[id].type='bar';
useChart(id,op,$.csv2table.data[id],$.csv2table._rowsAry[id]);
}
else
if(op.use_api=='ccchart'){
if(op.use_api_type){
op.type=$.csv2table.setting[id].type=op.use_api_type;
}
else
return;
useChart(id,op,data,$.csv2table._rowsAry[id]);
}
if($.csv2table.setting[id].onload)
$.csv2table.setting[id].onload(id,op,$.csv2table.data[id],$.csv2table._rowsAry[id]);
if(callback)callback(op['th'+colIndex],colIndex,id);
}
rowsAry=$.csv2table._rowsAry[id]=escapeStrComma(op.col_sep,op.row_sep,$.csv2table.data[id],op.removeDoubleQuote);
$("#"+id).html(
mkTable(id,rowsAry));
if(op.sortable)$('#'+id+' table
th .sortimg').attr('src',op.sortNImg
)
setCSS(id);
if(op.use_api=='jqchart'){
if(op.use_api_charttype=='jqchart:line')op.type=$.csv2table.setting[id].type='line';
else
if(op.use_api_charttype=='jqchart:bar')op.type=$.csv2table.setting[id].type='bar';
useChart(id,op,$.csv2table.data[id],$.csv2table._rowsAry[id]);
}
else
if(op.use_api=='ccchart'){
if(op.use_api_type){
op.type=$.csv2table.setting[id].type=op.use_api_type;
}
else
return;
useChart(id,op,data,$.csv2table._rowsAry[id]);
}
}
ary.head=ary.slice(0,op.col_midasi+1)
var
rowsAry=ary.slice(op.col_midasi+1,ary.length)
rowsAry=sortwk(rowsAry,sortType,colIndex);
rowsAry=ary=ary.head.concat(rowsAry)
return
rowsAry
}
ofs,len
rowsAry=$.csv2table._rowsAry[id]=orderWk(data,sortType,colIndex);
}
else
{
rowsAry=$.csv2table._rowsAry[id]=escapeStrComma(op.col_sep,op.row_sep,data,op.removeDoubleQuote);
var
_rowsAry = rowsAry,
rowsAry =
[],
wlen =
op.where.length-1,
colNamesArry
=_rowsAry[0] ;
for(var
i=_rowsAry.length-1 ;i> 0;i--){ //最終行はheaderなので無視
for(var
j=0,ok=false;j<=wlen;j++){
if(op.where[j]=='&&'
||
op.where[j]=='||'){
siki
=op.where[j];
sikis +=
" " +siki;ok=true;
} else
{
colNo=op.where[j][0];
value=$.trim(op.where[j][1]);
}
else if(typeof
op.where[j]=='object'){
for(var
k in
op.where[j]){
var
colName=$.trim(k);value=$.trim(op.where[j][k]);break;
}
colNo=
$.inArray(colName, colNamesArry);//get colNo
siki
=
'"'+_rowsAry[i][colNo]+'"=="'+RegExp.$1+'"';
sikis
+= " " +siki;ok=true;
reg=
reg.split('\\_').join('###adrsr###') ; //escape
_
reg=
reg.replace(/_/g,'.')
;
reg=
reg.split('###adrsr###').join('_')
;
reg=
reg.split('\\%').join('###parst###') ; //escape
%
reg=
reg.replace(/%/g,'.*')
;
reg=
reg.split('###parst###').join('%')
;
reg=
'^'+reg+'$'
;
siki=(_rowsAry[i][colNo].match(new
RegExp(reg,'g')))?true:false;
sikis
+= " " +siki;ok=true;
colValue=_rowsAry[i][colNo].split(',').join('');
siki
=
colValue+value.split(',').join('');
if(chkSiki(siki)
!=
null){
sikis
+= " "
+siki;ok=true;
}
else ok=errLog('op.where operetor');
colValue=
_rowsAry[i][colNo]
;
siki =
colValue+value;
if(chkSiki(siki)
!=
null){
sikis
+= " "
+siki;ok=true;
}
else ok=errLog('op.where
operetor');
}
}
}
try{
//変な値が入るとエラーになる
//http://jsgt.org/lib/jquery/plugin/csv2table/v002/test/where-2.htm#5"+alert()+"//"8"=="5"+alert()+""
sikis=
sikis.replace(/\+/g,'');//fixed follows
}
rowsAry.unshift(_rowsAry[0]);
$.csv2table._rowsAry[id]=rowsAry;
}
if(op.orderBy){
var
cv,orderlen =
op.orderBy.length-1;
for(var i=orderlen
;i>=0;i--){
var
cv=getColNoAndValue(op.orderBy[i],rowsAry[0]);
rowsAry=$.csv2table._rowsAry[id]=orderWk(
rowsAry,cv.val,cv.cln
)
}
}
var
lmt=op.limit,lmlen=lmt.length,_rowsAry=[],zan,end;
if(lmlen==1)ofs=1,len=lmt[0];
else
if(lmlen==2)ofs=lmt[0]+1,len=lmt[1];
else
ofs=1,len=rowsAry.length;
zan=rowsAry.length-ofs;
if(len>zan)len=zan;
end=ofs+len;
for(var
i=rowsAry.length;i>0;i--){
if(ofs<=i
&&
i<end)_rowsAry.unshift(rowsAry[i]);
}
_rowsAry.unshift(rowsAry[0]);
rowsAry=$.csv2table._rowsAry[id]=_rowsAry;
}
}
}
$.csv2table.err.unshift('[Err] '+msg)
;
return false;
}
var
colNo=null,value=null;
if(typeof
opr[0]=='number')colNo=opr[0];
else if(typeof
opr[0]=='string')
colNo=
$.inArray($.trim(opr[0]),colNamesArry);
value=$.trim(opr[1]);
return
{cln:colNo,val:value}
}
return
siki.match(/^&&|\|\|$/g) &&
siki.length==2
}
return
siki.match(/^[0-9]*[<>\!=][=]{0,}[0-9]*$/g)
}
if(!rowsAry)return
var
row=rowsAry.length,col=rowsAry[0].length,
s=op.col_midasi+1
var
htm="";
htm+=
"<tr>";
for (var k=0; k<col; k++) {
sortimgsrc=(si)?$('#'+id+'-sortimg-'+k)[0].src:op.sortNImg;
if(op['th'+k]!=null)
if(op['th'+k]=='D')sortimgsrc=op.sortDImg;
else
if(op['th'+k]=='A')sortimgsrc=op.sortAImg;
else
if(op['th'+k]=='N')sortimgsrc=op.sortNImg;
+
rowsAry[op.col_midasi][k];
htm+=
"<img id='"+id+"-sortimg-"+k+"' class='sortimg' src='"+sortimgsrc+"'
border='0'>"
htm+= "</th>";
}
htm+=
"</tr>";
for (var i=s;
i<row; i++) {
htm+=
"<tr>";
//列の処理
for
(var j=0; j<col; j++) {
htm+=
"<td>"
+
rowsAry[i][j]
+
"</td>";
}
htm+=
"</tr>";
}
.innerHTML="<table>"+htm+"</table>";
////
// 並べ替え
// @parame
dataAry 並べ替え対象配列
// @parame
sortType 昇順A|降順D
// @parame
colIndex ソート列
//
function
sortwk(dataAry,sortType,colIndex){
if(sortType=="D")op['th'+colIndex]='D';
else
op['th'+colIndex]='A';
are3comma=chkThreeComma(dataAry[0][ci]),
mved3comma=are3comma.split(",").join("");
if(!isNaN(dataAry[0][ci])
|| !isNaN(mved3comma)){
var
rowlen=dataAry.length;
if(are3comma !=
'null'){
for(var
j=0;j<rowlen;j++){
var
d=chkThreeComma(dataAry[j][ci]).split(",").join("")
;
dataAry[j].unshift((isNaN(d))?0:d);
}
ci=0;
}
dataAry.sort(function
(a,b){
return (b[ci] - a[ci])
;//降順
}):
dataAry.sort(function
(a,b){
return (a[ci] - b[ci]);//
昇順
})
for(var
j=0;j<rowlen;j++)dataAry[j].shift();
}
dataAry.sort(
function(a,b){
if(!b[ci])return
0;
else
return 1;
} else if(!b[ci])
{
return
-1;
}
return
(sortType=="D")?
((""+a[ci]
>
""+b[ci])?-1:1):
((""+a[ci]
>
""+b[ci])?1:-1);
}
)
}
return
dataAry;
}
var
rdq=(removeDoubleQuote)?'':'"';
var dmy
=['-###','###-'],cnt=0,r;
cnt=(function
mkdmy(cnt){
if(!(
oj.indexOf((dmy[0]+'comma'+cnt+dmy[1]))==-1
||
oj.indexOf((dmy[0]+'rn'+cnt+dmy[1]))==-1
||
oj.indexOf((dmy[0]+'wDquote'+cnt+dmy[1]))==-1
))mkdmy(
++cnt )
else
void(0)
return
cnt;
})(cnt)
dmystr_comma=''+(dmy[0]+'comma'+cnt+dmy[1])
,
dmystr_rn=''+(dmy[0]+'rn'+cnt+dmy[1])
,
dmystr_wDquote=''+(dmy[0]+'wDquote'+cnt+dmy[1])
;
escape=
escape.replace(
new
RegExp(reg,"g"),
function (after,before,index)
{
after=
after
.replace(/(\r\n|\r|\n)(?!$)/g,dmystr_rn)
.replace(/,(?!$)/g,dmystr_comma)
return
after
)
if(op.select
== '*'||op.select ==
['*'])
r=$.csv2table._rowsAry[id]=mkArray(escape,op.col_sep,op.row_sep);
else r=$.csv2table._rowsAry[id]=mkSelectedArray(escape,op.col_sep,op.row_sep,op.select)
for(var
i=0;i<rowlen;i++){
if(r[i]=='')continue;
b[i]=r[i];
for(var
j=0;j<collen;j++){
try{
b[i][j]=$.trim(r[i][j])
.replace(/^"|"$/g,rdq)
.replace(new
RegExp(dmystr_comma,"g"),",")
.replace(new
RegExp(dmystr_rn,"g"),"<br>")
.replace(new
RegExp(dmystr_wDquote,'g'),'""');
}
catch(e){}
}
}
return
b
}
var
rows=data.split(row_sep),rc=[],c=[],
rowlen=rows.length ;
for(var
i=0;i<rowlen;i++){
if($.trim(rows[i])=='')
continue;
try{
rc[i]=rows[i].split(col_sep);
c[i]=[];
for(var
j=0;j<select.length;j++){
c[i].push(rc[i][select[j]])
}
}
catch(e){ }
}
return
c||rc
}
function
mkArray(data,col_sep,row_sep){
var
rows=data.split(row_sep),rc=[]
rowlen=rows.length ;
for(var
i=0;i<rowlen;i++){
if($.trim(rows[i])=='')
continue;
try{
rc[i]=rows[i].split(col_sep);
}
catch(e){ }
}
return
rc
}
var prop =
(setting[settingName]=='undefined'||
setting[settingName]==null)?val:setting[settingName]
return
prop
}
return
data.replace("
","")
.split(".")[0]
.match(/^[0-9]{1,3}(,[0-9]{3})*,[0-9]{3}$/g)+""
}
$('#'+id+'
table').css($.csv2table.cssDefault.className_table).addClass(op.className_table)
if(tableWith){
$('#'+id+' table').css({ width : tableWith +
'px'});
} else
{
}
$('#'+id+'
table
td').css($.csv2table.cssDefault.className_table_td).addClass(op.className_table_td)
.addClass(op.className_hoboNum)
if(op.numArignRight)numTD.css({
textAlign
: 'right'
})
$('#'+id+'
table
th')
.css($.csv2table.cssDefault.className_sortMark)
.addClass(op.className_sortMark)
.each(function
(i,el) {
var i =$('#'+id+' table
th').index(this);
$(this).click(function
(e)
{
resetSortImg(id,i);
if(op['th'+i]=='D')
op['th'+i]='A';
else
op['th'+i]='D';
$.csv2table.wrtTable(
i,""+id+"",function(sortType,colIndex,id){});
});
});
}
}
var
thlen=$.csv2table._rowsAry[id][0].length;
for(var
i=0;i<thlen;i++)if(i!=index){
op['th'+i]='N'}
$('#'+id+' table th
img.sortimg').each(function(){
$(this).attr('src',$.csv2table.setting[id].sortNImg
);
})
}
var head=
ary[0];
if(op.use_api=='jqchart'){
var
dataBody =
ary.slice(1);
$("#"+op.use_api_box).jQchart({
config
: $.extend(op,{
width :
$('#'+id+' table').width()+10,
paddingL :
$('#'+id+' table
th:nth-child(1)').width()+14,
labelX
:
(op.labelX=='useChart')?head.slice(1):op.labelX,
onload
:
($.csv2table.setting[id].onload)?$.csv2table.setting[id].onload(id,op,data,ary):null
}),
data
: (function(){
var d =
[];
for(var
i=0,len=dataBody.length;i<len;i++){
d.push(dataBody[i].slice(1))
}
return
d;
})()
})
}
else
if(op.use_api=='ccchart'){
var dataBody =
ary;
if(!window.ccchart)return;
$.extend(setting,{
"type":
op.type,
"width": $('#'+id+'
table').width()
});
"config":
setting,
"data":
ary
}
}
if(op.use_api ===
'ccchart'){
return this
//lc = ccchart.ops[op.use_api_box].colorSet;
} else
{
jqc =
$("#"+op.use_api_box).jQchart.op;
if(jqc)lc=
$("#"+op.use_api_box).jQchart.op.line_strokeStyle
else
lc=
['red','#FF9114','#3CB000','#00A8A2','#0036C0','#C328FF','#FF34C0'];
}
var
dl=
dataBody.length,lc;
$('tr:even','#'+id).css('background','#eee');
if(op.col0color)
$.each(dataBody,function(i){
try{
$('tr:nth-child('+dl+'n'+(dl+i+2)%dl+')')
.css('color',lc[i])
}
catch(e){}
})
}
return
this
}