📄 ecms_tools.js
字号:
/*
EasyCMS Javascript enhancement functions
(c) Christian Heilmann
*/
function trigger(id){
d=document.getElementById("sub"+id);
if(d){d.style.display=d.style.display=='none'?'block':'none';}
d=document.getElementById("s"+id);
if(d){d.style.display=d.style.display=='none'?'block':'none';}
i=document.getElementById('img'+id);
if(i){i.src=(i.src.indexOf('minus.gif')==-1)?'minus.gif':'plus.gif';}
}
function showhide(id){
d=document.getElementById(id);
if(d){d.style.display=d.style.display=='none'?'block':'none';}
}
function peekaboo(id){
allCom='text,hl,para,list,tab,pic,colorpick,section'.split(',');
for (a in allCom){
d=document.getElementById(allCom[a]);
if(d){d.style.display='none';}
}
d=document.getElementById(id);
if(d){
if(d.style.display==''){d.style.display='none';}
d.style.display=d.style.display=='none'?'block':'none';
}
i=document.getElementById(id+'pic');
if(i){i.src=(i.src.indexOf('minus.gif')==-1)?'minus.gif':'plus.gif';}
}
function hide(){
// wank IE6 throws an error on the help page...
if (document.getElementById('tree')!=null){
lists=document.getElementsByTagName('ul');
for (i=1;i<lists.length;i++){
if (lists[i].getAttribute('id') && lists[i].getAttribute('id').indexOf('sub')!=-1){
lists[i].style.display='none';
imgcount=lists[i].getAttribute('id').replace('sub','');
document.getElementById('img'+imgcount).src='plus.gif';
}
}
}
if (document.getElementById('intro')!=null){showhide('intro')}
}
function addheadline(){
code=document.forms.codeform.code;
level=document.forms.toolform.headlinelevel;
islevel=level.options[level.selectedIndex].value;
code.value=code.value+"<h"+islevel+"></h"+islevel+">";
}
function addpara(){
code=document.forms.codeform.code;
level=document.forms.toolform.palign;
islevel=level.options[level.selectedIndex].value;
addcode=islevel=='none'?'<p></p>':'<p align="'+islevel+'"></p>';
code.value=code.value+addcode;
}
function addlist(){
code=document.forms.codeform.code;
level=document.forms.toolform.lt;
islevel=level.options[level.selectedIndex].value;
items=document.forms.toolform.items.value==''?1:document.forms.toolform.items.value;
compact=document.forms.toolform.compact.checked;
addcode='';
switch (islevel){
case 'unordered':
addcode+='<ul>';
for (i=0;i<items;i++){addcode+='\n<li></li>'}
addcode+='\n</ul>';
break;
case 'ordered':
addcode+='<ol>';
for (i=0;i<items;i++){addcode+='\n<li></li>'}
addcode+='\n</ol>';
break;
case 'definition':
addcode+=compact==true?'<dl compact="compact">':'<dl>';
for (i=0;i<items;i++){addcode+='\n<dt></dt>\n<dd></dd>'}
addcode+='\n</dl>';
break;
}
code.value=code.value+addcode;
}
function addlink(){
code=document.forms.codeform.code;
level=document.forms.toolform.linkshref;
islevel=level.options[level.selectedIndex].value;
addtarget=document.forms.toolform.linktarget.checked;
addtitle=document.forms.toolform.linktitle.checked;
addcode='<a href="';
addcode+=(islevel!='none')?islevel:'';
addcode+='"';
addcode+=addtarget==true?' target="_blank"':'';
addcode+=addtitle==true?' title=""':'';
addcode+='></a>';
code.value=code.value+addcode;
}
function addimg(){
code=document.forms.codeform.code;
level1=document.forms.toolform.imgsrc;
islevel1=level1.options[level1.selectedIndex].value;
level2=document.forms.toolform.imgalign;
islevel2=level2.options[level2.selectedIndex].value;
addcode='<img src="';
addcode+=islevel1=='none'?'':'../ecms_contentimages/'+islevel1;
addcode+='" alt=""';
addcode+=islevel2=='none'?'':' align="'+islevel2+'"';
addcode+=' />';
code.value=code.value+addcode;
}
function addtable(){
code=document.forms.codeform.code;
rows=document.forms.toolform.rows.value==''?1:document.forms.toolform.rows.value;
cols=document.forms.toolform.cols.value==''?1:document.forms.toolform.cols.value;
disp=document.forms.toolform.disp.checked;
addcode='';
addcode+=disp==true?'<table>':'<table summary="">';
if (disp==false){
addcode+='\n<tr>';
for (i=0;i<cols;i++){addcode+='\n<th></th>';}
addcode+='\n</tr>';
}
for (i=0;i<rows;i++){
addcode+='\n<tr>';
for (d=0;d<cols;d++){addcode+='\n<td></td>';}
addcode+='\n</tr>';
}
addcode+='\n</table>';
code.value=code.value+addcode;
}
function s(i){document.forms.codeform.code.value=document.forms.codeform.code.value+"#"+i;}
function x(i){document.getElementById("p").style.background="#"+i;}
function addtext(tag){
code=document.forms.codeform.code;
if (tag=='acronym'){code.value=code.value+'<acronym title=""></acronym>';}
else {code.value=code.value+'<'+tag+'></'+tag+'>';}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -