⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 editor.js

📁 asp的bbs程序
💻 JS
📖 第 1 页 / 共 5 页
字号:
return oA;},faceBlock:function(p){if(this.faceNode){oNode.AddNode(this.faceNode,p);return;}
var self=this;var faceNode=this.faceNode=oNode.CreateNode('div');oNode.AddNode(faceNode,p);var t=oNode.CreateNode('div');oNode.AddNode(t,faceNode);CSS.AddClass(t,'face-title');var tS=oNode.CreateNode('div');oNode.AddNode(tS,t);tS.style.position='absolute';tS.style.left=0;tS.style.top=0;var tSWidth=0;var typeCount=0;var curBut=null;var curType='default';for(var item in this.faceAbout.group){var n=oNode.CreateNode('div');oNode.AddNode(n,tS);if(item=='default'){CSS.AddClass(n,'focus');curBut=n;}
n.type=item;n.innerHTML='<a href="javascript:;">'+this.faceAbout.group[item]+'</a>';n.onclick=function(){if(this.type==curType)return;curType=this.type;CSS.RemoveClass(curBut,'focus');CSS.AddClass(this,'focus');curBut=this;var faceList=self.faceAbout.faceList[this.type];if(faceList){pageCount=Math.ceil(faceList.length/pageSize);}
curPage=1;show(this.type,1);};typeCount++;tSWidth+=n.offsetWidth;}
var scope=365-40;var tSW=tSWidth+1*typeCount+3;tS.style.width=tSW+'px';if(tSW>scope){var tC=oNode.CreateNode('div');oNode.AddNode(tC,t);CSS.AddClass(tC,'control');var tPrev=oNode.CreateNode('img');oNode.AddNode(tPrev,tC);tPrev.src=this.iconsRoot+'emoticon_prev.gif';tPrev.onmouseover=function(){dir=0;startMove()};tPrev.onmouseout=function(){stopMove()};var tNext=oNode.CreateNode('img');oNode.AddNode(tNext,tC);tNext.src=this.iconsRoot+'emoticon_next.gif';tNext.onmouseover=function(){dir=1;startMove()};tNext.onmouseout=function(){stopMove()};var dir;var step=5;var interval=0;function startMove(){var l=parseInt(tS.style.left);if(dir){if(l-step+tSW<scope)l=scope-tSW;else l-=step;}
else{if(l+step>0)l=0;else l+=step;}
tS.style.left=l+'px';interval=setTimeout(startMove,30);}
function stopMove(){clearTimeout(interval);}}
var c=oNode.CreateNode('div');oNode.AddNode(c,faceNode);CSS.AddClass(c,'face-content');var b=oNode.CreateNode('div');oNode.AddNode(b,faceNode);CSS.AddClass(b,'face-bottom');var leftC=oNode.CreateNode('div');oNode.AddNode(leftC,b);CSS.AddClass(leftC,'face-bottom-left');leftC.innerHTML='<a href="'+this.faceAbout.faceManage+'" target="_blank">管理</a> <a href="'+this.faceAbout.faceImport+'" target="_blank">导入</a>';var rightC=oNode.CreateNode('div');oNode.AddNode(rightC,b);CSS.AddClass(rightC,'face-bottom-right');var pagePrev=oNode.CreateNode('a');oNode.AddNode(pagePrev,rightC);pagePrev.href='javascript:void(0)';pagePrev.innerHTML='上一页';oNode.AddNode('  ',rightC);pagePrev.onclick=function(){if(curPage==1)return;curPage-=1;show(curType,curPage);};var pageNext=oNode.CreateNode('a');oNode.AddNode(pageNext,rightC);pageNext.href='javascript:void(0)';pageNext.innerHTML='下一页';pageNext.onclick=function(){if(curPage==pageCount)return;curPage+=1;show(curType,curPage);};var pageC=oNode.CreateNode('div');oNode.AddNode(pageC,b);CSS.AddClass(pageC,'face-bottom-page');var preview=oNode.CreateNode('div');oNode.AddNode(preview,faceNode);CSS.AddClass(preview,'face-preview');preview.style.visibility='hidden';var pageSize=this.faceAbout.pageSize;var pageCount=Math.ceil((self.faceAbout.faceList['default']||[]).length/pageSize);var curPage=1;function show(type,page){var curList=self.faceAbout.faceList[type];if(pageCount<=1)rightC.style.visibility='hidden';else rightC.style.visibility='visible';if(!curList){pageC.innerHTML='1/0';c.innerHTML='';return;}
pageC.innerHTML=page+'/'+pageCount;c.innerHTML='';for(var i=(page-1)*pageSize,j=1;i<page*pageSize&&i<curList.length;i++,j++){var img=oNode.CreateNode('img');oNode.AddNode(img,c);img.hspace=img.vspace=2;img.width=self.faceAbout.width;img.height=self.faceAbout.height;if(curList[i].length==0){img.style.cursor='default';img.src='images/transparent.gif';continue;}
img._src=curList[i][1];img._shortcut=curList[i][0];img.index=i;img.displayIndex=j;if(curType=='default'&&curList[i][2]!=-1){img.src='images/transparent.gif';img.style.background='#eee url('+self.faceAbout.defaultImg+') no-repeat '+curList[i][2]+'px 0';}
else{var src=curList[i][1].split('.');src=src.slice(0,src.length-1).join('.')+'.png';img.src=self.faceAbout.lowpath+src;}
img.onclick=function(){if(cEditor.isXHTML())return;var url=(curType=='default'&&curList[this.index][2]!=-1?self.faceAbout.defaultPath:self.faceAbout.path)+this._src;if(cEditor.isWYSIWYG()){var el='<img src="'+url+'" _shortcut="'+this._shortcut+'" />';cEditor.InsertContent(el);}
else{cEditor.SetUBBStyle(this._shortcut);}
self.facePanel.style.display='none';};img.onmouseover=function(){if(this.displayIndex%14>6){preview.style.left='5px';preview.style.right='auto';}
else{preview.style.left='auto';preview.style.right='5px';}
if(curType=='default'&&curList[this.index][2]!=-1){preview.style.background='#eee url('+self.faceAbout.defaultPath+this._src+') no-repeat center center';}
else{var img=oNode.CreateNode('img');oNode.AddNode(img,preview);img.onload=function(){AvatarLoaded(this)};img.width=preview.offsetWidth;img.height=preview.offsetHeight;img.src=self.faceAbout.path+this._src;}
preview.style.visibility='visible';};img.onmouseout=function(){preview.innerHTML='';preview.style.visibility='hidden';};}}
show('default',1);},regIcon:function(description,src,url,width,height,routine){var self=this;var Win=window.parent;var id='icon_'+Global.Random();this.regIcons.push(id);this.icons[id]=[1,src,description.width||0,description.title||0,description.content||''];var but=this.buttons[id]=this.createIcon($(cEditor.ToolBarName),id);but.onclick=function(){if(cEditor.isXHTML())return;self.currentCustom=id;if(TypeOf(routine)=='function'){routine();}
if(url){Win.Widget.Content(description.title,'<div style="height:'+height+'px;margin:-10px;"><iframe src="'+url+'&EditorId='+cEditor.Id+'" width="100%" height="100%"  frameborder="0" scrolling="no"></iframe></div>',width);Win.Widget.Show();Win.Widget.Resize();}};},displayRegIcon:function(tb){if(cEditor.EditorObj.RegIcons){for(var i=0,len=cEditor.EditorObj.RegIcons.length;i<len;i++){this.regIcon.apply(this,cEditor.EditorObj.RegIcons[i]);}}
else{var icons=BBSMaxConfig.icons;for(var i=0,len=icons.length;i<len;i++){var icon=[icons[i].description,icons[i].src,icons[i].url,icons[i].width,icons[i].height,icons[i].routine];this.regIcon.apply(this,icon);}}
var clear=CSS.AddClear(tb,CSS.LEFT);clear.style.height='5px';},responseGecko:function(e,iskey){var isB,isI,isU,isLink,FontName;this.response();var sel=cEditor.SelectRange;var range=sel.getRangeAt(0);var note=range.startContainer;if(note.tagName&&note.tagName.toLowerCase()=='body'){note=note.childNodes[range.startOffset];}
while(note){if(!note.tagName){note=note.parentNode;continue;}
var tagName=note.tagName.toLowerCase();if(tagName=='a'){isLink=true;}
if(tagName=='u'||(note.style&&note.style.textDecoration=='underline')){isU=true;}
note=note.parentNode;}
this.changeState(this.buttons.underline,isU);this.changeState(this.buttons.unlink,isLink);},responseIE:function(e,iskey){var isB,isI,isU,isLink,FontName;this.response();cEditor.GetRange();var range=cEditor.SelectRange.createRange();var note=cEditor.Window.event.srcElement;while(note){if(!note.tagName){note=note.parentNode;continue;}
var tagName=note.tagName.toLowerCase();if(tagName=='a'){isLink=true;}
if(tagName=='u'){isU=true;}
note=note.parentNode;}
this.changeState(this.buttons.underline,isU);this.changeState(this.buttons.unlink,isLink);},response:function(invalid){var isUBB=invalid||cEditor.isUBB();try{this.changeState(this.buttons.bold,isUBB?false:cEditor.Document.queryCommandState('Bold'),invalid);this.changeState(this.buttons.italic,isUBB?false:cEditor.Document.queryCommandState('Italic'),invalid);this.changeState(this.buttons.underline,isUBB?false:cEditor.Document.queryCommandState('Underline'),invalid);this.changeState(this.buttons.justifyLeft,isUBB?false:cEditor.Document.queryCommandState('JustifyLeft'),invalid);this.changeState(this.buttons.justifyCenter,isUBB?false:cEditor.Document.queryCommandState('JustifyCenter'),invalid);this.changeState(this.buttons.justifyRight,isUBB?false:cEditor.Document.queryCommandState('JustifyRight'),invalid);this.changeState(this.buttons.orderedList,isUBB?false:cEditor.Document.queryCommandState('InsertOrderedList'),invalid);this.changeState(this.buttons.unorderedList,isUBB?false:cEditor.Document.queryCommandState('InsertUnorderedList'),invalid);var fontName=isUBB?false:cEditor.Document.queryCommandValue('FontName');this.buttons.fontName.innerHTML=fontName?fontName:this.icons.fontName[3];var fontSize=isUBB?false:cEditor.Document.queryCommandValue('FontSize');this.buttons.fontSize.innerHTML=fontSize?this.fontSizeList[fontSize-1].label:this.icons.fontSize[3];}
catch(e){}},responseAll:function(invalid){this.response(invalid);try{this.changeState(this.buttons.foreColor,false,invalid);this.changeState(this.buttons.backColor,false,invalid);this.changeState(this.buttons.indent,false,invalid);this.changeState(this.buttons.outdent,false,invalid);this.changeState(this.buttons.link,false,invalid);this.changeState(this.buttons.unlink,false,invalid);this.changeState(this.buttons.table,false,invalid);this.changeState(this.buttons.code,false,invalid);this.changeState(this.buttons.hide,false,invalid);this.changeState(this.buttons.face,false,invalid);for(var i=0,len=this.regIcons.length;i<len;i++){this.buttons[this.regIcons[i]]&&this.changeState(this.buttons[this.regIcons[i]],false,invalid);}}
catch(e){}},changeState:function(obj,overState,invalid){obj.overState=overState;var left=typeof this.icons[obj.type][1]=='number'?this.icons[obj.type][1]:0;obj.style.backgroundPosition='-'+left+'px '+(invalid?'-'+(this.yOffset*2+'px'):(overState?'-'+this.yOffset+'px':'0'));},refreshState:function(obj,command){if(cEditor.Document.queryCommandEnabled(command)){obj.style.backgroundColor=this.changeState(obj,!obj.overState);}}};(function(){function RegIcon(){Toolbar.regIcon.apply(Toolbar,arguments);}
function CustomInsert(content,type){if(cEditor.isWYSIWYG()){cEditor.InsertContent(type==Config.UBB?UBB.multimediaUbbToHtmlView(content):content);}
else{if(cEditor.isUBB())content=UBB.xhtmlToUbb(content);content=UBB.mediaUBBUrlToSign(UBB.imageUBBUrlToSign(UBB.imageHTMLUrlToSign(content)));cEditor.SetUBBStyle(content);}}
function CustomClose(){Win.Widget.Close();}
var Win=window.parent;if(!Win.RegIcon){Win.RegIcon=RegIcon;Win.CustomInsert=CustomInsert;Win.CustomClose=CustomClose;}
var Id=Url.QS()['Id'];Win.RegIcon[Id]=RegIcon;Win.CustomInsert[Id]=CustomInsert;Win.CustomClose[Id]=CustomClose;var face=window.parent.face;if(typeof face!='object')return;var img=new Image();img.src=face.defaultImg;var lineSize=13;var fl={'default':{},'custom':{}};var ftl={};ftl['default']=[];if(face['default']){var d=face['default'];for(var i=0,len=d.length;i<len;i++){var sc='[em:'+d[i][0]+']';var url=d[i][1];ftl['default'].push([sc,url,-i*face.height]);fl['default'][d[i][0]]=face.defaultPath+'/'+url;}
if(i%13!=12)
for(;i%13!=0;i++)
ftl['default'].push([]);}
if(face['default_custom']){var dc=face['default_custom'];for(var i=0,len=dc.length;i<len;i++){var sc='[face:'+dc[i][0]+']';var url=dc[i][1];ftl['default'].push([sc,url,-1]);fl['custom'][dc[i][0]]=face.path+'/'+url;}}
if(face.custom){var c=face.custom;for(var i=0,len=c.length;i<len;i++){var sc='[face:'+c[i][0]+']';var url=c[i][1];if(!ftl[c[i][2]])ftl[c[i][2]]=[];ftl[c[i][2]].push([sc,url]);fl['custom'][c[i][0]]=face.path+'/'+url;}}
Toolbar.faceList=fl;function addFl(fl,sc,url,pos){if(sc=='')return;var step=fl[sc.substr(0,1)]||(fl[sc.substr(0,1)]={});for(var j=1,_len=sc.length;j<_len;j++){var chr=sc.substr(j,1);if(!step[chr])step[chr]={};else{delete step[chr][0];delete step[chr][1];(typeof pos!='undefined')&&(delete step[2]);}
step=step[chr];}
if(!step)step={};step[0]=sc;step[1]=url;step['~']=true;(typeof pos!='undefined')&&(step[2]=pos);}
if(face.path&&face.path.lastIndexOf('/')!=face.path.length-1){face.path+='/';}
if(face.lowpath&&face.lowpath.lastIndexOf('/')!=face.lowpath.length-1){face.lowpath+='/';}
if(face.defaultPath&&face.defaultPath.lastIndexOf('/')!=face.defaultPath.length-1){face.defaultPath+='/';}
Toolbar.faceAbout={faceList:ftl,width:face.width,height:face.height,defaultImg:face.defaultImg,path:face.path,lowpath:face.lowpath,defaultPath:face.defaultPath,group:face.group,pageSize:65,faceManag

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -