📄 toolbar.js
字号:
// Copyright (c) iRows.com. All rights reserved. Do not copy.SHTB_POPUP_ID='tbpop'SHTB_POPUP_BODY_ID='tbpopbody'SHTB_POPUP_MVID='popmvh'var SHTB_handlervar winsize={width:600,height:400}function Toolbar(){var TB=new Object()TB.setWinSize=function(sz){TB.winsize=sz}TB.close=function(){return SHTB_close()}TB.openTextColor=function(pos,color,bgcolor,handler){SHTB_openTextColor(pos,color,bgcolor,handler)}TB.openTextStyle=function(pos,style,handler){SHTB_openTextStyle(pos,style,handler)}TB.openFormat=function(pos,handler){SHTB_openFormat(pos,handler)}TB.openAbout=function(pos){SHTB_openAbout(pos)}TB.openCopyData=function(pos,text){SHTB_openCopyData(pos,text)}TB.openPasteData=function(pos,title,handler){SHTB_openPasteData(pos,title,handler)}TB.openExportDelimitedText=function(pos,handler){SHTB_openExportDelimitedText(pos,handler)}TB.openAddDelMenu=function(pos,fr,tr,fc,tc,handler){SHTB_openAddDelMenu(pos,fr,tr,fc,tc,handler)}TB.openChartMenu=function(pos,hasSelChart,handler){SHTB_openChartMenu(pos,hasSelChart,handler)}TB.openUrl=function(pos,handler){SHTB_openUrl(pos,handler)}TB.openChart=function(pos,defs,handler){SHTB_openChart(pos,defs,handler)}TB.openSort=function(pos,cols,handler){SHTB_openSort(pos,cols,handler)}TB.enable=function(btnName,enabled){SHTB_enable(btnName,enabled)}TB.openContextMenu=function(pos,ctxdata,handler){SHTB_openContextMenu(pos,ctxdata,handler)}return TB}function SHTB_close(){var pop=document.getElementById(SHTB_POPUP_ID)var popBody=document.getElementById(SHTB_POPUP_BODY_ID)popBody.innerHTML=''pop.style.display='none'var mvh=document.getElementById(SHTB_POPUP_MVID)mvh.style.display='none'SHTB_handler=null}function SHTB_openTextColor(pos,color,bgcolor,handler){SHTB_handler=handlervar pop=document.getElementById(SHTB_POPUP_ID)if(!color||color=='')color='#000000'if(!bgcolor||bgcolor=='')bgcolor='#ffffff'var c=''c+='<table border="0" cellpadding="0" cellspacing="0">'c+='<tr valign="top">'c+='<td align="center"><b>Text Color</b></td>'c+='<td> </td>'c+='<td align="center"><b>Background Color</b></td>'c+='</tr>'c+='<tr valign="top">'c+='<td align="center">'c+=SHTB_generateColorTable('T')c+='</td>'c+='<td></td>'c+='<td align="center">'c+=SHTB_generateColorTable('B')c+='</td>'c+='</tr>'c+='<tr height="10"><td></td></tr>'c+='<tr>'c+='<td colspan="3" align="center">'c+='<input type="text" id="shui_tb_col_sample" size="20" value="It looks like this" style="border:1px solid black;color:'+color+';background-color:'+bgcolor+';" />'c+='</td>'c+='</tr>'c+='<tr height="10"><td></td></tr>'c+='<tr>'c+='<td colspan="3" align="center">'c+='<input type="hidden" id="shui_tb_col_text" value="'+color+'" />'c+='<input type="hidden" id="shui_tb_col_bg" value="'+bgcolor+'" />'c+='<input type="button" value="OK" onclick="SHTB_selectedTextColor()" /> 'c+='<input type="button" value="Cancel" onclick="SHTB_close()" />'c+='</td></tr></table>'var popBody=document.getElementById(SHTB_POPUP_BODY_ID)popBody.innerHTML=cSHTB_show(pop,pos)}function SHTB_generateColorTable(type){var colors=['330033','330099','000066','003333','003300','333300','663333','663300','330000','000000','663366','333399','000099','336666','006600','666600','996633','993300','660000','333333','993399','6600cc','3333ff','339999','009900','999900','cc9933','cc6600','990000','666666','cc33cc','6633ff','3366ff','00cccc','33cc00','ffcc00','ffcc33','ff6600','cc0000','999999','cc66cc','6666cc','33ccff','66cccc','33ff33','ffff00','ffcc66','ff9900','ff0000','c0c0c0','ff99ff','9999ff','66ffff','33ffff','66ff99','ffff33','ffff66','ff9966','ff6666','cccccc','ffccff','ccccff','ccffff','99ffff','99ff99','ffffcc','ffff99','ffcc99','ffcccc','ffffff']var coltb=''coltb+='<table border="0" cellpadding="0" cellspacing="1" bgcolor="#ffffff">'for(var i=0;i<colors.length;i++){if(i % 10==0)coltb+='<tr>'var c=colors[i]coltb+='<td bgcolor="#'+c+'" style="width:12px;height:12px" onclick="return SHTB_setColor("'+type+'","#'+c+'")"></td>'if(i+1 % 10==0)coltb+='</tr>'}coltb+='</table>'return coltb}function SHTB_setColor(type,color){var sample=document.getElementById('shui_tb_col_sample')if(type=='T'){sample.style.color=colordocument.getElementById("shui_tb_col_text").value=color}elseif(type=='B'){sample.style.backgroundColor=colordocument.getElementById("shui_tb_col_bg").value=color}return false}function SHTB_selectedTextColor(){var sample=document.getElementById('shui_tb_col_sample')var color=document.getElementById("shui_tb_col_text").valuevar bgcolor=document.getElementById("shui_tb_col_bg").valuevar event={color:color,bgcolor:bgcolor}eval( SHTB_handler(event))SHTB_close()}function SHTB_openTextStyle(pos,style,handler){SHTB_handler=handlervar pop=document.getElementById(SHTB_POPUP_ID)var initialStyles=''if(style){if(style.align)initialStyles+='text-align:'+style.align+';'if(style.bold)initialStyles+='font-weight:bold;'if(style.italic)initialStyles+='font-style:italic;'if(style.underline)initialStyles+='text-decoration:underline;'if(style.strike)initialStyles+='text-decoration:line-through;'}var c=''c+='<table border="0" cellpadding="0" cellspacing="0">'c+='<tr valign="top">'c+='<td>'c+='<button onclick="return SHTB_setTextStyle("b")" style="width:90px"><b>Bold</b></button>'c+='<button onclick="return SHTB_setTextStyle("i")" style="width:90px"><i>Italic</i></button>'c+='<button onclick="return SHTB_setTextStyle("u")" style="width:90px"><u>Underline</u></button>'c+='<button onclick="return SHTB_setTextStyle("s")" style="width:90px"><strike>Strike</strike></button>'c+='</td>'c+='</tr>'c+='<tr height="6"><td></td></tr>'c+='<tr valign="top">'c+='<td>'c+='<button onclick="return SHTB_setTextStyle("l")" style="width:120px;text-align:left" >left</button>'c+='<button onclick="return SHTB_setTextStyle("c")" style="width:120px;text-align:center">center</button>'c+='<button onclick="return SHTB_setTextStyle("r")" style="width:120px;text-align:right">right</button>'c+='</td>'c+='</tr>'c+='<tr height="10"><td></td></tr>'c+='<tr>'c+='<td align="center">'c+='<input type="text" id="shui_tb_text_sample" size="30" value="It looks like this" style="border:1px solid black;width:200px;'+initialStyles+'" />'c+='</td>'c+='</tr>'c+='<tr height="10"><td></td></tr>'c+='<tr>'c+='<td align="center">'c+='<input type="button" value="OK" onclick="SHTB_selectedTextStyle()" /> 'c+='<input type="button" value="Cancel" onclick="SHTB_close()" />'c+='</td></tr></table>'var popBody=document.getElementById(SHTB_POPUP_BODY_ID)popBody.innerHTML=cSHTB_show(pop,pos)}function SHTB_setTextStyle(type){var sample=document.getElementById('shui_tb_text_sample')if(type=='l')sample.style.textAlign='left'elseif(type=='c')sample.style.textAlign='center'elseif(type=='r')sample.style.textAlign='right'elseif(type=='u')sample.style.textDecoration=sample.style.textDecoration=='underline'?'':'underline'elseif(type=='s')sample.style.textDecoration=sample.style.textDecoration=='line-through'?'':'line-through'elseif(type=='b')sample.style.fontWeight=sample.style.fontWeight=='bold'?'':'bold'elseif(type=='i')sample.style.fontStyle=sample.style.fontStyle=='italic'?'':'italic'return false}function SHTB_selectedTextStyle(){var sample=document.getElementById('shui_tb_text_sample')var align=sample.style.textAlignvar bold=(sample.style.fontWeight=='bold')var italic=(sample.style.fontStyle=='italic')var underline=(sample.style.textDecoration=='underline')var strike=(sample.style.textDecoration=='line-through')var event={align:align,bold:bold,italic:italic,underline:underline,strike:strike}eval( SHTB_handler(event))SHTB_close()}var K1='$'function SHTB_openFormat(pos,handler){SHTB_handler=handlervar pop=document.getElementById(SHTB_POPUP_ID)var c=''c+='<table border="0" cellpadding="0" cellspacing="0">'c+='<tr valign="top" bgcolor="#e0e0e0"><td width="100" align="center">Positive</td><td width="100" align="center">Negative</td></tr>'c+=SHTB_formatOption('-','1234.5','-1234',null)c+=SHTB_formatOption('n:n02--','1234.50','-1234.50',null)c+=SHTB_formatOption('n:y00--','1,234','-1,234',null)c+=SHTB_formatOption('n:y02--','1,234.00','-1,234.00',null)c+=SHTB_formatOption('n:y02'+K1+'-',''+K1+'1,234.00','-'+K1+'1,234.00',null)c+=SHTB_formatOption('n:y02'+K1+'r',''+K1+'1,234.00','-'+K1+'1,234.00','red')c+=SHTB_formatOption('n:y02'+K1+'(',''+K1+'1,234.00','('+K1+'1,234.00)',null)c+=SHTB_formatOption('n:y02'+K1+'R',''+K1+'1,234.00','('+K1+'1,234.00)','red')c+=SHTB_formatOption('n:y00%-','12%','-12%',null)c+=SHTB_formatOption('n:y02%-','12.00%','-12.00%',null)c+='<tr height="10"><td></td></tr>'c+='<tr><td colspan="2" align="center">'c+='<input type="button" value="Advanced »" onclick="SHTB_openFormatAdvanced()" />'c+='<input type="button" value="Cancel" onclick="SHTB_close()" />'c+='</td></tr></table>'c+='</td></tr></table>'var popBody=document.getElementById(SHTB_POPUP_BODY_ID)popBody.innerHTML=cSHTB_show(pop,pos)}function SHTB_openFormatAdvanced(){var c=''c+='<table border="0" cellpadding="0" cellspacing="0">'c+='<tr valign="top">'c+='<td colspan="2"><input type="checkbox" checked="true" id="shui_tb_fmt_sep"> Use decimal seperator (,)</td>'c+='</tr>'c+='<tr valign="top">'c+='<td>Decimal digits</td>'c+='<td><select id="shui_tb_fmt_dec">'for(var i=0;i<=10;i++)c+='<option'+(i==2?' selected="true"':'')+'>'+i+'</option>'c+='</td>'c+='</tr>'c+='<tr valign="top">'c+='<td>Symbol</td>'c+='<td><select id="shui_tb_fmt_sym">'c+='<option>None</option>'c+='<option>$ Dollar</option>'c+='<option>€ Euro</option>'c+='<option>₤ Pound (UK)</option>'c+='<option>₪ Shekel (Israel)</option>'c+='<option>¥ Yen (Japan)</option>'c+='<option>Percent (%)</option></td>'c+='</tr>'c+='<tr valign="top">'c+='<td>Negative values</td>'c+='<td>'c+='<input type="radio" name="shui_tb_fmt_neg" radio checked="true" />-12 'c+='<input type="radio" name="shui_tb_fmt_neg" radio id="shui_tb_fmt_dec_r" /><span style="color:red">-12</span> 'c+='<input type="radio" name="shui_tb_fmt_neg" radio id="shui_tb_fmt_dec_b" />(12) 'c+='<input type="radio" name="shui_tb_fmt_neg" radio id="shui_tb_fmt_dec_R" /><span style="color:red">(12)</span> 'c+='</td>'c+='</tr>'c+='<tr height="10"><td></td></tr>'c+='<tr><td colspan="2" align="center">'c+='<input type="button" value="OK" onclick="SHTB_setFormatAdvanced()" />'c+='<input type="button" value="Cancel" onclick="SHTB_close()" />'c+='</td></tr></table>'var popBody=document.getElementById(SHTB_POPUP_BODY_ID)popBody.innerHTML=c}function SHTB_formatOption(pattern,pos,neg,negcolor){var c=''c+='<tr valign="top" onclick="SHTB_setFormat("'+pattern+'")" onmouseover="this.style.backgroundColor="#ffc06f"" onmouseout="this.style.backgroundColor=""">'c+='<td align="right">'+pos+'</td>'c+='<td align="right"'if(negcolor)c+=' style="color:'+negcolor+'"'c+=' >'+neg+'</td></tr>'return c}function SHTB_setFormat(pattern){var event={pattern:pattern}eval( SHTB_handler(event))SHTB_close()}function SHTB_setFormatAdvanced(){var sep=document.getElementById('shui_tb_fmt_sep').checkedvar dec=document.getElementById('shui_tb_fmt_dec').selectedIndexvar symbol="-$\u20ac\u20a4\u20aa\u00a5%".charAt(document.getElementById('shui_tb_fmt_sym').selectedIndex)if(symbol!='-'&&symbol!='%')K1=symbolvar neg='-'if(document.getElementById('shui_tb_fmt_dec_r').checked)neg='r'if(document.getElementById('shui_tb_fmt_dec_b').checked)neg='('if(document.getElementById('shui_tb_fmt_dec_R').checked)neg='R'var pattern='n:'pattern+=sep?'y':'n'pattern+=dec<10?'0'+dec:decpattern+=symbol+negSHTB_setFormat(pattern)}function SHTB_openAbout(pos){var pop=document.getElementById(SHTB_POPUP_ID)var c=''c+='<table border="0" cellpadding="0" cellspacing="0">'c+='<tr><td width="300" align="center">This data sheet is powered by</td></tr>'c+='<tr><td align="center"><a href="http://www.irows.com" target="_blank" style="color:black;font-weight:bold">www.irows.com</a></td></tr>'c+='<tr height="10"><td></td></tr>'c+='<tr><td width="300" align="center">Managing you data online has never been easier</td></tr>'c+='<tr height="10"><td></td></tr>'c+='<tr><td align="center">'c+='<input type="button" value="Close" onclick="SHTB_close()" />'c+='</td></tr></table>'var popBody=document.getElementById(SHTB_POPUP_BODY_ID)popBody.innerHTML=cSHTB_show(pop,pos)}function SHTB_menuOption(icon,text,code,enabled){var c=''if(enabled){c+='<tr onmousedown="SHTB_selectMenu("'+code+'");return false" onmouseover="this.style.backgroundColor="#ffc06f"" onmouseout="this.style.backgroundColor=""">'c+='<td>'if(icon!=null)c+="<img src='image/tb_"+icon+".png' width='18' height='18' />"c+='</td>'c+='<td nowrap="true">'+text+'</td>'c+='</tr>'}else{c+='<tr><td>'if(icon!=null)c+="<img src='image/tb_"+icon+".png' width='18' height='18' />"c+='</td>'c+='<td nowrap="true" style="color:#808080">'+text+'</td>'c+='</tr>'}return c}function SHTB_menuSeperator(){return'<tr><td colspan="2"><hr size="1"/></td></tr>'}function SHTB_selectMenu(code){var event={selected:code}eval( SHTB_handler(event))SHTB_close()
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -