内容显示页
 
类别:JavaScript | 浏览(1803) | 2007-8-28 17:30:24
/*=========================================================================
 * Intro       打开CSS文件,然后运行这个宏
 * FileName    CSSFormat.jsee
 * Author      yongfa365
 * Version     v2.0
 * WEB         http://www.yongfa365.com
 * Email       yongfa365[at]qq.com
 * FirstWrite  http://www.yongfa365.com/Item/CSS-Format-Tool-CSSFormat-For-Emeditor-Macros-yongfa365.html
 * LastModify  2007-10-06 03:47:31
 *==========================================================================*/

editor.ExecuteCommandByID(4105);//转为CR+LF格式,如果文件没有保存会提示保存
xPos = document.selection.GetActivePointX( eePosLogical ); 
yPos = document.selection.GetActivePointY( eePosLogical ); 

function CSSformat(n){
    if (document.selection.Text=="") document.selection.SelectAll();
    if (n==1){
        document.selection.Text = document.selection.Text.replace(/\r\n/g,"").replace(/}/g,"}\r\n").replace(/\*\//g,"*/\r\n").replace(/\t/g,"").replace(/\s*(:|;)\s*/g,"$1").replace(/ {2,}/g," ").replace(/\{ *(.+) *\}/g,"{$1}");
    }
    if (n==2){
        document.selection.Text = document.selection.Text.replace(/\r\n/g,"").replace(/}/g,"}\r\n").replace(/\s*(:|;)\s*/g,"$1").replace(/;/g,";\r\n\t").replace(/{/g,"{\r\n\t").replace(/}/g,"\r\n}").replace(/\*\//g,"*/\r\n");
    }
    document.selection.SetActivePoint( eePosLogical, xPos, yPos, false ); 
}

mainMenu=CreatePopupMenu();
mainMenu.Add("功能:对选中文字或全文CSS格式化",0);
mainMenu.Add("一行",1);
mainMenu.Add("多行",2);
mainMenu.Add("关于",3);
mainMenu.Add( "", 0, eeMenuSeparator );
var witchItem=mainMenu.Track();
switch(witchItem)
{
	case 1:
		CSSformat(1);
		break;
	case 2:
		CSSformat(2);
		break;
	case 3:
		alert("哈哈哈哈,柳永法制作,\nhttp://www.yongfa365.com");
		break;
	default:
		break;
}



引用:
CSS格式化工具 Emeditor宏 Macros
http://www.yongfa365.com/item/CSS-Format-Tool-CSSFormat-For-Emeditor-Macros-yongfa365.html
 
 
相关链接
 
网友评论:
姓名: 记住我
网址:
邮箱:
内容:
验证码:  验证码图片 看不清? 换张图试试
 
     
 
 
文章分类
 
 
.Net + C#(74)
 
 
ASP+VBS(161)
 
 
 
Linux(10)
 
 
 
web 2.0(26)
 
 
 
 
 
心程(68)
 
生活(97)
 
 
     

Power by :柳永法(yongfa365)'Blog  | 京ICP备07011491号  QQ:64049027  E-mail:64049027@qq.com Weibo

申请友情链接 要求:跟本站主题相类似正规网站,双方交换为首页位置

转载请注明来源,以便后人及时得到最新、修正、加强版!!!