code stringlengths 1 2.01M | repo_name stringlengths 3 62 | path stringlengths 1 267 | language stringclasses 231 values | license stringclasses 13 values | size int64 1 2.01M |
|---|---|---|---|---|---|
/*!
* MultiUpload for xheditor
* @requires xhEditor
*
* @author Yanis.Wang<yanis.wang@gmail.com>
* @site http://xheditor.com/
* @licence LGPL(http://www.opensource.org/licenses/lgpl-license.php)
*
* @Version: 0.9.2 (build 100505)
*/
var swfu,selQueue=[],selectID,arrMsg=[],allSize=0,uploadSize=0;
function removeFile()
{
var file;
if(!selectID)return;
for(var i in selQueue)
{
file=selQueue[i];
if(file.id==selectID)
{
selQueue.splice(i,1);
allSize-=file.size;
swfu.cancelUpload(file.id);
$('#'+file.id).remove();
selectID=null;
break;
}
}
$('#btnClear').hide();
if(selQueue.length==0)$('#controlBtns').hide();
}
function startUploadFiles()
{
if(swfu.getStats().files_queued>0)
{
$('#controlBtns').hide();
swfu.startUpload();
}
else alert('上传前请先添加文件');
}
function setFileState(fileid,txt)
{
$('#'+fileid+'_state').text(txt);
}
function fileQueued(file)//队列添加成功
{
for(var i in selQueue)if(selQueue[i].name==file.name){swfu.cancelUpload(file.id);return false;}//防止同名文件重复添加
if(selQueue.length==0)$('#controlBtns').show();
selQueue.push(file);
allSize+=file.size;
$('#listBody').append('<tr id="'+file.id+'"><td>'+file.name+'</td><td>'+formatBytes(file.size)+'</td><td id="'+file.id+'_state">就绪</td></tr>');
$('#'+file.id).hover(function(){$(this).addClass('hover');},function(){$(this).removeClass('hover');})
.click(function(){selectID=file.id;$('#listBody tr').removeClass('select');$(this).removeClass('hover').addClass('select');$('#btnClear').show();})
}
function fileQueueError(file, errorCode, message)//队列添加失败
{
var errorName='';
switch (errorCode)
{
case SWFUpload.QUEUE_ERROR.QUEUE_LIMIT_EXCEEDED:
errorName = "只能同时上传 "+this.settings.file_upload_limit+" 个文件";
break;
case SWFUpload.QUEUE_ERROR.FILE_EXCEEDS_SIZE_LIMIT:
errorName = "选择的文件超过了当前大小限制:"+this.settings.file_size_limit;
break;
case SWFUpload.QUEUE_ERROR.ZERO_BYTE_FILE:
errorName = "零大小文件";
break;
case SWFUpload.QUEUE_ERROR.INVALID_FILETYPE:
errorName = "文件扩展名必需为:"+this.settings.file_types_description+" ("+this.settings.file_types+")";
break;
default:
errorName = "未知错误";
break;
}
alert(errorName);
}
function uploadStart(file)//单文件上传开始
{
setFileState(file.id,'上传中…');
}
function uploadProgress(file, bytesLoaded, bytesTotal)//单文件上传进度
{
var percent=Math.ceil((uploadSize+bytesLoaded)/allSize*100);
$('#progressBar span').text(percent+'% ('+formatBytes(uploadSize+bytesLoaded)+' / '+formatBytes(allSize)+')');
$('#progressBar div').css('width',percent+'%');
}
function uploadSuccess(file, serverData)//单文件上传成功
{
var data=Object;
try{eval("data=" + serverData);}catch(ex){};
if(data.err!=undefined&&data.msg!=undefined)
{
if(!data.err)
{
uploadSize+=file.size;
arrMsg.push(data.msg);
setFileState(file.id,'上传成功');
}
else
{
setFileState(file.id,'上传失败');
alert(data.err);
}
}
else setFileState(file.id,'上传失败!');
}
function uploadError(file, errorCode, message)//单文件上传错误
{
setFileState(file.id,'上传失败!');
}
function uploadComplete(file)//文件上传周期结束
{
if(swfu.getStats().files_queued>0)swfu.startUpload();
else uploadAllComplete();
}
function uploadAllComplete()//全部文件上传成功
{
callback(arrMsg);
}
function formatBytes(bytes) {
var s = ['Byte', 'KB', 'MB', 'GB', 'TB', 'PB'];
var e = Math.floor(Math.log(bytes)/Math.log(1024));
return (bytes/Math.pow(1024, Math.floor(e))).toFixed(2)+" "+s[e];
} | zz-ms | trunk/zz-ms-v2.0/src/main/webapp/js/xheditor/xheditor_plugins/multiupload/multiupload.js | JavaScript | asf20 | 3,808 |
html,body{
font-size:12px;
padding:0px;margin:0;
overflow:hidden;
width:100%;height:100%;
}
#buttonArea{
background:url(img/bg1.gif);
border-top:1px solid #F0F5FA;
border-bottom:1px solid #99BBE8;
padding:3px;
}
#controlBtns{
float:right;
}
.btn{
display:inline-block;
color:#000;
text-decoration:none;
padding-right:3px;
cursor:pointer;
}
.btn span{
display:inline-block;
height:17px;
line-height:17px;
padding:2px;
}
.btn img{border:0;vertical-align:text-bottom;}
.btn:hover{background:url(img/btnbgr.gif) top right;}
.btn:hover span{background:url(img/btnbg.gif);}
#listArea{
overflow-x:hidden;
overflow-y:auto;
}
#listTitle tr{background:url(img/bg2.gif);}
#listTitle td{padding:5px;border-top:1px solid #F0F5FA;border-left:1px solid #fff;border-right:1px solid #ccc;border-bottom:1px solid #D0D0D0;}
#listBody tr{cursor:pointer;}
#listBody .hover{background:#F0F0F0;}
#listBody .select{background:#DFE8F6;}
#listBody td{padding:5px;border-bottom:1px solid #EDEDED;}
#progressArea{
background:#D4E1F2;
border-top:1px solid #99BBE8;
padding:3px;
}
#progressBar{
position: relative;
border:1px solid #6593CF;
padding:1px;
}
#progress{
height:16px;
background:#8FB5E8 url(img/progressbg.gif);
}
#progressBar span{
position: absolute;
text-align: center;
width:100%;line-height:16px;
color:#396095;
} | zz-ms | trunk/zz-ms-v2.0/src/main/webapp/js/xheditor/xheditor_plugins/multiupload/multiupload.css | CSS | asf20 | 1,392 |
/*!
* xhEditor - WYSIWYG XHTML Editor
* @requires jQuery v1.4.4
*
* @author Yanis.Wang<yanis.wang@gmail.com>
* @site http://xheditor.com/
* @licence LGPL(http://xheditor.com/license/lgpl.txt)
*
* @Version: 1.1.14 (build 120701)
*/
(function($,undefined){
if(window.xheditor)return false;//防止JS重复加载
var agent=navigator.userAgent.toLowerCase();
var bMobile=agent.indexOf('mobile')!==-1,browser=$.browser,browerVer=parseFloat(browser.version),isIE=browser.msie,isMozilla=browser.mozilla,isSafari=browser.safari,isOpera=browser.opera;
var bAir=agent.indexOf(' adobeair/')>-1;
var bIOS5=/OS 5(_\d)+ like Mac OS X/i.test(agent);
$.fn.xheditor=function(options)
{
if(bMobile&&!bIOS5)return false;//手机浏览器不初始化编辑器(IOS5除外)
var arrSuccess=[];
this.each(function(){
if(!$.nodeName(this,'TEXTAREA'))return;
if(options===false)//卸载
{
if(this.xheditor)
{
this.xheditor.remove();
this.xheditor=null;
}
}
else//初始化
{
if(!this.xheditor)
{
var tOptions=/({.*})/.exec($(this).attr('class'));
if(tOptions)
{
try{tOptions=eval('('+tOptions[1]+')');}catch(ex){};
options=$.extend({},tOptions,options );
}
var editor=new xheditor(this,options);
if(editor.init())
{
this.xheditor=editor;
arrSuccess.push(editor);
}
else editor=null;
}
else arrSuccess.push(this.xheditor);
}
});
if(arrSuccess.length===0)arrSuccess=false;
if(arrSuccess.length===1)arrSuccess=arrSuccess[0];
return arrSuccess;
}
var xCount=0,bShowPanel=false,bClickCancel=true,bShowModal=false,bCheckEscInit=false;
var _jPanel,_jShadow,_jCntLine,_jPanelButton;
var jModal,jModalShadow,layerShadow,jOverlay,jHideSelect,onModalRemove;
var editorRoot;
$('script[src*=xheditor]').each(function(){
var s=this.src;
if(s.match(/xheditor[^\/]*\.js/i)){editorRoot=s.replace(/[\?#].*$/, '').replace(/(^|[\/\\])[^\/]*$/, '$1');return false;}
});
if(isIE){
//ie6 缓存背景图片
try{document.execCommand('BackgroundImageCache', false, true );}
catch(e){}
//修正 jquery 1.6,1.7系列在IE6浏览器下造成width="auto"问题的修正
var jqueryVer=$.fn.jquery;
if(jqueryVer&&jqueryVer.match(/^1\.[67]/))$.attrHooks['width']=$.attrHooks['height']=null;
}
var specialKeys={ 27: 'esc', 9: 'tab', 32:'space', 13: 'enter', 8:'backspace', 145: 'scroll',
20: 'capslock', 144: 'numlock', 19:'pause', 45:'insert', 36:'home', 46:'del',
35:'end', 33: 'pageup', 34:'pagedown', 37:'left', 38:'up', 39:'right',40:'down',
112:'f1',113:'f2', 114:'f3', 115:'f4', 116:'f5', 117:'f6', 118:'f7', 119:'f8', 120:'f9', 121:'f10', 122:'f11', 123:'f12' };
var itemColors=['#FFFFFF','#CCCCCC','#C0C0C0','#999999','#666666','#333333','#000000','#FFCCCC','#FF6666','#FF0000','#CC0000','#990000','#660000','#330000','#FFCC99','#FF9966','#FF9900','#FF6600','#CC6600','#993300','#663300','#FFFF99','#FFFF66','#FFCC66','#FFCC33','#CC9933','#996633','#663333','#FFFFCC','#FFFF33','#FFFF00','#FFCC00','#999900','#666600','#333300','#99FF99','#66FF99','#33FF33','#33CC00','#009900','#006600','#003300','#99FFFF','#33FFFF','#66CCCC','#00CCCC','#339999','#336666','#003333','#CCFFFF','#66FFFF','#33CCFF','#3366FF','#3333FF','#000099','#000066','#CCCCFF','#9999FF','#6666CC','#6633FF','#6600CC','#333399','#330099','#FFCCFF','#FF99FF','#CC66CC','#CC33CC','#993399','#663366','#330033'];
var arrBlocktag=[{n:'p',t:'Paragraph'},{n:'h1',t:'Heading 1'},{n:'h2',t:'Heading 2'},{n:'h3',t:'Heading 3'},{n:'h4',t:'Heading 4'},{n:'h5',t:'Heading 5'},{n:'h6',t:'Heading 6'},{n:'pre',t:'Preformatted'},{n:'address',t:'Address'}];
var arrFontname=[{n:'Arial'},{n:'Arial Black'},{n:'Comic Sans MS'},{n:'Courier New'},{n:'System'},{n:'Times New Roman'},{n:'Tahoma'},{n:'Verdana'}];
var arrFontsize=[{n:'x-small',s:'10px',t:'1'},{n:'small',s:'13px',t:'2'},{n:'medium',s:'16px',t:'3'},{n:'large',s:'18px',t:'4'},{n:'x-large',s:'24px',t:'5'},{n:'xx-large',s:'32px',t:'6'},{n:'-webkit-xxx-large',s:'48px',t:'7'}];
var menuAlign=[{s:'Align left',v:'justifyleft'},{s:'Align center',v:'justifycenter'},{s:'Align right',v:'justifyright'},{s:'Align full',v:'justifyfull'}],menuList=[{s:'Ordered list',v:'insertOrderedList'},{s:'Unordered list',v:'insertUnorderedList'}];
var htmlPastetext='<div><label for="xhePastetextValue">Use Ctrl+V on your keyboard to paste the text.</label></div><div><textarea id="xhePastetextValue" wrap="soft" spellcheck="false" style="width:300px;height:100px;" /></div><div style="text-align:right;"><input type="button" id="xheSave" value="Ok" /></div>';
var htmlLink='<div><label for="xheLinkUrl">Link URL: </label><input type="text" id="xheLinkUrl" value="http://" class="xheText" /></div><div><label for="xheLinkTarget">Target: </label><select id="xheLinkTarget"><option selected="selected" value="">Default</option><option value="_blank">New window</option><option value="_self">Same window</option><option value="_parent">Parent window</option></select></div><div style="display:none"><label for="xheLinkText">Link Text:</label><input type="text" id="xheLinkText" value="" class="xheText" /></div><div style="text-align:right;"><input type="button" id="xheSave" value="Ok" /></div>';
var htmlAnchor='<div><label for="xheAnchorName">Anchor name: </label><input type="text" id="xheAnchorName" value="" class="xheText" /></div><div style="text-align:right;"><input type="button" id="xheSave" value="Ok" /></div>';
var htmlImg='<div><label for="xheImgUrl">Img URL: </label><input type="text" id="xheImgUrl" value="http://" class="xheText" /></div><div><div><label for="xheImgAlt">Alt text: </label><input type="text" id="xheImgAlt" /></div><div><label for="xheImgAlign">Alignment:</label><select id="xheImgAlign"><option selected="selected" value="">Default</option><option value="left">Left</option><option value="right">Right</option><option value="top">Top</option><option value="middle">Middle</option><option value="baseline">Baseline</option><option value="bottom">Bottom</option></select></div><div><label for="xheImgWidth">Width: </label><input type="text" id="xheImgWidth" style="width:40px;" /> <label for="xheImgHeight">Height: </label><input type="text" id="xheImgHeight" style="width:40px;" /></div><div><label for="xheImgBorder">Border: </label><input type="text" id="xheImgBorder" style="width:40px;" /></div><div><label for="xheImgHspace">Hspace: </label><input type="text" id="xheImgHspace" style="width:40px;" /> <label for="xheImgVspace">Vspace: </label><input type="text" id="xheImgVspace" style="width:40px;" /></div><div style="text-align:right;"><input type="button" id="xheSave" value="Ok" /></div>';
var htmlFlash='<div><label for="xheFlashUrl">Flash URL:</label><input type="text" id="xheFlashUrl" value="http://" class="xheText" /></div><div><label for="xheFlashWidth">Width: </label><input type="text" id="xheFlashWidth" style="width:40px;" value="480" /> <label for="xheFlashHeight">Height: </label><input type="text" id="xheFlashHeight" style="width:40px;" value="400" /></div><div style="text-align:right;"><input type="button" id="xheSave" value="Ok" /></div>';
var htmlMedia='<div><label for="xheMediaUrl">Media URL:</label><input type="text" id="xheMediaUrl" value="http://" class="xheText" /></div><div><label for="xheMediaWidth">Width: </label><input type="text" id="xheMediaWidth" style="width:40px;" value="480" /> <label for="xheMediaHeight">Height: </label><input type="text" id="xheMediaHeight" style="width:40px;" value="400" /></div><div style="text-align:right;"><input type="button" id="xheSave" value="Ok" /></div>';
var htmlTable='<div><label for="xheTableRows">Rows: </label><input type="text" id="xheTableRows" style="width:40px;" value="3" /> <label for="xheTableColumns">Cols: </label><input type="text" id="xheTableColumns" style="width:40px;" value="2" /></div><div><label for="xheTableHeaders">Headers: </label><select id="xheTableHeaders"><option selected="selected" value="">None</option><option value="row">First row</option><option value="col">First column</option><option value="both">Both</option></select></div><div><label for="xheTableWidth">Width: </label><input type="text" id="xheTableWidth" style="width:40px;" value="200" /> <label for="xheTableHeight">Height: </label><input type="text" id="xheTableHeight" style="width:40px;" value="" /></div><div><label for="xheTableBorder">Border: </label><input type="text" id="xheTableBorder" style="width:40px;" value="1" /></div><div><label for="xheTableCellSpacing">CellSpacing:</label><input type="text" id="xheTableCellSpacing" style="width:40px;" value="1" /> <label for="xheTableCellPadding">CellPadding:</label><input type="text" id="xheTableCellPadding" style="width:40px;" value="1" /></div><div><label for="xheTableAlign">Align: </label><select id="xheTableAlign"><option selected="selected" value="">Default</option><option value="left">Left</option><option value="center">Center</option><option value="right">Right</option></select></div><div><label for="xheTableCaption">Caption: </label><input type="text" id="xheTableCaption" /></div><div style="text-align:right;"><input type="button" id="xheSave" value="Ok" /></div>';
var htmlAbout='<div style="font:12px Arial;width:245px;word-wrap:break-word;word-break:break-all;outline:none;" role="dialog" tabindex="-1"><p><span style="font-size:20px;color:#1997DF;">xhEditor</span><br />v1.1.14 (build 120701)</p><p>xhEditor is a platform independent WYSWYG XHTML editor based by jQuery,released as Open Source under <a href="http://www.gnu.org/licenses/lgpl.html" target="_blank">LGPL</a>.</p><p>Copyright © <a href="http://xheditor.com/" target="_blank">xhEditor.com</a>. All rights reserved.</p></div>';
var itemEmots={'default':{name:'Default',width:24,height:24,line:7,list:{'smile':'Smile','tongue':'Tongue','titter':'Titter','laugh':'Laugh','sad':'Sad','wronged':'Wronged','fastcry':'Fast cry','cry':'Cry','wail':'Wail','mad':'Mad','knock':'Knock','curse':'Curse','crazy':'Crazy','angry':'Angry','ohmy':'Oh my','awkward':'Awkward','panic':'Panic','shy':'Shy','cute':'Cute','envy':'Envy','proud':'Proud','struggle':'Struggle','quiet':'Quiet','shutup':'Shut up','doubt':'Doubt','despise':'Despise','sleep':'Sleep','bye':'Bye'}}};
var arrTools={Cut:{t:'Cut (Ctrl+X)'},Copy:{t:'Copy (Ctrl+C)'},Paste:{t:'Paste (Ctrl+V)'},Pastetext:{t:'Paste as plain text',h:isIE?0:1},Blocktag:{t:'Block tag',h:1},Fontface:{t:'Font family',h:1},FontSize:{t:'Font size',h:1},Bold:{t:'Bold (Ctrl+B)',s:'Ctrl+B'},Italic:{t:'Italic (Ctrl+I)',s:'Ctrl+I'},Underline:{t:'Underline (Ctrl+U)',s:'Ctrl+U'},Strikethrough:{t:'Strikethrough'},FontColor:{t:'Select text color',h:1},BackColor:{t:'Select background color',h:1},SelectAll:{t:'SelectAll (Ctrl+A)'},Removeformat:{t:'Remove formatting'},Align:{t:'Align',h:1},List:{t:'List',h:1},Outdent:{t:'Outdent'},Indent:{t:'Indent'},Link:{t:'Insert/edit link (Ctrl+L)',s:'Ctrl+L',h:1},Unlink:{t:'Unlink'},Anchor:{t:'Anchor',h:1},Img:{t:'Insert/edit image',h:1},Flash:{t:'Insert/edit flash',h:1},Media:{t:'Insert/edit media',h:1},Hr:{t:'Horizontal rule'},Emot:{t:'Emotions',s:'ctrl+e',h:1},Table:{t:'Insert a new table',h:1},Source:{t:'Edit source code'},Preview:{t:'Preview'},Print:{t:'Print (Ctrl+P)',s:'Ctrl+P'},Fullscreen:{t:'Toggle fullscreen (Esc)',s:'Esc'},About:{t:'About xhEditor'}};
var toolsThemes={
mini:'Bold,Italic,Underline,Strikethrough,|,Align,List,|,Link,Img',
simple:'Blocktag,Fontface,FontSize,Bold,Italic,Underline,Strikethrough,FontColor,BackColor,|,Align,List,Outdent,Indent,|,Link,Img,Emot',
full:'Cut,Copy,Paste,Pastetext,|,Blocktag,Fontface,FontSize,Bold,Italic,Underline,Strikethrough,FontColor,BackColor,SelectAll,Removeformat,|,Align,List,Outdent,Indent,|,Link,Unlink,Anchor,Img,Flash,Media,Hr,Emot,Table,|,Source,Preview,Print,Fullscreen'};
toolsThemes.mfull=toolsThemes.full.replace(/\|(,Align)/i,'/$1');
var arrDbClick={'a':'Link','img':'Img','embed':'Embed'},uploadInputname='filedata';
var arrEntities={'<':'<','>':'>','"':'"','®':'®','©':'©'};//实体
var regEntities=/[<>"®©]/g;
var xheditor=function(textarea,options)
{
var _this=this,_text=textarea,_jText=$(_text),_jForm=_jText.closest('form'),_jTools,_jArea,_win,_jWin,_doc,_jDoc;
var bookmark;
var bInit=false,bSource=false,bFullscreen=false,bCleanPaste=false,outerScroll,bShowBlocktag=false,sLayoutStyle='',ev=null,timer,bDisableHoverExec=false,bQuickHoverExec=false;
var lastPoint=null,lastAngle=null;//鼠标悬停显示
var editorHeight=0;
var settings=_this.settings=$.extend({},xheditor.settings,options );
var plugins=settings.plugins,strPlugins=[];
if(plugins)
{
arrTools=$.extend({},arrTools,plugins);
$.each(plugins,function(n){strPlugins.push(n);});
strPlugins=strPlugins.join(',');
}
if(settings.tools.match(/^\s*(m?full|simple|mini)\s*$/i))
{
var toolsTheme=toolsThemes[$.trim(settings.tools)];
settings.tools=(settings.tools.match(/m?full/i)&&plugins)?toolsTheme.replace('Table','Table,'+strPlugins):toolsTheme;//插件接在full的Table后面
}
//如需删除关于按钮,请往官方网站购买商业授权:http://xheditor.com/service
//在未购买商业授权的情况下私自去除xhEditor的版权信息,您将得不到官方提供的任何技术支持和BUG反馈服务,并且我们将对您保留法律诉讼的权利
//请支持开源项目
if(!settings.tools.match(/(^|,)\s*About\s*(,|$)/i))settings.tools+=',About';
settings.tools=settings.tools.split(',');
if(settings.editorRoot)editorRoot=settings.editorRoot;
if(bAir===false)editorRoot=getLocalUrl(editorRoot,'abs');
if(settings.urlBase)settings.urlBase=getLocalUrl(settings.urlBase,'abs');
//基本控件名
var idCSS='xheCSS_'+settings.skin,idContainer='xhe'+xCount+'_container',idTools='xhe'+xCount+'_Tool',idIframeArea='xhe'+xCount+'_iframearea',idIframe='xhe'+xCount+'_iframe',idFixFFCursor='xhe'+xCount+'_fixffcursor';
var headHTML='',bodyClass='',skinPath=editorRoot+'xheditor_skin/'+settings.skin+'/',arrEmots=itemEmots,urlType=settings.urlType,urlBase=settings.urlBase,emotPath=settings.emotPath,emotPath=emotPath?emotPath:editorRoot+'xheditor_emot/',selEmotGroup='';
arrEmots=$.extend({},arrEmots,settings.emots);
emotPath=getLocalUrl(emotPath,'rel',urlBase?urlBase:null);//返回最短表情路径
bShowBlocktag=settings.showBlocktag;
if(bShowBlocktag)bodyClass+=' showBlocktag';
var arrShortCuts=[];
this.init=function()
{
//加载样式表
if($('#'+idCSS).length===0)$('head').append('<link id="'+idCSS+'" rel="stylesheet" type="text/css" href="'+skinPath+'ui.css" />');
//初始化编辑器
var textareaWidth=_jText.outerWidth(),textareaHeight=_jText.outerHeight();
var editorWidth = settings.width || _text.style.width || (textareaWidth>10?textareaWidth:0);
editorHeight = settings.height || _text.style.height || (textareaHeight>10?textareaHeight:150);//默认高度
if(is(editorWidth,'number'))editorWidth+='px';
if(is(editorHeight,'string'))editorHeight=editorHeight.replace(/[^\d]+/g,'');
//编辑器CSS背景
var editorBackground=settings.background || _text.style.background;
//工具栏内容初始化
var arrToolsHtml=['<span class="xheGStart"/>'],tool,cn,regSeparator=/\||\//i;
$.each(settings.tools,function(i,n)
{
if(n.match(regSeparator))arrToolsHtml.push('<span class="xheGEnd"/>');
if(n==='|')arrToolsHtml.push('<span class="xheSeparator"/>');
else if(n==='/')arrToolsHtml.push('<br />');
else
{
tool=arrTools[n];
if(!tool)return;
if(tool.c)cn=tool.c;
else cn='xheIcon xheBtn'+n;
arrToolsHtml.push('<span><a href="#" title="'+tool.t+'" cmd="'+n+'" class="xheButton xheEnabled" tabindex="-1" role="button"><span class="'+cn+'" unselectable="on" style="font-size:0;color:transparent;text-indent:-999px;">'+tool.t+'</span></a></span>');
if(tool.s)_this.addShortcuts(tool.s,n);
}
if(n.match(regSeparator))arrToolsHtml.push('<span class="xheGStart"/>');
});
arrToolsHtml.push('<span class="xheGEnd"/><br />');
_jText.after($('<input type="text" id="'+idFixFFCursor+'" style="position:absolute;display:none;" /><span id="'+idContainer+'" class="xhe_'+settings.skin+'" style="display:none"><table cellspacing="0" cellpadding="0" class="xheLayout" style="'+(editorWidth!='0px'?'width:'+editorWidth+';':'')+'height:'+editorHeight+'px;" role="presentation"><tr><td id="'+idTools+'" class="xheTool" unselectable="on" style="height:1px;" role="presentation"></td></tr><tr><td id="'+idIframeArea+'" class="xheIframeArea" role="presentation"><iframe frameborder="0" id="'+idIframe+'" src="javascript:;" style="width:100%;"></iframe></td></tr></table></span>'));
_jTools=$('#'+idTools);_jArea=$('#'+idIframeArea);
headHTML='<meta http-equiv="Content-Type" content="text/html; charset=utf-8" /><link rel="stylesheet" href="'+skinPath+'iframe.css"/>';
var loadCSS=settings.loadCSS;
if(loadCSS)
{
if(is(loadCSS,'array'))for(var i in loadCSS)headHTML+='<link rel="stylesheet" href="'+loadCSS[i]+'"/>';
else
{
if(loadCSS.match(/\s*<style(\s+[^>]*?)?>[\s\S]+?<\/style>\s*/i))headHTML+=loadCSS;
else headHTML+='<link rel="stylesheet" href="'+loadCSS+'"/>';
}
}
var iframeHTML='<html><head>'+headHTML+'<title>WYSIWYG Editor,press alt+1-9,toogle to tool area,press tab,select button,press esc,return editor '+(settings.readTip?settings.readTip:'')+'</title>';
if(editorBackground)iframeHTML+='<style>html{background:'+editorBackground+';}</style>';
iframeHTML+='</head><body spellcheck="0" class="editMode'+bodyClass+'"></body></html>';
_this.win=_win=$('#'+idIframe)[0].contentWindow;
_jWin=$(_win);
try{
this.doc=_doc = _win.document;_jDoc=$(_doc);
_doc.open();
_doc.write(iframeHTML);
_doc.close();
if(isIE)_doc.body.contentEditable='true';
else _doc.designMode = 'On';
}catch(e){}
setTimeout(setOpts,300);
_this.setSource();
_win.setInterval=null;//针对jquery 1.3无法操作iframe window问题的hack
//添加工具栏
_jTools.append(arrToolsHtml.join('')).bind('mousedown contextmenu',returnFalse).click(function(event)
{
var jButton=$(event.target).closest('a');
if(jButton.is('.xheEnabled'))
{
clearTimeout(timer);//取消悬停执行
_jTools.find('a').attr('tabindex','-1');//无障碍支持
ev=event;
_this.exec(jButton.attr('cmd'));
}
return false;
});
_jTools.find('.xheButton').hover(function(event){//鼠标悬停执行
var jButton=$(this),delay=settings.hoverExecDelay;
var tAngle=lastAngle;lastAngle=null;
if(delay===-1||bDisableHoverExec||!jButton.is('.xheEnabled'))return false;
if(tAngle&&tAngle>10)//检测误操作
{
bDisableHoverExec=true;
setTimeout(function(){bDisableHoverExec=false;},100);
return false;
}
var cmd=jButton.attr('cmd'),bHover=arrTools[cmd].h===1;
if(!bHover)
{
_this.hidePanel();//移到非悬停按钮上隐藏面板
return false;
}
if(bQuickHoverExec)delay=0;
if(delay>=0)timer=setTimeout(function(){
ev=event;
lastPoint={x:ev.clientX,y:ev.clientY};
_this.exec(cmd);
},delay);
},function(event){lastPoint=null;if(timer)clearTimeout(timer);}).mousemove(function(event){
if(lastPoint)
{
var diff={x:event.clientX-lastPoint.x,y:event.clientY-lastPoint.y};
if(Math.abs(diff.x)>1||Math.abs(diff.y)>1)
{
if(diff.x>0&&diff.y>0)
{
var tAngle=Math.round(Math.atan(diff.y/diff.x)/0.017453293);
if(lastAngle)lastAngle=(lastAngle+tAngle)/2
else lastAngle=tAngle;
}
else lastAngle=null;
lastPoint={x:event.clientX,y:event.clientY};
}
}
});
//初始化面板
_jPanel=$('#xhePanel');
_jShadow=$('#xheShadow');
_jCntLine=$('#xheCntLine');
if(_jPanel.length===0)
{
_jPanel=$('<div id="xhePanel"></div>').mousedown(function(ev){ev.stopPropagation()});
_jShadow=$('<div id="xheShadow"></div>');
_jCntLine=$('<div id="xheCntLine"></div>');
setTimeout(function(){
$(document.body).append(_jPanel).append(_jShadow).append(_jCntLine);
},10);
}
//切换显示区域
$('#'+idContainer).show();
_jText.hide();
_jArea.css('height',editorHeight-_jTools.outerHeight());
if(isIE&browerVer<8)setTimeout(function(){_jArea.css('height',editorHeight-_jTools.outerHeight());},1);
//绑定内核事件
_jText.focus(_this.focus);
_jForm.submit(saveResult).bind('reset', loadReset);//绑定表单的提交和重置事件
if(settings.submitID)$('#'+settings.submitID).mousedown(saveResult);//自定义绑定submit按钮
$(window).bind('unload beforeunload',saveResult).bind('resize',fixFullHeight);
$(document).mousedown(clickCancelPanel);
if(!bCheckEscInit){$(document).keydown(checkEsc);bCheckEscInit=true;}
_jWin.focus(function(){if(settings.focus)settings.focus();}).blur(function(){if(settings.blur)settings.blur();});
if(isSafari)_jWin.click(fixAppleSel);
_jDoc.mousedown(clickCancelPanel).keydown(checkShortcuts).keypress(forcePtag).dblclick(checkDblClick).bind('mousedown click',function(ev){_jText.trigger(ev.type);});
if(isIE)
{
//IE控件上Backspace会导致页面后退
_jDoc.keydown(function(ev){var rng=_this.getRng();if(ev.which===8&&rng.item){$(rng.item(0)).remove();return false;}});
//修正IE拖动img大小不更新width和height属性值的问题
function fixResize(ev)
{
var jImg=$(ev.target),v;
if(v=jImg.css('width'))jImg.css('width','').attr('width',v.replace(/[^0-9%]+/g, ''));
if(v=jImg.css('height'))jImg.css('height','').attr('height',v.replace(/[^0-9%]+/g, ''));
}
_jDoc.bind('controlselect',function(ev){
ev=ev.target;if(!$.nodeName(ev,'IMG'))return;
$(ev).unbind('resizeend',fixResize).bind('resizeend',fixResize);
});
}
//无障碍支持
_jDoc.keydown(function(e){
var which=e.which;
if(e.altKey&&which>=49&&which<=57){
_jTools.find('a').attr('tabindex','0');
_jTools.find('.xheGStart').eq(which-49).next().find('a').focus();
_doc.title='\uFEFF\uFEFF';
return false;
}
}).click(function(){
_jTools.find('a').attr('tabindex','-1');
});
_jTools.keydown(function(e){
var which=e.which;
if(which==27){
_jTools.find('a').attr('tabindex','-1');
_this.focus();
}
else if(e.altKey&&which>=49&&which<=57){
_jTools.find('.xheGStart').eq(which-49).next().find('a').focus();
return false;
}
});
var jBody=$(_doc.documentElement);
//自动清理粘贴内容
if(isOpera)jBody.bind('keydown',function(e){if(e.ctrlKey&&e.which===86)cleanPaste();});
else jBody.bind(isIE?'beforepaste':'paste',cleanPaste);
//禁用编辑区域的浏览器默认右键菜单
if(settings.disableContextmenu)jBody.bind('contextmenu',returnFalse);
//HTML5编辑区域直接拖放上传
if(settings.html5Upload)jBody.bind('dragenter dragover',function(ev){var types;if((types=ev.originalEvent.dataTransfer.types)&&$.inArray('Files', types)!==-1)return false;}).bind('drop',function(ev){
var dataTransfer=ev.originalEvent.dataTransfer,fileList;
if(dataTransfer&&(fileList=dataTransfer.files)&&fileList.length>0){
var i,cmd,arrCmd=['Link','Img','Flash','Media'],arrExt=[],strExt;
for(i in arrCmd){
cmd=arrCmd[i];
if(settings['up'+cmd+'Url']&&settings['up'+cmd+'Url'].match(/^[^!].*/i))arrExt.push(cmd+':,'+settings['up'+cmd+'Ext']);//允许上传
}
if(arrExt.length===0)return false;//禁止上传
else strExt=arrExt.join(',');
function getCmd(fileList){
var match,fileExt,cmd;
for(i=0;i<fileList.length;i++){
fileExt=fileList[i].name.replace(/.+\./,'');
if(match=strExt.match(new RegExp('(\\w+):[^:]*,'+fileExt+'(?:,|$)','i'))){
if(!cmd)cmd=match[1];
else if(cmd!==match[1])return 2;
}
else return 1;
}
return cmd;
}
cmd=getCmd(fileList);
if(cmd===1)alert('Upload file extension required for this: '+strExt.replace(/\w+:,/g,''));
else if(cmd===2)alert('You can only drag and drop the same type of files.');
else if(cmd){
_this.startUpload(fileList,settings['up'+cmd+'Url'],'*',function(arrMsg){
var arrUrl=[],msg,onUpload=settings.onUpload;
if(onUpload)onUpload(arrMsg);//用户上传回调
for(var i=0,c=arrMsg.length;i<c;i++){
msg=arrMsg[i];
url=is(msg,'string')?msg:msg.url;
if(url.substr(0,1)==='!')url=url.substr(1);
arrUrl.push(url);
}
_this.exec(cmd);
$('#xhe'+cmd+'Url').val(arrUrl.join(' '));
$('#xheSave').click();
});
}
return false;
}
});
//添加用户快捷键
var shortcuts=settings.shortcuts;
if(shortcuts)$.each(shortcuts,function(key,func){_this.addShortcuts(key,func);});
xCount++;
bInit=true;
if(settings.fullscreen)_this.toggleFullscreen();
else if(settings.sourceMode)setTimeout(_this.toggleSource,20);
return true;
}
this.remove=function()
{
_this.hidePanel();
saveResult();//卸载前同步最新内容到textarea
//取消绑定事件
_jText.unbind('focus',_this.focus);
_jForm.unbind('submit',saveResult).unbind('reset', loadReset);
if(settings.submitID)$('#'+settings.submitID).unbind('mousedown',saveResult);
$(window).unbind('unload beforeunload',saveResult).unbind('resize',fixFullHeight);
$(document).unbind('mousedown',clickCancelPanel);
$('#'+idContainer).remove();
$('#'+idFixFFCursor).remove();
_jText.show();
bInit=false;
}
this.saveBookmark=function(){
if(!bSource){
_this.focus();
var rng=_this.getRng();
rng=rng.cloneRange?rng.cloneRange():rng;
bookmark={'top':_jWin.scrollTop(),'rng':rng};
}
}
this.loadBookmark=function()
{
if(bSource||!bookmark)return;
_this.focus();
var rng=bookmark.rng;
if(isIE)rng.select();
else
{
var sel=_this.getSel();
sel.removeAllRanges();
sel.addRange(rng);
}
_jWin.scrollTop(bookmark.top);
bookmark=null;
}
this.focus=function()
{
if(!bSource)_win.focus();
else $('#sourceCode',_doc).focus();
if(isIE){
var rng=_this.getRng();
if(rng.parentElement&&rng.parentElement().ownerDocument!==_doc)_this.setTextCursor();//修正IE初始焦点问题
}
return false;
}
this.setTextCursor=function(bLast)
{
var rng=_this.getRng(true),cursorNode=_doc.body;
if(isIE)rng.moveToElementText(cursorNode);
else{
var chileName=bLast?'lastChild':'firstChild';
while(cursorNode.nodeType!=3&&cursorNode[chileName]){cursorNode=cursorNode[chileName];}
rng.selectNode(cursorNode);
}
rng.collapse(bLast?false:true);
if(isIE)rng.select();
else{var sel=_this.getSel();sel.removeAllRanges();sel.addRange(rng);}
}
this.getSel=function()
{
return _doc.selection ? _doc.selection : _win.getSelection();
}
this.getRng=function(bNew)
{
var sel,rng;
try{
if(!bNew){
sel=_this.getSel();
rng = sel.createRange ? sel.createRange() : sel.rangeCount > 0?sel.getRangeAt(0):null;
}
if(!rng)rng = _doc.body.createTextRange?_doc.body.createTextRange():_doc.createRange();
}catch (ex){}
return rng;
}
this.getParent=function(tag)
{
var rng=_this.getRng(),p;
if(!isIE)
{
p = rng.commonAncestorContainer;
if(!rng.collapsed)if(rng.startContainer === rng.endContainer&&rng.startOffset - rng.endOffset < 2&&rng.startContainer.hasChildNodes())p = rng.startContainer.childNodes[rng.startOffset];
}
else p=rng.item?rng.item(0):rng.parentElement();
tag=tag?tag:'*';p=$(p);
if(!p.is(tag))p=$(p).closest(tag);
return p;
}
this.getSelect=function(format)
{
var sel=_this.getSel(),rng=_this.getRng(),isCollapsed=true;
if (!rng || rng.item)isCollapsed=false
else isCollapsed=!sel || rng.boundingWidth === 0 || rng.collapsed;
if(format==='text')return isCollapsed ? '' : (rng.text || (sel.toString ? sel.toString() : ''));
var sHtml;
if(rng.cloneContents)
{
var tmp=$('<div></div>'),c;
c = rng.cloneContents();
if(c)tmp.append(c);
sHtml=tmp.html();
}
else if(is(rng.item))sHtml=rng.item(0).outerHTML;
else if(is(rng.htmlText))sHtml=rng.htmlText;
else sHtml=rng.toString();
if(isCollapsed)sHtml='';
sHtml=_this.processHTML(sHtml,'read');
sHtml=_this.cleanHTML(sHtml);
sHtml=_this.formatXHTML(sHtml);
return sHtml;
}
this.pasteHTML=function(sHtml,bStart)
{
if(bSource)return false;
_this.focus();
sHtml=_this.processHTML(sHtml,'write');
var sel=_this.getSel(),rng=_this.getRng();
if(bStart!==undefined)//非覆盖式插入
{
if(rng.item)
{
var item=rng.item(0);
rng=_this.getRng(true);
rng.moveToElementText(item);
rng.select();
}
rng.collapse(bStart);
}
sHtml+='<'+(isIE?'img':'span')+' id="_xhe_temp" width="0" height="0" />';
if(rng.insertNode)
{
if($(rng.startContainer).closest('style,script').length>0)return false;//防止粘贴在style和script内部
rng.deleteContents();
rng.insertNode(rng.createContextualFragment(sHtml));
}
else
{
if(sel.type.toLowerCase()==='control'){sel.clear();rng=_this.getRng();};
rng.pasteHTML(sHtml);
}
var jTemp=$('#_xhe_temp',_doc),temp=jTemp[0];
if(isIE)
{
rng.moveToElementText(temp);
rng.select();
}
else
{
rng.selectNode(temp);
sel.removeAllRanges();
sel.addRange(rng);
}
jTemp.remove();
}
this.pasteText=function(text,bStart)
{
if(!text)text='';
text=_this.domEncode(text);
text = text.replace(/\r?\n/g, '<br />');
_this.pasteHTML(text,bStart);
}
this.appendHTML=function(sHtml)
{
if(bSource)return false;
_this.focus();
sHtml=_this.processHTML(sHtml,'write');
$(_doc.body).append(sHtml);
_this.setTextCursor(true);
}
this.domEncode=function(text)
{
return text.replace(regEntities,function(c){return arrEntities[c];});
}
this.setSource=function(sHtml)
{
bookmark=null;
if(typeof sHtml!=='string'&&sHtml!=='')sHtml=_text.value;
if(bSource)$('#sourceCode',_doc).val(sHtml);
else
{
if(settings.beforeSetSource)sHtml=settings.beforeSetSource(sHtml);
sHtml=_this.cleanHTML(sHtml);
sHtml=_this.formatXHTML(sHtml);
sHtml=_this.processHTML(sHtml,'write');
if(isIE){//修正IE会删除可视内容前的script,style,<!--
_doc.body.innerHTML='<img id="_xhe_temp" width="0" height="0" />'+sHtml;//修正IE会删除&符号后面代码的问题
$('#_xhe_temp',_doc).remove();
}
else _doc.body.innerHTML=sHtml;
}
}
this.processHTML=function(sHtml,mode)
{
var appleClass=' class="Apple-style-span"';
if(mode==='write')
{//write
sHtml=sHtml.replace(/(<(\/?)(\w+))((?:\s+[\w\-:]+\s*=\s*(?:"[^"]*"|'[^']*'|[^>\s]+))*)\s*((\/?)>)/g,function(all,left,end1,tag,attr,right,end2){
tag=tag.toLowerCase();
if(isMozilla){
if(tag==='strong')tag='b';
else if(tag==='em')tag='i';
}
else if(isSafari){
if(tag==='strong'){tag='span';if(!end1)attr+=appleClass+' style="font-weight: bold;"';}
else if(tag==='em'){tag='span';if(!end1)attr+=appleClass+' style="font-style: italic;"';}
else if(tag==='u'){tag='span';if(!end1)attr+=appleClass+' style="text-decoration: underline;"';}
else if(tag==='strike'){tag='span';if(!end1)attr+=appleClass+' style="text-decoration: line-through;"';}
}
var emot,addClass='';
if(tag==='del')tag='strike';//编辑状态统一转为strike
else if(tag==='img'){
//恢复emot
attr=attr.replace(/\s+emot\s*=\s*("[^"]*"|'[^']*'|[^>\s]+)/i,function(all,v){
emot=v.match(/^(["']?)(.*)\1/)[2];
emot=emot.split(',');
if(!emot[1]){emot[1]=emot[0];emot[0]=''}
if(emot[0]==='default')emot[0]='';
return settings.emotMark?all:'';
});
}
else if(tag==='a'){
if(!attr.match(/ href=[^ ]/i)&&attr.match(/ name=[^ ]/i))addClass+=' xhe-anchor';
if(end2)right='></a>';
}
else if(tag==='table'&&!end1){
var tb=attr.match(/\s+border\s*=\s*("[^"]*"|'[^']*'|[^>\s]+)/i);
if(!tb||tb[1].match(/^(["']?)\s*0\s*\1$/))addClass+=' xhe-border';
}
var bAppleClass;
//处理属性
attr=attr.replace(/\s+([\w\-:]+)\s*=\s*("[^"]*"|'[^']*'|[^>\s]+)/g,function(all,n,v){
n=n.toLowerCase();
v=v.match(/^(["']?)(.*)\1/)[2];
aft='';//尾部增加属性
if(isIE&&n.match(/^(disabled|checked|readonly|selected)$/)&&v.match(/^(false|0)$/i))return '';
//恢复emot
if(tag==='img'&&emot&&n==='src')return '';
//保存属性值:src,href
if(n.match(/^(src|href)$/)){
aft=' _xhe_'+n+'="'+v+'"';
if(urlBase)v=getLocalUrl(v,'abs',urlBase);
}
//添加class
if(addClass&&n==='class'){
v+=' '+addClass;
addClass='';
}
//处理Safari style值
if(isSafari&&n==='style'){
if(tag==='span'&&v.match(/(^|;)\s*(font-family|font-size|color|background-color)\s*:\s*[^;]+\s*(;|$)/i))bAppleClass=true;
}
return ' '+n+'="'+v+'"'+aft;
});
//恢复emot
if(emot){
var url=emotPath+(emot[0]?emot[0]:'default')+'/'+emot[1]+'.gif';
attr+=' src="'+url+'" _xhe_src="'+url+'"';
}
if(bAppleClass)attr+=appleClass;
if(addClass)attr+=' class="'+addClass+'"';
return '<'+end1+tag+attr+right;
});
if(isIE)sHtml = sHtml.replace(/'/ig, ''');
if(!isSafari)
{
//style转font
function style2font(all,tag,left,style,right,content)
{
var attrs='',f,s1,s2,c;
f=style.match(/font-family\s*:\s*([^;"]+)/i);
if(f)attrs+=' face="'+f[1]+'"';
s1=style.match(/font-size\s*:\s*([^;"]+)/i);
if(s1)
{
s1=s1[1].toLowerCase();
for(var j=0;j<arrFontsize.length;j++)if(s1===arrFontsize[j].n||s1===arrFontsize[j].s){s2=j+1;break;}
if(s2)
{
attrs+=' size="'+s2+'"';
style=style.replace(/(^|;)(\s*font-size\s*:\s*[^;"]+;?)+/ig,'$1');
}
}
c=style.match(/(?:^|[\s;])color\s*:\s*([^;"]+)/i);
if(c)
{
var rgb;
if(rgb=c[1].match(/\s*rgb\s*\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*\)/i)){
c[1]='#';
for(var i=1;i<=3;i++){
c[1]+=('0'+(rgb[i]-0).toString(16)).slice(-2);
}
}
c[1]=c[1].replace(/^#([0-9a-f])([0-9a-f])([0-9a-f])$/i,'#$1$1$2$2$3$3');
attrs+=' color="'+c[1]+'"';
}
style=style.replace(/(^|;)(\s*(font-family|color)\s*:\s*[^;"]+;?)+/ig,'$1');
if(attrs!=='')
{
if(style)attrs+=' style="'+style+'"';
return '<font'+(left?left:'')+attrs+(right?right:'')+'>'+content+"</font>";
}
else return all;
}
sHtml = sHtml.replace(/<(span)(\s+[^>]*?)?\s+style\s*=\s*"((?:[^"]*?;)?\s*(?:font-family|font-size|color)\s*:[^"]*)"( [^>]*)?>(((?!<\1(\s+[^>]*?)?>)[\s\S]|<\1(\s+[^>]*?)?>((?!<\1(\s+[^>]*?)?>)[\s\S]|<\1(\s+[^>]*?)?>((?!<\1(\s+[^>]*?)?>)[\s\S])*?<\/\1>)*?<\/\1>)*?)<\/\1>/ig,style2font);//第3层
sHtml = sHtml.replace(/<(span)(\s+[^>]*?)?\s+style\s*=\s*"((?:[^"]*?;)?\s*(?:font-family|font-size|color)\s*:[^"]*)"( [^>]*)?>(((?!<\1(\s+[^>]*?)?>)[\s\S]|<\1(\s+[^>]*?)?>((?!<\1(\s+[^>]*?)?>)[\s\S])*?<\/\1>)*?)<\/\1>/ig,style2font);//第2层
sHtml = sHtml.replace(/<(span)(\s+[^>]*?)?\s+style\s*=\s*"((?:[^"]*?;)?\s*(?:font-family|font-size|color)\s*:[^"]*)"( [^>]*)?>(((?!<\1(\s+[^>]*?)?>)[\s\S])*?)<\/\1>/ig,style2font);//最里层
}
//表格单元格处理
sHtml = sHtml.replace(/<(td|th)(\s+[^>]*?)?>(\s| )*<\/\1>/ig,'<$1$2>'+(isIE?'':'<br />')+'</$1>');
}
else
{//read
if(isSafari)
{
//转换apple的style为strong,em等
var arrAppleSpan=[{r:/font-weight\s*:\s*bold;?/ig,t:'strong'},{r:/font-style\s*:\s*italic;?/ig,t:'em'},{r:/text-decoration\s*:\s*underline;?/ig,t:'u'},{r:/text-decoration\s*:\s*line-through;?/ig,t:'strike'}];
function replaceAppleSpan(all,tag,attr1,attr2,content)
{
var attr=(attr1?attr1:'')+(attr2?attr2:'');
var arrPre=[],arrAft=[];
var regApple,tagApple;
for(var i=0;i<arrAppleSpan.length;i++)
{
regApple=arrAppleSpan[i].r;
tagApple=arrAppleSpan[i].t;
attr=attr.replace(regApple,function(){
arrPre.push("<"+tagApple+">");
arrAft.push("</"+tagApple+">");
return '';
});
}
attr=attr.replace(/\s+style\s*=\s*"\s*"/i,'');
return (attr?'<span'+attr+'>':'')+arrPre.join('')+content+arrAft.join('')+(attr?'</span>':'');
}
for(var i=0;i<2;i++){
sHtml = sHtml.replace(/<(span)(\s+[^>]*?)?\s+class\s*=\s*"Apple-style-span"(\s+[^>]*?)?>(((?!<\1(\s+[^>]*?)?>)[\s\S]|<\1(\s+[^>]*?)?>((?!<\1(\s+[^>]*?)?>)[\s\S]|<\1(\s+[^>]*?)?>((?!<\1(\s+[^>]*?)?>)[\s\S])*?<\/\1>)*?<\/\1>)*?)<\/\1>/ig,replaceAppleSpan);//第3层
sHtml = sHtml.replace(/<(span)(\s+[^>]*?)?\s+class\s*=\s*"Apple-style-span"(\s+[^>]*?)?>(((?!<\1(\s+[^>]*?)?>)[\s\S]|<\1(\s+[^>]*?)?>((?!<\1(\s+[^>]*?)?>)[\s\S])*?<\/\1>)*?)<\/\1>/ig,replaceAppleSpan);//第2层
sHtml = sHtml.replace(/<(span)(\s+[^>]*?)?\s+class\s*=\s*"Apple-style-span"(\s+[^>]*?)?>(((?!<\1(\s+[^>]*?)?>)[\s\S])*?)<\/\1>/ig,replaceAppleSpan);//最里层
}
}
sHtml=sHtml.replace(/(<(\w+))((?:\s+[\w\-:]+\s*=\s*(?:"[^"]*"|'[^']*'|[^>\s]+))*)\s*(\/?>)/g,function(all,left,tag,attr,right){
tag=tag.toLowerCase();
//恢复属性值src,href
var saveValue;
attr=attr.replace(/\s+_xhe_(?:src|href)\s*=\s*("[^"]*"|'[^']*'|[^>\s]+)/i,function(all,v){saveValue=v.match(/^(["']?)(.*)\1/)[2];return '';});
if(saveValue&&urlType)saveValue=getLocalUrl(saveValue,urlType,urlBase);
attr=attr.replace(/\s+([\w\-:]+)\s*=\s*("[^"]*"|'[^']*'|[^>\s]+)/g,function(all,n,v){
n=n.toLowerCase();
v=v.match(/^(["']?)(.*)\1/)[2].replace(/"/g,"'");
if(n==='class'){//清理class属性
if(v.match(/^["']?(apple|webkit)/i))return '';
v=v.replace(/\s?xhe-[a-z]+/ig,'');
if(v==='')return '';
}
else if(n.match(/^((_xhe_|_moz_|_webkit_)|jquery\d+)/i))return '';//清理临时属性
else if(saveValue&&n.match(/^(src|href)$/i))return ' '+n+'="'+saveValue+'"';//恢复属性值src,href
else if(n==='style'){//转换font-size的keyword到px单位
v=v.replace(/(^|;)\s*(font-size)\s*:\s*([a-z-]+)\s*(;|$)/i,function(all,left,n,v,right){
var t,s;
for(var i=0;i<arrFontsize.length;i++)
{
t=arrFontsize[i];
if(v===t.n){s=t.s;break;}
}
return left+n+':'+s+right;
});
}
return ' '+n+'="'+v+'"';
});
//img强制加alt
if(tag==='img'&&!attr.match(/\s+alt\s*=\s*("[^"]*"|'[^']*'|[^>\s]+)/i))attr+=' alt=""';
return left+attr+right;
});
//表格单元格处理
sHtml = sHtml.replace(/(<(td|th)(?:\s+[^>]*?)?>)\s*([\s\S]*?)(<br(\s*\/)?>)?\s*<\/\2>/ig,function(all,left,tag,content){return left+(content?content:' ')+'</'+tag+'>';});
//修正浏览器在空内容情况下多出来的代码
sHtml=sHtml.replace(/^\s*(?:<(p|div)(?:\s+[^>]*?)?>)?\s*(<span(?:\s+[^>]*?)?>\s*<\/span>|<br(?:\s+[^>]*?)?>| )*\s*(?:<\/\1>)?\s*$/i, '');
}
//写和读innerHTML前pre中<br>转\r\n
sHtml=sHtml.replace(/(<pre(?:\s+[^>]*?)?>)([\s\S]+?)(<\/pre>)/gi,function(all,left,code,right){
return left+code.replace(/<br\s*\/?>/ig,'\r\n')+right;
});
return sHtml;
}
this.getSource=function(bFormat)
{
var sHtml,beforeGetSource=settings.beforeGetSource;
if(bSource)
{
sHtml=$('#sourceCode',_doc).val();
if(!beforeGetSource)sHtml=_this.formatXHTML(sHtml,false);
}
else
{
sHtml=_this.processHTML(_doc.body.innerHTML,'read');
sHtml=_this.cleanHTML(sHtml);
sHtml=_this.formatXHTML(sHtml,bFormat);
if(beforeGetSource)sHtml=beforeGetSource(sHtml);
}
_text.value=sHtml;
return sHtml;
}
this.cleanWord=function(sHtml)
{
var cleanPaste=settings.cleanPaste;
if(cleanPaste>0&&cleanPaste<3&&/mso(-|normal)|WordDocument|<table\s+[^>]*?x:str|\s+class\s*=\s*"?xl[67]\d"/i.test(sHtml))
{
//区块标签清理
sHtml = sHtml.replace(/<!--[\s\S]*?-->|<!(--)?\[[\s\S]+?\](--)?>|<style(\s+[^>]*?)?>[\s\S]*?<\/style>/ig, '');
sHtml = sHtml.replace(/\r?\n/ig, '');
//保留Word图片占位
if(isIE){
sHtml = sHtml.replace(/<v:shapetype(\s+[^>]*)?>[\s\S]*<\/v:shapetype>/ig,'');
sHtml = sHtml.replace(/<v:shape(\s+[^>]+)?>[\s\S]*?<v:imagedata(\s+[^>]+)?>\s*<\/v:imagedata>[\s\S]*?<\/v:shape>/ig,function(all,attr1,attr2){
var match;
match = attr2.match(/\s+src\s*=\s*("[^"]+"|'[^']+'|[^>\s]+)/i);
if(match){
match = match[1].match(/^(["']?)(.*)\1/)[2];
var sImg ='<img src="'+editorRoot+'xheditor_skin/blank.gif'+'" _xhe_temp="true" class="wordImage"';
match = attr1.match(/\s+style\s*=\s*("[^"]+"|'[^']+'|[^>\s]+)/i);
if(match){
match = match[1].match(/^(["']?)(.*)\1/)[2];
sImg += ' style="' + match + '"';
}
sImg += ' />';
return sImg;
}
return '';
});
}
else{
sHtml = sHtml.replace(/<img( [^<>]*(v:shapes|msohtmlclip)[^<>]*)\/?>/ig,function(all,attr){
var match,str = '<img src="'+editorRoot+'xheditor_skin/blank.gif'+'" _xhe_temp="true" class="wordImage"';
match = attr.match(/ width\s*=\s*"([^"]+)"/i);
if(match)str += ' width="'+match[1]+'"';
match = attr.match(/ height\s*=\s*"([^"]+)"/i);
if(match)str += ' height="'+match[1]+'"';
return str + ' />';
});
}
sHtml=sHtml.replace(/(<(\/?)([\w\-:]+))((?:\s+[\w\-:]+(?:\s*=\s*(?:"[^"]*"|'[^']*'|[^>\s]+))?)*)\s*(\/?>)/g,function(all,left,end,tag,attr,right){
tag=tag.toLowerCase();
if((tag.match(/^(link)$/)&&attr.match(/file:\/\//i))||tag.match(/:/)||(tag==='span'&&cleanPaste===2))return '';
if(!end){
attr=attr.replace(/\s([\w\-:]+)(?:\s*=\s*("[^"]*"|'[^']*'|[^>\s]+))?/ig,function(all,n,v){
n=n.toLowerCase();
if(/:/.test(n))return '';
v=v.match(/^(["']?)(.*)\1/)[2];
if(cleanPaste===1){//简单清理
switch(tag){
case 'p':
if(n === 'style'){
v=v.replace(/"|"/ig,"'").replace(/\s*([^:]+)\s*:\s*(.*?)(;|$)/ig,function(all,n,v){
return /^(text-align)$/i.test(n)?(n+':'+v+';'):'';
}).replace(/^\s+|\s+$/g,'');
return v?(' '+n+'="'+v+'"'):'';
}
break;
case 'span':
if(n === 'style'){
v=v.replace(/"|"/ig,"'").replace(/\s*([^:]+)\s*:\s*(.*?)(;|$)/ig,function(all,n,v){
return /^(color|background|font-size|font-family)$/i.test(n)?(n+':'+v+';'):'';
}).replace(/^\s+|\s+$/g,'');
return v?(' '+n+'="'+v+'"'):'';
}
break;
case 'table':
if(n.match(/^(cellspacing|cellpadding|border|width)$/i))return all;
break;
case 'td':
if(n.match(/^(rowspan|colspan)$/i))return all;
if(n === 'style'){
v=v.replace(/"|"/ig,"'").replace(/\s*([^:]+)\s*:\s*(.*?)(;|$)/ig,function(all,n,v){
return /^(width|height)$/i.test(n)?(n+':'+v+';'):'';
}).replace(/^\s+|\s+$/g,'');
return v?(' '+n+'="'+v+'"'):'';
}
break;
case 'a':
if(n.match(/^(href)$/i))return all;
break;
case 'font':
case 'img':
return all;
break;
}
}
else if(cleanPaste===2){
switch(tag){
case 'td':
if(n.match(/^(rowspan|colspan)$/i))return all;
break;
case 'img':
return all;
}
}
return '';
});
}
return left+attr+right;
});
//空内容的标签
for(var i=0;i<3;i++)sHtml = sHtml.replace( /<([^\s>]+)(\s+[^>]*)?>\s*<\/\1>/g,'');
//无属性的无意义标签
function cleanEmptyTag(all,tag,content){
return content;
}
for(var i=0;i<3;i++)sHtml = sHtml.replace(/<(span|a)>(((?!<\1(\s+[^>]*?)?>)[\s\S]|<\1(\s+[^>]*?)?>((?!<\1(\s+[^>]*?)?>)[\s\S]|<\1(\s+[^>]*?)?>((?!<\1(\s+[^>]*?)?>)[\s\S])*?<\/\1>)*?<\/\1>)*?)<\/\1>/ig,cleanEmptyTag);//第3层
for(var i=0;i<3;i++)sHtml = sHtml.replace(/<(span|a)>(((?!<\1(\s+[^>]*?)?>)[\s\S]|<\1(\s+[^>]*?)?>((?!<\1(\s+[^>]*?)?>)[\s\S])*?<\/\1>)*?)<\/\1>/ig,cleanEmptyTag);//第2层
for(var i=0;i<3;i++)sHtml = sHtml.replace(/<(span|a)>(((?!<\1(\s+[^>]*?)?>)[\s\S])*?)<\/\1>/ig,cleanEmptyTag);//最里层
//合并多个font
for(var i=0;i<3;i++)sHtml = sHtml.replace(/<font(\s+[^>]+)><font(\s+[^>]+)>/ig,function(all,attr1,attr2){
return '<font'+attr1+attr2+'>';
});
//清除表格间隙里的空格等特殊字符
sHtml=sHtml.replace(/(<(\/?)(tr|td)(?:\s+[^>]+)?>)[^<>]+/ig,function(all,left,end,tag){
if(!end&&/^td$/i.test(tag))return all;
else return left;
});
}
return sHtml;
}
this.cleanHTML=function(sHtml)
{
sHtml = sHtml.replace(/<!?\/?(DOCTYPE|html|body|meta)(\s+[^>]*?)?>/ig, '');
var arrHeadSave;sHtml = sHtml.replace(/<head(?:\s+[^>]*?)?>([\s\S]*?)<\/head>/i, function(all,content){arrHeadSave=content.match(/<(script|style)(\s+[^>]*?)?>[\s\S]*?<\/\1>/ig);return '';});
if(arrHeadSave)sHtml=arrHeadSave.join('')+sHtml;
sHtml = sHtml.replace(/<\??xml(:\w+)?(\s+[^>]*?)?>([\s\S]*?<\/xml>)?/ig, '');
if(!settings.internalScript)sHtml = sHtml.replace(/<script(\s+[^>]*?)?>[\s\S]*?<\/script>/ig, '');
if(!settings.internalStyle)sHtml = sHtml.replace(/<style(\s+[^>]*?)?>[\s\S]*?<\/style>/ig, '');
if(!settings.linkTag||!settings.inlineScript||!settings.inlineStyle)sHtml=sHtml.replace(/(<(\w+))((?:\s+[\w-]+\s*=\s*(?:"[^"]*"|'[^']*'|[^>\s]+))*)\s*(\/?>)/ig,function(all,left,tag,attr,right){
if(!settings.linkTag&&tag.toLowerCase()==='link')return '';
if(!settings.inlineScript)attr=attr.replace(/\s+on(?:click|dblclick|mouse(down|up|move|over|out|enter|leave|wheel)|key(down|press|up)|change|select|submit|reset|blur|focus|load|unload)\s*=\s*("[^"]*"|'[^']*'|[^>\s]+)/ig,'');
if(!settings.inlineStyle)attr=attr.replace(/\s+(style|class)\s*=\s*("[^"]*"|'[^']*'|[^>\s]+)/ig,'');
return left+attr+right;
});
sHtml=sHtml.replace(/<\/(strong|b|u|strike|em|i)>((?:\s|<br\/?>| )*?)<\1(\s+[^>]*?)?>/ig,'$2');//连续相同标签
return sHtml;
}
this.formatXHTML=function(sHtml,bFormat){
var emptyTags = makeMap("area,base,basefont,br,col,frame,hr,img,input,isindex,link,meta,param,embed");//HTML 4.01
var blockTags = makeMap("address,applet,blockquote,button,center,dd,dir,div,dl,dt,fieldset,form,frameset,h1,h2,h3,h4,h5,h6,hr,iframe,ins,isindex,li,map,menu,noframes,noscript,object,ol,p,pre,table,tbody,td,tfoot,th,thead,tr,ul,script");//HTML 4.01
var inlineTags = makeMap("a,abbr,acronym,applet,b,basefont,bdo,big,br,button,cite,code,del,dfn,em,font,i,iframe,img,input,ins,kbd,label,map,object,q,s,samp,script,select,small,span,strike,strong,sub,sup,textarea,tt,u,var");//HTML 4.01
var closeSelfTags = makeMap("colgroup,dd,dt,li,options,p,td,tfoot,th,thead,tr");
var fillAttrsTags = makeMap("checked,compact,declare,defer,disabled,ismap,multiple,nohref,noresize,noshade,nowrap,readonly,selected");
var cdataTags = makeMap("script,style");
var tagReplac={'b':'strong','i':'em','s':'del','strike':'del'};
var regTag=/<(?:\/([^\s>]+)|!([^>]*?)|([\w\-:]+)((?:"[^"]*"|'[^']*'|[^"'<>])*)\s*(\/?))>/g;
var regAttr = /\s*([\w\-:]+)(?:\s*=\s*(?:"([^"]*)"|'([^']*)'|([^\s]+)))?/g;
var results=[],stack=[];
stack.last = function(){return this[ this.length - 1 ];};
var match,tagIndex,nextIndex=0,tagName,tagCDATA,arrCDATA,text;
var lvl=-1,lastTag='body',lastTagStart,stopFormat=false;
while(match=regTag.exec(sHtml)){
tagIndex = match.index;
if(tagIndex>nextIndex){//保存前面的文本或者CDATA
text=sHtml.substring(nextIndex,tagIndex);
if(tagCDATA)arrCDATA.push(text);
else onText(text);
}
nextIndex = regTag.lastIndex;
if(tagName=match[1]){//结束标签
tagName=processTag(tagName);
if(tagCDATA&&tagName===tagCDATA){//结束标签前输出CDATA
onCDATA(arrCDATA.join(''));
tagCDATA=null;
arrCDATA=null;
}
if(!tagCDATA){
onEndTag(tagName);
continue;
}
}
if(tagCDATA)arrCDATA.push(match[0]);
else{
if(tagName=match[3]){//开始标签
tagName=processTag(tagName);
onStartTag(tagName,match[4],match[5]);
if(cdataTags[tagName]){
tagCDATA=tagName;
arrCDATA=[];
}
}
else if(match[2])onComment(match[0]);//注释标签
}
}
if(sHtml.length>nextIndex)onText(sHtml.substring(nextIndex,sHtml.length ));//结尾文本
onEndTag();//封闭未结束的标签
sHtml=results.join('');
results=null;
function makeMap(str)
{
var obj = {}, items = str.split(",");
for ( var i = 0; i < items.length; i++ )obj[ items[i] ] = true;
return obj;
}
function processTag(tagName)
{
tagName=tagName.toLowerCase();
var tag=tagReplac[tagName];
return tag?tag:tagName;
}
function onStartTag(tagName,rest,unary)
{
if(blockTags[tagName])while(stack.last()&&inlineTags[stack.last()])onEndTag(stack.last());//块标签
if(closeSelfTags[tagName]&&stack.last()===tagName)onEndTag(tagName);//自封闭标签
unary = emptyTags[ tagName ] || !!unary;
if (!unary)stack.push(tagName);
var all=Array();
all.push('<' + tagName);
rest.replace(regAttr, function(match, name)
{
name=name.toLowerCase();
var value = arguments[2] ? arguments[2] :
arguments[3] ? arguments[3] :
arguments[4] ? arguments[4] :
fillAttrsTags[name] ? name : "";
all.push(' '+name+'="'+value.replace(/"/g,"'")+'"');
});
all.push((unary ? " /" : "") + ">");
addHtmlFrag(all.join(''),tagName,true);
if(tagName==='pre')stopFormat=true;
}
function onEndTag(tagName)
{
if(!tagName)var pos=0;//清空栈
else for(var pos=stack.length-1;pos>=0;pos--)if(stack[pos]===tagName)break;//向上寻找匹配的开始标签
if(pos>=0)
{
for(var i=stack.length-1;i>=pos;i--)addHtmlFrag("</" + stack[i] + ">",stack[i]);
stack.length=pos;
}
if(tagName==='pre'){
stopFormat=false;
lvl--;
}
}
function onText(text){
addHtmlFrag(_this.domEncode(text));
}
function onCDATA(text){
results.push(text.replace(/^[\s\r\n]+|[\s\r\n]+$/g,''));
}
function onComment(text){
results.push(text);
}
function addHtmlFrag(html,tagName,bStart)
{
if(!stopFormat)html=html.replace(/(\t*\r?\n\t*)+/g,'');//清理换行符和相邻的制表符
if(!stopFormat&&bFormat===true)
{
if(html.match(/^\s*$/)){//不格式化空内容的标签
results.push(html);
return;
}
var bBlock=blockTags[tagName],tag=bBlock?tagName:'';
if(bBlock)
{
if(bStart)lvl++;//块开始
if(lastTag==='')lvl--;//补文本结束
}
else if(lastTag)lvl++;//文本开始
if(tag!==lastTag||bBlock)addIndent();
results.push(html);
if(tagName==='br')addIndent();//回车强制换行
if(bBlock&&(emptyTags[tagName]||!bStart))lvl--;//块结束
lastTag=bBlock?tagName:'';lastTagStart=bStart;
}
else results.push(html);
}
function addIndent(){results.push('\r\n');if(lvl>0){var tabs=lvl;while(tabs--)results.push("\t");}}
//font转style
function font2style(all,tag,attrs,content)
{
if(!attrs)return content;
var styles='',f,s,c,style;
attrs=attrs.replace(/ face\s*=\s*"\s*([^"]*)\s*"/i,function(all,v){
if(v)styles+='font-family:'+v+';';
return '';
});
attrs=attrs.replace(/ size\s*=\s*"\s*(\d+)\s*"/i,function(all,v){
styles+='font-size:'+arrFontsize[(v>7?7:(v<1?1:v))-1].s+';';
return '';
});
attrs=attrs.replace(/ color\s*=\s*"\s*([^"]*)\s*"/i,function(all,v){
if(v)styles+='color:'+v+';';
return '';
});
attrs=attrs.replace(/ style\s*=\s*"\s*([^"]*)\s*"/i,function(all,v){
if(v)styles+=v;
return '';
});
attrs+=' style="'+styles+'"';
return attrs?('<span'+attrs+'>'+content+'</span>'):content;
}
sHtml = sHtml.replace(/<(font)(\s+[^>]*?)?>(((?!<\1(\s+[^>]*?)?>)[\s\S]|<\1(\s+[^>]*?)?>((?!<\1(\s+[^>]*?)?>)[\s\S]|<\1(\s+[^>]*?)?>((?!<\1(\s+[^>]*?)?>)[\s\S])*?<\/\1>)*?<\/\1>)*?)<\/\1>/ig,font2style);//第3层
sHtml = sHtml.replace(/<(font)(\s+[^>]*?)?>(((?!<\1(\s+[^>]*?)?>)[\s\S]|<\1(\s+[^>]*?)?>((?!<\1(\s+[^>]*?)?>)[\s\S])*?<\/\1>)*?)<\/\1>/ig,font2style);//第2层
sHtml = sHtml.replace(/<(font)(\s+[^>]*?)?>(((?!<\1(\s+[^>]*?)?>)[\s\S])*?)<\/\1>/ig,font2style);//最里层
sHtml = sHtml.replace(/^(\s*\r?\n)+|(\s*\r?\n)+$/g,'');//清理首尾换行
return sHtml;
}
this.toggleShowBlocktag=function(state)
{
if(bShowBlocktag===state)return;
bShowBlocktag=!bShowBlocktag;
var _jBody=$(_doc.body);
if(bShowBlocktag)
{
bodyClass+=' showBlocktag';
_jBody.addClass('showBlocktag');
}
else
{
bodyClass=bodyClass.replace(' showBlocktag','');
_jBody.removeClass('showBlocktag');
}
}
this.toggleSource=function(state)
{
if(bSource===state)return;
_jTools.find('[cmd=Source]').toggleClass('xheEnabled').toggleClass('xheActive');
var _body=_doc.body,jBody=$(_body),sHtml;
var sourceCode,cursorMark='<span id="_xhe_cursor"></span>',cursorPos=0;
var txtSourceTitle='';
if(!bSource)
{//转为源代码模式
_this.pasteHTML(cursorMark,true);//标记当前位置
sHtml=_this.getSource(true);
cursorPos=sHtml.indexOf(cursorMark);
if(!isOpera)cursorPos=sHtml.substring(0,cursorPos).replace(/\r/g,'').length;//修正非opera光标定位点
sHtml=sHtml.replace(/(\r?\n\s*|)<span id="_xhe_cursor"><\/span>(\s*\r?\n|)/,function(all,left,right){
return left&&right?'\r\n':left+right;//只有定位符的空行删除当前行
});
if(isIE)_body.contentEditable='false';
else _doc.designMode = 'Off';
jBody.attr('scroll','no').attr('class','sourceMode').html('<textarea id="sourceCode" wrap="soft" spellcheck="false" style="width:100%;height:100%" />');
sourceCode=$('#sourceCode',jBody).blur(_this.getSource)[0];
txtSourceTitle='WYSIWYG mode';
}
else
{//转为编辑模式
sHtml=_this.getSource();
jBody.html('').removeAttr('scroll').attr('class','editMode'+bodyClass);
if(isIE)_body.contentEditable='true';
else _doc.designMode = 'On';
if(isMozilla)
{
_this._exec("inserthtml","-");//修正firefox源代码切换回来无法删除文字的问题
$('#'+idFixFFCursor).show().focus().hide();//临时修正Firefox 3.6光标丢失问题
}
txtSourceTitle='Source mode';
}
bSource=!bSource;
_this.setSource(sHtml);
_this.focus();
if(bSource)//光标定位源码
{
if(sourceCode.setSelectionRange)sourceCode.setSelectionRange(cursorPos, cursorPos);
else
{
var rng = sourceCode.createTextRange();
rng.move("character",cursorPos);
rng.select();
}
}
else _this.setTextCursor();//定位最前面
_jTools.find('[cmd=Source]').attr('title',txtSourceTitle).find('span').text(txtSourceTitle);
_jTools.find('[cmd=Source],[cmd=Preview]').toggleClass('xheEnabled');
_jTools.find('.xheButton').not('[cmd=Source],[cmd=Fullscreen],[cmd=About]').toggleClass('xheEnabled').attr('aria-disabled',bSource?true:false);//无障碍支持
setTimeout(setOpts,300);
}
this.showPreview=function()
{
var beforeSetSource=settings.beforeSetSource,sContent=_this.getSource();
if(beforeSetSource)sContent=beforeSetSource(sContent);
var sHTML='<html><head>'+headHTML+'<title>Preview</title>'+(urlBase?'<base href="'+urlBase+'"/>':'')+'</head><body>' + sContent + '</body></html>';
var screen=window.screen,oWindow=window.open('', 'xhePreview', 'toolbar=yes,location=no,status=yes,menubar=yes,scrollbars=yes,resizable=yes,width='+Math.round(screen.width*0.9)+',height='+Math.round(screen.height*0.8)+',left='+Math.round(screen.width*0.05)),oDoc=oWindow.document;
oDoc.open();
oDoc.write(sHTML);
oDoc.close();
oWindow.focus();
}
this.toggleFullscreen=function(state)
{
if(bFullscreen===state)return;
var jLayout=$('#'+idContainer).find('.xheLayout'),jContainer=$('#'+idContainer),browserVer=jQuery.browser.version,isIE67=(isIE&&(browserVer==6||browserVer==7));
if(bFullscreen)
{//取消全屏
if(isIE67)_jText.after(jContainer);
jLayout.attr('style',sLayoutStyle);
_jArea.height(editorHeight-_jTools.outerHeight());
$(window).scrollTop(outerScroll);
setTimeout(function(){$(window).scrollTop(outerScroll);},10);//Firefox需要延迟设置
}
else
{//显示全屏
if(isIE67)$('body').append(jContainer);
outerScroll=$(window).scrollTop();
sLayoutStyle=jLayout.attr('style');
jLayout.removeAttr('style');
_jArea.height('100%');
setTimeout(fixFullHeight,100);
}
if(isMozilla)//临时修正Firefox 3.6源代码光标丢失问题
{
$('#'+idFixFFCursor).show().focus().hide();
setTimeout(_this.focus,1);
}
else if(isIE67)_this.setTextCursor();
bFullscreen=!bFullscreen;
jContainer.toggleClass('xhe_Fullscreen');
$('html').toggleClass('xhe_Fullfix');
_jTools.find('[cmd=Fullscreen]').toggleClass('xheActive');
setTimeout(setOpts,300);
}
this.showMenu=function(menuitems,callback)
{
var jMenu=$('<div class="xheMenu"></div>'),menuSize=menuitems.length,arrItem=[];
$.each(menuitems,function(n,v){
if(v.s==='-'){
arrItem.push('<div class="xheMenuSeparator"></div>');
}else{
arrItem.push('<a href="javascript:void(\''+v.v+'\')" title="'+(v.t?v.t:v.s)+'" v="'+v.v+'" role="option" aria-setsize="'+menuSize+'" aria-posinset="'+(n+1)+'" tabindex="0">'+v.s+'</a>');
}
});
jMenu.append(arrItem.join(''));
jMenu.click(function(ev){
ev=ev.target;
if($.nodeName(ev,'DIV'))return;
_this.loadBookmark();
callback($(ev).closest('a').attr('v'));
_this.hidePanel();
return false;
}).mousedown(returnFalse);
_this.saveBookmark();
_this.showPanel(jMenu);
}
this.showColor=function(callback)
{
var jColor=$('<div class="xheColor"></div>'),arrItem=[],colorSize=itemColors.length,count=0;
$.each(itemColors,function(n,v)
{
if(count%7===0)arrItem.push((count>0?'</div>':'')+'<div>');
arrItem.push('<a href="javascript:void(\''+v+'\')" xhev="'+v+'" title="'+v+'" style="background:'+v+'" role="option" aria-setsize="'+colorSize+'" aria-posinset="'+(count+1)+'"></a>');
count++;
});
arrItem.push('</div>');
jColor.append(arrItem.join(''));
jColor.click(function(ev){
ev=ev.target;
if(!$.nodeName(ev,'A'))return;
_this.loadBookmark();
callback($(ev).attr('xhev'));
_this.hidePanel();
return false;
}).mousedown(returnFalse);
_this.saveBookmark();
_this.showPanel(jColor);
}
this.showPastetext=function()
{
var jPastetext=$(htmlPastetext),jValue=$('#xhePastetextValue',jPastetext),jSave=$('#xheSave',jPastetext);
jSave.click(function(){
_this.loadBookmark();
var sValue=jValue.val();
if(sValue)_this.pasteText(sValue);
_this.hidePanel();
return false;
});
_this.saveBookmark();
_this.showDialog(jPastetext);
}
this.showLink=function()
{
var htmlTemp=htmlLink,$arrAnchor=_jDoc.find('a[name]').not('[href]'),haveAnchor=$arrAnchor.length>0;
if(haveAnchor){//页内有锚点
var arrAnchorOptions=[];
$arrAnchor.each(function(){
var name=$(this).attr('name');
arrAnchorOptions.push('<option value="#'+name+'">'+name+'</option>');
});
htmlTemp=htmlTemp.replace(/(<div><label for="xheLinkTarget)/,'<div><label for="xheLinkAnchor">Anchor: </label><select id="xheLinkAnchor"><option value="">None selected</option>'+arrAnchorOptions.join('')+'</select></div>$1');
}
var jLink=$(htmlTemp),jParent=_this.getParent('a'),jText=$('#xheLinkText',jLink),jUrl=$('#xheLinkUrl',jLink),jTarget=$('#xheLinkTarget',jLink),jSave=$('#xheSave',jLink),selHtml=_this.getSelect();
if(haveAnchor){
jLink.find('#xheLinkAnchor').change(function(){
var anchor=$(this).val();
if(anchor!='')jUrl.val(anchor);
});
}
if(jParent.length===1)
{
if(!jParent.attr('href')){//锚点
ev=null;
return _this.exec('Anchor');
}
jUrl.val(xheAttr(jParent,'href'));
jTarget.attr('value',jParent.attr('target'));
}
else if(selHtml==='')jText.val(settings.defLinkText).closest('div').show();
if(settings.upLinkUrl)_this.uploadInit(jUrl,settings.upLinkUrl,settings.upLinkExt);
jSave.click(function(){
_this.loadBookmark();
var url=jUrl.val();
if(url===''||jParent.length===0)_this._exec('unlink');
if(url!==''&&url!=='http://')
{
var aUrl=url.split(' '),sTarget=jTarget.val(),sText=jText.val();
if(aUrl.length>1)
{//批量插入
_this._exec('unlink');//批量前删除当前链接并重新获取选择内容
selHtml=_this.getSelect();
var sTemplate='<a href="xhe_tmpurl"',sLink,arrLink=[];
if(sTarget!=='')sTemplate+=' target="'+sTarget+'"';
sTemplate+='>xhe_tmptext</a>';
sText=(selHtml!==''?selHtml:(sText?sText:url));
for(var i=0,c=aUrl.length;i<c;i++)
{
url=aUrl[i];
if(url!=='')
{
url=url.split('||');
sLink=sTemplate;
sLink=sLink.replace('xhe_tmpurl',url[0]);
sLink=sLink.replace('xhe_tmptext',url[1]?url[1]:sText);
arrLink.push(sLink);
}
}
_this.pasteHTML(arrLink.join(' '));
}
else
{//单url模式
url=aUrl[0].split('||');
if(!sText)sText=url[0];
sText=url[1]?url[1]:(selHtml!=='')?'':sText?sText:url[0];
if(jParent.length===0)
{
if(sText)_this.pasteHTML('<a href="#xhe_tmpurl">'+sText+'</a>');
else _this._exec('createlink','#xhe_tmpurl');
jParent=$('a[href$="#xhe_tmpurl"]',_doc);
}
else if(sText&&!isSafari)jParent.text(sText);//safari改写文本会导致光标丢失
xheAttr(jParent,'href',url[0]);
if(sTarget!=='')jParent.attr('target',sTarget);
else jParent.removeAttr('target');
}
}
_this.hidePanel();
return false;
});
_this.saveBookmark();
_this.showDialog(jLink);
}
this.showAnchor=function(){
var jAnchor=$(htmlAnchor),jParent=_this.getParent('a'),jName=$('#xheAnchorName',jAnchor),jSave=$('#xheSave',jAnchor);
if(jParent.length===1){
if(jParent.attr('href')){//超链接
ev=null;
return _this.exec('Link');
}
jName.val(jParent.attr('name'));
}
jSave.click(function(){
_this.loadBookmark();
var name=jName.val();
if(name){
if(jParent.length===0)_this.pasteHTML('<a name="'+name+'"></a>');
else jParent.attr('name',name);
}
else if(jParent.length===1)jParent.remove();
_this.hidePanel();
return false;
});
_this.saveBookmark();
_this.showDialog(jAnchor);
}
this.showImg=function()
{
var jImg=$(htmlImg),jParent=_this.getParent('img'),jUrl=$('#xheImgUrl',jImg),jAlt=$('#xheImgAlt',jImg),jAlign=$('#xheImgAlign',jImg),jWidth=$('#xheImgWidth',jImg),jHeight=$('#xheImgHeight',jImg),jBorder=$('#xheImgBorder',jImg),jVspace=$('#xheImgVspace',jImg),jHspace=$('#xheImgHspace',jImg),jSave=$('#xheSave',jImg);
if(jParent.length===1)
{
jUrl.val(xheAttr(jParent,'src'));
jAlt.val(jParent.attr('alt'));
jAlign.val(jParent.attr('align'));
jWidth.val(jParent.attr('width'));
jHeight.val(jParent.attr('height'));
jBorder.val(jParent.attr('border'));
var vspace=jParent.attr('vspace'),hspace=jParent.attr('hspace');
jVspace.val(vspace<=0?'':vspace);
jHspace.val(hspace<=0?'':hspace);
}
if(settings.upImgUrl)_this.uploadInit(jUrl,settings.upImgUrl,settings.upImgExt);
jSave.click(function(){
_this.loadBookmark();
var url=jUrl.val();
if(url!==''&&url!=='http://')
{
var aUrl=url.split(' '),sAlt=jAlt.val(),sAlign=jAlign.val(),sWidth=jWidth.val(),sHeight=jHeight.val(),sBorder=jBorder.val(),sVspace=jVspace.val(),sHspace=jHspace.val();;
if(aUrl.length>1)
{//批量插入
var sTemplate='<img src="xhe_tmpurl"',sImg,arrImg=[];
if(sAlt!=='')sTemplate+=' alt="'+sAlt+'"';
if(sAlign!=='')sTemplate+=' align="'+sAlign+'"';
if(sWidth!=='')sTemplate+=' width="'+sWidth+'"';
if(sHeight!=='')sTemplate+=' height="'+sHeight+'"';
if(sBorder!=='')sTemplate+=' border="'+sBorder+'"';
if(sVspace!=='')sTemplate+=' vspace="'+sVspace+'"';
if(sHspace!=='')sTemplate+=' hspace="'+sHspace+'"';
sTemplate+=' />';
for(var i in aUrl)
{
url=aUrl[i];
if(url!=='')
{
url=url.split('||');
sImg=sTemplate;
sImg=sImg.replace('xhe_tmpurl',url[0]);
if(url[1])sImg='<a href="'+url[1]+'" target="_blank">'+sImg+'</a>'
arrImg.push(sImg);
}
}
_this.pasteHTML(arrImg.join(' '));
}
else if(aUrl.length===1)
{//单URL模式
url=aUrl[0];
if(url!=='')
{
url=url.split('||');
if(jParent.length===0)
{
_this.pasteHTML('<img src="'+url[0]+'#xhe_tmpurl" />');
jParent=$('img[src$="#xhe_tmpurl"]',_doc);
}
xheAttr(jParent,'src',url[0]);
if(sAlt!=='')jParent.attr('alt',sAlt);
if(sAlign!=='')jParent.attr('align',sAlign);
else jParent.removeAttr('align');
if(sWidth!=='')jParent.attr('width',sWidth);
else jParent.removeAttr('width');
if(sHeight!=='')jParent.attr('height',sHeight);
else jParent.removeAttr('height');
if(sBorder!=='')jParent.attr('border',sBorder);
else jParent.removeAttr('border');
if(sVspace!=='')jParent.attr('vspace',sVspace);
else jParent.removeAttr('vspace');
if(sHspace!=='')jParent.attr('hspace',sHspace);
else jParent.removeAttr('hspace');
if(url[1])
{
var jLink=jParent.parent('a');
if(jLink.length===0)
{
jParent.wrap('<a></a>');
jLink=jParent.parent('a');
}
xheAttr(jLink,'href',url[1]);
jLink.attr('target','_blank');
}
}
}
}
else if(jParent.length===1)jParent.remove();
_this.hidePanel();
return false;
});
_this.saveBookmark();
_this.showDialog(jImg);
}
this.showEmbed=function(sType,sHtml,sMime,sClsID,sBaseAttrs,sUploadUrl,sUploadExt)
{
var jEmbed=$(sHtml),jParent=_this.getParent('embed[type="'+sMime+'"],embed[classid="'+sClsID+'"]'),jUrl=$('#xhe'+sType+'Url',jEmbed),jWidth=$('#xhe'+sType+'Width',jEmbed),jHeight=$('#xhe'+sType+'Height',jEmbed),jSave=$('#xheSave',jEmbed);
if(sUploadUrl)_this.uploadInit(jUrl,sUploadUrl,sUploadExt);
if(jParent.length===1)
{
jUrl.val(xheAttr(jParent,'src'));
jWidth.val(jParent.attr('width'));
jHeight.val(jParent.attr('height'));
}
jSave.click(function(){
_this.loadBookmark();
var url=jUrl.val();
if(url!==''&&url!=='http://')
{
var w=jWidth.val(),h=jHeight.val(),reg=/^\d+%?$/;
if(!reg.test(w))w=412;if(!reg.test(h))h=300;
var sBaseCode='<embed type="'+sMime+'" classid="'+sClsID+'" src="xhe_tmpurl"'+sBaseAttrs;
var aUrl=url.split(' ');
if(aUrl.length>1)
{//批量插入
var sTemplate=sBaseCode+'',sEmbed,arrEmbed=[];
sTemplate+=' width="xhe_width" height="xhe_height" />';
for(var i in aUrl)
{
url=aUrl[i].split('||');
sEmbed=sTemplate;
sEmbed=sEmbed.replace('xhe_tmpurl',url[0])
sEmbed=sEmbed.replace('xhe_width',url[1]?url[1]:w)
sEmbed=sEmbed.replace('xhe_height',url[2]?url[2]:h)
if(url!=='')arrEmbed.push(sEmbed);
}
_this.pasteHTML(arrEmbed.join(' '));
}
else if(aUrl.length===1)
{//单URL模式
url=aUrl[0].split('||');
if(jParent.length===0)
{
_this.pasteHTML(sBaseCode.replace('xhe_tmpurl',url[0]+'#xhe_tmpurl')+' />');
jParent=$('embed[src$="#xhe_tmpurl"]',_doc);
}
xheAttr(jParent,'src',url[0]);
jParent.attr('width',url[1]?url[1]:w);
jParent.attr('height',url[2]?url[2]:h);
}
}
else if(jParent.length===1)jParent.remove();
_this.hidePanel();
return false;
});
_this.saveBookmark();
_this.showDialog(jEmbed);
}
this.showEmot=function(group)
{
var jEmot=$('<div class="xheEmot"></div>');
group=group?group:(selEmotGroup?selEmotGroup:'default');
var arrEmot=arrEmots[group];
var sEmotPath=emotPath+group+'/',n=0,arrList=[],jList='';
var ew=arrEmot.width,eh=arrEmot.height,line=arrEmot.line,count=arrEmot.count,list=arrEmot.list;
if(count)
{
for(var i=1;i<=count;i++)
{
n++;
arrList.push('<a href="javascript:void(\''+i+'\')" style="background-image:url('+sEmotPath+i+'.gif);" emot="'+group+','+i+'" xhev="" title="'+i+'" role="option"> </a>');
if(n%line===0)arrList.push('<br />');
}
}
else
{
$.each(list,function(id,title)
{
n++;
arrList.push('<a href="javascript:void(\''+title+'\')" style="background-image:url('+sEmotPath+id+'.gif);" emot="'+group+','+id+'" title="'+title+'" xhev="'+title+'" role="option"> </a>');
if(n%line===0)arrList.push('<br />');
});
}
var w=line*(ew+12),h=Math.ceil(n/line)*(eh+12),mh=w*0.75;
if(h<=mh)mh='';
jList=$('<style>'+(mh?'.xheEmot div{width:'+(w+20)+'px;height:'+mh+'px;}':'')+'.xheEmot div a{width:'+ew+'px;height:'+eh+'px;}</style><div>'+arrList.join('')+'</div>').click(function(ev){ev=ev.target;var jA=$(ev);if(!$.nodeName(ev,'A'))return;_this.loadBookmark();_this.pasteHTML('<img emot="'+jA.attr('emot')+'" alt="'+jA.attr('xhev')+'">');_this.hidePanel();return false;}).mousedown(returnFalse);
jEmot.append(jList);
var gcount=0,arrGroup=['<ul role="tablist">'],jGroup;//表情分类
$.each(arrEmots,function(g,v){
gcount++;
arrGroup.push('<li'+(group===g?' class="cur"':'')+' role="presentation"><a href="javascript:void(\''+v.name+'\')" group="'+g+'" role="tab" tabindex="0">'+v.name+'</a></li>');
});
if(gcount>1)
{
arrGroup.push('</ul><br style="clear:both;" />');
jGroup=$(arrGroup.join('')).click(function(ev){selEmotGroup=$(ev.target).attr('group');_this.exec('Emot');return false;}).mousedown(returnFalse);
jEmot.append(jGroup);
}
_this.saveBookmark();
_this.showPanel(jEmot);
}
this.showTable=function()
{
var jTable=$(htmlTable),jRows=$('#xheTableRows',jTable),jColumns=$('#xheTableColumns',jTable),jHeaders=$('#xheTableHeaders',jTable),jWidth=$('#xheTableWidth',jTable),jHeight=$('#xheTableHeight',jTable),jBorder=$('#xheTableBorder',jTable),jCellSpacing=$('#xheTableCellSpacing',jTable),jCellPadding=$('#xheTableCellPadding',jTable),jAlign=$('#xheTableAlign',jTable),jCaption=$('#xheTableCaption',jTable),jSave=$('#xheSave',jTable);
jSave.click(function(){
_this.loadBookmark();
var sCaption=jCaption.val(),sBorder=jBorder.val(),sRows=jRows.val(),sCols=jColumns.val(),sHeaders=jHeaders.val(),sWidth=jWidth.val(),sHeight=jHeight.val(),sCellSpacing=jCellSpacing.val(),sCellPadding=jCellPadding.val(),sAlign=jAlign.val();
var i,j,htmlTable='<table'+(sBorder!==''?' border="'+sBorder+'"':'')+(sWidth!==''?' width="'+sWidth+'"':'')+(sHeight!==''?' height="'+sHeight+'"':'')+(sCellSpacing!==''?' cellspacing="'+sCellSpacing+'"':'')+(sCellPadding!==''?' cellpadding="'+sCellPadding+'"':'')+(sAlign!==''?' align="'+sAlign+'"':'')+'>';
if(sCaption!=='')htmlTable+='<caption>'+sCaption+'</caption>';
if(sHeaders==='row'||sHeaders==='both')
{
htmlTable+='<tr>';
for(i=0;i<sCols;i++)htmlTable+='<th scope="col"></th>';
htmlTable+='</tr>';
sRows--;
}
htmlTable+='<tbody>';
for(i=0;i<sRows;i++)
{
htmlTable+='<tr>';
for(j=0;j<sCols;j++)
{
if(j===0&&(sHeaders==='col'||sHeaders==='both'))htmlTable+='<th scope="row"></th>';
else htmlTable+='<td></td>';
}
htmlTable+='</tr>';
}
htmlTable+='</tbody></table>';
_this.pasteHTML(htmlTable);
_this.hidePanel();
return false;
});
_this.saveBookmark();
_this.showDialog(jTable);
}
this.showAbout=function()
{
var jAbout=$(htmlAbout);
jAbout.find('p').attr('role','presentation');//无障碍支持
_this.showDialog(jAbout,true);
setTimeout(function(){jAbout.focus();},100);
}
this.addShortcuts=function(key,cmd)
{
key=key.toLowerCase();
if(arrShortCuts[key]===undefined)arrShortCuts[key]=Array();
arrShortCuts[key].push(cmd);
}
this.delShortcuts=function(key){delete arrShortCuts[key];}
this.uploadInit=function(jText,toUrl,upext)
{
var jUpload=$('<span class="xheUpload"><input type="text" style="visibility:hidden;" tabindex="-1" /><input type="button" value="'+settings.upBtnText+'" class="xheBtn" tabindex="-1" /></span>'),jUpBtn=$('.xheBtn',jUpload);
var bHtml5Upload=settings.html5Upload,upMultiple=bHtml5Upload?settings.upMultiple:1;
jText.after(jUpload);jUpBtn.before(jText);
toUrl=toUrl.replace(/{editorRoot}/ig,editorRoot);
if(toUrl.substr(0,1)==='!')//自定义上传管理页
{
jUpBtn.click(function(){_this.showIframeModal('Upload file',toUrl.substr(1),setUploadMsg,null,null);});
}
else
{//系统默认ajax上传
jUpload.append('<input type="file"'+(upMultiple>1?' multiple=""':'')+' class="xheFile" size="13" name="'+uploadInputname+'" tabindex="-1" />');
var jFile=$('.xheFile',jUpload),arrMsg;
jFile.change(function(){arrMsg=[];_this.startUpload(jFile[0],toUrl,upext,setUploadMsg);});
setTimeout(function(){//拖放上传
jText.closest('.xheDialog').bind('dragenter dragover',returnFalse).bind('drop',function(ev){
var dataTransfer=ev.originalEvent.dataTransfer,fileList;
if(bHtml5Upload&&dataTransfer&&(fileList=dataTransfer.files)&&fileList.length>0)_this.startUpload(fileList,toUrl,upext,setUploadMsg);
return false;
});
},10);
}
function setUploadMsg(arrMsg)
{
if(is(arrMsg,'string'))arrMsg=[arrMsg];//允许单URL传递
var bImmediate=false,i,count=arrMsg.length,msg,url,arrUrl=[],onUpload=settings.onUpload;
if(onUpload)onUpload(arrMsg);//用户上传回调
for(i=0;i<count;i++)
{
msg=arrMsg[i];
url=is(msg,'string')?msg:msg.url;
if(url.substr(0,1)==='!'){bImmediate=true;url=url.substr(1);}
arrUrl.push(url);
}
jText.val(arrUrl.join(' '));
if(bImmediate)jText.closest('.xheDialog').find('#xheSave').click();
}
}
this.startUpload=function(fromFiles,toUrl,limitExt,onUploadComplete)
{
var arrMsg=[],bHtml5Upload=settings.html5Upload,upMultiple=bHtml5Upload?settings.upMultiple:1;
var upload,fileList,filename,jUploadTip=$('<div style="padding:22px 0;text-align:center;line-height:30px;">File uploading,please wait...<br /></div>'),sLoading='<img src="'+skinPath+'img/loading.gif">';
if(isOpera||!bHtml5Upload||(fromFiles.nodeType&&!((fileList=fromFiles.files)&&fileList[0].name)))
{
if(!checkFileExt(fromFiles.value,limitExt))return;
jUploadTip.append(sLoading);
upload=new _this.html4Upload(fromFiles,toUrl,onUploadCallback);
}
else
{
if(!fileList)fileList=fromFiles;//拖放文件列表
var i,len=fileList.length;
if(len>upMultiple){
alert('Please do not upload more then '+upMultiple+' files.');
return;
}
for(i=0;i<len;i++)if(!checkFileExt(fileList[i].name,limitExt))return;
var jProgress=$('<div class="xheProgress"><div><span>0%</span></div></div>');
jUploadTip.append(jProgress);
upload=new _this.html5Upload(uploadInputname,fileList,toUrl,onUploadCallback,function(ev){
if(ev.loaded>=0)
{
var sPercent=Math.round((ev.loaded * 100) / ev.total)+'%';
$('div',jProgress).css('width',sPercent);
$('span',jProgress).text(sPercent+' ( '+formatBytes(ev.loaded)+' / '+formatBytes(ev.total)+' )');
}
else jProgress.replaceWith(sLoading);//不支持进度
});
}
_this.showModal('File uploading(Esc cancel)',jUploadTip,320,150);
upload.start();
function onUploadCallback(sText,bFinish)
{
var data=Object,bOK=false;
try{data=eval('('+sText+')');}catch(ex){};
if(data.err===undefined||data.msg===undefined)alert(toUrl+' upload interface error!\r\n\r\nreturn error:\r\n\r\n'+sText);
else
{
if(data.err)alert(data.err);
else
{
arrMsg.push(data.msg);
bOK=true;//继续下一个文件上传
}
}
if(!bOK||bFinish)_this.removeModal();
if(bFinish&&bOK)onUploadComplete(arrMsg);//全部上传完成
return bOK;
}
}
this.html4Upload=function(fromfile,toUrl,callback)
{
var uid = new Date().getTime(),idIO='jUploadFrame'+uid,_this=this;
var jIO=$('<iframe name="'+idIO+'" class="xheHideArea" />').appendTo('body');
var jForm=$('<form action="'+toUrl+'" target="'+idIO+'" method="post" enctype="multipart/form-data" class="xheHideArea"></form>').appendTo('body');
var jOldFile = $(fromfile),jNewFile = jOldFile.clone().attr('disabled','true');
jOldFile.before(jNewFile).appendTo(jForm);
this.remove=function()
{
if(_this!==null)
{
jNewFile.before(jOldFile).remove();
jIO.remove();jForm.remove();
_this=null;
}
}
this.onLoad=function(){
var ifmDoc=jIO[0].contentWindow.document,result=$(ifmDoc.body).text();
ifmDoc.write('');
_this.remove();
callback(result,true);
}
this.start=function(){jForm.submit();jIO.load(_this.onLoad);}
return this;
}
this.html5Upload=function(inputname,fromFiles,toUrl,callback,onProgress)
{
var xhr,i=0,count=fromFiles.length,allLoaded=0,allSize=0,_this=this;
for(var j=0;j<count;j++)allSize+=fromFiles[j].size;
this.remove=function(){if(xhr){xhr.abort();xhr=null;}}
this.uploadNext=function(sText)
{
if(sText)//当前文件上传完成
{
allLoaded+=fromFiles[i-1].size;
returnProgress(0);
}
if((!sText||(sText&&callback(sText,i===count)===true))&&i<count)postFile(fromFiles[i++],toUrl,_this.uploadNext,function(loaded){returnProgress(loaded);});
}
this.start=function(){_this.uploadNext();}
function postFile(fromfile,toUrl,callback,onProgress)
{
xhr = new XMLHttpRequest(),upload=xhr.upload;
xhr.onreadystatechange=function(){
if(xhr.readyState===4)callback(xhr.responseText);
};
if(upload)upload.onprogress=function(ev){
onProgress(ev.loaded);
};
else onProgress(-1);//不支持进度
xhr.open("POST", toUrl);
xhr.setRequestHeader('Content-Type', 'application/octet-stream');
xhr.setRequestHeader('Content-Disposition', 'attachment; name="'+encodeURIComponent(inputname)+'"; filename="'+encodeURIComponent(fromfile.name)+'"');
if(xhr.sendAsBinary&&fromfile.getAsBinary)xhr.sendAsBinary(fromfile.getAsBinary());
else xhr.send(fromfile);
}
function returnProgress(loaded){
if(onProgress)onProgress({'loaded':allLoaded+loaded,'total':allSize});
}
}
this.showIframeModal=function(title,url,callback,w,h,onRemove)
{
var jContent=$('<iframe frameborder="0" src="'+url.replace(/{editorRoot}/ig,editorRoot)+(/\?/.test(url)?'&':'?')+'parenthost='+location.host+'" style="width:100%;height:100%;display:none;" /><div class="xheModalIfmWait"></div>'),jIframe=jContent.eq(0),jWait=jContent.eq(1);
_this.showModal(title,jContent,w,h,onRemove);
var modalWin=jIframe[0].contentWindow,result;
initModalWin();
jIframe.load(function(){
initModalWin();//初始化接口
if(result){//跨域,取返回值
var bResult=true;
try{
result=eval('('+unescape(result)+')');
}
catch(e){
bResult=false;
}
if(bResult)return callbackModal(result);
}
if(jWait.is(':visible')){//显示内页
jIframe.show().focus();
jWait.remove();
}
});
//初始化接口
function initModalWin(){
try{
modalWin.callback=callbackModal;
modalWin.unloadme=_this.removeModal;
$(modalWin.document).keydown(checkEsc);
result=modalWin.name;
}
catch(ex){}
}
//模式窗口回调
function callbackModal(v){
modalWin.document.write('');
_this.removeModal();
if(v!=null)callback(v);
}
}
this.showModal=function(title,content,w,h,onRemove)
{
if(bShowModal)return false;//只能弹出一个模式窗口
_this.panelState=bShowPanel;
bShowPanel=false;//防止按钮面板被关闭
layerShadow=settings.layerShadow;
w=w?w:settings.modalWidth;h=h?h:settings.modalHeight;
jModal=$('<div class="xheModal" style="width:'+(w-1)+'px;height:'+h+'px;margin-left:-'+Math.ceil(w/2)+'px;'+(isIE&&browerVer<7.0?'':'margin-top:-'+Math.ceil(h/2)+'px')+'">'+(settings.modalTitle?'<div class="xheModalTitle"><span class="xheModalClose" title="Close (Esc)" tabindex="0" role="button"></span>'+title+'</div>':'')+'<div class="xheModalContent"></div></div>').appendTo('body');
jOverlay=$('<div class="xheModalOverlay"></div>').appendTo('body');
if(layerShadow>0)jModalShadow=$('<div class="xheModalShadow" style="width:'+jModal.outerWidth()+'px;height:'+jModal.outerHeight()+'px;margin-left:-'+(Math.ceil(w/2)-layerShadow-2)+'px;'+(isIE&&browerVer<7.0?'':'margin-top:-'+(Math.ceil(h/2)-layerShadow-2)+'px')+'"></div>').appendTo('body');
$('.xheModalContent',jModal).css('height',h-(settings.modalTitle?$('.xheModalTitle').outerHeight():0)).html(content);
if(isIE&&browerVer===6.0)jHideSelect=$('select:visible').css('visibility','hidden');//隐藏覆盖的select
$('.xheModalClose',jModal).click(_this.removeModal);
jOverlay.show();
if(layerShadow>0)jModalShadow.show();
jModal.show();
setTimeout(function(){jModal.find('a,input[type=text],textarea').filter(':visible').filter(function(){return $(this).css('visibility')!=='hidden';}).eq(0).focus();},10);//定位首个可见输入表单项,延迟解决opera无法设置焦点
bShowModal=true;
onModalRemove=onRemove;
}
this.removeModal=function(){
if(jHideSelect)jHideSelect.css('visibility','visible');
jModal.html('').remove();
if(layerShadow>0)jModalShadow.remove();
jOverlay.remove();
if(onModalRemove)onModalRemove();
bShowModal=false;
bShowPanel=_this.panelState;
};
this.showDialog=function(content,bNoFocus)
{
var jDialog=$('<div class="xheDialog"></div>'),jContent=$(content),jSave=$('#xheSave',jContent);
if(jSave.length===1)
{
jContent.find('input[type=text],select').keypress(function(ev){if(ev.which===13){jSave.click();return false;}});
jContent.find('textarea').keydown(function(ev){if(ev.ctrlKey&&ev.which===13){jSave.click();return false;}});
jSave.after(' <input type="button" id="xheCancel" value="Cancel" />');
$('#xheCancel',jContent).click(_this.hidePanel);
if(!settings.clickCancelDialog)
{
bClickCancel=false;//关闭点击隐藏
var jFixCancel=$('<div class="xheFixCancel"></div>').appendTo('body').mousedown(returnFalse);
var xy=_jArea.offset();
jFixCancel.css({'left':xy.left,'top':xy.top,width:_jArea.outerWidth(),height:_jArea.outerHeight()})
}
jDialog.mousedown(function(){bDisableHoverExec=true;})//点击对话框禁止悬停执行
}
jDialog.append(jContent);
_this.showPanel(jDialog,bNoFocus);
}
this.showPanel=function(content,bNoFocus)
{
if(!ev.target)return false;
_jPanel.html('').append(content).css('left',-999).css('top',-999);
_jPanelButton=$(ev.target).closest('a').addClass('xheActive');
var xy=_jPanelButton.offset();
var x=xy.left,y=xy.top;y+=_jPanelButton.outerHeight()-1;
_jCntLine.css({'left':x+1,'top':y,'width':_jPanelButton.width()}).show();
var _docElem=document.documentElement,body=document.body;
if((x+_jPanel.outerWidth())>((window.pageXOffset||_docElem.scrollLeft||body.scrollLeft)+(_docElem.clientWidth||body.clientWidth)))x-=(_jPanel.outerWidth()-_jPanelButton.outerWidth());//向左显示面板
var layerShadow=settings.layerShadow;
if(layerShadow>0)_jShadow.css({'left':x+layerShadow,'top':y+layerShadow,'width':_jPanel.outerWidth(),'height':_jPanel.outerHeight()}).show();
var basezIndex=$('#'+idContainer).offsetParent().css('zIndex');
if(basezIndex&&!isNaN(basezIndex)){
_jShadow.css('zIndex',parseInt(basezIndex,10)+1);
_jPanel.css('zIndex',parseInt(basezIndex,10)+2);
_jCntLine.css('zIndex',parseInt(basezIndex,10)+3);
}
_jPanel.css({'left':x,'top':y}).show();
if(!bNoFocus)setTimeout(function(){_jPanel.find('a,input[type=text],textarea').filter(':visible').filter(function(){return $(this).css('visibility')!=='hidden';}).eq(0).focus();},10);//定位首个可见输入表单项,延迟解决opera无法设置焦点
bQuickHoverExec=bShowPanel=true;
}
this.hidePanel=function(){
if(bShowPanel){
_jPanelButton.removeClass('xheActive');
_jShadow.hide();
_jCntLine.hide();
_jPanel.hide();
bShowPanel=false;
if(!bClickCancel){
$('.xheFixCancel').remove();
bClickCancel=true;
};
bQuickHoverExec=bDisableHoverExec=false;
lastAngle=null;
_this.focus();
_this.loadBookmark();
}
}
this.exec=function(cmd)
{
_this.hidePanel();
var tool=arrTools[cmd];
if(!tool)return false;//无效命令
if(ev===null)//非鼠标点击
{
ev={};
var btn=_jTools.find('.xheButton[cmd='+cmd+']');
if(btn.length===1)ev.target=btn;//设置当前事件焦点
}
if(tool.e)tool.e.call(_this)//插件事件
else//内置工具
{
cmd=cmd.toLowerCase();
switch(cmd)
{
case 'cut':
try{_doc.execCommand(cmd);if(!_doc.queryCommandSupported(cmd))throw 'Error';}
catch(ex){alert('Currently not supported by your browser, use keyboard shortcuts(Ctrl+X) instead.');};
break;
case 'copy':
try{_doc.execCommand(cmd);if(!_doc.queryCommandSupported(cmd))throw 'Error';}
catch(ex){alert('Currently not supported by your browser, use keyboard shortcuts(Ctrl+C) instead.');}
break;
case 'paste':
try{_doc.execCommand(cmd);if(!_doc.queryCommandSupported(cmd))throw 'Error';}
catch(ex){alert('Currently not supported by your browser, use keyboard shortcuts(Ctrl+V) instead.');}
break;
case 'pastetext':
if(window.clipboardData)_this.pasteText(window.clipboardData.getData('Text', true));
else _this.showPastetext();
break;
case 'blocktag':
var menuBlocktag=[];
$.each(arrBlocktag,function(n,v){menuBlocktag.push({s:'<'+v.n+'>'+v.t+'</'+v.n+'>',v:'<'+v.n+'>',t:v.t});});
_this.showMenu(menuBlocktag,function(v){_this._exec('formatblock',v);});
break;
case 'fontface':
var menuFontname=[];
$.each(arrFontname,function(n,v){v.c=v.c?v.c:v.n;menuFontname.push({s:'<span style="font-family:'+v.c+'">'+v.n+'</span>',v:v.c,t:v.n});});
_this.showMenu(menuFontname,function(v){_this._exec('fontname',v);});
break;
case 'fontsize':
var menuFontsize=[];
$.each(arrFontsize,function(n,v){menuFontsize.push({s:'<span style="font-size:'+v.s+';">'+v.t+'('+v.s+')</span>',v:n+1,t:v.t});});
_this.showMenu(menuFontsize,function(v){_this._exec('fontsize',v);});
break;
case 'fontcolor':
_this.showColor(function(v){_this._exec('forecolor',v);});
break;
case 'backcolor':
_this.showColor(function(v){if(isIE)_this._exec('backcolor',v);else{setCSS(true);_this._exec('hilitecolor',v);setCSS(false);}});
break;
case 'align':
_this.showMenu(menuAlign,function(v){_this._exec(v);});
break;
case 'list':
_this.showMenu(menuList,function(v){_this._exec(v);});
break;
case 'link':
_this.showLink();
break;
case 'anchor':
_this.showAnchor();
break;
case 'img':
_this.showImg();
break;
case 'flash':
_this.showEmbed('Flash',htmlFlash,'application/x-shockwave-flash','clsid:d27cdb6e-ae6d-11cf-96b8-4445535400000',' wmode="opaque" quality="high" menu="false" play="true" loop="true" allowfullscreen="true"',settings.upFlashUrl,settings.upFlashExt);
break;
case 'media':
_this.showEmbed('Media',htmlMedia,'application/x-mplayer2','clsid:6bf52a52-394a-11d3-b153-00c04f79faa6',' enablecontextmenu="false" autostart="false"',settings.upMediaUrl,settings.upMediaExt);
break;
case 'hr':
_this.pasteHTML('<hr />');
break;
case 'emot':
_this.showEmot();
break;
case 'table':
_this.showTable();
break;
case 'source':
_this.toggleSource();
break;
case 'preview':
_this.showPreview();
break;
case 'print':
_win.print();
break;
case 'fullscreen':
_this.toggleFullscreen();
break;
case 'about':
_this.showAbout();
break;
default:
_this._exec(cmd);
break;
}
}
ev=null;
}
this._exec=function(cmd,param,noFocus)
{
if(!noFocus)_this.focus();
var state;
if(param!==undefined)state=_doc.execCommand(cmd,false,param);
else state=_doc.execCommand(cmd,false,null);
return state;
}
function checkDblClick(ev)
{
var target=ev.target,tool=arrDbClick[target.tagName.toLowerCase()];
if(tool)
{
if(tool==='Embed')//自动识别Flash和多媒体
{
var arrEmbed={'application/x-shockwave-flash':'Flash','application/x-mplayer2':'Media'};
tool=arrEmbed[target.type.toLowerCase()];
}
_this.exec(tool);
}
}
function checkEsc(ev)
{
if(ev.which===27)
{
if(bShowModal)_this.removeModal();
else if(bShowPanel)_this.hidePanel();
return false;
}
}
function loadReset(){setTimeout(_this.setSource,10);}
function saveResult(){_this.getSource();};
function cleanPaste(ev){
var clipboardData,items,item;//for chrome
if(ev&&(clipboardData=ev.originalEvent.clipboardData)&&(items=clipboardData.items)&&(item=items[0])&&item.kind=='file'&&item.type.match(/^image\//i)){
var blob = item.getAsFile(),reader = new FileReader();
reader.onload=function(){
var sHtml='<img src="'+event.target.result+'">';
sHtml=replaceRemoteImg(sHtml);
_this.pasteHTML(sHtml);
}
reader.readAsDataURL(blob);
return false;
}
var cleanPaste=settings.cleanPaste;
if(cleanPaste===0||bSource||bCleanPaste)return true;
bCleanPaste=true;//解决IE右键粘贴重复产生paste的问题
_this.saveBookmark();
var tag=isIE?'pre':'div',jDiv=$('<'+tag+' class="xhe-paste">\uFEFF\uFEFF</'+tag+'>',_doc).appendTo(_doc.body),div=jDiv[0],sel=_this.getSel(),rng=_this.getRng(true);
jDiv.css('top',_jWin.scrollTop());
if(isIE){
rng.moveToElementText(div);
rng.select();
//注:调用execommand:paste,会导致IE8,IE9目标路径无法转为绝对路径
}
else{
rng.selectNodeContents(div);
sel.removeAllRanges();
sel.addRange(rng);
}
setTimeout(function(){
var bText=(cleanPaste===3),sPaste;
if(bText)sPaste=jDiv.text();
else{
var jTDiv=$('.xhe-paste',_doc.body),arrHtml=[];
jTDiv.each(function(i,n){if($(n).find('.xhe-paste').length==0)arrHtml.push(n.innerHTML);});
sPaste=arrHtml.join('<br />');
}
jDiv.remove();
_this.loadBookmark();
sPaste=sPaste.replace(/^[\s\uFEFF]+|[\s\uFEFF]+$/g,'');
if(sPaste){
if(bText)_this.pasteText(sPaste);
else{
sPaste=_this.cleanHTML(sPaste);
sPaste=_this.cleanWord(sPaste);
sPaste=_this.formatXHTML(sPaste);
if(!settings.onPaste||settings.onPaste&&(sPaste=settings.onPaste(sPaste))!==false){
sPaste=replaceRemoteImg(sPaste);
_this.pasteHTML(sPaste);
}
}
}
bCleanPaste=false;
},0);
}
//远程图片转本地
function replaceRemoteImg(sHtml){
var localUrlTest=settings.localUrlTest,remoteImgSaveUrl=settings.remoteImgSaveUrl;
if(localUrlTest&&remoteImgSaveUrl){
var arrRemoteImgs=[],count=0;
sHtml=sHtml.replace(/(<img)((?:\s+[^>]*?)?(?:\s+src="\s*([^"]+)\s*")(?: [^>]*)?)(\/?>)/ig,function(all,left,attr,url,right){
if(/^(https?|data:image)/i.test(url) && !/_xhe_temp/.test(attr) && !localUrlTest.test(url)){
arrRemoteImgs[count]=url;
attr=attr.replace(/\s+(width|height)="[^"]*"/ig,'').replace(/\s+src="[^"]*"/ig,' src="'+skinPath+'img/waiting.gif" remoteimg="'+(count++)+'"');
}
return left+attr+right;
});
if(arrRemoteImgs.length>0){
$.post(remoteImgSaveUrl,{urls:arrRemoteImgs.join('|')},function(data){
data=data.split('|');
$('img[remoteimg]',_this.doc).each(function(){
var $this=$(this);
xheAttr($this,'src',data[$this.attr('remoteimg')]);
$this.removeAttr('remoteimg');
});
});
}
}
return sHtml;
}
function setCSS(css)
{
try{_this._exec('styleWithCSS',css,true);}
catch(e)
{try{_this._exec('useCSS',!css,true);}catch(e){}}
}
function setOpts()
{
if(bInit&&!bSource)
{
setCSS(false);
try{_this._exec('enableObjectResizing',true,true);}catch(e){}
//try{_this._exec('enableInlineTableEditing',false,true);}catch(e){}
if(isIE)try{_this._exec('BackgroundImageCache',true,true);}catch(e){}
}
}
function forcePtag(ev)
{
if(bSource||ev.which!==13||ev.shiftKey||ev.ctrlKey||ev.altKey)return true;
var pNode=_this.getParent('p,h1,h2,h3,h4,h5,h6,pre,address,div,li');
if(pNode.is('li'))return true;
if(settings.forcePtag){if(pNode.length===0)_this._exec('formatblock','<p>');}
else
{
_this.pasteHTML('<br />');
if(isIE&&pNode.length>0&&_this.getRng().parentElement().childNodes.length===2)_this.pasteHTML('<br />');
return false;
}
}
function fixFullHeight()
{
if(!isMozilla&&!isSafari)
{
if(bFullscreen)_jArea.height('100%').css('height',_jArea.outerHeight()-_jTools.outerHeight());
if(isIE)_jTools.hide().show();
}
}
function fixAppleSel(e)
{
e=e.target;
if(e.tagName.match(/(img|embed)/i))
{
var sel=_this.getSel(),rng=_this.getRng(true);
rng.selectNode(e);
sel.removeAllRanges();
sel.addRange(rng);
}
}
function xheAttr(jObj,n,v)
{
if(!n)return false;
var kn='_xhe_'+n;
if(v)//设置属性
{
if(urlType)v=getLocalUrl(v,urlType,urlBase);
jObj.attr(n,urlBase?getLocalUrl(v,'abs',urlBase):v).removeAttr(kn).attr(kn,v);
}
return jObj.attr(kn)||jObj.attr(n);
}
function clickCancelPanel(){if(bClickCancel)_this.hidePanel();}
function checkShortcuts(event)
{
if(bSource)return true;
var code=event.which,special=specialKeys[code],sChar=special?special:String.fromCharCode(code).toLowerCase();
sKey='';
sKey+=event.ctrlKey?'ctrl+':'';sKey+=event.altKey?'alt+':'';sKey+=event.shiftKey?'shift+':'';sKey+=sChar;
var cmd=arrShortCuts[sKey],c;
for(c in cmd)
{
c=cmd[c];
if($.isFunction(c)){if(c.call(_this)===false)return false;}
else{_this.exec(c);return false;}//按钮独占快捷键
}
}
function is(o,t)
{
var n = typeof(o);
if (!t)return n != 'undefined';
if (t === 'array' && (o.hasOwnProperty && o instanceof Array))return true;
return n === t;
}
function getLocalUrl(url,urlType,urlBase)//绝对地址:abs,根地址:root,相对地址:rel
{
if( (url.match(/^(\w+):\/\//i) && !url.match(/^https?:/i)) || /^#/i.test(url) || /^data:/i.test(url) )return url;//非http和https协议,或者页面锚点不转换,或者base64编码的图片等
var baseUrl=urlBase?$('<a href="'+urlBase+'" />')[0]:location,protocol=baseUrl.protocol,host=baseUrl.host,hostname=baseUrl.hostname,port=baseUrl.port,path=baseUrl.pathname.replace(/\\/g,'/').replace(/[^\/]+$/i,'');
if(port==='')port='80';
if(path==='')path='/';
else if(path.charAt(0)!=='/')path='/'+path;//修正IE path
url=$.trim(url);
//删除域路径
if(urlType!=='abs')url=url.replace(new RegExp(protocol+'\\/\\/'+hostname.replace(/\./g,'\\.')+'(?::'+port+')'+(port==='80'?'?':'')+'(\/|$)','i'),'/');
//删除根路径
if(urlType==='rel')url=url.replace(new RegExp('^'+path.replace(/([\/\.\+\[\]\(\)])/g,'\\$1'),'i'),'');
//加上根路径
if(urlType!=='rel')
{
if(!url.match(/^(https?:\/\/|\/)/i))url=path+url;
if(url.charAt(0)==='/')//处理根路径中的..
{
var arrPath=[],arrFolder = url.split('/'),folder,i,l=arrFolder.length;
for(i=0;i<l;i++)
{
folder=arrFolder[i];
if(folder==='..')arrPath.pop();
else if(folder!==''&&folder!=='.')arrPath.push(folder);
}
if(arrFolder[l-1]==='')arrPath.push('');
url='/'+arrPath.join('/');
}
}
//加上域路径
if(urlType==='abs'&&!url.match(/^https?:\/\//i))url=protocol+'//'+host+url;
url=url.replace(/(https?:\/\/[^:\/?#]+):80(\/|$)/i,'$1$2');//省略80端口
return url;
}
function checkFileExt(filename,limitExt)
{
if(limitExt==='*'||filename.match(new RegExp('\.('+limitExt.replace(/,/g,'|')+')$','i')))return true;
else
{
alert('Upload file extension required for this: '+limitExt);
return false;
}
}
function formatBytes(bytes)
{
var s = ['Byte', 'KB', 'MB', 'GB', 'TB', 'PB'];
var e = Math.floor(Math.log(bytes)/Math.log(1024));
return (bytes/Math.pow(1024, Math.floor(e))).toFixed(2)+s[e];
}
function returnFalse(){return false;}
}
xheditor.settings={skin:'default',tools:'full',clickCancelDialog:true,linkTag:false,internalScript:false,inlineScript:false,internalStyle:true,inlineStyle:true,showBlocktag:false,forcePtag:true,upLinkExt:"zip,rar,txt",upImgExt:"jpg,jpeg,gif,png",upFlashExt:"swf",upMediaExt:"wmv,avi,wma,mp3,mid",modalWidth:350,modalHeight:220,modalTitle:true,defLinkText:'Click here',layerShadow:3,emotMark:false,upBtnText:'Upload',cleanPaste:1,hoverExecDelay:100,html5Upload:true,upMultiple:99};
window.xheditor=xheditor;
$(function(){
$.fn.oldVal=$.fn.val;
$.fn.val=function(value)
{
var _this=this,editor;
if(value===undefined)if(_this[0]&&(editor=_this[0].xheditor))return editor.getSource();else return _this.oldVal();//读
return _this.each(function(){if(editor=this.xheditor)editor.setSource(value);else _this.oldVal(value);});//写
}
$('textarea').each(function(){
var $this=$(this),xhClass=$this.attr('class');
if(xhClass&&(xhClass=xhClass.match(/(?:^|\s)xheditor(?:\-(m?full|simple|mini))?(?:\s|$)/i)))$this.xheditor(xhClass[1]?{tools:xhClass[1]}:null);
});
});
})(jQuery); | zz-ms | trunk/zz-ms-v2.0/src/main/webapp/js/xheditor/src/xheditor-1.1.14-en.js | JavaScript | asf20 | 99,072 |
/*!
* xhEditor - WYSIWYG XHTML Editor
* @requires jQuery v1.4.4
*
* @author Yanis.Wang<yanis.wang@gmail.com>
* @site http://xheditor.com/
* @licence LGPL(http://xheditor.com/license/lgpl.txt)
*
* @Version: 1.1.14 (build 120701)
*/
(function($,undefined){
if(window.xheditor)return false;//防止JS重复加载
var agent=navigator.userAgent.toLowerCase();
var bMobile=agent.indexOf('mobile')!==-1,browser=$.browser,browerVer=parseFloat(browser.version),isIE=browser.msie,isMozilla=browser.mozilla,isSafari=browser.safari,isOpera=browser.opera;
var bAir=agent.indexOf(' adobeair/')>-1;
var bIOS5=/OS 5(_\d)+ like Mac OS X/i.test(agent);
$.fn.xheditor=function(options)
{
if(bMobile&&!bIOS5)return false;//手机浏览器不初始化编辑器(IOS5除外)
var arrSuccess=[];
this.each(function(){
if(!$.nodeName(this,'TEXTAREA'))return;
if(options===false)//卸载
{
if(this.xheditor)
{
this.xheditor.remove();
this.xheditor=null;
}
}
else//初始化
{
if(!this.xheditor)
{
var tOptions=/({.*})/.exec($(this).attr('class'));
if(tOptions)
{
try{tOptions=eval('('+tOptions[1]+')');}catch(ex){};
options=$.extend({},tOptions,options );
}
var editor=new xheditor(this,options);
if(editor.init())
{
this.xheditor=editor;
arrSuccess.push(editor);
}
else editor=null;
}
else arrSuccess.push(this.xheditor);
}
});
if(arrSuccess.length===0)arrSuccess=false;
if(arrSuccess.length===1)arrSuccess=arrSuccess[0];
return arrSuccess;
}
var xCount=0,bShowPanel=false,bClickCancel=true,bShowModal=false,bCheckEscInit=false;
var _jPanel,_jShadow,_jCntLine,_jPanelButton;
var jModal,jModalShadow,layerShadow,jOverlay,jHideSelect,onModalRemove;
var editorRoot;
$('script[src*=xheditor]').each(function(){
var s=this.src;
if(s.match(/xheditor[^\/]*\.js/i)){editorRoot=s.replace(/[\?#].*$/, '').replace(/(^|[\/\\])[^\/]*$/, '$1');return false;}
});
if(isIE){
//ie6 缓存背景图片
try{document.execCommand('BackgroundImageCache', false, true );}
catch(e){}
//修正 jquery 1.6,1.7系列在IE6浏览器下造成width="auto"问题的修正
var jqueryVer=$.fn.jquery;
if(jqueryVer&&jqueryVer.match(/^1\.[67]/))$.attrHooks['width']=$.attrHooks['height']=null;
}
var specialKeys={ 27: 'esc', 9: 'tab', 32:'space', 13: 'enter', 8:'backspace', 145: 'scroll',
20: 'capslock', 144: 'numlock', 19:'pause', 45:'insert', 36:'home', 46:'del',
35:'end', 33: 'pageup', 34:'pagedown', 37:'left', 38:'up', 39:'right',40:'down',
112:'f1',113:'f2', 114:'f3', 115:'f4', 116:'f5', 117:'f6', 118:'f7', 119:'f8', 120:'f9', 121:'f10', 122:'f11', 123:'f12' };
var itemColors=['#FFFFFF','#CCCCCC','#C0C0C0','#999999','#666666','#333333','#000000','#FFCCCC','#FF6666','#FF0000','#CC0000','#990000','#660000','#330000','#FFCC99','#FF9966','#FF9900','#FF6600','#CC6600','#993300','#663300','#FFFF99','#FFFF66','#FFCC66','#FFCC33','#CC9933','#996633','#663333','#FFFFCC','#FFFF33','#FFFF00','#FFCC00','#999900','#666600','#333300','#99FF99','#66FF99','#33FF33','#33CC00','#009900','#006600','#003300','#99FFFF','#33FFFF','#66CCCC','#00CCCC','#339999','#336666','#003333','#CCFFFF','#66FFFF','#33CCFF','#3366FF','#3333FF','#000099','#000066','#CCCCFF','#9999FF','#6666CC','#6633FF','#6600CC','#333399','#330099','#FFCCFF','#FF99FF','#CC66CC','#CC33CC','#993399','#663366','#330033'];
var arrBlocktag=[{n:'p',t:'普通段落'},{n:'h1',t:'标题1'},{n:'h2',t:'标题2'},{n:'h3',t:'标题3'},{n:'h4',t:'标题4'},{n:'h5',t:'标题5'},{n:'h6',t:'标题6'},{n:'pre',t:'已编排格式'},{n:'address',t:'地址'}];
var arrFontname=[{n:'宋体',c:'SimSun'},{n:'仿宋体',c:'FangSong_GB2312'},{n:'黑体',c:'SimHei'},{n:'楷体',c:'KaiTi_GB2312'},{n:'微软雅黑',c:'Microsoft YaHei'},{n:'Arial'},{n:'Arial Black'},{n:'Comic Sans MS'},{n:'Courier New'},{n:'System'},{n:'Times New Roman'},{n:'Tahoma'},{n:'Verdana'}];
var arrFontsize=[{n:'x-small',s:'10px',t:'极小'},{n:'small',s:'12px',t:'特小'},{n:'medium',s:'16px',t:'小'},{n:'large',s:'18px',t:'中'},{n:'x-large',s:'24px',t:'大'},{n:'xx-large',s:'32px',t:'特大'},{n:'-webkit-xxx-large',s:'48px',t:'极大'}];
var menuAlign=[{s:'左对齐',v:'justifyleft'},{s:'居中',v:'justifycenter'},{s:'右对齐',v:'justifyright'},{s:'两端对齐',v:'justifyfull'}],menuList=[{s:'数字列表',v:'insertOrderedList'},{s:'符号列表',v:'insertUnorderedList'}];
var htmlPastetext='<div><label for="xhePastetextValue">使用键盘快捷键(Ctrl+V)把内容粘贴到方框里,按 确定</label></div><div><textarea id="xhePastetextValue" wrap="soft" spellcheck="false" style="width:300px;height:100px;" /></div><div style="text-align:right;"><input type="button" id="xheSave" value="确定" /></div>';
var htmlLink='<div><label for="xheLinkUrl">链接地址: </label><input type="text" id="xheLinkUrl" value="http://" class="xheText" /></div><div><label for="xheLinkTarget">打开方式: </label><select id="xheLinkTarget"><option selected="selected" value="">默认</option><option value="_blank">新窗口</option><option value="_self">当前窗口</option><option value="_parent">父窗口</option></select></div><div style="display:none"><label for="xheLinkText">链接文字: </label><input type="text" id="xheLinkText" value="" class="xheText" /></div><div style="text-align:right;"><input type="button" id="xheSave" value="确定" /></div>';
var htmlAnchor='<div><label for="xheAnchorName">锚点名称: </label><input type="text" id="xheAnchorName" value="" class="xheText" /></div><div style="text-align:right;"><input type="button" id="xheSave" value="确定" /></div>';
var htmlImg='<div><label for="xheImgUrl">图片文件: </label><input type="text" id="xheImgUrl" value="http://" class="xheText" /></div><div><div><label for="xheImgAlt">替换文本: </label><input type="text" id="xheImgAlt" /></div><div><label for="xheImgAlign">对齐方式: </label><select id="xheImgAlign"><option selected="selected" value="">默认</option><option value="left">左对齐</option><option value="right">右对齐</option><option value="top">顶端</option><option value="middle">居中</option><option value="baseline">基线</option><option value="bottom">底边</option></select></div><div><label for="xheImgWidth">宽 度: </label><input type="text" id="xheImgWidth" style="width:40px;" /> <label for="xheImgHeight">高 度: </label><input type="text" id="xheImgHeight" style="width:40px;" /></div><div><label for="xheImgBorder">边框大小: </label><input type="text" id="xheImgBorder" style="width:40px;" /></div><div><label for="xheImgHspace">水平间距: </label><input type="text" id="xheImgHspace" style="width:40px;" /> <label for="xheImgVspace">垂直间距: </label><input type="text" id="xheImgVspace" style="width:40px;" /></div><div style="text-align:right;"><input type="button" id="xheSave" value="确定" /></div>';
var htmlFlash='<div><label for="xheFlashUrl">动画文件: </label><input type="text" id="xheFlashUrl" value="http://" class="xheText" /></div><div><label for="xheFlashWidth">宽 度: </label><input type="text" id="xheFlashWidth" style="width:40px;" value="480" /> <label for="xheFlashHeight">高 度: </label><input type="text" id="xheFlashHeight" style="width:40px;" value="400" /></div><div style="text-align:right;"><input type="button" id="xheSave" value="确定" /></div>';
var htmlMedia='<div><label for="xheMediaUrl">媒体文件: </label><input type="text" id="xheMediaUrl" value="http://" class="xheText" /></div><div><label for="xheMediaWidth">宽 度: </label><input type="text" id="xheMediaWidth" style="width:40px;" value="480" /> <label for="xheMediaHeight">高 度: </label><input type="text" id="xheMediaHeight" style="width:40px;" value="400" /></div><div style="text-align:right;"><input type="button" id="xheSave" value="确定" /></div>';
var htmlTable='<div><label for="xheTableRows">行 数: </label><input type="text" id="xheTableRows" style="width:40px;" value="3" /> <label for="xheTableColumns">列 数: </label><input type="text" id="xheTableColumns" style="width:40px;" value="2" /></div><div><label for="xheTableHeaders">标题单元: </label><select id="xheTableHeaders"><option selected="selected" value="">无</option><option value="row">第一行</option><option value="col">第一列</option><option value="both">第一行和第一列</option></select></div><div><label for="xheTableWidth">宽 度: </label><input type="text" id="xheTableWidth" style="width:40px;" value="200" /> <label for="xheTableHeight">高 度: </label><input type="text" id="xheTableHeight" style="width:40px;" value="" /></div><div><label for="xheTableBorder">边框大小: </label><input type="text" id="xheTableBorder" style="width:40px;" value="1" /></div><div><label for="xheTableCellSpacing">表格间距: </label><input type="text" id="xheTableCellSpacing" style="width:40px;" value="1" /> <label for="xheTableCellPadding">表格填充: </label><input type="text" id="xheTableCellPadding" style="width:40px;" value="1" /></div><div><label for="xheTableAlign">对齐方式: </label><select id="xheTableAlign"><option selected="selected" value="">默认</option><option value="left">左对齐</option><option value="center">居中</option><option value="right">右对齐</option></select></div><div><label for="xheTableCaption">表格标题: </label><input type="text" id="xheTableCaption" /></div><div style="text-align:right;"><input type="button" id="xheSave" value="确定" /></div>';
var htmlAbout='<div style="font:12px Arial;width:245px;word-wrap:break-word;word-break:break-all;outline:none;" role="dialog" tabindex="-1"><p><span style="font-size:20px;color:#1997DF;">xhEditor</span><br />v1.1.14 (build 120701)</p><p>xhEditor是基于jQuery开发的跨平台轻量可视化XHTML编辑器,基于<a href="http://www.gnu.org/licenses/lgpl.html" target="_blank">LGPL</a>开源协议发布。</p><p>Copyright © <a href="http://xheditor.com/" target="_blank">xhEditor.com</a>. All rights reserved.</p></div>';
var itemEmots={'default':{name:'默认',width:24,height:24,line:7,list:{'smile':'微笑','tongue':'吐舌头','titter':'偷笑','laugh':'大笑','sad':'难过','wronged':'委屈','fastcry':'快哭了','cry':'哭','wail':'大哭','mad':'生气','knock':'敲打','curse':'骂人','crazy':'抓狂','angry':'发火','ohmy':'惊讶','awkward':'尴尬','panic':'惊恐','shy':'害羞','cute':'可怜','envy':'羡慕','proud':'得意','struggle':'奋斗','quiet':'安静','shutup':'闭嘴','doubt':'疑问','despise':'鄙视','sleep':'睡觉','bye':'再见'}}};
var arrTools={Cut:{t:'剪切 (Ctrl+X)'},Copy:{t:'复制 (Ctrl+C)'},Paste:{t:'粘贴 (Ctrl+V)'},Pastetext:{t:'粘贴文本',h:isIE?0:1},Blocktag:{t:'段落标签',h:1},Fontface:{t:'字体',h:1},FontSize:{t:'字体大小',h:1},Bold:{t:'加粗 (Ctrl+B)',s:'Ctrl+B'},Italic:{t:'斜体 (Ctrl+I)',s:'Ctrl+I'},Underline:{t:'下划线 (Ctrl+U)',s:'Ctrl+U'},Strikethrough:{t:'删除线'},FontColor:{t:'字体颜色',h:1},BackColor:{t:'背景颜色',h:1},SelectAll:{t:'全选 (Ctrl+A)'},Removeformat:{t:'删除文字格式'},Align:{t:'对齐',h:1},List:{t:'列表',h:1},Outdent:{t:'减少缩进'},Indent:{t:'增加缩进'},Link:{t:'超链接 (Ctrl+L)',s:'Ctrl+L',h:1},Unlink:{t:'取消超链接'},Anchor:{t:'锚点',h:1},Img:{t:'图片',h:1},Flash:{t:'Flash动画',h:1},Media:{t:'多媒体文件',h:1},Hr:{t:'插入水平线'},Emot:{t:'表情',s:'ctrl+e',h:1},Table:{t:'表格',h:1},Source:{t:'源代码'},Preview:{t:'预览'},Print:{t:'打印 (Ctrl+P)',s:'Ctrl+P'},Fullscreen:{t:'全屏编辑 (Esc)',s:'Esc'},About:{t:'关于 xhEditor'}};
var toolsThemes={
mini:'Bold,Italic,Underline,Strikethrough,|,Align,List,|,Link,Img',
simple:'Blocktag,Fontface,FontSize,Bold,Italic,Underline,Strikethrough,FontColor,BackColor,|,Align,List,Outdent,Indent,|,Link,Img,Emot',
full:'Cut,Copy,Paste,Pastetext,|,Blocktag,Fontface,FontSize,Bold,Italic,Underline,Strikethrough,FontColor,BackColor,SelectAll,Removeformat,|,Align,List,Outdent,Indent,|,Link,Unlink,Anchor,Img,Flash,Media,Hr,Emot,Table,|,Source,Preview,Print,Fullscreen'};
toolsThemes.mfull=toolsThemes.full.replace(/\|(,Align)/i,'/$1');
var arrDbClick={'a':'Link','img':'Img','embed':'Embed'},uploadInputname='filedata';
var arrEntities={'<':'<','>':'>','"':'"','®':'®','©':'©'};//实体
var regEntities=/[<>"®©]/g;
var xheditor=function(textarea,options)
{
var _this=this,_text=textarea,_jText=$(_text),_jForm=_jText.closest('form'),_jTools,_jArea,_win,_jWin,_doc,_jDoc;
var bookmark;
var bInit=false,bSource=false,bFullscreen=false,bCleanPaste=false,outerScroll,bShowBlocktag=false,sLayoutStyle='',ev=null,timer,bDisableHoverExec=false,bQuickHoverExec=false;
var lastPoint=null,lastAngle=null;//鼠标悬停显示
var editorHeight=0;
var settings=_this.settings=$.extend({},xheditor.settings,options );
var plugins=settings.plugins,strPlugins=[];
if(plugins)
{
arrTools=$.extend({},arrTools,plugins);
$.each(plugins,function(n){strPlugins.push(n);});
strPlugins=strPlugins.join(',');
}
if(settings.tools.match(/^\s*(m?full|simple|mini)\s*$/i))
{
var toolsTheme=toolsThemes[$.trim(settings.tools)];
settings.tools=(settings.tools.match(/m?full/i)&&plugins)?toolsTheme.replace('Table','Table,'+strPlugins):toolsTheme;//插件接在full的Table后面
}
//如需删除关于按钮,请往官方网站购买商业授权:http://xheditor.com/service
//在未购买商业授权的情况下私自去除xhEditor的版权信息,您将得不到官方提供的任何技术支持和BUG反馈服务,并且我们将对您保留法律诉讼的权利
//请支持开源项目
if(!settings.tools.match(/(^|,)\s*About\s*(,|$)/i))settings.tools+=',About';
settings.tools=settings.tools.split(',');
if(settings.editorRoot)editorRoot=settings.editorRoot;
if(bAir===false)editorRoot=getLocalUrl(editorRoot,'abs');
if(settings.urlBase)settings.urlBase=getLocalUrl(settings.urlBase,'abs');
//基本控件名
var idCSS='xheCSS_'+settings.skin,idContainer='xhe'+xCount+'_container',idTools='xhe'+xCount+'_Tool',idIframeArea='xhe'+xCount+'_iframearea',idIframe='xhe'+xCount+'_iframe',idFixFFCursor='xhe'+xCount+'_fixffcursor';
var headHTML='',bodyClass='',skinPath=editorRoot+'xheditor_skin/'+settings.skin+'/',arrEmots=itemEmots,urlType=settings.urlType,urlBase=settings.urlBase,emotPath=settings.emotPath,emotPath=emotPath?emotPath:editorRoot+'xheditor_emot/',selEmotGroup='';
arrEmots=$.extend({},arrEmots,settings.emots);
emotPath=getLocalUrl(emotPath,'rel',urlBase?urlBase:null);//返回最短表情路径
bShowBlocktag=settings.showBlocktag;
if(bShowBlocktag)bodyClass+=' showBlocktag';
var arrShortCuts=[];
this.init=function()
{
//加载样式表
if($('#'+idCSS).length===0)$('head').append('<link id="'+idCSS+'" rel="stylesheet" type="text/css" href="'+skinPath+'ui.css" />');
//初始化编辑器
var textareaWidth=_jText.outerWidth(),textareaHeight=_jText.outerHeight();
var editorWidth = settings.width || _text.style.width || (textareaWidth>10?textareaWidth:0);
editorHeight = settings.height || _text.style.height || (textareaHeight>10?textareaHeight:150);//默认高度
if(is(editorWidth,'number'))editorWidth+='px';
if(is(editorHeight,'string'))editorHeight=editorHeight.replace(/[^\d]+/g,'');
//编辑器CSS背景
var editorBackground=settings.background || _text.style.background;
//工具栏内容初始化
var arrToolsHtml=['<span class="xheGStart"/>'],tool,cn,regSeparator=/\||\//i;
$.each(settings.tools,function(i,n)
{
if(n.match(regSeparator))arrToolsHtml.push('<span class="xheGEnd"/>');
if(n==='|')arrToolsHtml.push('<span class="xheSeparator"/>');
else if(n==='/')arrToolsHtml.push('<br />');
else
{
tool=arrTools[n];
if(!tool)return;
if(tool.c)cn=tool.c;
else cn='xheIcon xheBtn'+n;
arrToolsHtml.push('<span><a href="#" title="'+tool.t+'" cmd="'+n+'" class="xheButton xheEnabled" tabindex="-1" role="button"><span class="'+cn+'" unselectable="on" style="font-size:0;color:transparent;text-indent:-999px;">'+tool.t+'</span></a></span>');
if(tool.s)_this.addShortcuts(tool.s,n);
}
if(n.match(regSeparator))arrToolsHtml.push('<span class="xheGStart"/>');
});
arrToolsHtml.push('<span class="xheGEnd"/><br />');
_jText.after($('<input type="text" id="'+idFixFFCursor+'" style="position:absolute;display:none;" /><span id="'+idContainer+'" class="xhe_'+settings.skin+'" style="display:none"><table cellspacing="0" cellpadding="0" class="xheLayout" style="'+(editorWidth!='0px'?'width:'+editorWidth+';':'')+'height:'+editorHeight+'px;" role="presentation"><tr><td id="'+idTools+'" class="xheTool" unselectable="on" style="height:1px;" role="presentation"></td></tr><tr><td id="'+idIframeArea+'" class="xheIframeArea" role="presentation"><iframe frameborder="0" id="'+idIframe+'" src="javascript:;" style="width:100%;"></iframe></td></tr></table></span>'));
_jTools=$('#'+idTools);_jArea=$('#'+idIframeArea);
headHTML='<meta http-equiv="Content-Type" content="text/html; charset=utf-8" /><link rel="stylesheet" href="'+skinPath+'iframe.css"/>';
var loadCSS=settings.loadCSS;
if(loadCSS)
{
if(is(loadCSS,'array'))for(var i in loadCSS)headHTML+='<link rel="stylesheet" href="'+loadCSS[i]+'"/>';
else
{
if(loadCSS.match(/\s*<style(\s+[^>]*?)?>[\s\S]+?<\/style>\s*/i))headHTML+=loadCSS;
else headHTML+='<link rel="stylesheet" href="'+loadCSS+'"/>';
}
}
var iframeHTML='<html><head>'+headHTML+'<title>可视化编辑器,alt+1到9键,切换到工具区,tab键,选择按钮,esc键,返回编辑 '+(settings.readTip?settings.readTip:'')+'</title>';
if(editorBackground)iframeHTML+='<style>html{background:'+editorBackground+';}</style>';
iframeHTML+='</head><body spellcheck="0" class="editMode'+bodyClass+'"></body></html>';
_this.win=_win=$('#'+idIframe)[0].contentWindow;
_jWin=$(_win);
try{
this.doc=_doc = _win.document;_jDoc=$(_doc);
_doc.open();
_doc.write(iframeHTML);
_doc.close();
if(isIE)_doc.body.contentEditable='true';
else _doc.designMode = 'On';
}catch(e){}
setTimeout(setOpts,300);
_this.setSource();
_win.setInterval=null;//针对jquery 1.3无法操作iframe window问题的hack
//添加工具栏
_jTools.append(arrToolsHtml.join('')).bind('mousedown contextmenu',returnFalse).click(function(event)
{
var jButton=$(event.target).closest('a');
if(jButton.is('.xheEnabled'))
{
clearTimeout(timer);//取消悬停执行
_jTools.find('a').attr('tabindex','-1');//无障碍支持
ev=event;
_this.exec(jButton.attr('cmd'));
}
return false;
});
_jTools.find('.xheButton').hover(function(event){//鼠标悬停执行
var jButton=$(this),delay=settings.hoverExecDelay;
var tAngle=lastAngle;lastAngle=null;
if(delay===-1||bDisableHoverExec||!jButton.is('.xheEnabled'))return false;
if(tAngle&&tAngle>10)//检测误操作
{
bDisableHoverExec=true;
setTimeout(function(){bDisableHoverExec=false;},100);
return false;
}
var cmd=jButton.attr('cmd'),bHover=arrTools[cmd].h===1;
if(!bHover)
{
_this.hidePanel();//移到非悬停按钮上隐藏面板
return false;
}
if(bQuickHoverExec)delay=0;
if(delay>=0)timer=setTimeout(function(){
ev=event;
lastPoint={x:ev.clientX,y:ev.clientY};
_this.exec(cmd);
},delay);
},function(event){lastPoint=null;if(timer)clearTimeout(timer);}).mousemove(function(event){
if(lastPoint)
{
var diff={x:event.clientX-lastPoint.x,y:event.clientY-lastPoint.y};
if(Math.abs(diff.x)>1||Math.abs(diff.y)>1)
{
if(diff.x>0&&diff.y>0)
{
var tAngle=Math.round(Math.atan(diff.y/diff.x)/0.017453293);
if(lastAngle)lastAngle=(lastAngle+tAngle)/2
else lastAngle=tAngle;
}
else lastAngle=null;
lastPoint={x:event.clientX,y:event.clientY};
}
}
});
//初始化面板
_jPanel=$('#xhePanel');
_jShadow=$('#xheShadow');
_jCntLine=$('#xheCntLine');
if(_jPanel.length===0)
{
_jPanel=$('<div id="xhePanel"></div>').mousedown(function(ev){ev.stopPropagation()});
_jShadow=$('<div id="xheShadow"></div>');
_jCntLine=$('<div id="xheCntLine"></div>');
setTimeout(function(){
$(document.body).append(_jPanel).append(_jShadow).append(_jCntLine);
},10);
}
//切换显示区域
$('#'+idContainer).show();
_jText.hide();
_jArea.css('height',editorHeight-_jTools.outerHeight());
if(isIE&browerVer<8)setTimeout(function(){_jArea.css('height',editorHeight-_jTools.outerHeight());},1);
//绑定内核事件
_jText.focus(_this.focus);
_jForm.submit(saveResult).bind('reset', loadReset);//绑定表单的提交和重置事件
if(settings.submitID)$('#'+settings.submitID).mousedown(saveResult);//自定义绑定submit按钮
$(window).bind('unload beforeunload',saveResult).bind('resize',fixFullHeight);
$(document).mousedown(clickCancelPanel);
if(!bCheckEscInit){$(document).keydown(checkEsc);bCheckEscInit=true;}
_jWin.focus(function(){if(settings.focus)settings.focus();}).blur(function(){if(settings.blur)settings.blur();});
if(isSafari)_jWin.click(fixAppleSel);
_jDoc.mousedown(clickCancelPanel).keydown(checkShortcuts).keypress(forcePtag).dblclick(checkDblClick).bind('mousedown click',function(ev){_jText.trigger(ev.type);});
if(isIE)
{
//IE控件上Backspace会导致页面后退
_jDoc.keydown(function(ev){var rng=_this.getRng();if(ev.which===8&&rng.item){$(rng.item(0)).remove();return false;}});
//修正IE拖动img大小不更新width和height属性值的问题
function fixResize(ev)
{
var jImg=$(ev.target),v;
if(v=jImg.css('width'))jImg.css('width','').attr('width',v.replace(/[^0-9%]+/g, ''));
if(v=jImg.css('height'))jImg.css('height','').attr('height',v.replace(/[^0-9%]+/g, ''));
}
_jDoc.bind('controlselect',function(ev){
ev=ev.target;if(!$.nodeName(ev,'IMG'))return;
$(ev).unbind('resizeend',fixResize).bind('resizeend',fixResize);
});
}
//无障碍支持
_jDoc.keydown(function(e){
var which=e.which;
if(e.altKey&&which>=49&&which<=57){
_jTools.find('a').attr('tabindex','0');
_jTools.find('.xheGStart').eq(which-49).next().find('a').focus();
_doc.title='\uFEFF\uFEFF';
return false;
}
}).click(function(){
_jTools.find('a').attr('tabindex','-1');
});
_jTools.keydown(function(e){
var which=e.which;
if(which==27){
_jTools.find('a').attr('tabindex','-1');
_this.focus();
}
else if(e.altKey&&which>=49&&which<=57){
_jTools.find('.xheGStart').eq(which-49).next().find('a').focus();
return false;
}
});
var jBody=$(_doc.documentElement);
//自动清理粘贴内容
if(isOpera)jBody.bind('keydown',function(e){if(e.ctrlKey&&e.which===86)cleanPaste();});
else jBody.bind(isIE?'beforepaste':'paste',cleanPaste);
//禁用编辑区域的浏览器默认右键菜单
if(settings.disableContextmenu)jBody.bind('contextmenu',returnFalse);
//HTML5编辑区域直接拖放上传
if(settings.html5Upload)jBody.bind('dragenter dragover',function(ev){var types;if((types=ev.originalEvent.dataTransfer.types)&&$.inArray('Files', types)!==-1)return false;}).bind('drop',function(ev){
var dataTransfer=ev.originalEvent.dataTransfer,fileList;
if(dataTransfer&&(fileList=dataTransfer.files)&&fileList.length>0){
var i,cmd,arrCmd=['Link','Img','Flash','Media'],arrExt=[],strExt;
for(i in arrCmd){
cmd=arrCmd[i];
if(settings['up'+cmd+'Url']&&settings['up'+cmd+'Url'].match(/^[^!].*/i))arrExt.push(cmd+':,'+settings['up'+cmd+'Ext']);//允许上传
}
if(arrExt.length===0)return false;//禁止上传
else strExt=arrExt.join(',');
function getCmd(fileList){
var match,fileExt,cmd;
for(i=0;i<fileList.length;i++){
fileExt=fileList[i].name.replace(/.+\./,'');
if(match=strExt.match(new RegExp('(\\w+):[^:]*,'+fileExt+'(?:,|$)','i'))){
if(!cmd)cmd=match[1];
else if(cmd!==match[1])return 2;
}
else return 1;
}
return cmd;
}
cmd=getCmd(fileList);
if(cmd===1)alert('上传文件的扩展名必需为:'+strExt.replace(/\w+:,/g,''));
else if(cmd===2)alert('每次只能拖放上传同一类型文件');
else if(cmd){
_this.startUpload(fileList,settings['up'+cmd+'Url'],'*',function(arrMsg){
var arrUrl=[],msg,onUpload=settings.onUpload;
if(onUpload)onUpload(arrMsg);//用户上传回调
for(var i=0,c=arrMsg.length;i<c;i++){
msg=arrMsg[i];
url=is(msg,'string')?msg:msg.url;
if(url.substr(0,1)==='!')url=url.substr(1);
arrUrl.push(url);
}
_this.exec(cmd);
$('#xhe'+cmd+'Url').val(arrUrl.join(' '));
$('#xheSave').click();
});
}
return false;
}
});
//添加用户快捷键
var shortcuts=settings.shortcuts;
if(shortcuts)$.each(shortcuts,function(key,func){_this.addShortcuts(key,func);});
xCount++;
bInit=true;
if(settings.fullscreen)_this.toggleFullscreen();
else if(settings.sourceMode)setTimeout(_this.toggleSource,20);
return true;
}
this.remove=function()
{
_this.hidePanel();
saveResult();//卸载前同步最新内容到textarea
//取消绑定事件
_jText.unbind('focus',_this.focus);
_jForm.unbind('submit',saveResult).unbind('reset', loadReset);
if(settings.submitID)$('#'+settings.submitID).unbind('mousedown',saveResult);
$(window).unbind('unload beforeunload',saveResult).unbind('resize',fixFullHeight);
$(document).unbind('mousedown',clickCancelPanel);
$('#'+idContainer).remove();
$('#'+idFixFFCursor).remove();
_jText.show();
bInit=false;
}
this.saveBookmark=function(){
if(!bSource){
_this.focus();
var rng=_this.getRng();
rng=rng.cloneRange?rng.cloneRange():rng;
bookmark={'top':_jWin.scrollTop(),'rng':rng};
}
}
this.loadBookmark=function()
{
if(bSource||!bookmark)return;
_this.focus();
var rng=bookmark.rng;
if(isIE)rng.select();
else
{
var sel=_this.getSel();
sel.removeAllRanges();
sel.addRange(rng);
}
_jWin.scrollTop(bookmark.top);
bookmark=null;
}
this.focus=function()
{
if(!bSource)_win.focus();
else $('#sourceCode',_doc).focus();
if(isIE){
var rng=_this.getRng();
if(rng.parentElement&&rng.parentElement().ownerDocument!==_doc)_this.setTextCursor();//修正IE初始焦点问题
}
return false;
}
this.setTextCursor=function(bLast)
{
var rng=_this.getRng(true),cursorNode=_doc.body;
if(isIE)rng.moveToElementText(cursorNode);
else{
var chileName=bLast?'lastChild':'firstChild';
while(cursorNode.nodeType!=3&&cursorNode[chileName]){cursorNode=cursorNode[chileName];}
rng.selectNode(cursorNode);
}
rng.collapse(bLast?false:true);
if(isIE)rng.select();
else{var sel=_this.getSel();sel.removeAllRanges();sel.addRange(rng);}
}
this.getSel=function()
{
return _doc.selection ? _doc.selection : _win.getSelection();
}
this.getRng=function(bNew)
{
var sel,rng;
try{
if(!bNew){
sel=_this.getSel();
rng = sel.createRange ? sel.createRange() : sel.rangeCount > 0?sel.getRangeAt(0):null;
}
if(!rng)rng = _doc.body.createTextRange?_doc.body.createTextRange():_doc.createRange();
}catch (ex){}
return rng;
}
this.getParent=function(tag)
{
var rng=_this.getRng(),p;
if(!isIE)
{
p = rng.commonAncestorContainer;
if(!rng.collapsed)if(rng.startContainer === rng.endContainer&&rng.startOffset - rng.endOffset < 2&&rng.startContainer.hasChildNodes())p = rng.startContainer.childNodes[rng.startOffset];
}
else p=rng.item?rng.item(0):rng.parentElement();
tag=tag?tag:'*';p=$(p);
if(!p.is(tag))p=$(p).closest(tag);
return p;
}
this.getSelect=function(format)
{
var sel=_this.getSel(),rng=_this.getRng(),isCollapsed=true;
if (!rng || rng.item)isCollapsed=false
else isCollapsed=!sel || rng.boundingWidth === 0 || rng.collapsed;
if(format==='text')return isCollapsed ? '' : (rng.text || (sel.toString ? sel.toString() : ''));
var sHtml;
if(rng.cloneContents)
{
var tmp=$('<div></div>'),c;
c = rng.cloneContents();
if(c)tmp.append(c);
sHtml=tmp.html();
}
else if(is(rng.item))sHtml=rng.item(0).outerHTML;
else if(is(rng.htmlText))sHtml=rng.htmlText;
else sHtml=rng.toString();
if(isCollapsed)sHtml='';
sHtml=_this.processHTML(sHtml,'read');
sHtml=_this.cleanHTML(sHtml);
sHtml=_this.formatXHTML(sHtml);
return sHtml;
}
this.pasteHTML=function(sHtml,bStart)
{
if(bSource)return false;
_this.focus();
sHtml=_this.processHTML(sHtml,'write');
var sel=_this.getSel(),rng=_this.getRng();
if(bStart!==undefined)//非覆盖式插入
{
if(rng.item)
{
var item=rng.item(0);
rng=_this.getRng(true);
rng.moveToElementText(item);
rng.select();
}
rng.collapse(bStart);
}
sHtml+='<'+(isIE?'img':'span')+' id="_xhe_temp" width="0" height="0" />';
if(rng.insertNode)
{
if($(rng.startContainer).closest('style,script').length>0)return false;//防止粘贴在style和script内部
rng.deleteContents();
rng.insertNode(rng.createContextualFragment(sHtml));
}
else
{
if(sel.type.toLowerCase()==='control'){sel.clear();rng=_this.getRng();};
rng.pasteHTML(sHtml);
}
var jTemp=$('#_xhe_temp',_doc),temp=jTemp[0];
if(isIE)
{
rng.moveToElementText(temp);
rng.select();
}
else
{
rng.selectNode(temp);
sel.removeAllRanges();
sel.addRange(rng);
}
jTemp.remove();
}
this.pasteText=function(text,bStart)
{
if(!text)text='';
text=_this.domEncode(text);
text = text.replace(/\r?\n/g, '<br />');
_this.pasteHTML(text,bStart);
}
this.appendHTML=function(sHtml)
{
if(bSource)return false;
_this.focus();
sHtml=_this.processHTML(sHtml,'write');
$(_doc.body).append(sHtml);
_this.setTextCursor(true);
}
this.domEncode=function(text)
{
return text.replace(regEntities,function(c){return arrEntities[c];});
}
this.setSource=function(sHtml)
{
bookmark=null;
if(typeof sHtml!=='string'&&sHtml!=='')sHtml=_text.value;
if(bSource)$('#sourceCode',_doc).val(sHtml);
else
{
if(settings.beforeSetSource)sHtml=settings.beforeSetSource(sHtml);
sHtml=_this.cleanHTML(sHtml);
sHtml=_this.formatXHTML(sHtml);
sHtml=_this.processHTML(sHtml,'write');
if(isIE){//修正IE会删除可视内容前的script,style,<!--
_doc.body.innerHTML='<img id="_xhe_temp" width="0" height="0" />'+sHtml;//修正IE会删除&符号后面代码的问题
$('#_xhe_temp',_doc).remove();
}
else _doc.body.innerHTML=sHtml;
}
}
this.processHTML=function(sHtml,mode)
{
var appleClass=' class="Apple-style-span"';
if(mode==='write')
{//write
sHtml=sHtml.replace(/(<(\/?)(\w+))((?:\s+[\w\-:]+\s*=\s*(?:"[^"]*"|'[^']*'|[^>\s]+))*)\s*((\/?)>)/g,function(all,left,end1,tag,attr,right,end2){
tag=tag.toLowerCase();
if(isMozilla){
if(tag==='strong')tag='b';
else if(tag==='em')tag='i';
}
else if(isSafari){
if(tag==='strong'){tag='span';if(!end1)attr+=appleClass+' style="font-weight: bold;"';}
else if(tag==='em'){tag='span';if(!end1)attr+=appleClass+' style="font-style: italic;"';}
else if(tag==='u'){tag='span';if(!end1)attr+=appleClass+' style="text-decoration: underline;"';}
else if(tag==='strike'){tag='span';if(!end1)attr+=appleClass+' style="text-decoration: line-through;"';}
}
var emot,addClass='';
if(tag==='del')tag='strike';//编辑状态统一转为strike
else if(tag==='img'){
//恢复emot
attr=attr.replace(/\s+emot\s*=\s*("[^"]*"|'[^']*'|[^>\s]+)/i,function(all,v){
emot=v.match(/^(["']?)(.*)\1/)[2];
emot=emot.split(',');
if(!emot[1]){emot[1]=emot[0];emot[0]=''}
if(emot[0]==='default')emot[0]='';
return settings.emotMark?all:'';
});
}
else if(tag==='a'){
if(!attr.match(/ href=[^ ]/i)&&attr.match(/ name=[^ ]/i))addClass+=' xhe-anchor';
if(end2)right='></a>';
}
else if(tag==='table'&&!end1){
var tb=attr.match(/\s+border\s*=\s*("[^"]*"|'[^']*'|[^>\s]+)/i);
if(!tb||tb[1].match(/^(["']?)\s*0\s*\1$/))addClass+=' xhe-border';
}
var bAppleClass;
//处理属性
attr=attr.replace(/\s+([\w\-:]+)\s*=\s*("[^"]*"|'[^']*'|[^>\s]+)/g,function(all,n,v){
n=n.toLowerCase();
v=v.match(/^(["']?)(.*)\1/)[2];
aft='';//尾部增加属性
if(isIE&&n.match(/^(disabled|checked|readonly|selected)$/)&&v.match(/^(false|0)$/i))return '';
//恢复emot
if(tag==='img'&&emot&&n==='src')return '';
//保存属性值:src,href
if(n.match(/^(src|href)$/)){
aft=' _xhe_'+n+'="'+v+'"';
if(urlBase)v=getLocalUrl(v,'abs',urlBase);
}
//添加class
if(addClass&&n==='class'){
v+=' '+addClass;
addClass='';
}
//处理Safari style值
if(isSafari&&n==='style'){
if(tag==='span'&&v.match(/(^|;)\s*(font-family|font-size|color|background-color)\s*:\s*[^;]+\s*(;|$)/i))bAppleClass=true;
}
return ' '+n+'="'+v+'"'+aft;
});
//恢复emot
if(emot){
var url=emotPath+(emot[0]?emot[0]:'default')+'/'+emot[1]+'.gif';
attr+=' src="'+url+'" _xhe_src="'+url+'"';
}
if(bAppleClass)attr+=appleClass;
if(addClass)attr+=' class="'+addClass+'"';
return '<'+end1+tag+attr+right;
});
if(isIE)sHtml = sHtml.replace(/'/ig, ''');
if(!isSafari)
{
//style转font
function style2font(all,tag,left,style,right,content)
{
var attrs='',f,s1,s2,c;
f=style.match(/font-family\s*:\s*([^;"]+)/i);
if(f)attrs+=' face="'+f[1]+'"';
s1=style.match(/font-size\s*:\s*([^;"]+)/i);
if(s1)
{
s1=s1[1].toLowerCase();
for(var j=0;j<arrFontsize.length;j++)if(s1===arrFontsize[j].n||s1===arrFontsize[j].s){s2=j+1;break;}
if(s2)
{
attrs+=' size="'+s2+'"';
style=style.replace(/(^|;)(\s*font-size\s*:\s*[^;"]+;?)+/ig,'$1');
}
}
c=style.match(/(?:^|[\s;])color\s*:\s*([^;"]+)/i);
if(c)
{
var rgb;
if(rgb=c[1].match(/\s*rgb\s*\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*\)/i)){
c[1]='#';
for(var i=1;i<=3;i++){
c[1]+=('0'+(rgb[i]-0).toString(16)).slice(-2);
}
}
c[1]=c[1].replace(/^#([0-9a-f])([0-9a-f])([0-9a-f])$/i,'#$1$1$2$2$3$3');
attrs+=' color="'+c[1]+'"';
}
style=style.replace(/(^|;)(\s*(font-family|color)\s*:\s*[^;"]+;?)+/ig,'$1');
if(attrs!=='')
{
if(style)attrs+=' style="'+style+'"';
return '<font'+(left?left:'')+attrs+(right?right:'')+'>'+content+"</font>";
}
else return all;
}
sHtml = sHtml.replace(/<(span)(\s+[^>]*?)?\s+style\s*=\s*"((?:[^"]*?;)?\s*(?:font-family|font-size|color)\s*:[^"]*)"( [^>]*)?>(((?!<\1(\s+[^>]*?)?>)[\s\S]|<\1(\s+[^>]*?)?>((?!<\1(\s+[^>]*?)?>)[\s\S]|<\1(\s+[^>]*?)?>((?!<\1(\s+[^>]*?)?>)[\s\S])*?<\/\1>)*?<\/\1>)*?)<\/\1>/ig,style2font);//第3层
sHtml = sHtml.replace(/<(span)(\s+[^>]*?)?\s+style\s*=\s*"((?:[^"]*?;)?\s*(?:font-family|font-size|color)\s*:[^"]*)"( [^>]*)?>(((?!<\1(\s+[^>]*?)?>)[\s\S]|<\1(\s+[^>]*?)?>((?!<\1(\s+[^>]*?)?>)[\s\S])*?<\/\1>)*?)<\/\1>/ig,style2font);//第2层
sHtml = sHtml.replace(/<(span)(\s+[^>]*?)?\s+style\s*=\s*"((?:[^"]*?;)?\s*(?:font-family|font-size|color)\s*:[^"]*)"( [^>]*)?>(((?!<\1(\s+[^>]*?)?>)[\s\S])*?)<\/\1>/ig,style2font);//最里层
}
//表格单元格处理
sHtml = sHtml.replace(/<(td|th)(\s+[^>]*?)?>(\s| )*<\/\1>/ig,'<$1$2>'+(isIE?'':'<br />')+'</$1>');
}
else
{//read
if(isSafari)
{
//转换apple的style为strong,em等
var arrAppleSpan=[{r:/font-weight\s*:\s*bold;?/ig,t:'strong'},{r:/font-style\s*:\s*italic;?/ig,t:'em'},{r:/text-decoration\s*:\s*underline;?/ig,t:'u'},{r:/text-decoration\s*:\s*line-through;?/ig,t:'strike'}];
function replaceAppleSpan(all,tag,attr1,attr2,content)
{
var attr=(attr1?attr1:'')+(attr2?attr2:'');
var arrPre=[],arrAft=[];
var regApple,tagApple;
for(var i=0;i<arrAppleSpan.length;i++)
{
regApple=arrAppleSpan[i].r;
tagApple=arrAppleSpan[i].t;
attr=attr.replace(regApple,function(){
arrPre.push("<"+tagApple+">");
arrAft.push("</"+tagApple+">");
return '';
});
}
attr=attr.replace(/\s+style\s*=\s*"\s*"/i,'');
return (attr?'<span'+attr+'>':'')+arrPre.join('')+content+arrAft.join('')+(attr?'</span>':'');
}
for(var i=0;i<2;i++){
sHtml = sHtml.replace(/<(span)(\s+[^>]*?)?\s+class\s*=\s*"Apple-style-span"(\s+[^>]*?)?>(((?!<\1(\s+[^>]*?)?>)[\s\S]|<\1(\s+[^>]*?)?>((?!<\1(\s+[^>]*?)?>)[\s\S]|<\1(\s+[^>]*?)?>((?!<\1(\s+[^>]*?)?>)[\s\S])*?<\/\1>)*?<\/\1>)*?)<\/\1>/ig,replaceAppleSpan);//第3层
sHtml = sHtml.replace(/<(span)(\s+[^>]*?)?\s+class\s*=\s*"Apple-style-span"(\s+[^>]*?)?>(((?!<\1(\s+[^>]*?)?>)[\s\S]|<\1(\s+[^>]*?)?>((?!<\1(\s+[^>]*?)?>)[\s\S])*?<\/\1>)*?)<\/\1>/ig,replaceAppleSpan);//第2层
sHtml = sHtml.replace(/<(span)(\s+[^>]*?)?\s+class\s*=\s*"Apple-style-span"(\s+[^>]*?)?>(((?!<\1(\s+[^>]*?)?>)[\s\S])*?)<\/\1>/ig,replaceAppleSpan);//最里层
}
}
sHtml=sHtml.replace(/(<(\w+))((?:\s+[\w\-:]+\s*=\s*(?:"[^"]*"|'[^']*'|[^>\s]+))*)\s*(\/?>)/g,function(all,left,tag,attr,right){
tag=tag.toLowerCase();
//恢复属性值src,href
var saveValue;
attr=attr.replace(/\s+_xhe_(?:src|href)\s*=\s*("[^"]*"|'[^']*'|[^>\s]+)/i,function(all,v){saveValue=v.match(/^(["']?)(.*)\1/)[2];return '';});
if(saveValue&&urlType)saveValue=getLocalUrl(saveValue,urlType,urlBase);
attr=attr.replace(/\s+([\w\-:]+)\s*=\s*("[^"]*"|'[^']*'|[^>\s]+)/g,function(all,n,v){
n=n.toLowerCase();
v=v.match(/^(["']?)(.*)\1/)[2].replace(/"/g,"'");
if(n==='class'){//清理class属性
if(v.match(/^["']?(apple|webkit)/i))return '';
v=v.replace(/\s?xhe-[a-z]+/ig,'');
if(v==='')return '';
}
else if(n.match(/^((_xhe_|_moz_|_webkit_)|jquery\d+)/i))return '';//清理临时属性
else if(saveValue&&n.match(/^(src|href)$/i))return ' '+n+'="'+saveValue+'"';//恢复属性值src,href
else if(n==='style'){//转换font-size的keyword到px单位
v=v.replace(/(^|;)\s*(font-size)\s*:\s*([a-z-]+)\s*(;|$)/i,function(all,left,n,v,right){
var t,s;
for(var i=0;i<arrFontsize.length;i++)
{
t=arrFontsize[i];
if(v===t.n){s=t.s;break;}
}
return left+n+':'+s+right;
});
}
return ' '+n+'="'+v+'"';
});
//img强制加alt
if(tag==='img'&&!attr.match(/\s+alt\s*=\s*("[^"]*"|'[^']*'|[^>\s]+)/i))attr+=' alt=""';
return left+attr+right;
});
//表格单元格处理
sHtml = sHtml.replace(/(<(td|th)(?:\s+[^>]*?)?>)\s*([\s\S]*?)(<br(\s*\/)?>)?\s*<\/\2>/ig,function(all,left,tag,content){return left+(content?content:' ')+'</'+tag+'>';});
//修正浏览器在空内容情况下多出来的代码
sHtml=sHtml.replace(/^\s*(?:<(p|div)(?:\s+[^>]*?)?>)?\s*(<span(?:\s+[^>]*?)?>\s*<\/span>|<br(?:\s+[^>]*?)?>| )*\s*(?:<\/\1>)?\s*$/i, '');
}
//写和读innerHTML前pre中<br>转\r\n
sHtml=sHtml.replace(/(<pre(?:\s+[^>]*?)?>)([\s\S]+?)(<\/pre>)/gi,function(all,left,code,right){
return left+code.replace(/<br\s*\/?>/ig,'\r\n')+right;
});
return sHtml;
}
this.getSource=function(bFormat)
{
var sHtml,beforeGetSource=settings.beforeGetSource;
if(bSource)
{
sHtml=$('#sourceCode',_doc).val();
if(!beforeGetSource)sHtml=_this.formatXHTML(sHtml,false);
}
else
{
sHtml=_this.processHTML(_doc.body.innerHTML,'read');
sHtml=_this.cleanHTML(sHtml);
sHtml=_this.formatXHTML(sHtml,bFormat);
if(beforeGetSource)sHtml=beforeGetSource(sHtml);
}
_text.value=sHtml;
return sHtml;
}
this.cleanWord=function(sHtml)
{
var cleanPaste=settings.cleanPaste;
if(cleanPaste>0&&cleanPaste<3&&/mso(-|normal)|WordDocument|<table\s+[^>]*?x:str|\s+class\s*=\s*"?xl[67]\d"/i.test(sHtml))
{
//区块标签清理
sHtml = sHtml.replace(/<!--[\s\S]*?-->|<!(--)?\[[\s\S]+?\](--)?>|<style(\s+[^>]*?)?>[\s\S]*?<\/style>/ig, '');
sHtml = sHtml.replace(/\r?\n/ig, '');
//保留Word图片占位
if(isIE){
sHtml = sHtml.replace(/<v:shapetype(\s+[^>]*)?>[\s\S]*<\/v:shapetype>/ig,'');
sHtml = sHtml.replace(/<v:shape(\s+[^>]+)?>[\s\S]*?<v:imagedata(\s+[^>]+)?>\s*<\/v:imagedata>[\s\S]*?<\/v:shape>/ig,function(all,attr1,attr2){
var match;
match = attr2.match(/\s+src\s*=\s*("[^"]+"|'[^']+'|[^>\s]+)/i);
if(match){
match = match[1].match(/^(["']?)(.*)\1/)[2];
var sImg ='<img src="'+editorRoot+'xheditor_skin/blank.gif'+'" _xhe_temp="true" class="wordImage"';
match = attr1.match(/\s+style\s*=\s*("[^"]+"|'[^']+'|[^>\s]+)/i);
if(match){
match = match[1].match(/^(["']?)(.*)\1/)[2];
sImg += ' style="' + match + '"';
}
sImg += ' />';
return sImg;
}
return '';
});
}
else{
sHtml = sHtml.replace(/<img( [^<>]*(v:shapes|msohtmlclip)[^<>]*)\/?>/ig,function(all,attr){
var match,str = '<img src="'+editorRoot+'xheditor_skin/blank.gif'+'" _xhe_temp="true" class="wordImage"';
match = attr.match(/ width\s*=\s*"([^"]+)"/i);
if(match)str += ' width="'+match[1]+'"';
match = attr.match(/ height\s*=\s*"([^"]+)"/i);
if(match)str += ' height="'+match[1]+'"';
return str + ' />';
});
}
sHtml=sHtml.replace(/(<(\/?)([\w\-:]+))((?:\s+[\w\-:]+(?:\s*=\s*(?:"[^"]*"|'[^']*'|[^>\s]+))?)*)\s*(\/?>)/g,function(all,left,end,tag,attr,right){
tag=tag.toLowerCase();
if((tag.match(/^(link)$/)&&attr.match(/file:\/\//i))||tag.match(/:/)||(tag==='span'&&cleanPaste===2))return '';
if(!end){
attr=attr.replace(/\s([\w\-:]+)(?:\s*=\s*("[^"]*"|'[^']*'|[^>\s]+))?/ig,function(all,n,v){
n=n.toLowerCase();
if(/:/.test(n))return '';
v=v.match(/^(["']?)(.*)\1/)[2];
if(cleanPaste===1){//简单清理
switch(tag){
case 'p':
if(n === 'style'){
v=v.replace(/"|"/ig,"'").replace(/\s*([^:]+)\s*:\s*(.*?)(;|$)/ig,function(all,n,v){
return /^(text-align)$/i.test(n)?(n+':'+v+';'):'';
}).replace(/^\s+|\s+$/g,'');
return v?(' '+n+'="'+v+'"'):'';
}
break;
case 'span':
if(n === 'style'){
v=v.replace(/"|"/ig,"'").replace(/\s*([^:]+)\s*:\s*(.*?)(;|$)/ig,function(all,n,v){
return /^(color|background|font-size|font-family)$/i.test(n)?(n+':'+v+';'):'';
}).replace(/^\s+|\s+$/g,'');
return v?(' '+n+'="'+v+'"'):'';
}
break;
case 'table':
if(n.match(/^(cellspacing|cellpadding|border|width)$/i))return all;
break;
case 'td':
if(n.match(/^(rowspan|colspan)$/i))return all;
if(n === 'style'){
v=v.replace(/"|"/ig,"'").replace(/\s*([^:]+)\s*:\s*(.*?)(;|$)/ig,function(all,n,v){
return /^(width|height)$/i.test(n)?(n+':'+v+';'):'';
}).replace(/^\s+|\s+$/g,'');
return v?(' '+n+'="'+v+'"'):'';
}
break;
case 'a':
if(n.match(/^(href)$/i))return all;
break;
case 'font':
case 'img':
return all;
break;
}
}
else if(cleanPaste===2){
switch(tag){
case 'td':
if(n.match(/^(rowspan|colspan)$/i))return all;
break;
case 'img':
return all;
}
}
return '';
});
}
return left+attr+right;
});
//空内容的标签
for(var i=0;i<3;i++)sHtml = sHtml.replace( /<([^\s>]+)(\s+[^>]*)?>\s*<\/\1>/g,'');
//无属性的无意义标签
function cleanEmptyTag(all,tag,content){
return content;
}
for(var i=0;i<3;i++)sHtml = sHtml.replace(/<(span|a)>(((?!<\1(\s+[^>]*?)?>)[\s\S]|<\1(\s+[^>]*?)?>((?!<\1(\s+[^>]*?)?>)[\s\S]|<\1(\s+[^>]*?)?>((?!<\1(\s+[^>]*?)?>)[\s\S])*?<\/\1>)*?<\/\1>)*?)<\/\1>/ig,cleanEmptyTag);//第3层
for(var i=0;i<3;i++)sHtml = sHtml.replace(/<(span|a)>(((?!<\1(\s+[^>]*?)?>)[\s\S]|<\1(\s+[^>]*?)?>((?!<\1(\s+[^>]*?)?>)[\s\S])*?<\/\1>)*?)<\/\1>/ig,cleanEmptyTag);//第2层
for(var i=0;i<3;i++)sHtml = sHtml.replace(/<(span|a)>(((?!<\1(\s+[^>]*?)?>)[\s\S])*?)<\/\1>/ig,cleanEmptyTag);//最里层
//合并多个font
for(var i=0;i<3;i++)sHtml = sHtml.replace(/<font(\s+[^>]+)><font(\s+[^>]+)>/ig,function(all,attr1,attr2){
return '<font'+attr1+attr2+'>';
});
//清除表格间隙里的空格等特殊字符
sHtml=sHtml.replace(/(<(\/?)(tr|td)(?:\s+[^>]+)?>)[^<>]+/ig,function(all,left,end,tag){
if(!end&&/^td$/i.test(tag))return all;
else return left;
});
}
return sHtml;
}
this.cleanHTML=function(sHtml)
{
sHtml = sHtml.replace(/<!?\/?(DOCTYPE|html|body|meta)(\s+[^>]*?)?>/ig, '');
var arrHeadSave;sHtml = sHtml.replace(/<head(?:\s+[^>]*?)?>([\s\S]*?)<\/head>/i, function(all,content){arrHeadSave=content.match(/<(script|style)(\s+[^>]*?)?>[\s\S]*?<\/\1>/ig);return '';});
if(arrHeadSave)sHtml=arrHeadSave.join('')+sHtml;
sHtml = sHtml.replace(/<\??xml(:\w+)?(\s+[^>]*?)?>([\s\S]*?<\/xml>)?/ig, '');
if(!settings.internalScript)sHtml = sHtml.replace(/<script(\s+[^>]*?)?>[\s\S]*?<\/script>/ig, '');
if(!settings.internalStyle)sHtml = sHtml.replace(/<style(\s+[^>]*?)?>[\s\S]*?<\/style>/ig, '');
if(!settings.linkTag||!settings.inlineScript||!settings.inlineStyle)sHtml=sHtml.replace(/(<(\w+))((?:\s+[\w-]+\s*=\s*(?:"[^"]*"|'[^']*'|[^>\s]+))*)\s*(\/?>)/ig,function(all,left,tag,attr,right){
if(!settings.linkTag&&tag.toLowerCase()==='link')return '';
if(!settings.inlineScript)attr=attr.replace(/\s+on(?:click|dblclick|mouse(down|up|move|over|out|enter|leave|wheel)|key(down|press|up)|change|select|submit|reset|blur|focus|load|unload)\s*=\s*("[^"]*"|'[^']*'|[^>\s]+)/ig,'');
if(!settings.inlineStyle)attr=attr.replace(/\s+(style|class)\s*=\s*("[^"]*"|'[^']*'|[^>\s]+)/ig,'');
return left+attr+right;
});
sHtml=sHtml.replace(/<\/(strong|b|u|strike|em|i)>((?:\s|<br\/?>| )*?)<\1(\s+[^>]*?)?>/ig,'$2');//连续相同标签
return sHtml;
}
this.formatXHTML=function(sHtml,bFormat){
var emptyTags = makeMap("area,base,basefont,br,col,frame,hr,img,input,isindex,link,meta,param,embed");//HTML 4.01
var blockTags = makeMap("address,applet,blockquote,button,center,dd,dir,div,dl,dt,fieldset,form,frameset,h1,h2,h3,h4,h5,h6,hr,iframe,ins,isindex,li,map,menu,noframes,noscript,object,ol,p,pre,table,tbody,td,tfoot,th,thead,tr,ul,script");//HTML 4.01
var inlineTags = makeMap("a,abbr,acronym,applet,b,basefont,bdo,big,br,button,cite,code,del,dfn,em,font,i,iframe,img,input,ins,kbd,label,map,object,q,s,samp,script,select,small,span,strike,strong,sub,sup,textarea,tt,u,var");//HTML 4.01
var closeSelfTags = makeMap("colgroup,dd,dt,li,options,p,td,tfoot,th,thead,tr");
var fillAttrsTags = makeMap("checked,compact,declare,defer,disabled,ismap,multiple,nohref,noresize,noshade,nowrap,readonly,selected");
var cdataTags = makeMap("script,style");
var tagReplac={'b':'strong','i':'em','s':'del','strike':'del'};
var regTag=/<(?:\/([^\s>]+)|!([^>]*?)|([\w\-:]+)((?:"[^"]*"|'[^']*'|[^"'<>])*)\s*(\/?))>/g;
var regAttr = /\s*([\w\-:]+)(?:\s*=\s*(?:"([^"]*)"|'([^']*)'|([^\s]+)))?/g;
var results=[],stack=[];
stack.last = function(){return this[ this.length - 1 ];};
var match,tagIndex,nextIndex=0,tagName,tagCDATA,arrCDATA,text;
var lvl=-1,lastTag='body',lastTagStart,stopFormat=false;
while(match=regTag.exec(sHtml)){
tagIndex = match.index;
if(tagIndex>nextIndex){//保存前面的文本或者CDATA
text=sHtml.substring(nextIndex,tagIndex);
if(tagCDATA)arrCDATA.push(text);
else onText(text);
}
nextIndex = regTag.lastIndex;
if(tagName=match[1]){//结束标签
tagName=processTag(tagName);
if(tagCDATA&&tagName===tagCDATA){//结束标签前输出CDATA
onCDATA(arrCDATA.join(''));
tagCDATA=null;
arrCDATA=null;
}
if(!tagCDATA){
onEndTag(tagName);
continue;
}
}
if(tagCDATA)arrCDATA.push(match[0]);
else{
if(tagName=match[3]){//开始标签
tagName=processTag(tagName);
onStartTag(tagName,match[4],match[5]);
if(cdataTags[tagName]){
tagCDATA=tagName;
arrCDATA=[];
}
}
else if(match[2])onComment(match[0]);//注释标签
}
}
if(sHtml.length>nextIndex)onText(sHtml.substring(nextIndex,sHtml.length ));//结尾文本
onEndTag();//封闭未结束的标签
sHtml=results.join('');
results=null;
function makeMap(str)
{
var obj = {}, items = str.split(",");
for ( var i = 0; i < items.length; i++ )obj[ items[i] ] = true;
return obj;
}
function processTag(tagName)
{
tagName=tagName.toLowerCase();
var tag=tagReplac[tagName];
return tag?tag:tagName;
}
function onStartTag(tagName,rest,unary)
{
if(blockTags[tagName])while(stack.last()&&inlineTags[stack.last()])onEndTag(stack.last());//块标签
if(closeSelfTags[tagName]&&stack.last()===tagName)onEndTag(tagName);//自封闭标签
unary = emptyTags[ tagName ] || !!unary;
if (!unary)stack.push(tagName);
var all=Array();
all.push('<' + tagName);
rest.replace(regAttr, function(match, name)
{
name=name.toLowerCase();
var value = arguments[2] ? arguments[2] :
arguments[3] ? arguments[3] :
arguments[4] ? arguments[4] :
fillAttrsTags[name] ? name : "";
all.push(' '+name+'="'+value.replace(/"/g,"'")+'"');
});
all.push((unary ? " /" : "") + ">");
addHtmlFrag(all.join(''),tagName,true);
if(tagName==='pre')stopFormat=true;
}
function onEndTag(tagName)
{
if(!tagName)var pos=0;//清空栈
else for(var pos=stack.length-1;pos>=0;pos--)if(stack[pos]===tagName)break;//向上寻找匹配的开始标签
if(pos>=0)
{
for(var i=stack.length-1;i>=pos;i--)addHtmlFrag("</" + stack[i] + ">",stack[i]);
stack.length=pos;
}
if(tagName==='pre'){
stopFormat=false;
lvl--;
}
}
function onText(text){
addHtmlFrag(_this.domEncode(text));
}
function onCDATA(text){
results.push(text.replace(/^[\s\r\n]+|[\s\r\n]+$/g,''));
}
function onComment(text){
results.push(text);
}
function addHtmlFrag(html,tagName,bStart)
{
if(!stopFormat)html=html.replace(/(\t*\r?\n\t*)+/g,'');//清理换行符和相邻的制表符
if(!stopFormat&&bFormat===true)
{
if(html.match(/^\s*$/)){//不格式化空内容的标签
results.push(html);
return;
}
var bBlock=blockTags[tagName],tag=bBlock?tagName:'';
if(bBlock)
{
if(bStart)lvl++;//块开始
if(lastTag==='')lvl--;//补文本结束
}
else if(lastTag)lvl++;//文本开始
if(tag!==lastTag||bBlock)addIndent();
results.push(html);
if(tagName==='br')addIndent();//回车强制换行
if(bBlock&&(emptyTags[tagName]||!bStart))lvl--;//块结束
lastTag=bBlock?tagName:'';lastTagStart=bStart;
}
else results.push(html);
}
function addIndent(){results.push('\r\n');if(lvl>0){var tabs=lvl;while(tabs--)results.push("\t");}}
//font转style
function font2style(all,tag,attrs,content)
{
if(!attrs)return content;
var styles='',f,s,c,style;
attrs=attrs.replace(/ face\s*=\s*"\s*([^"]*)\s*"/i,function(all,v){
if(v)styles+='font-family:'+v+';';
return '';
});
attrs=attrs.replace(/ size\s*=\s*"\s*(\d+)\s*"/i,function(all,v){
styles+='font-size:'+arrFontsize[(v>7?7:(v<1?1:v))-1].s+';';
return '';
});
attrs=attrs.replace(/ color\s*=\s*"\s*([^"]*)\s*"/i,function(all,v){
if(v)styles+='color:'+v+';';
return '';
});
attrs=attrs.replace(/ style\s*=\s*"\s*([^"]*)\s*"/i,function(all,v){
if(v)styles+=v;
return '';
});
attrs+=' style="'+styles+'"';
return attrs?('<span'+attrs+'>'+content+'</span>'):content;
}
sHtml = sHtml.replace(/<(font)(\s+[^>]*?)?>(((?!<\1(\s+[^>]*?)?>)[\s\S]|<\1(\s+[^>]*?)?>((?!<\1(\s+[^>]*?)?>)[\s\S]|<\1(\s+[^>]*?)?>((?!<\1(\s+[^>]*?)?>)[\s\S])*?<\/\1>)*?<\/\1>)*?)<\/\1>/ig,font2style);//第3层
sHtml = sHtml.replace(/<(font)(\s+[^>]*?)?>(((?!<\1(\s+[^>]*?)?>)[\s\S]|<\1(\s+[^>]*?)?>((?!<\1(\s+[^>]*?)?>)[\s\S])*?<\/\1>)*?)<\/\1>/ig,font2style);//第2层
sHtml = sHtml.replace(/<(font)(\s+[^>]*?)?>(((?!<\1(\s+[^>]*?)?>)[\s\S])*?)<\/\1>/ig,font2style);//最里层
sHtml = sHtml.replace(/^(\s*\r?\n)+|(\s*\r?\n)+$/g,'');//清理首尾换行
return sHtml;
}
this.toggleShowBlocktag=function(state)
{
if(bShowBlocktag===state)return;
bShowBlocktag=!bShowBlocktag;
var _jBody=$(_doc.body);
if(bShowBlocktag)
{
bodyClass+=' showBlocktag';
_jBody.addClass('showBlocktag');
}
else
{
bodyClass=bodyClass.replace(' showBlocktag','');
_jBody.removeClass('showBlocktag');
}
}
this.toggleSource=function(state)
{
if(bSource===state)return;
_jTools.find('[cmd=Source]').toggleClass('xheEnabled').toggleClass('xheActive');
var _body=_doc.body,jBody=$(_body),sHtml;
var sourceCode,cursorMark='<span id="_xhe_cursor"></span>',cursorPos=0;
var txtSourceTitle='';
if(!bSource)
{//转为源代码模式
_this.pasteHTML(cursorMark,true);//标记当前位置
sHtml=_this.getSource(true);
cursorPos=sHtml.indexOf(cursorMark);
if(!isOpera)cursorPos=sHtml.substring(0,cursorPos).replace(/\r/g,'').length;//修正非opera光标定位点
sHtml=sHtml.replace(/(\r?\n\s*|)<span id="_xhe_cursor"><\/span>(\s*\r?\n|)/,function(all,left,right){
return left&&right?'\r\n':left+right;//只有定位符的空行删除当前行
});
if(isIE)_body.contentEditable='false';
else _doc.designMode = 'Off';
jBody.attr('scroll','no').attr('class','sourceMode').html('<textarea id="sourceCode" wrap="soft" spellcheck="false" style="width:100%;height:100%" />');
sourceCode=$('#sourceCode',jBody).blur(_this.getSource)[0];
txtSourceTitle='可视化编辑';
}
else
{//转为编辑模式
sHtml=_this.getSource();
jBody.html('').removeAttr('scroll').attr('class','editMode'+bodyClass);
if(isIE)_body.contentEditable='true';
else _doc.designMode = 'On';
if(isMozilla)
{
_this._exec("inserthtml","-");//修正firefox源代码切换回来无法删除文字的问题
$('#'+idFixFFCursor).show().focus().hide();//临时修正Firefox 3.6光标丢失问题
}
txtSourceTitle='源代码';
}
bSource=!bSource;
_this.setSource(sHtml);
_this.focus();
if(bSource)//光标定位源码
{
if(sourceCode.setSelectionRange)sourceCode.setSelectionRange(cursorPos, cursorPos);
else
{
var rng = sourceCode.createTextRange();
rng.move("character",cursorPos);
rng.select();
}
}
else _this.setTextCursor();//定位最前面
_jTools.find('[cmd=Source]').attr('title',txtSourceTitle).find('span').text(txtSourceTitle);
_jTools.find('[cmd=Source],[cmd=Preview]').toggleClass('xheEnabled');
_jTools.find('.xheButton').not('[cmd=Source],[cmd=Fullscreen],[cmd=About]').toggleClass('xheEnabled').attr('aria-disabled',bSource?true:false);//无障碍支持
setTimeout(setOpts,300);
}
this.showPreview=function()
{
var beforeSetSource=settings.beforeSetSource,sContent=_this.getSource();
if(beforeSetSource)sContent=beforeSetSource(sContent);
var sHTML='<html><head>'+headHTML+'<title>预览</title>'+(urlBase?'<base href="'+urlBase+'"/>':'')+'</head><body>' + sContent + '</body></html>';
var screen=window.screen,oWindow=window.open('', 'xhePreview', 'toolbar=yes,location=no,status=yes,menubar=yes,scrollbars=yes,resizable=yes,width='+Math.round(screen.width*0.9)+',height='+Math.round(screen.height*0.8)+',left='+Math.round(screen.width*0.05)),oDoc=oWindow.document;
oDoc.open();
oDoc.write(sHTML);
oDoc.close();
oWindow.focus();
}
this.toggleFullscreen=function(state)
{
if(bFullscreen===state)return;
var jLayout=$('#'+idContainer).find('.xheLayout'),jContainer=$('#'+idContainer),browserVer=jQuery.browser.version,isIE67=(isIE&&(browserVer==6||browserVer==7));
if(bFullscreen)
{//取消全屏
if(isIE67)_jText.after(jContainer);
jLayout.attr('style',sLayoutStyle);
_jArea.height(editorHeight-_jTools.outerHeight());
$(window).scrollTop(outerScroll);
setTimeout(function(){$(window).scrollTop(outerScroll);},10);//Firefox需要延迟设置
}
else
{//显示全屏
if(isIE67)$('body').append(jContainer);
outerScroll=$(window).scrollTop();
sLayoutStyle=jLayout.attr('style');
jLayout.removeAttr('style');
_jArea.height('100%');
setTimeout(fixFullHeight,100);
}
if(isMozilla)//临时修正Firefox 3.6源代码光标丢失问题
{
$('#'+idFixFFCursor).show().focus().hide();
setTimeout(_this.focus,1);
}
else if(isIE67)_this.setTextCursor();
bFullscreen=!bFullscreen;
jContainer.toggleClass('xhe_Fullscreen');
$('html').toggleClass('xhe_Fullfix');
_jTools.find('[cmd=Fullscreen]').toggleClass('xheActive');
setTimeout(setOpts,300);
}
this.showMenu=function(menuitems,callback)
{
var jMenu=$('<div class="xheMenu"></div>'),menuSize=menuitems.length,arrItem=[];
$.each(menuitems,function(n,v){
if(v.s==='-'){
arrItem.push('<div class="xheMenuSeparator"></div>');
}else{
arrItem.push('<a href="javascript:void(\''+v.v+'\')" title="'+(v.t?v.t:v.s)+'" v="'+v.v+'" role="option" aria-setsize="'+menuSize+'" aria-posinset="'+(n+1)+'" tabindex="0">'+v.s+'</a>');
}
});
jMenu.append(arrItem.join(''));
jMenu.click(function(ev){
ev=ev.target;
if($.nodeName(ev,'DIV'))return;
_this.loadBookmark();
callback($(ev).closest('a').attr('v'));
_this.hidePanel();
return false;
}).mousedown(returnFalse);
_this.saveBookmark();
_this.showPanel(jMenu);
}
this.showColor=function(callback)
{
var jColor=$('<div class="xheColor"></div>'),arrItem=[],colorSize=itemColors.length,count=0;
$.each(itemColors,function(n,v)
{
if(count%7===0)arrItem.push((count>0?'</div>':'')+'<div>');
arrItem.push('<a href="javascript:void(\''+v+'\')" xhev="'+v+'" title="'+v+'" style="background:'+v+'" role="option" aria-setsize="'+colorSize+'" aria-posinset="'+(count+1)+'"></a>');
count++;
});
arrItem.push('</div>');
jColor.append(arrItem.join(''));
jColor.click(function(ev){
ev=ev.target;
if(!$.nodeName(ev,'A'))return;
_this.loadBookmark();
callback($(ev).attr('xhev'));
_this.hidePanel();
return false;
}).mousedown(returnFalse);
_this.saveBookmark();
_this.showPanel(jColor);
}
this.showPastetext=function()
{
var jPastetext=$(htmlPastetext),jValue=$('#xhePastetextValue',jPastetext),jSave=$('#xheSave',jPastetext);
jSave.click(function(){
_this.loadBookmark();
var sValue=jValue.val();
if(sValue)_this.pasteText(sValue);
_this.hidePanel();
return false;
});
_this.saveBookmark();
_this.showDialog(jPastetext);
}
this.showLink=function()
{
var htmlTemp=htmlLink,$arrAnchor=_jDoc.find('a[name]').not('[href]'),haveAnchor=$arrAnchor.length>0;
if(haveAnchor){//页内有锚点
var arrAnchorOptions=[];
$arrAnchor.each(function(){
var name=$(this).attr('name');
arrAnchorOptions.push('<option value="#'+name+'">'+name+'</option>');
});
htmlTemp=htmlTemp.replace(/(<div><label for="xheLinkTarget)/,'<div><label for="xheLinkAnchor">页内锚点: </label><select id="xheLinkAnchor"><option value="">未选择</option>'+arrAnchorOptions.join('')+'</select></div>$1');
}
var jLink=$(htmlTemp),jParent=_this.getParent('a'),jText=$('#xheLinkText',jLink),jUrl=$('#xheLinkUrl',jLink),jTarget=$('#xheLinkTarget',jLink),jSave=$('#xheSave',jLink),selHtml=_this.getSelect();
if(haveAnchor){
jLink.find('#xheLinkAnchor').change(function(){
var anchor=$(this).val();
if(anchor!='')jUrl.val(anchor);
});
}
if(jParent.length===1)
{
if(!jParent.attr('href')){//锚点
ev=null;
return _this.exec('Anchor');
}
jUrl.val(xheAttr(jParent,'href'));
jTarget.attr('value',jParent.attr('target'));
}
else if(selHtml==='')jText.val(settings.defLinkText).closest('div').show();
if(settings.upLinkUrl)_this.uploadInit(jUrl,settings.upLinkUrl,settings.upLinkExt);
jSave.click(function(){
_this.loadBookmark();
var url=jUrl.val();
if(url===''||jParent.length===0)_this._exec('unlink');
if(url!==''&&url!=='http://')
{
var aUrl=url.split(' '),sTarget=jTarget.val(),sText=jText.val();
if(aUrl.length>1)
{//批量插入
_this._exec('unlink');//批量前删除当前链接并重新获取选择内容
selHtml=_this.getSelect();
var sTemplate='<a href="xhe_tmpurl"',sLink,arrLink=[];
if(sTarget!=='')sTemplate+=' target="'+sTarget+'"';
sTemplate+='>xhe_tmptext</a>';
sText=(selHtml!==''?selHtml:(sText?sText:url));
for(var i=0,c=aUrl.length;i<c;i++)
{
url=aUrl[i];
if(url!=='')
{
url=url.split('||');
sLink=sTemplate;
sLink=sLink.replace('xhe_tmpurl',url[0]);
sLink=sLink.replace('xhe_tmptext',url[1]?url[1]:sText);
arrLink.push(sLink);
}
}
_this.pasteHTML(arrLink.join(' '));
}
else
{//单url模式
url=aUrl[0].split('||');
if(!sText)sText=url[0];
sText=url[1]?url[1]:(selHtml!=='')?'':sText?sText:url[0];
if(jParent.length===0)
{
if(sText)_this.pasteHTML('<a href="#xhe_tmpurl">'+sText+'</a>');
else _this._exec('createlink','#xhe_tmpurl');
jParent=$('a[href$="#xhe_tmpurl"]',_doc);
}
else if(sText&&!isSafari)jParent.text(sText);//safari改写文本会导致光标丢失
xheAttr(jParent,'href',url[0]);
if(sTarget!=='')jParent.attr('target',sTarget);
else jParent.removeAttr('target');
}
}
_this.hidePanel();
return false;
});
_this.saveBookmark();
_this.showDialog(jLink);
}
this.showAnchor=function(){
var jAnchor=$(htmlAnchor),jParent=_this.getParent('a'),jName=$('#xheAnchorName',jAnchor),jSave=$('#xheSave',jAnchor);
if(jParent.length===1){
if(jParent.attr('href')){//超链接
ev=null;
return _this.exec('Link');
}
jName.val(jParent.attr('name'));
}
jSave.click(function(){
_this.loadBookmark();
var name=jName.val();
if(name){
if(jParent.length===0)_this.pasteHTML('<a name="'+name+'"></a>');
else jParent.attr('name',name);
}
else if(jParent.length===1)jParent.remove();
_this.hidePanel();
return false;
});
_this.saveBookmark();
_this.showDialog(jAnchor);
}
this.showImg=function()
{
var jImg=$(htmlImg),jParent=_this.getParent('img'),jUrl=$('#xheImgUrl',jImg),jAlt=$('#xheImgAlt',jImg),jAlign=$('#xheImgAlign',jImg),jWidth=$('#xheImgWidth',jImg),jHeight=$('#xheImgHeight',jImg),jBorder=$('#xheImgBorder',jImg),jVspace=$('#xheImgVspace',jImg),jHspace=$('#xheImgHspace',jImg),jSave=$('#xheSave',jImg);
if(jParent.length===1)
{
jUrl.val(xheAttr(jParent,'src'));
jAlt.val(jParent.attr('alt'));
jAlign.val(jParent.attr('align'));
jWidth.val(jParent.attr('width'));
jHeight.val(jParent.attr('height'));
jBorder.val(jParent.attr('border'));
var vspace=jParent.attr('vspace'),hspace=jParent.attr('hspace');
jVspace.val(vspace<=0?'':vspace);
jHspace.val(hspace<=0?'':hspace);
}
if(settings.upImgUrl)_this.uploadInit(jUrl,settings.upImgUrl,settings.upImgExt);
jSave.click(function(){
_this.loadBookmark();
var url=jUrl.val();
if(url!==''&&url!=='http://')
{
var aUrl=url.split(' '),sAlt=jAlt.val(),sAlign=jAlign.val(),sWidth=jWidth.val(),sHeight=jHeight.val(),sBorder=jBorder.val(),sVspace=jVspace.val(),sHspace=jHspace.val();;
if(aUrl.length>1)
{//批量插入
var sTemplate='<img src="xhe_tmpurl"',sImg,arrImg=[];
if(sAlt!=='')sTemplate+=' alt="'+sAlt+'"';
if(sAlign!=='')sTemplate+=' align="'+sAlign+'"';
if(sWidth!=='')sTemplate+=' width="'+sWidth+'"';
if(sHeight!=='')sTemplate+=' height="'+sHeight+'"';
if(sBorder!=='')sTemplate+=' border="'+sBorder+'"';
if(sVspace!=='')sTemplate+=' vspace="'+sVspace+'"';
if(sHspace!=='')sTemplate+=' hspace="'+sHspace+'"';
sTemplate+=' />';
for(var i in aUrl)
{
url=aUrl[i];
if(url!=='')
{
url=url.split('||');
sImg=sTemplate;
sImg=sImg.replace('xhe_tmpurl',url[0]);
if(url[1])sImg='<a href="'+url[1]+'" target="_blank">'+sImg+'</a>'
arrImg.push(sImg);
}
}
_this.pasteHTML(arrImg.join(' '));
}
else if(aUrl.length===1)
{//单URL模式
url=aUrl[0];
if(url!=='')
{
url=url.split('||');
if(jParent.length===0)
{
_this.pasteHTML('<img src="'+url[0]+'#xhe_tmpurl" />');
jParent=$('img[src$="#xhe_tmpurl"]',_doc);
}
xheAttr(jParent,'src',url[0]);
if(sAlt!=='')jParent.attr('alt',sAlt);
if(sAlign!=='')jParent.attr('align',sAlign);
else jParent.removeAttr('align');
if(sWidth!=='')jParent.attr('width',sWidth);
else jParent.removeAttr('width');
if(sHeight!=='')jParent.attr('height',sHeight);
else jParent.removeAttr('height');
if(sBorder!=='')jParent.attr('border',sBorder);
else jParent.removeAttr('border');
if(sVspace!=='')jParent.attr('vspace',sVspace);
else jParent.removeAttr('vspace');
if(sHspace!=='')jParent.attr('hspace',sHspace);
else jParent.removeAttr('hspace');
if(url[1])
{
var jLink=jParent.parent('a');
if(jLink.length===0)
{
jParent.wrap('<a></a>');
jLink=jParent.parent('a');
}
xheAttr(jLink,'href',url[1]);
jLink.attr('target','_blank');
}
}
}
}
else if(jParent.length===1)jParent.remove();
_this.hidePanel();
return false;
});
_this.saveBookmark();
_this.showDialog(jImg);
}
this.showEmbed=function(sType,sHtml,sMime,sClsID,sBaseAttrs,sUploadUrl,sUploadExt)
{
var jEmbed=$(sHtml),jParent=_this.getParent('embed[type="'+sMime+'"],embed[classid="'+sClsID+'"]'),jUrl=$('#xhe'+sType+'Url',jEmbed),jWidth=$('#xhe'+sType+'Width',jEmbed),jHeight=$('#xhe'+sType+'Height',jEmbed),jSave=$('#xheSave',jEmbed);
if(sUploadUrl)_this.uploadInit(jUrl,sUploadUrl,sUploadExt);
if(jParent.length===1)
{
jUrl.val(xheAttr(jParent,'src'));
jWidth.val(jParent.attr('width'));
jHeight.val(jParent.attr('height'));
}
jSave.click(function(){
_this.loadBookmark();
var url=jUrl.val();
if(url!==''&&url!=='http://')
{
var w=jWidth.val(),h=jHeight.val(),reg=/^\d+%?$/;
if(!reg.test(w))w=412;if(!reg.test(h))h=300;
var sBaseCode='<embed type="'+sMime+'" classid="'+sClsID+'" src="xhe_tmpurl"'+sBaseAttrs;
var aUrl=url.split(' ');
if(aUrl.length>1)
{//批量插入
var sTemplate=sBaseCode+'',sEmbed,arrEmbed=[];
sTemplate+=' width="xhe_width" height="xhe_height" />';
for(var i in aUrl)
{
url=aUrl[i].split('||');
sEmbed=sTemplate;
sEmbed=sEmbed.replace('xhe_tmpurl',url[0])
sEmbed=sEmbed.replace('xhe_width',url[1]?url[1]:w)
sEmbed=sEmbed.replace('xhe_height',url[2]?url[2]:h)
if(url!=='')arrEmbed.push(sEmbed);
}
_this.pasteHTML(arrEmbed.join(' '));
}
else if(aUrl.length===1)
{//单URL模式
url=aUrl[0].split('||');
if(jParent.length===0)
{
_this.pasteHTML(sBaseCode.replace('xhe_tmpurl',url[0]+'#xhe_tmpurl')+' />');
jParent=$('embed[src$="#xhe_tmpurl"]',_doc);
}
xheAttr(jParent,'src',url[0]);
jParent.attr('width',url[1]?url[1]:w);
jParent.attr('height',url[2]?url[2]:h);
}
}
else if(jParent.length===1)jParent.remove();
_this.hidePanel();
return false;
});
_this.saveBookmark();
_this.showDialog(jEmbed);
}
this.showEmot=function(group)
{
var jEmot=$('<div class="xheEmot"></div>');
group=group?group:(selEmotGroup?selEmotGroup:'default');
var arrEmot=arrEmots[group];
var sEmotPath=emotPath+group+'/',n=0,arrList=[],jList='';
var ew=arrEmot.width,eh=arrEmot.height,line=arrEmot.line,count=arrEmot.count,list=arrEmot.list;
if(count)
{
for(var i=1;i<=count;i++)
{
n++;
arrList.push('<a href="javascript:void(\''+i+'\')" style="background-image:url('+sEmotPath+i+'.gif);" emot="'+group+','+i+'" xhev="" title="'+i+'" role="option"> </a>');
if(n%line===0)arrList.push('<br />');
}
}
else
{
$.each(list,function(id,title)
{
n++;
arrList.push('<a href="javascript:void(\''+title+'\')" style="background-image:url('+sEmotPath+id+'.gif);" emot="'+group+','+id+'" title="'+title+'" xhev="'+title+'" role="option"> </a>');
if(n%line===0)arrList.push('<br />');
});
}
var w=line*(ew+12),h=Math.ceil(n/line)*(eh+12),mh=w*0.75;
if(h<=mh)mh='';
jList=$('<style>'+(mh?'.xheEmot div{width:'+(w+20)+'px;height:'+mh+'px;}':'')+'.xheEmot div a{width:'+ew+'px;height:'+eh+'px;}</style><div>'+arrList.join('')+'</div>').click(function(ev){ev=ev.target;var jA=$(ev);if(!$.nodeName(ev,'A'))return;_this.loadBookmark();_this.pasteHTML('<img emot="'+jA.attr('emot')+'" alt="'+jA.attr('xhev')+'">');_this.hidePanel();return false;}).mousedown(returnFalse);
jEmot.append(jList);
var gcount=0,arrGroup=['<ul role="tablist">'],jGroup;//表情分类
$.each(arrEmots,function(g,v){
gcount++;
arrGroup.push('<li'+(group===g?' class="cur"':'')+' role="presentation"><a href="javascript:void(\''+v.name+'\')" group="'+g+'" role="tab" tabindex="0">'+v.name+'</a></li>');
});
if(gcount>1)
{
arrGroup.push('</ul><br style="clear:both;" />');
jGroup=$(arrGroup.join('')).click(function(ev){selEmotGroup=$(ev.target).attr('group');_this.exec('Emot');return false;}).mousedown(returnFalse);
jEmot.append(jGroup);
}
_this.saveBookmark();
_this.showPanel(jEmot);
}
this.showTable=function()
{
var jTable=$(htmlTable),jRows=$('#xheTableRows',jTable),jColumns=$('#xheTableColumns',jTable),jHeaders=$('#xheTableHeaders',jTable),jWidth=$('#xheTableWidth',jTable),jHeight=$('#xheTableHeight',jTable),jBorder=$('#xheTableBorder',jTable),jCellSpacing=$('#xheTableCellSpacing',jTable),jCellPadding=$('#xheTableCellPadding',jTable),jAlign=$('#xheTableAlign',jTable),jCaption=$('#xheTableCaption',jTable),jSave=$('#xheSave',jTable);
jSave.click(function(){
_this.loadBookmark();
var sCaption=jCaption.val(),sBorder=jBorder.val(),sRows=jRows.val(),sCols=jColumns.val(),sHeaders=jHeaders.val(),sWidth=jWidth.val(),sHeight=jHeight.val(),sCellSpacing=jCellSpacing.val(),sCellPadding=jCellPadding.val(),sAlign=jAlign.val();
var i,j,htmlTable='<table'+(sBorder!==''?' border="'+sBorder+'"':'')+(sWidth!==''?' width="'+sWidth+'"':'')+(sHeight!==''?' height="'+sHeight+'"':'')+(sCellSpacing!==''?' cellspacing="'+sCellSpacing+'"':'')+(sCellPadding!==''?' cellpadding="'+sCellPadding+'"':'')+(sAlign!==''?' align="'+sAlign+'"':'')+'>';
if(sCaption!=='')htmlTable+='<caption>'+sCaption+'</caption>';
if(sHeaders==='row'||sHeaders==='both')
{
htmlTable+='<tr>';
for(i=0;i<sCols;i++)htmlTable+='<th scope="col"></th>';
htmlTable+='</tr>';
sRows--;
}
htmlTable+='<tbody>';
for(i=0;i<sRows;i++)
{
htmlTable+='<tr>';
for(j=0;j<sCols;j++)
{
if(j===0&&(sHeaders==='col'||sHeaders==='both'))htmlTable+='<th scope="row"></th>';
else htmlTable+='<td></td>';
}
htmlTable+='</tr>';
}
htmlTable+='</tbody></table>';
_this.pasteHTML(htmlTable);
_this.hidePanel();
return false;
});
_this.saveBookmark();
_this.showDialog(jTable);
}
this.showAbout=function()
{
var jAbout=$(htmlAbout);
jAbout.find('p').attr('role','presentation');//无障碍支持
_this.showDialog(jAbout,true);
setTimeout(function(){jAbout.focus();},100);
}
this.addShortcuts=function(key,cmd)
{
key=key.toLowerCase();
if(arrShortCuts[key]===undefined)arrShortCuts[key]=Array();
arrShortCuts[key].push(cmd);
}
this.delShortcuts=function(key){delete arrShortCuts[key];}
this.uploadInit=function(jText,toUrl,upext)
{
var jUpload=$('<span class="xheUpload"><input type="text" style="visibility:hidden;" tabindex="-1" /><input type="button" value="'+settings.upBtnText+'" class="xheBtn" tabindex="-1" /></span>'),jUpBtn=$('.xheBtn',jUpload);
var bHtml5Upload=settings.html5Upload,upMultiple=bHtml5Upload?settings.upMultiple:1;
jText.after(jUpload);jUpBtn.before(jText);
toUrl=toUrl.replace(/{editorRoot}/ig,editorRoot);
if(toUrl.substr(0,1)==='!')//自定义上传管理页
{
jUpBtn.click(function(){_this.showIframeModal('上传文件',toUrl.substr(1),setUploadMsg,null,null);});
}
else
{//系统默认ajax上传
jUpload.append('<input type="file"'+(upMultiple>1?' multiple=""':'')+' class="xheFile" size="13" name="'+uploadInputname+'" tabindex="-1" />');
var jFile=$('.xheFile',jUpload),arrMsg;
jFile.change(function(){arrMsg=[];_this.startUpload(jFile[0],toUrl,upext,setUploadMsg);});
setTimeout(function(){//拖放上传
jText.closest('.xheDialog').bind('dragenter dragover',returnFalse).bind('drop',function(ev){
var dataTransfer=ev.originalEvent.dataTransfer,fileList;
if(bHtml5Upload&&dataTransfer&&(fileList=dataTransfer.files)&&fileList.length>0)_this.startUpload(fileList,toUrl,upext,setUploadMsg);
return false;
});
},10);
}
function setUploadMsg(arrMsg)
{
if(is(arrMsg,'string'))arrMsg=[arrMsg];//允许单URL传递
var bImmediate=false,i,count=arrMsg.length,msg,url,arrUrl=[],onUpload=settings.onUpload;
if(onUpload)onUpload(arrMsg);//用户上传回调
for(i=0;i<count;i++)
{
msg=arrMsg[i];
url=is(msg,'string')?msg:msg.url;
if(url.substr(0,1)==='!'){bImmediate=true;url=url.substr(1);}
arrUrl.push(url);
}
jText.val(arrUrl.join(' '));
if(bImmediate)jText.closest('.xheDialog').find('#xheSave').click();
}
}
this.startUpload=function(fromFiles,toUrl,limitExt,onUploadComplete)
{
var arrMsg=[],bHtml5Upload=settings.html5Upload,upMultiple=bHtml5Upload?settings.upMultiple:1;
var upload,fileList,filename,jUploadTip=$('<div style="padding:22px 0;text-align:center;line-height:30px;">文件上传中,请稍候……<br /></div>'),sLoading='<img src="'+skinPath+'img/loading.gif">';
if(isOpera||!bHtml5Upload||(fromFiles.nodeType&&!((fileList=fromFiles.files)&&fileList[0].name)))
{
if(!checkFileExt(fromFiles.value,limitExt))return;
jUploadTip.append(sLoading);
upload=new _this.html4Upload(fromFiles,toUrl,onUploadCallback);
}
else
{
if(!fileList)fileList=fromFiles;//拖放文件列表
var i,len=fileList.length;
if(len>upMultiple){
alert('请不要一次上传超过'+upMultiple+'个文件');
return;
}
for(i=0;i<len;i++)if(!checkFileExt(fileList[i].name,limitExt))return;
var jProgress=$('<div class="xheProgress"><div><span>0%</span></div></div>');
jUploadTip.append(jProgress);
upload=new _this.html5Upload(uploadInputname,fileList,toUrl,onUploadCallback,function(ev){
if(ev.loaded>=0)
{
var sPercent=Math.round((ev.loaded * 100) / ev.total)+'%';
$('div',jProgress).css('width',sPercent);
$('span',jProgress).text(sPercent+' ( '+formatBytes(ev.loaded)+' / '+formatBytes(ev.total)+' )');
}
else jProgress.replaceWith(sLoading);//不支持进度
});
}
_this.showModal('文件上传中(Esc取消上传)',jUploadTip,320,150);
upload.start();
function onUploadCallback(sText,bFinish)
{
var data=Object,bOK=false;
try{data=eval('('+sText+')');}catch(ex){};
if(data.err===undefined||data.msg===undefined)alert(toUrl+' 上传接口发生错误!\r\n\r\n返回的错误内容为: \r\n\r\n'+sText);
else
{
if(data.err)alert(data.err);
else
{
arrMsg.push(data.msg);
bOK=true;//继续下一个文件上传
}
}
if(!bOK||bFinish)_this.removeModal();
if(bFinish&&bOK)onUploadComplete(arrMsg);//全部上传完成
return bOK;
}
}
this.html4Upload=function(fromfile,toUrl,callback)
{
var uid = new Date().getTime(),idIO='jUploadFrame'+uid,_this=this;
var jIO=$('<iframe name="'+idIO+'" class="xheHideArea" />').appendTo('body');
var jForm=$('<form action="'+toUrl+'" target="'+idIO+'" method="post" enctype="multipart/form-data" class="xheHideArea"></form>').appendTo('body');
var jOldFile = $(fromfile),jNewFile = jOldFile.clone().attr('disabled','true');
jOldFile.before(jNewFile).appendTo(jForm);
this.remove=function()
{
if(_this!==null)
{
jNewFile.before(jOldFile).remove();
jIO.remove();jForm.remove();
_this=null;
}
}
this.onLoad=function(){
var ifmDoc=jIO[0].contentWindow.document,result=$(ifmDoc.body).text();
ifmDoc.write('');
_this.remove();
callback(result,true);
}
this.start=function(){jForm.submit();jIO.load(_this.onLoad);}
return this;
}
this.html5Upload=function(inputname,fromFiles,toUrl,callback,onProgress)
{
var xhr,i=0,count=fromFiles.length,allLoaded=0,allSize=0,_this=this;
for(var j=0;j<count;j++)allSize+=fromFiles[j].size;
this.remove=function(){if(xhr){xhr.abort();xhr=null;}}
this.uploadNext=function(sText)
{
if(sText)//当前文件上传完成
{
allLoaded+=fromFiles[i-1].size;
returnProgress(0);
}
if((!sText||(sText&&callback(sText,i===count)===true))&&i<count)postFile(fromFiles[i++],toUrl,_this.uploadNext,function(loaded){returnProgress(loaded);});
}
this.start=function(){_this.uploadNext();}
function postFile(fromfile,toUrl,callback,onProgress)
{
xhr = new XMLHttpRequest(),upload=xhr.upload;
xhr.onreadystatechange=function(){
if(xhr.readyState===4)callback(xhr.responseText);
};
if(upload)upload.onprogress=function(ev){
onProgress(ev.loaded);
};
else onProgress(-1);//不支持进度
xhr.open("POST", toUrl);
xhr.setRequestHeader('Content-Type', 'application/octet-stream');
xhr.setRequestHeader('Content-Disposition', 'attachment; name="'+encodeURIComponent(inputname)+'"; filename="'+encodeURIComponent(fromfile.name)+'"');
if(xhr.sendAsBinary&&fromfile.getAsBinary)xhr.sendAsBinary(fromfile.getAsBinary());
else xhr.send(fromfile);
}
function returnProgress(loaded){
if(onProgress)onProgress({'loaded':allLoaded+loaded,'total':allSize});
}
}
this.showIframeModal=function(title,url,callback,w,h,onRemove)
{
var jContent=$('<iframe frameborder="0" src="'+url.replace(/{editorRoot}/ig,editorRoot)+(/\?/.test(url)?'&':'?')+'parenthost='+location.host+'" style="width:100%;height:100%;display:none;" /><div class="xheModalIfmWait"></div>'),jIframe=jContent.eq(0),jWait=jContent.eq(1);
_this.showModal(title,jContent,w,h,onRemove);
var modalWin=jIframe[0].contentWindow,result;
initModalWin();
jIframe.load(function(){
initModalWin();//初始化接口
if(result){//跨域,取返回值
var bResult=true;
try{
result=eval('('+unescape(result)+')');
}
catch(e){
bResult=false;
}
if(bResult)return callbackModal(result);
}
if(jWait.is(':visible')){//显示内页
jIframe.show().focus();
jWait.remove();
}
});
//初始化接口
function initModalWin(){
try{
modalWin.callback=callbackModal;
modalWin.unloadme=_this.removeModal;
$(modalWin.document).keydown(checkEsc);
result=modalWin.name;
}
catch(ex){}
}
//模式窗口回调
function callbackModal(v){
modalWin.document.write('');
_this.removeModal();
if(v!=null)callback(v);
}
}
this.showModal=function(title,content,w,h,onRemove)
{
if(bShowModal)return false;//只能弹出一个模式窗口
_this.panelState=bShowPanel;
bShowPanel=false;//防止按钮面板被关闭
layerShadow=settings.layerShadow;
w=w?w:settings.modalWidth;h=h?h:settings.modalHeight;
jModal=$('<div class="xheModal" style="width:'+(w-1)+'px;height:'+h+'px;margin-left:-'+Math.ceil(w/2)+'px;'+(isIE&&browerVer<7.0?'':'margin-top:-'+Math.ceil(h/2)+'px')+'">'+(settings.modalTitle?'<div class="xheModalTitle"><span class="xheModalClose" title="关闭 (Esc)" tabindex="0" role="button"></span>'+title+'</div>':'')+'<div class="xheModalContent"></div></div>').appendTo('body');
jOverlay=$('<div class="xheModalOverlay"></div>').appendTo('body');
if(layerShadow>0)jModalShadow=$('<div class="xheModalShadow" style="width:'+jModal.outerWidth()+'px;height:'+jModal.outerHeight()+'px;margin-left:-'+(Math.ceil(w/2)-layerShadow-2)+'px;'+(isIE&&browerVer<7.0?'':'margin-top:-'+(Math.ceil(h/2)-layerShadow-2)+'px')+'"></div>').appendTo('body');
$('.xheModalContent',jModal).css('height',h-(settings.modalTitle?$('.xheModalTitle').outerHeight():0)).html(content);
if(isIE&&browerVer===6.0)jHideSelect=$('select:visible').css('visibility','hidden');//隐藏覆盖的select
$('.xheModalClose',jModal).click(_this.removeModal);
jOverlay.show();
if(layerShadow>0)jModalShadow.show();
jModal.show();
setTimeout(function(){jModal.find('a,input[type=text],textarea').filter(':visible').filter(function(){return $(this).css('visibility')!=='hidden';}).eq(0).focus();},10);//定位首个可见输入表单项,延迟解决opera无法设置焦点
bShowModal=true;
onModalRemove=onRemove;
}
this.removeModal=function(){
if(jHideSelect)jHideSelect.css('visibility','visible');
jModal.html('').remove();
if(layerShadow>0)jModalShadow.remove();
jOverlay.remove();
if(onModalRemove)onModalRemove();
bShowModal=false;
bShowPanel=_this.panelState;
};
this.showDialog=function(content,bNoFocus)
{
var jDialog=$('<div class="xheDialog"></div>'),jContent=$(content),jSave=$('#xheSave',jContent);
if(jSave.length===1)
{
jContent.find('input[type=text],select').keypress(function(ev){if(ev.which===13){jSave.click();return false;}});
jContent.find('textarea').keydown(function(ev){if(ev.ctrlKey&&ev.which===13){jSave.click();return false;}});
jSave.after(' <input type="button" id="xheCancel" value="取消" />');
$('#xheCancel',jContent).click(_this.hidePanel);
if(!settings.clickCancelDialog)
{
bClickCancel=false;//关闭点击隐藏
var jFixCancel=$('<div class="xheFixCancel"></div>').appendTo('body').mousedown(returnFalse);
var xy=_jArea.offset();
jFixCancel.css({'left':xy.left,'top':xy.top,width:_jArea.outerWidth(),height:_jArea.outerHeight()})
}
jDialog.mousedown(function(){bDisableHoverExec=true;})//点击对话框禁止悬停执行
}
jDialog.append(jContent);
_this.showPanel(jDialog,bNoFocus);
}
this.showPanel=function(content,bNoFocus)
{
if(!ev.target)return false;
_jPanel.html('').append(content).css('left',-999).css('top',-999);
_jPanelButton=$(ev.target).closest('a').addClass('xheActive');
var xy=_jPanelButton.offset();
var x=xy.left,y=xy.top;y+=_jPanelButton.outerHeight()-1;
_jCntLine.css({'left':x+1,'top':y,'width':_jPanelButton.width()}).show();
var _docElem=document.documentElement,body=document.body;
if((x+_jPanel.outerWidth())>((window.pageXOffset||_docElem.scrollLeft||body.scrollLeft)+(_docElem.clientWidth||body.clientWidth)))x-=(_jPanel.outerWidth()-_jPanelButton.outerWidth());//向左显示面板
var layerShadow=settings.layerShadow;
if(layerShadow>0)_jShadow.css({'left':x+layerShadow,'top':y+layerShadow,'width':_jPanel.outerWidth(),'height':_jPanel.outerHeight()}).show();
var basezIndex=$('#'+idContainer).offsetParent().css('zIndex');
if(basezIndex&&!isNaN(basezIndex)){
_jShadow.css('zIndex',parseInt(basezIndex,10)+1);
_jPanel.css('zIndex',parseInt(basezIndex,10)+2);
_jCntLine.css('zIndex',parseInt(basezIndex,10)+3);
}
_jPanel.css({'left':x,'top':y}).show();
if(!bNoFocus)setTimeout(function(){_jPanel.find('a,input[type=text],textarea').filter(':visible').filter(function(){return $(this).css('visibility')!=='hidden';}).eq(0).focus();},10);//定位首个可见输入表单项,延迟解决opera无法设置焦点
bQuickHoverExec=bShowPanel=true;
}
this.hidePanel=function(){
if(bShowPanel){
_jPanelButton.removeClass('xheActive');
_jShadow.hide();
_jCntLine.hide();
_jPanel.hide();
bShowPanel=false;
if(!bClickCancel){
$('.xheFixCancel').remove();
bClickCancel=true;
};
bQuickHoverExec=bDisableHoverExec=false;
lastAngle=null;
_this.focus();
_this.loadBookmark();
}
}
this.exec=function(cmd)
{
_this.hidePanel();
var tool=arrTools[cmd];
if(!tool)return false;//无效命令
if(ev===null)//非鼠标点击
{
ev={};
var btn=_jTools.find('.xheButton[cmd='+cmd+']');
if(btn.length===1)ev.target=btn;//设置当前事件焦点
}
if(tool.e)tool.e.call(_this)//插件事件
else//内置工具
{
cmd=cmd.toLowerCase();
switch(cmd)
{
case 'cut':
try{_doc.execCommand(cmd);if(!_doc.queryCommandSupported(cmd))throw 'Error';}
catch(ex){alert('您的浏览器安全设置不允许使用剪切操作,请使用键盘快捷键(Ctrl + X)来完成');};
break;
case 'copy':
try{_doc.execCommand(cmd);if(!_doc.queryCommandSupported(cmd))throw 'Error';}
catch(ex){alert('您的浏览器安全设置不允许使用复制操作,请使用键盘快捷键(Ctrl + C)来完成');}
break;
case 'paste':
try{_doc.execCommand(cmd);if(!_doc.queryCommandSupported(cmd))throw 'Error';}
catch(ex){alert('您的浏览器安全设置不允许使用粘贴操作,请使用键盘快捷键(Ctrl + V)来完成');}
break;
case 'pastetext':
if(window.clipboardData)_this.pasteText(window.clipboardData.getData('Text', true));
else _this.showPastetext();
break;
case 'blocktag':
var menuBlocktag=[];
$.each(arrBlocktag,function(n,v){menuBlocktag.push({s:'<'+v.n+'>'+v.t+'</'+v.n+'>',v:'<'+v.n+'>',t:v.t});});
_this.showMenu(menuBlocktag,function(v){_this._exec('formatblock',v);});
break;
case 'fontface':
var menuFontname=[];
$.each(arrFontname,function(n,v){v.c=v.c?v.c:v.n;menuFontname.push({s:'<span style="font-family:'+v.c+'">'+v.n+'</span>',v:v.c,t:v.n});});
_this.showMenu(menuFontname,function(v){_this._exec('fontname',v);});
break;
case 'fontsize':
var menuFontsize=[];
$.each(arrFontsize,function(n,v){menuFontsize.push({s:'<span style="font-size:'+v.s+';">'+v.t+'('+v.s+')</span>',v:n+1,t:v.t});});
_this.showMenu(menuFontsize,function(v){_this._exec('fontsize',v);});
break;
case 'fontcolor':
_this.showColor(function(v){_this._exec('forecolor',v);});
break;
case 'backcolor':
_this.showColor(function(v){if(isIE)_this._exec('backcolor',v);else{setCSS(true);_this._exec('hilitecolor',v);setCSS(false);}});
break;
case 'align':
_this.showMenu(menuAlign,function(v){_this._exec(v);});
break;
case 'list':
_this.showMenu(menuList,function(v){_this._exec(v);});
break;
case 'link':
_this.showLink();
break;
case 'anchor':
_this.showAnchor();
break;
case 'img':
_this.showImg();
break;
case 'flash':
_this.showEmbed('Flash',htmlFlash,'application/x-shockwave-flash','clsid:d27cdb6e-ae6d-11cf-96b8-4445535400000',' wmode="opaque" quality="high" menu="false" play="true" loop="true" allowfullscreen="true"',settings.upFlashUrl,settings.upFlashExt);
break;
case 'media':
_this.showEmbed('Media',htmlMedia,'application/x-mplayer2','clsid:6bf52a52-394a-11d3-b153-00c04f79faa6',' enablecontextmenu="false" autostart="false"',settings.upMediaUrl,settings.upMediaExt);
break;
case 'hr':
_this.pasteHTML('<hr />');
break;
case 'emot':
_this.showEmot();
break;
case 'table':
_this.showTable();
break;
case 'source':
_this.toggleSource();
break;
case 'preview':
_this.showPreview();
break;
case 'print':
_win.print();
break;
case 'fullscreen':
_this.toggleFullscreen();
break;
case 'about':
_this.showAbout();
break;
default:
_this._exec(cmd);
break;
}
}
ev=null;
}
this._exec=function(cmd,param,noFocus)
{
if(!noFocus)_this.focus();
var state;
if(param!==undefined)state=_doc.execCommand(cmd,false,param);
else state=_doc.execCommand(cmd,false,null);
return state;
}
function checkDblClick(ev)
{
var target=ev.target,tool=arrDbClick[target.tagName.toLowerCase()];
if(tool)
{
if(tool==='Embed')//自动识别Flash和多媒体
{
var arrEmbed={'application/x-shockwave-flash':'Flash','application/x-mplayer2':'Media'};
tool=arrEmbed[target.type.toLowerCase()];
}
_this.exec(tool);
}
}
function checkEsc(ev)
{
if(ev.which===27)
{
if(bShowModal)_this.removeModal();
else if(bShowPanel)_this.hidePanel();
return false;
}
}
function loadReset(){setTimeout(_this.setSource,10);}
function saveResult(){_this.getSource();};
function cleanPaste(ev){
var clipboardData,items,item;//for chrome
if(ev&&(clipboardData=ev.originalEvent.clipboardData)&&(items=clipboardData.items)&&(item=items[0])&&item.kind=='file'&&item.type.match(/^image\//i)){
var blob = item.getAsFile(),reader = new FileReader();
reader.onload=function(){
var sHtml='<img src="'+event.target.result+'">';
sHtml=replaceRemoteImg(sHtml);
_this.pasteHTML(sHtml);
}
reader.readAsDataURL(blob);
return false;
}
var cleanPaste=settings.cleanPaste;
if(cleanPaste===0||bSource||bCleanPaste)return true;
bCleanPaste=true;//解决IE右键粘贴重复产生paste的问题
_this.saveBookmark();
var tag=isIE?'pre':'div',jDiv=$('<'+tag+' class="xhe-paste">\uFEFF\uFEFF</'+tag+'>',_doc).appendTo(_doc.body),div=jDiv[0],sel=_this.getSel(),rng=_this.getRng(true);
jDiv.css('top',_jWin.scrollTop());
if(isIE){
rng.moveToElementText(div);
rng.select();
//注:调用execommand:paste,会导致IE8,IE9目标路径无法转为绝对路径
}
else{
rng.selectNodeContents(div);
sel.removeAllRanges();
sel.addRange(rng);
}
setTimeout(function(){
var bText=(cleanPaste===3),sPaste;
if(bText)sPaste=jDiv.text();
else{
var jTDiv=$('.xhe-paste',_doc.body),arrHtml=[];
jTDiv.each(function(i,n){if($(n).find('.xhe-paste').length==0)arrHtml.push(n.innerHTML);});
sPaste=arrHtml.join('<br />');
}
jDiv.remove();
_this.loadBookmark();
sPaste=sPaste.replace(/^[\s\uFEFF]+|[\s\uFEFF]+$/g,'');
if(sPaste){
if(bText)_this.pasteText(sPaste);
else{
sPaste=_this.cleanHTML(sPaste);
sPaste=_this.cleanWord(sPaste);
sPaste=_this.formatXHTML(sPaste);
if(!settings.onPaste||settings.onPaste&&(sPaste=settings.onPaste(sPaste))!==false){
sPaste=replaceRemoteImg(sPaste);
_this.pasteHTML(sPaste);
}
}
}
bCleanPaste=false;
},0);
}
//远程图片转本地
function replaceRemoteImg(sHtml){
var localUrlTest=settings.localUrlTest,remoteImgSaveUrl=settings.remoteImgSaveUrl;
if(localUrlTest&&remoteImgSaveUrl){
var arrRemoteImgs=[],count=0;
sHtml=sHtml.replace(/(<img)((?:\s+[^>]*?)?(?:\s+src="\s*([^"]+)\s*")(?: [^>]*)?)(\/?>)/ig,function(all,left,attr,url,right){
if(/^(https?|data:image)/i.test(url) && !/_xhe_temp/.test(attr) && !localUrlTest.test(url)){
arrRemoteImgs[count]=url;
attr=attr.replace(/\s+(width|height)="[^"]*"/ig,'').replace(/\s+src="[^"]*"/ig,' src="'+skinPath+'img/waiting.gif" remoteimg="'+(count++)+'"');
}
return left+attr+right;
});
if(arrRemoteImgs.length>0){
$.post(remoteImgSaveUrl,{urls:arrRemoteImgs.join('|')},function(data){
data=data.split('|');
$('img[remoteimg]',_this.doc).each(function(){
var $this=$(this);
xheAttr($this,'src',data[$this.attr('remoteimg')]);
$this.removeAttr('remoteimg');
});
});
}
}
return sHtml;
}
function setCSS(css)
{
try{_this._exec('styleWithCSS',css,true);}
catch(e)
{try{_this._exec('useCSS',!css,true);}catch(e){}}
}
function setOpts()
{
if(bInit&&!bSource)
{
setCSS(false);
try{_this._exec('enableObjectResizing',true,true);}catch(e){}
//try{_this._exec('enableInlineTableEditing',false,true);}catch(e){}
if(isIE)try{_this._exec('BackgroundImageCache',true,true);}catch(e){}
}
}
function forcePtag(ev)
{
if(bSource||ev.which!==13||ev.shiftKey||ev.ctrlKey||ev.altKey)return true;
var pNode=_this.getParent('p,h1,h2,h3,h4,h5,h6,pre,address,div,li');
if(pNode.is('li'))return true;
if(settings.forcePtag){if(pNode.length===0)_this._exec('formatblock','<p>');}
else
{
_this.pasteHTML('<br />');
if(isIE&&pNode.length>0&&_this.getRng().parentElement().childNodes.length===2)_this.pasteHTML('<br />');
return false;
}
}
function fixFullHeight()
{
if(!isMozilla&&!isSafari)
{
if(bFullscreen)_jArea.height('100%').css('height',_jArea.outerHeight()-_jTools.outerHeight());
if(isIE)_jTools.hide().show();
}
}
function fixAppleSel(e)
{
e=e.target;
if(e.tagName.match(/(img|embed)/i))
{
var sel=_this.getSel(),rng=_this.getRng(true);
rng.selectNode(e);
sel.removeAllRanges();
sel.addRange(rng);
}
}
function xheAttr(jObj,n,v)
{
if(!n)return false;
var kn='_xhe_'+n;
if(v)//设置属性
{
if(urlType)v=getLocalUrl(v,urlType,urlBase);
jObj.attr(n,urlBase?getLocalUrl(v,'abs',urlBase):v).removeAttr(kn).attr(kn,v);
}
return jObj.attr(kn)||jObj.attr(n);
}
function clickCancelPanel(){if(bClickCancel)_this.hidePanel();}
function checkShortcuts(event)
{
if(bSource)return true;
var code=event.which,special=specialKeys[code],sChar=special?special:String.fromCharCode(code).toLowerCase();
sKey='';
sKey+=event.ctrlKey?'ctrl+':'';sKey+=event.altKey?'alt+':'';sKey+=event.shiftKey?'shift+':'';sKey+=sChar;
var cmd=arrShortCuts[sKey],c;
for(c in cmd)
{
c=cmd[c];
if($.isFunction(c)){if(c.call(_this)===false)return false;}
else{_this.exec(c);return false;}//按钮独占快捷键
}
}
function is(o,t)
{
var n = typeof(o);
if (!t)return n != 'undefined';
if (t === 'array' && (o.hasOwnProperty && o instanceof Array))return true;
return n === t;
}
function getLocalUrl(url,urlType,urlBase)//绝对地址:abs,根地址:root,相对地址:rel
{
if( (url.match(/^(\w+):\/\//i) && !url.match(/^https?:/i)) || /^#/i.test(url) || /^data:/i.test(url) )return url;//非http和https协议,或者页面锚点不转换,或者base64编码的图片等
var baseUrl=urlBase?$('<a href="'+urlBase+'" />')[0]:location,protocol=baseUrl.protocol,host=baseUrl.host,hostname=baseUrl.hostname,port=baseUrl.port,path=baseUrl.pathname.replace(/\\/g,'/').replace(/[^\/]+$/i,'');
if(port==='')port='80';
if(path==='')path='/';
else if(path.charAt(0)!=='/')path='/'+path;//修正IE path
url=$.trim(url);
//删除域路径
if(urlType!=='abs')url=url.replace(new RegExp(protocol+'\\/\\/'+hostname.replace(/\./g,'\\.')+'(?::'+port+')'+(port==='80'?'?':'')+'(\/|$)','i'),'/');
//删除根路径
if(urlType==='rel')url=url.replace(new RegExp('^'+path.replace(/([\/\.\+\[\]\(\)])/g,'\\$1'),'i'),'');
//加上根路径
if(urlType!=='rel')
{
if(!url.match(/^(https?:\/\/|\/)/i))url=path+url;
if(url.charAt(0)==='/')//处理根路径中的..
{
var arrPath=[],arrFolder = url.split('/'),folder,i,l=arrFolder.length;
for(i=0;i<l;i++)
{
folder=arrFolder[i];
if(folder==='..')arrPath.pop();
else if(folder!==''&&folder!=='.')arrPath.push(folder);
}
if(arrFolder[l-1]==='')arrPath.push('');
url='/'+arrPath.join('/');
}
}
//加上域路径
if(urlType==='abs'&&!url.match(/^https?:\/\//i))url=protocol+'//'+host+url;
url=url.replace(/(https?:\/\/[^:\/?#]+):80(\/|$)/i,'$1$2');//省略80端口
return url;
}
function checkFileExt(filename,limitExt)
{
if(limitExt==='*'||filename.match(new RegExp('\.('+limitExt.replace(/,/g,'|')+')$','i')))return true;
else
{
alert('上传文件扩展名必需为: '+limitExt);
return false;
}
}
function formatBytes(bytes)
{
var s = ['Byte', 'KB', 'MB', 'GB', 'TB', 'PB'];
var e = Math.floor(Math.log(bytes)/Math.log(1024));
return (bytes/Math.pow(1024, Math.floor(e))).toFixed(2)+s[e];
}
function returnFalse(){return false;}
}
xheditor.settings={skin:'default',tools:'full',clickCancelDialog:true,linkTag:false,internalScript:false,inlineScript:false,internalStyle:true,inlineStyle:true,showBlocktag:false,forcePtag:true,upLinkExt:"zip,rar,txt",upImgExt:"jpg,jpeg,gif,png",upFlashExt:"swf",upMediaExt:"wmv,avi,wma,mp3,mid",modalWidth:350,modalHeight:220,modalTitle:true,defLinkText:'点击打开链接',layerShadow:3,emotMark:false,upBtnText:'上传',cleanPaste:1,hoverExecDelay:100,html5Upload:true,upMultiple:99};
window.xheditor=xheditor;
$(function(){
$.fn.oldVal=$.fn.val;
$.fn.val=function(value)
{
var _this=this,editor;
if(value===undefined)if(_this[0]&&(editor=_this[0].xheditor))return editor.getSource();else return _this.oldVal();//读
return _this.each(function(){if(editor=this.xheditor)editor.setSource(value);else _this.oldVal(value);});//写
}
$('textarea').each(function(){
var $this=$(this),xhClass=$this.attr('class');
if(xhClass&&(xhClass=xhClass.match(/(?:^|\s)xheditor(?:\-(m?full|simple|mini))?(?:\s|$)/i)))$this.xheditor(xhClass[1]?{tools:xhClass[1]}:null);
});
});
})(jQuery); | zz-ms | trunk/zz-ms-v2.0/src/main/webapp/js/xheditor/src/xheditor-1.1.14-zh-cn.js | JavaScript | asf20 | 99,164 |
/*!
* xhEditor - WYSIWYG XHTML Editor
* @requires jQuery v1.4.4
*
* @author Yanis.Wang<yanis.wang@gmail.com>
* @site http://xheditor.com/
* @licence LGPL(http://xheditor.com/license/lgpl.txt)
*
* @Version: 1.1.14 (build 120701)
*/
(function($,undefined){
if(window.xheditor)return false;//防止JS重複加載
var agent=navigator.userAgent.toLowerCase();
var bMobile=agent.indexOf('mobile')!==-1,browser=$.browser,browerVer=parseFloat(browser.version),isIE=browser.msie,isMozilla=browser.mozilla,isSafari=browser.safari,isOpera=browser.opera;
var bAir=agent.indexOf(' adobeair/')>-1;
var bIOS5=/OS 5(_\d)+ like Mac OS X/i.test(agent);
$.fn.xheditor=function(options)
{
if(bMobile&&!bIOS5)return false;//手機瀏覽器不初始化編輯器(IOS5除外)
var arrSuccess=[];
this.each(function(){
if(!$.nodeName(this,'TEXTAREA'))return;
if(options===false)//卸載
{
if(this.xheditor)
{
this.xheditor.remove();
this.xheditor=null;
}
}
else//初始化
{
if(!this.xheditor)
{
var tOptions=/({.*})/.exec($(this).attr('class'));
if(tOptions)
{
try{tOptions=eval('('+tOptions[1]+')');}catch(ex){};
options=$.extend({},tOptions,options );
}
var editor=new xheditor(this,options);
if(editor.init())
{
this.xheditor=editor;
arrSuccess.push(editor);
}
else editor=null;
}
else arrSuccess.push(this.xheditor);
}
});
if(arrSuccess.length===0)arrSuccess=false;
if(arrSuccess.length===1)arrSuccess=arrSuccess[0];
return arrSuccess;
}
var xCount=0,bShowPanel=false,bClickCancel=true,bShowModal=false,bCheckEscInit=false;
var _jPanel,_jShadow,_jCntLine,_jPanelButton;
var jModal,jModalShadow,layerShadow,jOverlay,jHideSelect,onModalRemove;
var editorRoot;
$('script[src*=xheditor]').each(function(){
var s=this.src;
if(s.match(/xheditor[^\/]*\.js/i)){editorRoot=s.replace(/[\?#].*$/, '').replace(/(^|[\/\\])[^\/]*$/, '$1');return false;}
});
if(isIE){
//ie6 緩存背景圖片
try{document.execCommand('BackgroundImageCache', false, true );}
catch(e){}
//修正 jquery 1.6,1.7系列在IE6瀏覽器下造成width="auto"問題的修正
var jqueryVer=$.fn.jquery;
if(jqueryVer&&jqueryVer.match(/^1\.[67]/))$.attrHooks['width']=$.attrHooks['height']=null;
}
var specialKeys={ 27: 'esc', 9: 'tab', 32:'space', 13: 'enter', 8:'backspace', 145: 'scroll',
20: 'capslock', 144: 'numlock', 19:'pause', 45:'insert', 36:'home', 46:'del',
35:'end', 33: 'pageup', 34:'pagedown', 37:'left', 38:'up', 39:'right',40:'down',
112:'f1',113:'f2', 114:'f3', 115:'f4', 116:'f5', 117:'f6', 118:'f7', 119:'f8', 120:'f9', 121:'f10', 122:'f11', 123:'f12' };
var itemColors=['#FFFFFF','#CCCCCC','#C0C0C0','#999999','#666666','#333333','#000000','#FFCCCC','#FF6666','#FF0000','#CC0000','#990000','#660000','#330000','#FFCC99','#FF9966','#FF9900','#FF6600','#CC6600','#993300','#663300','#FFFF99','#FFFF66','#FFCC66','#FFCC33','#CC9933','#996633','#663333','#FFFFCC','#FFFF33','#FFFF00','#FFCC00','#999900','#666600','#333300','#99FF99','#66FF99','#33FF33','#33CC00','#009900','#006600','#003300','#99FFFF','#33FFFF','#66CCCC','#00CCCC','#339999','#336666','#003333','#CCFFFF','#66FFFF','#33CCFF','#3366FF','#3333FF','#000099','#000066','#CCCCFF','#9999FF','#6666CC','#6633FF','#6600CC','#333399','#330099','#FFCCFF','#FF99FF','#CC66CC','#CC33CC','#993399','#663366','#330033'];
var arrBlocktag=[{n:'p',t:'普通段落'},{n:'h1',t:'標題1'},{n:'h2',t:'標題2'},{n:'h3',t:'標題3'},{n:'h4',t:'標題4'},{n:'h5',t:'標題5'},{n:'h6',t:'標題6'},{n:'pre',t:'已編排格式'},{n:'address',t:'地址'}];
var arrFontname=[{n:'新細明體',c:'PMingLiu'},{n:'細明體',c:'mingliu'},{n:'標楷體',c:'DFKai-SB'},{n:'微軟正黑體',c:'Microsoft JhengHei'},{n:'Arial'},{n:'Arial Black'},{n:'Comic Sans MS'},{n:'Courier New'},{n:'System'},{n:'Times New Roman'},{n:'Tahoma'},{n:'Verdana'}];
var arrFontsize=[{n:'x-small',s:'10px',t:'極小'},{n:'small',s:'12px',t:'特小'},{n:'medium',s:'16px',t:'小'},{n:'large',s:'18px',t:'中'},{n:'x-large',s:'24px',t:'大'},{n:'xx-large',s:'32px',t:'特大'},{n:'-webkit-xxx-large',s:'48px',t:'極大'}];
var menuAlign=[{s:'靠左對齊',v:'justifyleft'},{s:'置中',v:'justifycenter'},{s:'靠右對齊',v:'justifyright'},{s:'左右對齊',v:'justifyfull'}],menuList=[{s:'數字列表',v:'insertOrderedList'},{s:'符號列表',v:'insertUnorderedList'}];
var htmlPastetext='<div><label for="xhePastetextValue">使用鍵盤快捷鍵(Ctrl+V)把內容貼上到方框裡,按 確定</label></div><div><textarea id="xhePastetextValue" wrap="soft" spellcheck="false" style="width:300px;height:100px;" /></div><div style="text-align:right;"><input type="button" id="xheSave" value="確定" /></div>';
var htmlLink='<div><label for="xheLinkUrl">鏈接地址: </label><input type="text" id="xheLinkUrl" value="http://" class="xheText" /></div><div><label for="xheLinkTarget">打開方式: </label><select id="xheLinkTarget"><option selected="selected" value="">預設</option><option value="_blank">新窗口</option><option value="_self">當前窗口</option><option value="_parent">父窗口</option></select></div><div style="display:none"><label for="xheLinkText">鏈接文字: </label><input type="text" id="xheLinkText" value="" class="xheText" /></div><div style="text-align:right;"><input type="button" id="xheSave" value="確定" /></div>';
var htmlAnchor='<div><label for="xheAnchorName">錨點名稱: </label><input type="text" id="xheAnchorName" value="" class="xheText" /></div><div style="text-align:right;"><input type="button" id="xheSave" value="確定" /></div>';
var htmlImg='<div><label for="xheImgUrl">圖片文件: </label><input type="text" id="xheImgUrl" value="http://" class="xheText" /></div><div><div><label for="xheImgAlt">替換文本: </label><input type="text" id="xheImgAlt" /></div><div><label for="xheImgAlign">對齊方式: </label><select id="xheImgAlign"><option selected="selected" value="">預設</option><option value="left">靠左對齊</option><option value="right">靠右對齊</option><option value="top">頂端</option><option value="middle">置中</option><option value="baseline">基線</option><option value="bottom">底邊</option></select></div><div><label for="xheImgWidth">寬 度: </label><input type="text" id="xheImgWidth" style="width:40px;" /> <label for="xheImgHeight">高 度: </label><input type="text" id="xheImgHeight" style="width:40px;" /></div><div><label for="xheImgBorder">邊框大小: </label><input type="text" id="xheImgBorder" style="width:40px;" /></div><div><label for="xheImgHspace">水平間距: </label><input type="text" id="xheImgHspace" style="width:40px;" /> <label for="xheImgVspace">垂直間距: </label><input type="text" id="xheImgVspace" style="width:40px;" /></div><div style="text-align:right;"><input type="button" id="xheSave" value="確定" /></div>';
var htmlFlash='<div><label for="xheFlashUrl">動畫文件: </label><input type="text" id="xheFlashUrl" value="http://" class="xheText" /></div><div><label for="xheFlashWidth">寬 度: </label><input type="text" id="xheFlashWidth" style="width:40px;" value="480" /> <label for="xheFlashHeight">高 度: </label><input type="text" id="xheFlashHeight" style="width:40px;" value="400" /></div><div style="text-align:right;"><input type="button" id="xheSave" value="確定" /></div>';
var htmlMedia='<div><label for="xheMediaUrl">媒體文件: </label><input type="text" id="xheMediaUrl" value="http://" class="xheText" /></div><div><label for="xheMediaWidth">寬 度: </label><input type="text" id="xheMediaWidth" style="width:40px;" value="480" /> <label for="xheMediaHeight">高 度: </label><input type="text" id="xheMediaHeight" style="width:40px;" value="400" /></div><div style="text-align:right;"><input type="button" id="xheSave" value="確定" /></div>';
var htmlTable='<div><label for="xheTableRows">行 數: </label><input type="text" id="xheTableRows" style="width:40px;" value="3" /> <label for="xheTableColumns">列 數: </label><input type="text" id="xheTableColumns" style="width:40px;" value="2" /></div><div><label for="xheTableHeaders">標題單元: </label><select id="xheTableHeaders"><option selected="selected" value="">無</option><option value="row">第一行</option><option value="col">第一列</option><option value="both">第一行和第一列</option></select></div><div><label for="xheTableWidth">寬 度: </label><input type="text" id="xheTableWidth" style="width:40px;" value="200" /> <label for="xheTableHeight">高 度: </label><input type="text" id="xheTableHeight" style="width:40px;" value="" /></div><div><label for="xheTableBorder">邊框大小: </label><input type="text" id="xheTableBorder" style="width:40px;" value="1" /></div><div><label for="xheTableCellSpacing">表格間距: </label><input type="text" id="xheTableCellSpacing" style="width:40px;" value="1" /> <label for="xheTableCellPadding">表格填充: </label><input type="text" id="xheTableCellPadding" style="width:40px;" value="1" /></div><div><label for="xheTableAlign">對齊方式: </label><select id="xheTableAlign"><option selected="selected" value="">預設</option><option value="left">靠左對齊</option><option value="center">置中</option><option value="right">靠右對齊</option></select></div><div><label for="xheTableCaption">表格標題: </label><input type="text" id="xheTableCaption" /></div><div style="text-align:right;"><input type="button" id="xheSave" value="確定" /></div>';
var htmlAbout='<div style="font:12px Arial;width:245px;word-wrap:break-word;word-break:break-all;outline:none;" role="dialog" tabindex="-1"><p><span style="font-size:20px;color:#1997DF;">xhEditor</span><br />v1.1.14 (build 120701)</p><p>xhEditor是基於jQuery開發的跨平台輕量可視化XHTML編輯器,基於<a href="http://www.gnu.org/licenses/lgpl.html" target="_blank">LGPL</a>開源協議發佈。</p><p>Copyright © <a href="http://xheditor.com/" target="_blank">xhEditor.com</a>. All rights reserved.</p></div>';
var itemEmots={'default':{name:'預設',width:24,height:24,line:7,list:{'smile':'微笑','tongue':'吐舌頭','titter':'偷笑','laugh':'大笑','sad':'難過','wronged':'委屈','fastcry':'快哭了','cry':'哭','wail':'大哭','mad':'生氣','knock':'敲打','curse':'罵人','crazy':'抓狂','angry':'發火','ohmy':'驚訝','awkward':'尷尬','panic':'驚恐','shy':'害羞','cute':'可憐','envy':'羨慕','proud':'得意','struggle':'奮鬥','quiet':'安靜','shutup':'閉嘴','doubt':'疑問','despise':'鄙視','sleep':'睡覺','bye':'再見'}}};
var arrTools={Cut:{t:'剪下 (Ctrl+X)'},Copy:{t:'複製 (Ctrl+C)'},Paste:{t:'貼上 (Ctrl+V)'},Pastetext:{t:'貼上文本',h:isIE?0:1},Blocktag:{t:'段落標籤',h:1},Fontface:{t:'字型',h:1},FontSize:{t:'字型大小',h:1},Bold:{t:'粗體 (Ctrl+B)',s:'Ctrl+B'},Italic:{t:'斜體 (Ctrl+I)',s:'Ctrl+I'},Underline:{t:'底線 (Ctrl+U)',s:'Ctrl+U'},Strikethrough:{t:'刪除線'},FontColor:{t:'字型顏色',h:1},BackColor:{t:'背景顏色',h:1},SelectAll:{t:'全選 (Ctrl+A)'},Removeformat:{t:'刪除文字格式'},Align:{t:'對齊',h:1},List:{t:'列表',h:1},Outdent:{t:'減少縮排'},Indent:{t:'增加縮排'},Link:{t:'超連結 (Ctrl+L)',s:'Ctrl+L',h:1},Unlink:{t:'取消超連結'},Anchor:{t:'錨點',h:1},Img:{t:'圖片',h:1},Flash:{t:'Flash動畫',h:1},Media:{t:'多媒體文件',h:1},Hr:{t:'插入水平線'},Emot:{t:'表情',s:'ctrl+e',h:1},Table:{t:'表格',h:1},Source:{t:'原始碼'},Preview:{t:'預覽'},Print:{t:'打印 (Ctrl+P)',s:'Ctrl+P'},Fullscreen:{t:'全螢幕編輯 (Esc)',s:'Esc'},About:{t:'關於 xhEditor'}};
var toolsThemes={
mini:'Bold,Italic,Underline,Strikethrough,|,Align,List,|,Link,Img',
simple:'Blocktag,Fontface,FontSize,Bold,Italic,Underline,Strikethrough,FontColor,BackColor,|,Align,List,Outdent,Indent,|,Link,Img,Emot',
full:'Cut,Copy,Paste,Pastetext,|,Blocktag,Fontface,FontSize,Bold,Italic,Underline,Strikethrough,FontColor,BackColor,SelectAll,Removeformat,|,Align,List,Outdent,Indent,|,Link,Unlink,Anchor,Img,Flash,Media,Hr,Emot,Table,|,Source,Preview,Print,Fullscreen'};
toolsThemes.mfull=toolsThemes.full.replace(/\|(,Align)/i,'/$1');
var arrDbClick={'a':'Link','img':'Img','embed':'Embed'},uploadInputname='filedata';
var arrEntities={'<':'<','>':'>','"':'"','®':'®','©':'©'};//實體
var regEntities=/[<>"®©]/g;
var xheditor=function(textarea,options)
{
var _this=this,_text=textarea,_jText=$(_text),_jForm=_jText.closest('form'),_jTools,_jArea,_win,_jWin,_doc,_jDoc;
var bookmark;
var bInit=false,bSource=false,bFullscreen=false,bCleanPaste=false,outerScroll,bShowBlocktag=false,sLayoutStyle='',ev=null,timer,bDisableHoverExec=false,bQuickHoverExec=false;
var lastPoint=null,lastAngle=null;//鼠標懸停顯示
var editorHeight=0;
var settings=_this.settings=$.extend({},xheditor.settings,options );
var plugins=settings.plugins,strPlugins=[];
if(plugins)
{
arrTools=$.extend({},arrTools,plugins);
$.each(plugins,function(n){strPlugins.push(n);});
strPlugins=strPlugins.join(',');
}
if(settings.tools.match(/^\s*(m?full|simple|mini)\s*$/i))
{
var toolsTheme=toolsThemes[$.trim(settings.tools)];
settings.tools=(settings.tools.match(/m?full/i)&&plugins)?toolsTheme.replace('Table','Table,'+strPlugins):toolsTheme;//插件接在full的Table後面
}
//如需刪除關於按鈕,請往官方網站購買商業授權:http://xheditor.com/service
//在未購買商業授權的情況下私自去除xhEditor的版權信息,您將得不到官方提供的任何技術支持和BUG反饋服務,並且我們將對您保留法律訴訟的權利
//請支持開源項目
if(!settings.tools.match(/(^|,)\s*About\s*(,|$)/i))settings.tools+=',About';
settings.tools=settings.tools.split(',');
if(settings.editorRoot)editorRoot=settings.editorRoot;
if(bAir===false)editorRoot=getLocalUrl(editorRoot,'abs');
if(settings.urlBase)settings.urlBase=getLocalUrl(settings.urlBase,'abs');
//基本控件名
var idCSS='xheCSS_'+settings.skin,idContainer='xhe'+xCount+'_container',idTools='xhe'+xCount+'_Tool',idIframeArea='xhe'+xCount+'_iframearea',idIframe='xhe'+xCount+'_iframe',idFixFFCursor='xhe'+xCount+'_fixffcursor';
var headHTML='',bodyClass='',skinPath=editorRoot+'xheditor_skin/'+settings.skin+'/',arrEmots=itemEmots,urlType=settings.urlType,urlBase=settings.urlBase,emotPath=settings.emotPath,emotPath=emotPath?emotPath:editorRoot+'xheditor_emot/',selEmotGroup='';
arrEmots=$.extend({},arrEmots,settings.emots);
emotPath=getLocalUrl(emotPath,'rel',urlBase?urlBase:null);//返回最短表情路徑
bShowBlocktag=settings.showBlocktag;
if(bShowBlocktag)bodyClass+=' showBlocktag';
var arrShortCuts=[];
this.init=function()
{
//加載樣式表
if($('#'+idCSS).length===0)$('head').append('<link id="'+idCSS+'" rel="stylesheet" type="text/css" href="'+skinPath+'ui.css" />');
//初始化編輯器
var textareaWidth=_jText.outerWidth(),textareaHeight=_jText.outerHeight();
var editorWidth = settings.width || _text.style.width || (textareaWidth>10?textareaWidth:0);
editorHeight = settings.height || _text.style.height || (textareaHeight>10?textareaHeight:150);//預設高度
if(is(editorWidth,'number'))editorWidth+='px';
if(is(editorHeight,'string'))editorHeight=editorHeight.replace(/[^\d]+/g,'');
//編輯器CSS背景
var editorBackground=settings.background || _text.style.background;
//工具欄內容初始化
var arrToolsHtml=['<span class="xheGStart"/>'],tool,cn,regSeparator=/\||\//i;
$.each(settings.tools,function(i,n)
{
if(n.match(regSeparator))arrToolsHtml.push('<span class="xheGEnd"/>');
if(n==='|')arrToolsHtml.push('<span class="xheSeparator"/>');
else if(n==='/')arrToolsHtml.push('<br />');
else
{
tool=arrTools[n];
if(!tool)return;
if(tool.c)cn=tool.c;
else cn='xheIcon xheBtn'+n;
arrToolsHtml.push('<span><a href="#" title="'+tool.t+'" cmd="'+n+'" class="xheButton xheEnabled" tabindex="-1" role="button"><span class="'+cn+'" unselectable="on" style="font-size:0;color:transparent;text-indent:-999px;">'+tool.t+'</span></a></span>');
if(tool.s)_this.addShortcuts(tool.s,n);
}
if(n.match(regSeparator))arrToolsHtml.push('<span class="xheGStart"/>');
});
arrToolsHtml.push('<span class="xheGEnd"/><br />');
_jText.after($('<input type="text" id="'+idFixFFCursor+'" style="position:absolute;display:none;" /><span id="'+idContainer+'" class="xhe_'+settings.skin+'" style="display:none"><table cellspacing="0" cellpadding="0" class="xheLayout" style="'+(editorWidth!='0px'?'width:'+editorWidth+';':'')+'height:'+editorHeight+'px;" role="presentation"><tr><td id="'+idTools+'" class="xheTool" unselectable="on" style="height:1px;" role="presentation"></td></tr><tr><td id="'+idIframeArea+'" class="xheIframeArea" role="presentation"><iframe frameborder="0" id="'+idIframe+'" src="javascript:;" style="width:100%;"></iframe></td></tr></table></span>'));
_jTools=$('#'+idTools);_jArea=$('#'+idIframeArea);
headHTML='<meta http-equiv="Content-Type" content="text/html; charset=utf-8" /><link rel="stylesheet" href="'+skinPath+'iframe.css"/>';
var loadCSS=settings.loadCSS;
if(loadCSS)
{
if(is(loadCSS,'array'))for(var i in loadCSS)headHTML+='<link rel="stylesheet" href="'+loadCSS[i]+'"/>';
else
{
if(loadCSS.match(/\s*<style(\s+[^>]*?)?>[\s\S]+?<\/style>\s*/i))headHTML+=loadCSS;
else headHTML+='<link rel="stylesheet" href="'+loadCSS+'"/>';
}
}
var iframeHTML='<html><head>'+headHTML+'<title>可視化編輯器,alt+1到9鍵,切換到工具區,tab鍵,選擇按鈕,esc鍵,返回編輯 '+(settings.readTip?settings.readTip:'')+'</title>';
if(editorBackground)iframeHTML+='<style>html{background:'+editorBackground+';}</style>';
iframeHTML+='</head><body spellcheck="0" class="editMode'+bodyClass+'"></body></html>';
_this.win=_win=$('#'+idIframe)[0].contentWindow;
_jWin=$(_win);
try{
this.doc=_doc = _win.document;_jDoc=$(_doc);
_doc.open();
_doc.write(iframeHTML);
_doc.close();
if(isIE)_doc.body.contentEditable='true';
else _doc.designMode = 'On';
}catch(e){}
setTimeout(setOpts,300);
_this.setSource();
_win.setInterval=null;//針對jquery 1.3無法操作iframe window問題的hack
//添加工具欄
_jTools.append(arrToolsHtml.join('')).bind('mousedown contextmenu',returnFalse).click(function(event)
{
var jButton=$(event.target).closest('a');
if(jButton.is('.xheEnabled'))
{
clearTimeout(timer);//取消懸停執行
_jTools.find('a').attr('tabindex','-1');//無障礙支持
ev=event;
_this.exec(jButton.attr('cmd'));
}
return false;
});
_jTools.find('.xheButton').hover(function(event){//鼠標懸停執行
var jButton=$(this),delay=settings.hoverExecDelay;
var tAngle=lastAngle;lastAngle=null;
if(delay===-1||bDisableHoverExec||!jButton.is('.xheEnabled'))return false;
if(tAngle&&tAngle>10)//檢測誤操作
{
bDisableHoverExec=true;
setTimeout(function(){bDisableHoverExec=false;},100);
return false;
}
var cmd=jButton.attr('cmd'),bHover=arrTools[cmd].h===1;
if(!bHover)
{
_this.hidePanel();//移到非懸停按鈕上隱藏面板
return false;
}
if(bQuickHoverExec)delay=0;
if(delay>=0)timer=setTimeout(function(){
ev=event;
lastPoint={x:ev.clientX,y:ev.clientY};
_this.exec(cmd);
},delay);
},function(event){lastPoint=null;if(timer)clearTimeout(timer);}).mousemove(function(event){
if(lastPoint)
{
var diff={x:event.clientX-lastPoint.x,y:event.clientY-lastPoint.y};
if(Math.abs(diff.x)>1||Math.abs(diff.y)>1)
{
if(diff.x>0&&diff.y>0)
{
var tAngle=Math.round(Math.atan(diff.y/diff.x)/0.017453293);
if(lastAngle)lastAngle=(lastAngle+tAngle)/2
else lastAngle=tAngle;
}
else lastAngle=null;
lastPoint={x:event.clientX,y:event.clientY};
}
}
});
//初始化面板
_jPanel=$('#xhePanel');
_jShadow=$('#xheShadow');
_jCntLine=$('#xheCntLine');
if(_jPanel.length===0)
{
_jPanel=$('<div id="xhePanel"></div>').mousedown(function(ev){ev.stopPropagation()});
_jShadow=$('<div id="xheShadow"></div>');
_jCntLine=$('<div id="xheCntLine"></div>');
setTimeout(function(){
$(document.body).append(_jPanel).append(_jShadow).append(_jCntLine);
},10);
}
//切換顯示區域
$('#'+idContainer).show();
_jText.hide();
_jArea.css('height',editorHeight-_jTools.outerHeight());
if(isIE&browerVer<8)setTimeout(function(){_jArea.css('height',editorHeight-_jTools.outerHeight());},1);
//綁定內核事件
_jText.focus(_this.focus);
_jForm.submit(saveResult).bind('reset', loadReset);//綁定表單的提交和重置事件
if(settings.submitID)$('#'+settings.submitID).mousedown(saveResult);//自定義綁定submit按鈕
$(window).bind('unload beforeunload',saveResult).bind('resize',fixFullHeight);
$(document).mousedown(clickCancelPanel);
if(!bCheckEscInit){$(document).keydown(checkEsc);bCheckEscInit=true;}
_jWin.focus(function(){if(settings.focus)settings.focus();}).blur(function(){if(settings.blur)settings.blur();});
if(isSafari)_jWin.click(fixAppleSel);
_jDoc.mousedown(clickCancelPanel).keydown(checkShortcuts).keypress(forcePtag).dblclick(checkDblClick).bind('mousedown click',function(ev){_jText.trigger(ev.type);});
if(isIE)
{
//IE控件上Backspace會導致頁面後退
_jDoc.keydown(function(ev){var rng=_this.getRng();if(ev.which===8&&rng.item){$(rng.item(0)).remove();return false;}});
//修正IE拖動img大小不更新width和height屬性值的問題
function fixResize(ev)
{
var jImg=$(ev.target),v;
if(v=jImg.css('width'))jImg.css('width','').attr('width',v.replace(/[^0-9%]+/g, ''));
if(v=jImg.css('height'))jImg.css('height','').attr('height',v.replace(/[^0-9%]+/g, ''));
}
_jDoc.bind('controlselect',function(ev){
ev=ev.target;if(!$.nodeName(ev,'IMG'))return;
$(ev).unbind('resizeend',fixResize).bind('resizeend',fixResize);
});
}
//無障礙支持
_jDoc.keydown(function(e){
var which=e.which;
if(e.altKey&&which>=49&&which<=57){
_jTools.find('a').attr('tabindex','0');
_jTools.find('.xheGStart').eq(which-49).next().find('a').focus();
_doc.title='\uFEFF\uFEFF';
return false;
}
}).click(function(){
_jTools.find('a').attr('tabindex','-1');
});
_jTools.keydown(function(e){
var which=e.which;
if(which==27){
_jTools.find('a').attr('tabindex','-1');
_this.focus();
}
else if(e.altKey&&which>=49&&which<=57){
_jTools.find('.xheGStart').eq(which-49).next().find('a').focus();
return false;
}
});
var jBody=$(_doc.documentElement);
//自動清理貼上內容
if(isOpera)jBody.bind('keydown',function(e){if(e.ctrlKey&&e.which===86)cleanPaste();});
else jBody.bind(isIE?'beforepaste':'paste',cleanPaste);
//禁用編輯區域的瀏覽器預設右鍵菜單
if(settings.disableContextmenu)jBody.bind('contextmenu',returnFalse);
//HTML5編輯區域直接拖放上傳
if(settings.html5Upload)jBody.bind('dragenter dragover',function(ev){var types;if((types=ev.originalEvent.dataTransfer.types)&&$.inArray('Files', types)!==-1)return false;}).bind('drop',function(ev){
var dataTransfer=ev.originalEvent.dataTransfer,fileList;
if(dataTransfer&&(fileList=dataTransfer.files)&&fileList.length>0){
var i,cmd,arrCmd=['Link','Img','Flash','Media'],arrExt=[],strExt;
for(i in arrCmd){
cmd=arrCmd[i];
if(settings['up'+cmd+'Url']&&settings['up'+cmd+'Url'].match(/^[^!].*/i))arrExt.push(cmd+':,'+settings['up'+cmd+'Ext']);//允許上傳
}
if(arrExt.length===0)return false;//禁止上傳
else strExt=arrExt.join(',');
function getCmd(fileList){
var match,fileExt,cmd;
for(i=0;i<fileList.length;i++){
fileExt=fileList[i].name.replace(/.+\./,'');
if(match=strExt.match(new RegExp('(\\w+):[^:]*,'+fileExt+'(?:,|$)','i'))){
if(!cmd)cmd=match[1];
else if(cmd!==match[1])return 2;
}
else return 1;
}
return cmd;
}
cmd=getCmd(fileList);
if(cmd===1)alert('上傳文件的擴展名必需為:'+strExt.replace(/\w+:,/g,''));
else if(cmd===2)alert('每次只能拖放上傳同一類型文件');
else if(cmd){
_this.startUpload(fileList,settings['up'+cmd+'Url'],'*',function(arrMsg){
var arrUrl=[],msg,onUpload=settings.onUpload;
if(onUpload)onUpload(arrMsg);//用戶上傳回調
for(var i=0,c=arrMsg.length;i<c;i++){
msg=arrMsg[i];
url=is(msg,'string')?msg:msg.url;
if(url.substr(0,1)==='!')url=url.substr(1);
arrUrl.push(url);
}
_this.exec(cmd);
$('#xhe'+cmd+'Url').val(arrUrl.join(' '));
$('#xheSave').click();
});
}
return false;
}
});
//添加用戶快捷鍵
var shortcuts=settings.shortcuts;
if(shortcuts)$.each(shortcuts,function(key,func){_this.addShortcuts(key,func);});
xCount++;
bInit=true;
if(settings.fullscreen)_this.toggleFullscreen();
else if(settings.sourceMode)setTimeout(_this.toggleSource,20);
return true;
}
this.remove=function()
{
_this.hidePanel();
saveResult();//卸載前同步最新內容到textarea
//取消綁定事件
_jText.unbind('focus',_this.focus);
_jForm.unbind('submit',saveResult).unbind('reset', loadReset);
if(settings.submitID)$('#'+settings.submitID).unbind('mousedown',saveResult);
$(window).unbind('unload beforeunload',saveResult).unbind('resize',fixFullHeight);
$(document).unbind('mousedown',clickCancelPanel);
$('#'+idContainer).remove();
$('#'+idFixFFCursor).remove();
_jText.show();
bInit=false;
}
this.saveBookmark=function(){
if(!bSource){
_this.focus();
var rng=_this.getRng();
rng=rng.cloneRange?rng.cloneRange():rng;
bookmark={'top':_jWin.scrollTop(),'rng':rng};
}
}
this.loadBookmark=function()
{
if(bSource||!bookmark)return;
_this.focus();
var rng=bookmark.rng;
if(isIE)rng.select();
else
{
var sel=_this.getSel();
sel.removeAllRanges();
sel.addRange(rng);
}
_jWin.scrollTop(bookmark.top);
bookmark=null;
}
this.focus=function()
{
if(!bSource)_win.focus();
else $('#sourceCode',_doc).focus();
if(isIE){
var rng=_this.getRng();
if(rng.parentElement&&rng.parentElement().ownerDocument!==_doc)_this.setTextCursor();//修正IE初始焦點問題
}
return false;
}
this.setTextCursor=function(bLast)
{
var rng=_this.getRng(true),cursorNode=_doc.body;
if(isIE)rng.moveToElementText(cursorNode);
else{
var chileName=bLast?'lastChild':'firstChild';
while(cursorNode.nodeType!=3&&cursorNode[chileName]){cursorNode=cursorNode[chileName];}
rng.selectNode(cursorNode);
}
rng.collapse(bLast?false:true);
if(isIE)rng.select();
else{var sel=_this.getSel();sel.removeAllRanges();sel.addRange(rng);}
}
this.getSel=function()
{
return _doc.selection ? _doc.selection : _win.getSelection();
}
this.getRng=function(bNew)
{
var sel,rng;
try{
if(!bNew){
sel=_this.getSel();
rng = sel.createRange ? sel.createRange() : sel.rangeCount > 0?sel.getRangeAt(0):null;
}
if(!rng)rng = _doc.body.createTextRange?_doc.body.createTextRange():_doc.createRange();
}catch (ex){}
return rng;
}
this.getParent=function(tag)
{
var rng=_this.getRng(),p;
if(!isIE)
{
p = rng.commonAncestorContainer;
if(!rng.collapsed)if(rng.startContainer === rng.endContainer&&rng.startOffset - rng.endOffset < 2&&rng.startContainer.hasChildNodes())p = rng.startContainer.childNodes[rng.startOffset];
}
else p=rng.item?rng.item(0):rng.parentElement();
tag=tag?tag:'*';p=$(p);
if(!p.is(tag))p=$(p).closest(tag);
return p;
}
this.getSelect=function(format)
{
var sel=_this.getSel(),rng=_this.getRng(),isCollapsed=true;
if (!rng || rng.item)isCollapsed=false
else isCollapsed=!sel || rng.boundingWidth === 0 || rng.collapsed;
if(format==='text')return isCollapsed ? '' : (rng.text || (sel.toString ? sel.toString() : ''));
var sHtml;
if(rng.cloneContents)
{
var tmp=$('<div></div>'),c;
c = rng.cloneContents();
if(c)tmp.append(c);
sHtml=tmp.html();
}
else if(is(rng.item))sHtml=rng.item(0).outerHTML;
else if(is(rng.htmlText))sHtml=rng.htmlText;
else sHtml=rng.toString();
if(isCollapsed)sHtml='';
sHtml=_this.processHTML(sHtml,'read');
sHtml=_this.cleanHTML(sHtml);
sHtml=_this.formatXHTML(sHtml);
return sHtml;
}
this.pasteHTML=function(sHtml,bStart)
{
if(bSource)return false;
_this.focus();
sHtml=_this.processHTML(sHtml,'write');
var sel=_this.getSel(),rng=_this.getRng();
if(bStart!==undefined)//非覆蓋式插入
{
if(rng.item)
{
var item=rng.item(0);
rng=_this.getRng(true);
rng.moveToElementText(item);
rng.select();
}
rng.collapse(bStart);
}
sHtml+='<'+(isIE?'img':'span')+' id="_xhe_temp" width="0" height="0" />';
if(rng.insertNode)
{
if($(rng.startContainer).closest('style,script').length>0)return false;//防止貼上在style和script內部
rng.deleteContents();
rng.insertNode(rng.createContextualFragment(sHtml));
}
else
{
if(sel.type.toLowerCase()==='control'){sel.clear();rng=_this.getRng();};
rng.pasteHTML(sHtml);
}
var jTemp=$('#_xhe_temp',_doc),temp=jTemp[0];
if(isIE)
{
rng.moveToElementText(temp);
rng.select();
}
else
{
rng.selectNode(temp);
sel.removeAllRanges();
sel.addRange(rng);
}
jTemp.remove();
}
this.pasteText=function(text,bStart)
{
if(!text)text='';
text=_this.domEncode(text);
text = text.replace(/\r?\n/g, '<br />');
_this.pasteHTML(text,bStart);
}
this.appendHTML=function(sHtml)
{
if(bSource)return false;
_this.focus();
sHtml=_this.processHTML(sHtml,'write');
$(_doc.body).append(sHtml);
_this.setTextCursor(true);
}
this.domEncode=function(text)
{
return text.replace(regEntities,function(c){return arrEntities[c];});
}
this.setSource=function(sHtml)
{
bookmark=null;
if(typeof sHtml!=='string'&&sHtml!=='')sHtml=_text.value;
if(bSource)$('#sourceCode',_doc).val(sHtml);
else
{
if(settings.beforeSetSource)sHtml=settings.beforeSetSource(sHtml);
sHtml=_this.cleanHTML(sHtml);
sHtml=_this.formatXHTML(sHtml);
sHtml=_this.processHTML(sHtml,'write');
if(isIE){//修正IE會刪除可視內容前的script,style,<!--
_doc.body.innerHTML='<img id="_xhe_temp" width="0" height="0" />'+sHtml;//修正IE會刪除&符號後面代碼的問題
$('#_xhe_temp',_doc).remove();
}
else _doc.body.innerHTML=sHtml;
}
}
this.processHTML=function(sHtml,mode)
{
var appleClass=' class="Apple-style-span"';
if(mode==='write')
{//write
sHtml=sHtml.replace(/(<(\/?)(\w+))((?:\s+[\w\-:]+\s*=\s*(?:"[^"]*"|'[^']*'|[^>\s]+))*)\s*((\/?)>)/g,function(all,left,end1,tag,attr,right,end2){
tag=tag.toLowerCase();
if(isMozilla){
if(tag==='strong')tag='b';
else if(tag==='em')tag='i';
}
else if(isSafari){
if(tag==='strong'){tag='span';if(!end1)attr+=appleClass+' style="font-weight: bold;"';}
else if(tag==='em'){tag='span';if(!end1)attr+=appleClass+' style="font-style: italic;"';}
else if(tag==='u'){tag='span';if(!end1)attr+=appleClass+' style="text-decoration: underline;"';}
else if(tag==='strike'){tag='span';if(!end1)attr+=appleClass+' style="text-decoration: line-through;"';}
}
var emot,addClass='';
if(tag==='del')tag='strike';//編輯狀態統一轉為strike
else if(tag==='img'){
//恢復emot
attr=attr.replace(/\s+emot\s*=\s*("[^"]*"|'[^']*'|[^>\s]+)/i,function(all,v){
emot=v.match(/^(["']?)(.*)\1/)[2];
emot=emot.split(',');
if(!emot[1]){emot[1]=emot[0];emot[0]=''}
if(emot[0]==='default')emot[0]='';
return settings.emotMark?all:'';
});
}
else if(tag==='a'){
if(!attr.match(/ href=[^ ]/i)&&attr.match(/ name=[^ ]/i))addClass+=' xhe-anchor';
if(end2)right='></a>';
}
else if(tag==='table'&&!end1){
var tb=attr.match(/\s+border\s*=\s*("[^"]*"|'[^']*'|[^>\s]+)/i);
if(!tb||tb[1].match(/^(["']?)\s*0\s*\1$/))addClass+=' xhe-border';
}
var bAppleClass;
//處理屬性
attr=attr.replace(/\s+([\w\-:]+)\s*=\s*("[^"]*"|'[^']*'|[^>\s]+)/g,function(all,n,v){
n=n.toLowerCase();
v=v.match(/^(["']?)(.*)\1/)[2];
aft='';//尾部增加屬性
if(isIE&&n.match(/^(disabled|checked|readonly|selected)$/)&&v.match(/^(false|0)$/i))return '';
//恢復emot
if(tag==='img'&&emot&&n==='src')return '';
//保存屬性值:src,href
if(n.match(/^(src|href)$/)){
aft=' _xhe_'+n+'="'+v+'"';
if(urlBase)v=getLocalUrl(v,'abs',urlBase);
}
//添加class
if(addClass&&n==='class'){
v+=' '+addClass;
addClass='';
}
//處理Safari style值
if(isSafari&&n==='style'){
if(tag==='span'&&v.match(/(^|;)\s*(font-family|font-size|color|background-color)\s*:\s*[^;]+\s*(;|$)/i))bAppleClass=true;
}
return ' '+n+'="'+v+'"'+aft;
});
//恢復emot
if(emot){
var url=emotPath+(emot[0]?emot[0]:'default')+'/'+emot[1]+'.gif';
attr+=' src="'+url+'" _xhe_src="'+url+'"';
}
if(bAppleClass)attr+=appleClass;
if(addClass)attr+=' class="'+addClass+'"';
return '<'+end1+tag+attr+right;
});
if(isIE)sHtml = sHtml.replace(/'/ig, ''');
if(!isSafari)
{
//style轉font
function style2font(all,tag,left,style,right,content)
{
var attrs='',f,s1,s2,c;
f=style.match(/font-family\s*:\s*([^;"]+)/i);
if(f)attrs+=' face="'+f[1]+'"';
s1=style.match(/font-size\s*:\s*([^;"]+)/i);
if(s1)
{
s1=s1[1].toLowerCase();
for(var j=0;j<arrFontsize.length;j++)if(s1===arrFontsize[j].n||s1===arrFontsize[j].s){s2=j+1;break;}
if(s2)
{
attrs+=' size="'+s2+'"';
style=style.replace(/(^|;)(\s*font-size\s*:\s*[^;"]+;?)+/ig,'$1');
}
}
c=style.match(/(?:^|[\s;])color\s*:\s*([^;"]+)/i);
if(c)
{
var rgb;
if(rgb=c[1].match(/\s*rgb\s*\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*\)/i)){
c[1]='#';
for(var i=1;i<=3;i++){
c[1]+=('0'+(rgb[i]-0).toString(16)).slice(-2);
}
}
c[1]=c[1].replace(/^#([0-9a-f])([0-9a-f])([0-9a-f])$/i,'#$1$1$2$2$3$3');
attrs+=' color="'+c[1]+'"';
}
style=style.replace(/(^|;)(\s*(font-family|color)\s*:\s*[^;"]+;?)+/ig,'$1');
if(attrs!=='')
{
if(style)attrs+=' style="'+style+'"';
return '<font'+(left?left:'')+attrs+(right?right:'')+'>'+content+"</font>";
}
else return all;
}
sHtml = sHtml.replace(/<(span)(\s+[^>]*?)?\s+style\s*=\s*"((?:[^"]*?;)?\s*(?:font-family|font-size|color)\s*:[^"]*)"( [^>]*)?>(((?!<\1(\s+[^>]*?)?>)[\s\S]|<\1(\s+[^>]*?)?>((?!<\1(\s+[^>]*?)?>)[\s\S]|<\1(\s+[^>]*?)?>((?!<\1(\s+[^>]*?)?>)[\s\S])*?<\/\1>)*?<\/\1>)*?)<\/\1>/ig,style2font);//第3層
sHtml = sHtml.replace(/<(span)(\s+[^>]*?)?\s+style\s*=\s*"((?:[^"]*?;)?\s*(?:font-family|font-size|color)\s*:[^"]*)"( [^>]*)?>(((?!<\1(\s+[^>]*?)?>)[\s\S]|<\1(\s+[^>]*?)?>((?!<\1(\s+[^>]*?)?>)[\s\S])*?<\/\1>)*?)<\/\1>/ig,style2font);//第2層
sHtml = sHtml.replace(/<(span)(\s+[^>]*?)?\s+style\s*=\s*"((?:[^"]*?;)?\s*(?:font-family|font-size|color)\s*:[^"]*)"( [^>]*)?>(((?!<\1(\s+[^>]*?)?>)[\s\S])*?)<\/\1>/ig,style2font);//最裡層
}
//表格單元格處理
sHtml = sHtml.replace(/<(td|th)(\s+[^>]*?)?>(\s| )*<\/\1>/ig,'<$1$2>'+(isIE?'':'<br />')+'</$1>');
}
else
{//read
if(isSafari)
{
//轉換apple的style為strong,em等
var arrAppleSpan=[{r:/font-weight\s*:\s*bold;?/ig,t:'strong'},{r:/font-style\s*:\s*italic;?/ig,t:'em'},{r:/text-decoration\s*:\s*underline;?/ig,t:'u'},{r:/text-decoration\s*:\s*line-through;?/ig,t:'strike'}];
function replaceAppleSpan(all,tag,attr1,attr2,content)
{
var attr=(attr1?attr1:'')+(attr2?attr2:'');
var arrPre=[],arrAft=[];
var regApple,tagApple;
for(var i=0;i<arrAppleSpan.length;i++)
{
regApple=arrAppleSpan[i].r;
tagApple=arrAppleSpan[i].t;
attr=attr.replace(regApple,function(){
arrPre.push("<"+tagApple+">");
arrAft.push("</"+tagApple+">");
return '';
});
}
attr=attr.replace(/\s+style\s*=\s*"\s*"/i,'');
return (attr?'<span'+attr+'>':'')+arrPre.join('')+content+arrAft.join('')+(attr?'</span>':'');
}
for(var i=0;i<2;i++){
sHtml = sHtml.replace(/<(span)(\s+[^>]*?)?\s+class\s*=\s*"Apple-style-span"(\s+[^>]*?)?>(((?!<\1(\s+[^>]*?)?>)[\s\S]|<\1(\s+[^>]*?)?>((?!<\1(\s+[^>]*?)?>)[\s\S]|<\1(\s+[^>]*?)?>((?!<\1(\s+[^>]*?)?>)[\s\S])*?<\/\1>)*?<\/\1>)*?)<\/\1>/ig,replaceAppleSpan);//第3層
sHtml = sHtml.replace(/<(span)(\s+[^>]*?)?\s+class\s*=\s*"Apple-style-span"(\s+[^>]*?)?>(((?!<\1(\s+[^>]*?)?>)[\s\S]|<\1(\s+[^>]*?)?>((?!<\1(\s+[^>]*?)?>)[\s\S])*?<\/\1>)*?)<\/\1>/ig,replaceAppleSpan);//第2層
sHtml = sHtml.replace(/<(span)(\s+[^>]*?)?\s+class\s*=\s*"Apple-style-span"(\s+[^>]*?)?>(((?!<\1(\s+[^>]*?)?>)[\s\S])*?)<\/\1>/ig,replaceAppleSpan);//最裡層
}
}
sHtml=sHtml.replace(/(<(\w+))((?:\s+[\w\-:]+\s*=\s*(?:"[^"]*"|'[^']*'|[^>\s]+))*)\s*(\/?>)/g,function(all,left,tag,attr,right){
tag=tag.toLowerCase();
//恢復屬性值src,href
var saveValue;
attr=attr.replace(/\s+_xhe_(?:src|href)\s*=\s*("[^"]*"|'[^']*'|[^>\s]+)/i,function(all,v){saveValue=v.match(/^(["']?)(.*)\1/)[2];return '';});
if(saveValue&&urlType)saveValue=getLocalUrl(saveValue,urlType,urlBase);
attr=attr.replace(/\s+([\w\-:]+)\s*=\s*("[^"]*"|'[^']*'|[^>\s]+)/g,function(all,n,v){
n=n.toLowerCase();
v=v.match(/^(["']?)(.*)\1/)[2].replace(/"/g,"'");
if(n==='class'){//清理class屬性
if(v.match(/^["']?(apple|webkit)/i))return '';
v=v.replace(/\s?xhe-[a-z]+/ig,'');
if(v==='')return '';
}
else if(n.match(/^((_xhe_|_moz_|_webkit_)|jquery\d+)/i))return '';//清理臨時屬性
else if(saveValue&&n.match(/^(src|href)$/i))return ' '+n+'="'+saveValue+'"';//恢復屬性值src,href
else if(n==='style'){//轉換font-size的keyword到px單位
v=v.replace(/(^|;)\s*(font-size)\s*:\s*([a-z-]+)\s*(;|$)/i,function(all,left,n,v,right){
var t,s;
for(var i=0;i<arrFontsize.length;i++)
{
t=arrFontsize[i];
if(v===t.n){s=t.s;break;}
}
return left+n+':'+s+right;
});
}
return ' '+n+'="'+v+'"';
});
//img強制加alt
if(tag==='img'&&!attr.match(/\s+alt\s*=\s*("[^"]*"|'[^']*'|[^>\s]+)/i))attr+=' alt=""';
return left+attr+right;
});
//表格單元格處理
sHtml = sHtml.replace(/(<(td|th)(?:\s+[^>]*?)?>)\s*([\s\S]*?)(<br(\s*\/)?>)?\s*<\/\2>/ig,function(all,left,tag,content){return left+(content?content:' ')+'</'+tag+'>';});
//修正瀏覽器在空內容情況下多出來的代碼
sHtml=sHtml.replace(/^\s*(?:<(p|div)(?:\s+[^>]*?)?>)?\s*(<span(?:\s+[^>]*?)?>\s*<\/span>|<br(?:\s+[^>]*?)?>| )*\s*(?:<\/\1>)?\s*$/i, '');
}
//寫和讀innerHTML前pre中<br>轉\r\n
sHtml=sHtml.replace(/(<pre(?:\s+[^>]*?)?>)([\s\S]+?)(<\/pre>)/gi,function(all,left,code,right){
return left+code.replace(/<br\s*\/?>/ig,'\r\n')+right;
});
return sHtml;
}
this.getSource=function(bFormat)
{
var sHtml,beforeGetSource=settings.beforeGetSource;
if(bSource)
{
sHtml=$('#sourceCode',_doc).val();
if(!beforeGetSource)sHtml=_this.formatXHTML(sHtml,false);
}
else
{
sHtml=_this.processHTML(_doc.body.innerHTML,'read');
sHtml=_this.cleanHTML(sHtml);
sHtml=_this.formatXHTML(sHtml,bFormat);
if(beforeGetSource)sHtml=beforeGetSource(sHtml);
}
_text.value=sHtml;
return sHtml;
}
this.cleanWord=function(sHtml)
{
var cleanPaste=settings.cleanPaste;
if(cleanPaste>0&&cleanPaste<3&&/mso(-|normal)|WordDocument|<table\s+[^>]*?x:str|\s+class\s*=\s*"?xl[67]\d"/i.test(sHtml))
{
//區塊標籤清理
sHtml = sHtml.replace(/<!--[\s\S]*?-->|<!(--)?\[[\s\S]+?\](--)?>|<style(\s+[^>]*?)?>[\s\S]*?<\/style>/ig, '');
sHtml = sHtml.replace(/\r?\n/ig, '');
//保留Word圖片佔位
if(isIE){
sHtml = sHtml.replace(/<v:shapetype(\s+[^>]*)?>[\s\S]*<\/v:shapetype>/ig,'');
sHtml = sHtml.replace(/<v:shape(\s+[^>]+)?>[\s\S]*?<v:imagedata(\s+[^>]+)?>\s*<\/v:imagedata>[\s\S]*?<\/v:shape>/ig,function(all,attr1,attr2){
var match;
match = attr2.match(/\s+src\s*=\s*("[^"]+"|'[^']+'|[^>\s]+)/i);
if(match){
match = match[1].match(/^(["']?)(.*)\1/)[2];
var sImg ='<img src="'+editorRoot+'xheditor_skin/blank.gif'+'" _xhe_temp="true" class="wordImage"';
match = attr1.match(/\s+style\s*=\s*("[^"]+"|'[^']+'|[^>\s]+)/i);
if(match){
match = match[1].match(/^(["']?)(.*)\1/)[2];
sImg += ' style="' + match + '"';
}
sImg += ' />';
return sImg;
}
return '';
});
}
else{
sHtml = sHtml.replace(/<img( [^<>]*(v:shapes|msohtmlclip)[^<>]*)\/?>/ig,function(all,attr){
var match,str = '<img src="'+editorRoot+'xheditor_skin/blank.gif'+'" _xhe_temp="true" class="wordImage"';
match = attr.match(/ width\s*=\s*"([^"]+)"/i);
if(match)str += ' width="'+match[1]+'"';
match = attr.match(/ height\s*=\s*"([^"]+)"/i);
if(match)str += ' height="'+match[1]+'"';
return str + ' />';
});
}
sHtml=sHtml.replace(/(<(\/?)([\w\-:]+))((?:\s+[\w\-:]+(?:\s*=\s*(?:"[^"]*"|'[^']*'|[^>\s]+))?)*)\s*(\/?>)/g,function(all,left,end,tag,attr,right){
tag=tag.toLowerCase();
if((tag.match(/^(link)$/)&&attr.match(/file:\/\//i))||tag.match(/:/)||(tag==='span'&&cleanPaste===2))return '';
if(!end){
attr=attr.replace(/\s([\w\-:]+)(?:\s*=\s*("[^"]*"|'[^']*'|[^>\s]+))?/ig,function(all,n,v){
n=n.toLowerCase();
if(/:/.test(n))return '';
v=v.match(/^(["']?)(.*)\1/)[2];
if(cleanPaste===1){//簡單清理
switch(tag){
case 'p':
if(n === 'style'){
v=v.replace(/"|"/ig,"'").replace(/\s*([^:]+)\s*:\s*(.*?)(;|$)/ig,function(all,n,v){
return /^(text-align)$/i.test(n)?(n+':'+v+';'):'';
}).replace(/^\s+|\s+$/g,'');
return v?(' '+n+'="'+v+'"'):'';
}
break;
case 'span':
if(n === 'style'){
v=v.replace(/"|"/ig,"'").replace(/\s*([^:]+)\s*:\s*(.*?)(;|$)/ig,function(all,n,v){
return /^(color|background|font-size|font-family)$/i.test(n)?(n+':'+v+';'):'';
}).replace(/^\s+|\s+$/g,'');
return v?(' '+n+'="'+v+'"'):'';
}
break;
case 'table':
if(n.match(/^(cellspacing|cellpadding|border|width)$/i))return all;
break;
case 'td':
if(n.match(/^(rowspan|colspan)$/i))return all;
if(n === 'style'){
v=v.replace(/"|"/ig,"'").replace(/\s*([^:]+)\s*:\s*(.*?)(;|$)/ig,function(all,n,v){
return /^(width|height)$/i.test(n)?(n+':'+v+';'):'';
}).replace(/^\s+|\s+$/g,'');
return v?(' '+n+'="'+v+'"'):'';
}
break;
case 'a':
if(n.match(/^(href)$/i))return all;
break;
case 'font':
case 'img':
return all;
break;
}
}
else if(cleanPaste===2){
switch(tag){
case 'td':
if(n.match(/^(rowspan|colspan)$/i))return all;
break;
case 'img':
return all;
}
}
return '';
});
}
return left+attr+right;
});
//空內容的標籤
for(var i=0;i<3;i++)sHtml = sHtml.replace( /<([^\s>]+)(\s+[^>]*)?>\s*<\/\1>/g,'');
//無屬性的無意義標籤
function cleanEmptyTag(all,tag,content){
return content;
}
for(var i=0;i<3;i++)sHtml = sHtml.replace(/<(span|a)>(((?!<\1(\s+[^>]*?)?>)[\s\S]|<\1(\s+[^>]*?)?>((?!<\1(\s+[^>]*?)?>)[\s\S]|<\1(\s+[^>]*?)?>((?!<\1(\s+[^>]*?)?>)[\s\S])*?<\/\1>)*?<\/\1>)*?)<\/\1>/ig,cleanEmptyTag);//第3層
for(var i=0;i<3;i++)sHtml = sHtml.replace(/<(span|a)>(((?!<\1(\s+[^>]*?)?>)[\s\S]|<\1(\s+[^>]*?)?>((?!<\1(\s+[^>]*?)?>)[\s\S])*?<\/\1>)*?)<\/\1>/ig,cleanEmptyTag);//第2層
for(var i=0;i<3;i++)sHtml = sHtml.replace(/<(span|a)>(((?!<\1(\s+[^>]*?)?>)[\s\S])*?)<\/\1>/ig,cleanEmptyTag);//最裡層
//合併多個font
for(var i=0;i<3;i++)sHtml = sHtml.replace(/<font(\s+[^>]+)><font(\s+[^>]+)>/ig,function(all,attr1,attr2){
return '<font'+attr1+attr2+'>';
});
//清除表格間隙裡的空格等特殊字符
sHtml=sHtml.replace(/(<(\/?)(tr|td)(?:\s+[^>]+)?>)[^<>]+/ig,function(all,left,end,tag){
if(!end&&/^td$/i.test(tag))return all;
else return left;
});
}
return sHtml;
}
this.cleanHTML=function(sHtml)
{
sHtml = sHtml.replace(/<!?\/?(DOCTYPE|html|body|meta)(\s+[^>]*?)?>/ig, '');
var arrHeadSave;sHtml = sHtml.replace(/<head(?:\s+[^>]*?)?>([\s\S]*?)<\/head>/i, function(all,content){arrHeadSave=content.match(/<(script|style)(\s+[^>]*?)?>[\s\S]*?<\/\1>/ig);return '';});
if(arrHeadSave)sHtml=arrHeadSave.join('')+sHtml;
sHtml = sHtml.replace(/<\??xml(:\w+)?(\s+[^>]*?)?>([\s\S]*?<\/xml>)?/ig, '');
if(!settings.internalScript)sHtml = sHtml.replace(/<script(\s+[^>]*?)?>[\s\S]*?<\/script>/ig, '');
if(!settings.internalStyle)sHtml = sHtml.replace(/<style(\s+[^>]*?)?>[\s\S]*?<\/style>/ig, '');
if(!settings.linkTag||!settings.inlineScript||!settings.inlineStyle)sHtml=sHtml.replace(/(<(\w+))((?:\s+[\w-]+\s*=\s*(?:"[^"]*"|'[^']*'|[^>\s]+))*)\s*(\/?>)/ig,function(all,left,tag,attr,right){
if(!settings.linkTag&&tag.toLowerCase()==='link')return '';
if(!settings.inlineScript)attr=attr.replace(/\s+on(?:click|dblclick|mouse(down|up|move|over|out|enter|leave|wheel)|key(down|press|up)|change|select|submit|reset|blur|focus|load|unload)\s*=\s*("[^"]*"|'[^']*'|[^>\s]+)/ig,'');
if(!settings.inlineStyle)attr=attr.replace(/\s+(style|class)\s*=\s*("[^"]*"|'[^']*'|[^>\s]+)/ig,'');
return left+attr+right;
});
sHtml=sHtml.replace(/<\/(strong|b|u|strike|em|i)>((?:\s|<br\/?>| )*?)<\1(\s+[^>]*?)?>/ig,'$2');//連續相同標籤
return sHtml;
}
this.formatXHTML=function(sHtml,bFormat){
var emptyTags = makeMap("area,base,basefont,br,col,frame,hr,img,input,isindex,link,meta,param,embed");//HTML 4.01
var blockTags = makeMap("address,applet,blockquote,button,center,dd,dir,div,dl,dt,fieldset,form,frameset,h1,h2,h3,h4,h5,h6,hr,iframe,ins,isindex,li,map,menu,noframes,noscript,object,ol,p,pre,table,tbody,td,tfoot,th,thead,tr,ul,script");//HTML 4.01
var inlineTags = makeMap("a,abbr,acronym,applet,b,basefont,bdo,big,br,button,cite,code,del,dfn,em,font,i,iframe,img,input,ins,kbd,label,map,object,q,s,samp,script,select,small,span,strike,strong,sub,sup,textarea,tt,u,var");//HTML 4.01
var closeSelfTags = makeMap("colgroup,dd,dt,li,options,p,td,tfoot,th,thead,tr");
var fillAttrsTags = makeMap("checked,compact,declare,defer,disabled,ismap,multiple,nohref,noresize,noshade,nowrap,readonly,selected");
var cdataTags = makeMap("script,style");
var tagReplac={'b':'strong','i':'em','s':'del','strike':'del'};
var regTag=/<(?:\/([^\s>]+)|!([^>]*?)|([\w\-:]+)((?:"[^"]*"|'[^']*'|[^"'<>])*)\s*(\/?))>/g;
var regAttr = /\s*([\w\-:]+)(?:\s*=\s*(?:"([^"]*)"|'([^']*)'|([^\s]+)))?/g;
var results=[],stack=[];
stack.last = function(){return this[ this.length - 1 ];};
var match,tagIndex,nextIndex=0,tagName,tagCDATA,arrCDATA,text;
var lvl=-1,lastTag='body',lastTagStart,stopFormat=false;
while(match=regTag.exec(sHtml)){
tagIndex = match.index;
if(tagIndex>nextIndex){//保存前面的文本或者CDATA
text=sHtml.substring(nextIndex,tagIndex);
if(tagCDATA)arrCDATA.push(text);
else onText(text);
}
nextIndex = regTag.lastIndex;
if(tagName=match[1]){//結束標籤
tagName=processTag(tagName);
if(tagCDATA&&tagName===tagCDATA){//結束標籤前輸出CDATA
onCDATA(arrCDATA.join(''));
tagCDATA=null;
arrCDATA=null;
}
if(!tagCDATA){
onEndTag(tagName);
continue;
}
}
if(tagCDATA)arrCDATA.push(match[0]);
else{
if(tagName=match[3]){//開始標籤
tagName=processTag(tagName);
onStartTag(tagName,match[4],match[5]);
if(cdataTags[tagName]){
tagCDATA=tagName;
arrCDATA=[];
}
}
else if(match[2])onComment(match[0]);//註釋標籤
}
}
if(sHtml.length>nextIndex)onText(sHtml.substring(nextIndex,sHtml.length ));//結尾文本
onEndTag();//封閉未結束的標籤
sHtml=results.join('');
results=null;
function makeMap(str)
{
var obj = {}, items = str.split(",");
for ( var i = 0; i < items.length; i++ )obj[ items[i] ] = true;
return obj;
}
function processTag(tagName)
{
tagName=tagName.toLowerCase();
var tag=tagReplac[tagName];
return tag?tag:tagName;
}
function onStartTag(tagName,rest,unary)
{
if(blockTags[tagName])while(stack.last()&&inlineTags[stack.last()])onEndTag(stack.last());//塊標籤
if(closeSelfTags[tagName]&&stack.last()===tagName)onEndTag(tagName);//自封閉標籤
unary = emptyTags[ tagName ] || !!unary;
if (!unary)stack.push(tagName);
var all=Array();
all.push('<' + tagName);
rest.replace(regAttr, function(match, name)
{
name=name.toLowerCase();
var value = arguments[2] ? arguments[2] :
arguments[3] ? arguments[3] :
arguments[4] ? arguments[4] :
fillAttrsTags[name] ? name : "";
all.push(' '+name+'="'+value.replace(/"/g,"'")+'"');
});
all.push((unary ? " /" : "") + ">");
addHtmlFrag(all.join(''),tagName,true);
if(tagName==='pre')stopFormat=true;
}
function onEndTag(tagName)
{
if(!tagName)var pos=0;//清空棧
else for(var pos=stack.length-1;pos>=0;pos--)if(stack[pos]===tagName)break;//向上尋找匹配的開始標籤
if(pos>=0)
{
for(var i=stack.length-1;i>=pos;i--)addHtmlFrag("</" + stack[i] + ">",stack[i]);
stack.length=pos;
}
if(tagName==='pre'){
stopFormat=false;
lvl--;
}
}
function onText(text){
addHtmlFrag(_this.domEncode(text));
}
function onCDATA(text){
results.push(text.replace(/^[\s\r\n]+|[\s\r\n]+$/g,''));
}
function onComment(text){
results.push(text);
}
function addHtmlFrag(html,tagName,bStart)
{
if(!stopFormat)html=html.replace(/(\t*\r?\n\t*)+/g,'');//清理換行符和相鄰的製表符
if(!stopFormat&&bFormat===true)
{
if(html.match(/^\s*$/)){//不格式化空內容的標籤
results.push(html);
return;
}
var bBlock=blockTags[tagName],tag=bBlock?tagName:'';
if(bBlock)
{
if(bStart)lvl++;//塊開始
if(lastTag==='')lvl--;//補文本結束
}
else if(lastTag)lvl++;//文本開始
if(tag!==lastTag||bBlock)addIndent();
results.push(html);
if(tagName==='br')addIndent();//回車強制換行
if(bBlock&&(emptyTags[tagName]||!bStart))lvl--;//塊結束
lastTag=bBlock?tagName:'';lastTagStart=bStart;
}
else results.push(html);
}
function addIndent(){results.push('\r\n');if(lvl>0){var tabs=lvl;while(tabs--)results.push("\t");}}
//font轉style
function font2style(all,tag,attrs,content)
{
if(!attrs)return content;
var styles='',f,s,c,style;
attrs=attrs.replace(/ face\s*=\s*"\s*([^"]*)\s*"/i,function(all,v){
if(v)styles+='font-family:'+v+';';
return '';
});
attrs=attrs.replace(/ size\s*=\s*"\s*(\d+)\s*"/i,function(all,v){
styles+='font-size:'+arrFontsize[(v>7?7:(v<1?1:v))-1].s+';';
return '';
});
attrs=attrs.replace(/ color\s*=\s*"\s*([^"]*)\s*"/i,function(all,v){
if(v)styles+='color:'+v+';';
return '';
});
attrs=attrs.replace(/ style\s*=\s*"\s*([^"]*)\s*"/i,function(all,v){
if(v)styles+=v;
return '';
});
attrs+=' style="'+styles+'"';
return attrs?('<span'+attrs+'>'+content+'</span>'):content;
}
sHtml = sHtml.replace(/<(font)(\s+[^>]*?)?>(((?!<\1(\s+[^>]*?)?>)[\s\S]|<\1(\s+[^>]*?)?>((?!<\1(\s+[^>]*?)?>)[\s\S]|<\1(\s+[^>]*?)?>((?!<\1(\s+[^>]*?)?>)[\s\S])*?<\/\1>)*?<\/\1>)*?)<\/\1>/ig,font2style);//第3層
sHtml = sHtml.replace(/<(font)(\s+[^>]*?)?>(((?!<\1(\s+[^>]*?)?>)[\s\S]|<\1(\s+[^>]*?)?>((?!<\1(\s+[^>]*?)?>)[\s\S])*?<\/\1>)*?)<\/\1>/ig,font2style);//第2層
sHtml = sHtml.replace(/<(font)(\s+[^>]*?)?>(((?!<\1(\s+[^>]*?)?>)[\s\S])*?)<\/\1>/ig,font2style);//最裡層
sHtml = sHtml.replace(/^(\s*\r?\n)+|(\s*\r?\n)+$/g,'');//清理首尾換行
return sHtml;
}
this.toggleShowBlocktag=function(state)
{
if(bShowBlocktag===state)return;
bShowBlocktag=!bShowBlocktag;
var _jBody=$(_doc.body);
if(bShowBlocktag)
{
bodyClass+=' showBlocktag';
_jBody.addClass('showBlocktag');
}
else
{
bodyClass=bodyClass.replace(' showBlocktag','');
_jBody.removeClass('showBlocktag');
}
}
this.toggleSource=function(state)
{
if(bSource===state)return;
_jTools.find('[cmd=Source]').toggleClass('xheEnabled').toggleClass('xheActive');
var _body=_doc.body,jBody=$(_body),sHtml;
var sourceCode,cursorMark='<span id="_xhe_cursor"></span>',cursorPos=0;
var txtSourceTitle='';
if(!bSource)
{//轉為原始碼模式
_this.pasteHTML(cursorMark,true);//標記當前位置
sHtml=_this.getSource(true);
cursorPos=sHtml.indexOf(cursorMark);
if(!isOpera)cursorPos=sHtml.substring(0,cursorPos).replace(/\r/g,'').length;//修正非opera光標定位點
sHtml=sHtml.replace(/(\r?\n\s*|)<span id="_xhe_cursor"><\/span>(\s*\r?\n|)/,function(all,left,right){
return left&&right?'\r\n':left+right;//只有定位符的空行刪除當前行
});
if(isIE)_body.contentEditable='false';
else _doc.designMode = 'Off';
jBody.attr('scroll','no').attr('class','sourceMode').html('<textarea id="sourceCode" wrap="soft" spellcheck="false" style="width:100%;height:100%" />');
sourceCode=$('#sourceCode',jBody).blur(_this.getSource)[0];
txtSourceTitle='可視化編輯';
}
else
{//轉為編輯模式
sHtml=_this.getSource();
jBody.html('').removeAttr('scroll').attr('class','editMode'+bodyClass);
if(isIE)_body.contentEditable='true';
else _doc.designMode = 'On';
if(isMozilla)
{
_this._exec("inserthtml","-");//修正firefox原始碼切換回來無法刪除文字的問題
$('#'+idFixFFCursor).show().focus().hide();//臨時修正Firefox 3.6光標丟失問題
}
txtSourceTitle='原始碼';
}
bSource=!bSource;
_this.setSource(sHtml);
_this.focus();
if(bSource)//光標定位源碼
{
if(sourceCode.setSelectionRange)sourceCode.setSelectionRange(cursorPos, cursorPos);
else
{
var rng = sourceCode.createTextRange();
rng.move("character",cursorPos);
rng.select();
}
}
else _this.setTextCursor();//定位最前面
_jTools.find('[cmd=Source]').attr('title',txtSourceTitle).find('span').text(txtSourceTitle);
_jTools.find('[cmd=Source],[cmd=Preview]').toggleClass('xheEnabled');
_jTools.find('.xheButton').not('[cmd=Source],[cmd=Fullscreen],[cmd=About]').toggleClass('xheEnabled').attr('aria-disabled',bSource?true:false);//無障礙支持
setTimeout(setOpts,300);
}
this.showPreview=function()
{
var beforeSetSource=settings.beforeSetSource,sContent=_this.getSource();
if(beforeSetSource)sContent=beforeSetSource(sContent);
var sHTML='<html><head>'+headHTML+'<title>預覽</title>'+(urlBase?'<base href="'+urlBase+'"/>':'')+'</head><body>' + sContent + '</body></html>';
var screen=window.screen,oWindow=window.open('', 'xhePreview', 'toolbar=yes,location=no,status=yes,menubar=yes,scrollbars=yes,resizable=yes,width='+Math.round(screen.width*0.9)+',height='+Math.round(screen.height*0.8)+',left='+Math.round(screen.width*0.05)),oDoc=oWindow.document;
oDoc.open();
oDoc.write(sHTML);
oDoc.close();
oWindow.focus();
}
this.toggleFullscreen=function(state)
{
if(bFullscreen===state)return;
var jLayout=$('#'+idContainer).find('.xheLayout'),jContainer=$('#'+idContainer),browserVer=jQuery.browser.version,isIE67=(isIE&&(browserVer==6||browserVer==7));
if(bFullscreen)
{//取消全屏
if(isIE67)_jText.after(jContainer);
jLayout.attr('style',sLayoutStyle);
_jArea.height(editorHeight-_jTools.outerHeight());
$(window).scrollTop(outerScroll);
setTimeout(function(){$(window).scrollTop(outerScroll);},10);//Firefox需要延遲設置
}
else
{//顯示全屏
if(isIE67)$('body').append(jContainer);
outerScroll=$(window).scrollTop();
sLayoutStyle=jLayout.attr('style');
jLayout.removeAttr('style');
_jArea.height('100%');
setTimeout(fixFullHeight,100);
}
if(isMozilla)//臨時修正Firefox 3.6原始碼光標丟失問題
{
$('#'+idFixFFCursor).show().focus().hide();
setTimeout(_this.focus,1);
}
else if(isIE67)_this.setTextCursor();
bFullscreen=!bFullscreen;
jContainer.toggleClass('xhe_Fullscreen');
$('html').toggleClass('xhe_Fullfix');
_jTools.find('[cmd=Fullscreen]').toggleClass('xheActive');
setTimeout(setOpts,300);
}
this.showMenu=function(menuitems,callback)
{
var jMenu=$('<div class="xheMenu"></div>'),menuSize=menuitems.length,arrItem=[];
$.each(menuitems,function(n,v){
if(v.s==='-'){
arrItem.push('<div class="xheMenuSeparator"></div>');
}else{
arrItem.push('<a href="javascript:void(\''+v.v+'\')" title="'+(v.t?v.t:v.s)+'" v="'+v.v+'" role="option" aria-setsize="'+menuSize+'" aria-posinset="'+(n+1)+'" tabindex="0">'+v.s+'</a>');
}
});
jMenu.append(arrItem.join(''));
jMenu.click(function(ev){
ev=ev.target;
if($.nodeName(ev,'DIV'))return;
_this.loadBookmark();
callback($(ev).closest('a').attr('v'));
_this.hidePanel();
return false;
}).mousedown(returnFalse);
_this.saveBookmark();
_this.showPanel(jMenu);
}
this.showColor=function(callback)
{
var jColor=$('<div class="xheColor"></div>'),arrItem=[],colorSize=itemColors.length,count=0;
$.each(itemColors,function(n,v)
{
if(count%7===0)arrItem.push((count>0?'</div>':'')+'<div>');
arrItem.push('<a href="javascript:void(\''+v+'\')" xhev="'+v+'" title="'+v+'" style="background:'+v+'" role="option" aria-setsize="'+colorSize+'" aria-posinset="'+(count+1)+'"></a>');
count++;
});
arrItem.push('</div>');
jColor.append(arrItem.join(''));
jColor.click(function(ev){
ev=ev.target;
if(!$.nodeName(ev,'A'))return;
_this.loadBookmark();
callback($(ev).attr('xhev'));
_this.hidePanel();
return false;
}).mousedown(returnFalse);
_this.saveBookmark();
_this.showPanel(jColor);
}
this.showPastetext=function()
{
var jPastetext=$(htmlPastetext),jValue=$('#xhePastetextValue',jPastetext),jSave=$('#xheSave',jPastetext);
jSave.click(function(){
_this.loadBookmark();
var sValue=jValue.val();
if(sValue)_this.pasteText(sValue);
_this.hidePanel();
return false;
});
_this.saveBookmark();
_this.showDialog(jPastetext);
}
this.showLink=function()
{
var htmlTemp=htmlLink,$arrAnchor=_jDoc.find('a[name]').not('[href]'),haveAnchor=$arrAnchor.length>0;
if(haveAnchor){//頁內有錨點
var arrAnchorOptions=[];
$arrAnchor.each(function(){
var name=$(this).attr('name');
arrAnchorOptions.push('<option value="#'+name+'">'+name+'</option>');
});
htmlTemp=htmlTemp.replace(/(<div><label for="xheLinkTarget)/,'<div><label for="xheLinkAnchor">頁內錨點: </label><select id="xheLinkAnchor"><option value="">未選擇</option>'+arrAnchorOptions.join('')+'</select></div>$1');
}
var jLink=$(htmlTemp),jParent=_this.getParent('a'),jText=$('#xheLinkText',jLink),jUrl=$('#xheLinkUrl',jLink),jTarget=$('#xheLinkTarget',jLink),jSave=$('#xheSave',jLink),selHtml=_this.getSelect();
if(haveAnchor){
jLink.find('#xheLinkAnchor').change(function(){
var anchor=$(this).val();
if(anchor!='')jUrl.val(anchor);
});
}
if(jParent.length===1)
{
if(!jParent.attr('href')){//錨點
ev=null;
return _this.exec('Anchor');
}
jUrl.val(xheAttr(jParent,'href'));
jTarget.attr('value',jParent.attr('target'));
}
else if(selHtml==='')jText.val(settings.defLinkText).closest('div').show();
if(settings.upLinkUrl)_this.uploadInit(jUrl,settings.upLinkUrl,settings.upLinkExt);
jSave.click(function(){
_this.loadBookmark();
var url=jUrl.val();
if(url===''||jParent.length===0)_this._exec('unlink');
if(url!==''&&url!=='http://')
{
var aUrl=url.split(' '),sTarget=jTarget.val(),sText=jText.val();
if(aUrl.length>1)
{//批量插入
_this._exec('unlink');//批量前刪除當前鏈接並重新獲取選擇內容
selHtml=_this.getSelect();
var sTemplate='<a href="xhe_tmpurl"',sLink,arrLink=[];
if(sTarget!=='')sTemplate+=' target="'+sTarget+'"';
sTemplate+='>xhe_tmptext</a>';
sText=(selHtml!==''?selHtml:(sText?sText:url));
for(var i=0,c=aUrl.length;i<c;i++)
{
url=aUrl[i];
if(url!=='')
{
url=url.split('||');
sLink=sTemplate;
sLink=sLink.replace('xhe_tmpurl',url[0]);
sLink=sLink.replace('xhe_tmptext',url[1]?url[1]:sText);
arrLink.push(sLink);
}
}
_this.pasteHTML(arrLink.join(' '));
}
else
{//單url模式
url=aUrl[0].split('||');
if(!sText)sText=url[0];
sText=url[1]?url[1]:(selHtml!=='')?'':sText?sText:url[0];
if(jParent.length===0)
{
if(sText)_this.pasteHTML('<a href="#xhe_tmpurl">'+sText+'</a>');
else _this._exec('createlink','#xhe_tmpurl');
jParent=$('a[href$="#xhe_tmpurl"]',_doc);
}
else if(sText&&!isSafari)jParent.text(sText);//safari改寫文本會導致光標丟失
xheAttr(jParent,'href',url[0]);
if(sTarget!=='')jParent.attr('target',sTarget);
else jParent.removeAttr('target');
}
}
_this.hidePanel();
return false;
});
_this.saveBookmark();
_this.showDialog(jLink);
}
this.showAnchor=function(){
var jAnchor=$(htmlAnchor),jParent=_this.getParent('a'),jName=$('#xheAnchorName',jAnchor),jSave=$('#xheSave',jAnchor);
if(jParent.length===1){
if(jParent.attr('href')){//超連結
ev=null;
return _this.exec('Link');
}
jName.val(jParent.attr('name'));
}
jSave.click(function(){
_this.loadBookmark();
var name=jName.val();
if(name){
if(jParent.length===0)_this.pasteHTML('<a name="'+name+'"></a>');
else jParent.attr('name',name);
}
else if(jParent.length===1)jParent.remove();
_this.hidePanel();
return false;
});
_this.saveBookmark();
_this.showDialog(jAnchor);
}
this.showImg=function()
{
var jImg=$(htmlImg),jParent=_this.getParent('img'),jUrl=$('#xheImgUrl',jImg),jAlt=$('#xheImgAlt',jImg),jAlign=$('#xheImgAlign',jImg),jWidth=$('#xheImgWidth',jImg),jHeight=$('#xheImgHeight',jImg),jBorder=$('#xheImgBorder',jImg),jVspace=$('#xheImgVspace',jImg),jHspace=$('#xheImgHspace',jImg),jSave=$('#xheSave',jImg);
if(jParent.length===1)
{
jUrl.val(xheAttr(jParent,'src'));
jAlt.val(jParent.attr('alt'));
jAlign.val(jParent.attr('align'));
jWidth.val(jParent.attr('width'));
jHeight.val(jParent.attr('height'));
jBorder.val(jParent.attr('border'));
var vspace=jParent.attr('vspace'),hspace=jParent.attr('hspace');
jVspace.val(vspace<=0?'':vspace);
jHspace.val(hspace<=0?'':hspace);
}
if(settings.upImgUrl)_this.uploadInit(jUrl,settings.upImgUrl,settings.upImgExt);
jSave.click(function(){
_this.loadBookmark();
var url=jUrl.val();
if(url!==''&&url!=='http://')
{
var aUrl=url.split(' '),sAlt=jAlt.val(),sAlign=jAlign.val(),sWidth=jWidth.val(),sHeight=jHeight.val(),sBorder=jBorder.val(),sVspace=jVspace.val(),sHspace=jHspace.val();;
if(aUrl.length>1)
{//批量插入
var sTemplate='<img src="xhe_tmpurl"',sImg,arrImg=[];
if(sAlt!=='')sTemplate+=' alt="'+sAlt+'"';
if(sAlign!=='')sTemplate+=' align="'+sAlign+'"';
if(sWidth!=='')sTemplate+=' width="'+sWidth+'"';
if(sHeight!=='')sTemplate+=' height="'+sHeight+'"';
if(sBorder!=='')sTemplate+=' border="'+sBorder+'"';
if(sVspace!=='')sTemplate+=' vspace="'+sVspace+'"';
if(sHspace!=='')sTemplate+=' hspace="'+sHspace+'"';
sTemplate+=' />';
for(var i in aUrl)
{
url=aUrl[i];
if(url!=='')
{
url=url.split('||');
sImg=sTemplate;
sImg=sImg.replace('xhe_tmpurl',url[0]);
if(url[1])sImg='<a href="'+url[1]+'" target="_blank">'+sImg+'</a>'
arrImg.push(sImg);
}
}
_this.pasteHTML(arrImg.join(' '));
}
else if(aUrl.length===1)
{//單URL模式
url=aUrl[0];
if(url!=='')
{
url=url.split('||');
if(jParent.length===0)
{
_this.pasteHTML('<img src="'+url[0]+'#xhe_tmpurl" />');
jParent=$('img[src$="#xhe_tmpurl"]',_doc);
}
xheAttr(jParent,'src',url[0]);
if(sAlt!=='')jParent.attr('alt',sAlt);
if(sAlign!=='')jParent.attr('align',sAlign);
else jParent.removeAttr('align');
if(sWidth!=='')jParent.attr('width',sWidth);
else jParent.removeAttr('width');
if(sHeight!=='')jParent.attr('height',sHeight);
else jParent.removeAttr('height');
if(sBorder!=='')jParent.attr('border',sBorder);
else jParent.removeAttr('border');
if(sVspace!=='')jParent.attr('vspace',sVspace);
else jParent.removeAttr('vspace');
if(sHspace!=='')jParent.attr('hspace',sHspace);
else jParent.removeAttr('hspace');
if(url[1])
{
var jLink=jParent.parent('a');
if(jLink.length===0)
{
jParent.wrap('<a></a>');
jLink=jParent.parent('a');
}
xheAttr(jLink,'href',url[1]);
jLink.attr('target','_blank');
}
}
}
}
else if(jParent.length===1)jParent.remove();
_this.hidePanel();
return false;
});
_this.saveBookmark();
_this.showDialog(jImg);
}
this.showEmbed=function(sType,sHtml,sMime,sClsID,sBaseAttrs,sUploadUrl,sUploadExt)
{
var jEmbed=$(sHtml),jParent=_this.getParent('embed[type="'+sMime+'"],embed[classid="'+sClsID+'"]'),jUrl=$('#xhe'+sType+'Url',jEmbed),jWidth=$('#xhe'+sType+'Width',jEmbed),jHeight=$('#xhe'+sType+'Height',jEmbed),jSave=$('#xheSave',jEmbed);
if(sUploadUrl)_this.uploadInit(jUrl,sUploadUrl,sUploadExt);
if(jParent.length===1)
{
jUrl.val(xheAttr(jParent,'src'));
jWidth.val(jParent.attr('width'));
jHeight.val(jParent.attr('height'));
}
jSave.click(function(){
_this.loadBookmark();
var url=jUrl.val();
if(url!==''&&url!=='http://')
{
var w=jWidth.val(),h=jHeight.val(),reg=/^\d+%?$/;
if(!reg.test(w))w=412;if(!reg.test(h))h=300;
var sBaseCode='<embed type="'+sMime+'" classid="'+sClsID+'" src="xhe_tmpurl"'+sBaseAttrs;
var aUrl=url.split(' ');
if(aUrl.length>1)
{//批量插入
var sTemplate=sBaseCode+'',sEmbed,arrEmbed=[];
sTemplate+=' width="xhe_width" height="xhe_height" />';
for(var i in aUrl)
{
url=aUrl[i].split('||');
sEmbed=sTemplate;
sEmbed=sEmbed.replace('xhe_tmpurl',url[0])
sEmbed=sEmbed.replace('xhe_width',url[1]?url[1]:w)
sEmbed=sEmbed.replace('xhe_height',url[2]?url[2]:h)
if(url!=='')arrEmbed.push(sEmbed);
}
_this.pasteHTML(arrEmbed.join(' '));
}
else if(aUrl.length===1)
{//單URL模式
url=aUrl[0].split('||');
if(jParent.length===0)
{
_this.pasteHTML(sBaseCode.replace('xhe_tmpurl',url[0]+'#xhe_tmpurl')+' />');
jParent=$('embed[src$="#xhe_tmpurl"]',_doc);
}
xheAttr(jParent,'src',url[0]);
jParent.attr('width',url[1]?url[1]:w);
jParent.attr('height',url[2]?url[2]:h);
}
}
else if(jParent.length===1)jParent.remove();
_this.hidePanel();
return false;
});
_this.saveBookmark();
_this.showDialog(jEmbed);
}
this.showEmot=function(group)
{
var jEmot=$('<div class="xheEmot"></div>');
group=group?group:(selEmotGroup?selEmotGroup:'default');
var arrEmot=arrEmots[group];
var sEmotPath=emotPath+group+'/',n=0,arrList=[],jList='';
var ew=arrEmot.width,eh=arrEmot.height,line=arrEmot.line,count=arrEmot.count,list=arrEmot.list;
if(count)
{
for(var i=1;i<=count;i++)
{
n++;
arrList.push('<a href="javascript:void(\''+i+'\')" style="background-image:url('+sEmotPath+i+'.gif);" emot="'+group+','+i+'" xhev="" title="'+i+'" role="option"> </a>');
if(n%line===0)arrList.push('<br />');
}
}
else
{
$.each(list,function(id,title)
{
n++;
arrList.push('<a href="javascript:void(\''+title+'\')" style="background-image:url('+sEmotPath+id+'.gif);" emot="'+group+','+id+'" title="'+title+'" xhev="'+title+'" role="option"> </a>');
if(n%line===0)arrList.push('<br />');
});
}
var w=line*(ew+12),h=Math.ceil(n/line)*(eh+12),mh=w*0.75;
if(h<=mh)mh='';
jList=$('<style>'+(mh?'.xheEmot div{width:'+(w+20)+'px;height:'+mh+'px;}':'')+'.xheEmot div a{width:'+ew+'px;height:'+eh+'px;}</style><div>'+arrList.join('')+'</div>').click(function(ev){ev=ev.target;var jA=$(ev);if(!$.nodeName(ev,'A'))return;_this.loadBookmark();_this.pasteHTML('<img emot="'+jA.attr('emot')+'" alt="'+jA.attr('xhev')+'">');_this.hidePanel();return false;}).mousedown(returnFalse);
jEmot.append(jList);
var gcount=0,arrGroup=['<ul role="tablist">'],jGroup;//表情分類
$.each(arrEmots,function(g,v){
gcount++;
arrGroup.push('<li'+(group===g?' class="cur"':'')+' role="presentation"><a href="javascript:void(\''+v.name+'\')" group="'+g+'" role="tab" tabindex="0">'+v.name+'</a></li>');
});
if(gcount>1)
{
arrGroup.push('</ul><br style="clear:both;" />');
jGroup=$(arrGroup.join('')).click(function(ev){selEmotGroup=$(ev.target).attr('group');_this.exec('Emot');return false;}).mousedown(returnFalse);
jEmot.append(jGroup);
}
_this.saveBookmark();
_this.showPanel(jEmot);
}
this.showTable=function()
{
var jTable=$(htmlTable),jRows=$('#xheTableRows',jTable),jColumns=$('#xheTableColumns',jTable),jHeaders=$('#xheTableHeaders',jTable),jWidth=$('#xheTableWidth',jTable),jHeight=$('#xheTableHeight',jTable),jBorder=$('#xheTableBorder',jTable),jCellSpacing=$('#xheTableCellSpacing',jTable),jCellPadding=$('#xheTableCellPadding',jTable),jAlign=$('#xheTableAlign',jTable),jCaption=$('#xheTableCaption',jTable),jSave=$('#xheSave',jTable);
jSave.click(function(){
_this.loadBookmark();
var sCaption=jCaption.val(),sBorder=jBorder.val(),sRows=jRows.val(),sCols=jColumns.val(),sHeaders=jHeaders.val(),sWidth=jWidth.val(),sHeight=jHeight.val(),sCellSpacing=jCellSpacing.val(),sCellPadding=jCellPadding.val(),sAlign=jAlign.val();
var i,j,htmlTable='<table'+(sBorder!==''?' border="'+sBorder+'"':'')+(sWidth!==''?' width="'+sWidth+'"':'')+(sHeight!==''?' height="'+sHeight+'"':'')+(sCellSpacing!==''?' cellspacing="'+sCellSpacing+'"':'')+(sCellPadding!==''?' cellpadding="'+sCellPadding+'"':'')+(sAlign!==''?' align="'+sAlign+'"':'')+'>';
if(sCaption!=='')htmlTable+='<caption>'+sCaption+'</caption>';
if(sHeaders==='row'||sHeaders==='both')
{
htmlTable+='<tr>';
for(i=0;i<sCols;i++)htmlTable+='<th scope="col"></th>';
htmlTable+='</tr>';
sRows--;
}
htmlTable+='<tbody>';
for(i=0;i<sRows;i++)
{
htmlTable+='<tr>';
for(j=0;j<sCols;j++)
{
if(j===0&&(sHeaders==='col'||sHeaders==='both'))htmlTable+='<th scope="row"></th>';
else htmlTable+='<td></td>';
}
htmlTable+='</tr>';
}
htmlTable+='</tbody></table>';
_this.pasteHTML(htmlTable);
_this.hidePanel();
return false;
});
_this.saveBookmark();
_this.showDialog(jTable);
}
this.showAbout=function()
{
var jAbout=$(htmlAbout);
jAbout.find('p').attr('role','presentation');//無障礙支持
_this.showDialog(jAbout,true);
setTimeout(function(){jAbout.focus();},100);
}
this.addShortcuts=function(key,cmd)
{
key=key.toLowerCase();
if(arrShortCuts[key]===undefined)arrShortCuts[key]=Array();
arrShortCuts[key].push(cmd);
}
this.delShortcuts=function(key){delete arrShortCuts[key];}
this.uploadInit=function(jText,toUrl,upext)
{
var jUpload=$('<span class="xheUpload"><input type="text" style="visibility:hidden;" tabindex="-1" /><input type="button" value="'+settings.upBtnText+'" class="xheBtn" tabindex="-1" /></span>'),jUpBtn=$('.xheBtn',jUpload);
var bHtml5Upload=settings.html5Upload,upMultiple=bHtml5Upload?settings.upMultiple:1;
jText.after(jUpload);jUpBtn.before(jText);
toUrl=toUrl.replace(/{editorRoot}/ig,editorRoot);
if(toUrl.substr(0,1)==='!')//自定義上傳管理頁
{
jUpBtn.click(function(){_this.showIframeModal('上傳文件',toUrl.substr(1),setUploadMsg,null,null);});
}
else
{//系統預設ajax上傳
jUpload.append('<input type="file"'+(upMultiple>1?' multiple=""':'')+' class="xheFile" size="13" name="'+uploadInputname+'" tabindex="-1" />');
var jFile=$('.xheFile',jUpload),arrMsg;
jFile.change(function(){arrMsg=[];_this.startUpload(jFile[0],toUrl,upext,setUploadMsg);});
setTimeout(function(){//拖放上傳
jText.closest('.xheDialog').bind('dragenter dragover',returnFalse).bind('drop',function(ev){
var dataTransfer=ev.originalEvent.dataTransfer,fileList;
if(bHtml5Upload&&dataTransfer&&(fileList=dataTransfer.files)&&fileList.length>0)_this.startUpload(fileList,toUrl,upext,setUploadMsg);
return false;
});
},10);
}
function setUploadMsg(arrMsg)
{
if(is(arrMsg,'string'))arrMsg=[arrMsg];//允許單URL傳遞
var bImmediate=false,i,count=arrMsg.length,msg,url,arrUrl=[],onUpload=settings.onUpload;
if(onUpload)onUpload(arrMsg);//用戶上傳回調
for(i=0;i<count;i++)
{
msg=arrMsg[i];
url=is(msg,'string')?msg:msg.url;
if(url.substr(0,1)==='!'){bImmediate=true;url=url.substr(1);}
arrUrl.push(url);
}
jText.val(arrUrl.join(' '));
if(bImmediate)jText.closest('.xheDialog').find('#xheSave').click();
}
}
this.startUpload=function(fromFiles,toUrl,limitExt,onUploadComplete)
{
var arrMsg=[],bHtml5Upload=settings.html5Upload,upMultiple=bHtml5Upload?settings.upMultiple:1;
var upload,fileList,filename,jUploadTip=$('<div style="padding:22px 0;text-align:center;line-height:30px;">文件上傳中,請稍候……<br /></div>'),sLoading='<img src="'+skinPath+'img/loading.gif">';
if(isOpera||!bHtml5Upload||(fromFiles.nodeType&&!((fileList=fromFiles.files)&&fileList[0].name)))
{
if(!checkFileExt(fromFiles.value,limitExt))return;
jUploadTip.append(sLoading);
upload=new _this.html4Upload(fromFiles,toUrl,onUploadCallback);
}
else
{
if(!fileList)fileList=fromFiles;//拖放文件列表
var i,len=fileList.length;
if(len>upMultiple){
alert('請不要一次上傳超過'+upMultiple+'個文件');
return;
}
for(i=0;i<len;i++)if(!checkFileExt(fileList[i].name,limitExt))return;
var jProgress=$('<div class="xheProgress"><div><span>0%</span></div></div>');
jUploadTip.append(jProgress);
upload=new _this.html5Upload(uploadInputname,fileList,toUrl,onUploadCallback,function(ev){
if(ev.loaded>=0)
{
var sPercent=Math.round((ev.loaded * 100) / ev.total)+'%';
$('div',jProgress).css('width',sPercent);
$('span',jProgress).text(sPercent+' ( '+formatBytes(ev.loaded)+' / '+formatBytes(ev.total)+' )');
}
else jProgress.replaceWith(sLoading);//不支持進度
});
}
_this.showModal('文件上傳中(Esc取消上傳)',jUploadTip,320,150);
upload.start();
function onUploadCallback(sText,bFinish)
{
var data=Object,bOK=false;
try{data=eval('('+sText+')');}catch(ex){};
if(data.err===undefined||data.msg===undefined)alert(toUrl+' 上傳接口發生錯誤!\r\n\r\n返回的錯誤內容為: \r\n\r\n'+sText);
else
{
if(data.err)alert(data.err);
else
{
arrMsg.push(data.msg);
bOK=true;//繼續下一個文件上傳
}
}
if(!bOK||bFinish)_this.removeModal();
if(bFinish&&bOK)onUploadComplete(arrMsg);//全部上傳完成
return bOK;
}
}
this.html4Upload=function(fromfile,toUrl,callback)
{
var uid = new Date().getTime(),idIO='jUploadFrame'+uid,_this=this;
var jIO=$('<iframe name="'+idIO+'" class="xheHideArea" />').appendTo('body');
var jForm=$('<form action="'+toUrl+'" target="'+idIO+'" method="post" enctype="multipart/form-data" class="xheHideArea"></form>').appendTo('body');
var jOldFile = $(fromfile),jNewFile = jOldFile.clone().attr('disabled','true');
jOldFile.before(jNewFile).appendTo(jForm);
this.remove=function()
{
if(_this!==null)
{
jNewFile.before(jOldFile).remove();
jIO.remove();jForm.remove();
_this=null;
}
}
this.onLoad=function(){
var ifmDoc=jIO[0].contentWindow.document,result=$(ifmDoc.body).text();
ifmDoc.write('');
_this.remove();
callback(result,true);
}
this.start=function(){jForm.submit();jIO.load(_this.onLoad);}
return this;
}
this.html5Upload=function(inputname,fromFiles,toUrl,callback,onProgress)
{
var xhr,i=0,count=fromFiles.length,allLoaded=0,allSize=0,_this=this;
for(var j=0;j<count;j++)allSize+=fromFiles[j].size;
this.remove=function(){if(xhr){xhr.abort();xhr=null;}}
this.uploadNext=function(sText)
{
if(sText)//當前文件上傳完成
{
allLoaded+=fromFiles[i-1].size;
returnProgress(0);
}
if((!sText||(sText&&callback(sText,i===count)===true))&&i<count)postFile(fromFiles[i++],toUrl,_this.uploadNext,function(loaded){returnProgress(loaded);});
}
this.start=function(){_this.uploadNext();}
function postFile(fromfile,toUrl,callback,onProgress)
{
xhr = new XMLHttpRequest(),upload=xhr.upload;
xhr.onreadystatechange=function(){
if(xhr.readyState===4)callback(xhr.responseText);
};
if(upload)upload.onprogress=function(ev){
onProgress(ev.loaded);
};
else onProgress(-1);//不支持進度
xhr.open("POST", toUrl);
xhr.setRequestHeader('Content-Type', 'application/octet-stream');
xhr.setRequestHeader('Content-Disposition', 'attachment; name="'+encodeURIComponent(inputname)+'"; filename="'+encodeURIComponent(fromfile.name)+'"');
if(xhr.sendAsBinary&&fromfile.getAsBinary)xhr.sendAsBinary(fromfile.getAsBinary());
else xhr.send(fromfile);
}
function returnProgress(loaded){
if(onProgress)onProgress({'loaded':allLoaded+loaded,'total':allSize});
}
}
this.showIframeModal=function(title,url,callback,w,h,onRemove)
{
var jContent=$('<iframe frameborder="0" src="'+url.replace(/{editorRoot}/ig,editorRoot)+(/\?/.test(url)?'&':'?')+'parenthost='+location.host+'" style="width:100%;height:100%;display:none;" /><div class="xheModalIfmWait"></div>'),jIframe=jContent.eq(0),jWait=jContent.eq(1);
_this.showModal(title,jContent,w,h,onRemove);
var modalWin=jIframe[0].contentWindow,result;
initModalWin();
jIframe.load(function(){
initModalWin();//初始化接口
if(result){//跨域,取返回值
var bResult=true;
try{
result=eval('('+unescape(result)+')');
}
catch(e){
bResult=false;
}
if(bResult)return callbackModal(result);
}
if(jWait.is(':visible')){//顯示內頁
jIframe.show().focus();
jWait.remove();
}
});
//初始化接口
function initModalWin(){
try{
modalWin.callback=callbackModal;
modalWin.unloadme=_this.removeModal;
$(modalWin.document).keydown(checkEsc);
result=modalWin.name;
}
catch(ex){}
}
//模式窗口回調
function callbackModal(v){
modalWin.document.write('');
_this.removeModal();
if(v!=null)callback(v);
}
}
this.showModal=function(title,content,w,h,onRemove)
{
if(bShowModal)return false;//只能彈出一個模式窗口
_this.panelState=bShowPanel;
bShowPanel=false;//防止按鈕面板被關閉
layerShadow=settings.layerShadow;
w=w?w:settings.modalWidth;h=h?h:settings.modalHeight;
jModal=$('<div class="xheModal" style="width:'+(w-1)+'px;height:'+h+'px;margin-left:-'+Math.ceil(w/2)+'px;'+(isIE&&browerVer<7.0?'':'margin-top:-'+Math.ceil(h/2)+'px')+'">'+(settings.modalTitle?'<div class="xheModalTitle"><span class="xheModalClose" title="關閉 (Esc)" tabindex="0" role="button"></span>'+title+'</div>':'')+'<div class="xheModalContent"></div></div>').appendTo('body');
jOverlay=$('<div class="xheModalOverlay"></div>').appendTo('body');
if(layerShadow>0)jModalShadow=$('<div class="xheModalShadow" style="width:'+jModal.outerWidth()+'px;height:'+jModal.outerHeight()+'px;margin-left:-'+(Math.ceil(w/2)-layerShadow-2)+'px;'+(isIE&&browerVer<7.0?'':'margin-top:-'+(Math.ceil(h/2)-layerShadow-2)+'px')+'"></div>').appendTo('body');
$('.xheModalContent',jModal).css('height',h-(settings.modalTitle?$('.xheModalTitle').outerHeight():0)).html(content);
if(isIE&&browerVer===6.0)jHideSelect=$('select:visible').css('visibility','hidden');//隱藏覆蓋的select
$('.xheModalClose',jModal).click(_this.removeModal);
jOverlay.show();
if(layerShadow>0)jModalShadow.show();
jModal.show();
setTimeout(function(){jModal.find('a,input[type=text],textarea').filter(':visible').filter(function(){return $(this).css('visibility')!=='hidden';}).eq(0).focus();},10);//定位首個可見輸入表單項,延遲解決opera無法設置焦點
bShowModal=true;
onModalRemove=onRemove;
}
this.removeModal=function(){
if(jHideSelect)jHideSelect.css('visibility','visible');
jModal.html('').remove();
if(layerShadow>0)jModalShadow.remove();
jOverlay.remove();
if(onModalRemove)onModalRemove();
bShowModal=false;
bShowPanel=_this.panelState;
};
this.showDialog=function(content,bNoFocus)
{
var jDialog=$('<div class="xheDialog"></div>'),jContent=$(content),jSave=$('#xheSave',jContent);
if(jSave.length===1)
{
jContent.find('input[type=text],select').keypress(function(ev){if(ev.which===13){jSave.click();return false;}});
jContent.find('textarea').keydown(function(ev){if(ev.ctrlKey&&ev.which===13){jSave.click();return false;}});
jSave.after(' <input type="button" id="xheCancel" value="取消" />');
$('#xheCancel',jContent).click(_this.hidePanel);
if(!settings.clickCancelDialog)
{
bClickCancel=false;//關閉點擊隱藏
var jFixCancel=$('<div class="xheFixCancel"></div>').appendTo('body').mousedown(returnFalse);
var xy=_jArea.offset();
jFixCancel.css({'left':xy.left,'top':xy.top,width:_jArea.outerWidth(),height:_jArea.outerHeight()})
}
jDialog.mousedown(function(){bDisableHoverExec=true;})//點擊對話框禁止懸停執行
}
jDialog.append(jContent);
_this.showPanel(jDialog,bNoFocus);
}
this.showPanel=function(content,bNoFocus)
{
if(!ev.target)return false;
_jPanel.html('').append(content).css('left',-999).css('top',-999);
_jPanelButton=$(ev.target).closest('a').addClass('xheActive');
var xy=_jPanelButton.offset();
var x=xy.left,y=xy.top;y+=_jPanelButton.outerHeight()-1;
_jCntLine.css({'left':x+1,'top':y,'width':_jPanelButton.width()}).show();
var _docElem=document.documentElement,body=document.body;
if((x+_jPanel.outerWidth())>((window.pageXOffset||_docElem.scrollLeft||body.scrollLeft)+(_docElem.clientWidth||body.clientWidth)))x-=(_jPanel.outerWidth()-_jPanelButton.outerWidth());//向左顯示面板
var layerShadow=settings.layerShadow;
if(layerShadow>0)_jShadow.css({'left':x+layerShadow,'top':y+layerShadow,'width':_jPanel.outerWidth(),'height':_jPanel.outerHeight()}).show();
var basezIndex=$('#'+idContainer).offsetParent().css('zIndex');
if(basezIndex&&!isNaN(basezIndex)){
_jShadow.css('zIndex',parseInt(basezIndex,10)+1);
_jPanel.css('zIndex',parseInt(basezIndex,10)+2);
_jCntLine.css('zIndex',parseInt(basezIndex,10)+3);
}
_jPanel.css({'left':x,'top':y}).show();
if(!bNoFocus)setTimeout(function(){_jPanel.find('a,input[type=text],textarea').filter(':visible').filter(function(){return $(this).css('visibility')!=='hidden';}).eq(0).focus();},10);//定位首個可見輸入表單項,延遲解決opera無法設置焦點
bQuickHoverExec=bShowPanel=true;
}
this.hidePanel=function(){
if(bShowPanel){
_jPanelButton.removeClass('xheActive');
_jShadow.hide();
_jCntLine.hide();
_jPanel.hide();
bShowPanel=false;
if(!bClickCancel){
$('.xheFixCancel').remove();
bClickCancel=true;
};
bQuickHoverExec=bDisableHoverExec=false;
lastAngle=null;
_this.focus();
_this.loadBookmark();
}
}
this.exec=function(cmd)
{
_this.hidePanel();
var tool=arrTools[cmd];
if(!tool)return false;//無效命令
if(ev===null)//非鼠標點擊
{
ev={};
var btn=_jTools.find('.xheButton[cmd='+cmd+']');
if(btn.length===1)ev.target=btn;//設置當前事件焦點
}
if(tool.e)tool.e.call(_this)//插件事件
else//內置工具
{
cmd=cmd.toLowerCase();
switch(cmd)
{
case 'cut':
try{_doc.execCommand(cmd);if(!_doc.queryCommandSupported(cmd))throw 'Error';}
catch(ex){alert('您的瀏覽器安全設置不允許使用剪下操作,請使用鍵盤快捷鍵(Ctrl + X)來完成');};
break;
case 'copy':
try{_doc.execCommand(cmd);if(!_doc.queryCommandSupported(cmd))throw 'Error';}
catch(ex){alert('您的瀏覽器安全設置不允許使用複製操作,請使用鍵盤快捷鍵(Ctrl + C)來完成');}
break;
case 'paste':
try{_doc.execCommand(cmd);if(!_doc.queryCommandSupported(cmd))throw 'Error';}
catch(ex){alert('您的瀏覽器安全設置不允許使用貼上操作,請使用鍵盤快捷鍵(Ctrl + V)來完成');}
break;
case 'pastetext':
if(window.clipboardData)_this.pasteText(window.clipboardData.getData('Text', true));
else _this.showPastetext();
break;
case 'blocktag':
var menuBlocktag=[];
$.each(arrBlocktag,function(n,v){menuBlocktag.push({s:'<'+v.n+'>'+v.t+'</'+v.n+'>',v:'<'+v.n+'>',t:v.t});});
_this.showMenu(menuBlocktag,function(v){_this._exec('formatblock',v);});
break;
case 'fontface':
var menuFontname=[];
$.each(arrFontname,function(n,v){v.c=v.c?v.c:v.n;menuFontname.push({s:'<span style="font-family:'+v.c+'">'+v.n+'</span>',v:v.c,t:v.n});});
_this.showMenu(menuFontname,function(v){_this._exec('fontname',v);});
break;
case 'fontsize':
var menuFontsize=[];
$.each(arrFontsize,function(n,v){menuFontsize.push({s:'<span style="font-size:'+v.s+';">'+v.t+'('+v.s+')</span>',v:n+1,t:v.t});});
_this.showMenu(menuFontsize,function(v){_this._exec('fontsize',v);});
break;
case 'fontcolor':
_this.showColor(function(v){_this._exec('forecolor',v);});
break;
case 'backcolor':
_this.showColor(function(v){if(isIE)_this._exec('backcolor',v);else{setCSS(true);_this._exec('hilitecolor',v);setCSS(false);}});
break;
case 'align':
_this.showMenu(menuAlign,function(v){_this._exec(v);});
break;
case 'list':
_this.showMenu(menuList,function(v){_this._exec(v);});
break;
case 'link':
_this.showLink();
break;
case 'anchor':
_this.showAnchor();
break;
case 'img':
_this.showImg();
break;
case 'flash':
_this.showEmbed('Flash',htmlFlash,'application/x-shockwave-flash','clsid:d27cdb6e-ae6d-11cf-96b8-4445535400000',' wmode="opaque" quality="high" menu="false" play="true" loop="true" allowfullscreen="true"',settings.upFlashUrl,settings.upFlashExt);
break;
case 'media':
_this.showEmbed('Media',htmlMedia,'application/x-mplayer2','clsid:6bf52a52-394a-11d3-b153-00c04f79faa6',' enablecontextmenu="false" autostart="false"',settings.upMediaUrl,settings.upMediaExt);
break;
case 'hr':
_this.pasteHTML('<hr />');
break;
case 'emot':
_this.showEmot();
break;
case 'table':
_this.showTable();
break;
case 'source':
_this.toggleSource();
break;
case 'preview':
_this.showPreview();
break;
case 'print':
_win.print();
break;
case 'fullscreen':
_this.toggleFullscreen();
break;
case 'about':
_this.showAbout();
break;
default:
_this._exec(cmd);
break;
}
}
ev=null;
}
this._exec=function(cmd,param,noFocus)
{
if(!noFocus)_this.focus();
var state;
if(param!==undefined)state=_doc.execCommand(cmd,false,param);
else state=_doc.execCommand(cmd,false,null);
return state;
}
function checkDblClick(ev)
{
var target=ev.target,tool=arrDbClick[target.tagName.toLowerCase()];
if(tool)
{
if(tool==='Embed')//自動識別Flash和多媒體
{
var arrEmbed={'application/x-shockwave-flash':'Flash','application/x-mplayer2':'Media'};
tool=arrEmbed[target.type.toLowerCase()];
}
_this.exec(tool);
}
}
function checkEsc(ev)
{
if(ev.which===27)
{
if(bShowModal)_this.removeModal();
else if(bShowPanel)_this.hidePanel();
return false;
}
}
function loadReset(){setTimeout(_this.setSource,10);}
function saveResult(){_this.getSource();};
function cleanPaste(ev){
var clipboardData,items,item;//for chrome
if(ev&&(clipboardData=ev.originalEvent.clipboardData)&&(items=clipboardData.items)&&(item=items[0])&&item.kind=='file'&&item.type.match(/^image\//i)){
var blob = item.getAsFile(),reader = new FileReader();
reader.onload=function(){
var sHtml='<img src="'+event.target.result+'">';
sHtml=replaceRemoteImg(sHtml);
_this.pasteHTML(sHtml);
}
reader.readAsDataURL(blob);
return false;
}
var cleanPaste=settings.cleanPaste;
if(cleanPaste===0||bSource||bCleanPaste)return true;
bCleanPaste=true;//解決IE右鍵貼上重複產生paste的問題
_this.saveBookmark();
var tag=isIE?'pre':'div',jDiv=$('<'+tag+' class="xhe-paste">\uFEFF\uFEFF</'+tag+'>',_doc).appendTo(_doc.body),div=jDiv[0],sel=_this.getSel(),rng=_this.getRng(true);
jDiv.css('top',_jWin.scrollTop());
if(isIE){
rng.moveToElementText(div);
rng.select();
//註:調用execommand:paste,會導致IE8,IE9目標路徑無法轉為絕對路徑
}
else{
rng.selectNodeContents(div);
sel.removeAllRanges();
sel.addRange(rng);
}
setTimeout(function(){
var bText=(cleanPaste===3),sPaste;
if(bText)sPaste=jDiv.text();
else{
var jTDiv=$('.xhe-paste',_doc.body),arrHtml=[];
jTDiv.each(function(i,n){if($(n).find('.xhe-paste').length==0)arrHtml.push(n.innerHTML);});
sPaste=arrHtml.join('<br />');
}
jDiv.remove();
_this.loadBookmark();
sPaste=sPaste.replace(/^[\s\uFEFF]+|[\s\uFEFF]+$/g,'');
if(sPaste){
if(bText)_this.pasteText(sPaste);
else{
sPaste=_this.cleanHTML(sPaste);
sPaste=_this.cleanWord(sPaste);
sPaste=_this.formatXHTML(sPaste);
if(!settings.onPaste||settings.onPaste&&(sPaste=settings.onPaste(sPaste))!==false){
sPaste=replaceRemoteImg(sPaste);
_this.pasteHTML(sPaste);
}
}
}
bCleanPaste=false;
},0);
}
//遠程圖片轉本地
function replaceRemoteImg(sHtml){
var localUrlTest=settings.localUrlTest,remoteImgSaveUrl=settings.remoteImgSaveUrl;
if(localUrlTest&&remoteImgSaveUrl){
var arrRemoteImgs=[],count=0;
sHtml=sHtml.replace(/(<img)((?:\s+[^>]*?)?(?:\s+src="\s*([^"]+)\s*")(?: [^>]*)?)(\/?>)/ig,function(all,left,attr,url,right){
if(/^(https?|data:image)/i.test(url) && !/_xhe_temp/.test(attr) && !localUrlTest.test(url)){
arrRemoteImgs[count]=url;
attr=attr.replace(/\s+(width|height)="[^"]*"/ig,'').replace(/\s+src="[^"]*"/ig,' src="'+skinPath+'img/waiting.gif" remoteimg="'+(count++)+'"');
}
return left+attr+right;
});
if(arrRemoteImgs.length>0){
$.post(remoteImgSaveUrl,{urls:arrRemoteImgs.join('|')},function(data){
data=data.split('|');
$('img[remoteimg]',_this.doc).each(function(){
var $this=$(this);
xheAttr($this,'src',data[$this.attr('remoteimg')]);
$this.removeAttr('remoteimg');
});
});
}
}
return sHtml;
}
function setCSS(css)
{
try{_this._exec('styleWithCSS',css,true);}
catch(e)
{try{_this._exec('useCSS',!css,true);}catch(e){}}
}
function setOpts()
{
if(bInit&&!bSource)
{
setCSS(false);
try{_this._exec('enableObjectResizing',true,true);}catch(e){}
//try{_this._exec('enableInlineTableEditing',false,true);}catch(e){}
if(isIE)try{_this._exec('BackgroundImageCache',true,true);}catch(e){}
}
}
function forcePtag(ev)
{
if(bSource||ev.which!==13||ev.shiftKey||ev.ctrlKey||ev.altKey)return true;
var pNode=_this.getParent('p,h1,h2,h3,h4,h5,h6,pre,address,div,li');
if(pNode.is('li'))return true;
if(settings.forcePtag){if(pNode.length===0)_this._exec('formatblock','<p>');}
else
{
_this.pasteHTML('<br />');
if(isIE&&pNode.length>0&&_this.getRng().parentElement().childNodes.length===2)_this.pasteHTML('<br />');
return false;
}
}
function fixFullHeight()
{
if(!isMozilla&&!isSafari)
{
if(bFullscreen)_jArea.height('100%').css('height',_jArea.outerHeight()-_jTools.outerHeight());
if(isIE)_jTools.hide().show();
}
}
function fixAppleSel(e)
{
e=e.target;
if(e.tagName.match(/(img|embed)/i))
{
var sel=_this.getSel(),rng=_this.getRng(true);
rng.selectNode(e);
sel.removeAllRanges();
sel.addRange(rng);
}
}
function xheAttr(jObj,n,v)
{
if(!n)return false;
var kn='_xhe_'+n;
if(v)//設置屬性
{
if(urlType)v=getLocalUrl(v,urlType,urlBase);
jObj.attr(n,urlBase?getLocalUrl(v,'abs',urlBase):v).removeAttr(kn).attr(kn,v);
}
return jObj.attr(kn)||jObj.attr(n);
}
function clickCancelPanel(){if(bClickCancel)_this.hidePanel();}
function checkShortcuts(event)
{
if(bSource)return true;
var code=event.which,special=specialKeys[code],sChar=special?special:String.fromCharCode(code).toLowerCase();
sKey='';
sKey+=event.ctrlKey?'ctrl+':'';sKey+=event.altKey?'alt+':'';sKey+=event.shiftKey?'shift+':'';sKey+=sChar;
var cmd=arrShortCuts[sKey],c;
for(c in cmd)
{
c=cmd[c];
if($.isFunction(c)){if(c.call(_this)===false)return false;}
else{_this.exec(c);return false;}//按鈕獨佔快捷鍵
}
}
function is(o,t)
{
var n = typeof(o);
if (!t)return n != 'undefined';
if (t === 'array' && (o.hasOwnProperty && o instanceof Array))return true;
return n === t;
}
function getLocalUrl(url,urlType,urlBase)//絕對地址:abs,根地址:root,相對地址:rel
{
if( (url.match(/^(\w+):\/\//i) && !url.match(/^https?:/i)) || /^#/i.test(url) || /^data:/i.test(url) )return url;//非http和https協議,或者頁面錨點不轉換,或者base64編碼的圖片等
var baseUrl=urlBase?$('<a href="'+urlBase+'" />')[0]:location,protocol=baseUrl.protocol,host=baseUrl.host,hostname=baseUrl.hostname,port=baseUrl.port,path=baseUrl.pathname.replace(/\\/g,'/').replace(/[^\/]+$/i,'');
if(port==='')port='80';
if(path==='')path='/';
else if(path.charAt(0)!=='/')path='/'+path;//修正IE path
url=$.trim(url);
//刪除域路徑
if(urlType!=='abs')url=url.replace(new RegExp(protocol+'\\/\\/'+hostname.replace(/\./g,'\\.')+'(?::'+port+')'+(port==='80'?'?':'')+'(\/|$)','i'),'/');
//刪除根路徑
if(urlType==='rel')url=url.replace(new RegExp('^'+path.replace(/([\/\.\+\[\]\(\)])/g,'\\$1'),'i'),'');
//加上根路徑
if(urlType!=='rel')
{
if(!url.match(/^(https?:\/\/|\/)/i))url=path+url;
if(url.charAt(0)==='/')//處理根路徑中的..
{
var arrPath=[],arrFolder = url.split('/'),folder,i,l=arrFolder.length;
for(i=0;i<l;i++)
{
folder=arrFolder[i];
if(folder==='..')arrPath.pop();
else if(folder!==''&&folder!=='.')arrPath.push(folder);
}
if(arrFolder[l-1]==='')arrPath.push('');
url='/'+arrPath.join('/');
}
}
//加上域路徑
if(urlType==='abs'&&!url.match(/^https?:\/\//i))url=protocol+'//'+host+url;
url=url.replace(/(https?:\/\/[^:\/?#]+):80(\/|$)/i,'$1$2');//省略80端口
return url;
}
function checkFileExt(filename,limitExt)
{
if(limitExt==='*'||filename.match(new RegExp('\.('+limitExt.replace(/,/g,'|')+')$','i')))return true;
else
{
alert('上傳文件擴展名必需為: '+limitExt);
return false;
}
}
function formatBytes(bytes)
{
var s = ['Byte', 'KB', 'MB', 'GB', 'TB', 'PB'];
var e = Math.floor(Math.log(bytes)/Math.log(1024));
return (bytes/Math.pow(1024, Math.floor(e))).toFixed(2)+s[e];
}
function returnFalse(){return false;}
}
xheditor.settings={skin:'default',tools:'full',clickCancelDialog:true,linkTag:false,internalScript:false,inlineScript:false,internalStyle:true,inlineStyle:true,showBlocktag:false,forcePtag:true,upLinkExt:"zip,rar,txt",upImgExt:"jpg,jpeg,gif,png",upFlashExt:"swf",upMediaExt:"wmv,avi,wma,mp3,mid",modalWidth:350,modalHeight:220,modalTitle:true,defLinkText:'點擊打開鏈接',layerShadow:3,emotMark:false,upBtnText:'上傳',cleanPaste:1,hoverExecDelay:100,html5Upload:true,upMultiple:99};
window.xheditor=xheditor;
$(function(){
$.fn.oldVal=$.fn.val;
$.fn.val=function(value)
{
var _this=this,editor;
if(value===undefined)if(_this[0]&&(editor=_this[0].xheditor))return editor.getSource();else return _this.oldVal();//讀
return _this.each(function(){if(editor=this.xheditor)editor.setSource(value);else _this.oldVal(value);});//寫
}
$('textarea').each(function(){
var $this=$(this),xhClass=$this.attr('class');
if(xhClass&&(xhClass=xhClass.match(/(?:^|\s)xheditor(?:\-(m?full|simple|mini))?(?:\s|$)/i)))$this.xheditor(xhClass[1]?{tools:xhClass[1]}:null);
});
});
})(jQuery); | zz-ms | trunk/zz-ms-v2.0/src/main/webapp/js/xheditor/src/xheditor-1.1.14-zh-tw.js | JavaScript | asf20 | 99,163 |
/*!
* WYSIWYG UBB Editor support for xhEditor
* @requires xhEditor
*
* @author Yanis.Wang<yanis.wang@gmail.com>
* @site http://xheditor.com/
* @licence LGPL(http://www.opensource.org/licenses/lgpl-license.php)
*
* @Version: 0.9.12 (build 120228)
*/
function ubb2html(sUBB)
{
var i,sHtml=String(sUBB),arrcode=new Array(),cnum=0;
var arrFontsize=['10px','13px','16px','18px','24px','32px','48px'];
sHtml=sHtml.replace(/[<>&"]/g,function(c){return {'<':'<','>':'>','&':'&','"':'"'}[c];});
sHtml=sHtml.replace(/\r?\n/g,"<br />");
sHtml=sHtml.replace(/\[code\s*(?:=\s*([^\]]+?))?\]([\s\S]*?)\[\/code\]/ig,function(all,t,c){//code特殊处理
cnum++;arrcode[cnum]=all;
return "[\tubbcodeplace_"+cnum+"\t]";
});
sHtml=sHtml.replace(/\[(\/?)(b|u|i|s|sup|sub)\]/ig,'<$1$2>');
sHtml=sHtml.replace(/\[color\s*=\s*([^\]"]+?)(?:"[^\]]*?)?\s*\]/ig,'<font color="$1">');
sHtml=sHtml.replace(/\[font\s*=\s*([^\]"]+?)(?:"[^\]]*?)?\s*\]/ig,'<font face="$1">');
sHtml=sHtml.replace(/\[\/(color|font)\]/ig,'</font>');
sHtml=sHtml.replace(/\[size\s*=\s*([^\]"]+?)(?:"[^\]]*?)?\s*\]/ig,function(all,size){
if(size.match(/^\d+$/))size=arrFontsize[size-1];
return '<span style="font-size:'+size+';">';
});
sHtml=sHtml.replace(/\[back\s*=\s*([^\]"]+?)(?:"[^\]]*?)?\s*\]/ig,'<span style="background-color:$1;">');
sHtml=sHtml.replace(/\[\/(size|back)\]/ig,'</span>');
for(i=0;i<3;i++)sHtml=sHtml.replace(/\[align\s*=\s*([^\]"]+?)(?:"[^\]]*?)?\s*\](((?!\[align(?:\s+[^\]]+)?\])[\s\S])*?)\[\/align\]/ig,'<p align="$1">$2</p>');
sHtml=sHtml.replace(/\[img\]\s*(((?!")[\s\S])+?)(?:"[\s\S]*?)?\s*\[\/img\]/ig,'<img src="$1" alt="" />');
sHtml=sHtml.replace(/\[img\s*=([^,\]]*)(?:\s*,\s*(\d*%?)\s*,\s*(\d*%?)\s*)?(?:,?\s*(\w+))?\s*\]\s*(((?!")[\s\S])+?)(?:"[\s\S]*)?\s*\[\/img\]/ig,function(all,alt,p1,p2,p3,src){
var str='<img src="'+src+'" alt="'+alt+'"',a=p3?p3:(!isNum(p1)?p1:'');
if(isNum(p1))str+=' width="'+p1+'"';
if(isNum(p2))str+=' height="'+p2+'"'
if(a)str+=' align="'+a+'"';
str+=' />';
return str;
});
sHtml=sHtml.replace(/\[emot\s*=\s*([^\]"]+?)(?:"[^\]]*?)?\s*\/\]/ig,'<img emot="$1" />');
sHtml=sHtml.replace(/\[url\]\s*(((?!")[\s\S])*?)(?:"[\s\S]*?)?\s*\[\/url\]/ig,'<a href="$1">$1</a>');
sHtml=sHtml.replace(/\[url\s*=\s*([^\]"]+?)(?:"[^\]]*?)?\s*\]\s*([\s\S]*?)\s*\[\/url\]/ig,'<a href="$1">$2</a>');
sHtml=sHtml.replace(/\[email\]\s*(((?!")[\s\S])+?)(?:"[\s\S]*?)?\s*\[\/email\]/ig,'<a href="mailto:$1">$1</a>');
sHtml=sHtml.replace(/\[email\s*=\s*([^\]"]+?)(?:"[^\]]*?)?\s*\]\s*([\s\S]+?)\s*\[\/email\]/ig,'<a href="mailto:$1">$2</a>');
sHtml=sHtml.replace(/\[quote\]/ig,'<blockquote>');
sHtml=sHtml.replace(/\[\/quote\]/ig,'</blockquote>');
sHtml=sHtml.replace(/\[flash\s*(?:=\s*(\d+)\s*,\s*(\d+)\s*)?\]\s*(((?!")[\s\S])+?)(?:"[\s\S]*?)?\s*\[\/flash\]/ig,function(all,w,h,url){
if(!w)w=480;if(!h)h=400;
return '<embed type="application/x-shockwave-flash" src="'+url+'" wmode="opaque" quality="high" bgcolor="#ffffff" menu="false" play="true" loop="true" width="'+w+'" height="'+h+'"/>';
});
sHtml=sHtml.replace(/\[media\s*(?:=\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*(\d+)\s*)?)?\]\s*(((?!")[\s\S])+?)(?:"[\s\S]*?)?\s*\[\/media\]/ig,function(all,w,h,play,url){
if(!w)w=480;if(!h)h=400;
return '<embed type="application/x-mplayer2" src="'+url+'" enablecontextmenu="false" autostart="'+(play=='1'?'true':'false')+'" width="'+w+'" height="'+h+'"/>';
});
sHtml=sHtml.replace(/\[table\s*(?:=\s*(\d{1,4}%?)\s*(?:,\s*([^\]"]+)(?:"[^\]]*?)?)?)?\s*\]/ig,function(all,w,b){
var str='<table';
if(w)str+=' width="'+w+'"';
if(b)str+=' bgcolor="'+b+'"';
return str+'>';
});
sHtml=sHtml.replace(/\[tr\s*(?:=\s*([^\]"]+?)(?:"[^\]]*?)?)?\s*\]/ig,function(all,bg){
return '<tr'+(bg?' bgcolor="'+bg+'"':'')+'>';
});
sHtml=sHtml.replace(/\[td\s*(?:=\s*(\d{1,2})\s*,\s*(\d{1,2})\s*(?:,\s*(\d{1,4}%?))?)?\s*\]/ig,function(all,col,row,w){
return '<td'+(col>1?' colspan="'+col+'"':'')+(row>1?' rowspan="'+row+'"':'')+(w?' width="'+w+'"':'')+'>';
});
sHtml=sHtml.replace(/\[\/(table|tr|td)\]/ig,'</$1>');
sHtml=sHtml.replace(/\[\*\]((?:(?!\[\*\]|\[\/list\]|\[list\s*(?:=[^\]]+)?\])[\s\S])+)/ig,'<li>$1</li>');
sHtml=sHtml.replace(/\[list\s*(?:=\s*([^\]"]+?)(?:"[^\]]*?)?)?\s*\]/ig,function(all,type){
var str='<ul';
if(type)str+=' type="'+type+'"';
return str+'>';
});
sHtml=sHtml.replace(/\[\/list\]/ig,'</ul>');
sHtml=sHtml.replace(/\[hr\/\]/ig,'<hr />');
for(i=1;i<=cnum;i++)sHtml=sHtml.replace("[\tubbcodeplace_"+i+"\t]", arrcode[i]);
sHtml=sHtml.replace(/(^|<\/?\w+(?:\s+[^>]*?)?>)([^<$]+)/ig, function(all,tag,text){
return tag+text.replace(/[\t ]/g,function(c){return {'\t':' ',' ':' '}[c];});
});
function isNum(s){if(s!=null&&s!='')return !isNaN(s);else return false;}
return sHtml;
}
function html2ubb(sHtml)
{
var regSrc=/\s+src\s*=\s*(["']?)\s*(.+?)\s*\1(\s|$)/i,regWidth=/\s+width\s*=\s*(["']?)\s*(\d+(?:\.\d+)?%?)\s*\1(\s|$)/i,regHeight=/\s+height\s*=\s*(["']?)\s*(\d+(?:\.\d+)?%?)\s*\1(\s|$)/i,regBg=/(?:background|background-color|bgcolor)\s*[:=]\s*(["']?)\s*((rgb\s*\(\s*\d{1,3}%?,\s*\d{1,3}%?\s*,\s*\d{1,3}%?\s*\))|(#[0-9a-f]{3,6})|([a-z]{1,20}))\s*\1/i
var i,sUBB=String(sHtml),arrcode=new Array(),cnum=0;
sUBB=sUBB.replace(/\s*\r?\n\s*/g,'');
sUBB = sUBB.replace(/<(script|style)(\s+[^>]*?)?>[\s\S]*?<\/\1>/ig, '');
sUBB = sUBB.replace(/<!--[\s\S]*?-->/ig,'');
sUBB=sUBB.replace(/<br(\s+[^>]*)?\/?>/ig,"\r\n");
sUBB=sUBB.replace(/\[code\s*(=\s*([^\]]+?))?\]([\s\S]*?)\[\/code\]/ig,function(all,t,c){//code特殊处理
cnum++;arrcode[cnum]=all;
return "[\tubbcodeplace_"+cnum+"\t]";
});
sUBB=sUBB.replace(/<(\/?)(b|u|i|s)(\s+[^>]*?)?>/ig,'[$1$2]');
sUBB=sUBB.replace(/<(\/?)strong(\s+[^>]*?)?>/ig,'[$1b]');
sUBB=sUBB.replace(/<(\/?)em(\s+[^>]*?)?>/ig,'[$1i]');
sUBB=sUBB.replace(/<(\/?)(strike|del)(\s+[^>]*?)?>/ig,'[$1s]');
sUBB=sUBB.replace(/<(\/?)(sup|sub)(\s+[^>]*?)?>/ig,'[$1$2]');
//font转ubb
function font2ubb(all,tag,attrs,content)
{
if(!attrs)return content;
var arrStart=[],arrEnd=[];
var match;
match=attrs.match(/ face\s*=\s*"\s*([^"]+)\s*"/i);
if(match){
arrStart.push('[font='+match[1]+']');
arrEnd.push('[/font]');
}
match=attrs.match(/ size\s*=\s*"\s*(\d+)\s*"/i);
if(match){
arrStart.push('[size='+match[1]+']');
arrEnd.push('[/size]');
}
match=attrs.match(/ color\s*=\s*"\s*([^"]+)\s*"/i);
if(match){
arrStart.push('[color='+formatColor(match[1])+']');
arrEnd.push('[/color]');
}
return arrStart.join('')+content+arrEnd.join('');
}
sUBB = sUBB.replace(/<(font)(\s+[^>]*?)?>(((?!<\1(\s+[^>]*?)?>)[\s\S]|<\1(\s+[^>]*?)?>((?!<\1(\s+[^>]*?)?>)[\s\S]|<\1(\s+[^>]*?)?>((?!<\1(\s+[^>]*?)?>)[\s\S])*?<\/\1>)*?<\/\1>)*?)<\/\1>/ig,font2ubb);//第3层
sUBB = sUBB.replace(/<(font)(\s+[^>]*?)?>(((?!<\1(\s+[^>]*?)?>)[\s\S]|<\1(\s+[^>]*?)?>((?!<\1(\s+[^>]*?)?>)[\s\S])*?<\/\1>)*?)<\/\1>/ig,font2ubb);//第2层
sUBB = sUBB.replace(/<(font)(\s+[^>]*?)?>(((?!<\1(\s+[^>]*?)?>)[\s\S])*?)<\/\1>/ig,font2ubb);//最里层
for(i=0;i<3;i++)sUBB=sUBB.replace(/<(span)(?:\s+[^>]*?)?\s+style\s*=\s*"((?:[^"]*?;)*\s*(?:font-family|font-size|color|background|background-color)\s*:[^"]*)"(?: [^>]+)?>(((?!<\1(\s+[^>]*?)?>)[\s\S]|<\1(\s+[^>]*?)?>((?!<\1(\s+[^>]*?)?>)[\s\S]|<\1(\s+[^>]*?)?>((?!<\1(\s+[^>]*?)?>)[\s\S])*?<\/\1>)*?<\/\1>)*?)<\/\1>/ig,function(all,tag,style,content){
var face=style.match(/(?:^|;)\s*font-family\s*:\s*([^;]+)/i),size=style.match(/(?:^|;)\s*font-size\s*:\s*([^;]+)/i),color=style.match(/(?:^|;)\s*color\s*:\s*([^;]+)/i),back=style.match(/(?:^|;)\s*(?:background|background-color)\s*:\s*([^;]+)/i),str=content;
var arrStart=[],arrEnd=[];
if(face){
arrStart.push('[font='+face[1]+']');
arrEnd.push('[/font]');
}
if(size){
arrStart.push('[size='+size[1]+']');
arrEnd.push('[/size]');
}
if(color){
arrStart.push('[color='+formatColor(color[1])+']');
arrEnd.push('[/color]');
}
if(back){
arrStart.push('[back='+formatColor(back[1])+']');
arrEnd.push('[/back]');
}
return arrStart.join('')+str+arrEnd.join('');
});
function formatColor(c)
{
var matchs;
if(matchs=c.match(/\s*rgb\s*\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*\)/i)){c=(matchs[1]*65536+matchs[2]*256+matchs[3]*1).toString(16);while(c.length<6)c='0'+c;c='#'+c;}
c=c.replace(/^#([0-9a-f])([0-9a-f])([0-9a-f])$/i,'#$1$1$2$2$3$3');
return c;
}
for(i=0;i<3;i++)sUBB=sUBB.replace(/<(div|p)(?:\s+[^>]*?)?[\s"';]\s*(?:text-)?align\s*[=:]\s*(["']?)\s*(left|center|right)\s*\2[^>]*>(((?!<\1(\s+[^>]*?)?>)[\s\S])+?)<\/\1>/ig,'[align=$3]$4[/align]');
for(i=0;i<3;i++)sUBB=sUBB.replace(/<(center)(?:\s+[^>]*?)?>(((?!<\1(\s+[^>]*?)?>)[\s\S])*?)<\/\1>/ig,'[align=center]$2[/align]');
for(i=0;i<3;i++)sUBB=sUBB.replace(/<(p|div)(?:\s+[^>]*?)?\s+style\s*=\s*"(?:[^;"]*;)*\s*text-align\s*:([^;"]*)[^"]*"(?: [^>]+)?>(((?!<\1(\s+[^>]*?)?>)[\s\S]|<\1(\s+[^>]*?)?>((?!<\1(\s+[^>]*?)?>)[\s\S]|<\1(\s+[^>]*?)?>((?!<\1(\s+[^>]*?)?>)[\s\S])*?<\/\1>)*?<\/\1>)*?)<\/\1>/ig,function(all,tag,align,content){
return '[align='+align+']'+content+'[/align]';
});
sUBB=sUBB.replace(/<a(?:\s+[^>]*?)?\s+href=(["'])\s*(.+?)\s*\1[^>]*>\s*([\s\S]*?)\s*<\/a>/ig,function(all,q,url,text){
if(!(url&&text))return '';
var tag='url',str;
if(url.match(/^mailto:/i))
{
tag='email';
url=url.replace(/mailto:(.+?)/i,'$1');
}
str='['+tag;
if(url!=text)str+='='+url;
return str+']'+text+'[/'+tag+']';
});
sUBB=sUBB.replace(/<img(\s+[^>]*?)\/?>/ig,function(all,attr){
var emot=attr.match(/\s+emot\s*=\s*(["']?)\s*(.+?)\s*\1(\s|$)/i);
if(emot)return '[emot='+emot[2]+'/]';
var url=attr.match(regSrc),alt=attr.match(/\s+alt\s*=\s*(["']?)\s*(.*?)\s*\1(\s|$)/i),w=attr.match(regWidth),h=attr.match(regHeight),align=attr.match(/\s+align\s*=\s*(["']?)\s*(\w+)\s*\1(\s|$)/i),str='[img',p='';
if(!url)return '';
p+=alt[2];
if(w||h)p+=','+(w?w[2]:'')+','+(h?h[2]:'');
if(align)p+=','+align[2];
if(p)str+='='+p;
str+=']'+url[2]+'[/img]';
return str;
});
sUBB=sUBB.replace(/<blockquote(?:\s+[^>]*?)?>/ig,'[quote]');
sUBB=sUBB.replace(/<\/blockquote>/ig,'[/quote]');
sUBB=sUBB.replace(/<embed((?:\s+[^>]*?)?(?:\s+type\s*=\s*"\s*application\/x-shockwave-flash\s*"|\s+classid\s*=\s*"\s*clsid:d27cdb6e-ae6d-11cf-96b8-4445535400000\s*")[^>]*?)\/?>/ig,function(all,attr){
var url=attr.match(regSrc),w=attr.match(regWidth),h=attr.match(regHeight),str='[flash';
if(!url)return '';
if(w&&h)str+='='+w[2]+','+h[2];
str+=']'+url[2];
return str+'[/flash]';
});
sUBB=sUBB.replace(/<embed((?:\s+[^>]*?)?(?:\s+type\s*=\s*"\s*application\/x-mplayer2\s*"|\s+classid\s*=\s*"\s*clsid:6bf52a52-394a-11d3-b153-00c04f79faa6\s*")[^>]*?)\/?>/ig,function(all,attr){
var url=attr.match(regSrc),w=attr.match(regWidth),h=attr.match(regHeight),p=attr.match(/\s+autostart\s*=\s*(["']?)\s*(.+?)\s*\1(\s|$)/i),str='[media',auto='0';
if(!url)return '';
if(p)if(p[2]=='true')auto='1';
if(w&&h)str+='='+w[2]+','+h[2]+','+auto;
str+=']'+url[2];
return str+'[/media]';
});
sUBB=sUBB.replace(/<table(\s+[^>]*?)?>/ig,function(all,attr){
var str='[table';
if(attr)
{
var w=attr.match(regWidth),b=attr.match(regBg);
if(w)
{
str+='='+w[2];
if(b)str+=','+b[2];
}
}
return str+']';
});
sUBB=sUBB.replace(/<tr(\s+[^>]*?)?>/ig,function(all,attr){
var str='[tr';
if(attr)
{
var bg=attr.match(regBg)
if(bg)str+='='+bg[2];
}
return str+']';
});
sUBB=sUBB.replace(/<(?:th|td)(\s+[^>]*?)?>/ig,function(all,attr){
var str='[td';
if(attr)
{
var col=attr.match(/\s+colspan\s*=\s*(["']?)\s*(\d+)\s*\1(\s|$)/i),row=attr.match(/\s+rowspan\s*=\s*(["']?)\s*(\d+)\s*\1(\s|$)/i),w=attr.match(regWidth);
col=col?col[2]:1;
row=row?row[2]:1;
if(col>1||row>1||w)str+='='+col+','+row;
if(w)str+=','+w[2];
}
return str+']';
});
sUBB=sUBB.replace(/<\/(table|tr)>/ig,'[/$1]');
sUBB=sUBB.replace(/<\/(th|td)>/ig,'[/td]');
sUBB=sUBB.replace(/<ul(\s+[^>]*?)?>/ig,function(all,attr){
var t;
if(attr)t=attr.match(/\s+type\s*=\s*(["']?)\s*(.+?)\s*\1(\s|$)/i);
return '[list'+(t?'='+t[2]:'')+']';
});
sUBB=sUBB.replace(/<ol(\s+[^>]*?)?>/ig,'[list=1]');
sUBB=sUBB.replace(/<li(\s+[^>]*?)?>/ig,'[*]');
sUBB=sUBB.replace(/<\/li>/ig,'');
sUBB=sUBB.replace(/<\/(ul|ol)>/ig,'[/list]');
sUBB=sUBB.replace(/<h([1-6])(\s+[^>]*?)?>/ig,function(all,n){return '\r\n\r\n[size='+(7-n)+'][b]'});
sUBB=sUBB.replace(/<\/h[1-6]>/ig,'[/b][/size]\r\n\r\n');
sUBB=sUBB.replace(/<address(\s+[^>]*?)?>/ig,'\r\n[i]');
sUBB=sUBB.replace(/<\/address>/ig,'[i]\r\n');
sUBB=sUBB.replace(/<hr(\s+[^>]*?)?\/>/ig,'[hr/]');
for(i=0;i<3;i++)sUBB=sUBB.replace(/<(p)(?:\s+[^>]*?)?>(((?!<\1(\s+[^>]*?)?>)[\s\S]|<\1(\s+[^>]*?)?>((?!<\1(\s+[^>]*?)?>)[\s\S]|<\1(\s+[^>]*?)?>((?!<\1(\s+[^>]*?)?>)[\s\S])*?<\/\1>)*?<\/\1>)*?)<\/\1>/ig,"\r\n\r\n$2\r\n\r\n");
for(i=0;i<3;i++)sUBB=sUBB.replace(/<(div)(?:\s+[^>]*?)?>(((?!<\1(\s+[^>]*?)?>)[\s\S]|<\1(\s+[^>]*?)?>((?!<\1(\s+[^>]*?)?>)[\s\S]|<\1(\s+[^>]*?)?>((?!<\1(\s+[^>]*?)?>)[\s\S])*?<\/\1>)*?<\/\1>)*?)<\/\1>/ig,"\r\n$2\r\n");
sUBB=sUBB.replace(/((\s| )*\r?\n){3,}/g,"\r\n\r\n");//限制最多2次换行
sUBB=sUBB.replace(/^((\s| )*\r?\n)+/g,'');//清除开头换行
sUBB=sUBB.replace(/((\s| )*\r?\n)+$/g,'');//清除结尾换行
for(i=1;i<=cnum;i++)sUBB=sUBB.replace("[\tubbcodeplace_"+i+"\t]", arrcode[i]);
sUBB=sUBB.replace(/<[^<>]+?>/g,'');//删除所有HTML标签
var arrEntities={'lt':'<','gt':'>','nbsp':' ','amp':'&','quot':'"'};
sUBB=sUBB.replace(/&(lt|gt|nbsp|amp|quot);/ig,function(all,t){return arrEntities[t];});
//清除空内容的UBB标签
sUBB=sUBB.replace(/\[([a-z]+)(?:=[^\[\]]+)?\]\s*\[\/\1\]/ig,'');
return sUBB;
} | zz-ms | trunk/zz-ms-v2.0/src/main/webapp/js/xheditor/src/ubb.js | JavaScript | asf20 | 13,971 |
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>上传接口测试程序</title>
</head>
<body>
<form method="post" name="form1" action="upload.php?immediate=1" enctype="multipart/form-data">
<input type="file" size="13" name="filedata" />
<input type="submit" size="13" name="submit" value="提交上传" />
</form>
</body>
</html> | zz-ms | trunk/zz-ms-v2.0/src/main/webapp/js/xheditor/demos/uptest.html | HTML | asf20 | 554 |
<?php
//此程序为UBB模式下的服务端显示测试程序
header('Content-Type: text/html; charset=utf-8');
require_once '../serverscript/php/ubb2html.php';
$sHtml=ubb2html($_POST['elm1']);//htmlspecialchars
function showCode($match)
{
$match[1]=strtolower($match[1]);
if(!$match[1])$match[1]='plain';
$match[2]=preg_replace("/</",'<',$match[2]);
$match[2]=preg_replace("/>/",'>',$match[2]);
return '<pre class="prettyprint lang-'.$match[1].'">'.$match[2].'</pre>';
}
$sHtml=preg_replace_callback('/\[code\s*(?:=\s*((?:(?!")[\s\S])+?)(?:"[\s\S]*?)?)?\]([\s\S]*?)\[\/code\]/i','showCode',$sHtml);
function showFlv($match)
{
$w=$match[1];$h=$match[2];$url=$match[3];
if(!$w)$w=480;if(!$h)$h=400;
return '<embed type="application/x-shockwave-flash" src="mediaplayer/player.swf" wmode="transparent" allowscriptaccess="always" allowfullscreen="true" quality="high" bgcolor="#ffffff" width="'.$w.'" height="'.$h.'" flashvars="file='.$url.'" />';
}
$sHtml=preg_replace_callback('/\[flv\s*(?:=\s*(\d+)\s*,\s*(\d+)\s*)?\]\s*(((?!")[\s\S])+?)(?:"[\s\S]*?)?\s*\[\/flv\]/i','showFlv',$sHtml);
?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>UBB文章显示测试页</title>
<style type="text/css">
body{margin:5px;border:2px solid #ccc;padding:5px;font:12px tahoma,arial,sans-serif;line-height:1.2}
</style>
<link type="text/css" rel="stylesheet" href="prettify/prettify.css"/>
<script type="text/javascript" src="prettify/prettify.js"></script>
<body>
<?php echo $sHtml?>
<script type="text/javascript">prettyPrint();</script>
</body>
</html> | zz-ms | trunk/zz-ms-v2.0/src/main/webapp/js/xheditor/demos/showubb.php | PHP | asf20 | 1,791 |
<?php
header('Content-Type: text/html; charset=utf-8');
$magicQ=get_magic_quotes_gpc();
echo '<div>';
for($i=1;$i<10;$i++)
{
if(isset($_POST['elm'.$i]))
{
if($magicQ)$_POST['elm'.$i]=stripslashes($_POST['elm'.$i]);
echo '<textarea rows="10" cols="50">'.htmlspecialchars($_POST['elm'.$i]).'</textarea>';
}
}
echo '</div><p style="text-align:center;"><br /><input type="button" value="点击后退" onclick="javascript:history.back();" /></p>';
?> | zz-ms | trunk/zz-ms-v2.0/src/main/webapp/js/xheditor/demos/show.php | PHP | asf20 | 465 |
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>xhEditor demo11 : 异步加载</title>
<link rel="stylesheet" href="common.css" type="text/css" media="screen" />
<script type="text/javascript" src="../jquery/jquery-1.4.4.min.js"></script>
<script type="text/javascript">
function loadJS(url,callback,charset)
{
var script = document.createElement('script');
script.onload = script.onreadystatechange = function ()
{
if (script && script.readyState && /^(?!(?:loaded|complete)$)/.test(script.readyState)) return;
script.onload = script.onreadystatechange = null;
script.src = '';
script.parentNode.removeChild(script);
script = null;
if(callback)callback();
};
script.charset=charset || document.charset || document.characterSet;
script.src = url;
try {document.getElementsByTagName("head")[0].appendChild(script);} catch (e) {}
}
function initEditor()
{
loadJS('../xheditor-1.1.14-zh-cn.min.js',function(){$('#elm1').xheditor({shortcuts:{'ctrl+enter':submitForm}});$('#btnInit').hide();});
}
function submitForm(){$('#frmDemo').submit();}
</script>
</head>
<body>
<div id="header-nav">
<ul>
<li><a href="demo01.html"><span>默认模式</span></a></li>
<li><a href="demo02.html"><span>自定义按钮</span></a></li>
<li><a href="demo03.html"><span>皮肤选择</span></a></li>
<li><a href="demo04.html"><span>其它选项</span></a></li>
<li><a href="demo05.html"><span>API交互</span></a></li>
<li><a href="demo06.html"><span>非utf-8编码调用</span></a></li>
<li><a href="demo07.html"><span>UBB可视化</span></a></li>
<li><a href="demo08.html"><span>Ajax上传</span></a></li>
<li><a href="demo09.html"><span>插件扩展</span></a></li>
<li><a href="demo10.html"><span>iframe调用上传</span></a></li>
<li><a href="demo11.html"><span>异步加载</span></a></li>
<li><a href="demo12.html"><span>远程抓图</span></a></li>
<li><a href="../wizard.html" target="_blank"><span>生成代码</span></a></li>
</ul>
</div>
<form id="frmDemo" method="post" action="show.php">
<h3>xhEditor demo11 : 异步加载</h3>
<textarea id="elm1" name="elm1" rows="12" cols="80" style="width: 80%">
<p>当前实例调用的Javascript源代码为:</p><pre>loadJS('../xheditor-1.1.14-zh-cn.min.js',function(){$('#elm1').xheditor();});<br /></pre>
</textarea>
<br/><br />
<input type="button" id="btnInit" value="加载js文件并初始化编辑器" onclick="initEditor()" />
<input type="submit" name="save" value="Submit" />
<input type="reset" name="reset" value="Reset" />
</form>
</body>
</html> | zz-ms | trunk/zz-ms-v2.0/src/main/webapp/js/xheditor/demos/demo11.html | HTML | asf20 | 2,839 |
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>xhEditor demos</title>
<style type="text/css" rel="stylesheet">
body {
font-size: 12px;
font-family: Courier New;
}
li {
margin: 5px;
}
</style>
</head>
<body>
<h4>xhEditor演示程序列表</h4>
<ol>
<li><a href="demo01.html" target="_blank">demo01.html</a> (默认模式)</li>
<li><a href="demo02.html" target="_blank">demo02.html</a> (自定义按钮)</li>
<li><a href="demo03.html" target="_blank">demo03.html</a> (皮肤选择)</li>
<li><a href="demo04.html" target="_blank">demo04.html</a> (其它选项)</li>
<li><a href="demo05.html" target="_blank">demo05.html</a> (Javascript API交互)</li>
<li><a href="demo06.html" target="_blank">demo06.html</a> (非utf-8编码网页调用)</li>
<li><a href="demo07.html" target="_blank">demo07.html</a> (UBB可视化编辑)</li>
<li><a href="demo08.html" target="_blank">demo08.html</a> (Ajax文件上传)</li>
<li><a href="demo09.html" target="_blank">demo09.html</a> (插件扩展)</li>
<li><a href="demo10.html" target="_blank">demo10.html</a> (iframe调用文件上传)</li>
<li><a href="demo11.html" target="_blank">demo11.html</a> (异步加载)</li>
<li><a href="demo12.html" target="_blank">demo12.html</a> (远程抓图)</li>
</ol>
</body>
</html>
| zz-ms | trunk/zz-ms-v2.0/src/main/webapp/js/xheditor/demos/index.html | HTML | asf20 | 1,567 |
<%@ codepage=65001%><%
' upload demo for asp
' @requires xhEditor
'
' @author Yanis.Wang<yanis.wang@gmail.com>
' @site http://xheditor.com/
' @licence LGPL(http://www.opensource.org/licenses/lgpl-license.php)
'
' @Version: 0.9.4 (build 111027)
'
' 注1:本程序仅为演示用,请您根据自己需求进行相应修改,或者重开发
' 注2:本程序调用的无惧上传类 V2.2为xhEditor特别针对HTML5上传而修改过的版本
'option explicit
response.charset="UTF-8"
dim inputname,immediate,attachdir,dirtype,maxattachsize,upext,msgtype
inputname="filedata"'表单文件域name
attachdir="upload"'上传文件保存路径,结尾不要带/
dirtype=1'1:按天存入目录 2:按月存入目录 3:按扩展名存目录 建议使用按天存
maxattachsize=2097152'最大上传大小,默认是2M
upext="txt,rar,zip,jpg,jpeg,gif,png,swf,wmv,avi,wma,mp3,mid"'上传扩展名
msgtype=2'返回上传参数的格式:1,只返回url,2,返回参数数组
immediate=Request.QueryString("immediate")'立即上传模式,仅为演示用
dim err,msg,upfile
err = ""
msg = "''"
set upfile=new upfile_class
upfile.AllowExt=replace(upext,",",";")+";"
upfile.GetData(maxattachsize)
if upfile.isErr then
select case upfile.isErr
case 1
err="无数据提交"
case 2
err="文件大小超过 "+cstr(maxattachsize)+"字节"
case else
err=upfile.ErrMessage
end select
else
dim attach_dir,attach_subdir,filename,extension,target,tmpfile
extension=upfile.file(inputname).FileExt
select case dirtype
case 1
attach_subdir="day_"+DateFormat(now,"yymmdd")
case 2
attach_subdir="month_"+DateFormat(now,"yymm")
case 3
attach_subdir="ext_"+extension
end select
attach_dir=attachdir+"/"+attach_subdir+"/"
'建文件夹
CreateFolder attach_dir
tmpfile=upfile.AutoSave(inputname,Server.mappath(attach_dir)+"\")
if upfile.isErr then
if upfile.isErr=3 then
err="上传文件扩展名必需为:"+upext
else
err=upfile.ErrMessage
end if
else
'生成随机文件名并改名
Randomize timer
filename=DateFormat(now,"yyyymmddhhnnss")+cstr(cint(9999*Rnd))+"."+extension
target=attach_dir+filename
moveFile attach_dir+tmpfile,target
if immediate="1" then target="!"+target
target=jsonString(target)
if msgtype=1 then
msg="'"+target+"'"
else
msg="{'url':'"+target+"','localname':'"+jsonString(upfile.file(inputname).FileName)+"','id':'1'}"
end if
end if
end if
set upfile=nothing
response.write "{'err':'"+jsonString(err)+"','msg':"+msg+"}"
function jsonString(str)
str=replace(str,"\","\\")
str=replace(str,"/","\/")
str=replace(str,"'","\'")
jsonString=str
end function
Function Iif(expression,returntrue,returnfalse)
If expression=true Then
iif=returntrue
Else
iif=returnfalse
End If
End Function
function DateFormat(strDate,fstr)
if isdate(strDate) then
dim i,temp
temp=replace(fstr,"yyyy",DatePart("yyyy",strDate))
temp=replace(temp,"yy",mid(DatePart("yyyy",strDate),3))
temp=replace(temp,"y",DatePart("y",strDate))
temp=replace(temp,"w",DatePart("w",strDate))
temp=replace(temp,"ww",DatePart("ww",strDate))
temp=replace(temp,"q",DatePart("q",strDate))
temp=replace(temp,"mm",iif(len(DatePart("m",strDate))>1,DatePart("m",strDate),"0"&DatePart("m",strDate)))
temp=replace(temp,"dd",iif(len(DatePart("d",strDate))>1,DatePart("d",strDate),"0"&DatePart("d",strDate)))
temp=replace(temp,"hh",iif(len(DatePart("h",strDate))>1,DatePart("h",strDate),"0"&DatePart("h",strDate)))
temp=replace(temp,"nn",iif(len(DatePart("n",strDate))>1,DatePart("n",strDate),"0"&DatePart("n",strDate)))
temp=replace(temp,"ss",iif(len(DatePart("s",strDate))>1,DatePart("s",strDate),"0"&DatePart("s",strDate)))
DateFormat=temp
else
DateFormat=false
end if
end function
Function CreateFolder(FolderPath)
dim lpath,fs,f
lpath=Server.MapPath(FolderPath)
Set fs=Server.CreateObject("Scri"&"pting.File"&"Sys"&"temObject")
If not fs.FolderExists(lpath) then
Set f=fs.CreateFolder(lpath)
CreateFolder=F.Path
end if
Set F=Nothing
Set fs=Nothing
End Function
Function moveFile(oldfile,newfile)
dim fs
Set fs=Server.CreateObject("Scri"&"pting.File"&"Sys"&"temObject")
fs.movefile Server.MapPath(oldfile),Server.MapPath(newfile)
Set fs=Nothing
End Function
'----------------------------------------------------------------------
'转发时请保留此声明信息,这段声明不并会影响你的速度!
'******************* 无惧上传类 V2.2 xheditor特别修改版 ************************************
'作者:梁无惧
'网站:http://www.25cn.com
'电子邮件:yjlrb@21cn.com
'版权声明:版权所有,源代码公开,各种用途均可免费使用,但是修改后必须把修改后的文件
'发送一份给作者.并且保留作者此版权信息
'**********************************************************************
'----------------------------------------------------------------------
'----------------------------------------------------------------------
'文件上传类
Class UpFile_Class
Dim Form,File
Dim AllowExt_ '允许上传类型(白名单)
Dim NoAllowExt_ '不允许上传类型(黑名单)
Dim IsDebug_ '是否显示出错信息
Private oUpFileStream '上传的数据流
Private isErr_ '错误的代码,0或true表示无错
Private ErrMessage_ '错误的字符串信息
Private isGetData_ '指示是否已执行过GETDATA过程
'------------------------------------------------------------------
'类的属性
Public Property Get Version
Version="无惧上传类 Version V2.0"
End Property
Public Property Get isErr '错误的代码,0或true表示无错
isErr=isErr_
End Property
Public Property Get ErrMessage '错误的字符串信息
ErrMessage=ErrMessage_
End Property
Public Property Get AllowExt '允许上传类型(白名单)
AllowExt=AllowExt_
End Property
Public Property Let AllowExt(Value) '允许上传类型(白名单)
AllowExt_=LCase(Value)
End Property
Public Property Get NoAllowExt '不允许上传类型(黑名单)
NoAllowExt=NoAllowExt_
End Property
Public Property Let NoAllowExt(Value) '不允许上传类型(黑名单)
NoAllowExt_=LCase(Value)
End Property
Public Property Let IsDebug(Value) '是否设置为调试模式
IsDebug_=Value
End Property
'----------------------------------------------------------------
'类实现代码
'初始化类
Private Sub Class_Initialize
isErr_ = 0
NoAllowExt="" '黑名单,可以在这里预设不可上传的文件类型,以文件的后缀名来判断,不分大小写,每个每缀名用;号分开,如果黑名单为空,则判断白名单
NoAllowExt=LCase(NoAllowExt)
AllowExt="" '白名单,可以在这里预设可上传的文件类型,以文件的后缀名来判断,不分大小写,每个后缀名用;号分开
AllowExt=LCase(AllowExt)
isGetData_=false
End Sub
'类结束
Private Sub Class_Terminate
on error Resume Next
'清除变量及对像
Form.RemoveAll
Set Form = Nothing
File.RemoveAll
Set File = Nothing
oUpFileStream.Close
Set oUpFileStream = Nothing
if Err.number<>0 then OutErr("清除类时发生错误!")
End Sub
'分析上传的数据
Public Sub GetData (MaxSize)
'定义变量
on error Resume Next
if isGetData_=false then
Dim RequestBinData,sSpace,bCrLf,sInfo,iInfoStart,iInfoEnd,tStream,iStart,oFileInfo
Dim sFormValue,sFileName
Dim iFindStart,iFindEnd
Dim iFormStart,iFormEnd,sFormName
'代码开始
If Request.TotalBytes < 1 Then '如果没有数据上传
isErr_ = 1
ErrMessage_="没有数据上传,这是因为直接提交网址所产生的错误!"
OutErr("没有数据上传,这是因为直接提交网址所产生的错误!!")
Exit Sub
End If
If MaxSize > 0 Then '如果限制大小
If Request.TotalBytes > MaxSize Then
isErr_ = 2 '如果上传的数据超出限制大小
ErrMessage_="上传的数据超出限制大小!"
OutErr("上传的数据超出限制大小!")
Exit Sub
End If
End If
Set Form = Server.CreateObject ("Scripting.Dictionary")
Form.CompareMode = 1
Set File = Server.CreateObject ("Scripting.Dictionary")
File.CompareMode = 1
Set tStream = Server.CreateObject ("ADODB.Stream")
Set oUpFileStream = Server.CreateObject ("ADODB.Stream")
if Err.number<>0 then OutErr("创建流对象(ADODB.STREAM)时出错,可能系统不支持或没有开通该组件")
oUpFileStream.Type = 1
oUpFileStream.Mode = 3
oUpFileStream.Open
oUpFileStream.Write Request.BinaryRead (Request.TotalBytes)
oUpFileStream.Position = 0
RequestBinData = oUpFileStream.Read
Dim sHtml5FileInfo
sHtml5FileInfo=Request.ServerVariables("HTTP_CONTENT_DISPOSITION")
If sHtml5FileInfo<>"" Then'针对Html5上传特别修正
iFindStart = InStr (1,sHtml5FileInfo,"name=""",1)+6
iFindEnd = InStr (iFindStart,sHtml5FileInfo,"""",1)
sFormName=Trim(Mid(sHtml5FileInfo,iFindStart,iFindEnd-iFindStart))
iFindStart = InStr (iFindStart,sHtml5FileInfo,"filename=""",1)+10
iFindEnd = InStr (iFindStart,sHtml5FileInfo,"""",1)
sFileName = Trim(Mid(sHtml5FileInfo,iFindStart,iFindEnd-iFindStart))
Set oFileInfo = new FileInfo_Class
oFileInfo.FileName = URLDecode(GetFileName(sFileName))
oFileInfo.FilePath = GetFilePath(sFileName)
oFileInfo.FileExt = GetFileExt(sFileName)
oFileInfo.FileStart = 0
oFileInfo.FileSize = Request.TotalBytes
oFileInfo.FormName = sFormName
file.add sFormName,oFileInfo
Else
iFormEnd = oUpFileStream.Size
bCrLf = ChrB (13) & ChrB (10)
'取得每个项目之间的分隔符
sSpace = MidB (RequestBinData,1, InStrB (1,RequestBinData,bCrLf)-1)
iStart = LenB(sSpace)
iFormStart = iStart+2
'分解项目
Do
iInfoEnd = InStrB (iFormStart,RequestBinData,bCrLf & bCrLf)+3
tStream.Type = 1
tStream.Mode = 3
tStream.Open
oUpFileStream.Position = iFormStart
oUpFileStream.CopyTo tStream,iInfoEnd-iFormStart
tStream.Position = 0
tStream.Type = 2
tStream.CharSet = "utf-8"
sInfo = tStream.ReadText
'取得表单项目名称
iFormStart = InStrB (iInfoEnd,RequestBinData,sSpace)-1
iFindStart = InStr (22,sInfo,"name=""",1)+6
iFindEnd = InStr (iFindStart,sInfo,"""",1)
sFormName = Mid(sinfo,iFindStart,iFindEnd-iFindStart)
'如果是文件
If InStr (45,sInfo,"filename=""",1) > 0 Then
Set oFileInfo = new FileInfo_Class
'取得文件属性
iFindStart = InStr (iFindEnd,sInfo,"filename=""",1)+10
iFindEnd = InStr (iFindStart,sInfo,""""&vbCrLf,1)
sFileName = Trim(Mid(sinfo,iFindStart,iFindEnd-iFindStart))
oFileInfo.FileName = GetFileName(sFileName)
oFileInfo.FilePath = GetFilePath(sFileName)
oFileInfo.FileExt = GetFileExt(sFileName)
iFindStart = InStr (iFindEnd,sInfo,"Content-Type: ",1)+14
iFindEnd = InStr (iFindStart,sInfo,vbCr)
oFileInfo.FileMIME = Mid(sinfo,iFindStart,iFindEnd-iFindStart)
oFileInfo.FileStart = iInfoEnd
oFileInfo.FileSize = iFormStart -iInfoEnd -2
oFileInfo.FormName = sFormName
file.add sFormName,oFileInfo
else
'如果是表单项目
tStream.Close
tStream.Type = 1
tStream.Mode = 3
tStream.Open
oUpFileStream.Position = iInfoEnd
oUpFileStream.CopyTo tStream,iFormStart-iInfoEnd-2
tStream.Position = 0
tStream.Type = 2
tStream.CharSet = "utf-8"
sFormValue = tStream.ReadText
If Form.Exists (sFormName) Then
Form (sFormName) = Form (sFormName) & ", " & sFormValue
else
Form.Add sFormName,sFormValue
End If
End If
tStream.Close
iFormStart = iFormStart+iStart+2
'如果到文件尾了就退出
Loop Until (iFormStart+2) >= iFormEnd
if Err.number<>0 then OutErr("分解上传数据时发生错误,可能客户端的上传数据不正确或不符合上传数据规则")
End if
RequestBinData = ""
Set tStream = Nothing
isGetData_=true
end if
End Sub
'保存到文件,自动覆盖已存在的同名文件
Public Function SaveToFile(Item,Path)
SaveToFile=SaveToFileEx(Item,Path,True)
End Function
'保存到文件,自动设置文件名
Public Function AutoSave(Item,Path)
AutoSave=SaveToFileEx(Item,Path,false)
End Function
'保存到文件,OVER为真时,自动覆盖已存在的同名文件,否则自动把文件改名保存
Private Function SaveToFileEx(Item,Path,Over)
On Error Resume Next
Dim FileExt
if file.Exists(Item) then
Dim oFileStream
Dim tmpPath
isErr_=0
Set oFileStream = CreateObject ("ADODB.Stream")
oFileStream.Type = 1
oFileStream.Mode = 3
oFileStream.Open
oUpFileStream.Position = File(Item).FileStart
oUpFileStream.CopyTo oFileStream,File(Item).FileSize
tmpPath=Split(Path,".")(0)
FileExt=GetFileExt(Path)
if Over then
if isAllowExt(FileExt) then
oFileStream.SaveToFile tmpPath & "." & FileExt,2
if Err.number<>0 then OutErr("保存文件时出错,请检查路径,是否存在该上传目录!该文件保存路径为" & tmpPath & "." & FileExt)
Else
isErr_=3
ErrMessage_="该后缀名的文件不允许上传!"
OutErr("该后缀名的文件不允许上传")
End if
Else
Path=GetFilePath(Path)
dim fori
fori=1
if isAllowExt(File(Item).FileExt) then
do
fori=fori+1
Err.Clear()
tmpPath=Path&GetNewFileName()&"."&File(Item).FileExt
oFileStream.SaveToFile tmpPath
loop Until ((Err.number=0) or (fori>50))
if Err.number<>0 then OutErr("自动保存文件出错,已经测试50次不同的文件名来保存,请检查目录是否存在!该文件最后一次保存时全路径为"&Path&GetNewFileName()&"."&File(Item).FileExt)
Else
isErr_=3
ErrMessage_="该后缀名的文件不允许上传!"
OutErr("该后缀名的文件不允许上传")
End if
End if
oFileStream.Close
Set oFileStream = Nothing
else
ErrMessage_="不存在该对象(如该文件没有上传,文件为空)!"
OutErr("不存在该对象(如该文件没有上传,文件为空)")
end if
if isErr_=3 then SaveToFileEx="" else SaveToFileEx=GetFileName(tmpPath)
End Function
'取得文件数据
Public Function FileData(Item)
isErr_=0
if file.Exists(Item) then
if isAllowExt(File(Item).FileExt) then
oUpFileStream.Position = File(Item).FileStart
FileData = oUpFileStream.Read (File(Item).FileSize)
Else
isErr_=3
ErrMessage_="该后缀名的文件不允许上传"
OutErr("该后缀名的文件不允许上传")
FileData=""
End if
else
ErrMessage_="不存在该对象(如该文件没有上传,文件为空)!"
OutErr("不存在该对象(如该文件没有上传,文件为空)")
end if
End Function
'取得文件路径
Public function GetFilePath(FullPath)
If FullPath <> "" Then
GetFilePath = Left(FullPath,InStrRev(FullPath, "\"))
Else
GetFilePath = ""
End If
End function
'取得文件名
Public Function GetFileName(FullPath)
If FullPath <> "" Then
GetFileName = mid(FullPath,InStrRev(FullPath, "\")+1)
Else
GetFileName = ""
End If
End function
'取得文件的后缀名
Public Function GetFileExt(FullPath)
If FullPath <> "" Then
GetFileExt = LCase(Mid(FullPath,InStrRev(FullPath, ".")+1))
Else
GetFileExt = ""
End If
End function
'取得一个不重复的序号
Public Function GetNewFileName()
dim ranNum
dim dtNow
dtNow=Now()
randomize
ranNum=int(90000*rnd)+10000
'以下这段由webboy提供
GetNewFileName=year(dtNow) & right("0" & month(dtNow),2) & right("0" & day(dtNow),2) & right("0" & hour(dtNow),2) & right("0" & minute(dtNow),2) & right("0" & second(dtNow),2) & ranNum
End Function
Public Function isAllowExt(Ext)
if NoAllowExt="" then
isAllowExt=cbool(InStr(1,";"&AllowExt&";",LCase(";"&Ext&";")))
else
isAllowExt=not CBool(InStr(1,";"&NoAllowExt&";",LCase(";"&Ext&";")))
end if
End Function
End Class
Public Sub OutErr(ErrMsg)
if IsDebug_=true then
Response.Write ErrMsg
Response.End
End if
End Sub
'----------------------------------------------------------------------------------------------------
'文件属性类
Class FileInfo_Class
Dim FormName,FileName,FilePath,FileSize,FileMIME,FileStart,FileExt
End Class
function URLDecode(strIn)
URLDecode = ""
Dim sl: sl = 1
Dim tl: tl = 1
Dim key: key = "%"
Dim kl: kl = Len(key)
sl = InStr(sl, strIn, key, 1)
Do While sl>0
If (tl=1 And sl<>1) Or tl<sl Then
URLDecode = URLDecode & Mid(strIn, tl, sl-tl)
End If
Dim hh, hi, hl
Dim a
Select Case UCase(Mid(strIn, sl+kl, 1))
Case "U":'Unicode URLEncode
a = Mid(strIn, sl+kl+1, 4)
URLDecode = URLDecode & ChrW("&H" & a)
sl = sl + 6
Case "E":'UTF-8 URLEncode
hh = Mid(strIn, sl+kl, 2)
a = Int("&H" & hh)'ascii码
If Abs(a)<128 Then
sl = sl + 3
URLDecode = URLDecode & Chr(a)
Else
hi = Mid(strIn, sl+3+kl, 2)
hl = Mid(strIn, sl+6+kl, 2)
a = ("&H" & hh And &H0F) * 2 ^12 Or ("&H" & hi And &H3F) * 2 ^ 6 Or ("&H" & hl And &H3F)
If a<0 Then a = a + 65536
URLDecode = URLDecode & ChrW(a)
sl = sl + 9
End If
Case Else:'Asc URLEncode
hh = Mid(strIn, sl+kl, 2)'高位
a = Int("&H" & hh)'ascii码
If Abs(a)<128 Then
sl = sl + 3
Else
hi = Mid(strIn, sl+3+kl, 2)'低位
a = Int("&H" & hh & hi)'非ascii码
sl = sl + 6
End If
URLDecode = URLDecode & Chr(a)
End Select
tl = sl
sl = InStr(sl, strIn, key, 1)
Loop
URLDecode = URLDecode & Mid(strIn, tl)
End function
%> | zz-ms | trunk/zz-ms-v2.0/src/main/webapp/js/xheditor/demos/upload.asp | Classic ASP | asf20 | 17,737 |
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta name="robots" content="noindex, nofollow" />
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Google Maps</title>
<style type="text/css">
<!--
body{margin:0;padding:10px;font-size:12px;}
input{border:1px solid #ABADB3;}
button{border:1px solid #888;border-color:#fff #888 #888 #fff;}
input,button{border-radius:3px;-moz-border-radius:3px;-webkit-border-radius:3px;}
#mapArea{width:512px; height:320px;border:1px #999 solid;text-align:center;margin-top:10px}
-->
</style>
<script type="text/javascript" src="../../jquery/jquery-1.4.4.min.js"></script>
<script type="text/javascript" src="http://maps.google.com/maps/api/js?sensor=false"></script>
<script type="text/javascript" src="googlemap.js"></script>
</head>
<body onload="initMap()">
<label for="address">地址:</label><input type="text" id="address" value="北京市" /> <button id="mapsearch">搜索</button> <button id="addMap">插入地图</button>
<div id="mapArea"></div>
</body>
</html> | zz-ms | trunk/zz-ms-v2.0/src/main/webapp/js/xheditor/demos/googlemap/googlemap.html | HTML | asf20 | 1,187 |
var mapWidth = 512;
var mapHeight = 320;
var mapType;
var center_lat = 0;
var center_lng = 0;
var marker_lat = 0;
var marker_lng = 0;
var setZoom = 3;
var map,marker;
function initMap(zoom)
{
var mapOptions={zoom: 3,streetViewControl: false,scaleControl: true,mapTypeId: google.maps.MapTypeId.ROADMAP};
map = new google.maps.Map($('#mapArea')[0], mapOptions);
google.maps.event.addListener(map, 'maptypeid_changed', function(event) {
mapType=map.getMapTypeId();
});
google.maps.event.addListener(map, 'tilesloaded', function(event) {
center_lat = map.getCenter().lat();
center_lng = map.getCenter().lng();
setZoom = map.getZoom();
});
google.maps.event.addListener(map, 'center_changed', function(event) {
center_lat = map.getCenter().lat();
center_lng = map.getCenter().lng();
setZoom = map.getZoom();
});
marker = new google.maps.Marker({map:map,draggable:true});
google.maps.event.addListener(marker, 'dragend', function(event) {
marker_lat = marker.getPosition().lat();
marker_lng = marker.getPosition().lng();
});
searchMap();
}
function searchMap(zoom){
var address = $('#address').val();
var geocoder = new google.maps.Geocoder();
geocoder.geocode( { 'address': address}, function(results, status) {
if (status == google.maps.GeocoderStatus.OK) {
var tlatlng=results[0].geometry.location;
if(zoom)map.setZoom(zoom);
map.setCenter(tlatlng);
marker.setPosition(tlatlng);
marker.setTitle(address);
}
else alert(address + " 地址错误,未找到当前地址");
});
}
function pasteMap()
{
if (marker_lat == 0) marker_lat = center_lat;
if (marker_lng == 0) marker_lng = center_lng;
callback("http://maps.google.com/maps/api/staticmap?center=" + center_lat + ',' + center_lng + "&zoom=" + setZoom + "&size=" + mapWidth + 'x' + mapHeight + "&maptype=" + mapType + "&markers=" + marker_lat + ',' + marker_lng + "&sensor=false");
}
function pageInit()
{
$('#address').keypress(function(ev){if(ev.which==13)searchMap(10);});
$('#mapsearch').click(function(){searchMap(10);});
$('#addMap').click(pasteMap);
}
$(pageInit); | zz-ms | trunk/zz-ms-v2.0/src/main/webapp/js/xheditor/demos/googlemap/googlemap.js | JavaScript | asf20 | 2,150 |
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>xhEditor demo7 : UBB可视化编辑</title>
<link rel="stylesheet" href="common.css" type="text/css" media="screen" />
<style type="text/css">
<!--
.btnCode {
background:transparent url(prettify/code.gif) no-repeat 16px 16px;
background-position:2px 2px;
}
.btnFlv {
background:transparent url(mediaplayer/flv.gif) no-repeat 16px 16px;
background-position:2px 2px;
}
.btnMap {
width:50px !important;
background:transparent url(googlemap/map.gif) no-repeat center center;
}
-->
</style>
<script type="text/javascript" src="../jquery/jquery-1.4.4.min.js"></script>
<script type="text/javascript" src="../xheditor-1.1.14-zh-cn.min.js"></script>
<script type="text/javascript" src="../xheditor_plugins/ubb.min.js"></script>
<script type="text/javascript">
$(pageInit);
function pageInit()
{
var plugins={
Code:{c:'btnCode',t:'插入代码',h:1,e:function(){
var _this=this;
var htmlCode='<div><select id="xheCodeType"><option value="html">HTML/XML</option><option value="js">Javascript</option><option value="css">CSS</option><option value="php">PHP</option><option value="java">Java</option><option value="py">Python</option><option value="pl">Perl</option><option value="rb">Ruby</option><option value="cs">C#</option><option value="c">C++/C</option><option value="vb">VB/ASP</option><option value="">其它</option></select></div><div><textarea id="xheCodeValue" wrap="soft" spellcheck="false" style="width:300px;height:100px;" /></div><div style="text-align:right;"><input type="button" id="xheSave" value="确定" /></div>'; var jCode=$(htmlCode),jType=$('#xheCodeType',jCode),jValue=$('#xheCodeValue',jCode),jSave=$('#xheSave',jCode);
jSave.click(function(){
_this.loadBookmark();
_this.pasteText('[code='+jType.val()+']\r\n'+jValue.val()+'\r\n[/code]');
_this.hidePanel();
return false;
});
_this.saveBookmark();
_this.showDialog(jCode);
}},
Flv:{c:'btnFlv',t:'插入Flv视频',h:1,e:function(){
var _this=this;
var htmlFlv='<div>Flv文件: <input type="text" id="xheFlvUrl" value="http://" class="xheText" /></div><div>宽度高度: <input type="text" id="xheFlvWidth" style="width:40px;" value="480" /> x <input type="text" id="xheFlvHeight" style="width:40px;" value="400" /></div><div style="text-align:right;"><input type="button" id="xheSave" value="确定" /></div>';
var jFlv=$(htmlFlv),jUrl=$('#xheFlvUrl',jFlv),jWidth=$('#xheFlvWidth',jFlv),jHeight=$('#xheFlvHeight',jFlv),jSave=$('#xheSave',jFlv);
jSave.click(function(){
_this.loadBookmark();
_this.pasteText('[flv='+jWidth.val()+','+jHeight.val()+']'+jUrl.val()+'[/flv]');
_this.hidePanel();
return false;
});
_this.saveBookmark();
_this.showDialog(jFlv);
}},
map:{c:'btnMap',t:'插入Google地图',e:function(){
var _this=this;
_this.saveBookmark();
_this.showIframeModal('Google 地图','googlemap/googlemap.html',function(v){_this.loadBookmark();_this.pasteHTML('<img src="'+v+'" />');},538,404);
}}
},emots={
msn:{name:'MSN',count:40,width:22,height:22,line:8},
pidgin:{name:'Pidgin',width:22,height:25,line:8,list:{smile:'微笑',cute:'可爱',wink:'眨眼',laugh:'大笑',victory:'胜利',sad:'伤心',cry:'哭泣',angry:'生气',shout:'大骂',curse:'诅咒',devil:'魔鬼',blush:'害羞',tongue:'吐舌头',envy:'羡慕',cool:'耍酷',kiss:'吻',shocked:'惊讶',sweat:'汗',sick:'生病',bye:'再见',tired:'累',sleepy:'睡了',question:'疑问',rose:'玫瑰',gift:'礼物',coffee:'咖啡',music:'音乐',soccer:'足球',good:'赞同',bad:'反对',love:'心',brokenheart:'伤心'}},
ipb:{name:'IPB',width:20,height:25,line:8,list:{smile:'微笑',joyful:'开心',laugh:'笑',biglaugh:'大笑',w00t:'欢呼',wub:'欢喜',depres:'沮丧',sad:'悲伤',cry:'哭泣',angry:'生气',devil:'魔鬼',blush:'脸红',kiss:'吻',surprised:'惊讶',wondering:'疑惑',unsure:'不确定',tongue:'吐舌头',cool:'耍酷',blink:'眨眼',whistling:'吹口哨',glare:'轻视',pinch:'捏',sideways:'侧身',sleep:'睡了',sick:'生病',ninja:'忍者',bandit:'强盗',police:'警察',angel:'天使',magician:'魔法师',alien:'外星人',heart:'心动'}}
};
$('#elm1').xheditor({plugins:plugins,tools:'full',showBlocktag:false,forcePtag:false,beforeSetSource:ubb2html,beforeGetSource:html2ubb,emots:emots,emotMark:true,shortcuts:{'ctrl+enter':submitForm}});
}
function submitForm(){$('#frmDemo').submit();}
</script>
</head>
<body>
<div id="header-nav">
<ul>
<li><a href="demo01.html"><span>默认模式</span></a></li>
<li><a href="demo02.html"><span>自定义按钮</span></a></li>
<li><a href="demo03.html"><span>皮肤选择</span></a></li>
<li><a href="demo04.html"><span>其它选项</span></a></li>
<li><a href="demo05.html"><span>API交互</span></a></li>
<li><a href="demo06.html"><span>非utf-8编码调用</span></a></li>
<li><a href="demo07.html"><span>UBB可视化</span></a></li>
<li><a href="demo08.html"><span>Ajax上传</span></a></li>
<li><a href="demo09.html"><span>插件扩展</span></a></li>
<li><a href="demo10.html"><span>iframe调用上传</span></a></li>
<li><a href="demo11.html"><span>异步加载</span></a></li>
<li><a href="demo12.html"><span>远程抓图</span></a></li>
<li><a href="../wizard.html" target="_blank"><span>生成代码</span></a></li>
</ul>
</div>
<form id="frmDemo" method="post" action="showubb.php">
<h3>xhEditor demo7 : UBB可视化编辑</h3>
<textarea id="elm1" name="elm1" rows="12" cols="80" style="width: 90%">[b]粗体文字 Abc[/b]
[u]下划线文字 Abc[/u]
[i]斜体文字 Abc[/i]
[s]删除线 Abc[/s]
[s][i][u][b]粗体下划斜体删除线 Abc[/b][/u][/i][/s]
[color=red]红颜色[/color]
[back=#cccccc]背景灰色[/back]
[size=16px]文字大小为 16px[/size]
[font=FangSong_GB2312]字体为仿宋[/font]
[align=Center]内容居中[/align]
[img]img/xheditor.gif[/img]
[img=,221,79]img/xheditor.gif[/img]
[url]http://xheditor.com/[/url]
[url=http://xheditor.com/]xhEditor[/url]
[url=http://xheditor.com/][img]img/xheditor.gif[/img][/url]
[email]yanis.wang@gmail.com[/email]
[email=yanis.wang@gmail.com]Yanis.Wang[/email]
X[sup]2[/sup]
X[sub]2[/sub]
[list][*]aaa[*]bbb[*]ccc[/list]
[list=1][*]列表项 #1[*]列表项 #2[*]列表项 #3[list=a][*]列表项 #1[*]列表项 #2[*]列表项 #3[/list][*]列表项 #4[/list]
[table=300,#f5f5f5][tr=#E8F3FD][td=2,1] [/td][/tr][tr][td] [/td][td] [/td][/tr][tr][td] [/td][td] [/td][/tr][/table]
[quote]我们是一艘年轻的海盗船,载着梦想,我们愿将快乐带到大海的每一个角落。 [/quote]
[flash=400,300]test.swf[/flash]
[media=400,300,1]test.avi[/media]
[flv]http://content.longtailvideo.com/videos/8.flv[/flv]
[code=php]
<?php
$t=1;
if($t==1)$str="Hello xhEditor!";
else $str='Hello PHP';
echo $str;//输出文字
?>
[/code]</textarea>
<br/><br />
<input type="submit" name="save" value="Submit" />
<input type="reset" name="reset" value="Reset" />
</form>
</body>
</html> | zz-ms | trunk/zz-ms-v2.0/src/main/webapp/js/xheditor/demos/demo07.html | HTML | asf20 | 7,329 |
{err:'',msg:'!upload\/day_100127\/201001271345297042.zip||201001271345297042.zip'} | zz-ms | trunk/zz-ms-v2.0/src/main/webapp/js/xheditor/demos/uploadattach.php | Hack | asf20 | 82 |
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>xhEditor demo5 : Javascript API交互</title>
<link rel="stylesheet" href="common.css" type="text/css" media="screen" />
<script type="text/javascript" src="../jquery/jquery-1.4.4.min.js"></script>
<script type="text/javascript" src="../xheditor-1.1.14-zh-cn.min.js"></script>
<script type="text/javascript">
$(pageInit);
var editor;
function pageInit()
{
editor=$('#elm1').xheditor({shortcuts:{'ctrl+enter':submitForm}});//交互方式1
editor=$('#elm1')[0].xheditor;//交互方式2
}
function submitForm(){$('#frmDemo').submit();}
</script>
</head>
<body>
<div id="header-nav">
<ul>
<li><a href="demo01.html"><span>默认模式</span></a></li>
<li><a href="demo02.html"><span>自定义按钮</span></a></li>
<li><a href="demo03.html"><span>皮肤选择</span></a></li>
<li><a href="demo04.html"><span>其它选项</span></a></li>
<li><a href="demo05.html"><span>API交互</span></a></li>
<li><a href="demo06.html"><span>非utf-8编码调用</span></a></li>
<li><a href="demo07.html"><span>UBB可视化</span></a></li>
<li><a href="demo08.html"><span>Ajax上传</span></a></li>
<li><a href="demo09.html"><span>插件扩展</span></a></li>
<li><a href="demo10.html"><span>iframe调用上传</span></a></li>
<li><a href="demo11.html"><span>异步加载</span></a></li>
<li><a href="demo12.html"><span>远程抓图</span></a></li>
<li><a href="../wizard.html" target="_blank"><span>生成代码</span></a></li>
</ul>
</div>
<form id="frmDemo" method="post" action="show.php">
<h3>xhEditor demo5 : Javascript API交互</h3>
<textarea id="elm1" name="elm1" rows="12" cols="80" style="width: 80%">
<p>当前实例调用的Javascript源代码为:</p><p>var editor;<br />editor=$('#elm1').xheditor();//方式1<br />editor=$('#elm1')[0].xheditor;//方式2<br />editor.pasteHTML('&lt;strong&gt;粘贴的内容&lt;/strong&gt;');</p><p><br />注:本页面演示大部分外部调用的API接口,更多详细帮助信息请查看:<a href="http://xheditor.com/manual/2#chapter3">http://xheditor.com/manual/2#chapter3</a></p>
</textarea>
<br /><br />
<input type="submit" name="save" value="Submit" />
<input type="reset" name="reset" value="Reset" />
</form>
<br/>
<div style="border:1px solid #999;padding:10px;">
<a href="javascript:;" onclick="editor.focus();return false;">focus()</a> |
<a href="javascript:;" onclick="editor.setSource('<p>aaa1</p>');return false;">setSource('<p>aaa1</p>')</a> |
<a href="javascript:;" onclick="$('#elm1').val('<p>aaa2</p>');return false;">$('#elm1').val('<p>aaa2</p>')</a> |
<a href="javascript:;" onclick="alert(editor.getSource());return false;">getSource()</a> |
<a href="javascript:;" onclick="alert($('#elm1').val());return false;">$('#elm1').val()</a> |
<a href="javascript:;" onclick="editor.appendHTML('<strong>添加在尾部</strong>');return false;">appendHTML('<strong>添加在尾部</strong>')</a> |
<a href="javascript:;" onclick="alert(editor.getSelect());return false;">getSelect()</a> |
<a href="javascript:;" onclick="alert(editor.getSelect('text'));return false;">getSelect('text')</a> |
<a href="javascript:;" onclick="editor.pasteHTML('<strong>粘贴的内容</strong>');return false;">pasteHTML('<strong>粘贴的内容</strong>')</a> |
<a href="javascript:;" onclick="editor.pasteText('<strong>粘贴的内容</strong>');return false;">pasteText('<strong>粘贴的内容</strong>')</a> |
<a href="javascript:;" onclick="alert(editor.formatXHTML('<b>abc</b>'));return false;">formatXHTML('<b>abc</b>')</a> |
<a href="javascript:;" onclick="editor.toggleSource();return false;">toggleSource()</a> |
<a href="javascript:;" onclick="editor.toggleSource(true);return false;">toggleSource(true)</a> |
<a href="javascript:;" onclick="editor.toggleFullscreen(true);return false;">toggleFullscreen(true)</a> |
<a href="javascript:;" onclick="editor.toggleShowBlocktag();return false;">toggleShowBlocktag()</a> |
<a href="javascript:;" onclick="alert(editor.settings.upLinkExt);return false;">alert(settings.upLinkExt)</a> |
<a href="javascript:;" onclick="editor.exec('About');return false;">exec('About')</a>
</div>
</body>
</html> | zz-ms | trunk/zz-ms-v2.0/src/main/webapp/js/xheditor/demos/demo05.html | HTML | asf20 | 4,618 |
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>xhEditor demo10 : showIframeModal接口的iframe文件上传</title>
<link rel="stylesheet" href="common.css" type="text/css" media="screen" />
<script type="text/javascript" src="../jquery/jquery-1.4.4.min.js"></script>
<script type="text/javascript" src="../xheditor-1.1.14-zh-cn.min.js"></script>
<script type="text/javascript">
$(pageInit);
function pageInit()
{
$.extend(xheditor.settings,{skin:'vista',shortcuts:{'ctrl+enter':submitForm}});//修改默认设置
$('#elm1').xheditor({upLinkUrl:"!uploadgui.php",upImgUrl:"!uploadgui.php",upFlashUrl:"!uploadgui.php",upMediaUrl:"!uploadgui.php"});
$('#elm2').xheditor({upLinkUrl:"!{editorRoot}xheditor_plugins/multiupload/multiupload.html?uploadurl={editorRoot}demos/upload.php%3Fimmediate%3D1&ext=附件文件(*.zip;*.rar;*.txt)",upImgUrl:'!{editorRoot}xheditor_plugins/multiupload/multiupload.html?uploadurl={editorRoot}demos/upload.php%3Fimmediate%3D1&ext=图片文件(*.jpg;*.jpeg;*.gif;*.png)',upFlashUrl:'!{editorRoot}xheditor_plugins/multiupload/multiupload.html?uploadurl={editorRoot}demos/upload.php%3Fimmediate%3D1&ext=Flash动画(*.swf)',upMediaUrl:'!{editorRoot}xheditor_plugins/multiupload/multiupload.html?uploadurl={editorRoot}demos/upload.php%3Fimmediate%3D1&ext=多媒体文件(*.wmv;*.avi;*.wma;*.mp3;*.mid)'});
}
function submitForm(){$('#frmDemo').submit();}
</script>
</head>
<body>
<div id="header-nav">
<ul>
<li><a href="demo01.html"><span>默认模式</span></a></li>
<li><a href="demo02.html"><span>自定义按钮</span></a></li>
<li><a href="demo03.html"><span>皮肤选择</span></a></li>
<li><a href="demo04.html"><span>其它选项</span></a></li>
<li><a href="demo05.html"><span>API交互</span></a></li>
<li><a href="demo06.html"><span>非utf-8编码调用</span></a></li>
<li><a href="demo07.html"><span>UBB可视化</span></a></li>
<li><a href="demo08.html"><span>Ajax上传</span></a></li>
<li><a href="demo09.html"><span>插件扩展</span></a></li>
<li><a href="demo10.html"><span>iframe调用上传</span></a></li>
<li><a href="demo11.html"><span>异步加载</span></a></li>
<li><a href="demo12.html"><span>远程抓图</span></a></li>
<li><a href="../wizard.html" target="_blank"><span>生成代码</span></a></li>
</ul>
</div>
<form id="frmDemo" method="post" action="show.php">
<h3>xhEditor demo10 : showIframeModal接口的iframe文件上传</h3>
1,iframe单文件上传演示:<br />
<textarea id="elm1" name="elm1" rows="12" cols="80" style="width: 90%">
<p>当前实例调用的Javascript源代码为:</p><p>$('#elm1').xheditor({skin:'vista',upLinkUrl:"!uploadgui.php",upImgUrl:"!uploadgui.php",upFlashUrl:"!uploadgui.php",upMediaUrl:"!uploadgui.php"});</p><p><br /></p><p>本页面演示通过showIframeModal接口来调用iframe调用指定的文件上传页来上传和管理文件,可以实现高可定义的文件上传和管理,当前示例页面中在“<strong>超链接、图片、Flash动画和视频</strong>”按钮中实现了演示。</p><BR><p>此功能可在以下4个按钮中通过参数调用来实现:超链接、图片、动画和视频,接口分别为:upLinkUrl、upImgUrl、upFlashUrl和upMediaUrl,默认这几个函数为编辑器内置的ajax式文件上传,想要在frame中调用自定义上传管理页面,必需在参数值最前面添加感叹号:“!”,注意必需为半角符号。例如:upLinkUrl:'!gui.html'</p><BR><p>上传管理页面可使用接口:callback,callback用来返回上传或者选择的文件链接并关闭模式窗口,您可以查看uploadgui.php页面来了解具体的管理页面制作示例</p>
</textarea><br /><br />
2,iframe多文件批量上传演示:<br />
<textarea id="elm2" name="elm2" rows="12" cols="80" style="width: 90%">
<p>当前实例调用的Javascript原代码为:</p><p>$('#elm2').xheditor({skin:'vista',upImgUrl:'!{editorRoot}xheditor_plugins/multiupload/multiupload.html?uploadurl={editorRoot}demos/upload.php%3Fimmediate%3D1&amp;ext=图片文件(*.jpg;*.jpeg;*.gif;*.png)',upFlashUrl:'!{editorRoot}xheditor_plugins/multiupload/multiupload.html?uploadurl={editorRoot}demos/upload.php%3Fimmediate%3D1&amp;ext=Flash动画(*.swf)',upMediaUrl:'!{editorRoot}xheditor_plugins/multiupload/multiupload.html?uploadurl={editorRoot}demos/upload.php%3Fimmediate%3D1&amp;ext=多媒体文件(*.wmv;*.avi;*.wma;*.mp3;*.mid)'});</p><p><br /></p><p>本演示仅是在上面的iframe单文件演示基础上的更进一步应用。多文件批量接口可在:<strong>超链接、图片</strong>、<strong>Flash动画</strong>和<strong>多媒体</strong>中使用,使用的方法仅需将多个URL地址用制表符(\t )来分隔,例如:1.gif 2.gif 3.gif</p><p>本演示利用showIframeModal接口来调用批量上传页面,批量上传页是结合了开源的<strong>swfupload</strong>组件来实现的,可实现高可定制的批量上传。而界面是参考了<strong>SwfUploadPanel</strong>组件,在此一并感谢。批量上传演示页的代码并没有太多的整理和优化,因此建议大家使用时再自己另行修改和开发,此模块仅供参考。<br /></p><p>注:批量上传演示页默认使用了立即上传模式,上传完成便会自动插入到编辑器中。<br /></p><p>感谢名单:</p><ol><li><a target="_blank" href="http://swfupload.org/">http://swfupload.org/</a></li><li><a target="_blank" href="http://www.extjs.com/learn/Extension:SwfUploadPanel">http://www.extjs.com/learn/Extension:SwfUploadPanel</a></li></ol>
</textarea>
<br/><br />
<input type="submit" name="save" value="Submit" />
<input type="reset" name="reset" value="Reset" />
</form>
</body>
</html> | zz-ms | trunk/zz-ms-v2.0/src/main/webapp/js/xheditor/demos/demo10.html | HTML | asf20 | 6,324 |
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>xhEditor demo12 : 远程抓图&剪切板图片粘贴上传</title>
<link rel="stylesheet" href="common.css" type="text/css" media="screen" />
<script type="text/javascript" src="../jquery/jquery-1.4.4.min.js"></script>
<script type="text/javascript" src="../xheditor-1.1.14-zh-cn.min.js"></script>
<script type="text/javascript">
$(function(){
$('#elm1').xheditor({localUrlTest:/^https?:\/\/[^\/]*?(xheditor\.com)\//i,remoteImgSaveUrl:'saveremoteimg.php',shortcuts:{'ctrl+enter':submitForm}});
});
function submitForm(){$('#frmDemo').submit();}
</script>
</head>
<body>
<div id="header-nav">
<ul>
<li><a href="demo01.html"><span>默认模式</span></a></li>
<li><a href="demo02.html"><span>自定义按钮</span></a></li>
<li><a href="demo03.html"><span>皮肤选择</span></a></li>
<li><a href="demo04.html"><span>其它选项</span></a></li>
<li><a href="demo05.html"><span>API交互</span></a></li>
<li><a href="demo06.html"><span>非utf-8编码调用</span></a></li>
<li><a href="demo07.html"><span>UBB可视化</span></a></li>
<li><a href="demo08.html"><span>Ajax上传</span></a></li>
<li><a href="demo09.html"><span>插件扩展</span></a></li>
<li><a href="demo10.html"><span>iframe调用上传</span></a></li>
<li><a href="demo11.html"><span>异步加载</span></a></li>
<li><a href="demo12.html"><span>远程抓图</span></a></li>
<li><a href="../wizard.html" target="_blank"><span>生成代码</span></a></li>
</ul>
</div>
<form id="frmDemo" method="post" action="show.php">
<h3>xhEditor demo12 : 远程抓图&剪切板图片粘贴上传</h3>
<textarea id="elm1" name="elm1" rows="15" cols="80" style="width: 80%">
<p>本页面演示以下功能:</p><ol><li>粘贴自动抓取远程图片(全浏览器兼容)</li><li>剪切板图片粘贴自动上传(仅支持Firefox 4.0,5.0 Chrome 10,11,12)</li></ol><p>特别说明:Chrome 12及之前的版本(将来版本是否会修正也是个未知数)仅能粘贴QQ等屏幕截图,ACDSEE等图片软件复制粘贴会上传白屏图,具体原因不详,理论上应该是Chrome浏览器的Bug,因为Gmail官方的这个功能也同样存在这个BUG。</p><p><strong>使用说明:</strong></p><p>初始化时添加以下两个参数:<span style="font-family:monospace;font-size:16px;white-space: pre-wrap; "><strong>localUrlTest</strong>、<span style="font-family:monospace;font-size:16px;white-space: pre-wrap; "><strong>remoteImgSaveUrl</strong></span></span></p><p>localUrlTest是正则表达式,用来测试URL是否属于非本域名。如果测试为false,则会将图片的URL提交给remoteImgSaveUrl参数指定的服务器端上传接收程序,抓取后返回替换。<br /></p>
</textarea>
<br/><br />
<input type="submit" name="save" value="Submit" />
<input type="reset" name="reset" value="Reset" />
</form>
</body>
</html> | zz-ms | trunk/zz-ms-v2.0/src/main/webapp/js/xheditor/demos/demo12.html | HTML | asf20 | 3,329 |
body{
font-size:12px;
padding:0;margin:0;
}
form{
margin:30px 0 0 0;
padding:10px;
}
#header-nav{
position:fixed;
margin:0;
padding:0;
top:0;
left:0;
width:100%;
z-index:9999;
background:#F4F4F4;
border-bottom:1px solid #999;
line-height:normal;
_position: absolute;
_top: expression(eval(TBWindowMargin = document.documentElement && document.documentElement.scrollTop || document.body.scrollTop));
}
*html{background:url(about:blank) fixed;}
#header-nav ul{
margin:0;
padding:10px 5px 0 12px;
list-style:none;
}
#header-nav li{
float:left;
margin:0;
padding:0;
}
#header-nav a{
display:block;
background:url("img/tabbgl.gif") no-repeat left top;
margin:0;
padding:0 0 0 4px;
text-decoration:none;
}
#header-nav span{
float:left;
display:block;
background:url("img/tabbgr.gif") no-repeat right top;
padding:5px 9px 2px 5px;
color:#666;
}
/* Commented Backslash Hack hides rule from IE5-Mac \*/
#header-nav a span {float:none;}
/* End IE5-Mac hack */
#header-nav a:hover span{
color:#FFF;
}
#header-nav a:hover{
background-position:0% -42px;
}
#header-nav a:hover span{
background-position:100% -42px;
} | zz-ms | trunk/zz-ms-v2.0/src/main/webapp/js/xheditor/demos/common.css | CSS | asf20 | 1,195 |
{err:'',msg:'!img\/xheditor.gif||img\/xheditor.gif'} | zz-ms | trunk/zz-ms-v2.0/src/main/webapp/js/xheditor/demos/uploadthumb.php | Hack | asf20 | 52 |
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>xhEditor demo8 : Ajax文件上传</title>
<link rel="stylesheet" href="common.css" type="text/css" media="screen" />
<script type="text/javascript" src="../jquery/jquery-1.4.4.min.js"></script>
<script type="text/javascript" src="../xheditor-1.1.14-zh-cn.min.js"></script>
<script type="text/javascript">
$(pageInit);
function pageInit()
{
$.extend(xheditor.settings,{shortcuts:{'ctrl+enter':submitForm}});
$('#elm1').xheditor({upLinkUrl:"upload.php",upLinkExt:"zip,rar,txt",upImgUrl:"upload.php",upImgExt:"jpg,jpeg,gif,png",upFlashUrl:"upload.php",upFlashExt:"swf",upMediaUrl:"upload.php",upMediaExt:"wmv,avi,wma,mp3,mid"});
$('#elm2').xheditor({upLinkUrl:"upload.php?immediate=1",upLinkExt:"zip,rar,txt",upImgUrl:"upload.php?immediate=1",upImgExt:"jpg,jpeg,gif,png",upFlashUrl:"upload.php?immediate=1",upFlashExt:"swf",upMediaUrl:"upload.php?immediate=1",upMediaExt:"wmv,avi,wma,mp3,mid"});
$('#elm3').xheditor({upLinkUrl:"uploadattach.php",upLinkExt:"zip,rar,txt"});
$('#elm4').xheditor({upImgUrl:"uploadthumb.php",upImgExt:"jpg,jpeg,gif,png"});
$('#elm5').xheditor({upFlashUrl:"uploadembed.php",upFlashExt:"swf",upMediaUrl:"uploadembed.php",upMediaExt:"wmv,avi,wma,mp3,mid"});
$('#elm6').xheditor({upLinkUrl:"upload.php",upLinkExt:"zip,rar,txt",upImgUrl:"upload.php",upImgExt:"jpg,jpeg,gif,png",onUpload:insertUpload});
}
function insertUpload(arrMsg)
{
var i,msg;
for(i=0;i<arrMsg.length;i++)
{
msg=arrMsg[i];
$("#uploadList").append('<option value="'+msg.id+'">'+msg.localname+'</option>');
}
}
function submitForm(){$('#frmDemo').submit();}
</script>
</head>
<body>
<div id="header-nav">
<ul>
<li><a href="demo01.html"><span>默认模式</span></a></li>
<li><a href="demo02.html"><span>自定义按钮</span></a></li>
<li><a href="demo03.html"><span>皮肤选择</span></a></li>
<li><a href="demo04.html"><span>其它选项</span></a></li>
<li><a href="demo05.html"><span>API交互</span></a></li>
<li><a href="demo06.html"><span>非utf-8编码调用</span></a></li>
<li><a href="demo07.html"><span>UBB可视化</span></a></li>
<li><a href="demo08.html"><span>Ajax上传</span></a></li>
<li><a href="demo09.html"><span>插件扩展</span></a></li>
<li><a href="demo10.html"><span>iframe调用上传</span></a></li>
<li><a href="demo11.html"><span>异步加载</span></a></li>
<li><a href="demo12.html"><span>远程抓图</span></a></li>
<li><a href="../wizard.html" target="_blank"><span>生成代码</span></a></li>
</ul>
</div>
<form id="frmDemo" method="post" action="show.php">
<h3>xhEditor demo8 : Ajax文件上传</h3>
1,普通上传模式:<br />
<textarea id="elm1" name="elm1" rows="12" cols="80" style="width: 80%">
<p>当前实例调用的Javascript源代码为:</p><p>$('#elm1').xheditor({upLinkUrl:"upload.php",upLinkExt:"zip,rar,txt",upImgUrl:"upload.php",upImgExt:"jpg,jpeg,gif,png",upFlashUrl:"upload.php",upFlashExt:"swf",upMediaUrl:"upload.php",upMediaExt:"avi"});</p><p><br /></p><p>请确保当前目录中的upload.php有相应的PHP执行权限,若您使用的是其它的服务器脚本语言,请自行对初始化参数中的upLinkUrl、upImgUrl、upFlashUrl和upMediaUrl进行修改,并开发相应服务器上传接收程序。</p>注:upload.php仅为演示代码,若您希望在自己的项目中实际使用,请自行修改代码或者重新开发,开发过程中请注意上传文件的格式及大小限制,注意服务器安全问题。 <br /><br /><strong>上传接收程序开发规范:<br /></strong>1,上传文件域名字为:filedata<br />2,返回结构必需为json,并且结构如下:{"err":"","msg":"200906030521128703.gif"}<br />若上传出现错误,请将错误内容保存在err变量中;若上传成功,请将服务器上的绝对或者相对地址保存在msg变量中。<br />编辑器若发现返回的err变量不为空,则弹出窗口显示返回的错误内容。<br /><br /><br /><strong>上传管理方案建议:</strong><br />1,在编辑器初始化时在upload.php后面跟上一个服务器生成的绝对唯一的跟踪值,例如:upload.php?infoid=121312121<br />2,在服务器接收程序中以这个跟踪值保存到数据库中,同样可以限制单个跟踪值下总上传文件数或者总文件大小,否则就是一个可以上传无限个文件的漏洞了<br />3,最终当前表单提交时,再根据编辑器提交的HTML内容和数据库中上传内容进行比较,删除所有没有使用的上传文件<br />4,定期由服务器脚本删除上传数据库中没提交的文件记录,这样就能防止别人将您的网站作为免费相册空间了
</textarea><br /><br />
2,立即上传模式:<br />
<textarea id="elm2" name="elm2" rows="12" cols="80" style="width: 80%">
<p>当前实例调用的Javascript源代码为:</p><p>$('#elm2').xheditor({upLinkUrl:"upload.php?immediate=1",upLinkExt:"zip,rar,txt",upImgUrl:"upload.php?immediate=1",upImgExt:"jpg,jpeg,gif,png",upFlashUrl:"upload.php?immediate=1",upFlashExt:"swf",upMediaUrl:"upload.php?immediate=1",upMediaExt:"avi"});</p><p><br /></p><p>若返回的地址最前面为<span style="color:#fe2419;"><strong>半角的感叹号:“!”</strong></span>,表示为<strong><span style="color:#fe2419;">立即上传模式</span></strong>,上传成功后不需要点“确定”按钮,随后自动插入到编辑器内容中。<br /></p>
</textarea><br /><br />
3,带链接文字的附件上传:<br />
<textarea id="elm3" name="elm3" rows="12" cols="80" style="width: 80%">
<p>当前实例调用的Javascript源代码为:</p><p>$('#elm3').xheditor({upLinkUrl:"uploadattach.php",upLinkExt:"zip,rar,txt"});</p><p><br /></p><p><span style="color:#fe2419;"><strong>带链接文字的附件上传</strong></span>仅可在“超链接”按钮中使用,URL链接和链接文字之间用<span style="color:#fe2419;"><strong></strong></span><span style="color:#fe2419;"><strong>“||”分隔</strong></span>,例如:test.zip||download,前面为下载的URL链接,后面为超链接的文字内容,例如可以是附件的文件名。</p><p>特别说明:uploadattach.php是静态内容,仅为演示用,无论上传了什么文件都返回一个演示用的文件。</p>
</textarea><br /><br />
4,缩略图上传模式:<br />
<textarea id="elm4" name="elm4" rows="12" cols="80" style="width: 80%">
<p>当前实例调用的Javascript源代码为:</p><p>$('#elm4').xheditor({upImgUrl:"uploadthumb.php",upImgExt:"jpg,jpeg,gif,png"});</p><p><br /></p><p><span style="color:#fe2419;"><strong>缩略图模式</strong></span>仅可在“图片”按钮中使用,小图和大图链接之间用<span style="color:#fe2419;"><strong>“||”分隔</strong></span>,例如:small.gif||big.html,大图链接可以是图片,也可以是URL网址。</p><p>缩略图模式可与多文件插入混合使用,例如:1.gif||1.htm 2.gif||2.html<br /></p><p>特别说明:uploadthumb.php是静态内容,仅为演示用,无论上传了什么图片都返回内置的演示图片文件。</p>
</textarea><br /><br />
5,Flash和多媒体自定高宽上传:<br />
<textarea id="elm5" name="elm5" rows="12" cols="80" style="width: 80%">
<p>当前实例调用的Javascript源代码为:</p><p>$('#elm5').xheditor({upFlashUrl:"uploadembed.php",upFlashExt:"swf",upMediaUrl:"uploadembed.php",upMediaExt:"wmv,avi,wma,mp3,mid"});</p><p><br /></p><p>Flash和多媒体两个模块上传接口的3个参数分别代表:url、宽度、高度,之间用<span style="color:#ff0000;"><strong>“||”分隔</strong></span>,例如:test.swf||100||100<br /></p><p>自定高宽可与批量插入混合使用,例如:1.swf||100||100 2.swf||200||200,或者1.mp3||100||100 2.mp3||200||200</p><p>特别说明:uploadembed.php是静态内容,仅为演示用,无论上传了什么文件都返回内置的演示文件。</p>
</textarea><br /><br />
6,上传文件URL回调:<br />
<textarea id="elm6" name="elm6" rows="12" cols="80" style="width: 80%">
<p>当前实例调用的Javascript源代码为:</p><p>$('#elm6').xheditor({upLinkUrl:"upload.php",upLinkExt:"zip,rar,txt",upImgUrl:"upload.php",upImgExt:"jpg,jpeg,gif,png",<span style="color:#ff0000;">onUpload:insertUpload</span>});</p><p><br /></p><p>上传文件URL回调接口onUpload可扩展编辑器内置的文件上传功能,例如可以将编辑器中上传的图片应用在文章主图片上。</p>
</textarea>
<br /><br />上传文件列表:<select id="uploadList" style="width:350px;"></select>
<br/><br />
<input type="submit" name="save" value="Submit" />
<input type="reset" name="reset" value="Reset" />
</form>
</body>
</html> | zz-ms | trunk/zz-ms-v2.0/src/main/webapp/js/xheditor/demos/demo08.html | HTML | asf20 | 9,880 |
{err:'',msg:'!1.swf||100||100'} | zz-ms | trunk/zz-ms-v2.0/src/main/webapp/js/xheditor/demos/uploadembed.php | Hack | asf20 | 31 |
<%@ Page Language="C#" AutoEventWireup="true" CodePage="65001" %>
<%@ Import namespace="System" %>
<%@ Import namespace="System.Collections" %>
<%@ Import namespace="System.Configuration" %>
<%@ Import namespace="System.Data" %>
<%@ Import namespace="System.Web" %>
<%@ Import namespace="System.Web.Security" %>
<%@ Import namespace="System.Web.UI" %>
<%@ Import namespace="System.Web.UI.HtmlControls" %>
<%@ Import namespace="System.Web.UI.WebControls" %>
<%@ Import namespace="System.Web.UI.WebControls.WebParts" %>
<%@ Import namespace="System.IO" %>
<%@ Import namespace="System.Net" %>
<script runat="server">
// saveremoteimg demo for aspx
// @requires xhEditor
//
// @author JEDIWOLF<jediwolf@gmail.com>
// @site http://xheditor.com/
// @licence LGPL(http://www.opensource.org/licenses/lgpl-license.php)
//
// @Version: 0.9.1 (build 110703)
//
// 注:本程序仅为演示用,只实现了最简单的远程抓图及粘贴上传,如果要完善此功能,还需要自行开发以下功能:
// 1,非图片扩展名的URL地址抓取
// 2,大体积的图片转jpg格式,以及加水印等后续操作
// 3,上传记录存入数据库以管理用户上传图片
private string upExt = ",jpg,jpeg,gif,png,"; //上传扩展名
private string attachDir = "upload"; //上传文件保存路径,结尾不要带/
private int dirType = 1; // 1:按天存入目录 2:按月存入目录 3:按扩展名存目录 建议使用按天存
private int maxAttachSize = 2097152; // 最大上传大小,默认是2M
protected void Page_Load(object sender, EventArgs e)
{
Response.Charset = "UTF-8";
string[] arrUrl = Request["urls"].Split('|');
for (int i = 0; i < arrUrl.Length; i++)
{
string localUrl = saveRemoteImg(arrUrl[i]);
if (localUrl != "")arrUrl[i] = localUrl;//有效图片替换
}
Response.Write(String.Join("|", arrUrl));
Response.End();
}
string saveRemoteImg(string sUrl)
{
byte[] fileContent;
string objStream;
string sExt;
string sFile;
if (sUrl.StartsWith("data:image"))
{
// base64编码的图片,可能出现在firefox粘贴,或者某些网站上,例如google图片
int pstart = sUrl.IndexOf('/') + 1;
sExt = sUrl.Substring(pstart, sUrl.IndexOf(';') - pstart).ToLower();
if (upExt.IndexOf("," + sExt + ",")==-1) return "";
fileContent = Convert.FromBase64String(sUrl.Substring(sUrl.IndexOf("base64,") + 7));
}
else
{
// 图片网址
sExt = sUrl.Substring(sUrl.LastIndexOf('.') + 1).ToLower();
if (upExt.IndexOf("," + sExt + ",") == -1) return "";
fileContent = getUrl(sUrl);
}
if (fileContent.Length > maxAttachSize) return "";//超过最大上传大小忽略
//有效图片保存
sFile = getLocalPath(sExt);
File.WriteAllBytes(Server.MapPath(sFile), fileContent);
return sFile;
}
string getLocalPath(string extension)
{
string attach_dir, attach_subdir, filename, target, tmpfile;
switch (dirType)
{
case 1:
attach_subdir = "day_" + DateTime.Now.ToString("yyMMdd");
break;
case 2:
attach_subdir = "month_" + DateTime.Now.ToString("yyMM");
break;
default:
attach_subdir = "ext_" + extension;
break;
}
attach_dir = attachDir + "/" + attach_subdir + "/";
if (!Directory.Exists(Server.MapPath(attach_dir)))
{
Directory.CreateDirectory(Server.MapPath(attach_dir));
}
filename = DateTime.Now.ToString("yyyyMMddHHmmssfff") + "." + extension;
return attach_dir + filename;
}
byte[] getUrl(string sUrl)
{
WebClient wc = new WebClient();
try
{
return wc.DownloadData(sUrl);
}
catch
{
return null;
}
}
</script>
| zz-ms | trunk/zz-ms-v2.0/src/main/webapp/js/xheditor/demos/saveremoteimg.aspx | ASP.NET | asf20 | 3,993 |
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>xhEditor demo2 : 自定义按钮</title>
<link rel="stylesheet" href="common.css" type="text/css" media="screen" />
<script type="text/javascript" src="../jquery/jquery-1.4.4.min.js"></script>
<script type="text/javascript" src="../xheditor-1.1.14-zh-cn.min.js"></script>
<script type="text/javascript">
$(pageInit);
function pageInit()
{
$.extend(xheditor.settings,{shortcuts:{'ctrl+enter':submitForm}});
$('#elm1').xheditor({tools:'full'});
$('#elm2').xheditor({tools:'mfull'});
$('#elm3').xheditor({tools:'simple'});
$('#elm4').xheditor({tools:'mini'});
$('#elm5').xheditor({tools:'Cut,Copy,Paste,Pastetext,|,Source,Fullscreen,About'});
$('#elm6').xheditor({tools:'Cut,Copy,Paste,Pastetext,/,Source,Fullscreen,About'});
}
function submitForm(){$('#frmDemo').submit();}
</script>
</head>
<body>
<div id="header-nav">
<ul>
<li><a href="demo01.html"><span>默认模式</span></a></li>
<li><a href="demo02.html"><span>自定义按钮</span></a></li>
<li><a href="demo03.html"><span>皮肤选择</span></a></li>
<li><a href="demo04.html"><span>其它选项</span></a></li>
<li><a href="demo05.html"><span>API交互</span></a></li>
<li><a href="demo06.html"><span>非utf-8编码调用</span></a></li>
<li><a href="demo07.html"><span>UBB可视化</span></a></li>
<li><a href="demo08.html"><span>Ajax上传</span></a></li>
<li><a href="demo09.html"><span>插件扩展</span></a></li>
<li><a href="demo10.html"><span>iframe调用上传</span></a></li>
<li><a href="demo11.html"><span>异步加载</span></a></li>
<li><a href="demo12.html"><span>远程抓图</span></a></li>
<li><a href="../wizard.html" target="_blank"><span>生成代码</span></a></li>
</ul>
</div>
<form id="frmDemo" method="post" action="show.php">
<h3>xhEditor demo2 : 自定义按钮</h3>
1,full(完全):<br />
<textarea id="elm1" name="elm1" rows="12" cols="80" style="width: 80%">
<p>当前实例调用的Javascript源代码为:</p><p>$('#elm1').xheditor({<span style="color:#ff0000;">tools:'full'</span>});</p>
</textarea><br /><br />
2,mfull(多行完全):<br />
<textarea id="elm2" name="elm2" rows="12" cols="80" style="width: 80%">
<p>当前实例调用的Javascript源代码为:</p><p>$('#elm2').xheditor({<span style="color:#ff0000;">tools:'mfull'</span>});</p>
</textarea><br /><br />
3,simple(简单):<br />
<textarea id="elm3" name="elm3" rows="12" cols="80" style="width: 80%">
<p>当前实例调用的Javascript源代码为:</p><p>$('#elm3').xheditor({<span style="color:#ff0000;">tools:'simple'</span>});</p>
</textarea><br /><br />
4,mini(迷你):<br />
<textarea id="elm4" name="elm4" rows="12" cols="80" style="width: 80%">
<p>当前实例调用的Javascript源代码为:</p><p>$('#elm4').xheditor({<span style="color:#ff0000;">tools:'mini'</span>});</p>
</textarea><br /><br />
5,custom(自定义):<br />
<textarea id="elm5" name="elm5" rows="12" cols="80" style="width: 80%">
<p>当前实例调用的Javascript源代码为:</p><p>$('#elm5').xheditor({<span style="color:#ff0000;">tools:'Cut,Copy,Paste,Pastetext,|,Source,Fullscreen,About'</span>});</p>
</textarea><br /><br />
6,自定义多行模式:<br />
<textarea id="elm6" name="elm6" rows="12" cols="80" style="width: 80%">
<p>当前实例调用的Javascript源代码为:</p><p>$('#elm6').xheditor({tools:'Cut,Copy,Paste,Pastetext,<span style="color:#ff0000;">/</span>,Source,Fullscreen,About'});</p>
</textarea>
<br/><br />
<input type="submit" name="save" value="Submit" />
<input type="reset" name="reset" value="Reset" />
</form>
</body>
</html> | zz-ms | trunk/zz-ms-v2.0/src/main/webapp/js/xheditor/demos/demo02.html | HTML | asf20 | 4,158 |
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>xhEditor demo3 : 皮肤选择</title>
<link rel="stylesheet" href="common.css" type="text/css" media="screen" />
<script type="text/javascript" src="../jquery/jquery-1.4.4.min.js"></script>
<script type="text/javascript" src="../xheditor-1.1.14-zh-cn.min.js"></script>
<script type="text/javascript">
$(pageInit);
function pageInit()
{
$.extend(xheditor.settings,{shortcuts:{'ctrl+enter':submitForm}});
$('#elm1').xheditor({skin:'default'});
$('#elm2').xheditor({skin:'o2007blue'});
$('#elm3').xheditor({skin:'o2007silver'});
$('#elm4').xheditor({skin:'vista'});
$('#elm5').xheditor({skin:'nostyle'});
}
function submitForm(){$('#frmDemo').submit();}
</script>
</head>
<body>
<div id="header-nav">
<ul>
<li><a href="demo01.html"><span>默认模式</span></a></li>
<li><a href="demo02.html"><span>自定义按钮</span></a></li>
<li><a href="demo03.html"><span>皮肤选择</span></a></li>
<li><a href="demo04.html"><span>其它选项</span></a></li>
<li><a href="demo05.html"><span>API交互</span></a></li>
<li><a href="demo06.html"><span>非utf-8编码调用</span></a></li>
<li><a href="demo07.html"><span>UBB可视化</span></a></li>
<li><a href="demo08.html"><span>Ajax上传</span></a></li>
<li><a href="demo09.html"><span>插件扩展</span></a></li>
<li><a href="demo10.html"><span>iframe调用上传</span></a></li>
<li><a href="demo11.html"><span>异步加载</span></a></li>
<li><a href="demo12.html"><span>远程抓图</span></a></li>
<li><a href="../wizard.html" target="_blank"><span>生成代码</span></a></li>
</ul>
</div>
<form id="frmDemo" method="post" action="show.php">
<h3>xhEditor demo3 : 皮肤选择</h3>
1,默认皮肤:<br/>
<textarea id="elm1" name="elm1" rows="12" cols="80" style="width: 90%">
<p>当前实例调用的Javascript源代码为:</p><p>$('#elm1').xheditor({<span style="color:#ff0000;">skin:'default'</span>});</p>
</textarea><br /><br />
2,Office 2007 蓝色:<br />
<textarea id="elm2" name="elm2" rows="12" cols="80" style="width: 90%">
<p>当前实例调用的Javascript源代码为:</p><p>$('#elm2').xheditor({<span style="color:#ff0000;">skin:'o2007blue'</span>});</p>
</textarea><br /><br />
3,Office 2007 银白色:<br />
<textarea id="elm3" name="elm3" rows="12" cols="80" style="width: 90%">
<p>当前实例调用的Javascript源代码为:</p><p>$('#elm3').xheditor({<span style="color:#ff0000;">skin:'o2007silver'</span>});</p>
</textarea><br /><br />
4,Vista:<br />
<textarea id="elm4" name="elm4" rows="12" cols="80" style="width: 90%">
<p>当前实例调用的Javascript源代码为:</p><p>$('#elm4').xheditor({<span style="color:#ff0000;">skin:'vista'</span>});</p>
</textarea><br /><br />
5,NoStyle:<br />
<textarea id="elm5" name="elm5" rows="12" cols="80" style="width: 90%">
<p>当前实例调用的Javascript源代码为:</p><p>$('#elm5').xheditor({<span style="color:#ff0000;">skin:'nostyle'</span>});</p><p>皮肤作者:<strong>shiny</strong> (dev.meettea.com)</p>
</textarea>
<br/><br />注:为了保持项目精简,同一个页面只能调用一个皮肤,当同一界面同时调用多个皮肤时,最后一个皮肤的按钮面板样式会影响之前的<br /><br />
<input type="submit" name="save" value="Submit" />
<input type="reset" name="reset" value="Reset" />
</form>
</body>
</html> | zz-ms | trunk/zz-ms-v2.0/src/main/webapp/js/xheditor/demos/demo03.html | HTML | asf20 | 3,901 |
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>xhEditor demo9 : 自定义按钮之插件扩展</title>
<link rel="stylesheet" href="common.css" type="text/css" media="screen" />
<style type="text/css">
<!--
.testClassName {
background:transparent url(img/plugin.gif) no-repeat 16px 16px;
background-position:2px 2px;
}
.btnCode {
background:transparent url(prettify/code.gif) no-repeat 16px 16px;
background-position:2px 2px;
}
-->
</style>
<script type="text/javascript" src="../jquery/jquery-1.4.4.min.js"></script>
<script type="text/javascript" src="../xheditor-1.1.14-zh-cn.min.js"></script>
<script type="text/javascript">
var editor;
$(pageInit);
function pageInit()
{
var allPlugin={
subscript:{c:'testClassName',t:'下标:调用execCommand(subscript)'},
superscript:{c:'testClassName',t:'上标:调用execCommand(superscript)'},
test1:{c:'testClassName',t:'测试1:加粗 (Ctrl+1)',s:'ctrl+1',e:function(){
this._exec('Bold');
}},
test2:{c:'testClassName',t:'测试2:普通对话框 (Ctrl+2)',s:'ctrl+2',h:1,e:function(){
var _this=this;
var jTest=$('<div>测试showDialog</div><div><label for="xheImgUrl">图片文件: </label><input type="text" id="xheImgUrl" value="http://" class="xheText" /></div><div style="text-align:right;"><input type="button" id="xheSave" value="确定" /></div>');
var jUrl=$('#xheImgUrl',jTest),jSave=$('#xheSave',jTest);
_this.uploadInit(jUrl,'upload.php','jpg,gif,png');
jSave.click(function(){
_this.loadBookmark();
_this.pasteHTML(jUrl.val());
_this.hidePanel();
return false;
});
_this.saveBookmark();
_this.showDialog(jTest);
}},
test3:{c:'testClassName',t:'测试3:需要转移焦点的对话框 (Ctrl+3)',s:'ctrl+3',h:1,e:function(){
var _this=this;
var jTest=$('<div>测试需要转移焦点的showDialog</div><div><textarea id="xheTestInput" style="width:260px;height:100px;">当互动界面中有input或者textarea等会产生焦点的表单项时,必需在插入内容前用loadBookmark函数加载之前保存的光标焦点。</textarea></div><div style="text-align:right;"><input type="button" id="xheSave" value="确定" /></div>');
var jTestInput=$('#xheTestInput',jTest),jSave=$('#xheSave',jTest);
jSave.click(function(){
_this.loadBookmark();
_this.pasteText('您输入了:'+jTestInput.val());
_this.hidePanel();
return false;
});
_this.saveBookmark();
_this.showDialog(jTest);
}},
test4:{c:'testClassName',t:'测试4:面板界面 (Ctrl+4)',s:'ctrl+4',h:1,e:function(){
var _this=this;
var jTest=$('<div style="padding:5px;">测试showPanel</div>');
_this.showPanel(jTest);
}},
test5:{c:'testClassName',t:'测试5:菜单调用 (Ctrl+5)',s:'ctrl+5',h:1,e:function(){
var _this=this;
var arrMenu=[{s:'菜单1',v:'menu1',t:'这是菜单1'},{s:'菜单2',v:'menu2',t:'这是菜单2'},{s:'菜单3',v:'menu3',t:'这是菜单3'}];
_this.saveBookmark();
_this.showMenu(arrMenu,function(v){_this.pasteHTML(v);});
}},
test6:{c:'testClassName',t:'测试6:showModal (Ctrl+6)',s:'ctrl+6',e:function(){
var _this=this;
_this.saveBookmark();
_this.showModal('测试showModal接口','<div style="padding:5px;">模式窗口主体内容</div>',500,300);
}},
test7:{c:'testClassName',t:'测试7:showIframeModal (Ctrl+7)',s:'ctrl+7',e:function(){
var _this=this;
_this.saveBookmark();
_this.showIframeModal('测试showIframeModal接口','uploadgui.php',function(v){_this.loadBookmark();_this.pasteText('返回值:\r\n'+v);},500,300);
}},
Code:{c:'btnCode',t:'插入代码',h:1,e:function(){
var _this=this;
var htmlCode='<div><select id="xheCodeType"><option value="html">HTML/XML</option><option value="js">Javascript</option><option value="css">CSS</option><option value="php">PHP</option><option value="java">Java</option><option value="py">Python</option><option value="pl">Perl</option><option value="rb">Ruby</option><option value="cs">C#</option><option value="c">C++/C</option><option value="vb">VB/ASP</option><option value="">其它</option></select></div><div><textarea id="xheCodeValue" wrap="soft" spellcheck="false" style="width:300px;height:100px;" /></div><div style="text-align:right;"><input type="button" id="xheSave" value="确定" /></div>'; var jCode=$(htmlCode),jType=$('#xheCodeType',jCode),jValue=$('#xheCodeValue',jCode),jSave=$('#xheSave',jCode);
jSave.click(function(){
_this.loadBookmark();
_this.pasteHTML('<pre class="prettyprint lang-'+jType.val()+'">'+_this.domEncode(jValue.val())+'</pre>');
_this.hidePanel();
return false;
});
_this.saveBookmark();
_this.showDialog(jCode);
}}
};
editor=$('#elm1').xheditor({plugins:allPlugin,tools:'subscript,superscript,test1,test2,test3,test4,test5,test6,test7,Code,|,Source,Fullscreen,About',loadCSS:'<style>pre{margin-left:2em;border-left:3px solid #CCC;padding:0 1em;}</style>',shortcuts:{'ctrl+enter':submitForm}});
$('#btnSubscript').click(function(){editor.exec('subscript');});
$('#btnTest2').click(function(){editor.exec('test2');});
}
function submitForm(){$('#frmDemo').submit();}
</script>
</head>
<body>
<div id="header-nav">
<ul>
<li><a href="demo01.html"><span>默认模式</span></a></li>
<li><a href="demo02.html"><span>自定义按钮</span></a></li>
<li><a href="demo03.html"><span>皮肤选择</span></a></li>
<li><a href="demo04.html"><span>其它选项</span></a></li>
<li><a href="demo05.html"><span>API交互</span></a></li>
<li><a href="demo06.html"><span>非utf-8编码调用</span></a></li>
<li><a href="demo07.html"><span>UBB可视化</span></a></li>
<li><a href="demo08.html"><span>Ajax上传</span></a></li>
<li><a href="demo09.html"><span>插件扩展</span></a></li>
<li><a href="demo10.html"><span>iframe调用上传</span></a></li>
<li><a href="demo11.html"><span>异步加载</span></a></li>
<li><a href="demo12.html"><span>远程抓图</span></a></li>
<li><a href="../wizard.html" target="_blank"><span>生成代码</span></a></li>
</ul>
</div>
<form id="frmDemo" method="post" action="showplugin.php">
<h3>xhEditor demo9 : 自定义按钮之插件扩展</h3>
<textarea id="elm1" name="elm1" rows="12" cols="80" style="width: 80%">
<p><strong>插件初始化参考代码:</strong><br /></p>&lt;script type=&quot;text/javascript&quot;&gt;<br />var editor;<br />$(pageInit);<br />function pageInit()<br />{<br />&nbsp;&nbsp; &nbsp;var allPlugin={<br />&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp; subscript:{c:'testClassName',t:'下标:调用execCommand(subscript)'},<br />&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp; superscript:{c:'testClassName',t:'上标:调用execCommand(superscript)'},<br />&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp; test1:{c:'testClassName',t:'测试1:加粗 (Ctrl+1)',s:'ctrl+1',e:function(){<br />&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; this._exec('Bold');<br />&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp; }},<br />&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp; test2:{c:'testClassName',t:'测试2:普通对话框 (Ctrl+2)',s:'ctrl+2',h:1,e:function(){<br />&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; var _this=this;<br />&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; var jTest=$('&lt;div&gt;测试showDialog&lt;/div&gt;&lt;div style=&quot;text-align:right;&quot;&gt;&lt;input type=&quot;button&quot; id=&quot;xheSave&quot; value=&quot;确定&quot; /&gt;&lt;/div&gt;');<br />&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; var jSave=$('#xheSave',jTest);<br />&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; jSave.click(function(){<br />&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; _this.pasteHTML('点击了确定按钮');<br />&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; _this.hidePanel();<br />&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; return false;&nbsp;&nbsp; &nbsp;<br />&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; });<br />&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; _this.saveBookmark();<br />&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; _this.showDialog(jTest);<br />&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp; }},<br />&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp; test3:{c:'testClassName',t:'测试3:需要转移焦点的对话框 (Ctrl+3)',s:'ctrl+3',h:1,e:function(){<br />&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; var _this=this;<br />&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; var jTest=$('&lt;div&gt;测试需要转移焦点的showDialog&lt;/div&gt;&lt;div&gt;&lt;textarea id=&quot;xheTestInput&quot; style=&quot;width:260px;height:100px;&quot;&gt;当互动界面中有input或者textarea等会产生焦点的表单项时,必需在插入内容前用loadBookmark函数加载之前保存的光标焦点。&lt;/textarea&gt;&lt;/div&gt;&lt;div style=&quot;text-align:right;&quot;&gt;&lt;input type=&quot;button&quot; id=&quot;xheSave&quot; value=&quot;确定&quot; /&gt;&lt;/div&gt;');<br />&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; var jTestInput=$('#xheTestInput',jTest),jSave=$('#xheSave',jTest);<br />&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; jSave.click(function(){<br />&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; _this.loadBookmark();<br />&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; _this.pasteText('您输入了:'+jTestInput.val());<br />&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; _this.hidePanel();<br />&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; return false;&nbsp;&nbsp; &nbsp;<br />&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; });<br />&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; _this.saveBookmark();<br />&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; _this.showDialog(jTest);<br />&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp; }},<br />&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp; test4:{c:'testClassName',t:'测试4:面板界面 (Ctrl+4)',s:'ctrl+4',h:1,e:function(){<br />&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; var _this=this;<br />&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; var jTest=$('&lt;div style=&quot;padding:5px;&quot;&gt;测试showPanel&lt;/div&gt;');<br />&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; _this.showPanel(jTest);<br />&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp; }},<br />&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp; test5:{c:'testClassName',t:'测试5:菜单调用 (Ctrl+5)',s:'ctrl+5',h:1,e:function(){<br />&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; var _this=this;<br />&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; var arrMenu=[{s:'菜单1',v:'menu1',t:'这是菜单1'},{s:'菜单2',v:'menu2',t:'这是菜单2'},{s:'菜单3',v:'menu3',t:'这是菜单3'}];<br />&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; _this.saveBookmark();<br />&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; _this.showMenu(arrMenu,function(v){_this.pasteHTML(v);});<br />&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp; }},<br />&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp; test6:{c:'testClassName',t:'测试6:showModal (Ctrl+6)',s:'ctrl+6',e:function(){<br />&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; var _this=this;<br />&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; _this.saveBookmark();<br />&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; _this.showModal('测试showModal接口','&lt;div style=&quot;padding:5px;&quot;&gt;模式窗口主体内容&lt;/div&gt;',500,300);<br />&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp; }},<br />&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp; test7:{c:'testClassName',t:'测试7:showIframeModal (Ctrl+7)',s:'ctrl+7',e:function(){<br />&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; var _this=this;<br />&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; _this.saveBookmark();<br />&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; _this.showIframeModal('测试showIframeModal接口','uploadgui.php',function(v){_this.loadBookmark();_this.pasteText('返回值:\r\n'+v);},500,300);<br />&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp; }}<br />&nbsp;&nbsp; &nbsp;};<br />&nbsp;&nbsp; &nbsp;editor=$('#elm1').xheditor({plugins:allPlugin,tools:'subscript,superscript,test1,test2,test3,test4,test5,test6,test7,|,Source,Fullscreen,About'});<br />}<br />&lt;/script&gt;<p><strong>插件对象的属性解释:</strong><br /><br />c:样式表名称 t:插件名字(鼠标在按钮上方时显示) s:快捷方式(例如:Esc、Ctr+B) h:是否鼠标悬停直接执行,1:直接执行(省略当前值代表不直接执行) e:按钮点击后需要执行的代码(省略执行代码,则把当前的插件名作为参数,调用浏览器的execCommand函数)<br /><br /><br /><br /><strong>特别说明:</strong><br />如果您希望样式表存储在系统自带的模板目录ui.css中,请将插件对象的样式名留空,则会自动按照插件名来调用相应的样式,例如:xhEdtBtnCut、xhEdtBtnCopy,其中的Cut和Copy是插件名<br /><br /></p>
</textarea>
<br/><br />
<input type="submit" name="save" value="Submit" />
<input type="reset" name="reset" value="Reset" />
<input type="button" id="btnSubscript" value="外部调用下标插件" />
<input type="button" id="btnTest2" value="外部调用插件2" />
</form>
</body>
</html> | zz-ms | trunk/zz-ms-v2.0/src/main/webapp/js/xheditor/demos/demo09.html | HTML | asf20 | 16,294 |
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>xhEditor demo1 : 默认模式</title>
<link rel="stylesheet" href="common.css" type="text/css" media="screen" />
<script type="text/javascript" src="../jquery/jquery-1.4.4.min.js"></script>
<script type="text/javascript" src="../xheditor-1.1.14-zh-cn.min.js"></script>
</head>
<body>
<div id="header-nav">
<ul>
<li><a href="demo01.html"><span>默认模式</span></a></li>
<li><a href="demo02.html"><span>自定义按钮</span></a></li>
<li><a href="demo03.html"><span>皮肤选择</span></a></li>
<li><a href="demo04.html"><span>其它选项</span></a></li>
<li><a href="demo05.html"><span>API交互</span></a></li>
<li><a href="demo06.html"><span>非utf-8编码调用</span></a></li>
<li><a href="demo07.html"><span>UBB可视化</span></a></li>
<li><a href="demo08.html"><span>Ajax上传</span></a></li>
<li><a href="demo09.html"><span>插件扩展</span></a></li>
<li><a href="demo10.html"><span>iframe调用上传</span></a></li>
<li><a href="demo11.html"><span>异步加载</span></a></li>
<li><a href="demo12.html"><span>远程抓图</span></a></li>
<li><a href="../wizard.html" target="_blank"><span>生成代码</span></a></li>
</ul>
</div>
<form method="post" action="show.php">
<h3>xhEditor demo1 : 默认模式</h3>
1,xheditor(默认完全):<br />
<textarea id="elm1" name="elm1" class="xheditor" rows="12" cols="80" style="width: 80%">
<p>当前实例调用的HTML代码为:</p><p>&lt;textarea id="elm1" name="elm1" <span style="color:#ff0000;">class="xheditor"</span> rows="12" cols="80" style="width: 80%"&gt;</p>
</textarea><br /><br />
2,xheditor-mfull(多行完全):<br />
<textarea id="elm2" name="elm2" class="xheditor-mfull" rows="12" cols="80" style="width: 80%">
<p>当前实例调用的HTML代码为:</p><p>&lt;textarea id="elm2" name="elm2" <span style="color:#ff0000;">class="xheditor-mfull"</span> rows="12" cols="80" style="width: 80%"&gt;</p>
</textarea><br /><br />
3,xheditor-simple(简单):<br />
<textarea id="elm3" name="elm3" class="xheditor-simple" rows="12" cols="80" style="width: 80%">
<p>当前实例调用的HTML代码为:</p><p>&lt;textarea id="elm3" name="elm3" <span style="color:#ff0000;">class="xheditor-simple"</span> rows="12" cols="80" style="width: 80%"&gt;</p>
</textarea><br /><br />
4,xheditor-mini(迷你):<br />
<textarea id="elm4" name="elm4" class="xheditor-mini" rows="12" cols="80" style="width: 80%">
<p>当前实例调用的HTML代码为:</p><p>&lt;textarea id="elm4" name="elm4" <span style="color:#ff0000;">class="xheditor-mini"</span> rows="12" cols="80" style="width: 80%"&gt;</p>
</textarea><br /><br />
5,自定义详细参数:<br />
<textarea id="elm5" name="elm5" class="xheditor {tools:'Bold,Italic,Underline,Strikethrough,About',skin:'default'}" rows="12" cols="80" style="width: 80%">
<p>当前实例调用的HTML代码为:</p><p>&lt;textarea id="elm5" name="elm5" <span style="color:#ff0000;">class="xheditor {tools:'Bold,Italic,Underline,Strikethrough,About',skin:'default'}"</span> rows="12" cols="80" style="width: 80%"&gt; <br /></p><p>在以上3个参数的基础上,可以在后面接一个json格式的详细参数,参数和Javascript初始化模式中的完全一致。前面主参数为xheditor-full、xheditor-mfull、xheditor-simple或者xheditor-mini的情况下,后面参数中tools参数值是无效的,以前面的主参数为主。</p>
</textarea>
<br/><br />
<input type="submit" name="save" value="Submit" />
<input type="reset" name="reset" value="Reset" />
</form>
</body>
</html> | zz-ms | trunk/zz-ms-v2.0/src/main/webapp/js/xheditor/demos/demo01.html | HTML | asf20 | 4,428 |
<%@ Page Language="C#" AutoEventWireup="true" CodePage="65001" %>
<%@ Import namespace="System" %>
<%@ Import namespace="System.Collections" %>
<%@ Import namespace="System.Configuration" %>
<%@ Import namespace="System.Data" %>
<%@ Import namespace="System.Web" %>
<%@ Import namespace="System.Web.Security" %>
<%@ Import namespace="System.Web.UI" %>
<%@ Import namespace="System.Web.UI.HtmlControls" %>
<%@ Import namespace="System.Web.UI.WebControls" %>
<%@ Import namespace="System.Web.UI.WebControls.WebParts" %>
<script runat="server">
/*
* upload demo for c# .net 2.0
*
* @requires xhEditor
* @author Jediwolf<jediwolf@gmail.com>
* @licence LGPL(http://www.opensource.org/licenses/lgpl-license.php)
*
* @Version: 0.1.4 (build 111027)
*
* 注1:本程序仅为演示用,请您务必根据自己需求进行相应修改,或者重开发
* 注2:本程序将HTML5上传与普通POST上传转换为byte类型统一处理
*
*/
protected void Page_Load(object sender, EventArgs e)
{
Response.Charset = "UTF-8";
// 初始化一大堆变量
string inputname = "filedata";//表单文件域name
string attachdir = "upload"; // 上传文件保存路径,结尾不要带/
int dirtype = 1; // 1:按天存入目录 2:按月存入目录 3:按扩展名存目录 建议使用按天存
int maxattachsize = 2097152; // 最大上传大小,默认是2M
string upext = "txt,rar,zip,jpg,jpeg,gif,png,swf,wmv,avi,wma,mp3,mid"; // 上传扩展名
int msgtype = 2; //返回上传参数的格式:1,只返回url,2,返回参数数组
string immediate = Request.QueryString["immediate"];//立即上传模式,仅为演示用
byte[] file; // 统一转换为byte数组处理
string localname = "";
string disposition = Request.ServerVariables["HTTP_CONTENT_DISPOSITION"];
string err = "";
string msg = "''";
if (disposition != null)
{
// HTML5上传
file = Request.BinaryRead(Request.TotalBytes);
localname = Server.UrlDecode(Regex.Match(disposition, "filename=\"(.+?)\"").Groups[1].Value);// 读取原始文件名
}
else
{
HttpFileCollection filecollection = Request.Files;
HttpPostedFile postedfile = filecollection.Get(inputname);
// 读取原始文件名
localname = postedfile.FileName;
// 初始化byte长度.
file = new Byte[postedfile.ContentLength];
// 转换为byte类型
System.IO.Stream stream = postedfile.InputStream;
stream.Read(file, 0, postedfile.ContentLength);
stream.Close();
filecollection = null;
}
if (file.Length == 0)err = "无数据提交";
else
{
if (file.Length > maxattachsize)err = "文件大小超过" + maxattachsize + "字节";
else
{
string attach_dir, attach_subdir, filename, extension, target;
// 取上载文件后缀名
extension = GetFileExt(localname);
if (("," + upext + ",").IndexOf("," + extension + ",") < 0)err = "上传文件扩展名必需为:" + upext;
else
{
switch (dirtype)
{
case 2:
attach_subdir = "month_" + DateTime.Now.ToString("yyMM");
break;
case 3:
attach_subdir = "ext_" + extension;
break;
default:
attach_subdir = "day_" + DateTime.Now.ToString("yyMMdd");
break;
}
attach_dir = attachdir + "/" + attach_subdir + "/";
// 生成随机文件名
Random random = new Random(DateTime.Now.Millisecond);
filename = DateTime.Now.ToString("yyyyMMddhhmmss") + random.Next(10000) + "." + extension;
target = attach_dir + filename;
try
{
CreateFolder(Server.MapPath(attach_dir));
System.IO.FileStream fs = new System.IO.FileStream(Server.MapPath(target), System.IO.FileMode.Create, System.IO.FileAccess.Write);
fs.Write(file, 0, file.Length);
fs.Flush();
fs.Close();
}
catch (Exception ex)
{
err = ex.Message.ToString();
}
// 立即模式判断
if (immediate == "1") target = "!" + target;
target=jsonString(target);
if(msgtype==1)msg = "'"+target+"'";
else msg = "{'url':'" + target + "','localname':'" + jsonString(localname) + "','id':'1'}";
}
}
}
file = null;
Response.Write("{'err':'" + jsonString(err) + "','msg':" + msg + "}");
}
string jsonString(string str)
{
str = str.Replace("\\", "\\\\");
str = str.Replace("/", "\\/");
str = str.Replace("'", "\\'");
return str;
}
string GetFileExt(string FullPath)
{
if (FullPath != "")return FullPath.Substring(FullPath.LastIndexOf('.') + 1).ToLower();
else return "";
}
void CreateFolder(string FolderPath)
{
if (!System.IO.Directory.Exists(FolderPath))System.IO.Directory.CreateDirectory(FolderPath);
}
</script>
| zz-ms | trunk/zz-ms-v2.0/src/main/webapp/js/xheditor/demos/upload.aspx | ASP.NET | asf20 | 5,572 |
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>文件上传</title>
<style>
body{
padding:5px;
margin:0px;
font-size:12px;
}
</style>
<script type="text/javascript">
//----------------跨域支持代码开始(非跨域环境请删除这段代码)----------------
var JSON = JSON || {};
JSON.stringify = JSON.stringify || function (obj) {
var t = typeof (obj);
if (t != "object" || obj === null) {
if (t == "string")obj = '"'+obj.replace(/(["\\])/g,'\\$1')+'"';
return String(obj);
}
else {
var n, v, json = [], arr = (obj && obj.constructor == Array);
for (n in obj) {
v = obj[n]; t = typeof(v);
if (t == "string") v = '"'+v.replace(/(["\\])/g,'\\$1')+'"';
else if (t == "object" && v !== null) v = JSON.stringify(v);
json.push((arr ? "" : '"' + n + '":') + String(v));
}
return (arr ? "[" : "{") + String(json) + (arr ? "]" : "}");
}
};
var callback = callback || function(v){
v=JSON.stringify(v);
window.name=escape(v);
window.location='http://'+location.search.match(/[\?&]parenthost=(.*?)(&|$)/i)[1]+'/xheditorproxy.html';//这个文件最好是一个0字节文件,如果无此文件也会正常工作
}
var unloadme = unloadme || function(){
callback(null);//返回null,直接关闭当前窗口
}
//----------------跨域支持代码结束----------------
function upload(){
callback('test1.zip');//非跨域允许直接传输JSON对象
}
</script>
</head>
<body>
<a href="javascript:void(0);" onclick="upload();return false;">点击这里直接返回文件URL</a> | <a href="javascript:void(0);" onclick="unloadme();return false;">点击这里关闭模式窗口</a><br />
<p style="color:#999;">注:此页面仅供演示用,您可以在此页面的基础上实现文件上传和用户文件浏览功能<br />本页面提供两个接口用来和编辑器进行互动:callback和unloadme,callback用来返回上传的地址,唯一返回参数就是返回值,unloadme方法用来关闭当前模式窗口,无任何参数</p>
<form id="frmUpload" method="post" action="uploadguiupload.php">
<input type="hidden" name="parenthost" value="<?php echo $_GET['parenthost'];?>" />
<input type="submit" name="save" value="点击这里提交上传表单" />
</form>
</body>
</html> | zz-ms | trunk/zz-ms-v2.0/src/main/webapp/js/xheditor/demos/uploadgui.php | PHP | asf20 | 2,503 |
<?php
//此程序为demo09的服务端显示演示程序
header('Content-Type: text/html; charset=utf-8');
$sHtml=$_POST['elm1'];
function fixPre($match)
{
$match[2]=preg_replace('/<br\s*\/?>/i',"\r\n",$match[2]);
$match[2]=preg_replace('/<\/?[\w:]+(\s+[^>]+?)?>/i',"",$match[2]);//去除所有HTML标签
return $match[1].$match[2].$match[3];
}
$sHtml=preg_replace_callback('/(<pre(?:\s+[^>]*?)?>)([\s\S]+?)(<\/pre>)/i','fixPre',$sHtml);
?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>demo09插件显示测试页</title>
<style type="text/css">
body{margin:5px;border:2px solid #ccc;padding:5px;font:12px tahoma,arial,sans-serif;line-height:1.2}
</style>
<link type="text/css" rel="stylesheet" href="prettify/prettify.css"/>
<script type="text/javascript" src="prettify/prettify.js"></script>
<body>
<?php echo $sHtml?>
<script type="text/javascript">prettyPrint();</script>
</body>
</html> | zz-ms | trunk/zz-ms-v2.0/src/main/webapp/js/xheditor/demos/showplugin.php | PHP | asf20 | 1,125 |
<%@ CODEPAGE=65001 %>
<!--#include file="../serverscript/asp/ubb2html.asp"-->
<%
'此程序为UBB模式下的服务端显示测试程序
Response.Charset="UTF-8"
dim sHtml
sHtml=ubb2html(request("elm1"))'Server.HTMLEncode()
sHtml=showCode(sHtml)
sHtml=showFlv(sHtml)
%><script language="javascript" runat="server">
function showCode(sHtml)
{
sHtml=sHtml.replace(/\[code\s*(?:=\s*((?:(?!")[\s\S])+?)(?:"[\s\S]*?)?)?\]([\s\S]*?)\[\/code\]/ig,function(all,t,c){//code特殊处理
t=t.toLowerCase();
if(!t)t='plain';
c=c.replace(/[<>]/g,function(c){return {'<':'<','>':'>'}[c];});
return '<pre class="prettyprint lang-'+t+'">'+c+'</pre>';
});
return sHtml;
}
function showFlv(sHtml)
{
sHtml=sHtml.replace(/\[flv\s*(?:=\s*(\d+)\s*,\s*(\d+)\s*)?\]\s*(((?!")[\s\S])+?)(?:"[\s\S]*?)?\s*\[\/flv\]/ig,function(all,w,h,url){
if(!w)w=480;if(!h)h=400;
return '<embed type="application/x-shockwave-flash" src="mediaplayer/player.swf" wmode="transparent" allowscriptaccess="always" allowfullscreen="true" quality="high" bgcolor="#ffffff" width="'+w+'" height="'+h+'" flashvars="file='+url+'" />';
});
return sHtml;
}
</script><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>UBB文章显示测试页</title>
<style type="text/css">
body{margin:5px;border:2px solid #ccc;padding:5px;font:12px tahoma,arial,sans-serif;line-height:1.2}
</style>
<link type="text/css" rel="stylesheet" href="prettify/prettify.css"/>
<script type="text/javascript" src="prettify/prettify.js"></script>
<body>
<%=sHtml%>
<script type="text/javascript">prettyPrint();</script>
</body>
</html> | zz-ms | trunk/zz-ms-v2.0/src/main/webapp/js/xheditor/demos/showubb.asp | Classic ASP | asf20 | 1,822 |
<?php
/*!
* upload demo for php
* @requires xhEditor
*
* @author Yanis.Wang<yanis.wang@gmail.com>
* @site http://xheditor.com/
* @licence LGPL(http://www.opensource.org/licenses/lgpl-license.php)
*
* @Version: 0.9.6 (build 111027)
*
* 注1:本程序仅为演示用,请您务必根据自己需求进行相应修改,或者重开发
* 注2:本程序特别针对HTML5上传,加入了特殊处理
*/
header('Content-Type: text/html; charset=UTF-8');
$inputName='filedata';//表单文件域name
$attachDir='upload';//上传文件保存路径,结尾不要带/
$dirType=1;//1:按天存入目录 2:按月存入目录 3:按扩展名存目录 建议使用按天存
$maxAttachSize=2097152;//最大上传大小,默认是2M
$upExt='txt,rar,zip,jpg,jpeg,gif,png,swf,wmv,avi,wma,mp3,mid';//上传扩展名
$msgType=2;//返回上传参数的格式:1,只返回url,2,返回参数数组
$immediate=isset($_GET['immediate'])?$_GET['immediate']:0;//立即上传模式,仅为演示用
ini_set('date.timezone','Asia/Shanghai');//时区
$err = "";
$msg = "''";
$tempPath=$attachDir.'/'.date("YmdHis").mt_rand(10000,99999).'.tmp';
$localName='';
if(isset($_SERVER['HTTP_CONTENT_DISPOSITION'])&&preg_match('/attachment;\s+name="(.+?)";\s+filename="(.+?)"/i',$_SERVER['HTTP_CONTENT_DISPOSITION'],$info)){//HTML5上传
file_put_contents($tempPath,file_get_contents("php://input"));
$localName=urldecode($info[2]);
}
else{//标准表单式上传
$upfile=@$_FILES[$inputName];
if(!isset($upfile))$err='文件域的name错误';
elseif(!empty($upfile['error'])){
switch($upfile['error'])
{
case '1':
$err = '文件大小超过了php.ini定义的upload_max_filesize值';
break;
case '2':
$err = '文件大小超过了HTML定义的MAX_FILE_SIZE值';
break;
case '3':
$err = '文件上传不完全';
break;
case '4':
$err = '无文件上传';
break;
case '6':
$err = '缺少临时文件夹';
break;
case '7':
$err = '写文件失败';
break;
case '8':
$err = '上传被其它扩展中断';
break;
case '999':
default:
$err = '无有效错误代码';
}
}
elseif(empty($upfile['tmp_name']) || $upfile['tmp_name'] == 'none')$err = '无文件上传';
else{
move_uploaded_file($upfile['tmp_name'],$tempPath);
$localName=$upfile['name'];
}
}
if($err==''){
$fileInfo=pathinfo($localName);
$extension=$fileInfo['extension'];
if(preg_match('/^('.str_replace(',','|',$upExt).')$/i',$extension))
{
$bytes=filesize($tempPath);
if($bytes > $maxAttachSize)$err='请不要上传大小超过'.formatBytes($maxAttachSize).'的文件';
else
{
switch($dirType)
{
case 1: $attachSubDir = 'day_'.date('ymd'); break;
case 2: $attachSubDir = 'month_'.date('ym'); break;
case 3: $attachSubDir = 'ext_'.$extension; break;
}
$attachDir = $attachDir.'/'.$attachSubDir;
if(!is_dir($attachDir))
{
@mkdir($attachDir, 0777);
@fclose(fopen($attachDir.'/index.htm', 'w'));
}
PHP_VERSION < '4.2.0' && mt_srand((double)microtime() * 1000000);
$newFilename=date("YmdHis").mt_rand(1000,9999).'.'.$extension;
$targetPath = $attachDir.'/'.$newFilename;
rename($tempPath,$targetPath);
@chmod($targetPath,0755);
$targetPath=jsonString($targetPath);
if($immediate=='1')$targetPath='!'.$targetPath;
if($msgType==1)$msg="'$targetPath'";
else $msg="{'url':'".$targetPath."','localname':'".jsonString($localName)."','id':'1'}";//id参数固定不变,仅供演示,实际项目中可以是数据库ID
}
}
else $err='上传文件扩展名必需为:'.$upExt;
@unlink($tempPath);
}
echo "{'err':'".jsonString($err)."','msg':".$msg."}";
function jsonString($str)
{
return preg_replace("/([\\\\\/'])/",'\\\$1',$str);
}
function formatBytes($bytes) {
if($bytes >= 1073741824) {
$bytes = round($bytes / 1073741824 * 100) / 100 . 'GB';
} elseif($bytes >= 1048576) {
$bytes = round($bytes / 1048576 * 100) / 100 . 'MB';
} elseif($bytes >= 1024) {
$bytes = round($bytes / 1024 * 100) / 100 . 'KB';
} else {
$bytes = $bytes . 'Bytes';
}
return $bytes;
}
?> | zz-ms | trunk/zz-ms-v2.0/src/main/webapp/js/xheditor/demos/upload.php | PHP | asf20 | 4,255 |
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>xhEditor demo4 : 其它选项</title>
<link rel="stylesheet" href="common.css" type="text/css" media="screen" />
<script type="text/javascript" src="../jquery/jquery-1.4.4.min.js"></script>
<script type="text/javascript" src="../xheditor-1.1.14-zh-cn.min.js"></script>
<script type="text/javascript">
$(pageInit);
function pageInit()
{
$.extend(xheditor.settings,{shortcuts:{'ctrl+enter':submitForm}});
$('#elm1').xheditor({urlType:'rel'});
$('#elm2').xheditor({urlType:'root'});
$('#elm3').xheditor({urlType:'abs'});
$('#elm4').xheditor({urlBase:'img/'});
var emots={
msn:{name:'MSN',count:40,width:22,height:22,line:8},
pidgin:{name:'Pidgin',width:22,height:25,line:8,list:{smile:'微笑',cute:'可爱',wink:'眨眼',laugh:'大笑',victory:'胜利',sad:'伤心',cry:'哭泣',angry:'生气',shout:'大骂',curse:'诅咒',devil:'魔鬼',blush:'害羞',tongue:'吐舌头',envy:'羡慕',cool:'耍酷',kiss:'吻',shocked:'惊讶',sweat:'汗',sick:'生病',bye:'再见',tired:'累',sleepy:'睡了',question:'疑问',rose:'玫瑰',gift:'礼物',coffee:'咖啡',music:'音乐',soccer:'足球',good:'赞同',bad:'反对',love:'心',brokenheart:'伤心'}},
ipb:{name:'IPB',width:20,height:25,line:8,list:{smile:'微笑',joyful:'开心',laugh:'笑',biglaugh:'大笑',w00t:'欢呼',wub:'欢喜',depres:'沮丧',sad:'悲伤',cry:'哭泣',angry:'生气',devil:'魔鬼',blush:'脸红',kiss:'吻',surprised:'惊讶',wondering:'疑惑',unsure:'不确定',tongue:'吐舌头',cool:'耍酷',blink:'眨眼',whistling:'吹口哨',glare:'轻视',pinch:'捏',sideways:'侧身',sleep:'睡了',sick:'生病',ninja:'忍者',bandit:'强盗',police:'警察',angel:'天使',magician:'魔法师',alien:'外星人',heart:'心动'}}
};
$('#elm5').xheditor({tools:'full',skin:'default',width:800,height:200,clickCancelDialog:false,fullscreen:false,layerShadow:3,linkTag:false,cleanPaste:0,defLinkText:'默认超链接文字',sourceMode:false,showBlocktag:true,forcePtag:false,internalScript:true,inlineScript:true,internalStyle:true,inlineStyle:true,hoverExecDelay:-1,loadCSS:'http://xheditor.com/css/common.css',emots:emots});
}
function submitForm(){$('#frmDemo').submit();}
</script>
</head>
<body>
<div id="header-nav">
<ul>
<li><a href="demo01.html"><span>默认模式</span></a></li>
<li><a href="demo02.html"><span>自定义按钮</span></a></li>
<li><a href="demo03.html"><span>皮肤选择</span></a></li>
<li><a href="demo04.html"><span>其它选项</span></a></li>
<li><a href="demo05.html"><span>API交互</span></a></li>
<li><a href="demo06.html"><span>非utf-8编码调用</span></a></li>
<li><a href="demo07.html"><span>UBB可视化</span></a></li>
<li><a href="demo08.html"><span>Ajax上传</span></a></li>
<li><a href="demo09.html"><span>插件扩展</span></a></li>
<li><a href="demo10.html"><span>iframe调用上传</span></a></li>
<li><a href="demo11.html"><span>异步加载</span></a></li>
<li><a href="demo12.html"><span>远程抓图</span></a></li>
<li><a href="../wizard.html" target="_blank"><span>生成代码</span></a></li>
</ul>
</div>
<form id="frmDemo" method="post" action="show.php">
<h3>xhEditor demo4 : 其它选项</h3>
1,本地URL转相对地址(urlType:rel):<br />
<textarea id="elm1" name="elm1" rows="8" cols="80" style="width: 80%">
<p>内部图片:<img src="img/xheditor.gif" alt="" /></p><p>外部图片:<img src="http://www.google.cn/intl/zh-CN/images/logo_cn.gif" alt="" /></p><p>内部链接:<a href="index.html">xhEditor</a></p><p>外部链接:<a href="http://www.google.com/">Google</a></p><p> </p><p>当前实例调用的Javascript源代码为:</p><p>$('#elm1').xheditor({<span style="color:#ff0000;">urlType:'rel'</span>});<br /></p>
</textarea><br /><br />
2,本地URL转根地址(urlType:root):<br />
<textarea id="elm2" name="elm2" rows="8" cols="80" style="width: 80%">
<p>内部图片:<img src="img/xheditor.gif" alt="" /></p><p>外部图片:<img src="http://www.google.cn/intl/zh-CN/images/logo_cn.gif" alt="" /></p><p>内部链接:<a href="index.html">xhEditor</a></p><p>外部链接:<a href="http://www.google.com/">Google</a></p><p> </p><p>当前实例调用的Javascript源代码为:</p><p>$('#elm2').xheditor({<span style="color:#ff0000;">urlType:'root'</span>});<br /></p>
</textarea><br /><br />
3,本地URL转绝对地址(urlType:abs):<br />
<textarea id="elm3" name="elm3" rows="8" cols="80" style="width: 80%">
<p>内部图片:<img src="img/xheditor.gif" alt="" /></p><p>外部图片:<img src="http://www.google.cn/intl/zh-CN/images/logo_cn.gif" alt="" /></p><p>内部链接:<a href="index.html">xhEditor</a></p><p>外部链接:<a href="http://www.google.com/">Google</a></p><p> </p><p>当前实例调用的Javascript源代码为:</p><p>$('#elm3').xheditor({<span style="color:#ff0000;">urlType:'abs'</span>});<br /></p>
</textarea><br /><br />
4,相对地址的基址路径(urlBase):<br />
<textarea id="elm4" name="elm4" rows="8" cols="80" style="width: 80%">
<p>图片:<img src="xheditor.gif" alt="" /></p><p>链接:<a href="xheditor.gif">xhEditor</a></p><p>&nbsp;</p><p>当前实例调用的Javascript源代码为:</p><p>$('#elm4').xheditor({<span style="color:#ff0000;">urlBase:'img/'</span>});</p><p>urlBase主要应用在前后台路径不一致的情况下,举例如下:</p><p>前台文章地址为:http://xheditor.com/read/1.html<br />后台发布文章地址为:http://xheditor.com/admin/add.php</p><p>针对这种情况,使用urlType:root,或者urlType:abs当然能解决此问题,但是这样的路径一方面过长,另一方面也不利于今后调整路径结构。</p><p>本质来讲,这个参数的功能和HTML中的&lt;base href=""&gt;功能是一致的。</p><p>目标就是让文章中的图片保存为以文章发布路径为基础的相对路径,但是在后台编辑文章时又不至于显示不了图片。<br /></p>
</textarea><br /><br />
5,其它更多选项:<br />
<textarea id="elm5" name="elm5" rows="8" cols="80" style="width: 80%;background:url(img/xheditorbg.gif) no-repeat right bottom fixed">
<p>当前实例调用的Javascript源代码为:</p><p>$('#elm5').xheditor({tools:'full',skin:'default',width:800,height:200,clickCancelDialog:false,fullscreen:false,layerShadow:3,linkTag:false,cleanPaste:0,defLinkText:'默认超链接文字',sourceMode:false,showBlocktag:true,forcePtag:false,internalScript:true,inlineScript:true,internalStyle:true,inlineStyle:true,hoverExecDelay:-1,loadCSS:'http://xheditor.com/css/global.css',emots:{msn:{name:'MSN',count:40,width:22,height:22,line:8}},shortcuts:{'ctrl+enter':submitForm}});</p><br /><br />注:本实例演示其它大部分的初始化参数,详细帮助信息请查看:<a href="http://xheditor.com/manual/2#chapter2">http://xheditor.com/manual/2#chapter2</a>
</textarea>
<br/><br />
<input type="submit" name="save" value="Submit" />
<input type="reset" name="reset" value="Reset" />
</form>
</body>
</html> | zz-ms | trunk/zz-ms-v2.0/src/main/webapp/js/xheditor/demos/demo04.html | HTML | asf20 | 8,187 |
/*!
* jQuery JavaScript Library v1.4.4
* http://jquery.com/
*
* Copyright 2010, John Resig
* Dual licensed under the MIT or GPL Version 2 licenses.
* http://jquery.org/license
*
* Includes Sizzle.js
* http://sizzlejs.com/
* Copyright 2010, The Dojo Foundation
* Released under the MIT, BSD, and GPL Licenses.
*
* Date: Thu Nov 11 19:04:53 2010 -0500
*/
(function( window, undefined ) {
// Use the correct document accordingly with window argument (sandbox)
var document = window.document;
var jQuery = (function() {
// Define a local copy of jQuery
var jQuery = function( selector, context ) {
// The jQuery object is actually just the init constructor 'enhanced'
return new jQuery.fn.init( selector, context );
},
// Map over jQuery in case of overwrite
_jQuery = window.jQuery,
// Map over the $ in case of overwrite
_$ = window.$,
// A central reference to the root jQuery(document)
rootjQuery,
// A simple way to check for HTML strings or ID strings
// (both of which we optimize for)
quickExpr = /^(?:[^<]*(<[\w\W]+>)[^>]*$|#([\w\-]+)$)/,
// Is it a simple selector
isSimple = /^.[^:#\[\.,]*$/,
// Check if a string has a non-whitespace character in it
rnotwhite = /\S/,
rwhite = /\s/,
// Used for trimming whitespace
trimLeft = /^\s+/,
trimRight = /\s+$/,
// Check for non-word characters
rnonword = /\W/,
// Check for digits
rdigit = /\d/,
// Match a standalone tag
rsingleTag = /^<(\w+)\s*\/?>(?:<\/\1>)?$/,
// JSON RegExp
rvalidchars = /^[\],:{}\s]*$/,
rvalidescape = /\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g,
rvalidtokens = /"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,
rvalidbraces = /(?:^|:|,)(?:\s*\[)+/g,
// Useragent RegExp
rwebkit = /(webkit)[ \/]([\w.]+)/,
ropera = /(opera)(?:.*version)?[ \/]([\w.]+)/,
rmsie = /(msie) ([\w.]+)/,
rmozilla = /(mozilla)(?:.*? rv:([\w.]+))?/,
// Keep a UserAgent string for use with jQuery.browser
userAgent = navigator.userAgent,
// For matching the engine and version of the browser
browserMatch,
// Has the ready events already been bound?
readyBound = false,
// The functions to execute on DOM ready
readyList = [],
// The ready event handler
DOMContentLoaded,
// Save a reference to some core methods
toString = Object.prototype.toString,
hasOwn = Object.prototype.hasOwnProperty,
push = Array.prototype.push,
slice = Array.prototype.slice,
trim = String.prototype.trim,
indexOf = Array.prototype.indexOf,
// [[Class]] -> type pairs
class2type = {};
jQuery.fn = jQuery.prototype = {
init: function( selector, context ) {
var match, elem, ret, doc;
// Handle $(""), $(null), or $(undefined)
if ( !selector ) {
return this;
}
// Handle $(DOMElement)
if ( selector.nodeType ) {
this.context = this[0] = selector;
this.length = 1;
return this;
}
// The body element only exists once, optimize finding it
if ( selector === "body" && !context && document.body ) {
this.context = document;
this[0] = document.body;
this.selector = "body";
this.length = 1;
return this;
}
// Handle HTML strings
if ( typeof selector === "string" ) {
// Are we dealing with HTML string or an ID?
match = quickExpr.exec( selector );
// Verify a match, and that no context was specified for #id
if ( match && (match[1] || !context) ) {
// HANDLE: $(html) -> $(array)
if ( match[1] ) {
doc = (context ? context.ownerDocument || context : document);
// If a single string is passed in and it's a single tag
// just do a createElement and skip the rest
ret = rsingleTag.exec( selector );
if ( ret ) {
if ( jQuery.isPlainObject( context ) ) {
selector = [ document.createElement( ret[1] ) ];
jQuery.fn.attr.call( selector, context, true );
} else {
selector = [ doc.createElement( ret[1] ) ];
}
} else {
ret = jQuery.buildFragment( [ match[1] ], [ doc ] );
selector = (ret.cacheable ? ret.fragment.cloneNode(true) : ret.fragment).childNodes;
}
return jQuery.merge( this, selector );
// HANDLE: $("#id")
} else {
elem = document.getElementById( match[2] );
// Check parentNode to catch when Blackberry 4.6 returns
// nodes that are no longer in the document #6963
if ( elem && elem.parentNode ) {
// Handle the case where IE and Opera return items
// by name instead of ID
if ( elem.id !== match[2] ) {
return rootjQuery.find( selector );
}
// Otherwise, we inject the element directly into the jQuery object
this.length = 1;
this[0] = elem;
}
this.context = document;
this.selector = selector;
return this;
}
// HANDLE: $("TAG")
} else if ( !context && !rnonword.test( selector ) ) {
this.selector = selector;
this.context = document;
selector = document.getElementsByTagName( selector );
return jQuery.merge( this, selector );
// HANDLE: $(expr, $(...))
} else if ( !context || context.jquery ) {
return (context || rootjQuery).find( selector );
// HANDLE: $(expr, context)
// (which is just equivalent to: $(context).find(expr)
} else {
return jQuery( context ).find( selector );
}
// HANDLE: $(function)
// Shortcut for document ready
} else if ( jQuery.isFunction( selector ) ) {
return rootjQuery.ready( selector );
}
if (selector.selector !== undefined) {
this.selector = selector.selector;
this.context = selector.context;
}
return jQuery.makeArray( selector, this );
},
// Start with an empty selector
selector: "",
// The current version of jQuery being used
jquery: "1.4.4",
// The default length of a jQuery object is 0
length: 0,
// The number of elements contained in the matched element set
size: function() {
return this.length;
},
toArray: function() {
return slice.call( this, 0 );
},
// Get the Nth element in the matched element set OR
// Get the whole matched element set as a clean array
get: function( num ) {
return num == null ?
// Return a 'clean' array
this.toArray() :
// Return just the object
( num < 0 ? this.slice(num)[ 0 ] : this[ num ] );
},
// Take an array of elements and push it onto the stack
// (returning the new matched element set)
pushStack: function( elems, name, selector ) {
// Build a new jQuery matched element set
var ret = jQuery();
if ( jQuery.isArray( elems ) ) {
push.apply( ret, elems );
} else {
jQuery.merge( ret, elems );
}
// Add the old object onto the stack (as a reference)
ret.prevObject = this;
ret.context = this.context;
if ( name === "find" ) {
ret.selector = this.selector + (this.selector ? " " : "") + selector;
} else if ( name ) {
ret.selector = this.selector + "." + name + "(" + selector + ")";
}
// Return the newly-formed element set
return ret;
},
// Execute a callback for every element in the matched set.
// (You can seed the arguments with an array of args, but this is
// only used internally.)
each: function( callback, args ) {
return jQuery.each( this, callback, args );
},
ready: function( fn ) {
// Attach the listeners
jQuery.bindReady();
// If the DOM is already ready
if ( jQuery.isReady ) {
// Execute the function immediately
fn.call( document, jQuery );
// Otherwise, remember the function for later
} else if ( readyList ) {
// Add the function to the wait list
readyList.push( fn );
}
return this;
},
eq: function( i ) {
return i === -1 ?
this.slice( i ) :
this.slice( i, +i + 1 );
},
first: function() {
return this.eq( 0 );
},
last: function() {
return this.eq( -1 );
},
slice: function() {
return this.pushStack( slice.apply( this, arguments ),
"slice", slice.call(arguments).join(",") );
},
map: function( callback ) {
return this.pushStack( jQuery.map(this, function( elem, i ) {
return callback.call( elem, i, elem );
}));
},
end: function() {
return this.prevObject || jQuery(null);
},
// For internal use only.
// Behaves like an Array's method, not like a jQuery method.
push: push,
sort: [].sort,
splice: [].splice
};
// Give the init function the jQuery prototype for later instantiation
jQuery.fn.init.prototype = jQuery.fn;
jQuery.extend = jQuery.fn.extend = function() {
var options, name, src, copy, copyIsArray, clone,
target = arguments[0] || {},
i = 1,
length = arguments.length,
deep = false;
// Handle a deep copy situation
if ( typeof target === "boolean" ) {
deep = target;
target = arguments[1] || {};
// skip the boolean and the target
i = 2;
}
// Handle case when target is a string or something (possible in deep copy)
if ( typeof target !== "object" && !jQuery.isFunction(target) ) {
target = {};
}
// extend jQuery itself if only one argument is passed
if ( length === i ) {
target = this;
--i;
}
for ( ; i < length; i++ ) {
// Only deal with non-null/undefined values
if ( (options = arguments[ i ]) != null ) {
// Extend the base object
for ( name in options ) {
src = target[ name ];
copy = options[ name ];
// Prevent never-ending loop
if ( target === copy ) {
continue;
}
// Recurse if we're merging plain objects or arrays
if ( deep && copy && ( jQuery.isPlainObject(copy) || (copyIsArray = jQuery.isArray(copy)) ) ) {
if ( copyIsArray ) {
copyIsArray = false;
clone = src && jQuery.isArray(src) ? src : [];
} else {
clone = src && jQuery.isPlainObject(src) ? src : {};
}
// Never move original objects, clone them
target[ name ] = jQuery.extend( deep, clone, copy );
// Don't bring in undefined values
} else if ( copy !== undefined ) {
target[ name ] = copy;
}
}
}
}
// Return the modified object
return target;
};
jQuery.extend({
noConflict: function( deep ) {
window.$ = _$;
if ( deep ) {
window.jQuery = _jQuery;
}
return jQuery;
},
// Is the DOM ready to be used? Set to true once it occurs.
isReady: false,
// A counter to track how many items to wait for before
// the ready event fires. See #6781
readyWait: 1,
// Handle when the DOM is ready
ready: function( wait ) {
// A third-party is pushing the ready event forwards
if ( wait === true ) {
jQuery.readyWait--;
}
// Make sure that the DOM is not already loaded
if ( !jQuery.readyWait || (wait !== true && !jQuery.isReady) ) {
// Make sure body exists, at least, in case IE gets a little overzealous (ticket #5443).
if ( !document.body ) {
return setTimeout( jQuery.ready, 1 );
}
// Remember that the DOM is ready
jQuery.isReady = true;
// If a normal DOM Ready event fired, decrement, and wait if need be
if ( wait !== true && --jQuery.readyWait > 0 ) {
return;
}
// If there are functions bound, to execute
if ( readyList ) {
// Execute all of them
var fn,
i = 0,
ready = readyList;
// Reset the list of functions
readyList = null;
while ( (fn = ready[ i++ ]) ) {
fn.call( document, jQuery );
}
// Trigger any bound ready events
if ( jQuery.fn.trigger ) {
jQuery( document ).trigger( "ready" ).unbind( "ready" );
}
}
}
},
bindReady: function() {
if ( readyBound ) {
return;
}
readyBound = true;
// Catch cases where $(document).ready() is called after the
// browser event has already occurred.
if ( document.readyState === "complete" ) {
// Handle it asynchronously to allow scripts the opportunity to delay ready
return setTimeout( jQuery.ready, 1 );
}
// Mozilla, Opera and webkit nightlies currently support this event
if ( document.addEventListener ) {
// Use the handy event callback
document.addEventListener( "DOMContentLoaded", DOMContentLoaded, false );
// A fallback to window.onload, that will always work
window.addEventListener( "load", jQuery.ready, false );
// If IE event model is used
} else if ( document.attachEvent ) {
// ensure firing before onload,
// maybe late but safe also for iframes
document.attachEvent("onreadystatechange", DOMContentLoaded);
// A fallback to window.onload, that will always work
window.attachEvent( "onload", jQuery.ready );
// If IE and not a frame
// continually check to see if the document is ready
var toplevel = false;
try {
toplevel = window.frameElement == null;
} catch(e) {}
if ( document.documentElement.doScroll && toplevel ) {
doScrollCheck();
}
}
},
// See test/unit/core.js for details concerning isFunction.
// Since version 1.3, DOM methods and functions like alert
// aren't supported. They return false on IE (#2968).
isFunction: function( obj ) {
return jQuery.type(obj) === "function";
},
isArray: Array.isArray || function( obj ) {
return jQuery.type(obj) === "array";
},
// A crude way of determining if an object is a window
isWindow: function( obj ) {
return obj && typeof obj === "object" && "setInterval" in obj;
},
isNaN: function( obj ) {
return obj == null || !rdigit.test( obj ) || isNaN( obj );
},
type: function( obj ) {
return obj == null ?
String( obj ) :
class2type[ toString.call(obj) ] || "object";
},
isPlainObject: function( obj ) {
// Must be an Object.
// Because of IE, we also have to check the presence of the constructor property.
// Make sure that DOM nodes and window objects don't pass through, as well
if ( !obj || jQuery.type(obj) !== "object" || obj.nodeType || jQuery.isWindow( obj ) ) {
return false;
}
// Not own constructor property must be Object
if ( obj.constructor &&
!hasOwn.call(obj, "constructor") &&
!hasOwn.call(obj.constructor.prototype, "isPrototypeOf") ) {
return false;
}
// Own properties are enumerated firstly, so to speed up,
// if last one is own, then all properties are own.
var key;
for ( key in obj ) {}
return key === undefined || hasOwn.call( obj, key );
},
isEmptyObject: function( obj ) {
for ( var name in obj ) {
return false;
}
return true;
},
error: function( msg ) {
throw msg;
},
parseJSON: function( data ) {
if ( typeof data !== "string" || !data ) {
return null;
}
// Make sure leading/trailing whitespace is removed (IE can't handle it)
data = jQuery.trim( data );
// Make sure the incoming data is actual JSON
// Logic borrowed from http://json.org/json2.js
if ( rvalidchars.test(data.replace(rvalidescape, "@")
.replace(rvalidtokens, "]")
.replace(rvalidbraces, "")) ) {
// Try to use the native JSON parser first
return window.JSON && window.JSON.parse ?
window.JSON.parse( data ) :
(new Function("return " + data))();
} else {
jQuery.error( "Invalid JSON: " + data );
}
},
noop: function() {},
// Evalulates a script in a global context
globalEval: function( data ) {
if ( data && rnotwhite.test(data) ) {
// Inspired by code by Andrea Giammarchi
// http://webreflection.blogspot.com/2007/08/global-scope-evaluation-and-dom.html
var head = document.getElementsByTagName("head")[0] || document.documentElement,
script = document.createElement("script");
script.type = "text/javascript";
if ( jQuery.support.scriptEval ) {
script.appendChild( document.createTextNode( data ) );
} else {
script.text = data;
}
// Use insertBefore instead of appendChild to circumvent an IE6 bug.
// This arises when a base node is used (#2709).
head.insertBefore( script, head.firstChild );
head.removeChild( script );
}
},
nodeName: function( elem, name ) {
return elem.nodeName && elem.nodeName.toUpperCase() === name.toUpperCase();
},
// args is for internal usage only
each: function( object, callback, args ) {
var name, i = 0,
length = object.length,
isObj = length === undefined || jQuery.isFunction(object);
if ( args ) {
if ( isObj ) {
for ( name in object ) {
if ( callback.apply( object[ name ], args ) === false ) {
break;
}
}
} else {
for ( ; i < length; ) {
if ( callback.apply( object[ i++ ], args ) === false ) {
break;
}
}
}
// A special, fast, case for the most common use of each
} else {
if ( isObj ) {
for ( name in object ) {
if ( callback.call( object[ name ], name, object[ name ] ) === false ) {
break;
}
}
} else {
for ( var value = object[0];
i < length && callback.call( value, i, value ) !== false; value = object[++i] ) {}
}
}
return object;
},
// Use native String.trim function wherever possible
trim: trim ?
function( text ) {
return text == null ?
"" :
trim.call( text );
} :
// Otherwise use our own trimming functionality
function( text ) {
return text == null ?
"" :
text.toString().replace( trimLeft, "" ).replace( trimRight, "" );
},
// results is for internal usage only
makeArray: function( array, results ) {
var ret = results || [];
if ( array != null ) {
// The window, strings (and functions) also have 'length'
// The extra typeof function check is to prevent crashes
// in Safari 2 (See: #3039)
// Tweaked logic slightly to handle Blackberry 4.7 RegExp issues #6930
var type = jQuery.type(array);
if ( array.length == null || type === "string" || type === "function" || type === "regexp" || jQuery.isWindow( array ) ) {
push.call( ret, array );
} else {
jQuery.merge( ret, array );
}
}
return ret;
},
inArray: function( elem, array ) {
if ( array.indexOf ) {
return array.indexOf( elem );
}
for ( var i = 0, length = array.length; i < length; i++ ) {
if ( array[ i ] === elem ) {
return i;
}
}
return -1;
},
merge: function( first, second ) {
var i = first.length,
j = 0;
if ( typeof second.length === "number" ) {
for ( var l = second.length; j < l; j++ ) {
first[ i++ ] = second[ j ];
}
} else {
while ( second[j] !== undefined ) {
first[ i++ ] = second[ j++ ];
}
}
first.length = i;
return first;
},
grep: function( elems, callback, inv ) {
var ret = [], retVal;
inv = !!inv;
// Go through the array, only saving the items
// that pass the validator function
for ( var i = 0, length = elems.length; i < length; i++ ) {
retVal = !!callback( elems[ i ], i );
if ( inv !== retVal ) {
ret.push( elems[ i ] );
}
}
return ret;
},
// arg is for internal usage only
map: function( elems, callback, arg ) {
var ret = [], value;
// Go through the array, translating each of the items to their
// new value (or values).
for ( var i = 0, length = elems.length; i < length; i++ ) {
value = callback( elems[ i ], i, arg );
if ( value != null ) {
ret[ ret.length ] = value;
}
}
return ret.concat.apply( [], ret );
},
// A global GUID counter for objects
guid: 1,
proxy: function( fn, proxy, thisObject ) {
if ( arguments.length === 2 ) {
if ( typeof proxy === "string" ) {
thisObject = fn;
fn = thisObject[ proxy ];
proxy = undefined;
} else if ( proxy && !jQuery.isFunction( proxy ) ) {
thisObject = proxy;
proxy = undefined;
}
}
if ( !proxy && fn ) {
proxy = function() {
return fn.apply( thisObject || this, arguments );
};
}
// Set the guid of unique handler to the same of original handler, so it can be removed
if ( fn ) {
proxy.guid = fn.guid = fn.guid || proxy.guid || jQuery.guid++;
}
// So proxy can be declared as an argument
return proxy;
},
// Mutifunctional method to get and set values to a collection
// The value/s can be optionally by executed if its a function
access: function( elems, key, value, exec, fn, pass ) {
var length = elems.length;
// Setting many attributes
if ( typeof key === "object" ) {
for ( var k in key ) {
jQuery.access( elems, k, key[k], exec, fn, value );
}
return elems;
}
// Setting one attribute
if ( value !== undefined ) {
// Optionally, function values get executed if exec is true
exec = !pass && exec && jQuery.isFunction(value);
for ( var i = 0; i < length; i++ ) {
fn( elems[i], key, exec ? value.call( elems[i], i, fn( elems[i], key ) ) : value, pass );
}
return elems;
}
// Getting an attribute
return length ? fn( elems[0], key ) : undefined;
},
now: function() {
return (new Date()).getTime();
},
// Use of jQuery.browser is frowned upon.
// More details: http://docs.jquery.com/Utilities/jQuery.browser
uaMatch: function( ua ) {
ua = ua.toLowerCase();
var match = rwebkit.exec( ua ) ||
ropera.exec( ua ) ||
rmsie.exec( ua ) ||
ua.indexOf("compatible") < 0 && rmozilla.exec( ua ) ||
[];
return { browser: match[1] || "", version: match[2] || "0" };
},
browser: {}
});
// Populate the class2type map
jQuery.each("Boolean Number String Function Array Date RegExp Object".split(" "), function(i, name) {
class2type[ "[object " + name + "]" ] = name.toLowerCase();
});
browserMatch = jQuery.uaMatch( userAgent );
if ( browserMatch.browser ) {
jQuery.browser[ browserMatch.browser ] = true;
jQuery.browser.version = browserMatch.version;
}
// Deprecated, use jQuery.browser.webkit instead
if ( jQuery.browser.webkit ) {
jQuery.browser.safari = true;
}
if ( indexOf ) {
jQuery.inArray = function( elem, array ) {
return indexOf.call( array, elem );
};
}
// Verify that \s matches non-breaking spaces
// (IE fails on this test)
if ( !rwhite.test( "\xA0" ) ) {
trimLeft = /^[\s\xA0]+/;
trimRight = /[\s\xA0]+$/;
}
// All jQuery objects should point back to these
rootjQuery = jQuery(document);
// Cleanup functions for the document ready method
if ( document.addEventListener ) {
DOMContentLoaded = function() {
document.removeEventListener( "DOMContentLoaded", DOMContentLoaded, false );
jQuery.ready();
};
} else if ( document.attachEvent ) {
DOMContentLoaded = function() {
// Make sure body exists, at least, in case IE gets a little overzealous (ticket #5443).
if ( document.readyState === "complete" ) {
document.detachEvent( "onreadystatechange", DOMContentLoaded );
jQuery.ready();
}
};
}
// The DOM ready check for Internet Explorer
function doScrollCheck() {
if ( jQuery.isReady ) {
return;
}
try {
// If IE is used, use the trick by Diego Perini
// http://javascript.nwbox.com/IEContentLoaded/
document.documentElement.doScroll("left");
} catch(e) {
setTimeout( doScrollCheck, 1 );
return;
}
// and execute any waiting functions
jQuery.ready();
}
// Expose jQuery to the global object
return (window.jQuery = window.$ = jQuery);
})();
(function() {
jQuery.support = {};
var root = document.documentElement,
script = document.createElement("script"),
div = document.createElement("div"),
id = "script" + jQuery.now();
div.style.display = "none";
div.innerHTML = " <link/><table></table><a href='/a' style='color:red;float:left;opacity:.55;'>a</a><input type='checkbox'/>";
var all = div.getElementsByTagName("*"),
a = div.getElementsByTagName("a")[0],
select = document.createElement("select"),
opt = select.appendChild( document.createElement("option") );
// Can't get basic test support
if ( !all || !all.length || !a ) {
return;
}
jQuery.support = {
// IE strips leading whitespace when .innerHTML is used
leadingWhitespace: div.firstChild.nodeType === 3,
// Make sure that tbody elements aren't automatically inserted
// IE will insert them into empty tables
tbody: !div.getElementsByTagName("tbody").length,
// Make sure that link elements get serialized correctly by innerHTML
// This requires a wrapper element in IE
htmlSerialize: !!div.getElementsByTagName("link").length,
// Get the style information from getAttribute
// (IE uses .cssText insted)
style: /red/.test( a.getAttribute("style") ),
// Make sure that URLs aren't manipulated
// (IE normalizes it by default)
hrefNormalized: a.getAttribute("href") === "/a",
// Make sure that element opacity exists
// (IE uses filter instead)
// Use a regex to work around a WebKit issue. See #5145
opacity: /^0.55$/.test( a.style.opacity ),
// Verify style float existence
// (IE uses styleFloat instead of cssFloat)
cssFloat: !!a.style.cssFloat,
// Make sure that if no value is specified for a checkbox
// that it defaults to "on".
// (WebKit defaults to "" instead)
checkOn: div.getElementsByTagName("input")[0].value === "on",
// Make sure that a selected-by-default option has a working selected property.
// (WebKit defaults to false instead of true, IE too, if it's in an optgroup)
optSelected: opt.selected,
// Will be defined later
deleteExpando: true,
optDisabled: false,
checkClone: false,
scriptEval: false,
noCloneEvent: true,
boxModel: null,
inlineBlockNeedsLayout: false,
shrinkWrapBlocks: false,
reliableHiddenOffsets: true
};
// Make sure that the options inside disabled selects aren't marked as disabled
// (WebKit marks them as diabled)
select.disabled = true;
jQuery.support.optDisabled = !opt.disabled;
script.type = "text/javascript";
try {
script.appendChild( document.createTextNode( "window." + id + "=1;" ) );
} catch(e) {}
root.insertBefore( script, root.firstChild );
// Make sure that the execution of code works by injecting a script
// tag with appendChild/createTextNode
// (IE doesn't support this, fails, and uses .text instead)
if ( window[ id ] ) {
jQuery.support.scriptEval = true;
delete window[ id ];
}
// Test to see if it's possible to delete an expando from an element
// Fails in Internet Explorer
try {
delete script.test;
} catch(e) {
jQuery.support.deleteExpando = false;
}
root.removeChild( script );
if ( div.attachEvent && div.fireEvent ) {
div.attachEvent("onclick", function click() {
// Cloning a node shouldn't copy over any
// bound event handlers (IE does this)
jQuery.support.noCloneEvent = false;
div.detachEvent("onclick", click);
});
div.cloneNode(true).fireEvent("onclick");
}
div = document.createElement("div");
div.innerHTML = "<input type='radio' name='radiotest' checked='checked'/>";
var fragment = document.createDocumentFragment();
fragment.appendChild( div.firstChild );
// WebKit doesn't clone checked state correctly in fragments
jQuery.support.checkClone = fragment.cloneNode(true).cloneNode(true).lastChild.checked;
// Figure out if the W3C box model works as expected
// document.body must exist before we can do this
jQuery(function() {
var div = document.createElement("div");
div.style.width = div.style.paddingLeft = "1px";
document.body.appendChild( div );
jQuery.boxModel = jQuery.support.boxModel = div.offsetWidth === 2;
if ( "zoom" in div.style ) {
// Check if natively block-level elements act like inline-block
// elements when setting their display to 'inline' and giving
// them layout
// (IE < 8 does this)
div.style.display = "inline";
div.style.zoom = 1;
jQuery.support.inlineBlockNeedsLayout = div.offsetWidth === 2;
// Check if elements with layout shrink-wrap their children
// (IE 6 does this)
div.style.display = "";
div.innerHTML = "<div style='width:4px;'></div>";
jQuery.support.shrinkWrapBlocks = div.offsetWidth !== 2;
}
div.innerHTML = "<table><tr><td style='padding:0;display:none'></td><td>t</td></tr></table>";
var tds = div.getElementsByTagName("td");
// Check if table cells still have offsetWidth/Height when they are set
// to display:none and there are still other visible table cells in a
// table row; if so, offsetWidth/Height are not reliable for use when
// determining if an element has been hidden directly using
// display:none (it is still safe to use offsets if a parent element is
// hidden; don safety goggles and see bug #4512 for more information).
// (only IE 8 fails this test)
jQuery.support.reliableHiddenOffsets = tds[0].offsetHeight === 0;
tds[0].style.display = "";
tds[1].style.display = "none";
// Check if empty table cells still have offsetWidth/Height
// (IE < 8 fail this test)
jQuery.support.reliableHiddenOffsets = jQuery.support.reliableHiddenOffsets && tds[0].offsetHeight === 0;
div.innerHTML = "";
document.body.removeChild( div ).style.display = "none";
div = tds = null;
});
// Technique from Juriy Zaytsev
// http://thinkweb2.com/projects/prototype/detecting-event-support-without-browser-sniffing/
var eventSupported = function( eventName ) {
var el = document.createElement("div");
eventName = "on" + eventName;
var isSupported = (eventName in el);
if ( !isSupported ) {
el.setAttribute(eventName, "return;");
isSupported = typeof el[eventName] === "function";
}
el = null;
return isSupported;
};
jQuery.support.submitBubbles = eventSupported("submit");
jQuery.support.changeBubbles = eventSupported("change");
// release memory in IE
root = script = div = all = a = null;
})();
var windowData = {},
rbrace = /^(?:\{.*\}|\[.*\])$/;
jQuery.extend({
cache: {},
// Please use with caution
uuid: 0,
// Unique for each copy of jQuery on the page
expando: "jQuery" + jQuery.now(),
// The following elements throw uncatchable exceptions if you
// attempt to add expando properties to them.
noData: {
"embed": true,
// Ban all objects except for Flash (which handle expandos)
"object": "clsid:D27CDB6E-AE6D-11cf-96B8-444553540000",
"applet": true
},
data: function( elem, name, data ) {
if ( !jQuery.acceptData( elem ) ) {
return;
}
elem = elem == window ?
windowData :
elem;
var isNode = elem.nodeType,
id = isNode ? elem[ jQuery.expando ] : null,
cache = jQuery.cache, thisCache;
if ( isNode && !id && typeof name === "string" && data === undefined ) {
return;
}
// Get the data from the object directly
if ( !isNode ) {
cache = elem;
// Compute a unique ID for the element
} else if ( !id ) {
elem[ jQuery.expando ] = id = ++jQuery.uuid;
}
// Avoid generating a new cache unless none exists and we
// want to manipulate it.
if ( typeof name === "object" ) {
if ( isNode ) {
cache[ id ] = jQuery.extend(cache[ id ], name);
} else {
jQuery.extend( cache, name );
}
} else if ( isNode && !cache[ id ] ) {
cache[ id ] = {};
}
thisCache = isNode ? cache[ id ] : cache;
// Prevent overriding the named cache with undefined values
if ( data !== undefined ) {
thisCache[ name ] = data;
}
return typeof name === "string" ? thisCache[ name ] : thisCache;
},
removeData: function( elem, name ) {
if ( !jQuery.acceptData( elem ) ) {
return;
}
elem = elem == window ?
windowData :
elem;
var isNode = elem.nodeType,
id = isNode ? elem[ jQuery.expando ] : elem,
cache = jQuery.cache,
thisCache = isNode ? cache[ id ] : id;
// If we want to remove a specific section of the element's data
if ( name ) {
if ( thisCache ) {
// Remove the section of cache data
delete thisCache[ name ];
// If we've removed all the data, remove the element's cache
if ( isNode && jQuery.isEmptyObject(thisCache) ) {
jQuery.removeData( elem );
}
}
// Otherwise, we want to remove all of the element's data
} else {
if ( isNode && jQuery.support.deleteExpando ) {
delete elem[ jQuery.expando ];
} else if ( elem.removeAttribute ) {
elem.removeAttribute( jQuery.expando );
// Completely remove the data cache
} else if ( isNode ) {
delete cache[ id ];
// Remove all fields from the object
} else {
for ( var n in elem ) {
delete elem[ n ];
}
}
}
},
// A method for determining if a DOM node can handle the data expando
acceptData: function( elem ) {
if ( elem.nodeName ) {
var match = jQuery.noData[ elem.nodeName.toLowerCase() ];
if ( match ) {
return !(match === true || elem.getAttribute("classid") !== match);
}
}
return true;
}
});
jQuery.fn.extend({
data: function( key, value ) {
var data = null;
if ( typeof key === "undefined" ) {
if ( this.length ) {
var attr = this[0].attributes, name;
data = jQuery.data( this[0] );
for ( var i = 0, l = attr.length; i < l; i++ ) {
name = attr[i].name;
if ( name.indexOf( "data-" ) === 0 ) {
name = name.substr( 5 );
dataAttr( this[0], name, data[ name ] );
}
}
}
return data;
} else if ( typeof key === "object" ) {
return this.each(function() {
jQuery.data( this, key );
});
}
var parts = key.split(".");
parts[1] = parts[1] ? "." + parts[1] : "";
if ( value === undefined ) {
data = this.triggerHandler("getData" + parts[1] + "!", [parts[0]]);
// Try to fetch any internally stored data first
if ( data === undefined && this.length ) {
data = jQuery.data( this[0], key );
data = dataAttr( this[0], key, data );
}
return data === undefined && parts[1] ?
this.data( parts[0] ) :
data;
} else {
return this.each(function() {
var $this = jQuery( this ),
args = [ parts[0], value ];
$this.triggerHandler( "setData" + parts[1] + "!", args );
jQuery.data( this, key, value );
$this.triggerHandler( "changeData" + parts[1] + "!", args );
});
}
},
removeData: function( key ) {
return this.each(function() {
jQuery.removeData( this, key );
});
}
});
function dataAttr( elem, key, data ) {
// If nothing was found internally, try to fetch any
// data from the HTML5 data-* attribute
if ( data === undefined && elem.nodeType === 1 ) {
data = elem.getAttribute( "data-" + key );
if ( typeof data === "string" ) {
try {
data = data === "true" ? true :
data === "false" ? false :
data === "null" ? null :
!jQuery.isNaN( data ) ? parseFloat( data ) :
rbrace.test( data ) ? jQuery.parseJSON( data ) :
data;
} catch( e ) {}
// Make sure we set the data so it isn't changed later
jQuery.data( elem, key, data );
} else {
data = undefined;
}
}
return data;
}
jQuery.extend({
queue: function( elem, type, data ) {
if ( !elem ) {
return;
}
type = (type || "fx") + "queue";
var q = jQuery.data( elem, type );
// Speed up dequeue by getting out quickly if this is just a lookup
if ( !data ) {
return q || [];
}
if ( !q || jQuery.isArray(data) ) {
q = jQuery.data( elem, type, jQuery.makeArray(data) );
} else {
q.push( data );
}
return q;
},
dequeue: function( elem, type ) {
type = type || "fx";
var queue = jQuery.queue( elem, type ),
fn = queue.shift();
// If the fx queue is dequeued, always remove the progress sentinel
if ( fn === "inprogress" ) {
fn = queue.shift();
}
if ( fn ) {
// Add a progress sentinel to prevent the fx queue from being
// automatically dequeued
if ( type === "fx" ) {
queue.unshift("inprogress");
}
fn.call(elem, function() {
jQuery.dequeue(elem, type);
});
}
}
});
jQuery.fn.extend({
queue: function( type, data ) {
if ( typeof type !== "string" ) {
data = type;
type = "fx";
}
if ( data === undefined ) {
return jQuery.queue( this[0], type );
}
return this.each(function( i ) {
var queue = jQuery.queue( this, type, data );
if ( type === "fx" && queue[0] !== "inprogress" ) {
jQuery.dequeue( this, type );
}
});
},
dequeue: function( type ) {
return this.each(function() {
jQuery.dequeue( this, type );
});
},
// Based off of the plugin by Clint Helfers, with permission.
// http://blindsignals.com/index.php/2009/07/jquery-delay/
delay: function( time, type ) {
time = jQuery.fx ? jQuery.fx.speeds[time] || time : time;
type = type || "fx";
return this.queue( type, function() {
var elem = this;
setTimeout(function() {
jQuery.dequeue( elem, type );
}, time );
});
},
clearQueue: function( type ) {
return this.queue( type || "fx", [] );
}
});
var rclass = /[\n\t]/g,
rspaces = /\s+/,
rreturn = /\r/g,
rspecialurl = /^(?:href|src|style)$/,
rtype = /^(?:button|input)$/i,
rfocusable = /^(?:button|input|object|select|textarea)$/i,
rclickable = /^a(?:rea)?$/i,
rradiocheck = /^(?:radio|checkbox)$/i;
jQuery.props = {
"for": "htmlFor",
"class": "className",
readonly: "readOnly",
maxlength: "maxLength",
cellspacing: "cellSpacing",
rowspan: "rowSpan",
colspan: "colSpan",
tabindex: "tabIndex",
usemap: "useMap",
frameborder: "frameBorder"
};
jQuery.fn.extend({
attr: function( name, value ) {
return jQuery.access( this, name, value, true, jQuery.attr );
},
removeAttr: function( name, fn ) {
return this.each(function(){
jQuery.attr( this, name, "" );
if ( this.nodeType === 1 ) {
this.removeAttribute( name );
}
});
},
addClass: function( value ) {
if ( jQuery.isFunction(value) ) {
return this.each(function(i) {
var self = jQuery(this);
self.addClass( value.call(this, i, self.attr("class")) );
});
}
if ( value && typeof value === "string" ) {
var classNames = (value || "").split( rspaces );
for ( var i = 0, l = this.length; i < l; i++ ) {
var elem = this[i];
if ( elem.nodeType === 1 ) {
if ( !elem.className ) {
elem.className = value;
} else {
var className = " " + elem.className + " ",
setClass = elem.className;
for ( var c = 0, cl = classNames.length; c < cl; c++ ) {
if ( className.indexOf( " " + classNames[c] + " " ) < 0 ) {
setClass += " " + classNames[c];
}
}
elem.className = jQuery.trim( setClass );
}
}
}
}
return this;
},
removeClass: function( value ) {
if ( jQuery.isFunction(value) ) {
return this.each(function(i) {
var self = jQuery(this);
self.removeClass( value.call(this, i, self.attr("class")) );
});
}
if ( (value && typeof value === "string") || value === undefined ) {
var classNames = (value || "").split( rspaces );
for ( var i = 0, l = this.length; i < l; i++ ) {
var elem = this[i];
if ( elem.nodeType === 1 && elem.className ) {
if ( value ) {
var className = (" " + elem.className + " ").replace(rclass, " ");
for ( var c = 0, cl = classNames.length; c < cl; c++ ) {
className = className.replace(" " + classNames[c] + " ", " ");
}
elem.className = jQuery.trim( className );
} else {
elem.className = "";
}
}
}
}
return this;
},
toggleClass: function( value, stateVal ) {
var type = typeof value,
isBool = typeof stateVal === "boolean";
if ( jQuery.isFunction( value ) ) {
return this.each(function(i) {
var self = jQuery(this);
self.toggleClass( value.call(this, i, self.attr("class"), stateVal), stateVal );
});
}
return this.each(function() {
if ( type === "string" ) {
// toggle individual class names
var className,
i = 0,
self = jQuery( this ),
state = stateVal,
classNames = value.split( rspaces );
while ( (className = classNames[ i++ ]) ) {
// check each className given, space seperated list
state = isBool ? state : !self.hasClass( className );
self[ state ? "addClass" : "removeClass" ]( className );
}
} else if ( type === "undefined" || type === "boolean" ) {
if ( this.className ) {
// store className if set
jQuery.data( this, "__className__", this.className );
}
// toggle whole className
this.className = this.className || value === false ? "" : jQuery.data( this, "__className__" ) || "";
}
});
},
hasClass: function( selector ) {
var className = " " + selector + " ";
for ( var i = 0, l = this.length; i < l; i++ ) {
if ( (" " + this[i].className + " ").replace(rclass, " ").indexOf( className ) > -1 ) {
return true;
}
}
return false;
},
val: function( value ) {
if ( !arguments.length ) {
var elem = this[0];
if ( elem ) {
if ( jQuery.nodeName( elem, "option" ) ) {
// attributes.value is undefined in Blackberry 4.7 but
// uses .value. See #6932
var val = elem.attributes.value;
return !val || val.specified ? elem.value : elem.text;
}
// We need to handle select boxes special
if ( jQuery.nodeName( elem, "select" ) ) {
var index = elem.selectedIndex,
values = [],
options = elem.options,
one = elem.type === "select-one";
// Nothing was selected
if ( index < 0 ) {
return null;
}
// Loop through all the selected options
for ( var i = one ? index : 0, max = one ? index + 1 : options.length; i < max; i++ ) {
var option = options[ i ];
// Don't return options that are disabled or in a disabled optgroup
if ( option.selected && (jQuery.support.optDisabled ? !option.disabled : option.getAttribute("disabled") === null) &&
(!option.parentNode.disabled || !jQuery.nodeName( option.parentNode, "optgroup" )) ) {
// Get the specific value for the option
value = jQuery(option).val();
// We don't need an array for one selects
if ( one ) {
return value;
}
// Multi-Selects return an array
values.push( value );
}
}
return values;
}
// Handle the case where in Webkit "" is returned instead of "on" if a value isn't specified
if ( rradiocheck.test( elem.type ) && !jQuery.support.checkOn ) {
return elem.getAttribute("value") === null ? "on" : elem.value;
}
// Everything else, we just grab the value
return (elem.value || "").replace(rreturn, "");
}
return undefined;
}
var isFunction = jQuery.isFunction(value);
return this.each(function(i) {
var self = jQuery(this), val = value;
if ( this.nodeType !== 1 ) {
return;
}
if ( isFunction ) {
val = value.call(this, i, self.val());
}
// Treat null/undefined as ""; convert numbers to string
if ( val == null ) {
val = "";
} else if ( typeof val === "number" ) {
val += "";
} else if ( jQuery.isArray(val) ) {
val = jQuery.map(val, function (value) {
return value == null ? "" : value + "";
});
}
if ( jQuery.isArray(val) && rradiocheck.test( this.type ) ) {
this.checked = jQuery.inArray( self.val(), val ) >= 0;
} else if ( jQuery.nodeName( this, "select" ) ) {
var values = jQuery.makeArray(val);
jQuery( "option", this ).each(function() {
this.selected = jQuery.inArray( jQuery(this).val(), values ) >= 0;
});
if ( !values.length ) {
this.selectedIndex = -1;
}
} else {
this.value = val;
}
});
}
});
jQuery.extend({
attrFn: {
val: true,
css: true,
html: true,
text: true,
data: true,
width: true,
height: true,
offset: true
},
attr: function( elem, name, value, pass ) {
// don't set attributes on text and comment nodes
if ( !elem || elem.nodeType === 3 || elem.nodeType === 8 ) {
return undefined;
}
if ( pass && name in jQuery.attrFn ) {
return jQuery(elem)[name](value);
}
var notxml = elem.nodeType !== 1 || !jQuery.isXMLDoc( elem ),
// Whether we are setting (or getting)
set = value !== undefined;
// Try to normalize/fix the name
name = notxml && jQuery.props[ name ] || name;
// These attributes require special treatment
var special = rspecialurl.test( name );
// Safari mis-reports the default selected property of an option
// Accessing the parent's selectedIndex property fixes it
if ( name === "selected" && !jQuery.support.optSelected ) {
var parent = elem.parentNode;
if ( parent ) {
parent.selectedIndex;
// Make sure that it also works with optgroups, see #5701
if ( parent.parentNode ) {
parent.parentNode.selectedIndex;
}
}
}
// If applicable, access the attribute via the DOM 0 way
// 'in' checks fail in Blackberry 4.7 #6931
if ( (name in elem || elem[ name ] !== undefined) && notxml && !special ) {
if ( set ) {
// We can't allow the type property to be changed (since it causes problems in IE)
if ( name === "type" && rtype.test( elem.nodeName ) && elem.parentNode ) {
jQuery.error( "type property can't be changed" );
}
if ( value === null ) {
if ( elem.nodeType === 1 ) {
elem.removeAttribute( name );
}
} else {
elem[ name ] = value;
}
}
// browsers index elements by id/name on forms, give priority to attributes.
if ( jQuery.nodeName( elem, "form" ) && elem.getAttributeNode(name) ) {
return elem.getAttributeNode( name ).nodeValue;
}
// elem.tabIndex doesn't always return the correct value when it hasn't been explicitly set
// http://fluidproject.org/blog/2008/01/09/getting-setting-and-removing-tabindex-values-with-javascript/
if ( name === "tabIndex" ) {
var attributeNode = elem.getAttributeNode( "tabIndex" );
return attributeNode && attributeNode.specified ?
attributeNode.value :
rfocusable.test( elem.nodeName ) || rclickable.test( elem.nodeName ) && elem.href ?
0 :
undefined;
}
return elem[ name ];
}
if ( !jQuery.support.style && notxml && name === "style" ) {
if ( set ) {
elem.style.cssText = "" + value;
}
return elem.style.cssText;
}
if ( set ) {
// convert the value to a string (all browsers do this but IE) see #1070
elem.setAttribute( name, "" + value );
}
// Ensure that missing attributes return undefined
// Blackberry 4.7 returns "" from getAttribute #6938
if ( !elem.attributes[ name ] && (elem.hasAttribute && !elem.hasAttribute( name )) ) {
return undefined;
}
var attr = !jQuery.support.hrefNormalized && notxml && special ?
// Some attributes require a special call on IE
elem.getAttribute( name, 2 ) :
elem.getAttribute( name );
// Non-existent attributes return null, we normalize to undefined
return attr === null ? undefined : attr;
}
});
var rnamespaces = /\.(.*)$/,
rformElems = /^(?:textarea|input|select)$/i,
rperiod = /\./g,
rspace = / /g,
rescape = /[^\w\s.|`]/g,
fcleanup = function( nm ) {
return nm.replace(rescape, "\\$&");
},
focusCounts = { focusin: 0, focusout: 0 };
/*
* A number of helper functions used for managing events.
* Many of the ideas behind this code originated from
* Dean Edwards' addEvent library.
*/
jQuery.event = {
// Bind an event to an element
// Original by Dean Edwards
add: function( elem, types, handler, data ) {
if ( elem.nodeType === 3 || elem.nodeType === 8 ) {
return;
}
// For whatever reason, IE has trouble passing the window object
// around, causing it to be cloned in the process
if ( jQuery.isWindow( elem ) && ( elem !== window && !elem.frameElement ) ) {
elem = window;
}
if ( handler === false ) {
handler = returnFalse;
} else if ( !handler ) {
// Fixes bug #7229. Fix recommended by jdalton
return;
}
var handleObjIn, handleObj;
if ( handler.handler ) {
handleObjIn = handler;
handler = handleObjIn.handler;
}
// Make sure that the function being executed has a unique ID
if ( !handler.guid ) {
handler.guid = jQuery.guid++;
}
// Init the element's event structure
var elemData = jQuery.data( elem );
// If no elemData is found then we must be trying to bind to one of the
// banned noData elements
if ( !elemData ) {
return;
}
// Use a key less likely to result in collisions for plain JS objects.
// Fixes bug #7150.
var eventKey = elem.nodeType ? "events" : "__events__",
events = elemData[ eventKey ],
eventHandle = elemData.handle;
if ( typeof events === "function" ) {
// On plain objects events is a fn that holds the the data
// which prevents this data from being JSON serialized
// the function does not need to be called, it just contains the data
eventHandle = events.handle;
events = events.events;
} else if ( !events ) {
if ( !elem.nodeType ) {
// On plain objects, create a fn that acts as the holder
// of the values to avoid JSON serialization of event data
elemData[ eventKey ] = elemData = function(){};
}
elemData.events = events = {};
}
if ( !eventHandle ) {
elemData.handle = eventHandle = function() {
// Handle the second event of a trigger and when
// an event is called after a page has unloaded
return typeof jQuery !== "undefined" && !jQuery.event.triggered ?
jQuery.event.handle.apply( eventHandle.elem, arguments ) :
undefined;
};
}
// Add elem as a property of the handle function
// This is to prevent a memory leak with non-native events in IE.
eventHandle.elem = elem;
// Handle multiple events separated by a space
// jQuery(...).bind("mouseover mouseout", fn);
types = types.split(" ");
var type, i = 0, namespaces;
while ( (type = types[ i++ ]) ) {
handleObj = handleObjIn ?
jQuery.extend({}, handleObjIn) :
{ handler: handler, data: data };
// Namespaced event handlers
if ( type.indexOf(".") > -1 ) {
namespaces = type.split(".");
type = namespaces.shift();
handleObj.namespace = namespaces.slice(0).sort().join(".");
} else {
namespaces = [];
handleObj.namespace = "";
}
handleObj.type = type;
if ( !handleObj.guid ) {
handleObj.guid = handler.guid;
}
// Get the current list of functions bound to this event
var handlers = events[ type ],
special = jQuery.event.special[ type ] || {};
// Init the event handler queue
if ( !handlers ) {
handlers = events[ type ] = [];
// Check for a special event handler
// Only use addEventListener/attachEvent if the special
// events handler returns false
if ( !special.setup || special.setup.call( elem, data, namespaces, eventHandle ) === false ) {
// Bind the global event handler to the element
if ( elem.addEventListener ) {
elem.addEventListener( type, eventHandle, false );
} else if ( elem.attachEvent ) {
elem.attachEvent( "on" + type, eventHandle );
}
}
}
if ( special.add ) {
special.add.call( elem, handleObj );
if ( !handleObj.handler.guid ) {
handleObj.handler.guid = handler.guid;
}
}
// Add the function to the element's handler list
handlers.push( handleObj );
// Keep track of which events have been used, for global triggering
jQuery.event.global[ type ] = true;
}
// Nullify elem to prevent memory leaks in IE
elem = null;
},
global: {},
// Detach an event or set of events from an element
remove: function( elem, types, handler, pos ) {
// don't do events on text and comment nodes
if ( elem.nodeType === 3 || elem.nodeType === 8 ) {
return;
}
if ( handler === false ) {
handler = returnFalse;
}
var ret, type, fn, j, i = 0, all, namespaces, namespace, special, eventType, handleObj, origType,
eventKey = elem.nodeType ? "events" : "__events__",
elemData = jQuery.data( elem ),
events = elemData && elemData[ eventKey ];
if ( !elemData || !events ) {
return;
}
if ( typeof events === "function" ) {
elemData = events;
events = events.events;
}
// types is actually an event object here
if ( types && types.type ) {
handler = types.handler;
types = types.type;
}
// Unbind all events for the element
if ( !types || typeof types === "string" && types.charAt(0) === "." ) {
types = types || "";
for ( type in events ) {
jQuery.event.remove( elem, type + types );
}
return;
}
// Handle multiple events separated by a space
// jQuery(...).unbind("mouseover mouseout", fn);
types = types.split(" ");
while ( (type = types[ i++ ]) ) {
origType = type;
handleObj = null;
all = type.indexOf(".") < 0;
namespaces = [];
if ( !all ) {
// Namespaced event handlers
namespaces = type.split(".");
type = namespaces.shift();
namespace = new RegExp("(^|\\.)" +
jQuery.map( namespaces.slice(0).sort(), fcleanup ).join("\\.(?:.*\\.)?") + "(\\.|$)");
}
eventType = events[ type ];
if ( !eventType ) {
continue;
}
if ( !handler ) {
for ( j = 0; j < eventType.length; j++ ) {
handleObj = eventType[ j ];
if ( all || namespace.test( handleObj.namespace ) ) {
jQuery.event.remove( elem, origType, handleObj.handler, j );
eventType.splice( j--, 1 );
}
}
continue;
}
special = jQuery.event.special[ type ] || {};
for ( j = pos || 0; j < eventType.length; j++ ) {
handleObj = eventType[ j ];
if ( handler.guid === handleObj.guid ) {
// remove the given handler for the given type
if ( all || namespace.test( handleObj.namespace ) ) {
if ( pos == null ) {
eventType.splice( j--, 1 );
}
if ( special.remove ) {
special.remove.call( elem, handleObj );
}
}
if ( pos != null ) {
break;
}
}
}
// remove generic event handler if no more handlers exist
if ( eventType.length === 0 || pos != null && eventType.length === 1 ) {
if ( !special.teardown || special.teardown.call( elem, namespaces ) === false ) {
jQuery.removeEvent( elem, type, elemData.handle );
}
ret = null;
delete events[ type ];
}
}
// Remove the expando if it's no longer used
if ( jQuery.isEmptyObject( events ) ) {
var handle = elemData.handle;
if ( handle ) {
handle.elem = null;
}
delete elemData.events;
delete elemData.handle;
if ( typeof elemData === "function" ) {
jQuery.removeData( elem, eventKey );
} else if ( jQuery.isEmptyObject( elemData ) ) {
jQuery.removeData( elem );
}
}
},
// bubbling is internal
trigger: function( event, data, elem /*, bubbling */ ) {
// Event object or event type
var type = event.type || event,
bubbling = arguments[3];
if ( !bubbling ) {
event = typeof event === "object" ?
// jQuery.Event object
event[ jQuery.expando ] ? event :
// Object literal
jQuery.extend( jQuery.Event(type), event ) :
// Just the event type (string)
jQuery.Event(type);
if ( type.indexOf("!") >= 0 ) {
event.type = type = type.slice(0, -1);
event.exclusive = true;
}
// Handle a global trigger
if ( !elem ) {
// Don't bubble custom events when global (to avoid too much overhead)
event.stopPropagation();
// Only trigger if we've ever bound an event for it
if ( jQuery.event.global[ type ] ) {
jQuery.each( jQuery.cache, function() {
if ( this.events && this.events[type] ) {
jQuery.event.trigger( event, data, this.handle.elem );
}
});
}
}
// Handle triggering a single element
// don't do events on text and comment nodes
if ( !elem || elem.nodeType === 3 || elem.nodeType === 8 ) {
return undefined;
}
// Clean up in case it is reused
event.result = undefined;
event.target = elem;
// Clone the incoming data, if any
data = jQuery.makeArray( data );
data.unshift( event );
}
event.currentTarget = elem;
// Trigger the event, it is assumed that "handle" is a function
var handle = elem.nodeType ?
jQuery.data( elem, "handle" ) :
(jQuery.data( elem, "__events__" ) || {}).handle;
if ( handle ) {
handle.apply( elem, data );
}
var parent = elem.parentNode || elem.ownerDocument;
// Trigger an inline bound script
try {
if ( !(elem && elem.nodeName && jQuery.noData[elem.nodeName.toLowerCase()]) ) {
if ( elem[ "on" + type ] && elem[ "on" + type ].apply( elem, data ) === false ) {
event.result = false;
event.preventDefault();
}
}
// prevent IE from throwing an error for some elements with some event types, see #3533
} catch (inlineError) {}
if ( !event.isPropagationStopped() && parent ) {
jQuery.event.trigger( event, data, parent, true );
} else if ( !event.isDefaultPrevented() ) {
var old,
target = event.target,
targetType = type.replace( rnamespaces, "" ),
isClick = jQuery.nodeName( target, "a" ) && targetType === "click",
special = jQuery.event.special[ targetType ] || {};
if ( (!special._default || special._default.call( elem, event ) === false) &&
!isClick && !(target && target.nodeName && jQuery.noData[target.nodeName.toLowerCase()]) ) {
try {
if ( target[ targetType ] ) {
// Make sure that we don't accidentally re-trigger the onFOO events
old = target[ "on" + targetType ];
if ( old ) {
target[ "on" + targetType ] = null;
}
jQuery.event.triggered = true;
target[ targetType ]();
}
// prevent IE from throwing an error for some elements with some event types, see #3533
} catch (triggerError) {}
if ( old ) {
target[ "on" + targetType ] = old;
}
jQuery.event.triggered = false;
}
}
},
handle: function( event ) {
var all, handlers, namespaces, namespace_re, events,
namespace_sort = [],
args = jQuery.makeArray( arguments );
event = args[0] = jQuery.event.fix( event || window.event );
event.currentTarget = this;
// Namespaced event handlers
all = event.type.indexOf(".") < 0 && !event.exclusive;
if ( !all ) {
namespaces = event.type.split(".");
event.type = namespaces.shift();
namespace_sort = namespaces.slice(0).sort();
namespace_re = new RegExp("(^|\\.)" + namespace_sort.join("\\.(?:.*\\.)?") + "(\\.|$)");
}
event.namespace = event.namespace || namespace_sort.join(".");
events = jQuery.data(this, this.nodeType ? "events" : "__events__");
if ( typeof events === "function" ) {
events = events.events;
}
handlers = (events || {})[ event.type ];
if ( events && handlers ) {
// Clone the handlers to prevent manipulation
handlers = handlers.slice(0);
for ( var j = 0, l = handlers.length; j < l; j++ ) {
var handleObj = handlers[ j ];
// Filter the functions by class
if ( all || namespace_re.test( handleObj.namespace ) ) {
// Pass in a reference to the handler function itself
// So that we can later remove it
event.handler = handleObj.handler;
event.data = handleObj.data;
event.handleObj = handleObj;
var ret = handleObj.handler.apply( this, args );
if ( ret !== undefined ) {
event.result = ret;
if ( ret === false ) {
event.preventDefault();
event.stopPropagation();
}
}
if ( event.isImmediatePropagationStopped() ) {
break;
}
}
}
}
return event.result;
},
props: "altKey attrChange attrName bubbles button cancelable charCode clientX clientY ctrlKey currentTarget data detail eventPhase fromElement handler keyCode layerX layerY metaKey newValue offsetX offsetY pageX pageY prevValue relatedNode relatedTarget screenX screenY shiftKey srcElement target toElement view wheelDelta which".split(" "),
fix: function( event ) {
if ( event[ jQuery.expando ] ) {
return event;
}
// store a copy of the original event object
// and "clone" to set read-only properties
var originalEvent = event;
event = jQuery.Event( originalEvent );
for ( var i = this.props.length, prop; i; ) {
prop = this.props[ --i ];
event[ prop ] = originalEvent[ prop ];
}
// Fix target property, if necessary
if ( !event.target ) {
// Fixes #1925 where srcElement might not be defined either
event.target = event.srcElement || document;
}
// check if target is a textnode (safari)
if ( event.target.nodeType === 3 ) {
event.target = event.target.parentNode;
}
// Add relatedTarget, if necessary
if ( !event.relatedTarget && event.fromElement ) {
event.relatedTarget = event.fromElement === event.target ? event.toElement : event.fromElement;
}
// Calculate pageX/Y if missing and clientX/Y available
if ( event.pageX == null && event.clientX != null ) {
var doc = document.documentElement,
body = document.body;
event.pageX = event.clientX + (doc && doc.scrollLeft || body && body.scrollLeft || 0) - (doc && doc.clientLeft || body && body.clientLeft || 0);
event.pageY = event.clientY + (doc && doc.scrollTop || body && body.scrollTop || 0) - (doc && doc.clientTop || body && body.clientTop || 0);
}
// Add which for key events
if ( event.which == null && (event.charCode != null || event.keyCode != null) ) {
event.which = event.charCode != null ? event.charCode : event.keyCode;
}
// Add metaKey to non-Mac browsers (use ctrl for PC's and Meta for Macs)
if ( !event.metaKey && event.ctrlKey ) {
event.metaKey = event.ctrlKey;
}
// Add which for click: 1 === left; 2 === middle; 3 === right
// Note: button is not normalized, so don't use it
if ( !event.which && event.button !== undefined ) {
event.which = (event.button & 1 ? 1 : ( event.button & 2 ? 3 : ( event.button & 4 ? 2 : 0 ) ));
}
return event;
},
// Deprecated, use jQuery.guid instead
guid: 1E8,
// Deprecated, use jQuery.proxy instead
proxy: jQuery.proxy,
special: {
ready: {
// Make sure the ready event is setup
setup: jQuery.bindReady,
teardown: jQuery.noop
},
live: {
add: function( handleObj ) {
jQuery.event.add( this,
liveConvert( handleObj.origType, handleObj.selector ),
jQuery.extend({}, handleObj, {handler: liveHandler, guid: handleObj.handler.guid}) );
},
remove: function( handleObj ) {
jQuery.event.remove( this, liveConvert( handleObj.origType, handleObj.selector ), handleObj );
}
},
beforeunload: {
setup: function( data, namespaces, eventHandle ) {
// We only want to do this special case on windows
if ( jQuery.isWindow( this ) ) {
this.onbeforeunload = eventHandle;
}
},
teardown: function( namespaces, eventHandle ) {
if ( this.onbeforeunload === eventHandle ) {
this.onbeforeunload = null;
}
}
}
}
};
jQuery.removeEvent = document.removeEventListener ?
function( elem, type, handle ) {
if ( elem.removeEventListener ) {
elem.removeEventListener( type, handle, false );
}
} :
function( elem, type, handle ) {
if ( elem.detachEvent ) {
elem.detachEvent( "on" + type, handle );
}
};
jQuery.Event = function( src ) {
// Allow instantiation without the 'new' keyword
if ( !this.preventDefault ) {
return new jQuery.Event( src );
}
// Event object
if ( src && src.type ) {
this.originalEvent = src;
this.type = src.type;
// Event type
} else {
this.type = src;
}
// timeStamp is buggy for some events on Firefox(#3843)
// So we won't rely on the native value
this.timeStamp = jQuery.now();
// Mark it as fixed
this[ jQuery.expando ] = true;
};
function returnFalse() {
return false;
}
function returnTrue() {
return true;
}
// jQuery.Event is based on DOM3 Events as specified by the ECMAScript Language Binding
// http://www.w3.org/TR/2003/WD-DOM-Level-3-Events-20030331/ecma-script-binding.html
jQuery.Event.prototype = {
preventDefault: function() {
this.isDefaultPrevented = returnTrue;
var e = this.originalEvent;
if ( !e ) {
return;
}
// if preventDefault exists run it on the original event
if ( e.preventDefault ) {
e.preventDefault();
// otherwise set the returnValue property of the original event to false (IE)
} else {
e.returnValue = false;
}
},
stopPropagation: function() {
this.isPropagationStopped = returnTrue;
var e = this.originalEvent;
if ( !e ) {
return;
}
// if stopPropagation exists run it on the original event
if ( e.stopPropagation ) {
e.stopPropagation();
}
// otherwise set the cancelBubble property of the original event to true (IE)
e.cancelBubble = true;
},
stopImmediatePropagation: function() {
this.isImmediatePropagationStopped = returnTrue;
this.stopPropagation();
},
isDefaultPrevented: returnFalse,
isPropagationStopped: returnFalse,
isImmediatePropagationStopped: returnFalse
};
// Checks if an event happened on an element within another element
// Used in jQuery.event.special.mouseenter and mouseleave handlers
var withinElement = function( event ) {
// Check if mouse(over|out) are still within the same parent element
var parent = event.relatedTarget;
// Firefox sometimes assigns relatedTarget a XUL element
// which we cannot access the parentNode property of
try {
// Traverse up the tree
while ( parent && parent !== this ) {
parent = parent.parentNode;
}
if ( parent !== this ) {
// set the correct event type
event.type = event.data;
// handle event if we actually just moused on to a non sub-element
jQuery.event.handle.apply( this, arguments );
}
// assuming we've left the element since we most likely mousedover a xul element
} catch(e) { }
},
// In case of event delegation, we only need to rename the event.type,
// liveHandler will take care of the rest.
delegate = function( event ) {
event.type = event.data;
jQuery.event.handle.apply( this, arguments );
};
// Create mouseenter and mouseleave events
jQuery.each({
mouseenter: "mouseover",
mouseleave: "mouseout"
}, function( orig, fix ) {
jQuery.event.special[ orig ] = {
setup: function( data ) {
jQuery.event.add( this, fix, data && data.selector ? delegate : withinElement, orig );
},
teardown: function( data ) {
jQuery.event.remove( this, fix, data && data.selector ? delegate : withinElement );
}
};
});
// submit delegation
if ( !jQuery.support.submitBubbles ) {
jQuery.event.special.submit = {
setup: function( data, namespaces ) {
if ( this.nodeName.toLowerCase() !== "form" ) {
jQuery.event.add(this, "click.specialSubmit", function( e ) {
var elem = e.target,
type = elem.type;
if ( (type === "submit" || type === "image") && jQuery( elem ).closest("form").length ) {
e.liveFired = undefined;
return trigger( "submit", this, arguments );
}
});
jQuery.event.add(this, "keypress.specialSubmit", function( e ) {
var elem = e.target,
type = elem.type;
if ( (type === "text" || type === "password") && jQuery( elem ).closest("form").length && e.keyCode === 13 ) {
e.liveFired = undefined;
return trigger( "submit", this, arguments );
}
});
} else {
return false;
}
},
teardown: function( namespaces ) {
jQuery.event.remove( this, ".specialSubmit" );
}
};
}
// change delegation, happens here so we have bind.
if ( !jQuery.support.changeBubbles ) {
var changeFilters,
getVal = function( elem ) {
var type = elem.type, val = elem.value;
if ( type === "radio" || type === "checkbox" ) {
val = elem.checked;
} else if ( type === "select-multiple" ) {
val = elem.selectedIndex > -1 ?
jQuery.map( elem.options, function( elem ) {
return elem.selected;
}).join("-") :
"";
} else if ( elem.nodeName.toLowerCase() === "select" ) {
val = elem.selectedIndex;
}
return val;
},
testChange = function testChange( e ) {
var elem = e.target, data, val;
if ( !rformElems.test( elem.nodeName ) || elem.readOnly ) {
return;
}
data = jQuery.data( elem, "_change_data" );
val = getVal(elem);
// the current data will be also retrieved by beforeactivate
if ( e.type !== "focusout" || elem.type !== "radio" ) {
jQuery.data( elem, "_change_data", val );
}
if ( data === undefined || val === data ) {
return;
}
if ( data != null || val ) {
e.type = "change";
e.liveFired = undefined;
return jQuery.event.trigger( e, arguments[1], elem );
}
};
jQuery.event.special.change = {
filters: {
focusout: testChange,
beforedeactivate: testChange,
click: function( e ) {
var elem = e.target, type = elem.type;
if ( type === "radio" || type === "checkbox" || elem.nodeName.toLowerCase() === "select" ) {
return testChange.call( this, e );
}
},
// Change has to be called before submit
// Keydown will be called before keypress, which is used in submit-event delegation
keydown: function( e ) {
var elem = e.target, type = elem.type;
if ( (e.keyCode === 13 && elem.nodeName.toLowerCase() !== "textarea") ||
(e.keyCode === 32 && (type === "checkbox" || type === "radio")) ||
type === "select-multiple" ) {
return testChange.call( this, e );
}
},
// Beforeactivate happens also before the previous element is blurred
// with this event you can't trigger a change event, but you can store
// information
beforeactivate: function( e ) {
var elem = e.target;
jQuery.data( elem, "_change_data", getVal(elem) );
}
},
setup: function( data, namespaces ) {
if ( this.type === "file" ) {
return false;
}
for ( var type in changeFilters ) {
jQuery.event.add( this, type + ".specialChange", changeFilters[type] );
}
return rformElems.test( this.nodeName );
},
teardown: function( namespaces ) {
jQuery.event.remove( this, ".specialChange" );
return rformElems.test( this.nodeName );
}
};
changeFilters = jQuery.event.special.change.filters;
// Handle when the input is .focus()'d
changeFilters.focus = changeFilters.beforeactivate;
}
function trigger( type, elem, args ) {
args[0].type = type;
return jQuery.event.handle.apply( elem, args );
}
// Create "bubbling" focus and blur events
if ( document.addEventListener ) {
jQuery.each({ focus: "focusin", blur: "focusout" }, function( orig, fix ) {
jQuery.event.special[ fix ] = {
setup: function() {
if ( focusCounts[fix]++ === 0 ) {
document.addEventListener( orig, handler, true );
}
},
teardown: function() {
if ( --focusCounts[fix] === 0 ) {
document.removeEventListener( orig, handler, true );
}
}
};
function handler( e ) {
e = jQuery.event.fix( e );
e.type = fix;
return jQuery.event.trigger( e, null, e.target );
}
});
}
jQuery.each(["bind", "one"], function( i, name ) {
jQuery.fn[ name ] = function( type, data, fn ) {
// Handle object literals
if ( typeof type === "object" ) {
for ( var key in type ) {
this[ name ](key, data, type[key], fn);
}
return this;
}
if ( jQuery.isFunction( data ) || data === false ) {
fn = data;
data = undefined;
}
var handler = name === "one" ? jQuery.proxy( fn, function( event ) {
jQuery( this ).unbind( event, handler );
return fn.apply( this, arguments );
}) : fn;
if ( type === "unload" && name !== "one" ) {
this.one( type, data, fn );
} else {
for ( var i = 0, l = this.length; i < l; i++ ) {
jQuery.event.add( this[i], type, handler, data );
}
}
return this;
};
});
jQuery.fn.extend({
unbind: function( type, fn ) {
// Handle object literals
if ( typeof type === "object" && !type.preventDefault ) {
for ( var key in type ) {
this.unbind(key, type[key]);
}
} else {
for ( var i = 0, l = this.length; i < l; i++ ) {
jQuery.event.remove( this[i], type, fn );
}
}
return this;
},
delegate: function( selector, types, data, fn ) {
return this.live( types, data, fn, selector );
},
undelegate: function( selector, types, fn ) {
if ( arguments.length === 0 ) {
return this.unbind( "live" );
} else {
return this.die( types, null, fn, selector );
}
},
trigger: function( type, data ) {
return this.each(function() {
jQuery.event.trigger( type, data, this );
});
},
triggerHandler: function( type, data ) {
if ( this[0] ) {
var event = jQuery.Event( type );
event.preventDefault();
event.stopPropagation();
jQuery.event.trigger( event, data, this[0] );
return event.result;
}
},
toggle: function( fn ) {
// Save reference to arguments for access in closure
var args = arguments,
i = 1;
// link all the functions, so any of them can unbind this click handler
while ( i < args.length ) {
jQuery.proxy( fn, args[ i++ ] );
}
return this.click( jQuery.proxy( fn, function( event ) {
// Figure out which function to execute
var lastToggle = ( jQuery.data( this, "lastToggle" + fn.guid ) || 0 ) % i;
jQuery.data( this, "lastToggle" + fn.guid, lastToggle + 1 );
// Make sure that clicks stop
event.preventDefault();
// and execute the function
return args[ lastToggle ].apply( this, arguments ) || false;
}));
},
hover: function( fnOver, fnOut ) {
return this.mouseenter( fnOver ).mouseleave( fnOut || fnOver );
}
});
var liveMap = {
focus: "focusin",
blur: "focusout",
mouseenter: "mouseover",
mouseleave: "mouseout"
};
jQuery.each(["live", "die"], function( i, name ) {
jQuery.fn[ name ] = function( types, data, fn, origSelector /* Internal Use Only */ ) {
var type, i = 0, match, namespaces, preType,
selector = origSelector || this.selector,
context = origSelector ? this : jQuery( this.context );
if ( typeof types === "object" && !types.preventDefault ) {
for ( var key in types ) {
context[ name ]( key, data, types[key], selector );
}
return this;
}
if ( jQuery.isFunction( data ) ) {
fn = data;
data = undefined;
}
types = (types || "").split(" ");
while ( (type = types[ i++ ]) != null ) {
match = rnamespaces.exec( type );
namespaces = "";
if ( match ) {
namespaces = match[0];
type = type.replace( rnamespaces, "" );
}
if ( type === "hover" ) {
types.push( "mouseenter" + namespaces, "mouseleave" + namespaces );
continue;
}
preType = type;
if ( type === "focus" || type === "blur" ) {
types.push( liveMap[ type ] + namespaces );
type = type + namespaces;
} else {
type = (liveMap[ type ] || type) + namespaces;
}
if ( name === "live" ) {
// bind live handler
for ( var j = 0, l = context.length; j < l; j++ ) {
jQuery.event.add( context[j], "live." + liveConvert( type, selector ),
{ data: data, selector: selector, handler: fn, origType: type, origHandler: fn, preType: preType } );
}
} else {
// unbind live handler
context.unbind( "live." + liveConvert( type, selector ), fn );
}
}
return this;
};
});
function liveHandler( event ) {
var stop, maxLevel, related, match, handleObj, elem, j, i, l, data, close, namespace, ret,
elems = [],
selectors = [],
events = jQuery.data( this, this.nodeType ? "events" : "__events__" );
if ( typeof events === "function" ) {
events = events.events;
}
// Make sure we avoid non-left-click bubbling in Firefox (#3861)
if ( event.liveFired === this || !events || !events.live || event.button && event.type === "click" ) {
return;
}
if ( event.namespace ) {
namespace = new RegExp("(^|\\.)" + event.namespace.split(".").join("\\.(?:.*\\.)?") + "(\\.|$)");
}
event.liveFired = this;
var live = events.live.slice(0);
for ( j = 0; j < live.length; j++ ) {
handleObj = live[j];
if ( handleObj.origType.replace( rnamespaces, "" ) === event.type ) {
selectors.push( handleObj.selector );
} else {
live.splice( j--, 1 );
}
}
match = jQuery( event.target ).closest( selectors, event.currentTarget );
for ( i = 0, l = match.length; i < l; i++ ) {
close = match[i];
for ( j = 0; j < live.length; j++ ) {
handleObj = live[j];
if ( close.selector === handleObj.selector && (!namespace || namespace.test( handleObj.namespace )) ) {
elem = close.elem;
related = null;
// Those two events require additional checking
if ( handleObj.preType === "mouseenter" || handleObj.preType === "mouseleave" ) {
event.type = handleObj.preType;
related = jQuery( event.relatedTarget ).closest( handleObj.selector )[0];
}
if ( !related || related !== elem ) {
elems.push({ elem: elem, handleObj: handleObj, level: close.level });
}
}
}
}
for ( i = 0, l = elems.length; i < l; i++ ) {
match = elems[i];
if ( maxLevel && match.level > maxLevel ) {
break;
}
event.currentTarget = match.elem;
event.data = match.handleObj.data;
event.handleObj = match.handleObj;
ret = match.handleObj.origHandler.apply( match.elem, arguments );
if ( ret === false || event.isPropagationStopped() ) {
maxLevel = match.level;
if ( ret === false ) {
stop = false;
}
if ( event.isImmediatePropagationStopped() ) {
break;
}
}
}
return stop;
}
function liveConvert( type, selector ) {
return (type && type !== "*" ? type + "." : "") + selector.replace(rperiod, "`").replace(rspace, "&");
}
jQuery.each( ("blur focus focusin focusout load resize scroll unload click dblclick " +
"mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave " +
"change select submit keydown keypress keyup error").split(" "), function( i, name ) {
// Handle event binding
jQuery.fn[ name ] = function( data, fn ) {
if ( fn == null ) {
fn = data;
data = null;
}
return arguments.length > 0 ?
this.bind( name, data, fn ) :
this.trigger( name );
};
if ( jQuery.attrFn ) {
jQuery.attrFn[ name ] = true;
}
});
// Prevent memory leaks in IE
// Window isn't included so as not to unbind existing unload events
// More info:
// - http://isaacschlueter.com/2006/10/msie-memory-leaks/
if ( window.attachEvent && !window.addEventListener ) {
jQuery(window).bind("unload", function() {
for ( var id in jQuery.cache ) {
if ( jQuery.cache[ id ].handle ) {
// Try/Catch is to handle iframes being unloaded, see #4280
try {
jQuery.event.remove( jQuery.cache[ id ].handle.elem );
} catch(e) {}
}
}
});
}
/*!
* Sizzle CSS Selector Engine - v1.0
* Copyright 2009, The Dojo Foundation
* Released under the MIT, BSD, and GPL Licenses.
* More information: http://sizzlejs.com/
*/
(function(){
var chunker = /((?:\((?:\([^()]+\)|[^()]+)+\)|\[(?:\[[^\[\]]*\]|['"][^'"]*['"]|[^\[\]'"]+)+\]|\\.|[^ >+~,(\[\\]+)+|[>+~])(\s*,\s*)?((?:.|\r|\n)*)/g,
done = 0,
toString = Object.prototype.toString,
hasDuplicate = false,
baseHasDuplicate = true;
// Here we check if the JavaScript engine is using some sort of
// optimization where it does not always call our comparision
// function. If that is the case, discard the hasDuplicate value.
// Thus far that includes Google Chrome.
[0, 0].sort(function() {
baseHasDuplicate = false;
return 0;
});
var Sizzle = function( selector, context, results, seed ) {
results = results || [];
context = context || document;
var origContext = context;
if ( context.nodeType !== 1 && context.nodeType !== 9 ) {
return [];
}
if ( !selector || typeof selector !== "string" ) {
return results;
}
var m, set, checkSet, extra, ret, cur, pop, i,
prune = true,
contextXML = Sizzle.isXML( context ),
parts = [],
soFar = selector;
// Reset the position of the chunker regexp (start from head)
do {
chunker.exec( "" );
m = chunker.exec( soFar );
if ( m ) {
soFar = m[3];
parts.push( m[1] );
if ( m[2] ) {
extra = m[3];
break;
}
}
} while ( m );
if ( parts.length > 1 && origPOS.exec( selector ) ) {
if ( parts.length === 2 && Expr.relative[ parts[0] ] ) {
set = posProcess( parts[0] + parts[1], context );
} else {
set = Expr.relative[ parts[0] ] ?
[ context ] :
Sizzle( parts.shift(), context );
while ( parts.length ) {
selector = parts.shift();
if ( Expr.relative[ selector ] ) {
selector += parts.shift();
}
set = posProcess( selector, set );
}
}
} else {
// Take a shortcut and set the context if the root selector is an ID
// (but not if it'll be faster if the inner selector is an ID)
if ( !seed && parts.length > 1 && context.nodeType === 9 && !contextXML &&
Expr.match.ID.test(parts[0]) && !Expr.match.ID.test(parts[parts.length - 1]) ) {
ret = Sizzle.find( parts.shift(), context, contextXML );
context = ret.expr ?
Sizzle.filter( ret.expr, ret.set )[0] :
ret.set[0];
}
if ( context ) {
ret = seed ?
{ expr: parts.pop(), set: makeArray(seed) } :
Sizzle.find( parts.pop(), parts.length === 1 && (parts[0] === "~" || parts[0] === "+") && context.parentNode ? context.parentNode : context, contextXML );
set = ret.expr ?
Sizzle.filter( ret.expr, ret.set ) :
ret.set;
if ( parts.length > 0 ) {
checkSet = makeArray( set );
} else {
prune = false;
}
while ( parts.length ) {
cur = parts.pop();
pop = cur;
if ( !Expr.relative[ cur ] ) {
cur = "";
} else {
pop = parts.pop();
}
if ( pop == null ) {
pop = context;
}
Expr.relative[ cur ]( checkSet, pop, contextXML );
}
} else {
checkSet = parts = [];
}
}
if ( !checkSet ) {
checkSet = set;
}
if ( !checkSet ) {
Sizzle.error( cur || selector );
}
if ( toString.call(checkSet) === "[object Array]" ) {
if ( !prune ) {
results.push.apply( results, checkSet );
} else if ( context && context.nodeType === 1 ) {
for ( i = 0; checkSet[i] != null; i++ ) {
if ( checkSet[i] && (checkSet[i] === true || checkSet[i].nodeType === 1 && Sizzle.contains(context, checkSet[i])) ) {
results.push( set[i] );
}
}
} else {
for ( i = 0; checkSet[i] != null; i++ ) {
if ( checkSet[i] && checkSet[i].nodeType === 1 ) {
results.push( set[i] );
}
}
}
} else {
makeArray( checkSet, results );
}
if ( extra ) {
Sizzle( extra, origContext, results, seed );
Sizzle.uniqueSort( results );
}
return results;
};
Sizzle.uniqueSort = function( results ) {
if ( sortOrder ) {
hasDuplicate = baseHasDuplicate;
results.sort( sortOrder );
if ( hasDuplicate ) {
for ( var i = 1; i < results.length; i++ ) {
if ( results[i] === results[ i - 1 ] ) {
results.splice( i--, 1 );
}
}
}
}
return results;
};
Sizzle.matches = function( expr, set ) {
return Sizzle( expr, null, null, set );
};
Sizzle.matchesSelector = function( node, expr ) {
return Sizzle( expr, null, null, [node] ).length > 0;
};
Sizzle.find = function( expr, context, isXML ) {
var set;
if ( !expr ) {
return [];
}
for ( var i = 0, l = Expr.order.length; i < l; i++ ) {
var match,
type = Expr.order[i];
if ( (match = Expr.leftMatch[ type ].exec( expr )) ) {
var left = match[1];
match.splice( 1, 1 );
if ( left.substr( left.length - 1 ) !== "\\" ) {
match[1] = (match[1] || "").replace(/\\/g, "");
set = Expr.find[ type ]( match, context, isXML );
if ( set != null ) {
expr = expr.replace( Expr.match[ type ], "" );
break;
}
}
}
}
if ( !set ) {
set = context.getElementsByTagName( "*" );
}
return { set: set, expr: expr };
};
Sizzle.filter = function( expr, set, inplace, not ) {
var match, anyFound,
old = expr,
result = [],
curLoop = set,
isXMLFilter = set && set[0] && Sizzle.isXML( set[0] );
while ( expr && set.length ) {
for ( var type in Expr.filter ) {
if ( (match = Expr.leftMatch[ type ].exec( expr )) != null && match[2] ) {
var found, item,
filter = Expr.filter[ type ],
left = match[1];
anyFound = false;
match.splice(1,1);
if ( left.substr( left.length - 1 ) === "\\" ) {
continue;
}
if ( curLoop === result ) {
result = [];
}
if ( Expr.preFilter[ type ] ) {
match = Expr.preFilter[ type ]( match, curLoop, inplace, result, not, isXMLFilter );
if ( !match ) {
anyFound = found = true;
} else if ( match === true ) {
continue;
}
}
if ( match ) {
for ( var i = 0; (item = curLoop[i]) != null; i++ ) {
if ( item ) {
found = filter( item, match, i, curLoop );
var pass = not ^ !!found;
if ( inplace && found != null ) {
if ( pass ) {
anyFound = true;
} else {
curLoop[i] = false;
}
} else if ( pass ) {
result.push( item );
anyFound = true;
}
}
}
}
if ( found !== undefined ) {
if ( !inplace ) {
curLoop = result;
}
expr = expr.replace( Expr.match[ type ], "" );
if ( !anyFound ) {
return [];
}
break;
}
}
}
// Improper expression
if ( expr === old ) {
if ( anyFound == null ) {
Sizzle.error( expr );
} else {
break;
}
}
old = expr;
}
return curLoop;
};
Sizzle.error = function( msg ) {
throw "Syntax error, unrecognized expression: " + msg;
};
var Expr = Sizzle.selectors = {
order: [ "ID", "NAME", "TAG" ],
match: {
ID: /#((?:[\w\u00c0-\uFFFF\-]|\\.)+)/,
CLASS: /\.((?:[\w\u00c0-\uFFFF\-]|\\.)+)/,
NAME: /\[name=['"]*((?:[\w\u00c0-\uFFFF\-]|\\.)+)['"]*\]/,
ATTR: /\[\s*((?:[\w\u00c0-\uFFFF\-]|\\.)+)\s*(?:(\S?=)\s*(['"]*)(.*?)\3|)\s*\]/,
TAG: /^((?:[\w\u00c0-\uFFFF\*\-]|\\.)+)/,
CHILD: /:(only|nth|last|first)-child(?:\((even|odd|[\dn+\-]*)\))?/,
POS: /:(nth|eq|gt|lt|first|last|even|odd)(?:\((\d*)\))?(?=[^\-]|$)/,
PSEUDO: /:((?:[\w\u00c0-\uFFFF\-]|\\.)+)(?:\((['"]?)((?:\([^\)]+\)|[^\(\)]*)+)\2\))?/
},
leftMatch: {},
attrMap: {
"class": "className",
"for": "htmlFor"
},
attrHandle: {
href: function( elem ) {
return elem.getAttribute( "href" );
}
},
relative: {
"+": function(checkSet, part){
var isPartStr = typeof part === "string",
isTag = isPartStr && !/\W/.test( part ),
isPartStrNotTag = isPartStr && !isTag;
if ( isTag ) {
part = part.toLowerCase();
}
for ( var i = 0, l = checkSet.length, elem; i < l; i++ ) {
if ( (elem = checkSet[i]) ) {
while ( (elem = elem.previousSibling) && elem.nodeType !== 1 ) {}
checkSet[i] = isPartStrNotTag || elem && elem.nodeName.toLowerCase() === part ?
elem || false :
elem === part;
}
}
if ( isPartStrNotTag ) {
Sizzle.filter( part, checkSet, true );
}
},
">": function( checkSet, part ) {
var elem,
isPartStr = typeof part === "string",
i = 0,
l = checkSet.length;
if ( isPartStr && !/\W/.test( part ) ) {
part = part.toLowerCase();
for ( ; i < l; i++ ) {
elem = checkSet[i];
if ( elem ) {
var parent = elem.parentNode;
checkSet[i] = parent.nodeName.toLowerCase() === part ? parent : false;
}
}
} else {
for ( ; i < l; i++ ) {
elem = checkSet[i];
if ( elem ) {
checkSet[i] = isPartStr ?
elem.parentNode :
elem.parentNode === part;
}
}
if ( isPartStr ) {
Sizzle.filter( part, checkSet, true );
}
}
},
"": function(checkSet, part, isXML){
var nodeCheck,
doneName = done++,
checkFn = dirCheck;
if ( typeof part === "string" && !/\W/.test(part) ) {
part = part.toLowerCase();
nodeCheck = part;
checkFn = dirNodeCheck;
}
checkFn( "parentNode", part, doneName, checkSet, nodeCheck, isXML );
},
"~": function( checkSet, part, isXML ) {
var nodeCheck,
doneName = done++,
checkFn = dirCheck;
if ( typeof part === "string" && !/\W/.test( part ) ) {
part = part.toLowerCase();
nodeCheck = part;
checkFn = dirNodeCheck;
}
checkFn( "previousSibling", part, doneName, checkSet, nodeCheck, isXML );
}
},
find: {
ID: function( match, context, isXML ) {
if ( typeof context.getElementById !== "undefined" && !isXML ) {
var m = context.getElementById(match[1]);
// Check parentNode to catch when Blackberry 4.6 returns
// nodes that are no longer in the document #6963
return m && m.parentNode ? [m] : [];
}
},
NAME: function( match, context ) {
if ( typeof context.getElementsByName !== "undefined" ) {
var ret = [],
results = context.getElementsByName( match[1] );
for ( var i = 0, l = results.length; i < l; i++ ) {
if ( results[i].getAttribute("name") === match[1] ) {
ret.push( results[i] );
}
}
return ret.length === 0 ? null : ret;
}
},
TAG: function( match, context ) {
return context.getElementsByTagName( match[1] );
}
},
preFilter: {
CLASS: function( match, curLoop, inplace, result, not, isXML ) {
match = " " + match[1].replace(/\\/g, "") + " ";
if ( isXML ) {
return match;
}
for ( var i = 0, elem; (elem = curLoop[i]) != null; i++ ) {
if ( elem ) {
if ( not ^ (elem.className && (" " + elem.className + " ").replace(/[\t\n]/g, " ").indexOf(match) >= 0) ) {
if ( !inplace ) {
result.push( elem );
}
} else if ( inplace ) {
curLoop[i] = false;
}
}
}
return false;
},
ID: function( match ) {
return match[1].replace(/\\/g, "");
},
TAG: function( match, curLoop ) {
return match[1].toLowerCase();
},
CHILD: function( match ) {
if ( match[1] === "nth" ) {
// parse equations like 'even', 'odd', '5', '2n', '3n+2', '4n-1', '-n+6'
var test = /(-?)(\d*)n((?:\+|-)?\d*)/.exec(
match[2] === "even" && "2n" || match[2] === "odd" && "2n+1" ||
!/\D/.test( match[2] ) && "0n+" + match[2] || match[2]);
// calculate the numbers (first)n+(last) including if they are negative
match[2] = (test[1] + (test[2] || 1)) - 0;
match[3] = test[3] - 0;
}
// TODO: Move to normal caching system
match[0] = done++;
return match;
},
ATTR: function( match, curLoop, inplace, result, not, isXML ) {
var name = match[1].replace(/\\/g, "");
if ( !isXML && Expr.attrMap[name] ) {
match[1] = Expr.attrMap[name];
}
if ( match[2] === "~=" ) {
match[4] = " " + match[4] + " ";
}
return match;
},
PSEUDO: function( match, curLoop, inplace, result, not ) {
if ( match[1] === "not" ) {
// If we're dealing with a complex expression, or a simple one
if ( ( chunker.exec(match[3]) || "" ).length > 1 || /^\w/.test(match[3]) ) {
match[3] = Sizzle(match[3], null, null, curLoop);
} else {
var ret = Sizzle.filter(match[3], curLoop, inplace, true ^ not);
if ( !inplace ) {
result.push.apply( result, ret );
}
return false;
}
} else if ( Expr.match.POS.test( match[0] ) || Expr.match.CHILD.test( match[0] ) ) {
return true;
}
return match;
},
POS: function( match ) {
match.unshift( true );
return match;
}
},
filters: {
enabled: function( elem ) {
return elem.disabled === false && elem.type !== "hidden";
},
disabled: function( elem ) {
return elem.disabled === true;
},
checked: function( elem ) {
return elem.checked === true;
},
selected: function( elem ) {
// Accessing this property makes selected-by-default
// options in Safari work properly
elem.parentNode.selectedIndex;
return elem.selected === true;
},
parent: function( elem ) {
return !!elem.firstChild;
},
empty: function( elem ) {
return !elem.firstChild;
},
has: function( elem, i, match ) {
return !!Sizzle( match[3], elem ).length;
},
header: function( elem ) {
return (/h\d/i).test( elem.nodeName );
},
text: function( elem ) {
return "text" === elem.type;
},
radio: function( elem ) {
return "radio" === elem.type;
},
checkbox: function( elem ) {
return "checkbox" === elem.type;
},
file: function( elem ) {
return "file" === elem.type;
},
password: function( elem ) {
return "password" === elem.type;
},
submit: function( elem ) {
return "submit" === elem.type;
},
image: function( elem ) {
return "image" === elem.type;
},
reset: function( elem ) {
return "reset" === elem.type;
},
button: function( elem ) {
return "button" === elem.type || elem.nodeName.toLowerCase() === "button";
},
input: function( elem ) {
return (/input|select|textarea|button/i).test( elem.nodeName );
}
},
setFilters: {
first: function( elem, i ) {
return i === 0;
},
last: function( elem, i, match, array ) {
return i === array.length - 1;
},
even: function( elem, i ) {
return i % 2 === 0;
},
odd: function( elem, i ) {
return i % 2 === 1;
},
lt: function( elem, i, match ) {
return i < match[3] - 0;
},
gt: function( elem, i, match ) {
return i > match[3] - 0;
},
nth: function( elem, i, match ) {
return match[3] - 0 === i;
},
eq: function( elem, i, match ) {
return match[3] - 0 === i;
}
},
filter: {
PSEUDO: function( elem, match, i, array ) {
var name = match[1],
filter = Expr.filters[ name ];
if ( filter ) {
return filter( elem, i, match, array );
} else if ( name === "contains" ) {
return (elem.textContent || elem.innerText || Sizzle.getText([ elem ]) || "").indexOf(match[3]) >= 0;
} else if ( name === "not" ) {
var not = match[3];
for ( var j = 0, l = not.length; j < l; j++ ) {
if ( not[j] === elem ) {
return false;
}
}
return true;
} else {
Sizzle.error( "Syntax error, unrecognized expression: " + name );
}
},
CHILD: function( elem, match ) {
var type = match[1],
node = elem;
switch ( type ) {
case "only":
case "first":
while ( (node = node.previousSibling) ) {
if ( node.nodeType === 1 ) {
return false;
}
}
if ( type === "first" ) {
return true;
}
node = elem;
case "last":
while ( (node = node.nextSibling) ) {
if ( node.nodeType === 1 ) {
return false;
}
}
return true;
case "nth":
var first = match[2],
last = match[3];
if ( first === 1 && last === 0 ) {
return true;
}
var doneName = match[0],
parent = elem.parentNode;
if ( parent && (parent.sizcache !== doneName || !elem.nodeIndex) ) {
var count = 0;
for ( node = parent.firstChild; node; node = node.nextSibling ) {
if ( node.nodeType === 1 ) {
node.nodeIndex = ++count;
}
}
parent.sizcache = doneName;
}
var diff = elem.nodeIndex - last;
if ( first === 0 ) {
return diff === 0;
} else {
return ( diff % first === 0 && diff / first >= 0 );
}
}
},
ID: function( elem, match ) {
return elem.nodeType === 1 && elem.getAttribute("id") === match;
},
TAG: function( elem, match ) {
return (match === "*" && elem.nodeType === 1) || elem.nodeName.toLowerCase() === match;
},
CLASS: function( elem, match ) {
return (" " + (elem.className || elem.getAttribute("class")) + " ")
.indexOf( match ) > -1;
},
ATTR: function( elem, match ) {
var name = match[1],
result = Expr.attrHandle[ name ] ?
Expr.attrHandle[ name ]( elem ) :
elem[ name ] != null ?
elem[ name ] :
elem.getAttribute( name ),
value = result + "",
type = match[2],
check = match[4];
return result == null ?
type === "!=" :
type === "=" ?
value === check :
type === "*=" ?
value.indexOf(check) >= 0 :
type === "~=" ?
(" " + value + " ").indexOf(check) >= 0 :
!check ?
value && result !== false :
type === "!=" ?
value !== check :
type === "^=" ?
value.indexOf(check) === 0 :
type === "$=" ?
value.substr(value.length - check.length) === check :
type === "|=" ?
value === check || value.substr(0, check.length + 1) === check + "-" :
false;
},
POS: function( elem, match, i, array ) {
var name = match[2],
filter = Expr.setFilters[ name ];
if ( filter ) {
return filter( elem, i, match, array );
}
}
}
};
var origPOS = Expr.match.POS,
fescape = function(all, num){
return "\\" + (num - 0 + 1);
};
for ( var type in Expr.match ) {
Expr.match[ type ] = new RegExp( Expr.match[ type ].source + (/(?![^\[]*\])(?![^\(]*\))/.source) );
Expr.leftMatch[ type ] = new RegExp( /(^(?:.|\r|\n)*?)/.source + Expr.match[ type ].source.replace(/\\(\d+)/g, fescape) );
}
var makeArray = function( array, results ) {
array = Array.prototype.slice.call( array, 0 );
if ( results ) {
results.push.apply( results, array );
return results;
}
return array;
};
// Perform a simple check to determine if the browser is capable of
// converting a NodeList to an array using builtin methods.
// Also verifies that the returned array holds DOM nodes
// (which is not the case in the Blackberry browser)
try {
Array.prototype.slice.call( document.documentElement.childNodes, 0 )[0].nodeType;
// Provide a fallback method if it does not work
} catch( e ) {
makeArray = function( array, results ) {
var i = 0,
ret = results || [];
if ( toString.call(array) === "[object Array]" ) {
Array.prototype.push.apply( ret, array );
} else {
if ( typeof array.length === "number" ) {
for ( var l = array.length; i < l; i++ ) {
ret.push( array[i] );
}
} else {
for ( ; array[i]; i++ ) {
ret.push( array[i] );
}
}
}
return ret;
};
}
var sortOrder, siblingCheck;
if ( document.documentElement.compareDocumentPosition ) {
sortOrder = function( a, b ) {
if ( a === b ) {
hasDuplicate = true;
return 0;
}
if ( !a.compareDocumentPosition || !b.compareDocumentPosition ) {
return a.compareDocumentPosition ? -1 : 1;
}
return a.compareDocumentPosition(b) & 4 ? -1 : 1;
};
} else {
sortOrder = function( a, b ) {
var al, bl,
ap = [],
bp = [],
aup = a.parentNode,
bup = b.parentNode,
cur = aup;
// The nodes are identical, we can exit early
if ( a === b ) {
hasDuplicate = true;
return 0;
// If the nodes are siblings (or identical) we can do a quick check
} else if ( aup === bup ) {
return siblingCheck( a, b );
// If no parents were found then the nodes are disconnected
} else if ( !aup ) {
return -1;
} else if ( !bup ) {
return 1;
}
// Otherwise they're somewhere else in the tree so we need
// to build up a full list of the parentNodes for comparison
while ( cur ) {
ap.unshift( cur );
cur = cur.parentNode;
}
cur = bup;
while ( cur ) {
bp.unshift( cur );
cur = cur.parentNode;
}
al = ap.length;
bl = bp.length;
// Start walking down the tree looking for a discrepancy
for ( var i = 0; i < al && i < bl; i++ ) {
if ( ap[i] !== bp[i] ) {
return siblingCheck( ap[i], bp[i] );
}
}
// We ended someplace up the tree so do a sibling check
return i === al ?
siblingCheck( a, bp[i], -1 ) :
siblingCheck( ap[i], b, 1 );
};
siblingCheck = function( a, b, ret ) {
if ( a === b ) {
return ret;
}
var cur = a.nextSibling;
while ( cur ) {
if ( cur === b ) {
return -1;
}
cur = cur.nextSibling;
}
return 1;
};
}
// Utility function for retreiving the text value of an array of DOM nodes
Sizzle.getText = function( elems ) {
var ret = "", elem;
for ( var i = 0; elems[i]; i++ ) {
elem = elems[i];
// Get the text from text nodes and CDATA nodes
if ( elem.nodeType === 3 || elem.nodeType === 4 ) {
ret += elem.nodeValue;
// Traverse everything else, except comment nodes
} else if ( elem.nodeType !== 8 ) {
ret += Sizzle.getText( elem.childNodes );
}
}
return ret;
};
// Check to see if the browser returns elements by name when
// querying by getElementById (and provide a workaround)
(function(){
// We're going to inject a fake input element with a specified name
var form = document.createElement("div"),
id = "script" + (new Date()).getTime(),
root = document.documentElement;
form.innerHTML = "<a name='" + id + "'/>";
// Inject it into the root element, check its status, and remove it quickly
root.insertBefore( form, root.firstChild );
// The workaround has to do additional checks after a getElementById
// Which slows things down for other browsers (hence the branching)
if ( document.getElementById( id ) ) {
Expr.find.ID = function( match, context, isXML ) {
if ( typeof context.getElementById !== "undefined" && !isXML ) {
var m = context.getElementById(match[1]);
return m ?
m.id === match[1] || typeof m.getAttributeNode !== "undefined" && m.getAttributeNode("id").nodeValue === match[1] ?
[m] :
undefined :
[];
}
};
Expr.filter.ID = function( elem, match ) {
var node = typeof elem.getAttributeNode !== "undefined" && elem.getAttributeNode("id");
return elem.nodeType === 1 && node && node.nodeValue === match;
};
}
root.removeChild( form );
// release memory in IE
root = form = null;
})();
(function(){
// Check to see if the browser returns only elements
// when doing getElementsByTagName("*")
// Create a fake element
var div = document.createElement("div");
div.appendChild( document.createComment("") );
// Make sure no comments are found
if ( div.getElementsByTagName("*").length > 0 ) {
Expr.find.TAG = function( match, context ) {
var results = context.getElementsByTagName( match[1] );
// Filter out possible comments
if ( match[1] === "*" ) {
var tmp = [];
for ( var i = 0; results[i]; i++ ) {
if ( results[i].nodeType === 1 ) {
tmp.push( results[i] );
}
}
results = tmp;
}
return results;
};
}
// Check to see if an attribute returns normalized href attributes
div.innerHTML = "<a href='#'></a>";
if ( div.firstChild && typeof div.firstChild.getAttribute !== "undefined" &&
div.firstChild.getAttribute("href") !== "#" ) {
Expr.attrHandle.href = function( elem ) {
return elem.getAttribute( "href", 2 );
};
}
// release memory in IE
div = null;
})();
if ( document.querySelectorAll ) {
(function(){
var oldSizzle = Sizzle,
div = document.createElement("div"),
id = "__sizzle__";
div.innerHTML = "<p class='TEST'></p>";
// Safari can't handle uppercase or unicode characters when
// in quirks mode.
if ( div.querySelectorAll && div.querySelectorAll(".TEST").length === 0 ) {
return;
}
Sizzle = function( query, context, extra, seed ) {
context = context || document;
// Make sure that attribute selectors are quoted
query = query.replace(/\=\s*([^'"\]]*)\s*\]/g, "='$1']");
// Only use querySelectorAll on non-XML documents
// (ID selectors don't work in non-HTML documents)
if ( !seed && !Sizzle.isXML(context) ) {
if ( context.nodeType === 9 ) {
try {
return makeArray( context.querySelectorAll(query), extra );
} catch(qsaError) {}
// qSA works strangely on Element-rooted queries
// We can work around this by specifying an extra ID on the root
// and working up from there (Thanks to Andrew Dupont for the technique)
// IE 8 doesn't work on object elements
} else if ( context.nodeType === 1 && context.nodeName.toLowerCase() !== "object" ) {
var old = context.getAttribute( "id" ),
nid = old || id;
if ( !old ) {
context.setAttribute( "id", nid );
}
try {
return makeArray( context.querySelectorAll( "#" + nid + " " + query ), extra );
} catch(pseudoError) {
} finally {
if ( !old ) {
context.removeAttribute( "id" );
}
}
}
}
return oldSizzle(query, context, extra, seed);
};
for ( var prop in oldSizzle ) {
Sizzle[ prop ] = oldSizzle[ prop ];
}
// release memory in IE
div = null;
})();
}
(function(){
var html = document.documentElement,
matches = html.matchesSelector || html.mozMatchesSelector || html.webkitMatchesSelector || html.msMatchesSelector,
pseudoWorks = false;
try {
// This should fail with an exception
// Gecko does not error, returns false instead
matches.call( document.documentElement, "[test!='']:sizzle" );
} catch( pseudoError ) {
pseudoWorks = true;
}
if ( matches ) {
Sizzle.matchesSelector = function( node, expr ) {
// Make sure that attribute selectors are quoted
expr = expr.replace(/\=\s*([^'"\]]*)\s*\]/g, "='$1']");
if ( !Sizzle.isXML( node ) ) {
try {
if ( pseudoWorks || !Expr.match.PSEUDO.test( expr ) && !/!=/.test( expr ) ) {
return matches.call( node, expr );
}
} catch(e) {}
}
return Sizzle(expr, null, null, [node]).length > 0;
};
}
})();
(function(){
var div = document.createElement("div");
div.innerHTML = "<div class='test e'></div><div class='test'></div>";
// Opera can't find a second classname (in 9.6)
// Also, make sure that getElementsByClassName actually exists
if ( !div.getElementsByClassName || div.getElementsByClassName("e").length === 0 ) {
return;
}
// Safari caches class attributes, doesn't catch changes (in 3.2)
div.lastChild.className = "e";
if ( div.getElementsByClassName("e").length === 1 ) {
return;
}
Expr.order.splice(1, 0, "CLASS");
Expr.find.CLASS = function( match, context, isXML ) {
if ( typeof context.getElementsByClassName !== "undefined" && !isXML ) {
return context.getElementsByClassName(match[1]);
}
};
// release memory in IE
div = null;
})();
function dirNodeCheck( dir, cur, doneName, checkSet, nodeCheck, isXML ) {
for ( var i = 0, l = checkSet.length; i < l; i++ ) {
var elem = checkSet[i];
if ( elem ) {
var match = false;
elem = elem[dir];
while ( elem ) {
if ( elem.sizcache === doneName ) {
match = checkSet[elem.sizset];
break;
}
if ( elem.nodeType === 1 && !isXML ){
elem.sizcache = doneName;
elem.sizset = i;
}
if ( elem.nodeName.toLowerCase() === cur ) {
match = elem;
break;
}
elem = elem[dir];
}
checkSet[i] = match;
}
}
}
function dirCheck( dir, cur, doneName, checkSet, nodeCheck, isXML ) {
for ( var i = 0, l = checkSet.length; i < l; i++ ) {
var elem = checkSet[i];
if ( elem ) {
var match = false;
elem = elem[dir];
while ( elem ) {
if ( elem.sizcache === doneName ) {
match = checkSet[elem.sizset];
break;
}
if ( elem.nodeType === 1 ) {
if ( !isXML ) {
elem.sizcache = doneName;
elem.sizset = i;
}
if ( typeof cur !== "string" ) {
if ( elem === cur ) {
match = true;
break;
}
} else if ( Sizzle.filter( cur, [elem] ).length > 0 ) {
match = elem;
break;
}
}
elem = elem[dir];
}
checkSet[i] = match;
}
}
}
if ( document.documentElement.contains ) {
Sizzle.contains = function( a, b ) {
return a !== b && (a.contains ? a.contains(b) : true);
};
} else if ( document.documentElement.compareDocumentPosition ) {
Sizzle.contains = function( a, b ) {
return !!(a.compareDocumentPosition(b) & 16);
};
} else {
Sizzle.contains = function() {
return false;
};
}
Sizzle.isXML = function( elem ) {
// documentElement is verified for cases where it doesn't yet exist
// (such as loading iframes in IE - #4833)
var documentElement = (elem ? elem.ownerDocument || elem : 0).documentElement;
return documentElement ? documentElement.nodeName !== "HTML" : false;
};
var posProcess = function( selector, context ) {
var match,
tmpSet = [],
later = "",
root = context.nodeType ? [context] : context;
// Position selectors must be done after the filter
// And so must :not(positional) so we move all PSEUDOs to the end
while ( (match = Expr.match.PSEUDO.exec( selector )) ) {
later += match[0];
selector = selector.replace( Expr.match.PSEUDO, "" );
}
selector = Expr.relative[selector] ? selector + "*" : selector;
for ( var i = 0, l = root.length; i < l; i++ ) {
Sizzle( selector, root[i], tmpSet );
}
return Sizzle.filter( later, tmpSet );
};
// EXPOSE
jQuery.find = Sizzle;
jQuery.expr = Sizzle.selectors;
jQuery.expr[":"] = jQuery.expr.filters;
jQuery.unique = Sizzle.uniqueSort;
jQuery.text = Sizzle.getText;
jQuery.isXMLDoc = Sizzle.isXML;
jQuery.contains = Sizzle.contains;
})();
var runtil = /Until$/,
rparentsprev = /^(?:parents|prevUntil|prevAll)/,
// Note: This RegExp should be improved, or likely pulled from Sizzle
rmultiselector = /,/,
isSimple = /^.[^:#\[\.,]*$/,
slice = Array.prototype.slice,
POS = jQuery.expr.match.POS;
jQuery.fn.extend({
find: function( selector ) {
var ret = this.pushStack( "", "find", selector ),
length = 0;
for ( var i = 0, l = this.length; i < l; i++ ) {
length = ret.length;
jQuery.find( selector, this[i], ret );
if ( i > 0 ) {
// Make sure that the results are unique
for ( var n = length; n < ret.length; n++ ) {
for ( var r = 0; r < length; r++ ) {
if ( ret[r] === ret[n] ) {
ret.splice(n--, 1);
break;
}
}
}
}
}
return ret;
},
has: function( target ) {
var targets = jQuery( target );
return this.filter(function() {
for ( var i = 0, l = targets.length; i < l; i++ ) {
if ( jQuery.contains( this, targets[i] ) ) {
return true;
}
}
});
},
not: function( selector ) {
return this.pushStack( winnow(this, selector, false), "not", selector);
},
filter: function( selector ) {
return this.pushStack( winnow(this, selector, true), "filter", selector );
},
is: function( selector ) {
return !!selector && jQuery.filter( selector, this ).length > 0;
},
closest: function( selectors, context ) {
var ret = [], i, l, cur = this[0];
if ( jQuery.isArray( selectors ) ) {
var match, selector,
matches = {},
level = 1;
if ( cur && selectors.length ) {
for ( i = 0, l = selectors.length; i < l; i++ ) {
selector = selectors[i];
if ( !matches[selector] ) {
matches[selector] = jQuery.expr.match.POS.test( selector ) ?
jQuery( selector, context || this.context ) :
selector;
}
}
while ( cur && cur.ownerDocument && cur !== context ) {
for ( selector in matches ) {
match = matches[selector];
if ( match.jquery ? match.index(cur) > -1 : jQuery(cur).is(match) ) {
ret.push({ selector: selector, elem: cur, level: level });
}
}
cur = cur.parentNode;
level++;
}
}
return ret;
}
var pos = POS.test( selectors ) ?
jQuery( selectors, context || this.context ) : null;
for ( i = 0, l = this.length; i < l; i++ ) {
cur = this[i];
while ( cur ) {
if ( pos ? pos.index(cur) > -1 : jQuery.find.matchesSelector(cur, selectors) ) {
ret.push( cur );
break;
} else {
cur = cur.parentNode;
if ( !cur || !cur.ownerDocument || cur === context ) {
break;
}
}
}
}
ret = ret.length > 1 ? jQuery.unique(ret) : ret;
return this.pushStack( ret, "closest", selectors );
},
// Determine the position of an element within
// the matched set of elements
index: function( elem ) {
if ( !elem || typeof elem === "string" ) {
return jQuery.inArray( this[0],
// If it receives a string, the selector is used
// If it receives nothing, the siblings are used
elem ? jQuery( elem ) : this.parent().children() );
}
// Locate the position of the desired element
return jQuery.inArray(
// If it receives a jQuery object, the first element is used
elem.jquery ? elem[0] : elem, this );
},
add: function( selector, context ) {
var set = typeof selector === "string" ?
jQuery( selector, context || this.context ) :
jQuery.makeArray( selector ),
all = jQuery.merge( this.get(), set );
return this.pushStack( isDisconnected( set[0] ) || isDisconnected( all[0] ) ?
all :
jQuery.unique( all ) );
},
andSelf: function() {
return this.add( this.prevObject );
}
});
// A painfully simple check to see if an element is disconnected
// from a document (should be improved, where feasible).
function isDisconnected( node ) {
return !node || !node.parentNode || node.parentNode.nodeType === 11;
}
jQuery.each({
parent: function( elem ) {
var parent = elem.parentNode;
return parent && parent.nodeType !== 11 ? parent : null;
},
parents: function( elem ) {
return jQuery.dir( elem, "parentNode" );
},
parentsUntil: function( elem, i, until ) {
return jQuery.dir( elem, "parentNode", until );
},
next: function( elem ) {
return jQuery.nth( elem, 2, "nextSibling" );
},
prev: function( elem ) {
return jQuery.nth( elem, 2, "previousSibling" );
},
nextAll: function( elem ) {
return jQuery.dir( elem, "nextSibling" );
},
prevAll: function( elem ) {
return jQuery.dir( elem, "previousSibling" );
},
nextUntil: function( elem, i, until ) {
return jQuery.dir( elem, "nextSibling", until );
},
prevUntil: function( elem, i, until ) {
return jQuery.dir( elem, "previousSibling", until );
},
siblings: function( elem ) {
return jQuery.sibling( elem.parentNode.firstChild, elem );
},
children: function( elem ) {
return jQuery.sibling( elem.firstChild );
},
contents: function( elem ) {
return jQuery.nodeName( elem, "iframe" ) ?
elem.contentDocument || elem.contentWindow.document :
jQuery.makeArray( elem.childNodes );
}
}, function( name, fn ) {
jQuery.fn[ name ] = function( until, selector ) {
var ret = jQuery.map( this, fn, until );
if ( !runtil.test( name ) ) {
selector = until;
}
if ( selector && typeof selector === "string" ) {
ret = jQuery.filter( selector, ret );
}
ret = this.length > 1 ? jQuery.unique( ret ) : ret;
if ( (this.length > 1 || rmultiselector.test( selector )) && rparentsprev.test( name ) ) {
ret = ret.reverse();
}
return this.pushStack( ret, name, slice.call(arguments).join(",") );
};
});
jQuery.extend({
filter: function( expr, elems, not ) {
if ( not ) {
expr = ":not(" + expr + ")";
}
return elems.length === 1 ?
jQuery.find.matchesSelector(elems[0], expr) ? [ elems[0] ] : [] :
jQuery.find.matches(expr, elems);
},
dir: function( elem, dir, until ) {
var matched = [],
cur = elem[ dir ];
while ( cur && cur.nodeType !== 9 && (until === undefined || cur.nodeType !== 1 || !jQuery( cur ).is( until )) ) {
if ( cur.nodeType === 1 ) {
matched.push( cur );
}
cur = cur[dir];
}
return matched;
},
nth: function( cur, result, dir, elem ) {
result = result || 1;
var num = 0;
for ( ; cur; cur = cur[dir] ) {
if ( cur.nodeType === 1 && ++num === result ) {
break;
}
}
return cur;
},
sibling: function( n, elem ) {
var r = [];
for ( ; n; n = n.nextSibling ) {
if ( n.nodeType === 1 && n !== elem ) {
r.push( n );
}
}
return r;
}
});
// Implement the identical functionality for filter and not
function winnow( elements, qualifier, keep ) {
if ( jQuery.isFunction( qualifier ) ) {
return jQuery.grep(elements, function( elem, i ) {
var retVal = !!qualifier.call( elem, i, elem );
return retVal === keep;
});
} else if ( qualifier.nodeType ) {
return jQuery.grep(elements, function( elem, i ) {
return (elem === qualifier) === keep;
});
} else if ( typeof qualifier === "string" ) {
var filtered = jQuery.grep(elements, function( elem ) {
return elem.nodeType === 1;
});
if ( isSimple.test( qualifier ) ) {
return jQuery.filter(qualifier, filtered, !keep);
} else {
qualifier = jQuery.filter( qualifier, filtered );
}
}
return jQuery.grep(elements, function( elem, i ) {
return (jQuery.inArray( elem, qualifier ) >= 0) === keep;
});
}
var rinlinejQuery = / jQuery\d+="(?:\d+|null)"/g,
rleadingWhitespace = /^\s+/,
rxhtmlTag = /<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/ig,
rtagName = /<([\w:]+)/,
rtbody = /<tbody/i,
rhtml = /<|&#?\w+;/,
rnocache = /<(?:script|object|embed|option|style)/i,
// checked="checked" or checked (html5)
rchecked = /checked\s*(?:[^=]|=\s*.checked.)/i,
raction = /\=([^="'>\s]+\/)>/g,
wrapMap = {
option: [ 1, "<select multiple='multiple'>", "</select>" ],
legend: [ 1, "<fieldset>", "</fieldset>" ],
thead: [ 1, "<table>", "</table>" ],
tr: [ 2, "<table><tbody>", "</tbody></table>" ],
td: [ 3, "<table><tbody><tr>", "</tr></tbody></table>" ],
col: [ 2, "<table><tbody></tbody><colgroup>", "</colgroup></table>" ],
area: [ 1, "<map>", "</map>" ],
_default: [ 0, "", "" ]
};
wrapMap.optgroup = wrapMap.option;
wrapMap.tbody = wrapMap.tfoot = wrapMap.colgroup = wrapMap.caption = wrapMap.thead;
wrapMap.th = wrapMap.td;
// IE can't serialize <link> and <script> tags normally
if ( !jQuery.support.htmlSerialize ) {
wrapMap._default = [ 1, "div<div>", "</div>" ];
}
jQuery.fn.extend({
text: function( text ) {
if ( jQuery.isFunction(text) ) {
return this.each(function(i) {
var self = jQuery( this );
self.text( text.call(this, i, self.text()) );
});
}
if ( typeof text !== "object" && text !== undefined ) {
return this.empty().append( (this[0] && this[0].ownerDocument || document).createTextNode( text ) );
}
return jQuery.text( this );
},
wrapAll: function( html ) {
if ( jQuery.isFunction( html ) ) {
return this.each(function(i) {
jQuery(this).wrapAll( html.call(this, i) );
});
}
if ( this[0] ) {
// The elements to wrap the target around
var wrap = jQuery( html, this[0].ownerDocument ).eq(0).clone(true);
if ( this[0].parentNode ) {
wrap.insertBefore( this[0] );
}
wrap.map(function() {
var elem = this;
while ( elem.firstChild && elem.firstChild.nodeType === 1 ) {
elem = elem.firstChild;
}
return elem;
}).append(this);
}
return this;
},
wrapInner: function( html ) {
if ( jQuery.isFunction( html ) ) {
return this.each(function(i) {
jQuery(this).wrapInner( html.call(this, i) );
});
}
return this.each(function() {
var self = jQuery( this ),
contents = self.contents();
if ( contents.length ) {
contents.wrapAll( html );
} else {
self.append( html );
}
});
},
wrap: function( html ) {
return this.each(function() {
jQuery( this ).wrapAll( html );
});
},
unwrap: function() {
return this.parent().each(function() {
if ( !jQuery.nodeName( this, "body" ) ) {
jQuery( this ).replaceWith( this.childNodes );
}
}).end();
},
append: function() {
return this.domManip(arguments, true, function( elem ) {
if ( this.nodeType === 1 ) {
this.appendChild( elem );
}
});
},
prepend: function() {
return this.domManip(arguments, true, function( elem ) {
if ( this.nodeType === 1 ) {
this.insertBefore( elem, this.firstChild );
}
});
},
before: function() {
if ( this[0] && this[0].parentNode ) {
return this.domManip(arguments, false, function( elem ) {
this.parentNode.insertBefore( elem, this );
});
} else if ( arguments.length ) {
var set = jQuery(arguments[0]);
set.push.apply( set, this.toArray() );
return this.pushStack( set, "before", arguments );
}
},
after: function() {
if ( this[0] && this[0].parentNode ) {
return this.domManip(arguments, false, function( elem ) {
this.parentNode.insertBefore( elem, this.nextSibling );
});
} else if ( arguments.length ) {
var set = this.pushStack( this, "after", arguments );
set.push.apply( set, jQuery(arguments[0]).toArray() );
return set;
}
},
// keepData is for internal use only--do not document
remove: function( selector, keepData ) {
for ( var i = 0, elem; (elem = this[i]) != null; i++ ) {
if ( !selector || jQuery.filter( selector, [ elem ] ).length ) {
if ( !keepData && elem.nodeType === 1 ) {
jQuery.cleanData( elem.getElementsByTagName("*") );
jQuery.cleanData( [ elem ] );
}
if ( elem.parentNode ) {
elem.parentNode.removeChild( elem );
}
}
}
return this;
},
empty: function() {
for ( var i = 0, elem; (elem = this[i]) != null; i++ ) {
// Remove element nodes and prevent memory leaks
if ( elem.nodeType === 1 ) {
jQuery.cleanData( elem.getElementsByTagName("*") );
}
// Remove any remaining nodes
while ( elem.firstChild ) {
elem.removeChild( elem.firstChild );
}
}
return this;
},
clone: function( events ) {
// Do the clone
var ret = this.map(function() {
if ( !jQuery.support.noCloneEvent && !jQuery.isXMLDoc(this) ) {
// IE copies events bound via attachEvent when
// using cloneNode. Calling detachEvent on the
// clone will also remove the events from the orignal
// In order to get around this, we use innerHTML.
// Unfortunately, this means some modifications to
// attributes in IE that are actually only stored
// as properties will not be copied (such as the
// the name attribute on an input).
var html = this.outerHTML,
ownerDocument = this.ownerDocument;
if ( !html ) {
var div = ownerDocument.createElement("div");
div.appendChild( this.cloneNode(true) );
html = div.innerHTML;
}
return jQuery.clean([html.replace(rinlinejQuery, "")
// Handle the case in IE 8 where action=/test/> self-closes a tag
.replace(raction, '="$1">')
.replace(rleadingWhitespace, "")], ownerDocument)[0];
} else {
return this.cloneNode(true);
}
});
// Copy the events from the original to the clone
if ( events === true ) {
cloneCopyEvent( this, ret );
cloneCopyEvent( this.find("*"), ret.find("*") );
}
// Return the cloned set
return ret;
},
html: function( value ) {
if ( value === undefined ) {
return this[0] && this[0].nodeType === 1 ?
this[0].innerHTML.replace(rinlinejQuery, "") :
null;
// See if we can take a shortcut and just use innerHTML
} else if ( typeof value === "string" && !rnocache.test( value ) &&
(jQuery.support.leadingWhitespace || !rleadingWhitespace.test( value )) &&
!wrapMap[ (rtagName.exec( value ) || ["", ""])[1].toLowerCase() ] ) {
value = value.replace(rxhtmlTag, "<$1></$2>");
try {
for ( var i = 0, l = this.length; i < l; i++ ) {
// Remove element nodes and prevent memory leaks
if ( this[i].nodeType === 1 ) {
jQuery.cleanData( this[i].getElementsByTagName("*") );
this[i].innerHTML = value;
}
}
// If using innerHTML throws an exception, use the fallback method
} catch(e) {
this.empty().append( value );
}
} else if ( jQuery.isFunction( value ) ) {
this.each(function(i){
var self = jQuery( this );
self.html( value.call(this, i, self.html()) );
});
} else {
this.empty().append( value );
}
return this;
},
replaceWith: function( value ) {
if ( this[0] && this[0].parentNode ) {
// Make sure that the elements are removed from the DOM before they are inserted
// this can help fix replacing a parent with child elements
if ( jQuery.isFunction( value ) ) {
return this.each(function(i) {
var self = jQuery(this), old = self.html();
self.replaceWith( value.call( this, i, old ) );
});
}
if ( typeof value !== "string" ) {
value = jQuery( value ).detach();
}
return this.each(function() {
var next = this.nextSibling,
parent = this.parentNode;
jQuery( this ).remove();
if ( next ) {
jQuery(next).before( value );
} else {
jQuery(parent).append( value );
}
});
} else {
return this.pushStack( jQuery(jQuery.isFunction(value) ? value() : value), "replaceWith", value );
}
},
detach: function( selector ) {
return this.remove( selector, true );
},
domManip: function( args, table, callback ) {
var results, first, fragment, parent,
value = args[0],
scripts = [];
// We can't cloneNode fragments that contain checked, in WebKit
if ( !jQuery.support.checkClone && arguments.length === 3 && typeof value === "string" && rchecked.test( value ) ) {
return this.each(function() {
jQuery(this).domManip( args, table, callback, true );
});
}
if ( jQuery.isFunction(value) ) {
return this.each(function(i) {
var self = jQuery(this);
args[0] = value.call(this, i, table ? self.html() : undefined);
self.domManip( args, table, callback );
});
}
if ( this[0] ) {
parent = value && value.parentNode;
// If we're in a fragment, just use that instead of building a new one
if ( jQuery.support.parentNode && parent && parent.nodeType === 11 && parent.childNodes.length === this.length ) {
results = { fragment: parent };
} else {
results = jQuery.buildFragment( args, this, scripts );
}
fragment = results.fragment;
if ( fragment.childNodes.length === 1 ) {
first = fragment = fragment.firstChild;
} else {
first = fragment.firstChild;
}
if ( first ) {
table = table && jQuery.nodeName( first, "tr" );
for ( var i = 0, l = this.length; i < l; i++ ) {
callback.call(
table ?
root(this[i], first) :
this[i],
i > 0 || results.cacheable || this.length > 1 ?
fragment.cloneNode(true) :
fragment
);
}
}
if ( scripts.length ) {
jQuery.each( scripts, evalScript );
}
}
return this;
}
});
function root( elem, cur ) {
return jQuery.nodeName(elem, "table") ?
(elem.getElementsByTagName("tbody")[0] ||
elem.appendChild(elem.ownerDocument.createElement("tbody"))) :
elem;
}
function cloneCopyEvent(orig, ret) {
var i = 0;
ret.each(function() {
if ( this.nodeName !== (orig[i] && orig[i].nodeName) ) {
return;
}
var oldData = jQuery.data( orig[i++] ),
curData = jQuery.data( this, oldData ),
events = oldData && oldData.events;
if ( events ) {
delete curData.handle;
curData.events = {};
for ( var type in events ) {
for ( var handler in events[ type ] ) {
jQuery.event.add( this, type, events[ type ][ handler ], events[ type ][ handler ].data );
}
}
}
});
}
jQuery.buildFragment = function( args, nodes, scripts ) {
var fragment, cacheable, cacheresults,
doc = (nodes && nodes[0] ? nodes[0].ownerDocument || nodes[0] : document);
// Only cache "small" (1/2 KB) strings that are associated with the main document
// Cloning options loses the selected state, so don't cache them
// IE 6 doesn't like it when you put <object> or <embed> elements in a fragment
// Also, WebKit does not clone 'checked' attributes on cloneNode, so don't cache
if ( args.length === 1 && typeof args[0] === "string" && args[0].length < 512 && doc === document &&
!rnocache.test( args[0] ) && (jQuery.support.checkClone || !rchecked.test( args[0] )) ) {
cacheable = true;
cacheresults = jQuery.fragments[ args[0] ];
if ( cacheresults ) {
if ( cacheresults !== 1 ) {
fragment = cacheresults;
}
}
}
if ( !fragment ) {
fragment = doc.createDocumentFragment();
jQuery.clean( args, doc, fragment, scripts );
}
if ( cacheable ) {
jQuery.fragments[ args[0] ] = cacheresults ? fragment : 1;
}
return { fragment: fragment, cacheable: cacheable };
};
jQuery.fragments = {};
jQuery.each({
appendTo: "append",
prependTo: "prepend",
insertBefore: "before",
insertAfter: "after",
replaceAll: "replaceWith"
}, function( name, original ) {
jQuery.fn[ name ] = function( selector ) {
var ret = [],
insert = jQuery( selector ),
parent = this.length === 1 && this[0].parentNode;
if ( parent && parent.nodeType === 11 && parent.childNodes.length === 1 && insert.length === 1 ) {
insert[ original ]( this[0] );
return this;
} else {
for ( var i = 0, l = insert.length; i < l; i++ ) {
var elems = (i > 0 ? this.clone(true) : this).get();
jQuery( insert[i] )[ original ]( elems );
ret = ret.concat( elems );
}
return this.pushStack( ret, name, insert.selector );
}
};
});
jQuery.extend({
clean: function( elems, context, fragment, scripts ) {
context = context || document;
// !context.createElement fails in IE with an error but returns typeof 'object'
if ( typeof context.createElement === "undefined" ) {
context = context.ownerDocument || context[0] && context[0].ownerDocument || document;
}
var ret = [];
for ( var i = 0, elem; (elem = elems[i]) != null; i++ ) {
if ( typeof elem === "number" ) {
elem += "";
}
if ( !elem ) {
continue;
}
// Convert html string into DOM nodes
if ( typeof elem === "string" && !rhtml.test( elem ) ) {
elem = context.createTextNode( elem );
} else if ( typeof elem === "string" ) {
// Fix "XHTML"-style tags in all browsers
elem = elem.replace(rxhtmlTag, "<$1></$2>");
// Trim whitespace, otherwise indexOf won't work as expected
var tag = (rtagName.exec( elem ) || ["", ""])[1].toLowerCase(),
wrap = wrapMap[ tag ] || wrapMap._default,
depth = wrap[0],
div = context.createElement("div");
// Go to html and back, then peel off extra wrappers
div.innerHTML = wrap[1] + elem + wrap[2];
// Move to the right depth
while ( depth-- ) {
div = div.lastChild;
}
// Remove IE's autoinserted <tbody> from table fragments
if ( !jQuery.support.tbody ) {
// String was a <table>, *may* have spurious <tbody>
var hasBody = rtbody.test(elem),
tbody = tag === "table" && !hasBody ?
div.firstChild && div.firstChild.childNodes :
// String was a bare <thead> or <tfoot>
wrap[1] === "<table>" && !hasBody ?
div.childNodes :
[];
for ( var j = tbody.length - 1; j >= 0 ; --j ) {
if ( jQuery.nodeName( tbody[ j ], "tbody" ) && !tbody[ j ].childNodes.length ) {
tbody[ j ].parentNode.removeChild( tbody[ j ] );
}
}
}
// IE completely kills leading whitespace when innerHTML is used
if ( !jQuery.support.leadingWhitespace && rleadingWhitespace.test( elem ) ) {
div.insertBefore( context.createTextNode( rleadingWhitespace.exec(elem)[0] ), div.firstChild );
}
elem = div.childNodes;
}
if ( elem.nodeType ) {
ret.push( elem );
} else {
ret = jQuery.merge( ret, elem );
}
}
if ( fragment ) {
for ( i = 0; ret[i]; i++ ) {
if ( scripts && jQuery.nodeName( ret[i], "script" ) && (!ret[i].type || ret[i].type.toLowerCase() === "text/javascript") ) {
scripts.push( ret[i].parentNode ? ret[i].parentNode.removeChild( ret[i] ) : ret[i] );
} else {
if ( ret[i].nodeType === 1 ) {
ret.splice.apply( ret, [i + 1, 0].concat(jQuery.makeArray(ret[i].getElementsByTagName("script"))) );
}
fragment.appendChild( ret[i] );
}
}
}
return ret;
},
cleanData: function( elems ) {
var data, id, cache = jQuery.cache,
special = jQuery.event.special,
deleteExpando = jQuery.support.deleteExpando;
for ( var i = 0, elem; (elem = elems[i]) != null; i++ ) {
if ( elem.nodeName && jQuery.noData[elem.nodeName.toLowerCase()] ) {
continue;
}
id = elem[ jQuery.expando ];
if ( id ) {
data = cache[ id ];
if ( data && data.events ) {
for ( var type in data.events ) {
if ( special[ type ] ) {
jQuery.event.remove( elem, type );
} else {
jQuery.removeEvent( elem, type, data.handle );
}
}
}
if ( deleteExpando ) {
delete elem[ jQuery.expando ];
} else if ( elem.removeAttribute ) {
elem.removeAttribute( jQuery.expando );
}
delete cache[ id ];
}
}
}
});
function evalScript( i, elem ) {
if ( elem.src ) {
jQuery.ajax({
url: elem.src,
async: false,
dataType: "script"
});
} else {
jQuery.globalEval( elem.text || elem.textContent || elem.innerHTML || "" );
}
if ( elem.parentNode ) {
elem.parentNode.removeChild( elem );
}
}
var ralpha = /alpha\([^)]*\)/i,
ropacity = /opacity=([^)]*)/,
rdashAlpha = /-([a-z])/ig,
rupper = /([A-Z])/g,
rnumpx = /^-?\d+(?:px)?$/i,
rnum = /^-?\d/,
cssShow = { position: "absolute", visibility: "hidden", display: "block" },
cssWidth = [ "Left", "Right" ],
cssHeight = [ "Top", "Bottom" ],
curCSS,
getComputedStyle,
currentStyle,
fcamelCase = function( all, letter ) {
return letter.toUpperCase();
};
jQuery.fn.css = function( name, value ) {
// Setting 'undefined' is a no-op
if ( arguments.length === 2 && value === undefined ) {
return this;
}
return jQuery.access( this, name, value, true, function( elem, name, value ) {
return value !== undefined ?
jQuery.style( elem, name, value ) :
jQuery.css( elem, name );
});
};
jQuery.extend({
// Add in style property hooks for overriding the default
// behavior of getting and setting a style property
cssHooks: {
opacity: {
get: function( elem, computed ) {
if ( computed ) {
// We should always get a number back from opacity
var ret = curCSS( elem, "opacity", "opacity" );
return ret === "" ? "1" : ret;
} else {
return elem.style.opacity;
}
}
}
},
// Exclude the following css properties to add px
cssNumber: {
"zIndex": true,
"fontWeight": true,
"opacity": true,
"zoom": true,
"lineHeight": true
},
// Add in properties whose names you wish to fix before
// setting or getting the value
cssProps: {
// normalize float css property
"float": jQuery.support.cssFloat ? "cssFloat" : "styleFloat"
},
// Get and set the style property on a DOM Node
style: function( elem, name, value, extra ) {
// Don't set styles on text and comment nodes
if ( !elem || elem.nodeType === 3 || elem.nodeType === 8 || !elem.style ) {
return;
}
// Make sure that we're working with the right name
var ret, origName = jQuery.camelCase( name ),
style = elem.style, hooks = jQuery.cssHooks[ origName ];
name = jQuery.cssProps[ origName ] || origName;
// Check if we're setting a value
if ( value !== undefined ) {
// Make sure that NaN and null values aren't set. See: #7116
if ( typeof value === "number" && isNaN( value ) || value == null ) {
return;
}
// If a number was passed in, add 'px' to the (except for certain CSS properties)
if ( typeof value === "number" && !jQuery.cssNumber[ origName ] ) {
value += "px";
}
// If a hook was provided, use that value, otherwise just set the specified value
if ( !hooks || !("set" in hooks) || (value = hooks.set( elem, value )) !== undefined ) {
// Wrapped to prevent IE from throwing errors when 'invalid' values are provided
// Fixes bug #5509
try {
style[ name ] = value;
} catch(e) {}
}
} else {
// If a hook was provided get the non-computed value from there
if ( hooks && "get" in hooks && (ret = hooks.get( elem, false, extra )) !== undefined ) {
return ret;
}
// Otherwise just get the value from the style object
return style[ name ];
}
},
css: function( elem, name, extra ) {
// Make sure that we're working with the right name
var ret, origName = jQuery.camelCase( name ),
hooks = jQuery.cssHooks[ origName ];
name = jQuery.cssProps[ origName ] || origName;
// If a hook was provided get the computed value from there
if ( hooks && "get" in hooks && (ret = hooks.get( elem, true, extra )) !== undefined ) {
return ret;
// Otherwise, if a way to get the computed value exists, use that
} else if ( curCSS ) {
return curCSS( elem, name, origName );
}
},
// A method for quickly swapping in/out CSS properties to get correct calculations
swap: function( elem, options, callback ) {
var old = {};
// Remember the old values, and insert the new ones
for ( var name in options ) {
old[ name ] = elem.style[ name ];
elem.style[ name ] = options[ name ];
}
callback.call( elem );
// Revert the old values
for ( name in options ) {
elem.style[ name ] = old[ name ];
}
},
camelCase: function( string ) {
return string.replace( rdashAlpha, fcamelCase );
}
});
// DEPRECATED, Use jQuery.css() instead
jQuery.curCSS = jQuery.css;
jQuery.each(["height", "width"], function( i, name ) {
jQuery.cssHooks[ name ] = {
get: function( elem, computed, extra ) {
var val;
if ( computed ) {
if ( elem.offsetWidth !== 0 ) {
val = getWH( elem, name, extra );
} else {
jQuery.swap( elem, cssShow, function() {
val = getWH( elem, name, extra );
});
}
if ( val <= 0 ) {
val = curCSS( elem, name, name );
if ( val === "0px" && currentStyle ) {
val = currentStyle( elem, name, name );
}
if ( val != null ) {
// Should return "auto" instead of 0, use 0 for
// temporary backwards-compat
return val === "" || val === "auto" ? "0px" : val;
}
}
if ( val < 0 || val == null ) {
val = elem.style[ name ];
// Should return "auto" instead of 0, use 0 for
// temporary backwards-compat
return val === "" || val === "auto" ? "0px" : val;
}
return typeof val === "string" ? val : val + "px";
}
},
set: function( elem, value ) {
if ( rnumpx.test( value ) ) {
// ignore negative width and height values #1599
value = parseFloat(value);
if ( value >= 0 ) {
return value + "px";
}
} else {
return value;
}
}
};
});
if ( !jQuery.support.opacity ) {
jQuery.cssHooks.opacity = {
get: function( elem, computed ) {
// IE uses filters for opacity
return ropacity.test((computed && elem.currentStyle ? elem.currentStyle.filter : elem.style.filter) || "") ?
(parseFloat(RegExp.$1) / 100) + "" :
computed ? "1" : "";
},
set: function( elem, value ) {
var style = elem.style;
// IE has trouble with opacity if it does not have layout
// Force it by setting the zoom level
style.zoom = 1;
// Set the alpha filter to set the opacity
var opacity = jQuery.isNaN(value) ?
"" :
"alpha(opacity=" + value * 100 + ")",
filter = style.filter || "";
style.filter = ralpha.test(filter) ?
filter.replace(ralpha, opacity) :
style.filter + ' ' + opacity;
}
};
}
if ( document.defaultView && document.defaultView.getComputedStyle ) {
getComputedStyle = function( elem, newName, name ) {
var ret, defaultView, computedStyle;
name = name.replace( rupper, "-$1" ).toLowerCase();
if ( !(defaultView = elem.ownerDocument.defaultView) ) {
return undefined;
}
if ( (computedStyle = defaultView.getComputedStyle( elem, null )) ) {
ret = computedStyle.getPropertyValue( name );
if ( ret === "" && !jQuery.contains( elem.ownerDocument.documentElement, elem ) ) {
ret = jQuery.style( elem, name );
}
}
return ret;
};
}
if ( document.documentElement.currentStyle ) {
currentStyle = function( elem, name ) {
var left, rsLeft,
ret = elem.currentStyle && elem.currentStyle[ name ],
style = elem.style;
// From the awesome hack by Dean Edwards
// http://erik.eae.net/archives/2007/07/27/18.54.15/#comment-102291
// If we're not dealing with a regular pixel number
// but a number that has a weird ending, we need to convert it to pixels
if ( !rnumpx.test( ret ) && rnum.test( ret ) ) {
// Remember the original values
left = style.left;
rsLeft = elem.runtimeStyle.left;
// Put in the new values to get a computed value out
elem.runtimeStyle.left = elem.currentStyle.left;
style.left = name === "fontSize" ? "1em" : (ret || 0);
ret = style.pixelLeft + "px";
// Revert the changed values
style.left = left;
elem.runtimeStyle.left = rsLeft;
}
return ret === "" ? "auto" : ret;
};
}
curCSS = getComputedStyle || currentStyle;
function getWH( elem, name, extra ) {
var which = name === "width" ? cssWidth : cssHeight,
val = name === "width" ? elem.offsetWidth : elem.offsetHeight;
if ( extra === "border" ) {
return val;
}
jQuery.each( which, function() {
if ( !extra ) {
val -= parseFloat(jQuery.css( elem, "padding" + this )) || 0;
}
if ( extra === "margin" ) {
val += parseFloat(jQuery.css( elem, "margin" + this )) || 0;
} else {
val -= parseFloat(jQuery.css( elem, "border" + this + "Width" )) || 0;
}
});
return val;
}
if ( jQuery.expr && jQuery.expr.filters ) {
jQuery.expr.filters.hidden = function( elem ) {
var width = elem.offsetWidth,
height = elem.offsetHeight;
return (width === 0 && height === 0) || (!jQuery.support.reliableHiddenOffsets && (elem.style.display || jQuery.css( elem, "display" )) === "none");
};
jQuery.expr.filters.visible = function( elem ) {
return !jQuery.expr.filters.hidden( elem );
};
}
var jsc = jQuery.now(),
rscript = /<script\b[^<]*(?:(?!<\/script>)<[^<]*)*<\/script>/gi,
rselectTextarea = /^(?:select|textarea)/i,
rinput = /^(?:color|date|datetime|email|hidden|month|number|password|range|search|tel|text|time|url|week)$/i,
rnoContent = /^(?:GET|HEAD)$/,
rbracket = /\[\]$/,
jsre = /\=\?(&|$)/,
rquery = /\?/,
rts = /([?&])_=[^&]*/,
rurl = /^(\w+:)?\/\/([^\/?#]+)/,
r20 = /%20/g,
rhash = /#.*$/,
// Keep a copy of the old load method
_load = jQuery.fn.load;
jQuery.fn.extend({
load: function( url, params, callback ) {
if ( typeof url !== "string" && _load ) {
return _load.apply( this, arguments );
// Don't do a request if no elements are being requested
} else if ( !this.length ) {
return this;
}
var off = url.indexOf(" ");
if ( off >= 0 ) {
var selector = url.slice(off, url.length);
url = url.slice(0, off);
}
// Default to a GET request
var type = "GET";
// If the second parameter was provided
if ( params ) {
// If it's a function
if ( jQuery.isFunction( params ) ) {
// We assume that it's the callback
callback = params;
params = null;
// Otherwise, build a param string
} else if ( typeof params === "object" ) {
params = jQuery.param( params, jQuery.ajaxSettings.traditional );
type = "POST";
}
}
var self = this;
// Request the remote document
jQuery.ajax({
url: url,
type: type,
dataType: "html",
data: params,
complete: function( res, status ) {
// If successful, inject the HTML into all the matched elements
if ( status === "success" || status === "notmodified" ) {
// See if a selector was specified
self.html( selector ?
// Create a dummy div to hold the results
jQuery("<div>")
// inject the contents of the document in, removing the scripts
// to avoid any 'Permission Denied' errors in IE
.append(res.responseText.replace(rscript, ""))
// Locate the specified elements
.find(selector) :
// If not, just inject the full result
res.responseText );
}
if ( callback ) {
self.each( callback, [res.responseText, status, res] );
}
}
});
return this;
},
serialize: function() {
return jQuery.param(this.serializeArray());
},
serializeArray: function() {
return this.map(function() {
return this.elements ? jQuery.makeArray(this.elements) : this;
})
.filter(function() {
return this.name && !this.disabled &&
(this.checked || rselectTextarea.test(this.nodeName) ||
rinput.test(this.type));
})
.map(function( i, elem ) {
var val = jQuery(this).val();
return val == null ?
null :
jQuery.isArray(val) ?
jQuery.map( val, function( val, i ) {
return { name: elem.name, value: val };
}) :
{ name: elem.name, value: val };
}).get();
}
});
// Attach a bunch of functions for handling common AJAX events
jQuery.each( "ajaxStart ajaxStop ajaxComplete ajaxError ajaxSuccess ajaxSend".split(" "), function( i, o ) {
jQuery.fn[o] = function( f ) {
return this.bind(o, f);
};
});
jQuery.extend({
get: function( url, data, callback, type ) {
// shift arguments if data argument was omited
if ( jQuery.isFunction( data ) ) {
type = type || callback;
callback = data;
data = null;
}
return jQuery.ajax({
type: "GET",
url: url,
data: data,
success: callback,
dataType: type
});
},
getScript: function( url, callback ) {
return jQuery.get(url, null, callback, "script");
},
getJSON: function( url, data, callback ) {
return jQuery.get(url, data, callback, "json");
},
post: function( url, data, callback, type ) {
// shift arguments if data argument was omited
if ( jQuery.isFunction( data ) ) {
type = type || callback;
callback = data;
data = {};
}
return jQuery.ajax({
type: "POST",
url: url,
data: data,
success: callback,
dataType: type
});
},
ajaxSetup: function( settings ) {
jQuery.extend( jQuery.ajaxSettings, settings );
},
ajaxSettings: {
url: location.href,
global: true,
type: "GET",
contentType: "application/x-www-form-urlencoded",
processData: true,
async: true,
/*
timeout: 0,
data: null,
username: null,
password: null,
traditional: false,
*/
// This function can be overriden by calling jQuery.ajaxSetup
xhr: function() {
return new window.XMLHttpRequest();
},
accepts: {
xml: "application/xml, text/xml",
html: "text/html",
script: "text/javascript, application/javascript",
json: "application/json, text/javascript",
text: "text/plain",
_default: "*/*"
}
},
ajax: function( origSettings ) {
var s = jQuery.extend(true, {}, jQuery.ajaxSettings, origSettings),
jsonp, status, data, type = s.type.toUpperCase(), noContent = rnoContent.test(type);
s.url = s.url.replace( rhash, "" );
// Use original (not extended) context object if it was provided
s.context = origSettings && origSettings.context != null ? origSettings.context : s;
// convert data if not already a string
if ( s.data && s.processData && typeof s.data !== "string" ) {
s.data = jQuery.param( s.data, s.traditional );
}
// Handle JSONP Parameter Callbacks
if ( s.dataType === "jsonp" ) {
if ( type === "GET" ) {
if ( !jsre.test( s.url ) ) {
s.url += (rquery.test( s.url ) ? "&" : "?") + (s.jsonp || "callback") + "=?";
}
} else if ( !s.data || !jsre.test(s.data) ) {
s.data = (s.data ? s.data + "&" : "") + (s.jsonp || "callback") + "=?";
}
s.dataType = "json";
}
// Build temporary JSONP function
if ( s.dataType === "json" && (s.data && jsre.test(s.data) || jsre.test(s.url)) ) {
jsonp = s.jsonpCallback || ("jsonp" + jsc++);
// Replace the =? sequence both in the query string and the data
if ( s.data ) {
s.data = (s.data + "").replace(jsre, "=" + jsonp + "$1");
}
s.url = s.url.replace(jsre, "=" + jsonp + "$1");
// We need to make sure
// that a JSONP style response is executed properly
s.dataType = "script";
// Handle JSONP-style loading
var customJsonp = window[ jsonp ];
window[ jsonp ] = function( tmp ) {
if ( jQuery.isFunction( customJsonp ) ) {
customJsonp( tmp );
} else {
// Garbage collect
window[ jsonp ] = undefined;
try {
delete window[ jsonp ];
} catch( jsonpError ) {}
}
data = tmp;
jQuery.handleSuccess( s, xhr, status, data );
jQuery.handleComplete( s, xhr, status, data );
if ( head ) {
head.removeChild( script );
}
};
}
if ( s.dataType === "script" && s.cache === null ) {
s.cache = false;
}
if ( s.cache === false && noContent ) {
var ts = jQuery.now();
// try replacing _= if it is there
var ret = s.url.replace(rts, "$1_=" + ts);
// if nothing was replaced, add timestamp to the end
s.url = ret + ((ret === s.url) ? (rquery.test(s.url) ? "&" : "?") + "_=" + ts : "");
}
// If data is available, append data to url for GET/HEAD requests
if ( s.data && noContent ) {
s.url += (rquery.test(s.url) ? "&" : "?") + s.data;
}
// Watch for a new set of requests
if ( s.global && jQuery.active++ === 0 ) {
jQuery.event.trigger( "ajaxStart" );
}
// Matches an absolute URL, and saves the domain
var parts = rurl.exec( s.url ),
remote = parts && (parts[1] && parts[1].toLowerCase() !== location.protocol || parts[2].toLowerCase() !== location.host);
// If we're requesting a remote document
// and trying to load JSON or Script with a GET
if ( s.dataType === "script" && type === "GET" && remote ) {
var head = document.getElementsByTagName("head")[0] || document.documentElement;
var script = document.createElement("script");
if ( s.scriptCharset ) {
script.charset = s.scriptCharset;
}
script.src = s.url;
// Handle Script loading
if ( !jsonp ) {
var done = false;
// Attach handlers for all browsers
script.onload = script.onreadystatechange = function() {
if ( !done && (!this.readyState ||
this.readyState === "loaded" || this.readyState === "complete") ) {
done = true;
jQuery.handleSuccess( s, xhr, status, data );
jQuery.handleComplete( s, xhr, status, data );
// Handle memory leak in IE
script.onload = script.onreadystatechange = null;
if ( head && script.parentNode ) {
head.removeChild( script );
}
}
};
}
// Use insertBefore instead of appendChild to circumvent an IE6 bug.
// This arises when a base node is used (#2709 and #4378).
head.insertBefore( script, head.firstChild );
// We handle everything using the script element injection
return undefined;
}
var requestDone = false;
// Create the request object
var xhr = s.xhr();
if ( !xhr ) {
return;
}
// Open the socket
// Passing null username, generates a login popup on Opera (#2865)
if ( s.username ) {
xhr.open(type, s.url, s.async, s.username, s.password);
} else {
xhr.open(type, s.url, s.async);
}
// Need an extra try/catch for cross domain requests in Firefox 3
try {
// Set content-type if data specified and content-body is valid for this type
if ( (s.data != null && !noContent) || (origSettings && origSettings.contentType) ) {
xhr.setRequestHeader("Content-Type", s.contentType);
}
// Set the If-Modified-Since and/or If-None-Match header, if in ifModified mode.
if ( s.ifModified ) {
if ( jQuery.lastModified[s.url] ) {
xhr.setRequestHeader("If-Modified-Since", jQuery.lastModified[s.url]);
}
if ( jQuery.etag[s.url] ) {
xhr.setRequestHeader("If-None-Match", jQuery.etag[s.url]);
}
}
// Set header so the called script knows that it's an XMLHttpRequest
// Only send the header if it's not a remote XHR
if ( !remote ) {
xhr.setRequestHeader("X-Requested-With", "XMLHttpRequest");
}
// Set the Accepts header for the server, depending on the dataType
xhr.setRequestHeader("Accept", s.dataType && s.accepts[ s.dataType ] ?
s.accepts[ s.dataType ] + ", */*; q=0.01" :
s.accepts._default );
} catch( headerError ) {}
// Allow custom headers/mimetypes and early abort
if ( s.beforeSend && s.beforeSend.call(s.context, xhr, s) === false ) {
// Handle the global AJAX counter
if ( s.global && jQuery.active-- === 1 ) {
jQuery.event.trigger( "ajaxStop" );
}
// close opended socket
xhr.abort();
return false;
}
if ( s.global ) {
jQuery.triggerGlobal( s, "ajaxSend", [xhr, s] );
}
// Wait for a response to come back
var onreadystatechange = xhr.onreadystatechange = function( isTimeout ) {
// The request was aborted
if ( !xhr || xhr.readyState === 0 || isTimeout === "abort" ) {
// Opera doesn't call onreadystatechange before this point
// so we simulate the call
if ( !requestDone ) {
jQuery.handleComplete( s, xhr, status, data );
}
requestDone = true;
if ( xhr ) {
xhr.onreadystatechange = jQuery.noop;
}
// The transfer is complete and the data is available, or the request timed out
} else if ( !requestDone && xhr && (xhr.readyState === 4 || isTimeout === "timeout") ) {
requestDone = true;
xhr.onreadystatechange = jQuery.noop;
status = isTimeout === "timeout" ?
"timeout" :
!jQuery.httpSuccess( xhr ) ?
"error" :
s.ifModified && jQuery.httpNotModified( xhr, s.url ) ?
"notmodified" :
"success";
var errMsg;
if ( status === "success" ) {
// Watch for, and catch, XML document parse errors
try {
// process the data (runs the xml through httpData regardless of callback)
data = jQuery.httpData( xhr, s.dataType, s );
} catch( parserError ) {
status = "parsererror";
errMsg = parserError;
}
}
// Make sure that the request was successful or notmodified
if ( status === "success" || status === "notmodified" ) {
// JSONP handles its own success callback
if ( !jsonp ) {
jQuery.handleSuccess( s, xhr, status, data );
}
} else {
jQuery.handleError( s, xhr, status, errMsg );
}
// Fire the complete handlers
if ( !jsonp ) {
jQuery.handleComplete( s, xhr, status, data );
}
if ( isTimeout === "timeout" ) {
xhr.abort();
}
// Stop memory leaks
if ( s.async ) {
xhr = null;
}
}
};
// Override the abort handler, if we can (IE 6 doesn't allow it, but that's OK)
// Opera doesn't fire onreadystatechange at all on abort
try {
var oldAbort = xhr.abort;
xhr.abort = function() {
if ( xhr ) {
// oldAbort has no call property in IE7 so
// just do it this way, which works in all
// browsers
Function.prototype.call.call( oldAbort, xhr );
}
onreadystatechange( "abort" );
};
} catch( abortError ) {}
// Timeout checker
if ( s.async && s.timeout > 0 ) {
setTimeout(function() {
// Check to see if the request is still happening
if ( xhr && !requestDone ) {
onreadystatechange( "timeout" );
}
}, s.timeout);
}
// Send the data
try {
xhr.send( noContent || s.data == null ? null : s.data );
} catch( sendError ) {
jQuery.handleError( s, xhr, null, sendError );
// Fire the complete handlers
jQuery.handleComplete( s, xhr, status, data );
}
// firefox 1.5 doesn't fire statechange for sync requests
if ( !s.async ) {
onreadystatechange();
}
// return XMLHttpRequest to allow aborting the request etc.
return xhr;
},
// Serialize an array of form elements or a set of
// key/values into a query string
param: function( a, traditional ) {
var s = [],
add = function( key, value ) {
// If value is a function, invoke it and return its value
value = jQuery.isFunction(value) ? value() : value;
s[ s.length ] = encodeURIComponent(key) + "=" + encodeURIComponent(value);
};
// Set traditional to true for jQuery <= 1.3.2 behavior.
if ( traditional === undefined ) {
traditional = jQuery.ajaxSettings.traditional;
}
// If an array was passed in, assume that it is an array of form elements.
if ( jQuery.isArray(a) || a.jquery ) {
// Serialize the form elements
jQuery.each( a, function() {
add( this.name, this.value );
});
} else {
// If traditional, encode the "old" way (the way 1.3.2 or older
// did it), otherwise encode params recursively.
for ( var prefix in a ) {
buildParams( prefix, a[prefix], traditional, add );
}
}
// Return the resulting serialization
return s.join("&").replace(r20, "+");
}
});
function buildParams( prefix, obj, traditional, add ) {
if ( jQuery.isArray(obj) && obj.length ) {
// Serialize array item.
jQuery.each( obj, function( i, v ) {
if ( traditional || rbracket.test( prefix ) ) {
// Treat each array item as a scalar.
add( prefix, v );
} else {
// If array item is non-scalar (array or object), encode its
// numeric index to resolve deserialization ambiguity issues.
// Note that rack (as of 1.0.0) can't currently deserialize
// nested arrays properly, and attempting to do so may cause
// a server error. Possible fixes are to modify rack's
// deserialization algorithm or to provide an option or flag
// to force array serialization to be shallow.
buildParams( prefix + "[" + ( typeof v === "object" || jQuery.isArray(v) ? i : "" ) + "]", v, traditional, add );
}
});
} else if ( !traditional && obj != null && typeof obj === "object" ) {
if ( jQuery.isEmptyObject( obj ) ) {
add( prefix, "" );
// Serialize object item.
} else {
jQuery.each( obj, function( k, v ) {
buildParams( prefix + "[" + k + "]", v, traditional, add );
});
}
} else {
// Serialize scalar item.
add( prefix, obj );
}
}
// This is still on the jQuery object... for now
// Want to move this to jQuery.ajax some day
jQuery.extend({
// Counter for holding the number of active queries
active: 0,
// Last-Modified header cache for next request
lastModified: {},
etag: {},
handleError: function( s, xhr, status, e ) {
// If a local callback was specified, fire it
if ( s.error ) {
s.error.call( s.context, xhr, status, e );
}
// Fire the global callback
if ( s.global ) {
jQuery.triggerGlobal( s, "ajaxError", [xhr, s, e] );
}
},
handleSuccess: function( s, xhr, status, data ) {
// If a local callback was specified, fire it and pass it the data
if ( s.success ) {
s.success.call( s.context, data, status, xhr );
}
// Fire the global callback
if ( s.global ) {
jQuery.triggerGlobal( s, "ajaxSuccess", [xhr, s] );
}
},
handleComplete: function( s, xhr, status ) {
// Process result
if ( s.complete ) {
s.complete.call( s.context, xhr, status );
}
// The request was completed
if ( s.global ) {
jQuery.triggerGlobal( s, "ajaxComplete", [xhr, s] );
}
// Handle the global AJAX counter
if ( s.global && jQuery.active-- === 1 ) {
jQuery.event.trigger( "ajaxStop" );
}
},
triggerGlobal: function( s, type, args ) {
(s.context && s.context.url == null ? jQuery(s.context) : jQuery.event).trigger(type, args);
},
// Determines if an XMLHttpRequest was successful or not
httpSuccess: function( xhr ) {
try {
// IE error sometimes returns 1223 when it should be 204 so treat it as success, see #1450
return !xhr.status && location.protocol === "file:" ||
xhr.status >= 200 && xhr.status < 300 ||
xhr.status === 304 || xhr.status === 1223;
} catch(e) {}
return false;
},
// Determines if an XMLHttpRequest returns NotModified
httpNotModified: function( xhr, url ) {
var lastModified = xhr.getResponseHeader("Last-Modified"),
etag = xhr.getResponseHeader("Etag");
if ( lastModified ) {
jQuery.lastModified[url] = lastModified;
}
if ( etag ) {
jQuery.etag[url] = etag;
}
return xhr.status === 304;
},
httpData: function( xhr, type, s ) {
var ct = xhr.getResponseHeader("content-type") || "",
xml = type === "xml" || !type && ct.indexOf("xml") >= 0,
data = xml ? xhr.responseXML : xhr.responseText;
if ( xml && data.documentElement.nodeName === "parsererror" ) {
jQuery.error( "parsererror" );
}
// Allow a pre-filtering function to sanitize the response
// s is checked to keep backwards compatibility
if ( s && s.dataFilter ) {
data = s.dataFilter( data, type );
}
// The filter can actually parse the response
if ( typeof data === "string" ) {
// Get the JavaScript object, if JSON is used.
if ( type === "json" || !type && ct.indexOf("json") >= 0 ) {
data = jQuery.parseJSON( data );
// If the type is "script", eval it in global context
} else if ( type === "script" || !type && ct.indexOf("javascript") >= 0 ) {
jQuery.globalEval( data );
}
}
return data;
}
});
/*
* Create the request object; Microsoft failed to properly
* implement the XMLHttpRequest in IE7 (can't request local files),
* so we use the ActiveXObject when it is available
* Additionally XMLHttpRequest can be disabled in IE7/IE8 so
* we need a fallback.
*/
if ( window.ActiveXObject ) {
jQuery.ajaxSettings.xhr = function() {
if ( window.location.protocol !== "file:" ) {
try {
return new window.XMLHttpRequest();
} catch(xhrError) {}
}
try {
return new window.ActiveXObject("Microsoft.XMLHTTP");
} catch(activeError) {}
};
}
// Does this browser support XHR requests?
jQuery.support.ajax = !!jQuery.ajaxSettings.xhr();
var elemdisplay = {},
rfxtypes = /^(?:toggle|show|hide)$/,
rfxnum = /^([+\-]=)?([\d+.\-]+)(.*)$/,
timerId,
fxAttrs = [
// height animations
[ "height", "marginTop", "marginBottom", "paddingTop", "paddingBottom" ],
// width animations
[ "width", "marginLeft", "marginRight", "paddingLeft", "paddingRight" ],
// opacity animations
[ "opacity" ]
];
jQuery.fn.extend({
show: function( speed, easing, callback ) {
var elem, display;
if ( speed || speed === 0 ) {
return this.animate( genFx("show", 3), speed, easing, callback);
} else {
for ( var i = 0, j = this.length; i < j; i++ ) {
elem = this[i];
display = elem.style.display;
// Reset the inline display of this element to learn if it is
// being hidden by cascaded rules or not
if ( !jQuery.data(elem, "olddisplay") && display === "none" ) {
display = elem.style.display = "";
}
// Set elements which have been overridden with display: none
// in a stylesheet to whatever the default browser style is
// for such an element
if ( display === "" && jQuery.css( elem, "display" ) === "none" ) {
jQuery.data(elem, "olddisplay", defaultDisplay(elem.nodeName));
}
}
// Set the display of most of the elements in a second loop
// to avoid the constant reflow
for ( i = 0; i < j; i++ ) {
elem = this[i];
display = elem.style.display;
if ( display === "" || display === "none" ) {
elem.style.display = jQuery.data(elem, "olddisplay") || "";
}
}
return this;
}
},
hide: function( speed, easing, callback ) {
if ( speed || speed === 0 ) {
return this.animate( genFx("hide", 3), speed, easing, callback);
} else {
for ( var i = 0, j = this.length; i < j; i++ ) {
var display = jQuery.css( this[i], "display" );
if ( display !== "none" ) {
jQuery.data( this[i], "olddisplay", display );
}
}
// Set the display of the elements in a second loop
// to avoid the constant reflow
for ( i = 0; i < j; i++ ) {
this[i].style.display = "none";
}
return this;
}
},
// Save the old toggle function
_toggle: jQuery.fn.toggle,
toggle: function( fn, fn2, callback ) {
var bool = typeof fn === "boolean";
if ( jQuery.isFunction(fn) && jQuery.isFunction(fn2) ) {
this._toggle.apply( this, arguments );
} else if ( fn == null || bool ) {
this.each(function() {
var state = bool ? fn : jQuery(this).is(":hidden");
jQuery(this)[ state ? "show" : "hide" ]();
});
} else {
this.animate(genFx("toggle", 3), fn, fn2, callback);
}
return this;
},
fadeTo: function( speed, to, easing, callback ) {
return this.filter(":hidden").css("opacity", 0).show().end()
.animate({opacity: to}, speed, easing, callback);
},
animate: function( prop, speed, easing, callback ) {
var optall = jQuery.speed(speed, easing, callback);
if ( jQuery.isEmptyObject( prop ) ) {
return this.each( optall.complete );
}
return this[ optall.queue === false ? "each" : "queue" ](function() {
// XXX 'this' does not always have a nodeName when running the
// test suite
var opt = jQuery.extend({}, optall), p,
isElement = this.nodeType === 1,
hidden = isElement && jQuery(this).is(":hidden"),
self = this;
for ( p in prop ) {
var name = jQuery.camelCase( p );
if ( p !== name ) {
prop[ name ] = prop[ p ];
delete prop[ p ];
p = name;
}
if ( prop[p] === "hide" && hidden || prop[p] === "show" && !hidden ) {
return opt.complete.call(this);
}
if ( isElement && ( p === "height" || p === "width" ) ) {
// Make sure that nothing sneaks out
// Record all 3 overflow attributes because IE does not
// change the overflow attribute when overflowX and
// overflowY are set to the same value
opt.overflow = [ this.style.overflow, this.style.overflowX, this.style.overflowY ];
// Set display property to inline-block for height/width
// animations on inline elements that are having width/height
// animated
if ( jQuery.css( this, "display" ) === "inline" &&
jQuery.css( this, "float" ) === "none" ) {
if ( !jQuery.support.inlineBlockNeedsLayout ) {
this.style.display = "inline-block";
} else {
var display = defaultDisplay(this.nodeName);
// inline-level elements accept inline-block;
// block-level elements need to be inline with layout
if ( display === "inline" ) {
this.style.display = "inline-block";
} else {
this.style.display = "inline";
this.style.zoom = 1;
}
}
}
}
if ( jQuery.isArray( prop[p] ) ) {
// Create (if needed) and add to specialEasing
(opt.specialEasing = opt.specialEasing || {})[p] = prop[p][1];
prop[p] = prop[p][0];
}
}
if ( opt.overflow != null ) {
this.style.overflow = "hidden";
}
opt.curAnim = jQuery.extend({}, prop);
jQuery.each( prop, function( name, val ) {
var e = new jQuery.fx( self, opt, name );
if ( rfxtypes.test(val) ) {
e[ val === "toggle" ? hidden ? "show" : "hide" : val ]( prop );
} else {
var parts = rfxnum.exec(val),
start = e.cur() || 0;
if ( parts ) {
var end = parseFloat( parts[2] ),
unit = parts[3] || "px";
// We need to compute starting value
if ( unit !== "px" ) {
jQuery.style( self, name, (end || 1) + unit);
start = ((end || 1) / e.cur()) * start;
jQuery.style( self, name, start + unit);
}
// If a +=/-= token was provided, we're doing a relative animation
if ( parts[1] ) {
end = ((parts[1] === "-=" ? -1 : 1) * end) + start;
}
e.custom( start, end, unit );
} else {
e.custom( start, val, "" );
}
}
});
// For JS strict compliance
return true;
});
},
stop: function( clearQueue, gotoEnd ) {
var timers = jQuery.timers;
if ( clearQueue ) {
this.queue([]);
}
this.each(function() {
// go in reverse order so anything added to the queue during the loop is ignored
for ( var i = timers.length - 1; i >= 0; i-- ) {
if ( timers[i].elem === this ) {
if (gotoEnd) {
// force the next step to be the last
timers[i](true);
}
timers.splice(i, 1);
}
}
});
// start the next in the queue if the last step wasn't forced
if ( !gotoEnd ) {
this.dequeue();
}
return this;
}
});
function genFx( type, num ) {
var obj = {};
jQuery.each( fxAttrs.concat.apply([], fxAttrs.slice(0,num)), function() {
obj[ this ] = type;
});
return obj;
}
// Generate shortcuts for custom animations
jQuery.each({
slideDown: genFx("show", 1),
slideUp: genFx("hide", 1),
slideToggle: genFx("toggle", 1),
fadeIn: { opacity: "show" },
fadeOut: { opacity: "hide" },
fadeToggle: { opacity: "toggle" }
}, function( name, props ) {
jQuery.fn[ name ] = function( speed, easing, callback ) {
return this.animate( props, speed, easing, callback );
};
});
jQuery.extend({
speed: function( speed, easing, fn ) {
var opt = speed && typeof speed === "object" ? jQuery.extend({}, speed) : {
complete: fn || !fn && easing ||
jQuery.isFunction( speed ) && speed,
duration: speed,
easing: fn && easing || easing && !jQuery.isFunction(easing) && easing
};
opt.duration = jQuery.fx.off ? 0 : typeof opt.duration === "number" ? opt.duration :
opt.duration in jQuery.fx.speeds ? jQuery.fx.speeds[opt.duration] : jQuery.fx.speeds._default;
// Queueing
opt.old = opt.complete;
opt.complete = function() {
if ( opt.queue !== false ) {
jQuery(this).dequeue();
}
if ( jQuery.isFunction( opt.old ) ) {
opt.old.call( this );
}
};
return opt;
},
easing: {
linear: function( p, n, firstNum, diff ) {
return firstNum + diff * p;
},
swing: function( p, n, firstNum, diff ) {
return ((-Math.cos(p*Math.PI)/2) + 0.5) * diff + firstNum;
}
},
timers: [],
fx: function( elem, options, prop ) {
this.options = options;
this.elem = elem;
this.prop = prop;
if ( !options.orig ) {
options.orig = {};
}
}
});
jQuery.fx.prototype = {
// Simple function for setting a style value
update: function() {
if ( this.options.step ) {
this.options.step.call( this.elem, this.now, this );
}
(jQuery.fx.step[this.prop] || jQuery.fx.step._default)( this );
},
// Get the current size
cur: function() {
if ( this.elem[this.prop] != null && (!this.elem.style || this.elem.style[this.prop] == null) ) {
return this.elem[ this.prop ];
}
var r = parseFloat( jQuery.css( this.elem, this.prop ) );
return r && r > -10000 ? r : 0;
},
// Start an animation from one number to another
custom: function( from, to, unit ) {
var self = this,
fx = jQuery.fx;
this.startTime = jQuery.now();
this.start = from;
this.end = to;
this.unit = unit || this.unit || "px";
this.now = this.start;
this.pos = this.state = 0;
function t( gotoEnd ) {
return self.step(gotoEnd);
}
t.elem = this.elem;
if ( t() && jQuery.timers.push(t) && !timerId ) {
timerId = setInterval(fx.tick, fx.interval);
}
},
// Simple 'show' function
show: function() {
// Remember where we started, so that we can go back to it later
this.options.orig[this.prop] = jQuery.style( this.elem, this.prop );
this.options.show = true;
// Begin the animation
// Make sure that we start at a small width/height to avoid any
// flash of content
this.custom(this.prop === "width" || this.prop === "height" ? 1 : 0, this.cur());
// Start by showing the element
jQuery( this.elem ).show();
},
// Simple 'hide' function
hide: function() {
// Remember where we started, so that we can go back to it later
this.options.orig[this.prop] = jQuery.style( this.elem, this.prop );
this.options.hide = true;
// Begin the animation
this.custom(this.cur(), 0);
},
// Each step of an animation
step: function( gotoEnd ) {
var t = jQuery.now(), done = true;
if ( gotoEnd || t >= this.options.duration + this.startTime ) {
this.now = this.end;
this.pos = this.state = 1;
this.update();
this.options.curAnim[ this.prop ] = true;
for ( var i in this.options.curAnim ) {
if ( this.options.curAnim[i] !== true ) {
done = false;
}
}
if ( done ) {
// Reset the overflow
if ( this.options.overflow != null && !jQuery.support.shrinkWrapBlocks ) {
var elem = this.elem,
options = this.options;
jQuery.each( [ "", "X", "Y" ], function (index, value) {
elem.style[ "overflow" + value ] = options.overflow[index];
} );
}
// Hide the element if the "hide" operation was done
if ( this.options.hide ) {
jQuery(this.elem).hide();
}
// Reset the properties, if the item has been hidden or shown
if ( this.options.hide || this.options.show ) {
for ( var p in this.options.curAnim ) {
jQuery.style( this.elem, p, this.options.orig[p] );
}
}
// Execute the complete function
this.options.complete.call( this.elem );
}
return false;
} else {
var n = t - this.startTime;
this.state = n / this.options.duration;
// Perform the easing function, defaults to swing
var specialEasing = this.options.specialEasing && this.options.specialEasing[this.prop];
var defaultEasing = this.options.easing || (jQuery.easing.swing ? "swing" : "linear");
this.pos = jQuery.easing[specialEasing || defaultEasing](this.state, n, 0, 1, this.options.duration);
this.now = this.start + ((this.end - this.start) * this.pos);
// Perform the next step of the animation
this.update();
}
return true;
}
};
jQuery.extend( jQuery.fx, {
tick: function() {
var timers = jQuery.timers;
for ( var i = 0; i < timers.length; i++ ) {
if ( !timers[i]() ) {
timers.splice(i--, 1);
}
}
if ( !timers.length ) {
jQuery.fx.stop();
}
},
interval: 13,
stop: function() {
clearInterval( timerId );
timerId = null;
},
speeds: {
slow: 600,
fast: 200,
// Default speed
_default: 400
},
step: {
opacity: function( fx ) {
jQuery.style( fx.elem, "opacity", fx.now );
},
_default: function( fx ) {
if ( fx.elem.style && fx.elem.style[ fx.prop ] != null ) {
fx.elem.style[ fx.prop ] = (fx.prop === "width" || fx.prop === "height" ? Math.max(0, fx.now) : fx.now) + fx.unit;
} else {
fx.elem[ fx.prop ] = fx.now;
}
}
}
});
if ( jQuery.expr && jQuery.expr.filters ) {
jQuery.expr.filters.animated = function( elem ) {
return jQuery.grep(jQuery.timers, function( fn ) {
return elem === fn.elem;
}).length;
};
}
function defaultDisplay( nodeName ) {
if ( !elemdisplay[ nodeName ] ) {
var elem = jQuery("<" + nodeName + ">").appendTo("body"),
display = elem.css("display");
elem.remove();
if ( display === "none" || display === "" ) {
display = "block";
}
elemdisplay[ nodeName ] = display;
}
return elemdisplay[ nodeName ];
}
var rtable = /^t(?:able|d|h)$/i,
rroot = /^(?:body|html)$/i;
if ( "getBoundingClientRect" in document.documentElement ) {
jQuery.fn.offset = function( options ) {
var elem = this[0], box;
if ( options ) {
return this.each(function( i ) {
jQuery.offset.setOffset( this, options, i );
});
}
if ( !elem || !elem.ownerDocument ) {
return null;
}
if ( elem === elem.ownerDocument.body ) {
return jQuery.offset.bodyOffset( elem );
}
try {
box = elem.getBoundingClientRect();
} catch(e) {}
var doc = elem.ownerDocument,
docElem = doc.documentElement;
// Make sure we're not dealing with a disconnected DOM node
if ( !box || !jQuery.contains( docElem, elem ) ) {
return box || { top: 0, left: 0 };
}
var body = doc.body,
win = getWindow(doc),
clientTop = docElem.clientTop || body.clientTop || 0,
clientLeft = docElem.clientLeft || body.clientLeft || 0,
scrollTop = (win.pageYOffset || jQuery.support.boxModel && docElem.scrollTop || body.scrollTop ),
scrollLeft = (win.pageXOffset || jQuery.support.boxModel && docElem.scrollLeft || body.scrollLeft),
top = box.top + scrollTop - clientTop,
left = box.left + scrollLeft - clientLeft;
return { top: top, left: left };
};
} else {
jQuery.fn.offset = function( options ) {
var elem = this[0];
if ( options ) {
return this.each(function( i ) {
jQuery.offset.setOffset( this, options, i );
});
}
if ( !elem || !elem.ownerDocument ) {
return null;
}
if ( elem === elem.ownerDocument.body ) {
return jQuery.offset.bodyOffset( elem );
}
jQuery.offset.initialize();
var computedStyle,
offsetParent = elem.offsetParent,
prevOffsetParent = elem,
doc = elem.ownerDocument,
docElem = doc.documentElement,
body = doc.body,
defaultView = doc.defaultView,
prevComputedStyle = defaultView ? defaultView.getComputedStyle( elem, null ) : elem.currentStyle,
top = elem.offsetTop,
left = elem.offsetLeft;
while ( (elem = elem.parentNode) && elem !== body && elem !== docElem ) {
if ( jQuery.offset.supportsFixedPosition && prevComputedStyle.position === "fixed" ) {
break;
}
computedStyle = defaultView ? defaultView.getComputedStyle(elem, null) : elem.currentStyle;
top -= elem.scrollTop;
left -= elem.scrollLeft;
if ( elem === offsetParent ) {
top += elem.offsetTop;
left += elem.offsetLeft;
if ( jQuery.offset.doesNotAddBorder && !(jQuery.offset.doesAddBorderForTableAndCells && rtable.test(elem.nodeName)) ) {
top += parseFloat( computedStyle.borderTopWidth ) || 0;
left += parseFloat( computedStyle.borderLeftWidth ) || 0;
}
prevOffsetParent = offsetParent;
offsetParent = elem.offsetParent;
}
if ( jQuery.offset.subtractsBorderForOverflowNotVisible && computedStyle.overflow !== "visible" ) {
top += parseFloat( computedStyle.borderTopWidth ) || 0;
left += parseFloat( computedStyle.borderLeftWidth ) || 0;
}
prevComputedStyle = computedStyle;
}
if ( prevComputedStyle.position === "relative" || prevComputedStyle.position === "static" ) {
top += body.offsetTop;
left += body.offsetLeft;
}
if ( jQuery.offset.supportsFixedPosition && prevComputedStyle.position === "fixed" ) {
top += Math.max( docElem.scrollTop, body.scrollTop );
left += Math.max( docElem.scrollLeft, body.scrollLeft );
}
return { top: top, left: left };
};
}
jQuery.offset = {
initialize: function() {
var body = document.body, container = document.createElement("div"), innerDiv, checkDiv, table, td, bodyMarginTop = parseFloat( jQuery.css(body, "marginTop") ) || 0,
html = "<div style='position:absolute;top:0;left:0;margin:0;border:5px solid #000;padding:0;width:1px;height:1px;'><div></div></div><table style='position:absolute;top:0;left:0;margin:0;border:5px solid #000;padding:0;width:1px;height:1px;' cellpadding='0' cellspacing='0'><tr><td></td></tr></table>";
jQuery.extend( container.style, { position: "absolute", top: 0, left: 0, margin: 0, border: 0, width: "1px", height: "1px", visibility: "hidden" } );
container.innerHTML = html;
body.insertBefore( container, body.firstChild );
innerDiv = container.firstChild;
checkDiv = innerDiv.firstChild;
td = innerDiv.nextSibling.firstChild.firstChild;
this.doesNotAddBorder = (checkDiv.offsetTop !== 5);
this.doesAddBorderForTableAndCells = (td.offsetTop === 5);
checkDiv.style.position = "fixed";
checkDiv.style.top = "20px";
// safari subtracts parent border width here which is 5px
this.supportsFixedPosition = (checkDiv.offsetTop === 20 || checkDiv.offsetTop === 15);
checkDiv.style.position = checkDiv.style.top = "";
innerDiv.style.overflow = "hidden";
innerDiv.style.position = "relative";
this.subtractsBorderForOverflowNotVisible = (checkDiv.offsetTop === -5);
this.doesNotIncludeMarginInBodyOffset = (body.offsetTop !== bodyMarginTop);
body.removeChild( container );
body = container = innerDiv = checkDiv = table = td = null;
jQuery.offset.initialize = jQuery.noop;
},
bodyOffset: function( body ) {
var top = body.offsetTop,
left = body.offsetLeft;
jQuery.offset.initialize();
if ( jQuery.offset.doesNotIncludeMarginInBodyOffset ) {
top += parseFloat( jQuery.css(body, "marginTop") ) || 0;
left += parseFloat( jQuery.css(body, "marginLeft") ) || 0;
}
return { top: top, left: left };
},
setOffset: function( elem, options, i ) {
var position = jQuery.css( elem, "position" );
// set position first, in-case top/left are set even on static elem
if ( position === "static" ) {
elem.style.position = "relative";
}
var curElem = jQuery( elem ),
curOffset = curElem.offset(),
curCSSTop = jQuery.css( elem, "top" ),
curCSSLeft = jQuery.css( elem, "left" ),
calculatePosition = (position === "absolute" && jQuery.inArray('auto', [curCSSTop, curCSSLeft]) > -1),
props = {}, curPosition = {}, curTop, curLeft;
// need to be able to calculate position if either top or left is auto and position is absolute
if ( calculatePosition ) {
curPosition = curElem.position();
}
curTop = calculatePosition ? curPosition.top : parseInt( curCSSTop, 10 ) || 0;
curLeft = calculatePosition ? curPosition.left : parseInt( curCSSLeft, 10 ) || 0;
if ( jQuery.isFunction( options ) ) {
options = options.call( elem, i, curOffset );
}
if (options.top != null) {
props.top = (options.top - curOffset.top) + curTop;
}
if (options.left != null) {
props.left = (options.left - curOffset.left) + curLeft;
}
if ( "using" in options ) {
options.using.call( elem, props );
} else {
curElem.css( props );
}
}
};
jQuery.fn.extend({
position: function() {
if ( !this[0] ) {
return null;
}
var elem = this[0],
// Get *real* offsetParent
offsetParent = this.offsetParent(),
// Get correct offsets
offset = this.offset(),
parentOffset = rroot.test(offsetParent[0].nodeName) ? { top: 0, left: 0 } : offsetParent.offset();
// Subtract element margins
// note: when an element has margin: auto the offsetLeft and marginLeft
// are the same in Safari causing offset.left to incorrectly be 0
offset.top -= parseFloat( jQuery.css(elem, "marginTop") ) || 0;
offset.left -= parseFloat( jQuery.css(elem, "marginLeft") ) || 0;
// Add offsetParent borders
parentOffset.top += parseFloat( jQuery.css(offsetParent[0], "borderTopWidth") ) || 0;
parentOffset.left += parseFloat( jQuery.css(offsetParent[0], "borderLeftWidth") ) || 0;
// Subtract the two offsets
return {
top: offset.top - parentOffset.top,
left: offset.left - parentOffset.left
};
},
offsetParent: function() {
return this.map(function() {
var offsetParent = this.offsetParent || document.body;
while ( offsetParent && (!rroot.test(offsetParent.nodeName) && jQuery.css(offsetParent, "position") === "static") ) {
offsetParent = offsetParent.offsetParent;
}
return offsetParent;
});
}
});
// Create scrollLeft and scrollTop methods
jQuery.each( ["Left", "Top"], function( i, name ) {
var method = "scroll" + name;
jQuery.fn[ method ] = function(val) {
var elem = this[0], win;
if ( !elem ) {
return null;
}
if ( val !== undefined ) {
// Set the scroll offset
return this.each(function() {
win = getWindow( this );
if ( win ) {
win.scrollTo(
!i ? val : jQuery(win).scrollLeft(),
i ? val : jQuery(win).scrollTop()
);
} else {
this[ method ] = val;
}
});
} else {
win = getWindow( elem );
// Return the scroll offset
return win ? ("pageXOffset" in win) ? win[ i ? "pageYOffset" : "pageXOffset" ] :
jQuery.support.boxModel && win.document.documentElement[ method ] ||
win.document.body[ method ] :
elem[ method ];
}
};
});
function getWindow( elem ) {
return jQuery.isWindow( elem ) ?
elem :
elem.nodeType === 9 ?
elem.defaultView || elem.parentWindow :
false;
}
// Create innerHeight, innerWidth, outerHeight and outerWidth methods
jQuery.each([ "Height", "Width" ], function( i, name ) {
var type = name.toLowerCase();
// innerHeight and innerWidth
jQuery.fn["inner" + name] = function() {
return this[0] ?
parseFloat( jQuery.css( this[0], type, "padding" ) ) :
null;
};
// outerHeight and outerWidth
jQuery.fn["outer" + name] = function( margin ) {
return this[0] ?
parseFloat( jQuery.css( this[0], type, margin ? "margin" : "border" ) ) :
null;
};
jQuery.fn[ type ] = function( size ) {
// Get window width or height
var elem = this[0];
if ( !elem ) {
return size == null ? null : this;
}
if ( jQuery.isFunction( size ) ) {
return this.each(function( i ) {
var self = jQuery( this );
self[ type ]( size.call( this, i, self[ type ]() ) );
});
}
if ( jQuery.isWindow( elem ) ) {
// Everyone else use document.documentElement or document.body depending on Quirks vs Standards mode
return elem.document.compatMode === "CSS1Compat" && elem.document.documentElement[ "client" + name ] ||
elem.document.body[ "client" + name ];
// Get document width or height
} else if ( elem.nodeType === 9 ) {
// Either scroll[Width/Height] or offset[Width/Height], whichever is greater
return Math.max(
elem.documentElement["client" + name],
elem.body["scroll" + name], elem.documentElement["scroll" + name],
elem.body["offset" + name], elem.documentElement["offset" + name]
);
// Get or set width or height on the element
} else if ( size === undefined ) {
var orig = jQuery.css( elem, type ),
ret = parseFloat( orig );
return jQuery.isNaN( ret ) ? orig : ret;
// Set the width or height on the element (default to pixels if value is unitless)
} else {
return this.css( type, typeof size === "string" ? size : size + "px" );
}
};
});
})(window);
| zz-ms | trunk/zz-ms-v2.0/src/main/webapp/js/xheditor/jquery/jquery-1.4.4.src.js | JavaScript | asf20 | 183,184 |
html{height:100%;background-color:#FFFFFF;}
body,td,th{font-family:Arial,Helvetica,sans-serif;font-size:12px;}
body{height:100%;*height:90%;-moz-box-sizing:border-box;-webkit-box-sizing:border-box;box-sizing:border-box;}
.xhe-border{border:1px dotted #d3d3d3;}
.xhe-border th,.xhe-border td{border:1px dotted #d3d3d3;}
.editMode{margin:0px;padding:5px;overflow-y:auto;word-break:break-word;word-wrap:break-word;}
.editMode img:-moz-broken {-moz-force-broken-image-icon:1;height:24px;width:24px;}
.editMode embed{display:inline-block;border:1px dashed #FF4E4E;}
.editMode embed[type="application/x-shockwave-flash"]{background:url(img/flash.gif) center center no-repeat;}
.editMode embed[type="application/x-mplayer2"]{background:url(img/wmp.gif) center center no-repeat;}
.editMode .xhe-paste{position:absolute;left:-1000px;overflow:hidden;width:1px;height:1px;}
.editMode .xhe-anchor{display:inline-block;background: url(img/anchor.gif) no-repeat;border: 1px dotted #0000FF;width:16px;height:15px;overflow:hidden;}
.sourceMode{margin:0px;padding:0px;overflow:hidden;height:100%;}
.sourceMode textarea{*position:absolute;border:0px;margin:0px;padding:0px;width:100%;height:100%;overflow-y:auto;font-family:'Courier New',Courier,monospace !important;font-size:10pt;outline:0;}
.previewMode{margin:5px;padding:0px;}
.showBlocktag p,.showBlocktag h1,.showBlocktag h2,.showBlocktag h3,.showBlocktag h4,.showBlocktag h5,.showBlocktag h6,.showBlocktag pre,.showBlocktag address,.showBlocktag div{background:none no-repeat scroll right top;border:1px dotted gray;}
.showBlocktag p{background-image:url(img/tag-p.gif);}
.showBlocktag h1{background-image:url(img/tag-h1.gif);}
.showBlocktag h2{background-image:url(img/tag-h2.gif);}
.showBlocktag h3{background-image:url(img/tag-h3.gif);}
.showBlocktag h4{background-image:url(img/tag-h4.gif);}
.showBlocktag h5{background-image:url(img/tag-h5.gif);}
.showBlocktag h6{background-image:url(img/tag-h6.gif);}
.showBlocktag pre{background-image:url(img/tag-pre.gif);}
.showBlocktag address{background-image:url(img/tag-address.gif);}
.showBlocktag div{background-image:url(img/tag-div.gif);} | zz-ms | trunk/zz-ms-v2.0/src/main/webapp/js/xheditor/xheditor_skin/nostyle/iframe.css | CSS | asf20 | 2,164 |
.xhe_nostyle table, .xhe_nostyle tr, .xhe_nostyle td, .xhe_nostyle iframe {border:0; margin:0; padding:0; background:transparent;text-decoration:none; font-weight:normal; color:#000}
.xhe_nostyle table.xheLayout {display:inline-table;background:#FFF; border:1px solid #C5C5C5;width:100%;height:100%;}
.xhe_nostyle td.xheTool{padding:0px 3px;border-bottom:1px solid #C5C5C5;}
.xhe_nostyle td.xheTool span{float:left;margin:2px 0px;}
.xhe_nostyle td.xheTool br{clear:left;}
.xhe_nostyle span.xheGStart{display:none;}
.xhe_nostyle span.xheGEnd{display:none;}
.xhe_nostyle span.xheSeparator{display:block;height:22px;width:4px;margin:2px 2px !important;background:url(img/icons.gif) no-repeat -660px 0;}
.xhe_nostyle a.xheButton{display:inline-block;margin:1px;border:0px;cursor:pointer;text-decoration:none;}
.xhe_nostyle a.xheButton span{opacity:0.3; -ms-filter:'alpha(opacity=30)'; filter:alpha(opacity=30);}
.xhe_nostyle a.xheEnabled span{opacity:1; -ms-filter:'alpha(opacity=100)'; filter:alpha(opacity=100);}
.xhe_nostyle a.xheEnabled:hover {margin:0px;border:1px solid #999;background:#fff;}
.xhe_nostyle a.xheActive{margin:0px;border:1px solid #999; background:#fff;}
.xhe_nostyle a.xheButton span{display:block;margin:0px;height:20px;width:20px;overflow:hidden;}
.xhe_nostyle span.xheIcon{background:url(img/icons.gif) no-repeat 20px 20px}
.xhe_nostyle span.xheBtnCut {background-position:0 0}
.xhe_nostyle span.xheBtnCopy {background-position:-20px 0}
.xhe_nostyle span.xheBtnPaste {background-position:-40px 0}
.xhe_nostyle span.xheBtnPastetext {background-position:-60px 0}
.xhe_nostyle span.xheBtnBlocktag {background-position:-80px 0}
.xhe_nostyle span.xheBtnFontface {background-position:-100px 0}
.xhe_nostyle span.xheBtnFontSize {background-position:-120px 0}
.xhe_nostyle span.xheBtnBold {background-position:-140px 0}
.xhe_nostyle span.xheBtnItalic {background-position:-160px 0}
.xhe_nostyle span.xheBtnUnderline {background-position:-180px 0}
.xhe_nostyle span.xheBtnStrikethrough {background-position:-200px 0}
.xhe_nostyle span.xheBtnFontColor {background-position:-220px 0}
.xhe_nostyle span.xheBtnBackColor {background-position:-240px 0}
.xhe_nostyle span.xheBtnSelectAll {background-position:-260px 0}
.xhe_nostyle span.xheBtnRemoveformat {background-position:-280px 0}
.xhe_nostyle span.xheBtnAlign {background-position:-300px 0}
.xhe_nostyle span.xheBtnList {background-position:-320px 0}
.xhe_nostyle span.xheBtnOutdent {background-position:-340px 0}
.xhe_nostyle span.xheBtnIndent {background-position:-360px 0}
.xhe_nostyle span.xheBtnLink {background-position:-380px 0}
.xhe_nostyle span.xheBtnUnlink {background-position:-400px 0}
.xhe_nostyle span.xheBtnAnchor {background-position:-420px 0}
.xhe_nostyle span.xheBtnImg {background-position:-440px 0}
.xhe_nostyle span.xheBtnFlash {background-position:-460px 0}
.xhe_nostyle span.xheBtnMedia {background-position:-480px 0}
.xhe_nostyle span.xheBtnHr {background-position:-500px 0}
.xhe_nostyle span.xheBtnEmot {background-position:-520px 0}
.xhe_nostyle span.xheBtnTable {background-position:-540px 0}
.xhe_nostyle span.xheBtnSource {background-position:-560px 0}
.xhe_nostyle span.xheBtnPreview {background-position:-580px 0}
.xhe_nostyle span.xheBtnPrint {background-position:-600px 0}
.xhe_nostyle span.xheBtnFullscreen {background-position:-620px 0}
.xhe_nostyle span.xheBtnAbout {background-position:-640px 0}
.xhe_nostyle .xheIframeArea{height:100%;}
.xhe_nostyle iframe {display:block;background:#fff;width:100%;height:100%;}
#xheCntLine{display:none;position:absolute;z-index:1000001;background:#fff;height:1px;font-size:0;}
#xhePanel{display:none;position:absolute;z-index:1000000;border:#999 1px solid;background:#fff;text-align:left;}
#xheShadow{display:none;position:absolute;z-index:999999;background:#000;opacity:0.2; -ms-filter:'alpha(opacity=20)'; filter:alpha(opacity=20);}
.xheFixCancel{position:absolute;z-index:999998;background-color:#FFF;opacity:0; -ms-filter:'alpha(opacity=0)'; filter:alpha(opacity=0);}
.xheMenu{padding:2px;overflow-x:hidden;overflow-y:auto;max-height:230px;}
.xheMenu .xheMenuSeparator{margin:3px 0;border-top:1px solid #D8D8D8;}
.xheMenu a{display:block;padding:3px 20px 3px 3px;line-height:normal;font-size:12px;color:#000;text-decoration:none;white-space:nowrap;}
.xheMenu a:hover{background:#e5e5e5;text-decoration:none;color:#000;}
.xheMenu p,.xheMenu h1,.xheMenu h2,.xheMenu h3,.xheMenu h4,.xheMenu h5,.xheMenu h6,.xheMenu pre,.xheMenu address,.xheMenu div{margin:0}
.xheEmot div{padding:5px;overflow-x:hidden;overflow-y:auto;}
.xheEmot div a{display:inline-block;margin:3px;padding:3px;overflow:hidden;background-repeat:no-repeat;background-position:center;text-decoration:none;}
.xheEmot div a:hover{border:1px solid #999;padding:2px;}
.xheEmot ul{border-top:1px solid #999;list-style:none;padding:0 10px;margin:0;font-size:12px;}
.xheEmot li{float:left;margin:0 2px 5px 0;}
.xheEmot li a{background:#fff;display:block;padding:0 8px;text-decoration:none;color:#000;line-height:20px;}
.xheEmot li a:hover{text-decoration:underline;}
.xheEmot li.cur{border:1px solid #999;border-top:none;position:relative;bottom:1px;}
.xheEmot li.cur a{cursor:text;padding-top:1px;}
.xheEmot li.cur a:hover{text-decoration:none;}
.xheColor{padding:5px;}
.xheColor a{display:inline-block;margin:1px;border:#999 1px solid;width:17px;height:9px;font-size:0;}
.xheColor a:hover{border:#000 1px solid;}
.xheColor a img{display:none;}
.xheDialog{padding:10px;font-size:12px;font-family:monospace;}
.xheDialog a{text-decoration:underline;color:#00f;}
.xheDialog a:hover{text-decoration:underline;color:#00f}
.xheDialog div{padding:2px 0;}
.xheDialog input{
margin:0;border-width:1px;border-style:solid;font-size:12px;
*border-width:expression((type!="checkbox")?'1px':0);*padding:expression((type=="text")?'1px':'auto');*width:expression((type=="text")?'160px':'auto');*border-color:expression((type=="text")?'#ABADB3':'#fff #888 #888 #fff');*background:expression((type=="button")?'#F0F0F0':'#FFFFFF');*cursor:expression((type=="button")?'pointer':'');*font-size:expression((type=="button")?'13px':'12px');
}
.xheDialog textarea{font-size:12px;resize:none;border:1px solid #ccc;}
.xheDialog input[type=text]{padding:1px;width:160px;border-color:#ABADB3;}
.xheDialog input[type=button]{margin:0;border-color:#fff #888 #888 #fff;background:#F0F0F0;cursor:pointer;font-size:13px;}
.xheDialog input[type=file]{font-size:13px;}
.xheDialog input[type=checkbox]{border:0;}
.xheDialog select{margin:0;border:1px #ABADB3 solid;}
.xheDialog input,.xheDialog select,.xheDialog textarea{border-radius:3px;-moz-border-radius:3px;-webkit-border-radius:3px;}
.xheDialog input:focus,.xheDialog select:focus,.xheDialog textarea:focus{outline: 0;border-color: #EEC068;-webkit-box-shadow: 0 0 1px #EEC068;-moz-box-shadow: 0 0 1px #EEC068;box-shadow: 0 0 1px #EEC068;}
.xheDialog .xheUpload{position: relative;display:inline-block;width:164px;}
.xheDialog .xheUpload .xheBtn{position: absolute;top: 0px;left: 114px;width:50px;z-index: 1000001;padding:0;}
.xheDialog .xheUpload .xheFile{cursor:pointer;position: absolute;top: 0px;left: 0px;width:164px;opacity:0;-ms-filter:'alpha(opacity=0)';filter:alpha(opacity=0);z-index: 1000002;}
.xheDialog .xheUpload .xheText {position: absolute;width:107px;top: 0px;left: 0px;z-index: 1000003;}
.xheModal{
position: fixed;z-index: 1000010;text-align:left;top:50%;left:50%;background:#FFF;border:1px solid #BBB;font-size:12px;
_position:absolute;_margin-top:expression(0 - parseInt(this.offsetHeight / 2) + (TBWindowMargin = document.documentElement && document.documentElement.scrollTop || document.body.scrollTop) + 'px');
}
.xheModalTitle{padding:5px;background:#F0F0EE;border-bottom:1px solid #BBB;}
.xheModalClose{float:right;width:16px;height:16px;background:url(img/close.gif);cursor:pointer;}
.xheModalIfmWait{width:100%;height:100%;background:url(img/waiting.gif) no-repeat 50% 50%;margin:-16 0 0 -16;}
.xheModalShadow{
position:fixed;z-index:1000009;top:50%;left:50%;background:#000;opacity:0.2; -ms-filter:'alpha(opacity=20)'; filter:alpha(opacity=20);
_position:absolute;_margin-top:expression(0 - parseInt(this.offsetHeight / 2) + (TBWindowMargin = document.documentElement && document.documentElement.scrollTop || document.body.scrollTop) + 5 + 'px');
}
.xheModalOverlay{
position: fixed;z-index:1000008;top: 0px;left: 0px;height:100%;width:100%;background-color:#000;opacity:0.2; -ms-filter:'alpha(opacity=20)'; filter:alpha(opacity=20);
_position:absolute;_height:expression(Math.max(document.documentElement.clientHeight,document.documentElement.scrollHeight)+'px');_width:expression(Math.max(document.documentElement.clientWidth,document.documentElement.scrollWidth)+'px');
}
*html{
background-image:url(about:blank);
background-attachment:fixed;
}
.xheProgress{position:relative;width:280px;margin:auto;border:1px solid #C1C1C1;-moz-border-radius:3px;-webkit-border-radius:3px;border-radius:3px;background:url(img/progressbg.gif) #E9E9E9;}
.xheProgress span{position:absolute;left:0;top:0;width:100%;text-align:center;line-height:15px;font-size:12px;color:#222;text-shadow: 1px 1px 0 #eee;}
.xheProgress div{height:15px;width:1px;background:url(img/progress.gif) #31C135;}
.xhe_Fullfix{overflow:hidden;}
.xhe_Fullfix body{width:100%;height:100%;}
.xhe_Fullscreen{
top:0px;left:0px;position:fixed;z-index:100000;width:100%;height:100%;background:#fff;
_position:absolute;_top:expression((document.compatMode?documentElement.scrollTop:document.body.scrollTop)+'px');_width:expression((document.compatMode?documentElement.offsetWidth:document.body.offsetWidth) + 'px');_height:expression((document.compatMode?documentElement.offsetHeight:document.body.offsetHeight) + 'px');
}
.xheHideArea{position:absolute;top:-1000px;left:-1000px;visibility:hidden;} | zz-ms | trunk/zz-ms-v2.0/src/main/webapp/js/xheditor/xheditor_skin/nostyle/ui.css | CSS | asf20 | 9,967 |
html{height:100%;background-color:#FFFFFF;}
body,td,th{font-family:Arial,Helvetica,sans-serif;font-size:12px;}
body{height:100%;*height:90%;-moz-box-sizing:border-box;-webkit-box-sizing:border-box;box-sizing:border-box;}
.xhe-border{border:1px dotted #d3d3d3;}
.xhe-border th,.xhe-border td{border:1px dotted #d3d3d3;}
.editMode{margin:0px;padding:5px;overflow-y:auto;word-break:break-word;word-wrap:break-word;}
.editMode img:-moz-broken {-moz-force-broken-image-icon:1;height:24px;width:24px;}
.editMode embed{display:inline-block;border:1px dashed #FF4E4E;}
.editMode embed[type="application/x-shockwave-flash"]{background:url(img/flash.gif) center center no-repeat;}
.editMode embed[type="application/x-mplayer2"]{background:url(img/wmp.gif) center center no-repeat;}
.editMode .xhe-paste{position:absolute;left:-1000px;overflow:hidden;width:1px;height:1px;}
.editMode .xhe-anchor{display:inline-block;background: url(img/anchor.gif) no-repeat;border: 1px dotted #0000FF;width:16px;height:15px;overflow:hidden;}
.sourceMode{margin:0px;padding:0px;overflow:hidden;height:100%;}
.sourceMode textarea{*position:absolute;border:0px;margin:0px;padding:0px;width:100%;height:100%;overflow-y:auto;font-family:'Courier New',Courier,monospace !important;font-size:10pt;resize:none;outline:0;}
.previewMode{margin:5px;padding:0px;}
.showBlocktag p,.showBlocktag h1,.showBlocktag h2,.showBlocktag h3,.showBlocktag h4,.showBlocktag h5,.showBlocktag h6,.showBlocktag pre,.showBlocktag address,.showBlocktag div{background:none no-repeat scroll right top;border:1px dotted gray;}
.showBlocktag p{background-image:url(img/tag-p.gif);}
.showBlocktag h1{background-image:url(img/tag-h1.gif);}
.showBlocktag h2{background-image:url(img/tag-h2.gif);}
.showBlocktag h3{background-image:url(img/tag-h3.gif);}
.showBlocktag h4{background-image:url(img/tag-h4.gif);}
.showBlocktag h5{background-image:url(img/tag-h5.gif);}
.showBlocktag h6{background-image:url(img/tag-h6.gif);}
.showBlocktag pre{background-image:url(img/tag-pre.gif);}
.showBlocktag address{background-image:url(img/tag-address.gif);}
.showBlocktag div{background-image:url(img/tag-div.gif);} | zz-ms | trunk/zz-ms-v2.0/src/main/webapp/js/xheditor/xheditor_skin/o2007blue/iframe.css | CSS | asf20 | 2,176 |
.xhe_o2007blue table, .xhe_o2007blue tr, .xhe_o2007blue td, .xhe_o2007blue iframe {border:0; margin:0; padding:0; background:transparent;text-decoration:none; font-weight:normal; color:#000}
.xhe_o2007blue table.xheLayout {display:inline-table;background:#E5EFFD; border:1px solid #ABC6DD;width:100%;height:100%;}
.xhe_o2007blue td.xheTool {padding:1px 3px;border-bottom:1px solid #ABC6DD;}
.xhe_o2007blue td.xheTool span{float:left;margin:2px 0px;}
.xhe_o2007blue td.xheTool br{clear:left;}
.xhe_o2007blue span.xheGStart{display:block;width:1px;height:22px;background:url(img/buttonbg.gif) -22px 0;}
.xhe_o2007blue span.xheGEnd{display:block;width:1px;height:22px;background:url(img/buttonbg.gif) -22px 0;}
.xhe_o2007blue span.xheSeparator{display:block;height:22px;width:4px;}
.xhe_o2007blue a.xheButton{display:inline-block;padding:1px;border:0px;background:url(img/buttonbg.gif);cursor:pointer;text-decoration:none;}
.xhe_o2007blue a.xheButton span{opacity:0.3; -ms-filter:'alpha(opacity=30)'; filter:alpha(opacity=30);}
.xhe_o2007blue a.xheEnabled span{opacity:1; -ms-filter:'alpha(opacity=100)'; filter:alpha(opacity=100)}
.xhe_o2007blue a.xheEnabled:hover {background-color:#B2BBD0; background-position:0 -22px}
.xhe_o2007blue a.xheActive{background-color:#B2BBD0; background-position:0 -44px !important;}
.xhe_o2007blue a.xheButton span{display:block;margin:0px;height:20px;width:20px;overflow:hidden;}
.xhe_o2007blue span.xheIcon{background:url(img/icons.gif) no-repeat 20px 20px}
.xhe_o2007blue span.xheBtnCut {background-position:0 0}
.xhe_o2007blue span.xheBtnCopy {background-position:-20px 0}
.xhe_o2007blue span.xheBtnPaste {background-position:-40px 0}
.xhe_o2007blue span.xheBtnPastetext {background-position:-60px 0}
.xhe_o2007blue span.xheBtnBlocktag {background-position:-80px 0}
.xhe_o2007blue span.xheBtnFontface {background-position:-100px 0}
.xhe_o2007blue span.xheBtnFontSize {background-position:-120px 0}
.xhe_o2007blue span.xheBtnBold {background-position:-140px 0}
.xhe_o2007blue span.xheBtnItalic {background-position:-160px 0}
.xhe_o2007blue span.xheBtnUnderline {background-position:-180px 0}
.xhe_o2007blue span.xheBtnStrikethrough {background-position:-200px 0}
.xhe_o2007blue span.xheBtnFontColor {background-position:-220px 0}
.xhe_o2007blue span.xheBtnBackColor {background-position:-240px 0}
.xhe_o2007blue span.xheBtnSelectAll {background-position:-260px 0}
.xhe_o2007blue span.xheBtnRemoveformat {background-position:-280px 0}
.xhe_o2007blue span.xheBtnAlign {background-position:-300px 0}
.xhe_o2007blue span.xheBtnList {background-position:-320px 0}
.xhe_o2007blue span.xheBtnOutdent {background-position:-340px 0}
.xhe_o2007blue span.xheBtnIndent {background-position:-360px 0}
.xhe_o2007blue span.xheBtnLink {background-position:-380px 0}
.xhe_o2007blue span.xheBtnUnlink {background-position:-400px 0}
.xhe_o2007blue span.xheBtnAnchor {background-position:-420px 0}
.xhe_o2007blue span.xheBtnImg {background-position:-440px 0}
.xhe_o2007blue span.xheBtnFlash {background-position:-460px 0}
.xhe_o2007blue span.xheBtnMedia {background-position:-480px 0}
.xhe_o2007blue span.xheBtnHr {background-position:-500px 0}
.xhe_o2007blue span.xheBtnEmot {background-position:-520px 0}
.xhe_o2007blue span.xheBtnTable {background-position:-540px 0}
.xhe_o2007blue span.xheBtnSource {background-position:-560px 0}
.xhe_o2007blue span.xheBtnPreview {background-position:-580px 0}
.xhe_o2007blue span.xheBtnPrint {background-position:-600px 0}
.xhe_o2007blue span.xheBtnFullscreen {background-position:-620px 0}
.xhe_o2007blue span.xheBtnAbout {background-position:-640px 0}
.xhe_o2007blue .xheIframeArea{height:100%;}
.xhe_o2007blue iframe {display:block;background:#fff;width:100%;height:100%;}
#xheCntLine{display:none;position:absolute;z-index:1000001;background:#fff;height:1px;font-size:0;}
#xhePanel{display:none;position:absolute;z-index:1000000;border:#ABC6DD 1px solid;background:#FDFEFF;text-align:left;}
#xheShadow{display:none;position:absolute;z-index:999999;background:#000;opacity:0.2; -ms-filter:'alpha(opacity=20)'; filter:alpha(opacity=20);}
.xheFixCancel{position:absolute;z-index:999998;background-color:#FFF;opacity:0; -ms-filter:'alpha(opacity=0)'; filter:alpha(opacity=0);}
.xheMenu{padding:2px;overflow-x:hidden;overflow-y:auto;max-height:230px;}
.xheMenu .xheMenuSeparator{margin:3px 0;border-top:1px solid #D8D8D8;}
.xheMenu a{display:block;padding:3px 20px 3px 3px;line-height:normal;font-size:12px;color:#000;text-decoration:none;white-space:nowrap;}
.xheMenu a:hover{background:#C6DAE9;text-decoration:none;color:#000;}
.xheMenu p,.xheMenu h1,.xheMenu h2,.xheMenu h3,.xheMenu h4,.xheMenu h5,.xheMenu h6,.xheMenu pre,.xheMenu address,.xheMenu div{margin:0}
.xheEmot div{padding:5px;overflow-x:hidden;overflow-y:auto;}
.xheEmot div a{display:inline-block;margin:3px;padding:3px;overflow:hidden;background-repeat:no-repeat;background-position:center;text-decoration:none;}
.xheEmot div a:hover{border:1px solid #ABC6DD;padding:2px;}
.xheEmot ul{border-top:1px solid #ABC6DD;list-style:none;padding:0 10px;margin:0;font-size:12px;}
.xheEmot li{float:left;margin:0 2px 5px 0;}
.xheEmot li a{background:#fff;display:block;padding:0 8px;text-decoration:none;color:#000;line-height:20px;}
.xheEmot li a:hover{text-decoration:underline;}
.xheEmot li.cur{border:1px solid #ABC6DD;border-top:none;position:relative;bottom:1px;}
.xheEmot li.cur a{cursor:text;padding-top:1px;}
.xheEmot li.cur a:hover{text-decoration:none;}
.xheColor{padding:5px;}
.xheColor a{display:inline-block;margin:1px;border:#999 1px solid;width:17px;height:9px;font-size:0;}
.xheColor a:hover{border:#000 1px solid;}
.xheColor a img{display:none;}
.xheDialog{padding:10px;font-size:12px;font-family:monospace;}
.xheDialog a{text-decoration:underline;color:#00f;}
.xheDialog a:hover{text-decoration:underline;color:#00f}
.xheDialog div{padding:2px 0px;}
.xheDialog input{
margin:0;border-width:1px;border-style:solid;font-size:12px;
*border-width:expression((type!="checkbox")?'1px':0);*padding:expression((type=="text")?'1px':'auto');*width:expression((type=="text")?'160px':'auto');*border-color:expression((type=="text")?'#ABADB3':'#fff #888 #888 #fff');*background:expression((type=="button")?'#F0F0F0':'#FFFFFF');*cursor:expression((type=="button")?'pointer':'');*font-size:expression((type=="button")?'13px':'12px');
}
.xheDialog textarea{font-size:12px;resize:none;border:1px solid #ccc;}
.xheDialog input[type=text]{padding:1px;width:160px;border-color:#ABADB3;}
.xheDialog input[type=button]{margin:0;border-color:#fff #888 #888 #fff;background:#F0F0F0;cursor:pointer;font-size:13px;}
.xheDialog input[type=file]{font-size:13px;}
.xheDialog input[type=checkbox]{border:0;}
.xheDialog select{margin:0;border:1px #ABADB3 solid;}
.xheDialog input,.xheDialog select,.xheDialog textarea{border-radius:3px;-moz-border-radius:3px;-webkit-border-radius:3px;}
.xheDialog input:focus,.xheDialog select:focus,.xheDialog textarea:focus{outline: 0;border-color: #EEC068;-webkit-box-shadow: 0 0 1px #EEC068;-moz-box-shadow: 0 0 1px #EEC068;box-shadow: 0 0 1px #EEC068;}
.xheDialog .xheUpload{position: relative;display:inline-block;width:164px;}
.xheDialog .xheUpload .xheBtn{position: absolute;top: 0px;left: 114px;width:50px;z-index: 1000001;padding:0;}
.xheDialog .xheUpload .xheFile{cursor:pointer;position: absolute;top: 0px;left: 0px;width:164px;opacity:0;-ms-filter:'alpha(opacity=0)';filter:alpha(opacity=0);z-index: 1000002;}
.xheDialog .xheUpload .xheText {position: absolute;width:107px;top: 0px;left: 0px;z-index: 1000003;}
.xheModal{
position: fixed;z-index: 1000010;text-align:left;top:50%;left:50%;background:#FFF;border:1px solid #ABC6DD;font-size:12px;
_position:absolute;_margin-top:expression(0 - parseInt(this.offsetHeight / 2) + (TBWindowMargin = document.documentElement && document.documentElement.scrollTop || document.body.scrollTop) + 'px');
}
.xheModalTitle{padding:5px;background:#D1DEEF;border-bottom:1px solid #ABC6DD;}
.xheModalClose{float:right;width:16px;height:16px;background:url(img/close.gif);cursor:pointer;}
.xheModalIfmWait{width:100%;height:100%;background:url(img/waiting.gif) no-repeat 50% 50%;margin:-16 0 0 -16;}
.xheModalShadow{
position:fixed;z-index:1000009;top:50%;left:50%;background:#000;opacity:0.2; -ms-filter:'alpha(opacity=20)'; filter:alpha(opacity=20);
_position:absolute;_margin-top:expression(0 - parseInt(this.offsetHeight / 2) + (TBWindowMargin = document.documentElement && document.documentElement.scrollTop || document.body.scrollTop) + 5 + 'px');
}
.xheModalOverlay{
position: fixed;z-index:1000008;top: 0px;left: 0px;height:100%;width:100%;background-color:#000;opacity:0.2; -ms-filter:'alpha(opacity=20)'; filter:alpha(opacity=20);
_position:absolute;_height:expression(Math.max(document.documentElement.clientHeight,document.documentElement.scrollHeight)+'px');_width:expression(Math.max(document.documentElement.clientWidth,document.documentElement.scrollWidth)+'px');
}
*html{
background-image:url(about:blank);
background-attachment:fixed;
}
.xheProgress{position:relative;width:280px;margin:auto;border:1px solid #C1C1C1;-moz-border-radius:3px;-webkit-border-radius:3px;border-radius:3px;background:url(img/progressbg.gif) #E9E9E9;}
.xheProgress span{position:absolute;left:0;top:0;width:100%;text-align:center;line-height:15px;font-size:12px;color:#000;text-shadow: 1px 1px 0 #eee;}
.xheProgress div{height:15px;width:1px;background:url(img/progress.gif) #31C135;}
.xhe_Fullfix{overflow:hidden;}
.xhe_Fullfix body{width:100%;height:100%;}
.xhe_Fullscreen{
top:0px;left:0px;position:fixed;z-index:100000;width:100%;height:100%;background:#fff;
_position:absolute;_top:expression((document.compatMode?documentElement.scrollTop:document.body.scrollTop)+'px');_width:expression((document.compatMode?documentElement.offsetWidth:document.body.offsetWidth) + 'px');_height:expression((document.compatMode?documentElement.offsetHeight:document.body.offsetHeight) + 'px');
}
.xheHideArea{position:absolute;top:-1000px;left:-1000px;visibility:hidden;} | zz-ms | trunk/zz-ms-v2.0/src/main/webapp/js/xheditor/xheditor_skin/o2007blue/ui.css | CSS | asf20 | 10,203 |
html{height:100%;background-color:#FFFFFF;}
body,td,th{font-family:Arial,Helvetica,sans-serif;font-size:12px;}
body{height:100%;*height:90%;-moz-box-sizing:border-box;-webkit-box-sizing:border-box;box-sizing:border-box;}
.xhe-border{border:1px dotted #d3d3d3;}
.xhe-border th,.xhe-border td{border:1px dotted #d3d3d3;}
.wordImage{border:1px dotted #c00;background:url(img/wordimg.gif) #ffc center center no-repeat;}
.editMode{margin:0px;padding:5px;overflow-y:auto;word-break:break-word;word-wrap:break-word;}
.editMode img:-moz-broken {-moz-force-broken-image-icon:1;height:24px;width:24px;}
.editMode embed{display:inline-block;border:1px dotted #c00;}
.editMode embed[type="application/x-shockwave-flash"]{background:url(img/flash.gif) #ffc center center no-repeat;}
.editMode embed[type="application/x-mplayer2"]{background:url(img/wmp.gif) center center no-repeat;}
.editMode .xhe-paste{position:absolute;left:-1000px;overflow:hidden;width:1px;height:1px;}
.editMode .xhe-anchor{display:inline-block;background: url(img/anchor.gif) no-repeat;border: 1px dotted #0000FF;width:16px;height:15px;overflow:hidden;}
.sourceMode{margin:0px;padding:0px;overflow:hidden;height:100%;}
.sourceMode textarea{*position:absolute;border:0px;margin:0px;padding:0px;width:100%;height:100%;overflow:auto;font-family:'Courier New',Courier,monospace !important;font-size:10pt;resize:none;outline:0;}
.previewMode{margin:5px;padding:0px;}
.showBlocktag p,.showBlocktag h1,.showBlocktag h2,.showBlocktag h3,.showBlocktag h4,.showBlocktag h5,.showBlocktag h6,.showBlocktag pre,.showBlocktag address,.showBlocktag div{background:none no-repeat scroll right top;border:1px dotted gray;}
.showBlocktag p{background-image:url(img/tag-p.gif);}
.showBlocktag h1{background-image:url(img/tag-h1.gif);}
.showBlocktag h2{background-image:url(img/tag-h2.gif);}
.showBlocktag h3{background-image:url(img/tag-h3.gif);}
.showBlocktag h4{background-image:url(img/tag-h4.gif);}
.showBlocktag h5{background-image:url(img/tag-h5.gif);}
.showBlocktag h6{background-image:url(img/tag-h6.gif);}
.showBlocktag pre{background-image:url(img/tag-pre.gif);}
.showBlocktag address{background-image:url(img/tag-address.gif);}
.showBlocktag div{background-image:url(img/tag-div.gif);} | zz-ms | trunk/zz-ms-v2.0/src/main/webapp/js/xheditor/xheditor_skin/default/iframe.css | CSS | asf20 | 2,277 |
.xhe_default table, .xhe_default tr, .xhe_default td, .xhe_default iframe {border:0; margin:0; padding:0; background:transparent;text-decoration:none; font-weight:normal; color:#000}
.xhe_default table.xheLayout {display:inline-table;background:#F0F0EE; border:1px solid #C5C5C5;width:100%;height:100%;}
.xhe_default td.xheTool{padding:0px 3px;border-bottom:1px solid #C5C5C5;}
.xhe_default td.xheTool span{float:left;margin:2px 0px;}
.xhe_default td.xheTool br{clear:left;}
.xhe_default span.xheGStart{display:none;}
.xhe_default span.xheGEnd{display:none;}
.xhe_default span.xheSeparator{display:block;height:22px;width:4px;margin:2px 2px !important;background:url(img/icons.gif) no-repeat -660px 0;}
.xhe_default a.xheButton{display:inline-block;margin:1px;border:0px;cursor:pointer;text-decoration:none;}
.xhe_default a.xheButton span{opacity:0.3; -ms-filter:'alpha(opacity=30)'; filter:alpha(opacity=30);}
.xhe_default a.xheEnabled span{opacity:1; -ms-filter:'alpha(opacity=100)'; filter:alpha(opacity=100);}
.xhe_default a.xheEnabled:hover {margin:0px;border:1px solid #999;background:#fff;}
.xhe_default a.xheActive{margin:0px;border:1px solid #999; background:#fff;}
.xhe_default a.xheButton span{display:block;margin:0px;height:20px;width:20px;overflow:hidden;}
.xhe_default span.xheIcon{background:url(img/icons.gif) no-repeat 20px 20px}
.xhe_default span.xheBtnCut {background-position:0 0}
.xhe_default span.xheBtnCopy {background-position:-20px 0}
.xhe_default span.xheBtnPaste {background-position:-40px 0}
.xhe_default span.xheBtnPastetext {background-position:-60px 0}
.xhe_default span.xheBtnBlocktag {background-position:-80px 0}
.xhe_default span.xheBtnFontface {background-position:-100px 0}
.xhe_default span.xheBtnFontSize {background-position:-120px 0}
.xhe_default span.xheBtnBold {background-position:-140px 0}
.xhe_default span.xheBtnItalic {background-position:-160px 0}
.xhe_default span.xheBtnUnderline {background-position:-180px 0}
.xhe_default span.xheBtnStrikethrough {background-position:-200px 0}
.xhe_default span.xheBtnFontColor {background-position:-220px 0}
.xhe_default span.xheBtnBackColor {background-position:-240px 0}
.xhe_default span.xheBtnSelectAll {background-position:-260px 0}
.xhe_default span.xheBtnRemoveformat {background-position:-280px 0}
.xhe_default span.xheBtnAlign {background-position:-300px 0}
.xhe_default span.xheBtnList {background-position:-320px 0}
.xhe_default span.xheBtnOutdent {background-position:-340px 0}
.xhe_default span.xheBtnIndent {background-position:-360px 0}
.xhe_default span.xheBtnLink {background-position:-380px 0}
.xhe_default span.xheBtnUnlink {background-position:-400px 0}
.xhe_default span.xheBtnAnchor {background-position:-420px 0}
.xhe_default span.xheBtnImg {background-position:-440px 0}
.xhe_default span.xheBtnFlash {background-position:-460px 0}
.xhe_default span.xheBtnMedia {background-position:-480px 0}
.xhe_default span.xheBtnHr {background-position:-500px 0}
.xhe_default span.xheBtnEmot {background-position:-520px 0}
.xhe_default span.xheBtnTable {background-position:-540px 0}
.xhe_default span.xheBtnSource {background-position:-560px 0}
.xhe_default span.xheBtnPreview {background-position:-580px 0}
.xhe_default span.xheBtnPrint {background-position:-600px 0}
.xhe_default span.xheBtnFullscreen {background-position:-620px 0}
.xhe_default span.xheBtnAbout {background-position:-640px 0}
.xhe_default .xheIframeArea{height:100%;}
.xhe_default iframe {display:block;background:#fff;width:100%;height:100%;}
#xheCntLine{display:none;position:absolute;z-index:1000001;background:#fff;height:1px;font-size:0;}
#xhePanel{display:none;position:absolute;z-index:1000000;border:#999 1px solid;background:#fff;text-align:left;}
#xheShadow{display:none;position:absolute;z-index:999999;background:#000;opacity:0.2; -ms-filter:'alpha(opacity=20)'; filter:alpha(opacity=20);}
.xheFixCancel{position:absolute;z-index:999998;background-color:#FFF;opacity:0; -ms-filter:'alpha(opacity=0)'; filter:alpha(opacity=0);}
.xheMenu{padding:2px;overflow-x:hidden;overflow-y:auto;max-height:230px;}
.xheMenu .xheMenuSeparator{margin:3px 0;border-top:1px solid #D8D8D8;}
.xheMenu a{display:block;padding:3px 20px 3px 3px;line-height:normal;font-size:12px;color:#000;text-decoration:none;white-space:nowrap;}
.xheMenu a:hover{background:#e5e5e5;text-decoration:none;color:#000;}
.xheMenu p,.xheMenu h1,.xheMenu h2,.xheMenu h3,.xheMenu h4,.xheMenu h5,.xheMenu h6,.xheMenu pre,.xheMenu address,.xheMenu div{margin:0}
.xheEmot div{padding:5px;overflow-x:hidden;overflow-y:auto;}
.xheEmot div a{display:inline-block;margin:3px;padding:3px;overflow:hidden;background-repeat:no-repeat;background-position:center;text-decoration:none;}
.xheEmot div a:hover{border:1px solid #999;padding:2px;}
.xheEmot ul{border-top:1px solid #999;list-style:none;padding:0 10px;margin:0;font-size:12px;}
.xheEmot li{float:left;margin:0 2px 5px 0;}
.xheEmot li a{background:#fff;display:block;padding:0 8px;text-decoration:none;color:#000;line-height:20px;}
.xheEmot li a:hover{text-decoration:underline;}
.xheEmot li.cur{border:1px solid #999;border-top:none;position:relative;bottom:1px;}
.xheEmot li.cur a{cursor:text;padding-top:1px;}
.xheEmot li.cur a:hover{text-decoration:none;}
.xheColor{padding:5px;}
.xheColor a{display:inline-block;margin:1px;border:#999 1px solid;width:17px;height:9px;font-size:0;}
.xheColor a:hover{border:#000 1px solid;}
.xheColor a img{display:none;}
.xheDialog{padding:10px;font-size:12px;font-family:monospace;}
.xheDialog a{text-decoration:underline;color:#00f;}
.xheDialog a:hover{text-decoration:underline;color:#00f}
.xheDialog div{padding:2px 0;}
.xheDialog input{
margin:0;border-width:1px;border-style:solid;font-size:12px;
*border-width:expression((type!="checkbox")?'1px':0);*padding:expression((type=="text")?'1px':'auto');*width:expression((type=="text")?'160px':'auto');*border-color:expression((type=="text")?'#ABADB3':'#fff #888 #888 #fff');*background:expression((type=="button")?'#F0F0F0':'#FFFFFF');*cursor:expression((type=="button")?'pointer':'');*font-size:expression((type=="button")?'13px':'12px');
}
.xheDialog textarea{font-size:12px;resize:none;border:1px solid #ccc;}
.xheDialog input[type=text]{padding:1px;width:160px;border-color:#ABADB3;}
.xheDialog input[type=button]{margin:0;border-color:#fff #888 #888 #fff;background:#F0F0F0;cursor:pointer;font-size:13px;}
.xheDialog input[type=file]{font-size:13px;}
.xheDialog input[type=checkbox]{border:0;}
.xheDialog select{margin:0;border:1px #ABADB3 solid;padding:1px;}
.xheDialog input,.xheDialog select,.xheDialog textarea{border-radius:3px;-moz-border-radius:3px;-webkit-border-radius:3px;}
.xheDialog input:focus,.xheDialog select:focus,.xheDialog textarea:focus{outline: 0;border-color: #EEC068;-webkit-box-shadow: 0 0 1px #EEC068;-moz-box-shadow: 0 0 1px #EEC068;box-shadow: 0 0 1px #EEC068;}
.xheDialog .xheUpload{position: relative;display:inline-block;width:164px;}
.xheDialog .xheUpload .xheBtn{position: absolute;top: 0px;left: 114px;width:50px;z-index: 1000001;padding:0;}
.xheDialog .xheUpload .xheFile{cursor:pointer;position: absolute;top: 0px;left: 0px;width:164px;opacity:0;-ms-filter:'alpha(opacity=0)';filter:alpha(opacity=0);z-index: 1000002;}
.xheDialog .xheUpload .xheText {position: absolute;width:107px;top: 0px;left: 0px;z-index: 1000003;}
.xheModal{
position: fixed;z-index: 1000010;text-align:left;top:50%;left:50%;background:#FFF;border:1px solid #BBB;font-size:12px;
_position:absolute;_margin-top:expression(0 - parseInt(this.offsetHeight / 2) + (TBWindowMargin = document.documentElement && document.documentElement.scrollTop || document.body.scrollTop) + 'px');
}
.xheModalTitle{padding:5px;background:#F0F0EE;border-bottom:1px solid #BBB;}
.xheModalClose{float:right;width:16px;height:16px;background:url(img/close.gif);cursor:pointer;}
.xheModalIfmWait{width:100%;height:100%;background:url(img/waiting.gif) no-repeat 50% 50%;margin:-16 0 0 -16;}
.xheModalShadow{
position:fixed;z-index:1000009;top:50%;left:50%;background:#000;opacity:0.2; -ms-filter:'alpha(opacity=20)'; filter:alpha(opacity=20);
_position:absolute;_margin-top:expression(0 - parseInt(this.offsetHeight / 2) + (TBWindowMargin = document.documentElement && document.documentElement.scrollTop || document.body.scrollTop) + 5 + 'px');
}
.xheModalOverlay{
position: fixed;z-index:1000008;top: 0px;left: 0px;height:100%;width:100%;background-color:#000;opacity:0.2; -ms-filter:'alpha(opacity=20)'; filter:alpha(opacity=20);
_position:absolute;_height:expression(Math.max(document.documentElement.clientHeight,document.documentElement.scrollHeight)+'px');_width:expression(Math.max(document.documentElement.clientWidth,document.documentElement.scrollWidth)+'px');
}
*html{
background-image:url(about:blank);
background-attachment:fixed;
}
.xheProgress{position:relative;width:280px;margin:auto;border:1px solid #C1C1C1;-moz-border-radius:3px;-webkit-border-radius:3px;border-radius:3px;background:url(img/progressbg.gif) #E9E9E9;}
.xheProgress span{position:absolute;left:0;top:0;width:100%;text-align:center;line-height:15px;font-size:12px;color:#222;text-shadow: 1px 1px 0 #eee;}
.xheProgress div{height:15px;width:1px;background:url(img/progress.gif) #31C135;}
.xhe_Fullfix{overflow:hidden;}
.xhe_Fullfix body{width:100%;height:100%;}
.xhe_Fullscreen{
top:0px;left:0px;position:fixed;z-index:100000;width:100%;height:100%;background:#fff;
_position:absolute;_top:expression((document.compatMode?documentElement.scrollTop:document.body.scrollTop)+'px');_width:expression((document.compatMode?documentElement.offsetWidth:document.body.offsetWidth) + 'px');_height:expression((document.compatMode?documentElement.offsetHeight:document.body.offsetHeight) + 'px');
}
.xheHideArea{position:absolute;top:-1000px;left:-1000px;visibility:hidden;} | zz-ms | trunk/zz-ms-v2.0/src/main/webapp/js/xheditor/xheditor_skin/default/ui.css | CSS | asf20 | 9,983 |
html{height:100%;background-color:#FFFFFF;}
body,td,th{font-family:Arial,Helvetica,sans-serif;font-size:12px;}
body{height:100%;*height:90%;-moz-box-sizing:border-box;-webkit-box-sizing:border-box;box-sizing:border-box;}
.xhe-border{border:1px dotted #d3d3d3;}
.xhe-border th,.xhe-border td{border:1px dotted #d3d3d3;}
.editMode{margin:0px;padding:5px;overflow-y:auto;word-break:break-word;word-wrap:break-word;}
.editMode img:-moz-broken {-moz-force-broken-image-icon:1;height:24px;width:24px;}
.editMode embed{display:inline-block;border:1px dashed #FF4E4E;}
.editMode embed[type="application/x-shockwave-flash"]{background:url(img/flash.gif) center center no-repeat;}
.editMode embed[type="application/x-mplayer2"]{background:url(img/wmp.gif) center center no-repeat;}
.editMode .xhe-paste{position:absolute;left:-1000px;overflow:hidden;width:1px;height:1px;}
.editMode .xhe-anchor{display:inline-block;background: url(img/anchor.gif) no-repeat;border: 1px dotted #0000FF;width:16px;height:15px;overflow:hidden;}
.sourceMode{margin:0px;padding:0px;overflow:hidden;height:100%;}
.sourceMode textarea{*position:absolute;border:0px;margin:0px;padding:0px;width:100%;height:100%;overflow-y:auto;font-family:'Courier New',Courier,monospace !important;font-size:10pt;resize:none;outline:0;}
.previewMode{margin:5px;padding:0px;}
.showBlocktag p,.showBlocktag h1,.showBlocktag h2,.showBlocktag h3,.showBlocktag h4,.showBlocktag h5,.showBlocktag h6,.showBlocktag pre,.showBlocktag address,.showBlocktag div{background:none no-repeat scroll right top;border:1px dotted gray;}
.showBlocktag p{background-image:url(img/tag-p.gif);}
.showBlocktag h1{background-image:url(img/tag-h1.gif);}
.showBlocktag h2{background-image:url(img/tag-h2.gif);}
.showBlocktag h3{background-image:url(img/tag-h3.gif);}
.showBlocktag h4{background-image:url(img/tag-h4.gif);}
.showBlocktag h5{background-image:url(img/tag-h5.gif);}
.showBlocktag h6{background-image:url(img/tag-h6.gif);}
.showBlocktag pre{background-image:url(img/tag-pre.gif);}
.showBlocktag address{background-image:url(img/tag-address.gif);}
.showBlocktag div{background-image:url(img/tag-div.gif);} | zz-ms | trunk/zz-ms-v2.0/src/main/webapp/js/xheditor/xheditor_skin/vista/iframe.css | CSS | asf20 | 2,176 |
.xhe_vista table, .xhe_vista tr, .xhe_vista td, .xhe_vista iframe {border:0; margin:0; padding:0; background:transparent;text-decoration:none; font-weight:normal; color:#000}
.xhe_vista table.xheLayout {display:inline-table;background:#E0E8F5; border:1px solid #99BBE8;width:100%;height:100%;}
.xhe_vista td.xheTool {padding:1px 3px;border-bottom:1px solid #99BBE8;}
.xhe_vista td.xheTool span{float:left;margin:2px 0px;}
.xhe_vista td.xheTool br{clear:left;}
.xhe_vista span.xheGStart{display:block;width:4px;height:22px;background:url(img/buttonbg.gif) -22px 0;}
.xhe_vista span.xheGEnd{display:block;width:4px;height:22px;background:url(img/buttonbg.gif) -26px 0;}
.xhe_vista span.xheSeparator{display:block;height:22px;width:4px;}
.xhe_vista a.xheButton{display:inline-block;padding:1px;border:0px;background:url(img/buttonbg.gif);cursor:pointer;text-decoration:none;}
.xhe_vista a.xheButton span{opacity:0.3; -ms-filter:'alpha(opacity=30)'; filter:alpha(opacity=30);}
.xhe_vista a.xheEnabled span{opacity:1; -ms-filter:'alpha(opacity=100)'; filter:alpha(opacity=100);}
.xhe_vista a.xheEnabled:hover {background-color:#B2BBD0; background-position:0 -22px}
.xhe_vista a.xheActive{background-color:#B2BBD0; background-position:0 -44px !important;}
.xhe_vista a.xheButton span{display:block;margin:0px;height:20px;width:20px;overflow:hidden;}
.xhe_vista span.xheIcon{background:url(img/icons.gif) no-repeat 20px 20px}
.xhe_vista span.xheBtnCut {background-position:0 0}
.xhe_vista span.xheBtnCopy {background-position:-20px 0}
.xhe_vista span.xheBtnPaste {background-position:-40px 0}
.xhe_vista span.xheBtnPastetext {background-position:-60px 0}
.xhe_vista span.xheBtnBlocktag {background-position:-80px 0}
.xhe_vista span.xheBtnFontface {background-position:-100px 0}
.xhe_vista span.xheBtnFontSize {background-position:-120px 0}
.xhe_vista span.xheBtnBold {background-position:-140px 0}
.xhe_vista span.xheBtnItalic {background-position:-160px 0}
.xhe_vista span.xheBtnUnderline {background-position:-180px 0}
.xhe_vista span.xheBtnStrikethrough {background-position:-200px 0}
.xhe_vista span.xheBtnFontColor {background-position:-220px 0}
.xhe_vista span.xheBtnBackColor {background-position:-240px 0}
.xhe_vista span.xheBtnSelectAll {background-position:-260px 0}
.xhe_vista span.xheBtnRemoveformat {background-position:-280px 0}
.xhe_vista span.xheBtnAlign {background-position:-300px 0}
.xhe_vista span.xheBtnList {background-position:-320px 0}
.xhe_vista span.xheBtnOutdent {background-position:-340px 0}
.xhe_vista span.xheBtnIndent {background-position:-360px 0}
.xhe_vista span.xheBtnLink {background-position:-380px 0}
.xhe_vista span.xheBtnUnlink {background-position:-400px 0}
.xhe_vista span.xheBtnAnchor {background-position:-420px 0}
.xhe_vista span.xheBtnImg {background-position:-440px 0}
.xhe_vista span.xheBtnFlash {background-position:-460px 0}
.xhe_vista span.xheBtnMedia {background-position:-480px 0}
.xhe_vista span.xheBtnHr {background-position:-500px 0}
.xhe_vista span.xheBtnEmot {background-position:-520px 0}
.xhe_vista span.xheBtnTable {background-position:-540px 0}
.xhe_vista span.xheBtnSource {background-position:-560px 0}
.xhe_vista span.xheBtnPreview {background-position:-580px 0}
.xhe_vista span.xheBtnPrint {background-position:-600px 0}
.xhe_vista span.xheBtnFullscreen {background-position:-620px 0}
.xhe_vista span.xheBtnAbout {background-position:-640px 0}
.xhe_vista .xheIframeArea{height:100%;}
.xhe_vista iframe {display:block;background:#fff;width:100%;height:100%;}
#xheCntLine{display:none;position:absolute;z-index:1000001;background:#fff;height:1px;font-size:0;}
#xhePanel{display:none;position:absolute;z-index:1000000;border:#99BBE8 1px solid;background:#FDFEFF;text-align:left;}
#xheShadow{display:none;position:absolute;z-index:999999;background:#000;opacity:0.2; -ms-filter:'alpha(opacity=20)'; filter:alpha(opacity=20);}
.xheFixCancel{position:absolute;z-index:999998;background-color:#FFF;opacity:0; -ms-filter:'alpha(opacity=0)'; filter:alpha(opacity=0);}
.xheMenu{padding:2px;overflow-x:hidden;overflow-y:auto;max-height:230px;}
.xheMenu .xheMenuSeparator{margin:3px 0;border-top:1px solid #D8D8D8;}
.xheMenu a{display:block;padding:3px 20px 3px 3px;line-height:normal;font-size:12px;color:#000;text-decoration:none;white-space:nowrap;}
.xheMenu a:hover{background:#B8CFEE;text-decoration:none;color:#000;}
.xheMenu p,.xheMenu h1,.xheMenu h2,.xheMenu h3,.xheMenu h4,.xheMenu h5,.xheMenu h6,.xheMenu pre,.xheMenu address,.xheMenu div{margin:0}
.xheEmot div{padding:5px;overflow-x:hidden;overflow-y:auto;}
.xheEmot div a{display:inline-block;margin:3px;padding:3px;overflow:hidden;background-repeat:no-repeat;background-position:center;text-decoration:none;}
.xheEmot div a:hover{border:1px solid #99BBE8;padding:2px;}
.xheEmot ul{border-top:1px solid #99BBE8;list-style:none;padding:0 10px;margin:0;font-size:12px;}
.xheEmot li{float:left;margin:0 2px 5px 0;}
.xheEmot li a{background:#fff;display:block;padding:0 8px;text-decoration:none;color:#000;line-height:20px;}
.xheEmot li a:hover{text-decoration:underline;}
.xheEmot li.cur{border:1px solid #99BBE8;border-top:none;position:relative;bottom:1px;}
.xheEmot li.cur a{cursor:text;padding-top:1px;}
.xheEmot li.cur a:hover{text-decoration:none;}
.xheColor{padding:5px;}
.xheColor a{display:inline-block;margin:1px;border:#999 1px solid;width:17px;height:9px;font-size:0;}
.xheColor a:hover{border:#000 1px solid;}
.xheColor a img{display:none;}
.xheDialog{padding:10px;font-size:12px;font-family:monospace;}
.xheDialog a{text-decoration:underline;color:#00f;}
.xheDialog a:hover{text-decoration:underline;color:#00f}
.xheDialog div{padding:2px 0px;}
.xheDialog input{
margin:0;border-width:1px;border-style:solid;font-size:12px;
*border-width:expression((type!="checkbox")?'1px':0);*padding:expression((type=="text")?'1px':'auto');*width:expression((type=="text")?'160px':'auto');*border-color:expression((type=="text")?'#ABADB3':'#fff #888 #888 #fff');*background:expression((type=="button")?'#F0F0F0':'#FFFFFF');*cursor:expression((type=="button")?'pointer':'');*font-size:expression((type=="button")?'13px':'12px');
}
.xheDialog textarea{font-size:12px;resize:none;border:1px solid #ccc;}
.xheDialog input[type=text]{padding:1px;width:160px;border-color:#ABADB3;}
.xheDialog input[type=button]{margin:0;border-color:#fff #888 #888 #fff;background:#F0F0F0;cursor:pointer;font-size:13px;}
.xheDialog input[type=file]{font-size:13px;}
.xheDialog input[type=checkbox]{border:0;}
.xheDialog select{margin:0;border:1px #ABADB3 solid;}
.xheDialog input,.xheDialog select,.xheDialog textarea{border-radius:3px;-moz-border-radius:3px;-webkit-border-radius:3px;}
.xheDialog input:focus,.xheDialog select:focus,.xheDialog textarea:focus{outline: 0;border-color: #EEC068;-webkit-box-shadow: 0 0 1px #EEC068;-moz-box-shadow: 0 0 1px #EEC068;box-shadow: 0 0 1px #EEC068;}
.xheDialog .xheUpload{position: relative;display:inline-block;width:164px;}
.xheDialog .xheUpload .xheBtn{position: absolute;top: 0px;left: 114px;width:50px;z-index: 1000001;padding:0;}
.xheDialog .xheUpload .xheFile{cursor:pointer;position: absolute;top: 0px;left: 0px;width:164px;opacity:0;-ms-filter:'alpha(opacity=0)';filter:alpha(opacity=0);z-index: 1000002;}
.xheDialog .xheUpload .xheText {position: absolute;width:107px;top: 0px;left: 0px;z-index: 1000003;}
.xheModal{
position: fixed;z-index: 1000010;text-align:left;top:50%;left:50%;background:#FFF;border:1px solid #99BBE8;font-size:12px;
_position:absolute;_margin-top:expression(0 - parseInt(this.offsetHeight / 2) + (TBWindowMargin = document.documentElement && document.documentElement.scrollTop || document.body.scrollTop) + 'px');
}
.xheModalTitle{padding:3px;line-height:18px;background:url(img/titlebg.gif) repeat-x;border-bottom:1px solid #99BBE8;}
.xheModalClose{float:right;width:30px;height:18px;background:url(img/close.gif);cursor:pointer;}
.xheModalIfmWait{width:100%;height:100%;background:url(img/waiting.gif) no-repeat 50% 50%;margin:-16 0 0 -16;}
.xheModalShadow{
position:fixed;z-index:1000009;top:50%;left:50%;background:#000;opacity:0.2; -ms-filter:'alpha(opacity=20)'; filter:alpha(opacity=20);
_position:absolute;_margin-top:expression(0 - parseInt(this.offsetHeight / 2) + (TBWindowMargin = document.documentElement && document.documentElement.scrollTop || document.body.scrollTop) + 5 + 'px');
}
.xheModalOverlay{
position: fixed;z-index:1000008;top: 0px;left: 0px;height:100%;width:100%;background-color:#000;opacity:0.2; -ms-filter:'alpha(opacity=20)'; filter:alpha(opacity=20);
_position:absolute;_height:expression(Math.max(document.documentElement.clientHeight,document.documentElement.scrollHeight)+'px');_width:expression(Math.max(document.documentElement.clientWidth,document.documentElement.scrollWidth)+'px');
}
*html{
background-image:url(about:blank);
background-attachment:fixed;
}
.xheProgress{position:relative;width:280px;margin:auto;border:1px solid #C1C1C1;-moz-border-radius:3px;-webkit-border-radius:3px;border-radius:3px;background:url(img/progressbg.gif) #E9E9E9;}
.xheProgress span{position:absolute;left:0;top:0;width:100%;text-align:center;line-height:15px;font-size:12px;color:#000;text-shadow: 1px 1px 0 #eee;}
.xheProgress div{height:15px;width:1px;background:url(img/progress.gif) #31C135;}
.xhe_Fullfix{overflow:hidden;}
.xhe_Fullfix body{width:100%;height:100%;}
.xhe_Fullscreen{
top:0px;left:0px;position:fixed;z-index:100000;width:100%;height:100%;background:#fff;
_position:absolute;_top:expression((document.compatMode?documentElement.scrollTop:document.body.scrollTop)+'px');_width:expression((document.compatMode?documentElement.offsetWidth:document.body.offsetWidth) + 'px');_height:expression((document.compatMode?documentElement.offsetHeight:document.body.offsetHeight) + 'px');
}
.xheHideArea{position:absolute;top:-1000px;left:-1000px;visibility:hidden;} | zz-ms | trunk/zz-ms-v2.0/src/main/webapp/js/xheditor/xheditor_skin/vista/ui.css | CSS | asf20 | 10,033 |
html{height:100%;background-color:#FFFFFF;}
body,td,th{font-family:Arial,Helvetica,sans-serif;font-size:12px;}
body{height:100%;*height:90%;-moz-box-sizing:border-box;-webkit-box-sizing:border-box;box-sizing:border-box;}
.xhe-border{border:1px dotted #d3d3d3;}
.xhe-border th,.xhe-border td{border:1px dotted #d3d3d3;}
.editMode{margin:0px;padding:5px;overflow-y:auto;word-break:break-word;word-wrap:break-word;}
.editMode img:-moz-broken {-moz-force-broken-image-icon:1;height:24px;width:24px;}
.editMode embed{display:inline-block;border:1px dashed #FF4E4E;}
.editMode embed[type="application/x-shockwave-flash"]{background:url(img/flash.gif) center center no-repeat;}
.editMode embed[type="application/x-mplayer2"]{background:url(img/wmp.gif) center center no-repeat;}
.editMode .xhe-paste{position:absolute;left:-1000px;overflow:hidden;width:1px;height:1px;}
.editMode .xhe-anchor{display:inline-block;background: url(img/anchor.gif) no-repeat;border: 1px dotted #0000FF;width:16px;height:15px;overflow:hidden;}
.sourceMode{margin:0px;padding:0px;overflow:hidden;height:100%;}
.sourceMode textarea{*position:absolute;border:0px;margin:0px;padding:0px;width:100%;height:100%;overflow-y:auto;font-family:'Courier New',Courier,monospace !important;font-size:10pt;resize:none;outline:0;}
.previewMode{margin:5px;padding:0px;}
.showBlocktag p,.showBlocktag h1,.showBlocktag h2,.showBlocktag h3,.showBlocktag h4,.showBlocktag h5,.showBlocktag h6,.showBlocktag pre,.showBlocktag address,.showBlocktag div{background:none no-repeat scroll right top;border:1px dotted gray;}
.showBlocktag p{background-image:url(img/tag-p.gif);}
.showBlocktag h1{background-image:url(img/tag-h1.gif);}
.showBlocktag h2{background-image:url(img/tag-h2.gif);}
.showBlocktag h3{background-image:url(img/tag-h3.gif);}
.showBlocktag h4{background-image:url(img/tag-h4.gif);}
.showBlocktag h5{background-image:url(img/tag-h5.gif);}
.showBlocktag h6{background-image:url(img/tag-h6.gif);}
.showBlocktag pre{background-image:url(img/tag-pre.gif);}
.showBlocktag address{background-image:url(img/tag-address.gif);}
.showBlocktag div{background-image:url(img/tag-div.gif);} | zz-ms | trunk/zz-ms-v2.0/src/main/webapp/js/xheditor/xheditor_skin/o2007silver/iframe.css | CSS | asf20 | 2,176 |
.xhe_o2007silver table, .xhe_o2007silver tr, .xhe_o2007silver td, .xhe_o2007silver iframe {border:0; margin:0; padding:0; background:transparent;text-decoration:none; font-weight:normal; color:#000}
.xhe_o2007silver table.xheLayout {display:inline-table;background:#EEEEEE; border:1px solid #BBBBBB;width:100%;height:100%;}
.xhe_o2007silver td.xheTool {padding:1px 3px;border-bottom:1px solid #BBBBBB;}
.xhe_o2007silver td.xheTool span{float:left;margin:2px 0px;}
.xhe_o2007silver td.xheTool br{clear:left;}
.xhe_o2007silver span.xheGStart{display:block;width:1px;height:22px;background:url(img/buttonbg.gif) -22px 0;}
.xhe_o2007silver span.xheGEnd{display:block;width:1px;height:22px;background:url(img/buttonbg.gif) -22px 0;}
.xhe_o2007silver span.xheSeparator{display:block;height:22px;width:4px;}
.xhe_o2007silver a.xheButton{display:inline-block;padding:1px;border:0px;background:url(img/buttonbg.gif);cursor:pointer;text-decoration:none;}
.xhe_o2007silver a.xheButton span{opacity:0.3; -ms-filter:'alpha(opacity=30)'; filter:alpha(opacity=30);}
.xhe_o2007silver a.xheEnabled span{opacity:1; -ms-filter:'alpha(opacity=100)'; filter:alpha(opacity=100)}
.xhe_o2007silver a.xheEnabled:hover {background-color:#B2BBD0; background-position:0 -22px}
.xhe_o2007silver a.xheActive{background-color:#B2BBD0; background-position:0 -44px !important}
.xhe_o2007silver a.xheButton span{display:block;margin:0px;height:20px;width:20px;overflow:hidden;}
.xhe_o2007silver span.xheIcon{background:url(img/icons.gif) no-repeat 20px 20px}
.xhe_o2007silver span.xheBtnCut {background-position:0 0}
.xhe_o2007silver span.xheBtnCopy {background-position:-20px 0}
.xhe_o2007silver span.xheBtnPaste {background-position:-40px 0}
.xhe_o2007silver span.xheBtnPastetext {background-position:-60px 0}
.xhe_o2007silver span.xheBtnBlocktag {background-position:-80px 0}
.xhe_o2007silver span.xheBtnFontface {background-position:-100px 0}
.xhe_o2007silver span.xheBtnFontSize {background-position:-120px 0}
.xhe_o2007silver span.xheBtnBold {background-position:-140px 0}
.xhe_o2007silver span.xheBtnItalic {background-position:-160px 0}
.xhe_o2007silver span.xheBtnUnderline {background-position:-180px 0}
.xhe_o2007silver span.xheBtnStrikethrough {background-position:-200px 0}
.xhe_o2007silver span.xheBtnFontColor {background-position:-220px 0}
.xhe_o2007silver span.xheBtnBackColor {background-position:-240px 0}
.xhe_o2007silver span.xheBtnSelectAll {background-position:-260px 0}
.xhe_o2007silver span.xheBtnRemoveformat {background-position:-280px 0}
.xhe_o2007silver span.xheBtnAlign {background-position:-300px 0}
.xhe_o2007silver span.xheBtnList {background-position:-320px 0}
.xhe_o2007silver span.xheBtnOutdent {background-position:-340px 0}
.xhe_o2007silver span.xheBtnIndent {background-position:-360px 0}
.xhe_o2007silver span.xheBtnLink {background-position:-380px 0}
.xhe_o2007silver span.xheBtnUnlink {background-position:-400px 0}
.xhe_o2007silver span.xheBtnAnchor {background-position:-420px 0}
.xhe_o2007silver span.xheBtnImg {background-position:-440px 0}
.xhe_o2007silver span.xheBtnFlash {background-position:-460px 0}
.xhe_o2007silver span.xheBtnMedia {background-position:-480px 0}
.xhe_o2007silver span.xheBtnHr {background-position:-500px 0}
.xhe_o2007silver span.xheBtnEmot {background-position:-520px 0}
.xhe_o2007silver span.xheBtnTable {background-position:-540px 0}
.xhe_o2007silver span.xheBtnSource {background-position:-560px 0}
.xhe_o2007silver span.xheBtnPreview {background-position:-580px 0}
.xhe_o2007silver span.xheBtnPrint {background-position:-600px 0}
.xhe_o2007silver span.xheBtnFullscreen {background-position:-620px 0}
.xhe_o2007silver span.xheBtnAbout {background-position:-640px 0}
.xhe_o2007silver .xheIframeArea{height:100%;}
.xhe_o2007silver iframe {display:block;background:#fff;width:100%;height:100%;}
#xheCntLine{display:none;position:absolute;z-index:1000001;background:#fff;height:1px;font-size:0;}
#xhePanel{display:none;position:absolute;z-index:1000000;border:#BBBBBB 1px solid;background:#FDFEFF;text-align:left;}
#xheShadow{display:none;position:absolute;z-index:999999;background:#000;opacity:0.2; -ms-filter:'alpha(opacity=20)'; filter:alpha(opacity=20);}
.xheFixCancel{position:absolute;z-index:999998;background-color:#FFF;opacity:0; -ms-filter:'alpha(opacity=0)'; filter:alpha(opacity=0);}
.xheMenu{padding:2px;overflow-x:hidden;overflow-y:auto;max-height:230px;}
.xheMenu .xheMenuSeparator{margin:3px 0;border-top:1px solid #D8D8D8;}
.xheMenu a{display:block;padding:3px 20px 3px 3px;line-height:normal;font-size:12px;color:#000;text-decoration:none;white-space:nowrap;}
.xheMenu a:hover{background:#e5e5e5;text-decoration:none;color:#000;}
.xheMenu p,.xheMenu h1,.xheMenu h2,.xheMenu h3,.xheMenu h4,.xheMenu h5,.xheMenu h6,.xheMenu pre,.xheMenu address,.xheMenu div{margin:0}
.xheEmot div{padding:5px;overflow-x:hidden;overflow-y:auto;}
.xheEmot div a{display:inline-block;margin:3px;padding:3px;overflow:hidden;background-repeat:no-repeat;background-position:center;text-decoration:none;}
.xheEmot div a:hover{border:1px solid #BBBBBB;padding:2px;}
.xheEmot ul{border-top:1px solid #BBBBBB;list-style:none;padding:0 10px;margin:0;font-size:12px;}
.xheEmot li{float:left;margin:0 2px 5px 0;}
.xheEmot li a{background:#fff;display:block;padding:0 8px;text-decoration:none;color:#000;line-height:20px;}
.xheEmot li a:hover{text-decoration:underline;}
.xheEmot li.cur{border:1px solid #BBBBBB;border-top:none;position:relative;bottom:1px;}
.xheEmot li.cur a{cursor:text;padding-top:1px;}
.xheEmot li.cur a:hover{text-decoration:none;}
.xheColor{padding:5px;}
.xheColor a{display:inline-block;margin:1px;border:#999 1px solid;width:17px;height:9px;font-size:0;}
.xheColor a:hover{border:#000 1px solid;}
.xheColor a img{display:none;}
.xheDialog{padding:10px;font-size:12px;font-family:monospace;}
.xheDialog a{text-decoration:underline;color:#00f;}
.xheDialog a:hover{text-decoration:underline;color:#00f}
.xheDialog div{padding:2px 0px;}
.xheDialog input{
margin:0;border-width:1px;border-style:solid;font-size:12px;
*border-width:expression((type!="checkbox")?'1px':0);*padding:expression((type=="text")?'1px':'auto');*width:expression((type=="text")?'160px':'auto');*border-color:expression((type=="text")?'#ABADB3':'#fff #888 #888 #fff');*background:expression((type=="button")?'#F0F0F0':'#FFFFFF');*cursor:expression((type=="button")?'pointer':'');*font-size:expression((type=="button")?'13px':'12px');
}
.xheDialog textarea{font-size:12px;resize:none;border:1px solid #ccc;}
.xheDialog input[type=text]{padding:1px;width:160px;border-color:#ABADB3;}
.xheDialog input[type=button]{margin:0;border-color:#fff #888 #888 #fff;background:#F0F0F0;cursor:pointer;font-size:13px;}
.xheDialog input[type=file]{font-size:13px;}
.xheDialog input[type=checkbox]{border:0;}
.xheDialog select{margin:0;border:1px #ABADB3 solid;}
.xheDialog input,.xheDialog select,.xheDialog textarea{border-radius:3px;-moz-border-radius:3px;-webkit-border-radius:3px;}
.xheDialog input:focus,.xheDialog select:focus,.xheDialog textarea:focus{outline: 0;border-color: #EEC068;-webkit-box-shadow: 0 0 1px #EEC068;-moz-box-shadow: 0 0 1px #EEC068;box-shadow: 0 0 1px #EEC068;}
.xheDialog .xheUpload{position: relative;display:inline-block;width:164px;}
.xheDialog .xheUpload .xheBtn{position: absolute;top: 0px;left: 114px;width:50px;z-index: 1000001;padding:0;}
.xheDialog .xheUpload .xheFile{cursor:pointer;position: absolute;top: 0px;left: 0px;width:164px;opacity:0;-ms-filter:'alpha(opacity=0)';filter:alpha(opacity=0);z-index: 1000002;}
.xheDialog .xheUpload .xheText {position: absolute;width:107px;top: 0px;left: 0px;z-index: 1000003;}
.xheModal{
position: fixed;z-index: 1000010;text-align:left;top:50%;left:50%;background:#FFF;border:1px solid #AAA;font-size:12px;
_position:absolute;_margin-top:expression(0 - parseInt(this.offsetHeight / 2) + (TBWindowMargin = document.documentElement && document.documentElement.scrollTop || document.body.scrollTop) + 'px');
}
.xheModalTitle{padding:5px;background:#DDD;border-bottom:1px solid #AAA;}
.xheModalClose{float:right;width:16px;height:16px;background:url(img/close.gif);cursor:pointer;}
.xheModalIfmWait{width:100%;height:100%;background:url(img/waiting.gif) no-repeat 50% 50%;margin:-16 0 0 -16;}
.xheModalShadow{
position:fixed;z-index:1000009;top:50%;left:50%;background:#000;opacity:0.2; -ms-filter:'alpha(opacity=20)'; filter:alpha(opacity=20);
_position:absolute;_margin-top:expression(0 - parseInt(this.offsetHeight / 2) + (TBWindowMargin = document.documentElement && document.documentElement.scrollTop || document.body.scrollTop) + 5 + 'px');
}
.xheModalOverlay{
position: fixed;z-index:1000008;top: 0px;left: 0px;height:100%;width:100%;background-color:#000;opacity:0.2; -ms-filter:'alpha(opacity=20)'; filter:alpha(opacity=20);
_position:absolute;_height:expression(Math.max(document.documentElement.clientHeight,document.documentElement.scrollHeight)+'px');_width:expression(Math.max(document.documentElement.clientWidth,document.documentElement.scrollWidth)+'px');
}
*html{
background-image:url(about:blank);
background-attachment:fixed;
}
.xheProgress{position:relative;width:280px;margin:auto;border:1px solid #C1C1C1;-moz-border-radius:3px;-webkit-border-radius:3px;border-radius:3px;background:url(img/progressbg.gif) #E9E9E9;}
.xheProgress span{position:absolute;left:0;top:0;width:100%;text-align:center;line-height:15px;font-size:12px;color:#000;text-shadow: 1px 1px 0 #eee;}
.xheProgress div{height:15px;width:1px;background:url(img/progress.gif) #31C135;}
.xhe_Fullfix{overflow:hidden;}
.xhe_Fullfix body{width:100%;height:100%;}
.xhe_Fullscreen{
top:0px;left:0px;position:fixed;z-index:100000;width:100%;height:100%;background:#fff;
_position:absolute;_top:expression((document.compatMode?documentElement.scrollTop:document.body.scrollTop)+'px');_width:expression((document.compatMode?documentElement.offsetWidth:document.body.offsetWidth) + 'px');_height: expression((document.compatMode?documentElement.offsetHeight:document.body.offsetHeight) + 'px');
}
.xheHideArea{position:absolute;top:-1000px;left:-1000px;visibility:hidden;} | zz-ms | trunk/zz-ms-v2.0/src/main/webapp/js/xheditor/xheditor_skin/o2007silver/ui.css | CSS | asf20 | 10,300 |
/*!
* jQuery Cookie Plugin
* https://github.com/carhartl/jquery-cookie
*
* Copyright 2011, Klaus Hartl
* Dual licensed under the MIT or GPL Version 2 licenses.
* http://www.opensource.org/licenses/mit-license.php
* http://www.opensource.org/licenses/GPL-2.0
*/
(function($) {
$.cookie = function(key, value, options) {
// key and at least value given, set cookie...
if (arguments.length > 1 && (!/Object/.test(Object.prototype.toString.call(value)) || value === null || value === undefined)) {
options = $.extend({}, options);
if (value === null || value === undefined) {
options.expires = -1;
}
if (typeof options.expires === 'number') {
var days = options.expires, t = options.expires = new Date();
t.setDate(t.getDate() + days);
}
value = String(value);
return (document.cookie = [
encodeURIComponent(key), '=', options.raw ? value : encodeURIComponent(value),
options.expires ? '; expires=' + options.expires.toUTCString() : '', // use expires attribute, max-age is not supported by IE
options.path ? '; path=' + options.path : '',
options.domain ? '; domain=' + options.domain : '',
options.secure ? '; secure' : ''
].join(''));
}
// key and possibly options given, get cookie...
options = value || {};
var decode = options.raw ? function(s) { return s; } : decodeURIComponent;
var pairs = document.cookie.split('; ');
for (var i = 0, pair; pair = pairs[i] && pairs[i].split('='); i++) {
if (decode(pair[0]) === key) return decode(pair[1] || ''); // IE saves cookies with empty string as "c; ", e.g. without "=" as opposed to EOMB, thus pair[1] may be undefined
}
return null;
};
})(jQuery);
| zz-ms | trunk/zz-ms-v2.0/src/main/webapp/js/jquery.cookie.js | JavaScript | asf20 | 1,941 |
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" %>
<%@ include file="/common/taglibs.jsp"%>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>CRUD演示主界面</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=7" />
<%@ include file="/common/meta.jsp"%>
<%@ include file="/common/variable.jsp"%>
<%@ include file="/common/common.jsp"%>
<script type="text/javascript">
$(function(){
initMenu();
if (jqueryUtil.isLessThanIe8()) {
$.messager.show({
title : '警告',
msg : '您使用的浏览器版本太低!<br/>建议您使用谷歌浏览器来获得更快的页面响应效果!',
timeout : 1000 * 30
});
}
});
function initMenu(){
var $ma=$("#menuAccordion");
$ma.accordion({animate:true,fit:true,border:false});
$.post("${ctx}/menu.html", {userName:"1"}, function(rsp) {
$.each(rsp,function(i,e){
var menulist ="<div class=\"well well-small\">";
if(e.child && e.child.length>0){
$.each(e.child,function(ci,ce){
var effort=ce.name+"||"+ce.iconCls+"||"+ce.url;
menulist+="<a href=\"javascript:void(0);\" class=\"easyui-linkbutton\" data-options=\"plain:true,iconCls:'"+ce.iconCls+"'\" onclick=\"addTab('"+effort+"');\">"+ce.name+"</a><br/>";
});
}
menulist+="</div>";
$ma.accordion('add', {
title: e.name,
content: menulist,
border:false,
iconCls: e.iconCls,
selected: false
});
});
}, "JSON").error(function() {
$.messager.alert("提示", "获取菜单出错,请重新登陆!");
});
}
</script>
<style type="text/css">
#menuAccordion a.l-btn span span.l-btn-text {
display: inline-block;
height: 14px;
line-height: 14px;
margin: 0px 0px 0px 10px;
padding: 0px 0px 0px 10px;
vertical-align: baseline;
width: 128px;
}
#menuAccordion a.l-btn span span.l-btn-icon-left {
background-position: left center;
padding: 0px 0px 0px 20px;
}
#menuAccordion .panel-body {
padding:5px;
}
#menuAccordion span:focus{
outline: none;
}
</style>
</head>
<body class="easyui-layout">
<div data-options="region:'north',border:false" style="height:40px;background:#EEE;padding:10px;overflow: hidden;" href="layout/north.jsp"></div>
<div data-options="region:'west',split:true,title:'主要菜单'" style="width:200px;"><div id="menuAccordion"></div></div>
<div data-options="region:'south',border:false" style="height:25px;background:#EEE;padding:5px;" href="layout/south.jsp"></div>
<div data-options="region:'center',plain:true,title:'ZZMS'" style="overflow: hidden;" href="layout/center.jsp"></div>
</body>
</html> | zz-ms | trunk/zz-ms-v2.0/src/main/webapp/WEB-INF/pages/index.jsp | Java Server Pages | asf20 | 3,090 |
<%@ page language="java" contentType="application/json; charset=UTF-8" pageEncoding="UTF-8" %>
<%@ include file="/common/taglibs.jsp"%>
{"title":"登陆结果", "message":"${result eq true ? "登陆成功" : "登录失败"}", "status" : "${result}"} | zz-ms | trunk/zz-ms-v2.0/src/main/webapp/WEB-INF/pages/login.jsp | Java Server Pages | asf20 | 253 |
<%@ page language="java" pageEncoding="UTF-8"%>
<%@ include file="/common/taglibs.jsp"%>
<%@ include file="/common/variable.jsp"%>
<script type="text/javascript">
$(function() {
$("#form").form({
url :"${ctx}/user/save.html",
onSubmit : function() {
parent.$.messager.progress({
title : '提示',
text : '数据处理中,请稍后....'
});
var isValid = $(this).form('validate');
if (!isValid) {
parent.$.messager.progress('close');
}
return isValid;
},
success : function(result) {
parent.$.messager.progress('close');
result = $.parseJSON(result);
if (result.status) {
parent.reload;
parent.$.modalDialog.openner.datagrid('reload');//之所以能在这里调用到parent.$.modalDialog.openner_datagrid这个对象,是因为role.jsp页面预定义好了
parent.$.modalDialog.handler.dialog('close');
parent.$.messager.show({
title : result.title,
msg : result.message,
timeout : 1000 * 2
});
}else{
parent.$.messager.show({
title : result.title,
msg : result.message,
timeout : 1000 * 2
});
}
}
});
});
</script>
<style>
.easyui-textbox{
height: 18px;
width: 170px;
line-height: 16px;
/*border-radius: 3px 3px 3px 3px;*/
box-shadow: 0 1px 1px rgba(0, 0, 0, 0.075) inset;
transition: border 0.2s linear 0s, box-shadow 0.2s linear 0s;
}
textarea:focus, input[type="text"]:focus{
border-color: rgba(82, 168, 236, 0.8);
box-shadow: 0 1px 1px rgba(0, 0, 0, 0.075) inset, 0 0 8px rgba(82, 168, 236, 0.6);
outline: 0 none;
}
table {
background-color: transparent;
border-collapse: collapse;
border-spacing: 0;
max-width: 100%;
}
fieldset {
border: 0 none;
margin: 0;
padding: 0;
}
legend {
-moz-border-bottom-colors: none;
-moz-border-left-colors: none;
-moz-border-right-colors: none;
-moz-border-top-colors: none;
border-color: #E5E5E5;
border-image: none;
border-style: none none solid;
border-width: 0 0 1px;
color: #999999;
line-height: 20px;
display: block;
margin-bottom: 10px;
padding: 0;
width: 100%;
}
input, textarea {
font-weight: normal;
}
table ,th,td{
text-align:left;
padding: 6px;
}
</style>
<div class="easyui-layout" data-options="fit:true,border:false">
<div data-options="region:'center',border:false" title="" style="overflow: hidden;padding: 10px;">
<form id="form" method="post">
<fieldset>
<legend><img src="${ctx }/images/extend/fromedit.png" style="margin-bottom: -3px;"/> 用户编辑</legend>
<table>
<tr>
<th>用户编号</th>
<td><input name="id" id="id" class="easyui-textbox" type="text" value="${model.id }" readonly="readonly" style="background-color: #FFFFCC;"/></td>
<th>登录名</th>
<td><input name="userName" id="userName" type="text" class="easyui-textbox easyui-validatebox" data-options="required:true" value="${model.userName}"/></td>
</tr>
<tr>
<th>密码</th>
<td><input name="userPwd" id="userPwd" type="text" class="easyui-textbox easyui-validatebox" data-options="required:true" value="${model.userPwd}"/></td>
<th>备注</th>
<td><input id="address" name="address" type="text" class="easyui-textbox"></td>
</tr>
</table>
</fieldset>
</form>
</div>
</div>
| zz-ms | trunk/zz-ms-v2.0/src/main/webapp/WEB-INF/pages/user/edit.jsp | Java Server Pages | asf20 | 3,545 |
<%@ page language="java" pageEncoding="UTF-8"%>
<%@ include file="/common/taglibs.jsp"%>
<%@ include file="/common/variable.jsp"%>
<!-- 高级查询 -->
<div id="tbCompanySearchDlg">
<form id="tbCompanySearchFm" method="post">
<table>
<tr>
<th>条件</th>
<th>字段名</th>
<th>条件</th>
<th>值</th>
</tr>
<tr>
<td>
<div class="gradeSearchBox">
<select name="searchAnds" class="gradeSelectSearchBox">
<option value="and">并且</option>
<option value="or">或者</option>
</select>
</div>
</td>
<td>
<div class="gradeSearchBox">
<select name="searchColumnNames" class="gradeSelectSearchBox">
<option value="S_USER_NAME">用户名</option>
<option value="S_USER_PWD">密码</option>
</select>
</div>
</td>
<td>
<div class="gradeSearchBox">
<select name="searchConditions" class="gradeSelectSearchBox">
<option value="EQ">等于</option>
<option value="NEQ">大于小于</option>
<option value="LT">小于</option>
<option value="GT">大于</option>
<option value="LIKE">模糊</option>
</select>
</div>
</td>
<td><input class="easyui-textbox easyui-validatebox" name="searchVals" size="18"> <a style="display: none;" href="javascript:void(0);" onclick="tbCompanySearchRemove(this);">删除</a>
</td>
</tr>
</table>
</form>
</div>
| zz-ms | trunk/zz-ms-v2.0/src/main/webapp/WEB-INF/pages/user/search.jsp | Java Server Pages | asf20 | 1,465 |
<%@ page language="java" pageEncoding="UTF-8"%>
<%@ include file="/common/taglibs.jsp"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
<base href="${ctx }" />
<title>用户管理</title>
<%@ include file="/common/meta.jsp"%>
<%@ include file="/common/variable.jsp"%>
<%@ include file="/common/common.jsp"%>
<script type="text/javascript">
var $dg;
var $grid;
$(function() {
$dg = $("#dg");
$grid=$dg.datagrid({
url : "${ctx}/user/list.html",
width : 'auto',
height : $(this).height()-85,
pagination:true,
rownumbers:true,
border:true,
striped:true,
singleSelect:true,
columns : [ [ {field : 'userName',title : '用户名',width : parseInt($(this).width()*0.1),editor : {type:'validatebox',options:{required:true}}},
{field : 'userPwd',title : '密码',width : parseInt($(this).width()*0.1),align : 'left',editor : "text"}
] ],toolbar:'#tb'
});
//搜索框
$("#searchbox").searchbox({
menu:"#mm",
prompt :'模糊查询',
searcher:function(value,name){
//var str="{\"searchName\":\""+name+"\",\"searchValue\":\""+value+"\"}";
var str="{\"" + name + "\":\""+value +"\"}";
var obj = eval('('+str+')');
$dg.datagrid('reload',obj);
}
});
});
function endEdit(){
var flag=true;
var rows = $dg.datagrid('getRows');
for ( var i = 0; i < rows.length; i++) {
$dg.datagrid('endEdit', i);
var temp=$dg.datagrid('validateRow', i);
if(!temp){flag=false;}
}
return flag;
}
function addRows(){
$dg.datagrid('appendRow', {});
var rows = $dg.datagrid('getRows');
$dg.datagrid('beginEdit', rows.length - 1);
}
function editRows(){
var rows = $dg.datagrid('getSelections');
$.each(rows,function(i,row){
if (row) {
var rowIndex = $dg.datagrid('getRowIndex', row);
$dg.datagrid('beginEdit', rowIndex);
}
});
}
function removeRows(){
var rows = $dg.datagrid('getSelections');
$.each(rows,function(i,row){
if (row) {
var rowIndex = $dg.datagrid('getRowIndex', row);
$dg.datagrid('deleteRow', rowIndex);
}
});
}
function saveRows(){
if(endEdit()){
if ($dg.datagrid('getChanges').length) {
var inserted = $dg.datagrid('getChanges', "inserted");
var deleted = $dg.datagrid('getChanges', "deleted");
var updated = $dg.datagrid('getChanges', "updated");
var effectRow = new Object();
if (inserted.length) {
effectRow["inserted"] = JSON.stringify(inserted);
}
if (deleted.length) {
effectRow["deleted"] = JSON.stringify(deleted);
}
if (updated.length) {
effectRow["updated"] = JSON.stringify(updated);
}
$.post("${ctx}/user/save.html", effectRow, function(rsp) {
if(rsp.status){
$dg.datagrid('acceptChanges');
}
$.messager.alert(rsp.title, rsp.message);
}, "JSON").error(function() {
$.messager.alert("提示", "提交错误了!");
});
}
}else{
$.messager.alert("提示", "字段验证未通过!请查看");
}
}
//删除
function delRows(){
var row = $dg.datagrid('getSelected');
if(row){
var rowIndex = $dg.datagrid('getRowIndex', row);
parent.$.messager.confirm("提示","确定要删除记录吗?",function(r){
if (r){
$dg.datagrid('deleteRow', rowIndex);
$.ajax({
url:"${ctx}/user/del.html",
data: "id="+row.id,
success: function(rsp){
parent.$.messager.show({
title : rsp.title,
msg : rsp.message,
timeout : 1000 * 2
});
}
});
}
});
}else{
parent.$.messager.show({
title : "提示",
msg :"请选择一行记录!",
timeout : 1000 * 2
});
}
}
//弹窗修改
function updRowsOpenDlg() {
var row = $dg.datagrid('getSelected');
if (row) {
parent.$.modalDialog({
title : '编辑用户',
width : 600,
height : 400,
href : "${ctx}/user/edit.html",
onLoad:function(){
var f = parent.$.modalDialog.handler.find("#form");
f.form("load", row);
},
buttons : [ {
text : '编辑',
iconCls : 'icon-ok',
handler : function() {
parent.$.modalDialog.openner= $grid;//因为添加成功之后,需要刷新这个dataGrid,所以先预定义好
var f = parent.$.modalDialog.handler.find("#form");
f.submit();
}
}, {
text : '取消',
iconCls : 'icon-cancel',
handler : function() {
parent.$.modalDialog.handler.dialog('destroy');
parent.$.modalDialog.handler = undefined;
}
}
]
});
}else{
parent.$.messager.show({
title :"提示",
msg :"请选择一行记录!",
timeout : 1000 * 2
});
}
}
//弹窗增加
function addRowsOpenDlg() {
parent.$.modalDialog({
title : '添加用户',
width : 600,
height : 400,
href : '${ctx}/user/edit.html',
buttons : [ {
text : '保存',
iconCls : 'icon-ok',
handler : function() {
parent.$.modalDialog.openner= $grid;//因为添加成功之后,需要刷新这个dataGrid,所以先预定义好
var f = parent.$.modalDialog.handler.find("#form");
f.submit();
}
}, {
text : '取消',
iconCls : 'icon-cancel',
handler : function() {
parent.$.modalDialog.handler.dialog('destroy');
parent.$.modalDialog.handler = undefined;
}
}
]
});
}
//高级搜索 删除 row
function tbCompanySearchRemove(curr) {
$(curr).closest('tr').remove();
}
//高级查询
function tbsCompanySearch() {
jqueryUtil.gradeSearch($dg,"#tbCompanySearchFm","${ctx}/user/search.html");
}
//excel导出
function exportExcel(){
var rows = $dg.datagrid("getRows");
if(rows.length){
var isCheckedIds=[];
$.each(rows,function(i,row){
if (row) {
isCheckedIds.push(row.companyId);
}
});
//window.location.href="${ctx}/excel/export.html?isCheckedIds="+isCheckedIds;
parent.$.messager.show({
title :"提示",
msg :"暂不提供此功能!",
timeout : 1000 * 2
});
}
else{
parent.$.messager.show({
title :"提示",
msg :"暂无导出数据!",
timeout : 1000 * 2
});
}
}
</script>
</head>
<body>
<div data-options="region:'center',border : false">
<div class="well well-small" style="margin-left: 5px;margin-top: 5px">
<span class="badge">提示</span>
<p>
在此你可以对<span class="label-info"><strong>用户管理</strong></span>进行编辑!
</p>
</div>
<div id="tb" style="padding:2px 0">
<table cellpadding="0" cellspacing="0">
<tr>
<td style="padding-left:2px">
<a href="javascript:void(0);" class="easyui-linkbutton" iconCls="icon-add" plain="true" onclick="addRowsOpenDlg();">添加</a>
<a href="javascript:void(0);" class="easyui-linkbutton" iconCls="icon-edit" plain="true" onclick="updRowsOpenDlg();">编辑</a>
<a href="javascript:void(0);" class="easyui-linkbutton" iconCls="icon-remove" plain="true" onclick="delRows();">删除</a>
<a href="javascript:void(0);" class="easyui-linkbutton" iconCls="icon-excel" plain="true" onclick="exportExcel();">导出Excel</a>
</td>
<td style="padding-left:2px">
<input id="searchbox" type="text"/>
</td>
<td style="padding-left:2px">
<a href="javascript:void(0);" class="easyui-linkbutton" iconCls="icon-search" plain="true" onclick="tbsCompanySearch();">高级查询</a>
</td>
</tr>
</table>
</div>
<div id="mm">
<div name="filter_LIKES_USER_NAME">用户名</div>
<div name="filter_EQS_USER_PWD">密码</div>
</div>
<table id="dg" title="用户管理"></table>
</div>
</body>
</html>
| zz-ms | trunk/zz-ms-v2.0/src/main/webapp/WEB-INF/pages/user/page.jsp | Java Server Pages | asf20 | 8,449 |
<%@ page language="java" contentType="application/json; charset=UTF-8" pageEncoding="UTF-8" %>
<%@ include file="/common/taglibs.jsp"%>
${dto} | zz-ms | trunk/zz-ms-v2.0/src/main/webapp/WEB-INF/pages/user/list.jsp | Java Server Pages | asf20 | 144 |
<%@ page language="java" contentType="application/json; charset=UTF-8" pageEncoding="UTF-8" %>
<%@ include file="/common/taglibs.jsp"%>
{"title":"操作结果", "message":"${result eq true ? "操作成功" : "操作失败"}", "status" : "${result}"} | zz-ms | trunk/zz-ms-v2.0/src/main/webapp/WEB-INF/pages/user/result.jsp | Java Server Pages | asf20 | 253 |
<%@ page language="java" contentType="application/json; charset=UTF-8" pageEncoding="UTF-8" %>
<%@ include file="/common/taglibs.jsp"%>
{"title":"操作结果", "message":"${result eq true ? "操作成功" : "操作失败"}", "status" : "${result}"} | zz-ms | trunk/zz-ms-v2.0/src/main/webapp/WEB-INF/pages/user/save.jsp | Java Server Pages | asf20 | 253 |
<%@ page language="java" contentType="application/json; charset=UTF-8" pageEncoding="UTF-8" %>
<%@ include file="/common/taglibs.jsp"%>
${uiMenu} | zz-ms | trunk/zz-ms-v2.0/src/main/webapp/WEB-INF/pages/menu.jsp | Java Server Pages | asf20 | 147 |
.portal{
padding:0;
margin:0;
border:1px solid #99BBE8;
overflow:auto;
}
.portal-noborder{
border:0;
}
.portal-panel{
margin-bottom:10px;
}
.portal-column-td{
vertical-align:top;
}
.portal-column{
padding:10px 0 10px 10px;
overflow:hidden;
}
.portal-proxy{
opacity:0.6;
filter:alpha(opacity=60);
}
.portal-spacer{
border:3px dashed #eee;
margin-bottom:10px;
} | zz-ms | trunk/zz-ms-v2.0/src/main/webapp/images/extend/portal.css | CSS | asf20 | 399 |
/**
* portal - jQuery EasyUI
*
* Licensed under the GPL:
* http://www.gnu.org/licenses/gpl.txt
*
* Copyright 2010 stworthy [ stworthy@gmail.com ]
*
* Dependencies:
* draggable
* panel
*
*/
(function($){
/**
* initialize the portal
*/
function init(target){
$(target).addClass('portal');
var table = $('<table border="0" cellspacing="0" cellpadding="0"><tr></tr></table>').appendTo(target);
var tr = table.find('tr');
var columnWidths = [];
var totalWidth = 0;
$(target).find('>div').each(function(){ // each column panel
var column = $(this);
totalWidth += column.outerWidth();
columnWidths.push(column.outerWidth());
var td = $('<td class="portal-column-td"></td>').appendTo(tr)
column.addClass('portal-column').appendTo(td);
column.find('>div').each(function(){ // each portal panel
var p = $(this).addClass('portal-p').panel({
doSize:false,
cls:'portal-panel'
});
makeDraggable(target, p);
});
});
for(var i=0; i<columnWidths.length; i++){
columnWidths[i] /= totalWidth;
}
$(target).bind('_resize', function(){
var opts = $.data(target, 'portal').options;
if (opts.fit == true){
setSize(target);
}
return false;
});
return columnWidths;
}
function setSize(target){
var t = $(target);
var opts = $.data(target, 'portal').options;
if (opts.fit){
var p = t.parent();
opts.width = p.width();
opts.height = p.height();
}
if (!isNaN(opts.width)){
if ($.boxModel == true){
t.width(opts.width - (t.outerWidth() - t.width()));
} else {
t.width(opts.width);
}
} else {
t.width('auto');
}
if (!isNaN(opts.height)){
if ($.boxModel == true){
t.height(opts.height - (t.outerHeight() - t.height()));
} else {
t.height(opts.height);
}
} else {
t.height('auto');
}
var hasScroll = t.find('>table').outerHeight() > t.height();
var width = t.width();
var columnWidths = $.data(target, 'portal').columnWidths;
var leftWidth = 0;
// calculate and set every column size
for(var i=0; i<columnWidths.length; i++){
var p = t.find('div.portal-column:eq('+i+')');
var w = Math.floor(width * columnWidths[i]);
if (i == columnWidths.length - 1){
w = width - leftWidth - (hasScroll == true ? 28 : 10);
}
if ($.boxModel == true){
p.width(w - (p.outerWidth()-p.width()));
} else {
p.width(w);
}
leftWidth += p.outerWidth();
// resize every panel of the column
p.find('div.portal-p').panel('resize', {width:p.width()});
}
}
/**
* set draggable feature for the specified panel
*/
function makeDraggable(target, panel){
var spacer;
panel.panel('panel').draggable({
handle:'>div.panel-header>div.panel-title',
proxy:function(source){
var p = $('<div class="portal-proxy">proxy</div>').insertAfter(source);
p.width($(source).width());
p.height($(source).height());
p.html($(source).html());
p.find('div.portal-p').removeClass('portal-p');
return p;
},
onStartDrag:function(e){
$(this).hide();
spacer = $('<div class="portal-spacer"></div>').insertAfter(this);
setSpacerSize($(this).outerWidth(), $(this).outerHeight());
},
onDrag:function(e){
var p = findPanel(e, this);
if (p){
if (p.pos == 'up'){
spacer.insertBefore(p.target);
} else {
spacer.insertAfter(p.target);
}
setSpacerSize($(p.target).outerWidth());
} else {
var c = findColumn(e);
if (c){
if (c.find('div.portal-spacer').length == 0){
spacer.appendTo(c);
setSize(target);
setSpacerSize(c.width());
}
}
}
},
onStopDrag:function(e){
$(this).css('position', 'static');
$(this).show();
spacer.hide();
$(this).insertAfter(spacer);
spacer.remove();
setSize(target);
}
});
/**
* find which panel the cursor is over
*/
function findPanel(e, source){
var result = null;
$(target).find('div.portal-p').each(function(){
var pal = $(this).panel('panel');
if (pal[0] != source){
var pos = pal.offset();
if (e.pageX > pos.left && e.pageX < pos.left + pal.outerWidth()
&& e.pageY > pos.top && e.pageY < pos.top + pal.outerHeight()){
if (e.pageY > pos.top + pal.outerHeight() / 2){
result = {
target:pal,
pos:'down'
};
} else {
result = {
target:pal,
pos:'up'
}
}
}
}
});
return result;
}
/**
* find which portal column the cursor is over
*/
function findColumn(e){
var result = null;
$(target).find('div.portal-column').each(function(){
var pal = $(this);
var pos = pal.offset();
if (e.pageX > pos.left && e.pageX < pos.left + pal.outerWidth()){
result = pal;
}
});
return result;
}
/**
* set the spacer size
*/
function setSpacerSize(width, height){
if ($.boxModel == true){
spacer.width(width - (spacer.outerWidth() - spacer.width()));
if (height){
spacer.height(height - (spacer.outerHeight() - spacer.height()));
}
} else {
spacer.width(width);
if (height){
spacer.height(height);
}
}
}
}
$.fn.portal = function(options, param){
if (typeof options == 'string'){
return $.fn.portal.methods[options](this, param);
}
options = options || {};
return this.each(function(){
var state = $.data(this, 'portal');
if (state){
$.extend(state.options, options);
} else {
state = $.data(this, 'portal', {
options: $.extend({}, $.fn.portal.defaults, $.fn.portal.parseOptions(this), options),
columnWidths: init(this)
});
}
if (state.options.border){
$(this).removeClass('portal-noborder');
} else {
$(this).addClass('portal-noborder');
}
setSize(this);
});
};
$.fn.portal.methods = {
options: function(jq){
return $.data(jq[0], 'portal').options;
},
resize: function(jq, param){
return jq.each(function(){
if (param){
var opts = $.data(this, 'portal').options;
if (param.width) opts.width = param.width;
if (param.height) opts.height = param.height;
}
setSize(this);
});
},
getPanels: function(jq, columnIndex){
var c = jq; // the panel container
if (columnIndex){
c = jq.find('div.portal-column:eq(' + columnIndex + ')');
}
var panels = [];
c.find('div.portal-p').each(function(){
panels.push($(this));
});
return panels;
},
add: function(jq, param){ // param: {panel,columnIndex}
return jq.each(function(){
var c = $(this).find('div.portal-column:eq(' + param.columnIndex + ')');
var p = param.panel.addClass('portal-p');
p.panel('open');
p.panel('panel').addClass('portal-panel').appendTo(c);
makeDraggable(this, p);
p.panel('resize', {width:c.width()});
});
},
remove: function(jq, panel){
return jq.each(function(){
var panels = $(this).portal('getPanels');
for(var i=0; i<panels.length; i++){
var p = panels[i];
if (p[0] == $(panel)[0]){
p.panel('destroy');
}
}
});
}
};
$.fn.portal.parseOptions = function(target){
var t = $(target);
return {
width: (parseInt(target.style.width) || undefined),
height: (parseInt(target.style.height) || undefined),
border: (t.attr('border') ? t.attr('border') == 'true' : undefined),
fit: (t.attr('fit') ? t.attr('fit') == 'true' : undefined)
};
};
$.fn.portal.defaults = {
width:'auto',
height:'auto',
border:true,
fit:false
};
})(jQuery); | zz-ms | trunk/zz-ms-v2.0/src/main/webapp/images/extend/jquery.portal.js | JavaScript | asf20 | 7,875 |
.icon-blank{
background:url('icons/blank.gif') no-repeat center center;
}
.icon-add{
background:url('icons/edit_add.png') no-repeat center center;
}
.icon-adds{
background:url('icons/add.png') no-repeat center center;
}
.icon-edit{
background:url('icons/pencil.png') no-repeat center center;
}
.icon-remove{
background:url('icons/edit_remove.png') no-repeat center center;
}
.icon-save{
background:url('icons/save.png') no-repeat center center;
}
.icon-cut{
background:url('icons/cut.png') no-repeat center center;
}
.icon-ok{
background:url('icons/ok.png') no-repeat center center;
}
.icon-no{
background:url('icons/no.png') no-repeat center center;
}
.icon-cancel{
background:url('icons/cancel.png') no-repeat center center;
}
.icon-reload{
background:url('icons/reload.png') no-repeat center center;
}
.icon-search{
background:url('icons/sear.png') no-repeat center center;
}
.icon-color{
background:url('icons/color.png') no-repeat center center;
}
.icon-help{
background:url('icons/help.png') no-repeat center center;
}
.icon-undo{
background:url('icons/undo.png') no-repeat center center;
}
.icon-redo{
background:url('icons/redo.png') no-repeat center center;
}
.icon-back{
background:url('icons/back.png') no-repeat center center;
}
.icon-sum{
background:url('icons/sum.png') no-repeat center center;
}
.icon-tip{
background:url('icons/tip.png') no-repeat center center;
}
.icon-paint{
background:url('icons/paint.png') no-repeat center center;
}
.icon-config{
background:url('icons/config.png') no-repeat center center;
}
.icon-comp{
background:url('icons/company.png') no-repeat center center;
}
.icon-sys{
background:url('icons/sys.png') no-repeat center center;
}
.icon-db{
background:url('icons/db.png') no-repeat center center;
}
.icon-pro{
background:url('icons/pro.png') no-repeat center center;
}
.icon-role{
background:url('icons/role.png') no-repeat center center;
}
.icon-end{
background:url('icons/end.png') no-repeat center center;
}
.icon-home{
background:url('icons/home.png') no-repeat center center;
}
.icon-bug{
background:url('icons/bug.png') no-repeat center center;
}
.icon-badd{
background:url('icons/bug_add.png') no-repeat center center;
}
.icon-bedit{
background:url('icons/bug_edit.png') no-repeat center center;
}
.icon-bdel{
background:url('icons/bug_delete.png') no-repeat center center;
}
.icon-logout{
background:url('icons/logout.png') no-repeat center center;
}
.icon-cstbase{
background:url('icons/cstbase.png') no-repeat center center;
}
.icon-item{
background:url('icons/item.png') no-repeat center center;
}
.icon-excel{
background:url('icons/excel.png') no-repeat center center;
}
.icon-time{
background:url('icons/time.png') no-repeat center center;
}
.icon-auto{
background:url('icons/auto.png') no-repeat center center;
}
.icon-start{
background:url('icons/start.png') no-repeat center center;
}
.icon-mini-add{
background:url('icons/mini_add.png') no-repeat center center;
}
.icon-mini-edit{
background:url('icons/mini_edit.png') no-repeat center center;
}
.icon-mini-refresh{
background:url('icons/mini_refresh.png') no-repeat center center;
} | zz-ms | trunk/zz-ms-v2.0/src/main/webapp/themes/icon.css | CSS | asf20 | 3,262 |
.window {
overflow: hidden;
padding: 5px;
border-width: 1px;
border-style: solid;
}
.window .window-header {
background: transparent;
padding: 0px 0px 6px 0px;
}
.window .window-body {
border-width: 1px;
border-style: solid;
border-top-width: 0px;
}
.window .window-body-noheader {
border-top-width: 1px;
}
.window .window-header .panel-icon,
.window .window-header .panel-tool {
top: 50%;
margin-top: -11px;
}
.window .window-header .panel-icon {
left: 1px;
}
.window .window-header .panel-tool {
right: 1px;
}
.window .window-header .panel-with-icon {
padding-left: 18px;
}
.window-proxy {
position: absolute;
overflow: hidden;
}
.window-proxy-mask {
position: absolute;
filter: alpha(opacity=5);
opacity: 0.05;
}
.window-mask {
position: absolute;
left: 0;
top: 0;
width: 100%;
height: 100%;
filter: alpha(opacity=40);
opacity: 0.40;
font-size: 1px;
*zoom: 1;
overflow: hidden;
}
.window,
.window-shadow {
position: absolute;
-moz-border-radius: 0px 0px 0px 0px;
-webkit-border-radius: 0px 0px 0px 0px;
border-radius: 0px 0px 0px 0px;
}
.window-shadow {
background: #eee;
-moz-box-shadow: 2px 2px 3px #ededed;
-webkit-box-shadow: 2px 2px 3px #ededed;
box-shadow: 2px 2px 3px #ededed;
filter: progid:DXImageTransform.Microsoft.Blur(pixelRadius=2,MakeShadow=false,ShadowOpacity=0.2);
}
.window,
.window .window-body {
border-color: #ddd;
}
.window {
background-color: #ffffff;
}
.window-proxy {
border: 1px dashed #ddd;
}
.window-proxy-mask,
.window-mask {
background: #eee;
}
| zz-ms | trunk/zz-ms-v2.0/src/main/webapp/themes/metro/window.css | CSS | asf20 | 1,564 |
.dialog-content {
overflow: auto;
}
.dialog-toolbar {
padding: 2px 5px;
}
.dialog-tool-separator {
float: left;
height: 24px;
border-left: 1px solid #ddd;
border-right: 1px solid #fff;
margin: 2px 1px;
}
.dialog-button {
padding: 5px;
text-align: right;
}
.dialog-button .l-btn {
margin-left: 5px;
}
.dialog-toolbar,
.dialog-button {
background: #fff;
}
.dialog-toolbar {
border-bottom: 1px solid #ddd;
}
.dialog-button {
border-top: 1px solid #ddd;
}
| zz-ms | trunk/zz-ms-v2.0/src/main/webapp/themes/metro/dialog.css | CSS | asf20 | 478 |
.datebox-calendar-inner {
height: 180px;
}
.datebox-button {
height: 18px;
padding: 2px 5px;
font-size: 12px;
text-align: center;
}
.datebox-current,
.datebox-close,
.datebox-ok {
text-decoration: none;
font-weight: bold;
opacity: 0.6;
filter: alpha(opacity=60);
}
.datebox-current,
.datebox-close {
float: left;
}
.datebox-close {
float: right;
}
.datebox-button-hover {
opacity: 1.0;
filter: alpha(opacity=100);
}
.datebox .combo-arrow {
background-image: url('images/datebox_arrow.png');
background-position: center center;
}
.datebox-button {
background-color: #fff;
}
.datebox-current,
.datebox-close,
.datebox-ok {
color: #777;
}
| zz-ms | trunk/zz-ms-v2.0/src/main/webapp/themes/metro/datebox.css | CSS | asf20 | 670 |
.pagination {
zoom: 1;
}
.pagination table {
float: left;
height: 30px;
}
.pagination td {
border: 0;
}
.pagination-btn-separator {
float: left;
height: 24px;
border-left: 1px solid #ddd;
border-right: 1px solid #fff;
margin: 3px 1px;
}
.pagination .pagination-num {
border-width: 1px;
border-style: solid;
margin: 0 2px;
padding: 2px;
width: 2em;
height: auto;
}
.pagination-page-list {
margin: 0px 6px;
padding: 1px 2px;
width: auto;
height: auto;
border-width: 1px;
border-style: solid;
}
.pagination-info {
float: right;
margin: 0 6px 0 0;
padding: 0;
height: 30px;
line-height: 30px;
font-size: 12px;
}
.pagination span {
font-size: 12px;
}
.pagination-first {
background: url('images/pagination_icons.png') no-repeat 0 0;
}
.pagination-prev {
background: url('images/pagination_icons.png') no-repeat -16px 0;
}
.pagination-next {
background: url('images/pagination_icons.png') no-repeat -32px 0;
}
.pagination-last {
background: url('images/pagination_icons.png') no-repeat -48px 0;
}
.pagination-load {
background: url('images/pagination_icons.png') no-repeat -64px 0;
}
.pagination-loading {
background: url('images/loading.gif') no-repeat;
}
.pagination-page-list,
.pagination .pagination-num {
border-color: #ddd;
}
| zz-ms | trunk/zz-ms-v2.0/src/main/webapp/themes/metro/pagination.css | CSS | asf20 | 1,296 |
a.l-btn {
background-position: right 0;
font-size: 12px;
text-decoration: none;
display: inline-block;
zoom: 1;
height: 24px;
padding-right: 18px;
cursor: pointer;
outline: none;
}
a.l-btn-plain {
padding-right: 5px;
border: 0;
padding: 1px 6px 1px 1px;
}
a.l-btn-disabled {
color: #ccc;
opacity: 0.5;
filter: alpha(opacity=50);
cursor: default;
}
a.l-btn span.l-btn-left {
display: inline-block;
background-position: 0 -48px;
padding: 4px 0px 4px 18px;
line-height: 16px;
height: 16px;
}
a.l-btn-plain span.l-btn-left {
padding-left: 5px;
}
a.l-btn span span.l-btn-text {
display: inline-block;
vertical-align: baseline;
width: auto;
height: 16px;
line-height: 16px;
padding: 0;
margin: 0;
}
a.l-btn span span.l-btn-icon-left {
padding: 0 0 0 20px;
background-position: left center;
}
a.l-btn span span.l-btn-icon-right {
padding: 0 20px 0 0;
background-position: right center;
}
a.l-btn span span span.l-btn-empty {
display: inline-block;
margin: 0;
padding: 0;
width: 16px;
}
a:hover.l-btn {
background-position: right -24px;
outline: none;
text-decoration: none;
}
a:hover.l-btn span.l-btn-left {
background-position: 0 bottom;
}
a:hover.l-btn-plain {
padding: 0 5px 0 0;
}
a:hover.l-btn-disabled {
background-position: right 0;
}
a:hover.l-btn-disabled span.l-btn-left {
background-position: 0 -48px;
}
a.l-btn .l-btn-focus {
outline: #0000FF dotted thin;
}
a.l-btn {
color: #777;
background-image: url('images/linkbutton_bg.png');
background-repeat: no-repeat;
background: #ffffff;
background-repeat: repeat-x;
border: 1px solid #dddddd;
background: -webkit-linear-gradient(top,#ffffff 0,#ffffff 100%);
background: -moz-linear-gradient(top,#ffffff 0,#ffffff 100%);
background: -o-linear-gradient(top,#ffffff 0,#ffffff 100%);
background: linear-gradient(to bottom,#ffffff 0,#ffffff 100%);
background-repeat: repeat-x;
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr=#ffffff,endColorstr=#ffffff,GradientType=0);
-moz-border-radius: 0px 0px 0px 0px;
-webkit-border-radius: 0px 0px 0px 0px;
border-radius: 0px 0px 0px 0px;
}
a.l-btn span.l-btn-left {
background-image: url('images/linkbutton_bg.png');
background-repeat: no-repeat;
background-image: none;
}
a:hover.l-btn {
background: #E6E6E6;
color: #444;
border: 1px solid #ddd;
filter: none;
}
a.l-btn-plain,
a.l-btn-plain span.l-btn-left {
background: transparent;
border: 0;
filter: none;
}
a:hover.l-btn-plain {
background: #E6E6E6;
color: #444;
border: 1px solid #ddd;
-moz-border-radius: 0px 0px 0px 0px;
-webkit-border-radius: 0px 0px 0px 0px;
border-radius: 0px 0px 0px 0px;
}
a.l-btn-disabled,
a:hover.l-btn-disabled {
filter: alpha(opacity=50);
}
| zz-ms | trunk/zz-ms-v2.0/src/main/webapp/themes/metro/linkbutton.css | CSS | asf20 | 2,783 |
.panel {
overflow: hidden;
font-size: 12px;
text-align: left;
}
.panel-header,
.panel-body {
border-width: 1px;
border-style: solid;
}
.panel-header {
padding: 5px;
position: relative;
}
.panel-title {
background: url('images/blank.gif') no-repeat;
}
.panel-header-noborder {
border-width: 0 0 1px 0;
}
.panel-body {
overflow: auto;
border-top-width: 0px;
}
.panel-body-noheader {
border-top-width: 1px;
}
.panel-body-noborder {
border-width: 0px;
}
.panel-with-icon {
padding-left: 18px;
}
.panel-icon,
.panel-tool {
position: absolute;
top: 50%;
margin-top: -8px;
height: 16px;
overflow: hidden;
}
.panel-icon {
left: 5px;
width: 16px;
}
.panel-tool {
right: 5px;
width: auto;
}
.panel-tool a {
display: inline-block;
width: 16px;
height: 16px;
opacity: 0.6;
filter: alpha(opacity=60);
margin: 0 0 0 2px;
vertical-align: top;
}
.panel-tool a:hover {
opacity: 1;
filter: alpha(opacity=100);
background-color: #E6E6E6;
-moz-border-radius: -2px -2px -2px -2px;
-webkit-border-radius: -2px -2px -2px -2px;
border-radius: -2px -2px -2px -2px;
}
.panel-loading {
padding: 11px 0px 10px 30px;
}
.panel-noscroll {
overflow: hidden;
}
.panel-fit,
.panel-fit body {
height: 100%;
margin: 0;
padding: 0;
border: 0;
overflow: hidden;
}
.panel-loading {
background: url('images/loading.gif') no-repeat 10px 10px;
}
.panel-tool-close {
background: url('images/panel_tools.png') no-repeat -16px 0px;
}
.panel-tool-min {
background: url('images/panel_tools.png') no-repeat 0px 0px;
}
.panel-tool-max {
background: url('images/panel_tools.png') no-repeat 0px -16px;
}
.panel-tool-restore {
background: url('images/panel_tools.png') no-repeat -16px -16px;
}
.panel-tool-collapse {
background: url('images/panel_tools.png') no-repeat -32px 0;
}
.panel-tool-expand {
background: url('images/panel_tools.png') no-repeat -32px -16px;
}
.panel-header,
.panel-body {
border-color: #ddd;
}
.panel-header {
background-color: #ffffff;
}
.panel-body {
background-color: #fff;
color: #444;
}
.panel-title {
font-weight: bold;
color: #777;
height: 16px;
line-height: 16px;
}
.accordion {
overflow: hidden;
border-width: 1px;
border-style: solid;
}
.accordion .accordion-header {
border-width: 0 0 1px;
cursor: pointer;
}
.accordion .accordion-body {
border-width: 0 0 1px;
}
.accordion-noborder {
border-width: 0;
}
.accordion-noborder .accordion-header {
border-width: 0 0 1px;
}
.accordion-noborder .accordion-body {
border-width: 0 0 1px;
}
.accordion-collapse {
background: url('images/accordion_arrows.png') no-repeat 0 0;
}
.accordion-expand {
background: url('images/accordion_arrows.png') no-repeat -16px 0;
}
.accordion {
background: #fff;
border-color: #ddd;
}
.accordion .accordion-header {
background: #ffffff;
filter: none;
}
.accordion .accordion-header-selected {
background: #CCE6FF;
}
.accordion .accordion-header-selected .panel-title {
color: #000;
}
.window {
overflow: hidden;
padding: 5px;
border-width: 1px;
border-style: solid;
}
.window .window-header {
background: transparent;
padding: 0px 0px 6px 0px;
}
.window .window-body {
border-width: 1px;
border-style: solid;
border-top-width: 0px;
}
.window .window-body-noheader {
border-top-width: 1px;
}
.window .window-header .panel-icon,
.window .window-header .panel-tool {
top: 50%;
margin-top: -11px;
}
.window .window-header .panel-icon {
left: 1px;
}
.window .window-header .panel-tool {
right: 1px;
}
.window .window-header .panel-with-icon {
padding-left: 18px;
}
.window-proxy {
position: absolute;
overflow: hidden;
}
.window-proxy-mask {
position: absolute;
filter: alpha(opacity=5);
opacity: 0.05;
}
.window-mask {
position: absolute;
left: 0;
top: 0;
width: 100%;
height: 100%;
filter: alpha(opacity=40);
opacity: 0.40;
font-size: 1px;
*zoom: 1;
overflow: hidden;
}
.window,
.window-shadow {
position: absolute;
-moz-border-radius: 0px 0px 0px 0px;
-webkit-border-radius: 0px 0px 0px 0px;
border-radius: 0px 0px 0px 0px;
}
.window-shadow {
background: #eee;
-moz-box-shadow: 2px 2px 3px #ededed;
-webkit-box-shadow: 2px 2px 3px #ededed;
box-shadow: 2px 2px 3px #ededed;
filter: progid:DXImageTransform.Microsoft.Blur(pixelRadius=2,MakeShadow=false,ShadowOpacity=0.2);
}
.window,
.window .window-body {
border-color: #ddd;
}
.window {
background-color: #ffffff;
}
.window-proxy {
border: 1px dashed #ddd;
}
.window-proxy-mask,
.window-mask {
background: #eee;
}
.dialog-content {
overflow: auto;
}
.dialog-toolbar {
padding: 2px 5px;
}
.dialog-tool-separator {
float: left;
height: 24px;
border-left: 1px solid #ddd;
border-right: 1px solid #fff;
margin: 2px 1px;
}
.dialog-button {
padding: 5px;
text-align: right;
}
.dialog-button .l-btn {
margin-left: 5px;
}
.dialog-toolbar,
.dialog-button {
background: #fff;
}
.dialog-toolbar {
border-bottom: 1px solid #ddd;
}
.dialog-button {
border-top: 1px solid #ddd;
}
.combo {
display: inline-block;
white-space: nowrap;
margin: 0;
padding: 0;
border-width: 1px;
border-style: solid;
overflow: hidden;
vertical-align: middle;
}
.combo .combo-text {
font-size: 12px;
border: 0px;
line-height: 20px;
height: 20px;
margin: 0;
padding: 0px 2px;
*margin-top: -1px;
*height: 18px;
*line-height: 18px;
_height: 18px;
_line-height: 18px;
vertical-align: baseline;
}
.combo-arrow {
width: 18px;
height: 20px;
overflow: hidden;
display: inline-block;
vertical-align: top;
cursor: pointer;
opacity: 0.6;
filter: alpha(opacity=60);
}
.combo-arrow-hover {
opacity: 1.0;
filter: alpha(opacity=100);
}
.combo-panel {
overflow: auto;
}
.combo-arrow {
background: url('images/combo_arrow.png') no-repeat center center;
}
.combo,
.combo-panel {
background-color: #fff;
}
.combo {
border-color: #ddd;
background-color: #fff;
}
.combo-arrow {
background-color: #ffffff;
}
.combo-arrow-hover {
background-color: #E6E6E6;
}
.combobox-item {
padding: 2px;
font-size: 12px;
padding: 3px;
padding-right: 0px;
}
.combobox-item-hover {
background-color: #E6E6E6;
color: #444;
}
.combobox-item-selected {
background-color: #CCE6FF;
color: #000;
}
.layout {
position: relative;
overflow: hidden;
margin: 0;
padding: 0;
z-index: 0;
}
.layout-panel {
position: absolute;
overflow: hidden;
}
.layout-panel-east,
.layout-panel-west {
z-index: 2;
}
.layout-panel-north,
.layout-panel-south {
z-index: 3;
}
.layout-expand {
position: absolute;
padding: 0px;
font-size: 1px;
cursor: pointer;
z-index: 1;
}
.layout-expand .panel-header,
.layout-expand .panel-body {
background: transparent;
filter: none;
overflow: hidden;
}
.layout-expand .panel-header {
border-bottom-width: 0px;
}
.layout-split-proxy-h,
.layout-split-proxy-v {
position: absolute;
font-size: 1px;
display: none;
z-index: 5;
}
.layout-split-proxy-h {
width: 5px;
cursor: e-resize;
}
.layout-split-proxy-v {
height: 5px;
cursor: n-resize;
}
.layout-mask {
position: absolute;
background: #fafafa;
filter: alpha(opacity=10);
opacity: 0.10;
z-index: 4;
}
.layout-button-up {
background: url('images/layout_arrows.png') no-repeat -16px -16px;
}
.layout-button-down {
background: url('images/layout_arrows.png') no-repeat -16px 0;
}
.layout-button-left {
background: url('images/layout_arrows.png') no-repeat 0 0;
}
.layout-button-right {
background: url('images/layout_arrows.png') no-repeat 0 -16px;
}
.layout-split-proxy-h,
.layout-split-proxy-v {
background-color: #b3b3b3;
}
.layout-split-north {
border-bottom: 5px solid #fff;
}
.layout-split-south {
border-top: 5px solid #fff;
}
.layout-split-east {
border-left: 5px solid #fff;
}
.layout-split-west {
border-right: 5px solid #fff;
}
.layout-expand {
background-color: #ffffff;
}
.layout-expand-over {
background-color: #ffffff;
}
.tabs-container {
overflow: hidden;
}
.tabs-header {
border-width: 1px;
border-style: solid;
border-bottom-width: 0;
position: relative;
padding: 0;
padding-top: 2px;
overflow: hidden;
}
.tabs-header-plain {
border: 0;
background: transparent;
}
.tabs-scroller-left,
.tabs-scroller-right {
position: absolute;
top: auto;
bottom: 0;
width: 18px;
height: 28px !important;
height: 30px;
font-size: 1px;
display: none;
cursor: pointer;
border-width: 1px;
border-style: solid;
}
.tabs-scroller-left {
left: 0;
}
.tabs-scroller-right {
right: 0;
}
.tabs-header-plain .tabs-scroller-left,
.tabs-header-plain .tabs-scroller-right {
height: 25px !important;
height: 27px;
}
.tabs-tool {
position: absolute;
bottom: 0;
padding: 1px;
overflow: hidden;
border-width: 1px;
border-style: solid;
}
.tabs-header-plain .tabs-tool {
padding: 0 1px;
}
.tabs-wrap {
position: relative;
left: 0;
overflow: hidden;
width: 100%;
margin: 0;
padding: 0;
}
.tabs-scrolling {
margin-left: 18px;
margin-right: 18px;
}
.tabs-disabled {
opacity: 0.3;
filter: alpha(opacity=30);
}
.tabs {
list-style-type: none;
height: 26px;
margin: 0px;
padding: 0px;
padding-left: 4px;
font-size: 12px;
width: 5000px;
border-style: solid;
border-width: 0 0 1px 0;
}
.tabs li {
float: left;
display: inline-block;
margin: 0 4px -1px 0;
padding: 0;
position: relative;
border: 0;
}
.tabs li a.tabs-inner {
display: inline-block;
text-decoration: none;
margin: 0;
padding: 0 10px;
height: 25px;
line-height: 25px;
text-align: center;
white-space: nowrap;
border-width: 1px;
border-style: solid;
-moz-border-radius: 0px 0px 0 0;
-webkit-border-radius: 0px 0px 0 0;
border-radius: 0px 0px 0 0;
}
.tabs li.tabs-selected a.tabs-inner {
font-weight: bold;
outline: none;
}
.tabs li.tabs-selected a:hover.tabs-inner {
cursor: default;
pointer: default;
}
.tabs li a.tabs-close,
.tabs-p-tool {
position: absolute;
font-size: 1px;
display: block;
height: 12px;
padding: 0;
top: 50%;
margin-top: -6px;
overflow: hidden;
}
.tabs li a.tabs-close {
width: 12px;
right: 5px;
opacity: 0.6;
filter: alpha(opacity=60);
}
.tabs-p-tool {
right: 16px;
}
.tabs-p-tool a {
display: inline-block;
font-size: 1px;
width: 12px;
height: 12px;
margin: 0;
opacity: 0.6;
filter: alpha(opacity=60);
}
.tabs li a:hover.tabs-close,
.tabs-p-tool a:hover {
opacity: 1;
filter: alpha(opacity=100);
cursor: hand;
cursor: pointer;
}
.tabs-with-icon {
padding-left: 18px;
}
.tabs-icon {
position: absolute;
width: 16px;
height: 16px;
left: 10px;
top: 50%;
margin-top: -8px;
}
.tabs-closable {
padding-right: 8px;
}
.tabs-panels {
margin: 0px;
padding: 0px;
border-width: 1px;
border-style: solid;
border-top-width: 0;
overflow: hidden;
}
.tabs-header-bottom {
border-width: 0 1px 1px 1px;
padding: 0 0 2px 0;
}
.tabs-header-bottom .tabs {
border-width: 1px 0 0 0;
}
.tabs-header-bottom .tabs li {
margin: -1px 4px 0 0;
}
.tabs-header-bottom .tabs li a.tabs-inner {
-moz-border-radius: 0 0 0px 0px;
-webkit-border-radius: 0 0 0px 0px;
border-radius: 0 0 0px 0px;
}
.tabs-header-bottom .tabs-tool {
top: 0;
}
.tabs-header-bottom .tabs-scroller-left,
.tabs-header-bottom .tabs-scroller-right {
top: 0;
bottom: auto;
}
.tabs-panels-top {
border-width: 1px 1px 0 1px;
}
.tabs-header-left {
float: left;
border-width: 1px 0 1px 1px;
padding: 0;
}
.tabs-header-right {
float: right;
border-width: 1px 1px 1px 0;
padding: 0;
}
.tabs-header-left .tabs-wrap,
.tabs-header-right .tabs-wrap {
height: 100%;
}
.tabs-header-left .tabs {
height: 100%;
padding: 4px 0 0 4px;
border-width: 0 1px 0 0;
}
.tabs-header-right .tabs {
height: 100%;
padding: 4px 4px 0 0;
border-width: 0 0 0 1px;
}
.tabs-header-left .tabs li,
.tabs-header-right .tabs li {
display: block;
width: 100%;
position: relative;
}
.tabs-header-left .tabs li {
left: auto;
right: 0;
margin: 0 -1px 4px 0;
float: right;
}
.tabs-header-right .tabs li {
left: 0;
right: auto;
margin: 0 0 4px -1px;
float: left;
}
.tabs-header-left .tabs li a.tabs-inner {
display: block;
text-align: left;
-moz-border-radius: 0px 0 0 0px;
-webkit-border-radius: 0px 0 0 0px;
border-radius: 0px 0 0 0px;
}
.tabs-header-right .tabs li a.tabs-inner {
display: block;
text-align: left;
-moz-border-radius: 0 0px 0px 0;
-webkit-border-radius: 0 0px 0px 0;
border-radius: 0 0px 0px 0;
}
.tabs-panels-right {
float: right;
border-width: 1px 1px 1px 0;
}
.tabs-panels-left {
float: left;
border-width: 1px 0 1px 1px;
}
.tabs-header-noborder,
.tabs-panels-noborder {
border: 0px;
}
.tabs-header-plain {
border: 0px;
background: transparent;
}
.tabs-scroller-left {
background: #ffffff url('images/tabs_icons.png') no-repeat 1px center;
}
.tabs-scroller-right {
background: #ffffff url('images/tabs_icons.png') no-repeat -15px center;
}
.tabs li a.tabs-close {
background: url('images/tabs_icons.png') no-repeat -34px center;
}
.tabs li a.tabs-inner:hover {
background: #E6E6E6;
color: #444;
filter: none;
}
.tabs li.tabs-selected a.tabs-inner {
background-color: #fff;
color: #777;
}
.tabs li a.tabs-inner {
color: #777;
background-color: #ffffff;
}
.tabs-header,
.tabs-tool {
background-color: #ffffff;
}
.tabs-header-plain {
background: transparent;
}
.tabs-header,
.tabs-scroller-left,
.tabs-scroller-right,
.tabs-tool,
.tabs,
.tabs-panels,
.tabs li a.tabs-inner,
.tabs li.tabs-selected a.tabs-inner,
.tabs-header-bottom .tabs li.tabs-selected a.tabs-inner,
.tabs-header-left .tabs li.tabs-selected a.tabs-inner,
.tabs-header-right .tabs li.tabs-selected a.tabs-inner {
border-color: #ddd;
}
.tabs-p-tool a:hover,
.tabs li a:hover.tabs-close,
.tabs-scroller-over {
background-color: #E6E6E6;
}
.tabs li.tabs-selected a.tabs-inner {
border-bottom: 1px solid #fff;
}
.tabs-header-bottom .tabs li.tabs-selected a.tabs-inner {
border-top: 1px solid #fff;
}
.tabs-header-left .tabs li.tabs-selected a.tabs-inner {
border-right: 1px solid #fff;
}
.tabs-header-right .tabs li.tabs-selected a.tabs-inner {
border-left: 1px solid #fff;
}
a.l-btn {
background-position: right 0;
font-size: 12px;
text-decoration: none;
display: inline-block;
zoom: 1;
height: 24px;
padding-right: 18px;
cursor: pointer;
outline: none;
}
a.l-btn-plain {
padding-right: 5px;
border: 0;
padding: 1px 6px 1px 1px;
}
a.l-btn-disabled {
color: #ccc;
opacity: 0.5;
filter: alpha(opacity=50);
cursor: default;
}
a.l-btn span.l-btn-left {
display: inline-block;
background-position: 0 -48px;
padding: 4px 0px 4px 18px;
line-height: 16px;
height: 16px;
}
a.l-btn-plain span.l-btn-left {
padding-left: 5px;
}
a.l-btn span span.l-btn-text {
display: inline-block;
vertical-align: baseline;
width: auto;
height: 16px;
line-height: 16px;
padding: 0;
margin: 0;
}
a.l-btn span span.l-btn-icon-left {
padding: 0 0 0 20px;
background-position: left center;
}
a.l-btn span span.l-btn-icon-right {
padding: 0 20px 0 0;
background-position: right center;
}
a.l-btn span span span.l-btn-empty {
display: inline-block;
margin: 0;
padding: 0;
width: 16px;
}
a:hover.l-btn {
background-position: right -24px;
outline: none;
text-decoration: none;
}
a:hover.l-btn span.l-btn-left {
background-position: 0 bottom;
}
a:hover.l-btn-plain {
padding: 0 5px 0 0;
}
a:hover.l-btn-disabled {
background-position: right 0;
}
a:hover.l-btn-disabled span.l-btn-left {
background-position: 0 -48px;
}
a.l-btn .l-btn-focus {
outline: #0000FF dotted thin;
}
a.l-btn {
color: #777;
background-image: url('images/linkbutton_bg.png');
background-repeat: no-repeat;
background: #ffffff;
background-repeat: repeat-x;
border: 1px solid #dddddd;
background: -webkit-linear-gradient(top,#ffffff 0,#ffffff 100%);
background: -moz-linear-gradient(top,#ffffff 0,#ffffff 100%);
background: -o-linear-gradient(top,#ffffff 0,#ffffff 100%);
background: linear-gradient(to bottom,#ffffff 0,#ffffff 100%);
background-repeat: repeat-x;
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr=#ffffff,endColorstr=#ffffff,GradientType=0);
-moz-border-radius: 0px 0px 0px 0px;
-webkit-border-radius: 0px 0px 0px 0px;
border-radius: 0px 0px 0px 0px;
}
a.l-btn span.l-btn-left {
background-image: url('images/linkbutton_bg.png');
background-repeat: no-repeat;
background-image: none;
}
a:hover.l-btn {
background: #E6E6E6;
color: #444;
border: 1px solid #ddd;
filter: none;
}
a.l-btn-plain,
a.l-btn-plain span.l-btn-left {
background: transparent;
border: 0;
filter: none;
}
a:hover.l-btn-plain {
background: #E6E6E6;
color: #444;
border: 1px solid #ddd;
-moz-border-radius: 0px 0px 0px 0px;
-webkit-border-radius: 0px 0px 0px 0px;
border-radius: 0px 0px 0px 0px;
}
a.l-btn-disabled,
a:hover.l-btn-disabled {
filter: alpha(opacity=50);
}
.datagrid .panel-body {
overflow: hidden;
position: relative;
}
.datagrid-view {
position: relative;
overflow: hidden;
}
.datagrid-view1,
.datagrid-view2 {
position: absolute;
overflow: hidden;
top: 0;
}
.datagrid-view1 {
left: 0;
}
.datagrid-view2 {
right: 0;
}
.datagrid-mask {
position: absolute;
left: 0;
top: 0;
width: 100%;
height: 100%;
opacity: 0.3;
filter: alpha(opacity=30);
display: none;
}
.datagrid-mask-msg {
position: absolute;
top: 50%;
margin-top: -20px;
padding: 12px 5px 10px 30px;
width: auto;
height: 16px;
border-width: 2px;
border-style: solid;
display: none;
}
.datagrid-sort-icon {
padding: 0;
}
.datagrid-toolbar {
height: auto;
padding: 1px 2px;
border-width: 0 0 1px 0;
border-style: solid;
}
.datagrid-btn-separator {
float: left;
height: 24px;
border-left: 1px solid #ddd;
border-right: 1px solid #fff;
margin: 2px 1px;
}
.datagrid .datagrid-pager {
margin: 0;
border-width: 1px 0 0 0;
border-style: solid;
}
.datagrid .datagrid-pager-top {
border-width: 0 0 1px 0;
}
.datagrid-header {
overflow: hidden;
cursor: default;
border-width: 0 0 1px 0;
border-style: solid;
}
.datagrid-header-inner {
float: left;
width: 10000px;
}
.datagrid-header-row,
.datagrid-row {
height: 25px;
}
.datagrid-header td,
.datagrid-body td,
.datagrid-footer td {
border-width: 0 1px 1px 0;
border-style: dotted;
margin: 0;
padding: 0;
}
.datagrid-cell,
.datagrid-cell-group,
.datagrid-header-rownumber,
.datagrid-cell-rownumber {
margin: 0;
padding: 0 4px;
white-space: nowrap;
word-wrap: normal;
overflow: hidden;
height: 18px;
line-height: 18px;
font-weight: normal;
font-size: 12px;
}
.datagrid-cell-group {
text-align: center;
}
.datagrid-header-rownumber,
.datagrid-cell-rownumber {
width: 25px;
text-align: center;
margin: 0;
padding: 0;
}
.datagrid-body {
margin: 0;
padding: 0;
overflow: auto;
zoom: 1;
}
.datagrid-view1 .datagrid-body-inner {
padding-bottom: 20px;
}
.datagrid-view1 .datagrid-body {
overflow: hidden;
}
.datagrid-footer {
overflow: hidden;
}
.datagrid-footer-inner {
border-width: 1px 0 0 0;
border-style: solid;
width: 10000px;
float: left;
}
.datagrid-row-editing .datagrid-cell {
height: auto;
}
.datagrid-header-check,
.datagrid-cell-check {
padding: 0;
width: 27px;
height: 18px;
font-size: 1px;
text-align: center;
overflow: hidden;
}
.datagrid-header-check input,
.datagrid-cell-check input {
margin: 0;
padding: 0;
width: 15px;
height: 18px;
}
.datagrid-resize-proxy {
position: absolute;
width: 1px;
height: 10000px;
top: 0;
cursor: e-resize;
display: none;
}
.datagrid-body .datagrid-editable {
margin: 0;
padding: 0;
}
.datagrid-body .datagrid-editable table {
width: 100%;
height: 100%;
}
.datagrid-body .datagrid-editable td {
border: 0;
margin: 0;
padding: 0;
}
.datagrid-body .datagrid-editable .datagrid-editable-input {
margin: 0;
padding: 2px;
border-width: 1px;
border-style: solid;
}
.datagrid-sort-desc .datagrid-sort-icon {
padding: 0 13px 0 0;
background: url('images/datagrid_icons.png') no-repeat -16px center;
}
.datagrid-sort-asc .datagrid-sort-icon {
padding: 0 13px 0 0;
background: url('images/datagrid_icons.png') no-repeat 0px center;
}
.datagrid-row-collapse {
background: url('images/datagrid_icons.png') no-repeat -48px center;
}
.datagrid-row-expand {
background: url('images/datagrid_icons.png') no-repeat -32px center;
}
.datagrid-mask-msg {
background: #fff url('images/loading.gif') no-repeat scroll 5px center;
}
.datagrid-header,
.datagrid-td-rownumber {
background-color: #ffffff;
}
.datagrid-cell-rownumber {
color: #444;
}
.datagrid-resize-proxy {
background: #b3b3b3;
}
.datagrid-mask {
background: #eee;
}
.datagrid-mask-msg {
border-color: #ddd;
}
.datagrid-toolbar,
.datagrid-pager {
background: #fff;
}
.datagrid-header,
.datagrid-toolbar,
.datagrid-pager,
.datagrid-footer-inner {
border-color: #ddd;
}
.datagrid-header td,
.datagrid-body td,
.datagrid-footer td {
border-color: #ddd;
}
.datagrid-htable,
.datagrid-btable,
.datagrid-ftable {
color: #444;
}
.datagrid-row-alt {
background: #f5f5f5;
}
.datagrid-row-over,
.datagrid-header td.datagrid-header-over {
background: #E6E6E6;
color: #444;
cursor: default;
}
.datagrid-row-selected {
background: #CCE6FF;
color: #000;
}
.datagrid-body .datagrid-editable .datagrid-editable-input {
border-color: #ddd;
}
.propertygrid .datagrid-view1 .datagrid-body td {
padding-bottom: 1px;
border-width: 0 1px 0 0;
}
.propertygrid .datagrid-group {
height: 21px;
overflow: hidden;
border-width: 0 0 1px 0;
border-style: solid;
}
.propertygrid .datagrid-group span {
font-weight: bold;
}
.propertygrid .datagrid-view1 .datagrid-body td {
border-color: #ddd;
}
.propertygrid .datagrid-view1 .datagrid-group {
border-color: #ffffff;
}
.propertygrid .datagrid-view2 .datagrid-group {
border-color: #ddd;
}
.propertygrid .datagrid-group,
.propertygrid .datagrid-view1 .datagrid-body,
.propertygrid .datagrid-view1 .datagrid-row-over,
.propertygrid .datagrid-view1 .datagrid-row-selected {
background: #ffffff;
}
.pagination {
zoom: 1;
}
.pagination table {
float: left;
height: 30px;
}
.pagination td {
border: 0;
}
.pagination-btn-separator {
float: left;
height: 24px;
border-left: 1px solid #ddd;
border-right: 1px solid #fff;
margin: 3px 1px;
}
.pagination .pagination-num {
border-width: 1px;
border-style: solid;
margin: 0 2px;
padding: 2px;
width: 2em;
height: auto;
}
.pagination-page-list {
margin: 0px 6px;
padding: 1px 2px;
width: auto;
height: auto;
border-width: 1px;
border-style: solid;
}
.pagination-info {
float: right;
margin: 0 6px 0 0;
padding: 0;
height: 30px;
line-height: 30px;
font-size: 12px;
}
.pagination span {
font-size: 12px;
}
.pagination-first {
background: url('images/pagination_icons.png') no-repeat 0 0;
}
.pagination-prev {
background: url('images/pagination_icons.png') no-repeat -16px 0;
}
.pagination-next {
background: url('images/pagination_icons.png') no-repeat -32px 0;
}
.pagination-last {
background: url('images/pagination_icons.png') no-repeat -48px 0;
}
.pagination-load {
background: url('images/pagination_icons.png') no-repeat -64px 0;
}
.pagination-loading {
background: url('images/loading.gif') no-repeat;
}
.pagination-page-list,
.pagination .pagination-num {
border-color: #ddd;
}
.calendar {
border-width: 1px;
border-style: solid;
padding: 1px;
overflow: hidden;
font-size: 12px;
}
.calendar table {
border-collapse: separate;
font-size: 12px;
width: 100%;
height: 100%;
}
.calendar-noborder {
border: 0;
}
.calendar-header {
position: relative;
height: 22px;
}
.calendar-title {
text-align: center;
height: 22px;
}
.calendar-title span {
position: relative;
display: inline-block;
top: 2px;
padding: 0 3px;
height: 18px;
line-height: 18px;
cursor: pointer;
-moz-border-radius: 0px 0px 0px 0px;
-webkit-border-radius: 0px 0px 0px 0px;
border-radius: 0px 0px 0px 0px;
}
.calendar-prevmonth,
.calendar-nextmonth,
.calendar-prevyear,
.calendar-nextyear {
position: absolute;
top: 50%;
margin-top: -7px;
width: 14px;
height: 14px;
cursor: pointer;
font-size: 1px;
-moz-border-radius: 0px 0px 0px 0px;
-webkit-border-radius: 0px 0px 0px 0px;
border-radius: 0px 0px 0px 0px;
}
.calendar-prevmonth {
left: 20px;
background: url('images/calendar_arrows.png') no-repeat -18px -2px;
}
.calendar-nextmonth {
right: 20px;
background: url('images/calendar_arrows.png') no-repeat -34px -2px;
}
.calendar-prevyear {
left: 3px;
background: url('images/calendar_arrows.png') no-repeat -1px -2px;
}
.calendar-nextyear {
right: 3px;
background: url('images/calendar_arrows.png') no-repeat -49px -2px;
}
.calendar-body {
position: relative;
}
.calendar-body th,
.calendar-body td {
text-align: center;
}
.calendar-day {
border: 0;
padding: 1px;
cursor: pointer;
-moz-border-radius: 0px 0px 0px 0px;
-webkit-border-radius: 0px 0px 0px 0px;
border-radius: 0px 0px 0px 0px;
}
.calendar-other-month {
opacity: 0.3;
filter: alpha(opacity=30);
}
.calendar-menu {
position: absolute;
top: 0;
left: 0;
width: 180px;
height: 150px;
padding: 5px;
font-size: 12px;
display: none;
overflow: hidden;
}
.calendar-menu-year-inner {
text-align: center;
padding-bottom: 5px;
}
.calendar-menu-year {
width: 40px;
text-align: center;
border-width: 1px;
border-style: solid;
margin: 0;
padding: 2px;
font-weight: bold;
}
.calendar-menu-prev,
.calendar-menu-next {
display: inline-block;
width: 21px;
height: 21px;
vertical-align: top;
cursor: pointer;
-moz-border-radius: 0px 0px 0px 0px;
-webkit-border-radius: 0px 0px 0px 0px;
border-radius: 0px 0px 0px 0px;
}
.calendar-menu-prev {
margin-right: 10px;
background: url('images/calendar_arrows.png') no-repeat 2px 2px;
}
.calendar-menu-next {
margin-left: 10px;
background: url('images/calendar_arrows.png') no-repeat -45px 2px;
}
.calendar-menu-month {
text-align: center;
cursor: pointer;
font-weight: bold;
-moz-border-radius: 0px 0px 0px 0px;
-webkit-border-radius: 0px 0px 0px 0px;
border-radius: 0px 0px 0px 0px;
}
.calendar-body th,
.calendar-menu-month {
color: #919191;
}
.calendar-day {
color: #444;
}
.calendar-sunday {
color: #CC2222;
}
.calendar-saturday {
color: #00ee00;
}
.calendar-today {
color: #0000ff;
}
.calendar-menu-year {
border-color: #ddd;
}
.calendar {
border-color: #ddd;
}
.calendar-header {
background: #ffffff;
}
.calendar-body,
.calendar-menu {
background: #fff;
}
.calendar-body th {
background: #fff;
}
.calendar-hover,
.calendar-nav-hover,
.calendar-menu-hover {
background-color: #E6E6E6;
color: #444;
}
.calendar-hover {
border: 1px solid #ddd;
padding: 0;
}
.calendar-selected {
background-color: #CCE6FF;
color: #000;
border: 1px solid #99cdff;
padding: 0;
}
.datebox-calendar-inner {
height: 180px;
}
.datebox-button {
height: 18px;
padding: 2px 5px;
font-size: 12px;
text-align: center;
}
.datebox-current,
.datebox-close,
.datebox-ok {
text-decoration: none;
font-weight: bold;
opacity: 0.6;
filter: alpha(opacity=60);
}
.datebox-current,
.datebox-close {
float: left;
}
.datebox-close {
float: right;
}
.datebox-button-hover {
opacity: 1.0;
filter: alpha(opacity=100);
}
.datebox .combo-arrow {
background-image: url('images/datebox_arrow.png');
background-position: center center;
}
.datebox-button {
background-color: #fff;
}
.datebox-current,
.datebox-close,
.datebox-ok {
color: #777;
}
.spinner {
display: inline-block;
white-space: nowrap;
margin: 0;
padding: 0;
border-width: 1px;
border-style: solid;
overflow: hidden;
vertical-align: middle;
}
.spinner .spinner-text {
font-size: 12px;
border: 0px;
line-height: 20px;
height: 20px;
margin: 0;
padding: 0 2px;
*margin-top: -1px;
*height: 18px;
*line-height: 18px;
_height: 18px;
_line-height: 18px;
vertical-align: baseline;
}
.spinner-arrow {
display: inline-block;
overflow: hidden;
vertical-align: top;
margin: 0;
padding: 0;
}
.spinner-arrow-up,
.spinner-arrow-down {
opacity: 0.6;
filter: alpha(opacity=60);
display: block;
font-size: 1px;
width: 18px;
height: 10px;
}
.spinner-arrow-hover {
opacity: 1.0;
filter: alpha(opacity=100);
}
.spinner-arrow-up {
background: url('images/spinner_arrows.png') no-repeat 1px center;
}
.spinner-arrow-down {
background: url('images/spinner_arrows.png') no-repeat -15px center;
}
.spinner {
border-color: #ddd;
}
.spinner-arrow {
background-color: #ffffff;
}
.spinner-arrow-hover {
background-color: #E6E6E6;
}
.progressbar {
border-width: 1px;
border-style: solid;
-moz-border-radius: 0px 0px 0px 0px;
-webkit-border-radius: 0px 0px 0px 0px;
border-radius: 0px 0px 0px 0px;
overflow: hidden;
}
.progressbar-text {
text-align: center;
position: absolute;
}
.progressbar-value {
position: relative;
overflow: hidden;
width: 0;
-moz-border-radius: 0px 0 0 0px;
-webkit-border-radius: 0px 0 0 0px;
border-radius: 0px 0 0 0px;
}
.progressbar {
border-color: #ddd;
}
.progressbar-text {
color: #444;
}
.progressbar-value .progressbar-text {
background-color: #CCE6FF;
color: #000;
}
.searchbox {
display: inline-block;
white-space: nowrap;
margin: 0;
padding: 0;
border-width: 1px;
border-style: solid;
overflow: hidden;
}
.searchbox .searchbox-text {
font-size: 12px;
border: 0;
margin: 0;
padding: 0;
line-height: 20px;
height: 20px;
*margin-top: -1px;
*height: 18px;
*line-height: 18px;
_height: 18px;
_line-height: 18px;
vertical-align: baseline;
}
.searchbox .searchbox-prompt {
font-size: 12px;
color: #ccc;
}
.searchbox-button {
width: 18px;
height: 20px;
overflow: hidden;
display: inline-block;
vertical-align: top;
cursor: pointer;
opacity: 0.6;
filter: alpha(opacity=60);
}
.searchbox-button-hover {
opacity: 1.0;
filter: alpha(opacity=100);
}
.searchbox a.l-btn-plain {
height: 20px;
border: 0;
padding: 0 6px 0 0;
vertical-align: top;
-moz-border-radius: 0;
-webkit-border-radius: 0;
border-radius: 0;
opacity: 0.6;
filter: alpha(opacity=60);
}
.searchbox a.l-btn .l-btn-left {
padding: 2px 0 2px 4px;
}
.searchbox a.l-btn-plain:hover {
-moz-border-radius: 0;
-webkit-border-radius: 0;
border-radius: 0;
border: 0;
padding: 0 6px 0 0;
opacity: 1.0;
filter: alpha(opacity=100);
}
.searchbox a.m-btn-plain-active {
-moz-border-radius: 0;
-webkit-border-radius: 0;
border-radius: 0;
}
.searchbox-button {
background: url('images/searchbox_button.png') no-repeat center center;
}
.searchbox {
border-color: #ddd;
background-color: #fff;
}
.searchbox a.l-btn-plain {
background: #ffffff;
}
.slider-disabled {
opacity: 0.5;
filter: alpha(opacity=50);
}
.slider-h {
height: 22px;
}
.slider-v {
width: 22px;
}
.slider-inner {
position: relative;
height: 6px;
top: 7px;
border-width: 1px;
border-style: solid;
border-radius: 3px;
}
.slider-handle {
position: absolute;
display: block;
outline: none;
width: 20px;
height: 20px;
top: -7px;
margin-left: -10px;
}
.slider-tip {
position: absolute;
display: inline-block;
line-height: 12px;
white-space: nowrap;
top: -22px;
}
.slider-rule {
position: relative;
top: 15px;
}
.slider-rule span {
position: absolute;
display: inline-block;
font-size: 0;
height: 5px;
border-width: 0 0 0 1px;
border-style: solid;
}
.slider-rulelabel {
position: relative;
top: 20px;
}
.slider-rulelabel span {
position: absolute;
display: inline-block;
}
.slider-v .slider-inner {
width: 6px;
left: 7px;
top: 0;
float: left;
}
.slider-v .slider-handle {
left: 3px;
margin-top: -10px;
}
.slider-v .slider-tip {
left: -10px;
margin-top: -6px;
}
.slider-v .slider-rule {
float: left;
top: 0;
left: 16px;
}
.slider-v .slider-rule span {
width: 5px;
height: 'auto';
border-left: 0;
border-width: 1px 0 0 0;
border-style: solid;
}
.slider-v .slider-rulelabel {
float: left;
top: 0;
left: 23px;
}
.slider-handle {
background: url('images/slider_handle.png') no-repeat;
}
.slider-inner {
border-color: #ddd;
background: #ffffff;
}
.slider-rule span {
border-color: #ddd;
}
.slider-rulelabel span {
color: #444;
}
.menu {
position: absolute;
margin: 0;
padding: 2px;
border-width: 1px;
border-style: solid;
overflow: hidden;
}
.menu-item {
position: relative;
margin: 0;
padding: 0;
overflow: hidden;
white-space: nowrap;
cursor: pointer;
border-width: 1px;
border-style: solid;
}
.menu-text {
height: 20px;
line-height: 20px;
float: left;
padding-left: 28px;
}
.menu-icon {
position: absolute;
width: 16px;
height: 16px;
left: 2px;
top: 50%;
margin-top: -8px;
}
.menu-rightarrow {
position: absolute;
width: 16px;
height: 16px;
right: 0;
top: 50%;
margin-top: -8px;
}
.menu-line {
position: absolute;
left: 26px;
top: 0;
height: 2000px;
font-size: 1px;
}
.menu-sep {
margin: 3px 0px 3px 25px;
font-size: 1px;
}
.menu-active {
-moz-border-radius: 0px 0px 0px 0px;
-webkit-border-radius: 0px 0px 0px 0px;
border-radius: 0px 0px 0px 0px;
}
.menu-item-disabled {
opacity: 0.5;
filter: alpha(opacity=50);
cursor: default;
}
.menu-text,
.menu-text span {
font-size: 12px;
}
.menu-shadow {
position: absolute;
-moz-border-radius: 0px 0px 0px 0px;
-webkit-border-radius: 0px 0px 0px 0px;
border-radius: 0px 0px 0px 0px;
background: #eee;
-moz-box-shadow: 2px 2px 3px #ededed;
-webkit-box-shadow: 2px 2px 3px #ededed;
box-shadow: 2px 2px 3px #ededed;
filter: progid:DXImageTransform.Microsoft.Blur(pixelRadius=2,MakeShadow=false,ShadowOpacity=0.2);
}
.menu-rightarrow {
background: url('images/menu_arrows.png') no-repeat -32px center;
}
.menu-line {
border-left: 1px solid #ddd;
border-right: 1px solid #fff;
}
.menu-sep {
border-top: 1px solid #ddd;
border-bottom: 1px solid #fff;
}
.menu {
background-color: #ffffff;
border-color: #ddd;
color: #444;
}
.menu-content {
background: #fff;
}
.menu-item {
border-color: transparent;
_border-color: #ffffff;
}
.menu-active {
border-color: #ddd;
color: #444;
background: #E6E6E6;
}
.menu-active-disabled {
border-color: transparent;
background: transparent;
color: #444;
}
.m-btn-downarrow {
display: inline-block;
width: 16px;
height: 16px;
line-height: 16px;
_vertical-align: middle;
}
a.m-btn-active {
background-position: bottom right;
}
a.m-btn-active span.l-btn-left {
background-position: bottom left;
}
a.m-btn-plain-active {
background: transparent;
padding: 0 5px 0 0;
border-width: 1px;
border-style: solid;
-moz-border-radius: 0px 0px 0px 0px;
-webkit-border-radius: 0px 0px 0px 0px;
border-radius: 0px 0px 0px 0px;
}
.m-btn-downarrow {
background: url('images/menu_arrows.png') no-repeat 2px center;
}
a.m-btn-plain-active {
border-color: #ddd;
background-color: #E6E6E6;
color: #444;
}
.s-btn-downarrow {
display: inline-block;
margin: 0 0 0 4px;
padding: 0 0 0 1px;
width: 14px;
height: 16px;
line-height: 16px;
border-width: 0;
border-style: solid;
_vertical-align: middle;
}
a.s-btn-active {
background-position: bottom right;
}
a.s-btn-active span.l-btn-left {
background-position: bottom left;
}
a.s-btn-plain-active {
background: transparent;
padding: 0 5px 0 0;
border-width: 1px;
border-style: solid;
-moz-border-radius: 0px 0px 0px 0px;
-webkit-border-radius: 0px 0px 0px 0px;
border-radius: 0px 0px 0px 0px;
}
.s-btn-downarrow {
background: url('images/menu_arrows.png') no-repeat 2px center;
border-color: #b3b3b3;
}
a:hover.l-btn .s-btn-downarrow,
a.s-btn-active .s-btn-downarrow,
a.s-btn-plain-active .s-btn-downarrow {
background-position: 1px center;
padding: 0;
border-width: 0 0 0 1px;
}
a.s-btn-plain-active {
border-color: #ddd;
background-color: #E6E6E6;
color: #444;
}
.messager-body {
padding: 10px;
overflow: hidden;
}
.messager-button {
text-align: center;
padding-top: 10px;
}
.messager-icon {
float: left;
width: 32px;
height: 32px;
margin: 0 10px 10px 0;
}
.messager-error {
background: url('images/messager_icons.png') no-repeat scroll -64px 0;
}
.messager-info {
background: url('images/messager_icons.png') no-repeat scroll 0 0;
}
.messager-question {
background: url('images/messager_icons.png') no-repeat scroll -32px 0;
}
.messager-warning {
background: url('images/messager_icons.png') no-repeat scroll -96px 0;
}
.messager-progress {
padding: 10px;
}
.messager-p-msg {
margin-bottom: 5px;
}
.messager-body .messager-input {
width: 100%;
padding: 1px 0;
border: 1px solid #ddd;
}
.tree {
margin: 0;
padding: 0;
list-style-type: none;
}
.tree li {
white-space: nowrap;
}
.tree li ul {
list-style-type: none;
margin: 0;
padding: 0;
}
.tree-node {
height: 18px;
white-space: nowrap;
cursor: pointer;
}
.tree-hit {
cursor: pointer;
}
.tree-expanded,
.tree-collapsed,
.tree-folder,
.tree-file,
.tree-checkbox,
.tree-indent {
display: inline-block;
width: 16px;
height: 18px;
vertical-align: top;
overflow: hidden;
}
.tree-expanded {
background: url('images/tree_icons.png') no-repeat -18px 0px;
}
.tree-expanded-hover {
background: url('images/tree_icons.png') no-repeat -50px 0px;
}
.tree-collapsed {
background: url('images/tree_icons.png') no-repeat 0px 0px;
}
.tree-collapsed-hover {
background: url('images/tree_icons.png') no-repeat -32px 0px;
}
.tree-lines .tree-expanded,
.tree-lines .tree-root-first .tree-expanded {
background: url('images/tree_icons.png') no-repeat -144px 0;
}
.tree-lines .tree-collapsed,
.tree-lines .tree-root-first .tree-collapsed {
background: url('images/tree_icons.png') no-repeat -128px 0;
}
.tree-lines .tree-node-last .tree-expanded,
.tree-lines .tree-root-one .tree-expanded {
background: url('images/tree_icons.png') no-repeat -80px 0;
}
.tree-lines .tree-node-last .tree-collapsed,
.tree-lines .tree-root-one .tree-collapsed {
background: url('images/tree_icons.png') no-repeat -64px 0;
}
.tree-line {
background: url('images/tree_icons.png') no-repeat -176px 0;
}
.tree-join {
background: url('images/tree_icons.png') no-repeat -192px 0;
}
.tree-joinbottom {
background: url('images/tree_icons.png') no-repeat -160px 0;
}
.tree-folder {
background: url('images/tree_icons.png') no-repeat -208px 0;
}
.tree-folder-open {
background: url('images/tree_icons.png') no-repeat -224px 0;
}
.tree-file {
background: url('images/tree_icons.png') no-repeat -240px 0;
}
.tree-loading {
background: url('images/loading.gif') no-repeat center center;
}
.tree-checkbox0 {
background: url('images/tree_icons.png') no-repeat -208px -18px;
}
.tree-checkbox1 {
background: url('images/tree_icons.png') no-repeat -224px -18px;
}
.tree-checkbox2 {
background: url('images/tree_icons.png') no-repeat -240px -18px;
}
.tree-title {
font-size: 12px;
display: inline-block;
text-decoration: none;
vertical-align: top;
white-space: nowrap;
padding: 0 2px;
height: 18px;
line-height: 18px;
}
.tree-node-proxy {
font-size: 12px;
line-height: 20px;
padding: 0 2px 0 20px;
border-width: 1px;
border-style: solid;
z-index: 9900000;
}
.tree-dnd-icon {
display: inline-block;
position: absolute;
width: 16px;
height: 18px;
left: 2px;
top: 50%;
margin-top: -9px;
}
.tree-dnd-yes {
background: url('images/tree_icons.png') no-repeat -256px 0;
}
.tree-dnd-no {
background: url('images/tree_icons.png') no-repeat -256px -18px;
}
.tree-node-top {
border-top: 1px dotted red;
}
.tree-node-bottom {
border-bottom: 1px dotted red;
}
.tree-node-append .tree-title {
border: 1px dotted red;
}
.tree-editor {
border: 1px solid #ccc;
font-size: 12px;
height: 14px !important;
height: 18px;
line-height: 14px;
padding: 1px 2px;
width: 80px;
position: absolute;
top: 0;
}
.tree-node-proxy {
background-color: #fff;
color: #444;
border-color: #ddd;
}
.tree-node-hover {
background: #E6E6E6;
color: #444;
}
.tree-node-selected {
background: #CCE6FF;
color: #000;
}
.validatebox-tip {
position: absolute;
width: 200px;
height: auto;
display: none;
z-index: 9900000;
}
.validatebox-tip-content {
display: inline-block;
position: absolute;
top: 0px;
left: 8px;
width: 150px;
border-width: 1px;
border-style: solid;
padding: 3px 5px;
z-index: 9900001;
font-size: 12px;
}
.validatebox-tip-pointer {
display: inline-block;
width: 8px;
height: 16px;
position: absolute;
left: 1px;
top: 0px;
z-index: 9900002;
}
.validatebox-tip-left .validatebox-tip-content {
left: auto;
right: 8px;
}
.validatebox-tip-left .validatebox-tip-pointer {
background-position: -20px center;
left: auto;
right: 1px;
}
.validatebox-invalid {
background-image: url('images/validatebox_warning.png');
background-repeat: no-repeat;
background-position: right center;
border-color: #ffa8a8;
background-color: #fff3f3;
color: #000;
}
.validatebox-tip-pointer {
background: url('images/validatebox_arrows.png') no-repeat -4px center;
}
.validatebox-tip-content {
border-color: #CC9933;
background-color: #FFFFCC;
color: #000;
}
/*添加box的样式*/
.easyui-textbox{border:1px solid #DDDDDD;vertical-align:middle; }
/* 高级搜索下拉框样式*/
.gradeSearchBox{border:1px solid #DDDDDD;width:82px;height:20px;clip:rect(0px,81px,19px,0px);overflow:hidden;}
.gradeSelectSearchBox{position:relative;left:1px;top:1px;font-size:13px;width:81px;line-height:20px;border:0px;color:#909993;} | zz-ms | trunk/zz-ms-v2.0/src/main/webapp/themes/metro/easyui.css | CSS | asf20 | 41,770 |
.searchbox {
display: inline-block;
white-space: nowrap;
margin: 0;
padding: 0;
border-width: 1px;
border-style: solid;
overflow: hidden;
}
.searchbox .searchbox-text {
font-size: 12px;
border: 0;
margin: 0;
padding: 0;
line-height: 20px;
height: 20px;
*margin-top: -1px;
*height: 18px;
*line-height: 18px;
_height: 18px;
_line-height: 18px;
vertical-align: baseline;
}
.searchbox .searchbox-prompt {
font-size: 12px;
color: #ccc;
}
.searchbox-button {
width: 18px;
height: 20px;
overflow: hidden;
display: inline-block;
vertical-align: top;
cursor: pointer;
opacity: 0.6;
filter: alpha(opacity=60);
}
.searchbox-button-hover {
opacity: 1.0;
filter: alpha(opacity=100);
}
.searchbox a.l-btn-plain {
height: 20px;
border: 0;
padding: 0 6px 0 0;
vertical-align: top;
-moz-border-radius: 0;
-webkit-border-radius: 0;
border-radius: 0;
opacity: 0.6;
filter: alpha(opacity=60);
}
.searchbox a.l-btn .l-btn-left {
padding: 2px 0 2px 4px;
}
.searchbox a.l-btn-plain:hover {
-moz-border-radius: 0;
-webkit-border-radius: 0;
border-radius: 0;
border: 0;
padding: 0 6px 0 0;
opacity: 1.0;
filter: alpha(opacity=100);
}
.searchbox a.m-btn-plain-active {
-moz-border-radius: 0;
-webkit-border-radius: 0;
border-radius: 0;
}
.searchbox-button {
background: url('images/searchbox_button.png') no-repeat center center;
}
.searchbox {
border-color: #ddd;
background-color: #fff;
}
.searchbox a.l-btn-plain {
background: #ffffff;
}
| zz-ms | trunk/zz-ms-v2.0/src/main/webapp/themes/metro/searchbox.css | CSS | asf20 | 1,525 |
.spinner {
display: inline-block;
white-space: nowrap;
margin: 0;
padding: 0;
border-width: 1px;
border-style: solid;
overflow: hidden;
vertical-align: middle;
}
.spinner .spinner-text {
font-size: 12px;
border: 0px;
line-height: 20px;
height: 20px;
margin: 0;
padding: 0 2px;
*margin-top: -1px;
*height: 18px;
*line-height: 18px;
_height: 18px;
_line-height: 18px;
vertical-align: baseline;
}
.spinner-arrow {
display: inline-block;
overflow: hidden;
vertical-align: top;
margin: 0;
padding: 0;
}
.spinner-arrow-up,
.spinner-arrow-down {
opacity: 0.6;
filter: alpha(opacity=60);
display: block;
font-size: 1px;
width: 18px;
height: 10px;
}
.spinner-arrow-hover {
opacity: 1.0;
filter: alpha(opacity=100);
}
.spinner-arrow-up {
background: url('images/spinner_arrows.png') no-repeat 1px center;
}
.spinner-arrow-down {
background: url('images/spinner_arrows.png') no-repeat -15px center;
}
.spinner {
border-color: #ddd;
}
.spinner-arrow {
background-color: #ffffff;
}
.spinner-arrow-hover {
background-color: #E6E6E6;
}
| zz-ms | trunk/zz-ms-v2.0/src/main/webapp/themes/metro/spinner.css | CSS | asf20 | 1,097 |
.layout {
position: relative;
overflow: hidden;
margin: 0;
padding: 0;
z-index: 0;
}
.layout-panel {
position: absolute;
overflow: hidden;
}
.layout-panel-east,
.layout-panel-west {
z-index: 2;
}
.layout-panel-north,
.layout-panel-south {
z-index: 3;
}
.layout-expand {
position: absolute;
padding: 0px;
font-size: 1px;
cursor: pointer;
z-index: 1;
}
.layout-expand .panel-header,
.layout-expand .panel-body {
background: transparent;
filter: none;
overflow: hidden;
}
.layout-expand .panel-header {
border-bottom-width: 0px;
}
.layout-split-proxy-h,
.layout-split-proxy-v {
position: absolute;
font-size: 1px;
display: none;
z-index: 5;
}
.layout-split-proxy-h {
width: 5px;
cursor: e-resize;
}
.layout-split-proxy-v {
height: 5px;
cursor: n-resize;
}
.layout-mask {
position: absolute;
background: #fafafa;
filter: alpha(opacity=10);
opacity: 0.10;
z-index: 4;
}
.layout-button-up {
background: url('images/layout_arrows.png') no-repeat -16px -16px;
}
.layout-button-down {
background: url('images/layout_arrows.png') no-repeat -16px 0;
}
.layout-button-left {
background: url('images/layout_arrows.png') no-repeat 0 0;
}
.layout-button-right {
background: url('images/layout_arrows.png') no-repeat 0 -16px;
}
.layout-split-proxy-h,
.layout-split-proxy-v {
background-color: #b3b3b3;
}
.layout-split-north {
border-bottom: 5px solid #fff;
}
.layout-split-south {
border-top: 5px solid #fff;
}
.layout-split-east {
border-left: 5px solid #fff;
}
.layout-split-west {
border-right: 5px solid #fff;
}
.layout-expand {
background-color: #ffffff;
}
.layout-expand-over {
background-color: #ffffff;
}
| zz-ms | trunk/zz-ms-v2.0/src/main/webapp/themes/metro/layout.css | CSS | asf20 | 1,681 |
.combobox-item {
padding: 2px;
font-size: 12px;
padding: 3px;
padding-right: 0px;
}
.combobox-item-hover {
background-color: #E6E6E6;
color: #444;
}
.combobox-item-selected {
background-color: #CCE6FF;
color: #000;
}
| zz-ms | trunk/zz-ms-v2.0/src/main/webapp/themes/metro/combobox.css | CSS | asf20 | 233 |
.panel {
overflow: hidden;
font-size: 12px;
text-align: left;
}
.panel-header,
.panel-body {
border-width: 1px;
border-style: solid;
}
.panel-header {
padding: 5px;
position: relative;
}
.panel-title {
background: url('images/blank.gif') no-repeat;
}
.panel-header-noborder {
border-width: 0 0 1px 0;
}
.panel-body {
overflow: auto;
border-top-width: 0px;
}
.panel-body-noheader {
border-top-width: 1px;
}
.panel-body-noborder {
border-width: 0px;
}
.panel-with-icon {
padding-left: 18px;
}
.panel-icon,
.panel-tool {
position: absolute;
top: 50%;
margin-top: -8px;
height: 16px;
overflow: hidden;
}
.panel-icon {
left: 5px;
width: 16px;
}
.panel-tool {
right: 5px;
width: auto;
}
.panel-tool a {
display: inline-block;
width: 16px;
height: 16px;
opacity: 0.6;
filter: alpha(opacity=60);
margin: 0 0 0 2px;
vertical-align: top;
}
.panel-tool a:hover {
opacity: 1;
filter: alpha(opacity=100);
background-color: #E6E6E6;
-moz-border-radius: -2px -2px -2px -2px;
-webkit-border-radius: -2px -2px -2px -2px;
border-radius: -2px -2px -2px -2px;
}
.panel-loading {
padding: 11px 0px 10px 30px;
}
.panel-noscroll {
overflow: hidden;
}
.panel-fit,
.panel-fit body {
height: 100%;
margin: 0;
padding: 0;
border: 0;
overflow: hidden;
}
.panel-loading {
background: url('images/loading.gif') no-repeat 10px 10px;
}
.panel-tool-close {
background: url('images/panel_tools.png') no-repeat -16px 0px;
}
.panel-tool-min {
background: url('images/panel_tools.png') no-repeat 0px 0px;
}
.panel-tool-max {
background: url('images/panel_tools.png') no-repeat 0px -16px;
}
.panel-tool-restore {
background: url('images/panel_tools.png') no-repeat -16px -16px;
}
.panel-tool-collapse {
background: url('images/panel_tools.png') no-repeat -32px 0;
}
.panel-tool-expand {
background: url('images/panel_tools.png') no-repeat -32px -16px;
}
.panel-header,
.panel-body {
border-color: #ddd;
}
.panel-header {
background-color: #ffffff;
}
.panel-body {
background-color: #fff;
color: #444;
}
.panel-title {
font-weight: bold;
color: #777;
height: 16px;
line-height: 16px;
}
| zz-ms | trunk/zz-ms-v2.0/src/main/webapp/themes/metro/panel.css | CSS | asf20 | 2,163 |
.propertygrid .datagrid-view1 .datagrid-body td {
padding-bottom: 1px;
border-width: 0 1px 0 0;
}
.propertygrid .datagrid-group {
height: 21px;
overflow: hidden;
border-width: 0 0 1px 0;
border-style: solid;
}
.propertygrid .datagrid-group span {
font-weight: bold;
}
.propertygrid .datagrid-view1 .datagrid-body td {
border-color: #ddd;
}
.propertygrid .datagrid-view1 .datagrid-group {
border-color: #ffffff;
}
.propertygrid .datagrid-view2 .datagrid-group {
border-color: #ddd;
}
.propertygrid .datagrid-group,
.propertygrid .datagrid-view1 .datagrid-body,
.propertygrid .datagrid-view1 .datagrid-row-over,
.propertygrid .datagrid-view1 .datagrid-row-selected {
background: #ffffff;
}
| zz-ms | trunk/zz-ms-v2.0/src/main/webapp/themes/metro/propertygrid.css | CSS | asf20 | 710 |
.tabs-container {
overflow: hidden;
}
.tabs-header {
border-width: 1px;
border-style: solid;
border-bottom-width: 0;
position: relative;
padding: 0;
padding-top: 2px;
overflow: hidden;
}
.tabs-header-plain {
border: 0;
background: transparent;
}
.tabs-scroller-left,
.tabs-scroller-right {
position: absolute;
top: auto;
bottom: 0;
width: 18px;
height: 28px !important;
height: 30px;
font-size: 1px;
display: none;
cursor: pointer;
border-width: 1px;
border-style: solid;
}
.tabs-scroller-left {
left: 0;
}
.tabs-scroller-right {
right: 0;
}
.tabs-header-plain .tabs-scroller-left,
.tabs-header-plain .tabs-scroller-right {
height: 25px !important;
height: 27px;
}
.tabs-tool {
position: absolute;
bottom: 0;
padding: 1px;
overflow: hidden;
border-width: 1px;
border-style: solid;
}
.tabs-header-plain .tabs-tool {
padding: 0 1px;
}
.tabs-wrap {
position: relative;
left: 0;
overflow: hidden;
width: 100%;
margin: 0;
padding: 0;
}
.tabs-scrolling {
margin-left: 18px;
margin-right: 18px;
}
.tabs-disabled {
opacity: 0.3;
filter: alpha(opacity=30);
}
.tabs {
list-style-type: none;
height: 26px;
margin: 0px;
padding: 0px;
padding-left: 4px;
font-size: 12px;
width: 5000px;
border-style: solid;
border-width: 0 0 1px 0;
}
.tabs li {
float: left;
display: inline-block;
margin: 0 4px -1px 0;
padding: 0;
position: relative;
border: 0;
}
.tabs li a.tabs-inner {
display: inline-block;
text-decoration: none;
margin: 0;
padding: 0 10px;
height: 25px;
line-height: 25px;
text-align: center;
white-space: nowrap;
border-width: 1px;
border-style: solid;
-moz-border-radius: 0px 0px 0 0;
-webkit-border-radius: 0px 0px 0 0;
border-radius: 0px 0px 0 0;
}
.tabs li.tabs-selected a.tabs-inner {
font-weight: bold;
outline: none;
}
.tabs li.tabs-selected a:hover.tabs-inner {
cursor: default;
pointer: default;
}
.tabs li a.tabs-close,
.tabs-p-tool {
position: absolute;
font-size: 1px;
display: block;
height: 12px;
padding: 0;
top: 50%;
margin-top: -6px;
overflow: hidden;
}
.tabs li a.tabs-close {
width: 12px;
right: 5px;
opacity: 0.6;
filter: alpha(opacity=60);
}
.tabs-p-tool {
right: 16px;
}
.tabs-p-tool a {
display: inline-block;
font-size: 1px;
width: 12px;
height: 12px;
margin: 0;
opacity: 0.6;
filter: alpha(opacity=60);
}
.tabs li a:hover.tabs-close,
.tabs-p-tool a:hover {
opacity: 1;
filter: alpha(opacity=100);
cursor: hand;
cursor: pointer;
}
.tabs-with-icon {
padding-left: 18px;
}
.tabs-icon {
position: absolute;
width: 16px;
height: 16px;
left: 10px;
top: 50%;
margin-top: -8px;
}
.tabs-closable {
padding-right: 8px;
}
.tabs-panels {
margin: 0px;
padding: 0px;
border-width: 1px;
border-style: solid;
border-top-width: 0;
overflow: hidden;
}
.tabs-header-bottom {
border-width: 0 1px 1px 1px;
padding: 0 0 2px 0;
}
.tabs-header-bottom .tabs {
border-width: 1px 0 0 0;
}
.tabs-header-bottom .tabs li {
margin: -1px 4px 0 0;
}
.tabs-header-bottom .tabs li a.tabs-inner {
-moz-border-radius: 0 0 0px 0px;
-webkit-border-radius: 0 0 0px 0px;
border-radius: 0 0 0px 0px;
}
.tabs-header-bottom .tabs-tool {
top: 0;
}
.tabs-header-bottom .tabs-scroller-left,
.tabs-header-bottom .tabs-scroller-right {
top: 0;
bottom: auto;
}
.tabs-panels-top {
border-width: 1px 1px 0 1px;
}
.tabs-header-left {
float: left;
border-width: 1px 0 1px 1px;
padding: 0;
}
.tabs-header-right {
float: right;
border-width: 1px 1px 1px 0;
padding: 0;
}
.tabs-header-left .tabs-wrap,
.tabs-header-right .tabs-wrap {
height: 100%;
}
.tabs-header-left .tabs {
height: 100%;
padding: 4px 0 0 4px;
border-width: 0 1px 0 0;
}
.tabs-header-right .tabs {
height: 100%;
padding: 4px 4px 0 0;
border-width: 0 0 0 1px;
}
.tabs-header-left .tabs li,
.tabs-header-right .tabs li {
display: block;
width: 100%;
position: relative;
}
.tabs-header-left .tabs li {
left: auto;
right: 0;
margin: 0 -1px 4px 0;
float: right;
}
.tabs-header-right .tabs li {
left: 0;
right: auto;
margin: 0 0 4px -1px;
float: left;
}
.tabs-header-left .tabs li a.tabs-inner {
display: block;
text-align: left;
-moz-border-radius: 0px 0 0 0px;
-webkit-border-radius: 0px 0 0 0px;
border-radius: 0px 0 0 0px;
}
.tabs-header-right .tabs li a.tabs-inner {
display: block;
text-align: left;
-moz-border-radius: 0 0px 0px 0;
-webkit-border-radius: 0 0px 0px 0;
border-radius: 0 0px 0px 0;
}
.tabs-panels-right {
float: right;
border-width: 1px 1px 1px 0;
}
.tabs-panels-left {
float: left;
border-width: 1px 0 1px 1px;
}
.tabs-header-noborder,
.tabs-panels-noborder {
border: 0px;
}
.tabs-header-plain {
border: 0px;
background: transparent;
}
.tabs-scroller-left {
background: #ffffff url('images/tabs_icons.png') no-repeat 1px center;
}
.tabs-scroller-right {
background: #ffffff url('images/tabs_icons.png') no-repeat -15px center;
}
.tabs li a.tabs-close {
background: url('images/tabs_icons.png') no-repeat -34px center;
}
.tabs li a.tabs-inner:hover {
background: #E6E6E6;
color: #444;
filter: none;
}
.tabs li.tabs-selected a.tabs-inner {
background-color: #fff;
color: #777;
}
.tabs li a.tabs-inner {
color: #777;
background-color: #ffffff;
}
.tabs-header,
.tabs-tool {
background-color: #ffffff;
}
.tabs-header-plain {
background: transparent;
}
.tabs-header,
.tabs-scroller-left,
.tabs-scroller-right,
.tabs-tool,
.tabs,
.tabs-panels,
.tabs li a.tabs-inner,
.tabs li.tabs-selected a.tabs-inner,
.tabs-header-bottom .tabs li.tabs-selected a.tabs-inner,
.tabs-header-left .tabs li.tabs-selected a.tabs-inner,
.tabs-header-right .tabs li.tabs-selected a.tabs-inner {
border-color: #ddd;
}
.tabs-p-tool a:hover,
.tabs li a:hover.tabs-close,
.tabs-scroller-over {
background-color: #E6E6E6;
}
.tabs li.tabs-selected a.tabs-inner {
border-bottom: 1px solid #fff;
}
.tabs-header-bottom .tabs li.tabs-selected a.tabs-inner {
border-top: 1px solid #fff;
}
.tabs-header-left .tabs li.tabs-selected a.tabs-inner {
border-right: 1px solid #fff;
}
.tabs-header-right .tabs li.tabs-selected a.tabs-inner {
border-left: 1px solid #fff;
}
| zz-ms | trunk/zz-ms-v2.0/src/main/webapp/themes/metro/tabs.css | CSS | asf20 | 6,235 |
.messager-body {
padding: 10px;
overflow: hidden;
}
.messager-button {
text-align: center;
padding-top: 10px;
}
.messager-icon {
float: left;
width: 32px;
height: 32px;
margin: 0 10px 10px 0;
}
.messager-error {
background: url('images/messager_icons.png') no-repeat scroll -64px 0;
}
.messager-info {
background: url('images/messager_icons.png') no-repeat scroll 0 0;
}
.messager-question {
background: url('images/messager_icons.png') no-repeat scroll -32px 0;
}
.messager-warning {
background: url('images/messager_icons.png') no-repeat scroll -96px 0;
}
.messager-progress {
padding: 10px;
}
.messager-p-msg {
margin-bottom: 5px;
}
.messager-body .messager-input {
width: 100%;
padding: 1px 0;
border: 1px solid #ddd;
}
| zz-ms | trunk/zz-ms-v2.0/src/main/webapp/themes/metro/messager.css | CSS | asf20 | 758 |
.slider-disabled {
opacity: 0.5;
filter: alpha(opacity=50);
}
.slider-h {
height: 22px;
}
.slider-v {
width: 22px;
}
.slider-inner {
position: relative;
height: 6px;
top: 7px;
border-width: 1px;
border-style: solid;
border-radius: 3px;
}
.slider-handle {
position: absolute;
display: block;
outline: none;
width: 20px;
height: 20px;
top: -7px;
margin-left: -10px;
}
.slider-tip {
position: absolute;
display: inline-block;
line-height: 12px;
white-space: nowrap;
top: -22px;
}
.slider-rule {
position: relative;
top: 15px;
}
.slider-rule span {
position: absolute;
display: inline-block;
font-size: 0;
height: 5px;
border-width: 0 0 0 1px;
border-style: solid;
}
.slider-rulelabel {
position: relative;
top: 20px;
}
.slider-rulelabel span {
position: absolute;
display: inline-block;
}
.slider-v .slider-inner {
width: 6px;
left: 7px;
top: 0;
float: left;
}
.slider-v .slider-handle {
left: 3px;
margin-top: -10px;
}
.slider-v .slider-tip {
left: -10px;
margin-top: -6px;
}
.slider-v .slider-rule {
float: left;
top: 0;
left: 16px;
}
.slider-v .slider-rule span {
width: 5px;
height: 'auto';
border-left: 0;
border-width: 1px 0 0 0;
border-style: solid;
}
.slider-v .slider-rulelabel {
float: left;
top: 0;
left: 23px;
}
.slider-handle {
background: url('images/slider_handle.png') no-repeat;
}
.slider-inner {
border-color: #ddd;
background: #ffffff;
}
.slider-rule span {
border-color: #ddd;
}
.slider-rulelabel span {
color: #444;
}
| zz-ms | trunk/zz-ms-v2.0/src/main/webapp/themes/metro/slider.css | CSS | asf20 | 1,552 |
.s-btn-downarrow {
display: inline-block;
margin: 0 0 0 4px;
padding: 0 0 0 1px;
width: 14px;
height: 16px;
line-height: 16px;
border-width: 0;
border-style: solid;
_vertical-align: middle;
}
a.s-btn-active {
background-position: bottom right;
}
a.s-btn-active span.l-btn-left {
background-position: bottom left;
}
a.s-btn-plain-active {
background: transparent;
padding: 0 5px 0 0;
border-width: 1px;
border-style: solid;
-moz-border-radius: 0px 0px 0px 0px;
-webkit-border-radius: 0px 0px 0px 0px;
border-radius: 0px 0px 0px 0px;
}
.s-btn-downarrow {
background: url('images/menu_arrows.png') no-repeat 2px center;
border-color: #b3b3b3;
}
a:hover.l-btn .s-btn-downarrow,
a.s-btn-active .s-btn-downarrow,
a.s-btn-plain-active .s-btn-downarrow {
background-position: 1px center;
padding: 0;
border-width: 0 0 0 1px;
}
a.s-btn-plain-active {
border-color: #ddd;
background-color: #E6E6E6;
color: #444;
}
| zz-ms | trunk/zz-ms-v2.0/src/main/webapp/themes/metro/splitbutton.css | CSS | asf20 | 956 |
.tree {
margin: 0;
padding: 0;
list-style-type: none;
}
.tree li {
white-space: nowrap;
}
.tree li ul {
list-style-type: none;
margin: 0;
padding: 0;
}
.tree-node {
height: 18px;
white-space: nowrap;
cursor: pointer;
}
.tree-hit {
cursor: pointer;
}
.tree-expanded,
.tree-collapsed,
.tree-folder,
.tree-file,
.tree-checkbox,
.tree-indent {
display: inline-block;
width: 16px;
height: 18px;
vertical-align: top;
overflow: hidden;
}
.tree-expanded {
background: url('images/tree_icons.png') no-repeat -18px 0px;
}
.tree-expanded-hover {
background: url('images/tree_icons.png') no-repeat -50px 0px;
}
.tree-collapsed {
background: url('images/tree_icons.png') no-repeat 0px 0px;
}
.tree-collapsed-hover {
background: url('images/tree_icons.png') no-repeat -32px 0px;
}
.tree-lines .tree-expanded,
.tree-lines .tree-root-first .tree-expanded {
background: url('images/tree_icons.png') no-repeat -144px 0;
}
.tree-lines .tree-collapsed,
.tree-lines .tree-root-first .tree-collapsed {
background: url('images/tree_icons.png') no-repeat -128px 0;
}
.tree-lines .tree-node-last .tree-expanded,
.tree-lines .tree-root-one .tree-expanded {
background: url('images/tree_icons.png') no-repeat -80px 0;
}
.tree-lines .tree-node-last .tree-collapsed,
.tree-lines .tree-root-one .tree-collapsed {
background: url('images/tree_icons.png') no-repeat -64px 0;
}
.tree-line {
background: url('images/tree_icons.png') no-repeat -176px 0;
}
.tree-join {
background: url('images/tree_icons.png') no-repeat -192px 0;
}
.tree-joinbottom {
background: url('images/tree_icons.png') no-repeat -160px 0;
}
.tree-folder {
background: url('images/tree_icons.png') no-repeat -208px 0;
}
.tree-folder-open {
background: url('images/tree_icons.png') no-repeat -224px 0;
}
.tree-file {
background: url('images/tree_icons.png') no-repeat -240px 0;
}
.tree-loading {
background: url('images/loading.gif') no-repeat center center;
}
.tree-checkbox0 {
background: url('images/tree_icons.png') no-repeat -208px -18px;
}
.tree-checkbox1 {
background: url('images/tree_icons.png') no-repeat -224px -18px;
}
.tree-checkbox2 {
background: url('images/tree_icons.png') no-repeat -240px -18px;
}
.tree-title {
font-size: 12px;
display: inline-block;
text-decoration: none;
vertical-align: top;
white-space: nowrap;
padding: 0 2px;
height: 18px;
line-height: 18px;
}
.tree-node-proxy {
font-size: 12px;
line-height: 20px;
padding: 0 2px 0 20px;
border-width: 1px;
border-style: solid;
z-index: 9900000;
}
.tree-dnd-icon {
display: inline-block;
position: absolute;
width: 16px;
height: 18px;
left: 2px;
top: 50%;
margin-top: -9px;
}
.tree-dnd-yes {
background: url('images/tree_icons.png') no-repeat -256px 0;
}
.tree-dnd-no {
background: url('images/tree_icons.png') no-repeat -256px -18px;
}
.tree-node-top {
border-top: 1px dotted red;
}
.tree-node-bottom {
border-bottom: 1px dotted red;
}
.tree-node-append .tree-title {
border: 1px dotted red;
}
.tree-editor {
border: 1px solid #ccc;
font-size: 12px;
height: 14px !important;
height: 18px;
line-height: 14px;
padding: 1px 2px;
width: 80px;
position: absolute;
top: 0;
}
.tree-node-proxy {
background-color: #fff;
color: #444;
border-color: #ddd;
}
.tree-node-hover {
background: #E6E6E6;
color: #444;
}
.tree-node-selected {
background: #CCE6FF;
color: #000;
}
| zz-ms | trunk/zz-ms-v2.0/src/main/webapp/themes/metro/tree.css | CSS | asf20 | 3,425 |
.progressbar {
border-width: 1px;
border-style: solid;
-moz-border-radius: 0px 0px 0px 0px;
-webkit-border-radius: 0px 0px 0px 0px;
border-radius: 0px 0px 0px 0px;
overflow: hidden;
}
.progressbar-text {
text-align: center;
position: absolute;
}
.progressbar-value {
position: relative;
overflow: hidden;
width: 0;
-moz-border-radius: 0px 0 0 0px;
-webkit-border-radius: 0px 0 0 0px;
border-radius: 0px 0 0 0px;
}
.progressbar {
border-color: #ddd;
}
.progressbar-text {
color: #444;
}
.progressbar-value .progressbar-text {
background-color: #CCE6FF;
color: #000;
}
| zz-ms | trunk/zz-ms-v2.0/src/main/webapp/themes/metro/progressbar.css | CSS | asf20 | 603 |
.accordion {
overflow: hidden;
border-width: 1px;
border-style: solid;
}
.accordion .accordion-header {
border-width: 0 0 1px;
cursor: pointer;
}
.accordion .accordion-body {
border-width: 0 0 1px;
}
.accordion-noborder {
border-width: 0;
}
.accordion-noborder .accordion-header {
border-width: 0 0 1px;
}
.accordion-noborder .accordion-body {
border-width: 0 0 1px;
}
.accordion-collapse {
background: url('images/accordion_arrows.png') no-repeat 0 0;
}
.accordion-expand {
background: url('images/accordion_arrows.png') no-repeat -16px 0;
}
.accordion {
background: #fff;
border-color: #ddd;
}
.accordion .accordion-header {
background: #ffffff;
filter: none;
}
.accordion .accordion-header-selected {
background: #CCE6FF;
}
.accordion .accordion-header-selected .panel-title {
color: #000;
}
| zz-ms | trunk/zz-ms-v2.0/src/main/webapp/themes/metro/accordion.css | CSS | asf20 | 829 |
.validatebox-tip {
position: absolute;
width: 200px;
height: auto;
display: none;
z-index: 9900000;
}
.validatebox-tip-content {
display: inline-block;
position: absolute;
top: 0px;
left: 8px;
width: 150px;
border-width: 1px;
border-style: solid;
padding: 3px 5px;
z-index: 9900001;
font-size: 12px;
}
.validatebox-tip-pointer {
display: inline-block;
width: 8px;
height: 16px;
position: absolute;
left: 1px;
top: 0px;
z-index: 9900002;
}
.validatebox-tip-left .validatebox-tip-content {
left: auto;
right: 8px;
}
.validatebox-tip-left .validatebox-tip-pointer {
background-position: -20px center;
left: auto;
right: 1px;
}
.validatebox-invalid {
background-image: url('images/validatebox_warning.png');
background-repeat: no-repeat;
background-position: right center;
border-color: #ffa8a8;
background-color: #fff3f3;
color: #000;
}
.validatebox-tip-pointer {
background: url('images/validatebox_arrows.png') no-repeat -4px center;
}
.validatebox-tip-content {
border-color: #CC9933;
background-color: #FFFFCC;
color: #000;
}
| zz-ms | trunk/zz-ms-v2.0/src/main/webapp/themes/metro/validatebox.css | CSS | asf20 | 1,101 |
.datagrid .panel-body {
overflow: hidden;
position: relative;
}
.datagrid-view {
position: relative;
overflow: hidden;
}
.datagrid-view1,
.datagrid-view2 {
position: absolute;
overflow: hidden;
top: 0;
}
.datagrid-view1 {
left: 0;
}
.datagrid-view2 {
right: 0;
}
.datagrid-mask {
position: absolute;
left: 0;
top: 0;
width: 100%;
height: 100%;
opacity: 0.3;
filter: alpha(opacity=30);
display: none;
}
.datagrid-mask-msg {
position: absolute;
top: 50%;
margin-top: -20px;
padding: 12px 5px 10px 30px;
width: auto;
height: 16px;
border-width: 2px;
border-style: solid;
display: none;
}
.datagrid-sort-icon {
padding: 0;
}
.datagrid-toolbar {
height: auto;
padding: 1px 2px;
border-width: 0 0 1px 0;
border-style: solid;
}
.datagrid-btn-separator {
float: left;
height: 24px;
border-left: 1px solid #ddd;
border-right: 1px solid #fff;
margin: 2px 1px;
}
.datagrid .datagrid-pager {
margin: 0;
border-width: 1px 0 0 0;
border-style: solid;
}
.datagrid .datagrid-pager-top {
border-width: 0 0 1px 0;
}
.datagrid-header {
overflow: hidden;
cursor: default;
border-width: 0 0 1px 0;
border-style: solid;
}
.datagrid-header-inner {
float: left;
width: 10000px;
}
.datagrid-header-row,
.datagrid-row {
height: 25px;
}
.datagrid-header td,
.datagrid-body td,
.datagrid-footer td {
border-width: 0 1px 1px 0;
border-style: dotted;
margin: 0;
padding: 0;
}
.datagrid-cell,
.datagrid-cell-group,
.datagrid-header-rownumber,
.datagrid-cell-rownumber {
margin: 0;
padding: 0 4px;
white-space: nowrap;
word-wrap: normal;
overflow: hidden;
height: 18px;
line-height: 18px;
font-weight: normal;
font-size: 12px;
}
.datagrid-cell-group {
text-align: center;
}
.datagrid-header-rownumber,
.datagrid-cell-rownumber {
width: 25px;
text-align: center;
margin: 0;
padding: 0;
}
.datagrid-body {
margin: 0;
padding: 0;
overflow: auto;
zoom: 1;
}
.datagrid-view1 .datagrid-body-inner {
padding-bottom: 20px;
}
.datagrid-view1 .datagrid-body {
overflow: hidden;
}
.datagrid-footer {
overflow: hidden;
}
.datagrid-footer-inner {
border-width: 1px 0 0 0;
border-style: solid;
width: 10000px;
float: left;
}
.datagrid-row-editing .datagrid-cell {
height: auto;
}
.datagrid-header-check,
.datagrid-cell-check {
padding: 0;
width: 27px;
height: 18px;
font-size: 1px;
text-align: center;
overflow: hidden;
}
.datagrid-header-check input,
.datagrid-cell-check input {
margin: 0;
padding: 0;
width: 15px;
height: 18px;
}
.datagrid-resize-proxy {
position: absolute;
width: 1px;
height: 10000px;
top: 0;
cursor: e-resize;
display: none;
}
.datagrid-body .datagrid-editable {
margin: 0;
padding: 0;
}
.datagrid-body .datagrid-editable table {
width: 100%;
height: 100%;
}
.datagrid-body .datagrid-editable td {
border: 0;
margin: 0;
padding: 0;
}
.datagrid-body .datagrid-editable .datagrid-editable-input {
margin: 0;
padding: 2px;
border-width: 1px;
border-style: solid;
}
.datagrid-sort-desc .datagrid-sort-icon {
padding: 0 13px 0 0;
background: url('images/datagrid_icons.png') no-repeat -16px center;
}
.datagrid-sort-asc .datagrid-sort-icon {
padding: 0 13px 0 0;
background: url('images/datagrid_icons.png') no-repeat 0px center;
}
.datagrid-row-collapse {
background: url('images/datagrid_icons.png') no-repeat -48px center;
}
.datagrid-row-expand {
background: url('images/datagrid_icons.png') no-repeat -32px center;
}
.datagrid-mask-msg {
background: #fff url('images/loading.gif') no-repeat scroll 5px center;
}
.datagrid-header,
.datagrid-td-rownumber {
background-color: #ffffff;
}
.datagrid-cell-rownumber {
color: #444;
}
.datagrid-resize-proxy {
background: #b3b3b3;
}
.datagrid-mask {
background: #eee;
}
.datagrid-mask-msg {
border-color: #ddd;
}
.datagrid-toolbar,
.datagrid-pager {
background: #fff;
}
.datagrid-header,
.datagrid-toolbar,
.datagrid-pager,
.datagrid-footer-inner {
border-color: #ddd;
}
.datagrid-header td,
.datagrid-body td,
.datagrid-footer td {
border-color: #ddd;
}
.datagrid-htable,
.datagrid-btable,
.datagrid-ftable {
color: #444;
}
.datagrid-row-alt {
background: #f5f5f5;
}
.datagrid-row-over,
.datagrid-header td.datagrid-header-over {
background: #E6E6E6;
color: #444;
cursor: default;
}
.datagrid-row-selected {
background: #CCE6FF;
color: #000;
}
.datagrid-body .datagrid-editable .datagrid-editable-input {
border-color: #ddd;
}
| zz-ms | trunk/zz-ms-v2.0/src/main/webapp/themes/metro/datagrid.css | CSS | asf20 | 4,500 |
.m-btn-downarrow {
display: inline-block;
width: 16px;
height: 16px;
line-height: 16px;
_vertical-align: middle;
}
a.m-btn-active {
background-position: bottom right;
}
a.m-btn-active span.l-btn-left {
background-position: bottom left;
}
a.m-btn-plain-active {
background: transparent;
padding: 0 5px 0 0;
border-width: 1px;
border-style: solid;
-moz-border-radius: 0px 0px 0px 0px;
-webkit-border-radius: 0px 0px 0px 0px;
border-radius: 0px 0px 0px 0px;
}
.m-btn-downarrow {
background: url('images/menu_arrows.png') no-repeat 2px center;
}
a.m-btn-plain-active {
border-color: #ddd;
background-color: #E6E6E6;
color: #444;
}
| zz-ms | trunk/zz-ms-v2.0/src/main/webapp/themes/metro/menubutton.css | CSS | asf20 | 663 |
.menu {
position: absolute;
margin: 0;
padding: 2px;
border-width: 1px;
border-style: solid;
overflow: hidden;
}
.menu-item {
position: relative;
margin: 0;
padding: 0;
overflow: hidden;
white-space: nowrap;
cursor: pointer;
border-width: 1px;
border-style: solid;
}
.menu-text {
height: 20px;
line-height: 20px;
float: left;
padding-left: 28px;
}
.menu-icon {
position: absolute;
width: 16px;
height: 16px;
left: 2px;
top: 50%;
margin-top: -8px;
}
.menu-rightarrow {
position: absolute;
width: 16px;
height: 16px;
right: 0;
top: 50%;
margin-top: -8px;
}
.menu-line {
position: absolute;
left: 26px;
top: 0;
height: 2000px;
font-size: 1px;
}
.menu-sep {
margin: 3px 0px 3px 25px;
font-size: 1px;
}
.menu-active {
-moz-border-radius: 0px 0px 0px 0px;
-webkit-border-radius: 0px 0px 0px 0px;
border-radius: 0px 0px 0px 0px;
}
.menu-item-disabled {
opacity: 0.5;
filter: alpha(opacity=50);
cursor: default;
}
.menu-text,
.menu-text span {
font-size: 12px;
}
.menu-shadow {
position: absolute;
-moz-border-radius: 0px 0px 0px 0px;
-webkit-border-radius: 0px 0px 0px 0px;
border-radius: 0px 0px 0px 0px;
background: #eee;
-moz-box-shadow: 2px 2px 3px #ededed;
-webkit-box-shadow: 2px 2px 3px #ededed;
box-shadow: 2px 2px 3px #ededed;
filter: progid:DXImageTransform.Microsoft.Blur(pixelRadius=2,MakeShadow=false,ShadowOpacity=0.2);
}
.menu-rightarrow {
background: url('images/menu_arrows.png') no-repeat -32px center;
}
.menu-line {
border-left: 1px solid #ddd;
border-right: 1px solid #fff;
}
.menu-sep {
border-top: 1px solid #ddd;
border-bottom: 1px solid #fff;
}
.menu {
background-color: #ffffff;
border-color: #ddd;
color: #444;
}
.menu-content {
background: #fff;
}
.menu-item {
border-color: transparent;
_border-color: #ffffff;
}
.menu-active {
border-color: #ddd;
color: #444;
background: #E6E6E6;
}
.menu-active-disabled {
border-color: transparent;
background: transparent;
color: #444;
}
| zz-ms | trunk/zz-ms-v2.0/src/main/webapp/themes/metro/menu.css | CSS | asf20 | 2,037 |
.combo {
display: inline-block;
white-space: nowrap;
margin: 0;
padding: 0;
border-width: 1px;
border-style: solid;
overflow: hidden;
vertical-align: middle;
}
.combo .combo-text {
font-size: 12px;
border: 0px;
line-height: 20px;
height: 20px;
margin: 0;
padding: 0px 2px;
*margin-top: -1px;
*height: 18px;
*line-height: 18px;
_height: 18px;
_line-height: 18px;
vertical-align: baseline;
}
.combo-arrow {
width: 18px;
height: 20px;
overflow: hidden;
display: inline-block;
vertical-align: top;
cursor: pointer;
opacity: 0.6;
filter: alpha(opacity=60);
}
.combo-arrow-hover {
opacity: 1.0;
filter: alpha(opacity=100);
}
.combo-panel {
overflow: auto;
}
.combo-arrow {
background: url('images/combo_arrow.png') no-repeat center center;
}
.combo,
.combo-panel {
background-color: #fff;
}
.combo {
border-color: #ddd;
background-color: #fff;
}
.combo-arrow {
background-color: #ffffff;
}
.combo-arrow-hover {
background-color: #E6E6E6;
}
| zz-ms | trunk/zz-ms-v2.0/src/main/webapp/themes/metro/combo.css | CSS | asf20 | 1,008 |
.calendar {
border-width: 1px;
border-style: solid;
padding: 1px;
overflow: hidden;
font-size: 12px;
}
.calendar table {
border-collapse: separate;
font-size: 12px;
width: 100%;
height: 100%;
}
.calendar-noborder {
border: 0;
}
.calendar-header {
position: relative;
height: 22px;
}
.calendar-title {
text-align: center;
height: 22px;
}
.calendar-title span {
position: relative;
display: inline-block;
top: 2px;
padding: 0 3px;
height: 18px;
line-height: 18px;
cursor: pointer;
-moz-border-radius: 0px 0px 0px 0px;
-webkit-border-radius: 0px 0px 0px 0px;
border-radius: 0px 0px 0px 0px;
}
.calendar-prevmonth,
.calendar-nextmonth,
.calendar-prevyear,
.calendar-nextyear {
position: absolute;
top: 50%;
margin-top: -7px;
width: 14px;
height: 14px;
cursor: pointer;
font-size: 1px;
-moz-border-radius: 0px 0px 0px 0px;
-webkit-border-radius: 0px 0px 0px 0px;
border-radius: 0px 0px 0px 0px;
}
.calendar-prevmonth {
left: 20px;
background: url('images/calendar_arrows.png') no-repeat -18px -2px;
}
.calendar-nextmonth {
right: 20px;
background: url('images/calendar_arrows.png') no-repeat -34px -2px;
}
.calendar-prevyear {
left: 3px;
background: url('images/calendar_arrows.png') no-repeat -1px -2px;
}
.calendar-nextyear {
right: 3px;
background: url('images/calendar_arrows.png') no-repeat -49px -2px;
}
.calendar-body {
position: relative;
}
.calendar-body th,
.calendar-body td {
text-align: center;
}
.calendar-day {
border: 0;
padding: 1px;
cursor: pointer;
-moz-border-radius: 0px 0px 0px 0px;
-webkit-border-radius: 0px 0px 0px 0px;
border-radius: 0px 0px 0px 0px;
}
.calendar-other-month {
opacity: 0.3;
filter: alpha(opacity=30);
}
.calendar-menu {
position: absolute;
top: 0;
left: 0;
width: 180px;
height: 150px;
padding: 5px;
font-size: 12px;
display: none;
overflow: hidden;
}
.calendar-menu-year-inner {
text-align: center;
padding-bottom: 5px;
}
.calendar-menu-year {
width: 40px;
text-align: center;
border-width: 1px;
border-style: solid;
margin: 0;
padding: 2px;
font-weight: bold;
}
.calendar-menu-prev,
.calendar-menu-next {
display: inline-block;
width: 21px;
height: 21px;
vertical-align: top;
cursor: pointer;
-moz-border-radius: 0px 0px 0px 0px;
-webkit-border-radius: 0px 0px 0px 0px;
border-radius: 0px 0px 0px 0px;
}
.calendar-menu-prev {
margin-right: 10px;
background: url('images/calendar_arrows.png') no-repeat 2px 2px;
}
.calendar-menu-next {
margin-left: 10px;
background: url('images/calendar_arrows.png') no-repeat -45px 2px;
}
.calendar-menu-month {
text-align: center;
cursor: pointer;
font-weight: bold;
-moz-border-radius: 0px 0px 0px 0px;
-webkit-border-radius: 0px 0px 0px 0px;
border-radius: 0px 0px 0px 0px;
}
.calendar-body th,
.calendar-menu-month {
color: #919191;
}
.calendar-day {
color: #444;
}
.calendar-sunday {
color: #CC2222;
}
.calendar-saturday {
color: #00ee00;
}
.calendar-today {
color: #0000ff;
}
.calendar-menu-year {
border-color: #ddd;
}
.calendar {
border-color: #ddd;
}
.calendar-header {
background: #ffffff;
}
.calendar-body,
.calendar-menu {
background: #fff;
}
.calendar-body th {
background: #fff;
}
.calendar-hover,
.calendar-nav-hover,
.calendar-menu-hover {
background-color: #E6E6E6;
color: #444;
}
.calendar-hover {
border: 1px solid #ddd;
padding: 0;
}
.calendar-selected {
background-color: #CCE6FF;
color: #000;
border: 1px solid #99cdff;
padding: 0;
}
| zz-ms | trunk/zz-ms-v2.0/src/main/webapp/themes/metro/calendar.css | CSS | asf20 | 3,542 |
.window {
overflow: hidden;
padding: 5px;
border-width: 1px;
border-style: solid;
}
.window .window-header {
background: transparent;
padding: 0px 0px 6px 0px;
}
.window .window-body {
border-width: 1px;
border-style: solid;
border-top-width: 0px;
}
.window .window-body-noheader {
border-top-width: 1px;
}
.window .window-header .panel-icon,
.window .window-header .panel-tool {
top: 50%;
margin-top: -11px;
}
.window .window-header .panel-icon {
left: 1px;
}
.window .window-header .panel-tool {
right: 1px;
}
.window .window-header .panel-with-icon {
padding-left: 18px;
}
.window-proxy {
position: absolute;
overflow: hidden;
}
.window-proxy-mask {
position: absolute;
filter: alpha(opacity=5);
opacity: 0.05;
}
.window-mask {
position: absolute;
left: 0;
top: 0;
width: 100%;
height: 100%;
filter: alpha(opacity=40);
opacity: 0.40;
font-size: 1px;
*zoom: 1;
overflow: hidden;
}
.window,
.window-shadow {
position: absolute;
-moz-border-radius: 5px 5px 5px 5px;
-webkit-border-radius: 5px 5px 5px 5px;
border-radius: 5px 5px 5px 5px;
}
.window-shadow {
background: #ccc;
-moz-box-shadow: 2px 2px 3px #cccccc;
-webkit-box-shadow: 2px 2px 3px #cccccc;
box-shadow: 2px 2px 3px #cccccc;
filter: progid:DXImageTransform.Microsoft.Blur(pixelRadius=2,MakeShadow=false,ShadowOpacity=0.2);
}
.window,
.window .window-body {
border-color: #95B8E7;
}
.window {
background-color: #E0ECFF;
background: -webkit-linear-gradient(top,#EFF5FF 0,#E0ECFF 20%);
background: -moz-linear-gradient(top,#EFF5FF 0,#E0ECFF 20%);
background: -o-linear-gradient(top,#EFF5FF 0,#E0ECFF 20%);
background: linear-gradient(to bottom,#EFF5FF 0,#E0ECFF 20%);
background-repeat: repeat-x;
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr=#EFF5FF,endColorstr=#E0ECFF,GradientType=0);
}
.window-proxy {
border: 1px dashed #95B8E7;
}
.window-proxy-mask,
.window-mask {
background: #ccc;
}
| zz-ms | trunk/zz-ms-v2.0/src/main/webapp/themes/default/window.css | CSS | asf20 | 1,967 |
.dialog-content {
overflow: auto;
}
.dialog-toolbar {
padding: 2px 5px;
}
.dialog-tool-separator {
float: left;
height: 24px;
border-left: 1px solid #ccc;
border-right: 1px solid #fff;
margin: 2px 1px;
}
.dialog-button {
padding: 5px;
text-align: right;
}
.dialog-button .l-btn {
margin-left: 5px;
}
.dialog-toolbar,
.dialog-button {
background: #F4F4F4;
}
.dialog-toolbar {
border-bottom: 1px solid #dddddd;
}
.dialog-button {
border-top: 1px solid #dddddd;
}
| zz-ms | trunk/zz-ms-v2.0/src/main/webapp/themes/default/dialog.css | CSS | asf20 | 487 |
.datebox-calendar-inner {
height: 180px;
}
.datebox-button {
height: 18px;
padding: 2px 5px;
font-size: 12px;
text-align: center;
}
.datebox-current,
.datebox-close,
.datebox-ok {
text-decoration: none;
font-weight: bold;
opacity: 0.6;
filter: alpha(opacity=60);
}
.datebox-current,
.datebox-close {
float: left;
}
.datebox-close {
float: right;
}
.datebox-button-hover {
opacity: 1.0;
filter: alpha(opacity=100);
}
.datebox .combo-arrow {
background-image: url('images/datebox_arrow.png');
background-position: center center;
}
.datebox-button {
background-color: #F4F4F4;
}
.datebox-current,
.datebox-close,
.datebox-ok {
color: #444;
}
| zz-ms | trunk/zz-ms-v2.0/src/main/webapp/themes/default/datebox.css | CSS | asf20 | 673 |
.pagination {
zoom: 1;
}
.pagination table {
float: left;
height: 30px;
}
.pagination td {
border: 0;
}
.pagination-btn-separator {
float: left;
height: 24px;
border-left: 1px solid #ccc;
border-right: 1px solid #fff;
margin: 3px 1px;
}
.pagination .pagination-num {
border-width: 1px;
border-style: solid;
margin: 0 2px;
padding: 2px;
width: 2em;
height: auto;
}
.pagination-page-list {
margin: 0px 6px;
padding: 1px 2px;
width: auto;
height: auto;
border-width: 1px;
border-style: solid;
}
.pagination-info {
float: right;
margin: 0 6px 0 0;
padding: 0;
height: 30px;
line-height: 30px;
font-size: 12px;
}
.pagination span {
font-size: 12px;
}
.pagination-first {
background: url('images/pagination_icons.png') no-repeat 0 0;
}
.pagination-prev {
background: url('images/pagination_icons.png') no-repeat -16px 0;
}
.pagination-next {
background: url('images/pagination_icons.png') no-repeat -32px 0;
}
.pagination-last {
background: url('images/pagination_icons.png') no-repeat -48px 0;
}
.pagination-load {
background: url('images/pagination_icons.png') no-repeat -64px 0;
}
.pagination-loading {
background: url('images/loading.gif') no-repeat;
}
.pagination-page-list,
.pagination .pagination-num {
border-color: #95B8E7;
}
| zz-ms | trunk/zz-ms-v2.0/src/main/webapp/themes/default/pagination.css | CSS | asf20 | 1,299 |
a.l-btn {
background-position: right 0;
font-size: 12px;
text-decoration: none;
display: inline-block;
zoom: 1;
height: 24px;
padding-right: 18px;
cursor: pointer;
outline: none;
}
a.l-btn-plain {
padding-right: 5px;
border: 0;
padding: 1px 6px 1px 1px;
}
a.l-btn-disabled {
color: #ccc;
opacity: 0.5;
filter: alpha(opacity=50);
cursor: default;
}
a.l-btn span.l-btn-left {
display: inline-block;
background-position: 0 -48px;
padding: 4px 0px 4px 18px;
line-height: 16px;
height: 16px;
}
a.l-btn-plain span.l-btn-left {
padding-left: 5px;
}
a.l-btn span span.l-btn-text {
display: inline-block;
vertical-align: baseline;
width: auto;
height: 16px;
line-height: 16px;
padding: 0;
margin: 0;
}
a.l-btn span span.l-btn-icon-left {
padding: 0 0 0 20px;
background-position: left center;
}
a.l-btn span span.l-btn-icon-right {
padding: 0 20px 0 0;
background-position: right center;
}
a.l-btn span span span.l-btn-empty {
display: inline-block;
margin: 0;
padding: 0;
width: 16px;
}
a:hover.l-btn {
background-position: right -24px;
outline: none;
text-decoration: none;
}
a:hover.l-btn span.l-btn-left {
background-position: 0 bottom;
}
a:hover.l-btn-plain {
padding: 0 5px 0 0;
}
a:hover.l-btn-disabled {
background-position: right 0;
}
a:hover.l-btn-disabled span.l-btn-left {
background-position: 0 -48px;
}
a.l-btn .l-btn-focus {
outline: #0000FF dotted thin;
}
a.l-btn {
color: #444;
background-image: url('images/linkbutton_bg.png');
background-repeat: no-repeat;
-moz-border-radius: 5px 5px 5px 5px;
-webkit-border-radius: 5px 5px 5px 5px;
border-radius: 5px 5px 5px 5px;
}
a.l-btn span.l-btn-left {
background-image: url('images/linkbutton_bg.png');
background-repeat: no-repeat;
}
a.l-btn-plain,
a.l-btn-plain span.l-btn-left {
background: transparent;
border: 0;
filter: none;
}
a:hover.l-btn-plain {
background: #eaf2ff;
color: #000000;
border: 1px solid #b7d2ff;
-moz-border-radius: 5px 5px 5px 5px;
-webkit-border-radius: 5px 5px 5px 5px;
border-radius: 5px 5px 5px 5px;
}
a.l-btn-disabled,
a:hover.l-btn-disabled {
filter: alpha(opacity=50);
}
| zz-ms | trunk/zz-ms-v2.0/src/main/webapp/themes/default/linkbutton.css | CSS | asf20 | 2,181 |
.panel {
overflow: hidden;
font-size: 12px;
text-align: left;
}
.panel-header,
.panel-body {
border-width: 1px;
border-style: solid;
}
.panel-header {
padding: 5px;
position: relative;
}
.panel-title {
background: url('images/blank.gif') no-repeat;
}
.panel-header-noborder {
border-width: 0 0 1px 0;
}
.panel-body {
overflow: auto;
border-top-width: 0px;
}
.panel-body-noheader {
border-top-width: 1px;
}
.panel-body-noborder {
border-width: 0px;
}
.panel-with-icon {
padding-left: 18px;
}
.panel-icon,
.panel-tool {
position: absolute;
top: 50%;
margin-top: -8px;
height: 16px;
overflow: hidden;
}
.panel-icon {
left: 5px;
width: 16px;
}
.panel-tool {
right: 5px;
width: auto;
}
.panel-tool a {
display: inline-block;
width: 16px;
height: 16px;
opacity: 0.6;
filter: alpha(opacity=60);
margin: 0 0 0 2px;
vertical-align: top;
}
.panel-tool a:hover {
opacity: 1;
filter: alpha(opacity=100);
background-color: #eaf2ff;
-moz-border-radius: 3px 3px 3px 3px;
-webkit-border-radius: 3px 3px 3px 3px;
border-radius: 3px 3px 3px 3px;
}
.panel-loading {
padding: 11px 0px 10px 30px;
}
.panel-noscroll {
overflow: hidden;
}
.panel-fit,
.panel-fit body {
height: 100%;
margin: 0;
padding: 0;
border: 0;
overflow: hidden;
}
.panel-loading {
background: url('images/loading.gif') no-repeat 10px 10px;
}
.panel-tool-close {
background: url('images/panel_tools.png') no-repeat -16px 0px;
}
.panel-tool-min {
background: url('images/panel_tools.png') no-repeat 0px 0px;
}
.panel-tool-max {
background: url('images/panel_tools.png') no-repeat 0px -16px;
}
.panel-tool-restore {
background: url('images/panel_tools.png') no-repeat -16px -16px;
}
.panel-tool-collapse {
background: url('images/panel_tools.png') no-repeat -32px 0;
}
.panel-tool-expand {
background: url('images/panel_tools.png') no-repeat -32px -16px;
}
.panel-header,
.panel-body {
border-color: #95B8E7;
}
.panel-header {
background-color: #E0ECFF;
background: -webkit-linear-gradient(top,#EFF5FF 0,#E0ECFF 100%);
background: -moz-linear-gradient(top,#EFF5FF 0,#E0ECFF 100%);
background: -o-linear-gradient(top,#EFF5FF 0,#E0ECFF 100%);
background: linear-gradient(to bottom,#EFF5FF 0,#E0ECFF 100%);
background-repeat: repeat-x;
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr=#EFF5FF,endColorstr=#E0ECFF,GradientType=0);
}
.panel-body {
background-color: #ffffff;
color: #000000;
}
.panel-title {
font-weight: bold;
color: #0E2D5F;
height: 16px;
line-height: 16px;
}
.accordion {
overflow: hidden;
border-width: 1px;
border-style: solid;
}
.accordion .accordion-header {
border-width: 0 0 1px;
cursor: pointer;
}
.accordion .accordion-body {
border-width: 0 0 1px;
}
.accordion-noborder {
border-width: 0;
}
.accordion-noborder .accordion-header {
border-width: 0 0 1px;
}
.accordion-noborder .accordion-body {
border-width: 0 0 1px;
}
.accordion-collapse {
background: url('images/accordion_arrows.png') no-repeat 0 0;
}
.accordion-expand {
background: url('images/accordion_arrows.png') no-repeat -16px 0;
}
.accordion {
background: #ffffff;
border-color: #95B8E7;
}
.accordion .accordion-header {
background: #E0ECFF;
filter: none;
}
.accordion .accordion-header-selected {
background: #FBEC88;
}
.accordion .accordion-header-selected .panel-title {
color: #000000;
}
.window {
overflow: hidden;
padding: 5px;
border-width: 1px;
border-style: solid;
}
.window .window-header {
background: transparent;
padding: 0px 0px 6px 0px;
}
.window .window-body {
border-width: 1px;
border-style: solid;
border-top-width: 0px;
}
.window .window-body-noheader {
border-top-width: 1px;
}
.window .window-header .panel-icon,
.window .window-header .panel-tool {
top: 50%;
margin-top: -11px;
}
.window .window-header .panel-icon {
left: 1px;
}
.window .window-header .panel-tool {
right: 1px;
}
.window .window-header .panel-with-icon {
padding-left: 18px;
}
.window-proxy {
position: absolute;
overflow: hidden;
}
.window-proxy-mask {
position: absolute;
filter: alpha(opacity=5);
opacity: 0.05;
}
.window-mask {
position: absolute;
left: 0;
top: 0;
width: 100%;
height: 100%;
filter: alpha(opacity=40);
opacity: 0.40;
font-size: 1px;
*zoom: 1;
overflow: hidden;
}
.window,
.window-shadow {
position: absolute;
-moz-border-radius: 5px 5px 5px 5px;
-webkit-border-radius: 5px 5px 5px 5px;
border-radius: 5px 5px 5px 5px;
}
.window-shadow {
background: #ccc;
-moz-box-shadow: 2px 2px 3px #cccccc;
-webkit-box-shadow: 2px 2px 3px #cccccc;
box-shadow: 2px 2px 3px #cccccc;
filter: progid:DXImageTransform.Microsoft.Blur(pixelRadius=2,MakeShadow=false,ShadowOpacity=0.2);
}
.window,
.window .window-body {
border-color: #95B8E7;
}
.window {
background-color: #E0ECFF;
background: -webkit-linear-gradient(top,#EFF5FF 0,#E0ECFF 20%);
background: -moz-linear-gradient(top,#EFF5FF 0,#E0ECFF 20%);
background: -o-linear-gradient(top,#EFF5FF 0,#E0ECFF 20%);
background: linear-gradient(to bottom,#EFF5FF 0,#E0ECFF 20%);
background-repeat: repeat-x;
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr=#EFF5FF,endColorstr=#E0ECFF,GradientType=0);
}
.window-proxy {
border: 1px dashed #95B8E7;
}
.window-proxy-mask,
.window-mask {
background: #ccc;
}
.dialog-content {
overflow: auto;
}
.dialog-toolbar {
padding: 2px 5px;
}
.dialog-tool-separator {
float: left;
height: 24px;
border-left: 1px solid #ccc;
border-right: 1px solid #fff;
margin: 2px 1px;
}
.dialog-button {
padding: 5px;
text-align: right;
}
.dialog-button .l-btn {
margin-left: 5px;
}
.dialog-toolbar,
.dialog-button {
background: #F4F4F4;
}
.dialog-toolbar {
border-bottom: 1px solid #dddddd;
}
.dialog-button {
border-top: 1px solid #dddddd;
}
.combo {
display: inline-block;
white-space: nowrap;
margin: 0;
padding: 0;
border-width: 1px;
border-style: solid;
overflow: hidden;
vertical-align: middle;
}
.combo .combo-text {
font-size: 12px;
border: 0px;
line-height: 20px;
height: 20px;
margin: 0;
padding: 0px 2px;
*margin-top: -1px;
*height: 18px;
*line-height: 18px;
_height: 18px;
_line-height: 18px;
vertical-align: baseline;
}
.combo-arrow {
width: 18px;
height: 20px;
overflow: hidden;
display: inline-block;
vertical-align: top;
cursor: pointer;
opacity: 0.6;
filter: alpha(opacity=60);
}
.combo-arrow-hover {
opacity: 1.0;
filter: alpha(opacity=100);
}
.combo-panel {
overflow: auto;
}
.combo-arrow {
background: url('images/combo_arrow.png') no-repeat center center;
}
.combo,
.combo-panel {
background-color: #ffffff;
}
.combo {
border-color: #95B8E7;
background-color: #ffffff;
}
.combo-arrow {
background-color: #E0ECFF;
}
.combo-arrow-hover {
background-color: #eaf2ff;
}
.combobox-item {
padding: 2px;
font-size: 12px;
padding: 3px;
padding-right: 0px;
}
.combobox-item-hover {
background-color: #eaf2ff;
color: #000000;
}
.combobox-item-selected {
background-color: #FBEC88;
color: #000000;
}
.layout {
position: relative;
overflow: hidden;
margin: 0;
padding: 0;
z-index: 0;
}
.layout-panel {
position: absolute;
overflow: hidden;
}
.layout-panel-east,
.layout-panel-west {
z-index: 2;
}
.layout-panel-north,
.layout-panel-south {
z-index: 3;
}
.layout-expand {
position: absolute;
padding: 0px;
font-size: 1px;
cursor: pointer;
z-index: 1;
}
.layout-expand .panel-header,
.layout-expand .panel-body {
background: transparent;
filter: none;
overflow: hidden;
}
.layout-expand .panel-header {
border-bottom-width: 0px;
}
.layout-split-proxy-h,
.layout-split-proxy-v {
position: absolute;
font-size: 1px;
display: none;
z-index: 5;
}
.layout-split-proxy-h {
width: 5px;
cursor: e-resize;
}
.layout-split-proxy-v {
height: 5px;
cursor: n-resize;
}
.layout-mask {
position: absolute;
background: #fafafa;
filter: alpha(opacity=10);
opacity: 0.10;
z-index: 4;
}
.layout-button-up {
background: url('images/layout_arrows.png') no-repeat -16px -16px;
}
.layout-button-down {
background: url('images/layout_arrows.png') no-repeat -16px 0;
}
.layout-button-left {
background: url('images/layout_arrows.png') no-repeat 0 0;
}
.layout-button-right {
background: url('images/layout_arrows.png') no-repeat 0 -16px;
}
.layout-split-proxy-h,
.layout-split-proxy-v {
background-color: #aac5e7;
}
.layout-split-north {
border-bottom: 5px solid #E6EEF8;
}
.layout-split-south {
border-top: 5px solid #E6EEF8;
}
.layout-split-east {
border-left: 5px solid #E6EEF8;
}
.layout-split-west {
border-right: 5px solid #E6EEF8;
}
.layout-expand {
background-color: #E0ECFF;
}
.layout-expand-over {
background-color: #E0ECFF;
}
.tabs-container {
overflow: hidden;
}
.tabs-header {
border-width: 1px;
border-style: solid;
border-bottom-width: 0;
position: relative;
padding: 0;
padding-top: 2px;
overflow: hidden;
}
.tabs-header-plain {
border: 0;
background: transparent;
}
.tabs-scroller-left,
.tabs-scroller-right {
position: absolute;
top: auto;
bottom: 0;
width: 18px;
height: 28px !important;
height: 30px;
font-size: 1px;
display: none;
cursor: pointer;
border-width: 1px;
border-style: solid;
}
.tabs-scroller-left {
left: 0;
}
.tabs-scroller-right {
right: 0;
}
.tabs-header-plain .tabs-scroller-left,
.tabs-header-plain .tabs-scroller-right {
height: 25px !important;
height: 27px;
}
.tabs-tool {
position: absolute;
bottom: 0;
padding: 1px;
overflow: hidden;
border-width: 1px;
border-style: solid;
}
.tabs-header-plain .tabs-tool {
padding: 0 1px;
}
.tabs-wrap {
position: relative;
left: 0;
overflow: hidden;
width: 100%;
margin: 0;
padding: 0;
}
.tabs-scrolling {
margin-left: 18px;
margin-right: 18px;
}
.tabs-disabled {
opacity: 0.3;
filter: alpha(opacity=30);
}
.tabs {
list-style-type: none;
height: 26px;
margin: 0px;
padding: 0px;
padding-left: 4px;
font-size: 12px;
width: 5000px;
border-style: solid;
border-width: 0 0 1px 0;
}
.tabs li {
float: left;
display: inline-block;
margin: 0 4px -1px 0;
padding: 0;
position: relative;
border: 0;
}
.tabs li a.tabs-inner {
display: inline-block;
text-decoration: none;
margin: 0;
padding: 0 10px;
height: 25px;
line-height: 25px;
text-align: center;
white-space: nowrap;
border-width: 1px;
border-style: solid;
-moz-border-radius: 5px 5px 0 0;
-webkit-border-radius: 5px 5px 0 0;
border-radius: 5px 5px 0 0;
}
.tabs li.tabs-selected a.tabs-inner {
font-weight: bold;
outline: none;
}
.tabs li.tabs-selected a:hover.tabs-inner {
cursor: default;
pointer: default;
}
.tabs li a.tabs-close,
.tabs-p-tool {
position: absolute;
font-size: 1px;
display: block;
height: 12px;
padding: 0;
top: 50%;
margin-top: -6px;
overflow: hidden;
}
.tabs li a.tabs-close {
width: 12px;
right: 5px;
opacity: 0.6;
filter: alpha(opacity=60);
}
.tabs-p-tool {
right: 16px;
}
.tabs-p-tool a {
display: inline-block;
font-size: 1px;
width: 12px;
height: 12px;
margin: 0;
opacity: 0.6;
filter: alpha(opacity=60);
}
.tabs li a:hover.tabs-close,
.tabs-p-tool a:hover {
opacity: 1;
filter: alpha(opacity=100);
cursor: hand;
cursor: pointer;
}
.tabs-with-icon {
padding-left: 18px;
}
.tabs-icon {
position: absolute;
width: 16px;
height: 16px;
left: 10px;
top: 50%;
margin-top: -8px;
}
.tabs-closable {
padding-right: 8px;
}
.tabs-panels {
margin: 0px;
padding: 0px;
border-width: 1px;
border-style: solid;
border-top-width: 0;
overflow: hidden;
}
.tabs-header-bottom {
border-width: 0 1px 1px 1px;
padding: 0 0 2px 0;
}
.tabs-header-bottom .tabs {
border-width: 1px 0 0 0;
}
.tabs-header-bottom .tabs li {
margin: -1px 4px 0 0;
}
.tabs-header-bottom .tabs li a.tabs-inner {
-moz-border-radius: 0 0 5px 5px;
-webkit-border-radius: 0 0 5px 5px;
border-radius: 0 0 5px 5px;
}
.tabs-header-bottom .tabs-tool {
top: 0;
}
.tabs-header-bottom .tabs-scroller-left,
.tabs-header-bottom .tabs-scroller-right {
top: 0;
bottom: auto;
}
.tabs-panels-top {
border-width: 1px 1px 0 1px;
}
.tabs-header-left {
float: left;
border-width: 1px 0 1px 1px;
padding: 0;
}
.tabs-header-right {
float: right;
border-width: 1px 1px 1px 0;
padding: 0;
}
.tabs-header-left .tabs-wrap,
.tabs-header-right .tabs-wrap {
height: 100%;
}
.tabs-header-left .tabs {
height: 100%;
padding: 4px 0 0 4px;
border-width: 0 1px 0 0;
}
.tabs-header-right .tabs {
height: 100%;
padding: 4px 4px 0 0;
border-width: 0 0 0 1px;
}
.tabs-header-left .tabs li,
.tabs-header-right .tabs li {
display: block;
width: 100%;
position: relative;
}
.tabs-header-left .tabs li {
left: auto;
right: 0;
margin: 0 -1px 4px 0;
float: right;
}
.tabs-header-right .tabs li {
left: 0;
right: auto;
margin: 0 0 4px -1px;
float: left;
}
.tabs-header-left .tabs li a.tabs-inner {
display: block;
text-align: left;
-moz-border-radius: 5px 0 0 5px;
-webkit-border-radius: 5px 0 0 5px;
border-radius: 5px 0 0 5px;
}
.tabs-header-right .tabs li a.tabs-inner {
display: block;
text-align: left;
-moz-border-radius: 0 5px 5px 0;
-webkit-border-radius: 0 5px 5px 0;
border-radius: 0 5px 5px 0;
}
.tabs-panels-right {
float: right;
border-width: 1px 1px 1px 0;
}
.tabs-panels-left {
float: left;
border-width: 1px 0 1px 1px;
}
.tabs-header-noborder,
.tabs-panels-noborder {
border: 0px;
}
.tabs-header-plain {
border: 0px;
background: transparent;
}
.tabs-scroller-left {
background: #E0ECFF url('images/tabs_icons.png') no-repeat 1px center;
}
.tabs-scroller-right {
background: #E0ECFF url('images/tabs_icons.png') no-repeat -15px center;
}
.tabs li a.tabs-close {
background: url('images/tabs_icons.png') no-repeat -34px center;
}
.tabs li a.tabs-inner:hover {
background: #eaf2ff;
color: #000000;
filter: none;
}
.tabs li.tabs-selected a.tabs-inner {
background-color: #ffffff;
color: #0E2D5F;
background: -webkit-linear-gradient(top,#EFF5FF 0,#ffffff 100%);
background: -moz-linear-gradient(top,#EFF5FF 0,#ffffff 100%);
background: -o-linear-gradient(top,#EFF5FF 0,#ffffff 100%);
background: linear-gradient(to bottom,#EFF5FF 0,#ffffff 100%);
background-repeat: repeat-x;
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr=#EFF5FF,endColorstr=#ffffff,GradientType=0);
}
.tabs-header-bottom .tabs li.tabs-selected a.tabs-inner {
background: -webkit-linear-gradient(top,#ffffff 0,#EFF5FF 100%);
background: -moz-linear-gradient(top,#ffffff 0,#EFF5FF 100%);
background: -o-linear-gradient(top,#ffffff 0,#EFF5FF 100%);
background: linear-gradient(to bottom,#ffffff 0,#EFF5FF 100%);
background-repeat: repeat-x;
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr=#ffffff,endColorstr=#EFF5FF,GradientType=0);
}
.tabs-header-left .tabs li.tabs-selected a.tabs-inner {
background: -webkit-linear-gradient(left,#EFF5FF 0,#ffffff 100%);
background: -moz-linear-gradient(left,#EFF5FF 0,#ffffff 100%);
background: -o-linear-gradient(left,#EFF5FF 0,#ffffff 100%);
background: linear-gradient(to right,#EFF5FF 0,#ffffff 100%);
background-repeat: repeat-y;
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr=#EFF5FF,endColorstr=#ffffff,GradientType=1);
}
.tabs-header-right .tabs li.tabs-selected a.tabs-inner {
background: -webkit-linear-gradient(left,#ffffff 0,#EFF5FF 100%);
background: -moz-linear-gradient(left,#ffffff 0,#EFF5FF 100%);
background: -o-linear-gradient(left,#ffffff 0,#EFF5FF 100%);
background: linear-gradient(to right,#ffffff 0,#EFF5FF 100%);
background-repeat: repeat-y;
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr=#ffffff,endColorstr=#EFF5FF,GradientType=1);
}
.tabs li a.tabs-inner {
color: #0E2D5F;
background-color: #E0ECFF;
background: -webkit-linear-gradient(top,#EFF5FF 0,#E0ECFF 100%);
background: -moz-linear-gradient(top,#EFF5FF 0,#E0ECFF 100%);
background: -o-linear-gradient(top,#EFF5FF 0,#E0ECFF 100%);
background: linear-gradient(to bottom,#EFF5FF 0,#E0ECFF 100%);
background-repeat: repeat-x;
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr=#EFF5FF,endColorstr=#E0ECFF,GradientType=0);
}
.tabs-header,
.tabs-tool {
background-color: #E0ECFF;
}
.tabs-header-plain {
background: transparent;
}
.tabs-header,
.tabs-scroller-left,
.tabs-scroller-right,
.tabs-tool,
.tabs,
.tabs-panels,
.tabs li a.tabs-inner,
.tabs li.tabs-selected a.tabs-inner,
.tabs-header-bottom .tabs li.tabs-selected a.tabs-inner,
.tabs-header-left .tabs li.tabs-selected a.tabs-inner,
.tabs-header-right .tabs li.tabs-selected a.tabs-inner {
border-color: #95B8E7;
}
.tabs-p-tool a:hover,
.tabs li a:hover.tabs-close,
.tabs-scroller-over {
background-color: #eaf2ff;
}
.tabs li.tabs-selected a.tabs-inner {
border-bottom: 1px solid #ffffff;
}
.tabs-header-bottom .tabs li.tabs-selected a.tabs-inner {
border-top: 1px solid #ffffff;
}
.tabs-header-left .tabs li.tabs-selected a.tabs-inner {
border-right: 1px solid #ffffff;
}
.tabs-header-right .tabs li.tabs-selected a.tabs-inner {
border-left: 1px solid #ffffff;
}
a.l-btn {
background-position: right 0;
font-size: 12px;
text-decoration: none;
display: inline-block;
zoom: 1;
height: 24px;
padding-right: 18px;
cursor: pointer;
outline: none;
}
a.l-btn-plain {
padding-right: 5px;
border: 0;
padding: 1px 6px 1px 1px;
}
a.l-btn-disabled {
color: #ccc;
opacity: 0.5;
filter: alpha(opacity=50);
cursor: default;
}
a.l-btn span.l-btn-left {
display: inline-block;
background-position: 0 -48px;
padding: 4px 0px 4px 18px;
line-height: 16px;
height: 16px;
}
a.l-btn-plain span.l-btn-left {
padding-left: 5px;
}
a.l-btn span span.l-btn-text {
display: inline-block;
vertical-align: baseline;
width: auto;
height: 16px;
line-height: 16px;
padding: 0;
margin: 0;
}
a.l-btn span span.l-btn-icon-left {
padding: 0 0 0 20px;
background-position: left center;
}
a.l-btn span span.l-btn-icon-right {
padding: 0 20px 0 0;
background-position: right center;
}
a.l-btn span span span.l-btn-empty {
display: inline-block;
margin: 0;
padding: 0;
width: 16px;
}
a:hover.l-btn {
background-position: right -24px;
outline: none;
text-decoration: none;
}
a:hover.l-btn span.l-btn-left {
background-position: 0 bottom;
}
a:hover.l-btn-plain {
padding: 0 5px 0 0;
}
a:hover.l-btn-disabled {
background-position: right 0;
}
a:hover.l-btn-disabled span.l-btn-left {
background-position: 0 -48px;
}
a.l-btn .l-btn-focus {
outline: #0000FF dotted thin;
}
a.l-btn {
color: #444;
background-image: url('images/linkbutton_bg.png');
background-repeat: no-repeat;
-moz-border-radius: 5px 5px 5px 5px;
-webkit-border-radius: 5px 5px 5px 5px;
border-radius: 5px 5px 5px 5px;
}
a.l-btn span.l-btn-left {
background-image: url('images/linkbutton_bg.png');
background-repeat: no-repeat;
}
a.l-btn-plain,
a.l-btn-plain span.l-btn-left {
background: transparent;
border: 0;
filter: none;
}
a:hover.l-btn-plain {
background: #eaf2ff;
color: #000000;
border: 1px solid #b7d2ff;
-moz-border-radius: 5px 5px 5px 5px;
-webkit-border-radius: 5px 5px 5px 5px;
border-radius: 5px 5px 5px 5px;
}
a.l-btn-disabled,
a:hover.l-btn-disabled {
filter: alpha(opacity=50);
}
.datagrid .panel-body {
overflow: hidden;
position: relative;
}
.datagrid-view {
position: relative;
overflow: hidden;
}
.datagrid-view1,
.datagrid-view2 {
position: absolute;
overflow: hidden;
top: 0;
}
.datagrid-view1 {
left: 0;
}
.datagrid-view2 {
right: 0;
}
.datagrid-mask {
position: absolute;
left: 0;
top: 0;
width: 100%;
height: 100%;
opacity: 0.3;
filter: alpha(opacity=30);
display: none;
}
.datagrid-mask-msg {
position: absolute;
top: 50%;
margin-top: -20px;
padding: 12px 5px 10px 30px;
width: auto;
height: 16px;
border-width: 2px;
border-style: solid;
display: none;
}
.datagrid-sort-icon {
padding: 0;
}
.datagrid-toolbar {
height: auto;
padding: 1px 2px;
border-width: 0 0 1px 0;
border-style: solid;
}
.datagrid-btn-separator {
float: left;
height: 24px;
border-left: 1px solid #ccc;
border-right: 1px solid #fff;
margin: 2px 1px;
}
.datagrid .datagrid-pager {
margin: 0;
border-width: 1px 0 0 0;
border-style: solid;
}
.datagrid .datagrid-pager-top {
border-width: 0 0 1px 0;
}
.datagrid-header {
overflow: hidden;
cursor: default;
border-width: 0 0 1px 0;
border-style: solid;
}
.datagrid-header-inner {
float: left;
width: 10000px;
}
.datagrid-header-row,
.datagrid-row {
height: 25px;
}
.datagrid-header td,
.datagrid-body td,
.datagrid-footer td {
border-width: 0 1px 1px 0;
border-style: dotted;
margin: 0;
padding: 0;
}
.datagrid-cell,
.datagrid-cell-group,
.datagrid-header-rownumber,
.datagrid-cell-rownumber {
margin: 0;
padding: 0 4px;
white-space: nowrap;
word-wrap: normal;
overflow: hidden;
height: 18px;
line-height: 18px;
font-weight: normal;
font-size: 12px;
}
.datagrid-cell-group {
text-align: center;
}
.datagrid-header-rownumber,
.datagrid-cell-rownumber {
width: 25px;
text-align: center;
margin: 0;
padding: 0;
}
.datagrid-body {
margin: 0;
padding: 0;
overflow: auto;
zoom: 1;
}
.datagrid-view1 .datagrid-body-inner {
padding-bottom: 20px;
}
.datagrid-view1 .datagrid-body {
overflow: hidden;
}
.datagrid-footer {
overflow: hidden;
}
.datagrid-footer-inner {
border-width: 1px 0 0 0;
border-style: solid;
width: 10000px;
float: left;
}
.datagrid-row-editing .datagrid-cell {
height: auto;
}
.datagrid-header-check,
.datagrid-cell-check {
padding: 0;
width: 27px;
height: 18px;
font-size: 1px;
text-align: center;
overflow: hidden;
}
.datagrid-header-check input,
.datagrid-cell-check input {
margin: 0;
padding: 0;
width: 15px;
height: 18px;
}
.datagrid-resize-proxy {
position: absolute;
width: 1px;
height: 10000px;
top: 0;
cursor: e-resize;
display: none;
}
.datagrid-body .datagrid-editable {
margin: 0;
padding: 0;
}
.datagrid-body .datagrid-editable table {
width: 100%;
height: 100%;
}
.datagrid-body .datagrid-editable td {
border: 0;
margin: 0;
padding: 0;
}
.datagrid-body .datagrid-editable .datagrid-editable-input {
margin: 0;
padding: 2px;
border-width: 1px;
border-style: solid;
}
.datagrid-sort-desc .datagrid-sort-icon {
padding: 0 13px 0 0;
background: url('images/datagrid_icons.png') no-repeat -16px center;
}
.datagrid-sort-asc .datagrid-sort-icon {
padding: 0 13px 0 0;
background: url('images/datagrid_icons.png') no-repeat 0px center;
}
.datagrid-row-collapse {
background: url('images/datagrid_icons.png') no-repeat -48px center;
}
.datagrid-row-expand {
background: url('images/datagrid_icons.png') no-repeat -32px center;
}
.datagrid-mask-msg {
background: #ffffff url('images/loading.gif') no-repeat scroll 5px center;
}
.datagrid-header,
.datagrid-td-rownumber {
background-color: #efefef;
background: -webkit-linear-gradient(top,#F9F9F9 0,#efefef 100%);
background: -moz-linear-gradient(top,#F9F9F9 0,#efefef 100%);
background: -o-linear-gradient(top,#F9F9F9 0,#efefef 100%);
background: linear-gradient(to bottom,#F9F9F9 0,#efefef 100%);
background-repeat: repeat-x;
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr=#F9F9F9,endColorstr=#efefef,GradientType=0);
}
.datagrid-cell-rownumber {
color: #000000;
}
.datagrid-resize-proxy {
background: #aac5e7;
}
.datagrid-mask {
background: #ccc;
}
.datagrid-mask-msg {
border-color: #95B8E7;
}
.datagrid-toolbar,
.datagrid-pager {
background: #F4F4F4;
}
.datagrid-header,
.datagrid-toolbar,
.datagrid-pager,
.datagrid-footer-inner {
border-color: #dddddd;
}
.datagrid-header td,
.datagrid-body td,
.datagrid-footer td {
border-color: #ccc;
}
.datagrid-htable,
.datagrid-btable,
.datagrid-ftable {
color: #000000;
}
.datagrid-row-alt {
background: #fafafa;
}
.datagrid-row-over,
.datagrid-header td.datagrid-header-over {
background: #eaf2ff;
color: #000000;
cursor: default;
}
.datagrid-row-selected {
background: #FBEC88;
color: #000000;
}
.datagrid-body .datagrid-editable .datagrid-editable-input {
border-color: #95B8E7;
}
.propertygrid .datagrid-view1 .datagrid-body td {
padding-bottom: 1px;
border-width: 0 1px 0 0;
}
.propertygrid .datagrid-group {
height: 21px;
overflow: hidden;
border-width: 0 0 1px 0;
border-style: solid;
}
.propertygrid .datagrid-group span {
font-weight: bold;
}
.propertygrid .datagrid-view1 .datagrid-body td {
border-color: #dddddd;
}
.propertygrid .datagrid-view1 .datagrid-group {
border-color: #E0ECFF;
}
.propertygrid .datagrid-view2 .datagrid-group {
border-color: #dddddd;
}
.propertygrid .datagrid-group,
.propertygrid .datagrid-view1 .datagrid-body,
.propertygrid .datagrid-view1 .datagrid-row-over,
.propertygrid .datagrid-view1 .datagrid-row-selected {
background: #E0ECFF;
}
.pagination {
zoom: 1;
}
.pagination table {
float: left;
height: 30px;
}
.pagination td {
border: 0;
}
.pagination-btn-separator {
float: left;
height: 24px;
border-left: 1px solid #ccc;
border-right: 1px solid #fff;
margin: 3px 1px;
}
.pagination .pagination-num {
border-width: 1px;
border-style: solid;
margin: 0 2px;
padding: 2px;
width: 2em;
height: auto;
}
.pagination-page-list {
margin: 0px 6px;
padding: 1px 2px;
width: auto;
height: auto;
border-width: 1px;
border-style: solid;
}
.pagination-info {
float: right;
margin: 0 6px 0 0;
padding: 0;
height: 30px;
line-height: 30px;
font-size: 12px;
}
.pagination span {
font-size: 12px;
}
.pagination-first {
background: url('images/pagination_icons.png') no-repeat 0 0;
}
.pagination-prev {
background: url('images/pagination_icons.png') no-repeat -16px 0;
}
.pagination-next {
background: url('images/pagination_icons.png') no-repeat -32px 0;
}
.pagination-last {
background: url('images/pagination_icons.png') no-repeat -48px 0;
}
.pagination-load {
background: url('images/pagination_icons.png') no-repeat -64px 0;
}
.pagination-loading {
background: url('images/loading.gif') no-repeat;
}
.pagination-page-list,
.pagination .pagination-num {
border-color: #95B8E7;
}
.calendar {
border-width: 1px;
border-style: solid;
padding: 1px;
overflow: hidden;
font-size: 12px;
}
.calendar table {
border-collapse: separate;
font-size: 12px;
width: 100%;
height: 100%;
}
.calendar-noborder {
border: 0;
}
.calendar-header {
position: relative;
height: 22px;
}
.calendar-title {
text-align: center;
height: 22px;
}
.calendar-title span {
position: relative;
display: inline-block;
top: 2px;
padding: 0 3px;
height: 18px;
line-height: 18px;
cursor: pointer;
-moz-border-radius: 5px 5px 5px 5px;
-webkit-border-radius: 5px 5px 5px 5px;
border-radius: 5px 5px 5px 5px;
}
.calendar-prevmonth,
.calendar-nextmonth,
.calendar-prevyear,
.calendar-nextyear {
position: absolute;
top: 50%;
margin-top: -7px;
width: 14px;
height: 14px;
cursor: pointer;
font-size: 1px;
-moz-border-radius: 5px 5px 5px 5px;
-webkit-border-radius: 5px 5px 5px 5px;
border-radius: 5px 5px 5px 5px;
}
.calendar-prevmonth {
left: 20px;
background: url('images/calendar_arrows.png') no-repeat -18px -2px;
}
.calendar-nextmonth {
right: 20px;
background: url('images/calendar_arrows.png') no-repeat -34px -2px;
}
.calendar-prevyear {
left: 3px;
background: url('images/calendar_arrows.png') no-repeat -1px -2px;
}
.calendar-nextyear {
right: 3px;
background: url('images/calendar_arrows.png') no-repeat -49px -2px;
}
.calendar-body {
position: relative;
}
.calendar-body th,
.calendar-body td {
text-align: center;
}
.calendar-day {
border: 0;
padding: 1px;
cursor: pointer;
-moz-border-radius: 5px 5px 5px 5px;
-webkit-border-radius: 5px 5px 5px 5px;
border-radius: 5px 5px 5px 5px;
}
.calendar-other-month {
opacity: 0.3;
filter: alpha(opacity=30);
}
.calendar-menu {
position: absolute;
top: 0;
left: 0;
width: 180px;
height: 150px;
padding: 5px;
font-size: 12px;
display: none;
overflow: hidden;
}
.calendar-menu-year-inner {
text-align: center;
padding-bottom: 5px;
}
.calendar-menu-year {
width: 40px;
text-align: center;
border-width: 1px;
border-style: solid;
margin: 0;
padding: 2px;
font-weight: bold;
}
.calendar-menu-prev,
.calendar-menu-next {
display: inline-block;
width: 21px;
height: 21px;
vertical-align: top;
cursor: pointer;
-moz-border-radius: 5px 5px 5px 5px;
-webkit-border-radius: 5px 5px 5px 5px;
border-radius: 5px 5px 5px 5px;
}
.calendar-menu-prev {
margin-right: 10px;
background: url('images/calendar_arrows.png') no-repeat 2px 2px;
}
.calendar-menu-next {
margin-left: 10px;
background: url('images/calendar_arrows.png') no-repeat -45px 2px;
}
.calendar-menu-month {
text-align: center;
cursor: pointer;
font-weight: bold;
-moz-border-radius: 5px 5px 5px 5px;
-webkit-border-radius: 5px 5px 5px 5px;
border-radius: 5px 5px 5px 5px;
}
.calendar-body th,
.calendar-menu-month {
color: #4d4d4d;
}
.calendar-day {
color: #000000;
}
.calendar-sunday {
color: #CC2222;
}
.calendar-saturday {
color: #00ee00;
}
.calendar-today {
color: #0000ff;
}
.calendar-menu-year {
border-color: #95B8E7;
}
.calendar {
border-color: #95B8E7;
}
.calendar-header {
background: #E0ECFF;
}
.calendar-body,
.calendar-menu {
background: #ffffff;
}
.calendar-body th {
background: #F4F4F4;
}
.calendar-hover,
.calendar-nav-hover,
.calendar-menu-hover {
background-color: #eaf2ff;
color: #000000;
}
.calendar-hover {
border: 1px solid #b7d2ff;
padding: 0;
}
.calendar-selected {
background-color: #FBEC88;
color: #000000;
border: 1px solid #E2C608;
padding: 0;
}
.datebox-calendar-inner {
height: 180px;
}
.datebox-button {
height: 18px;
padding: 2px 5px;
font-size: 12px;
text-align: center;
}
.datebox-current,
.datebox-close,
.datebox-ok {
text-decoration: none;
font-weight: bold;
opacity: 0.6;
filter: alpha(opacity=60);
}
.datebox-current,
.datebox-close {
float: left;
}
.datebox-close {
float: right;
}
.datebox-button-hover {
opacity: 1.0;
filter: alpha(opacity=100);
}
.datebox .combo-arrow {
background-image: url('images/datebox_arrow.png');
background-position: center center;
}
.datebox-button {
background-color: #F4F4F4;
}
.datebox-current,
.datebox-close,
.datebox-ok {
color: #444;
}
.spinner {
display: inline-block;
white-space: nowrap;
margin: 0;
padding: 0;
border-width: 1px;
border-style: solid;
overflow: hidden;
vertical-align: middle;
}
.spinner .spinner-text {
font-size: 12px;
border: 0px;
line-height: 20px;
height: 20px;
margin: 0;
padding: 0 2px;
*margin-top: -1px;
*height: 18px;
*line-height: 18px;
_height: 18px;
_line-height: 18px;
vertical-align: baseline;
}
.spinner-arrow {
display: inline-block;
overflow: hidden;
vertical-align: top;
margin: 0;
padding: 0;
}
.spinner-arrow-up,
.spinner-arrow-down {
opacity: 0.6;
filter: alpha(opacity=60);
display: block;
font-size: 1px;
width: 18px;
height: 10px;
}
.spinner-arrow-hover {
opacity: 1.0;
filter: alpha(opacity=100);
}
.spinner-arrow-up {
background: url('images/spinner_arrows.png') no-repeat 1px center;
}
.spinner-arrow-down {
background: url('images/spinner_arrows.png') no-repeat -15px center;
}
.spinner {
border-color: #95B8E7;
}
.spinner-arrow {
background-color: #E0ECFF;
}
.spinner-arrow-hover {
background-color: #eaf2ff;
}
.progressbar {
border-width: 1px;
border-style: solid;
-moz-border-radius: 5px 5px 5px 5px;
-webkit-border-radius: 5px 5px 5px 5px;
border-radius: 5px 5px 5px 5px;
overflow: hidden;
}
.progressbar-text {
text-align: center;
position: absolute;
}
.progressbar-value {
position: relative;
overflow: hidden;
width: 0;
-moz-border-radius: 5px 0 0 5px;
-webkit-border-radius: 5px 0 0 5px;
border-radius: 5px 0 0 5px;
}
.progressbar {
border-color: #95B8E7;
}
.progressbar-text {
color: #000000;
}
.progressbar-value .progressbar-text {
background-color: #FBEC88;
color: #000000;
}
.searchbox {
display: inline-block;
white-space: nowrap;
margin: 0;
padding: 0;
border-width: 1px;
border-style: solid;
overflow: hidden;
}
.searchbox .searchbox-text {
font-size: 12px;
border: 0;
margin: 0;
padding: 0;
line-height: 20px;
height: 20px;
*margin-top: -1px;
*height: 18px;
*line-height: 18px;
_height: 18px;
_line-height: 18px;
vertical-align: baseline;
}
.searchbox .searchbox-prompt {
font-size: 12px;
color: #ccc;
}
.searchbox-button {
width: 18px;
height: 20px;
overflow: hidden;
display: inline-block;
vertical-align: top;
cursor: pointer;
opacity: 0.6;
filter: alpha(opacity=60);
}
.searchbox-button-hover {
opacity: 1.0;
filter: alpha(opacity=100);
}
.searchbox a.l-btn-plain {
height: 20px;
border: 0;
padding: 0 6px 0 0;
vertical-align: top;
-moz-border-radius: 0;
-webkit-border-radius: 0;
border-radius: 0;
opacity: 0.6;
filter: alpha(opacity=60);
}
.searchbox a.l-btn .l-btn-left {
padding: 2px 0 2px 4px;
}
.searchbox a.l-btn-plain:hover {
-moz-border-radius: 0;
-webkit-border-radius: 0;
border-radius: 0;
border: 0;
padding: 0 6px 0 0;
opacity: 1.0;
filter: alpha(opacity=100);
}
.searchbox a.m-btn-plain-active {
-moz-border-radius: 0;
-webkit-border-radius: 0;
border-radius: 0;
}
.searchbox-button {
background: url('images/searchbox_button.png') no-repeat center center;
}
.searchbox {
border-color: #95B8E7;
background-color: #fff;
}
.searchbox a.l-btn-plain {
background: #E0ECFF;
}
.slider-disabled {
opacity: 0.5;
filter: alpha(opacity=50);
}
.slider-h {
height: 22px;
}
.slider-v {
width: 22px;
}
.slider-inner {
position: relative;
height: 6px;
top: 7px;
border-width: 1px;
border-style: solid;
border-radius: 3px;
}
.slider-handle {
position: absolute;
display: block;
outline: none;
width: 20px;
height: 20px;
top: -7px;
margin-left: -10px;
}
.slider-tip {
position: absolute;
display: inline-block;
line-height: 12px;
white-space: nowrap;
top: -22px;
}
.slider-rule {
position: relative;
top: 15px;
}
.slider-rule span {
position: absolute;
display: inline-block;
font-size: 0;
height: 5px;
border-width: 0 0 0 1px;
border-style: solid;
}
.slider-rulelabel {
position: relative;
top: 20px;
}
.slider-rulelabel span {
position: absolute;
display: inline-block;
}
.slider-v .slider-inner {
width: 6px;
left: 7px;
top: 0;
float: left;
}
.slider-v .slider-handle {
left: 3px;
margin-top: -10px;
}
.slider-v .slider-tip {
left: -10px;
margin-top: -6px;
}
.slider-v .slider-rule {
float: left;
top: 0;
left: 16px;
}
.slider-v .slider-rule span {
width: 5px;
height: 'auto';
border-left: 0;
border-width: 1px 0 0 0;
border-style: solid;
}
.slider-v .slider-rulelabel {
float: left;
top: 0;
left: 23px;
}
.slider-handle {
background: url('images/slider_handle.png') no-repeat;
}
.slider-inner {
border-color: #95B8E7;
background: #E0ECFF;
}
.slider-rule span {
border-color: #95B8E7;
}
.slider-rulelabel span {
color: #000000;
}
.menu {
position: absolute;
margin: 0;
padding: 2px;
border-width: 1px;
border-style: solid;
overflow: hidden;
}
.menu-item {
position: relative;
margin: 0;
padding: 0;
overflow: hidden;
white-space: nowrap;
cursor: pointer;
border-width: 1px;
border-style: solid;
}
.menu-text {
height: 20px;
line-height: 20px;
float: left;
padding-left: 28px;
}
.menu-icon {
position: absolute;
width: 16px;
height: 16px;
left: 2px;
top: 50%;
margin-top: -8px;
}
.menu-rightarrow {
position: absolute;
width: 16px;
height: 16px;
right: 0;
top: 50%;
margin-top: -8px;
}
.menu-line {
position: absolute;
left: 26px;
top: 0;
height: 2000px;
font-size: 1px;
}
.menu-sep {
margin: 3px 0px 3px 25px;
font-size: 1px;
}
.menu-active {
-moz-border-radius: 5px 5px 5px 5px;
-webkit-border-radius: 5px 5px 5px 5px;
border-radius: 5px 5px 5px 5px;
}
.menu-item-disabled {
opacity: 0.5;
filter: alpha(opacity=50);
cursor: default;
}
.menu-text,
.menu-text span {
font-size: 12px;
}
.menu-shadow {
position: absolute;
-moz-border-radius: 5px 5px 5px 5px;
-webkit-border-radius: 5px 5px 5px 5px;
border-radius: 5px 5px 5px 5px;
background: #ccc;
-moz-box-shadow: 2px 2px 3px #cccccc;
-webkit-box-shadow: 2px 2px 3px #cccccc;
box-shadow: 2px 2px 3px #cccccc;
filter: progid:DXImageTransform.Microsoft.Blur(pixelRadius=2,MakeShadow=false,ShadowOpacity=0.2);
}
.menu-rightarrow {
background: url('images/menu_arrows.png') no-repeat -32px center;
}
.menu-line {
border-left: 1px solid #ccc;
border-right: 1px solid #fff;
}
.menu-sep {
border-top: 1px solid #ccc;
border-bottom: 1px solid #fff;
}
.menu {
background-color: #fafafa;
border-color: #ddd;
color: #444;
}
.menu-content {
background: #ffffff;
}
.menu-item {
border-color: transparent;
_border-color: #fafafa;
}
.menu-active {
border-color: #b7d2ff;
color: #000000;
background: #eaf2ff;
}
.menu-active-disabled {
border-color: transparent;
background: transparent;
color: #444;
}
.m-btn-downarrow {
display: inline-block;
width: 16px;
height: 16px;
line-height: 16px;
_vertical-align: middle;
}
a.m-btn-active {
background-position: bottom right;
}
a.m-btn-active span.l-btn-left {
background-position: bottom left;
}
a.m-btn-plain-active {
background: transparent;
padding: 0 5px 0 0;
border-width: 1px;
border-style: solid;
-moz-border-radius: 5px 5px 5px 5px;
-webkit-border-radius: 5px 5px 5px 5px;
border-radius: 5px 5px 5px 5px;
}
.m-btn-downarrow {
background: url('images/menu_arrows.png') no-repeat 2px center;
}
a.m-btn-plain-active {
border-color: #b7d2ff;
background-color: #eaf2ff;
color: #000000;
}
.s-btn-downarrow {
display: inline-block;
margin: 0 0 0 4px;
padding: 0 0 0 1px;
width: 14px;
height: 16px;
line-height: 16px;
border-width: 0;
border-style: solid;
_vertical-align: middle;
}
a.s-btn-active {
background-position: bottom right;
}
a.s-btn-active span.l-btn-left {
background-position: bottom left;
}
a.s-btn-plain-active {
background: transparent;
padding: 0 5px 0 0;
border-width: 1px;
border-style: solid;
-moz-border-radius: 5px 5px 5px 5px;
-webkit-border-radius: 5px 5px 5px 5px;
border-radius: 5px 5px 5px 5px;
}
.s-btn-downarrow {
background: url('images/menu_arrows.png') no-repeat 2px center;
border-color: #aac5e7;
}
a:hover.l-btn .s-btn-downarrow,
a.s-btn-active .s-btn-downarrow,
a.s-btn-plain-active .s-btn-downarrow {
background-position: 1px center;
padding: 0;
border-width: 0 0 0 1px;
}
a.s-btn-plain-active {
border-color: #b7d2ff;
background-color: #eaf2ff;
color: #000000;
}
.messager-body {
padding: 10px;
overflow: hidden;
}
.messager-button {
text-align: center;
padding-top: 10px;
}
.messager-icon {
float: left;
width: 32px;
height: 32px;
margin: 0 10px 10px 0;
}
.messager-error {
background: url('images/messager_icons.png') no-repeat scroll -64px 0;
}
.messager-info {
background: url('images/messager_icons.png') no-repeat scroll 0 0;
}
.messager-question {
background: url('images/messager_icons.png') no-repeat scroll -32px 0;
}
.messager-warning {
background: url('images/messager_icons.png') no-repeat scroll -96px 0;
}
.messager-progress {
padding: 10px;
}
.messager-p-msg {
margin-bottom: 5px;
}
.messager-body .messager-input {
width: 100%;
padding: 1px 0;
border: 1px solid #95B8E7;
}
.tree {
margin: 0;
padding: 0;
list-style-type: none;
}
.tree li {
white-space: nowrap;
}
.tree li ul {
list-style-type: none;
margin: 0;
padding: 0;
}
.tree-node {
height: 18px;
white-space: nowrap;
cursor: pointer;
}
.tree-hit {
cursor: pointer;
}
.tree-expanded,
.tree-collapsed,
.tree-folder,
.tree-file,
.tree-checkbox,
.tree-indent {
display: inline-block;
width: 16px;
height: 18px;
vertical-align: top;
overflow: hidden;
}
.tree-expanded {
background: url('images/tree_icons.png') no-repeat -18px 0px;
}
.tree-expanded-hover {
background: url('images/tree_icons.png') no-repeat -50px 0px;
}
.tree-collapsed {
background: url('images/tree_icons.png') no-repeat 0px 0px;
}
.tree-collapsed-hover {
background: url('images/tree_icons.png') no-repeat -32px 0px;
}
.tree-lines .tree-expanded,
.tree-lines .tree-root-first .tree-expanded {
background: url('images/tree_icons.png') no-repeat -144px 0;
}
.tree-lines .tree-collapsed,
.tree-lines .tree-root-first .tree-collapsed {
background: url('images/tree_icons.png') no-repeat -128px 0;
}
.tree-lines .tree-node-last .tree-expanded,
.tree-lines .tree-root-one .tree-expanded {
background: url('images/tree_icons.png') no-repeat -80px 0;
}
.tree-lines .tree-node-last .tree-collapsed,
.tree-lines .tree-root-one .tree-collapsed {
background: url('images/tree_icons.png') no-repeat -64px 0;
}
.tree-line {
background: url('images/tree_icons.png') no-repeat -176px 0;
}
.tree-join {
background: url('images/tree_icons.png') no-repeat -192px 0;
}
.tree-joinbottom {
background: url('images/tree_icons.png') no-repeat -160px 0;
}
.tree-folder {
background: url('images/tree_icons.png') no-repeat -208px 0;
}
.tree-folder-open {
background: url('images/tree_icons.png') no-repeat -224px 0;
}
.tree-file {
background: url('images/tree_icons.png') no-repeat -240px 0;
}
.tree-loading {
background: url('images/loading.gif') no-repeat center center;
}
.tree-checkbox0 {
background: url('images/tree_icons.png') no-repeat -208px -18px;
}
.tree-checkbox1 {
background: url('images/tree_icons.png') no-repeat -224px -18px;
}
.tree-checkbox2 {
background: url('images/tree_icons.png') no-repeat -240px -18px;
}
.tree-title {
font-size: 12px;
display: inline-block;
text-decoration: none;
vertical-align: top;
white-space: nowrap;
padding: 0 2px;
height: 18px;
line-height: 18px;
}
.tree-node-proxy {
font-size: 12px;
line-height: 20px;
padding: 0 2px 0 20px;
border-width: 1px;
border-style: solid;
z-index: 9900000;
}
.tree-dnd-icon {
display: inline-block;
position: absolute;
width: 16px;
height: 18px;
left: 2px;
top: 50%;
margin-top: -9px;
}
.tree-dnd-yes {
background: url('images/tree_icons.png') no-repeat -256px 0;
}
.tree-dnd-no {
background: url('images/tree_icons.png') no-repeat -256px -18px;
}
.tree-node-top {
border-top: 1px dotted red;
}
.tree-node-bottom {
border-bottom: 1px dotted red;
}
.tree-node-append .tree-title {
border: 1px dotted red;
}
.tree-editor {
border: 1px solid #ccc;
font-size: 12px;
height: 14px !important;
height: 18px;
line-height: 14px;
padding: 1px 2px;
width: 80px;
position: absolute;
top: 0;
}
.tree-node-proxy {
background-color: #ffffff;
color: #000000;
border-color: #95B8E7;
}
.tree-node-hover {
background: #eaf2ff;
color: #000000;
}
.tree-node-selected {
background: #FBEC88;
color: #000000;
}
.validatebox-tip {
position: absolute;
width: 200px;
height: auto;
display: none;
z-index: 9900000;
}
.validatebox-tip-content {
display: inline-block;
position: absolute;
top: 0px;
left: 8px;
width: 150px;
border-width: 1px;
border-style: solid;
padding: 3px 5px;
z-index: 9900001;
font-size: 12px;
}
.validatebox-tip-pointer {
display: inline-block;
width: 8px;
height: 16px;
position: absolute;
left: 1px;
top: 0px;
z-index: 9900002;
}
.validatebox-tip-left .validatebox-tip-content {
left: auto;
right: 8px;
}
.validatebox-tip-left .validatebox-tip-pointer {
background-position: -20px center;
left: auto;
right: 1px;
}
.validatebox-invalid {
background-image: url('images/validatebox_warning.png');
background-repeat: no-repeat;
background-position: right center;
border-color: #ffa8a8;
background-color: #fff3f3;
color: #000;
}
.validatebox-tip-pointer {
background: url('images/validatebox_arrows.png') no-repeat -4px center;
}
.validatebox-tip-content {
border-color: #CC9933;
background-color: #FFFFCC;
color: #000;
}
/*添加box的样式*/
.easyui-textbox{border:1px solid #95B8E7;vertical-align:middle; }
/* 高级搜索下拉框样式*/
.gradeSearchBox{border:1px solid #95B8E7;width:82px;height:20px;clip:rect(0px,81px,19px,0px);overflow:hidden;}
.gradeSelectSearchBox{position:relative;left:1px;top:1px;font-size:13px;width:81px;line-height:20px;border:0px;color:#909993;}
| zz-ms | trunk/zz-ms-v2.0/src/main/webapp/themes/default/easyui.css | CSS | asf20 | 44,758 |
.searchbox {
display: inline-block;
white-space: nowrap;
margin: 0;
padding: 0;
border-width: 1px;
border-style: solid;
overflow: hidden;
}
.searchbox .searchbox-text {
font-size: 12px;
border: 0;
margin: 0;
padding: 0;
line-height: 20px;
height: 20px;
*margin-top: -1px;
*height: 18px;
*line-height: 18px;
_height: 18px;
_line-height: 18px;
vertical-align: baseline;
}
.searchbox .searchbox-prompt {
font-size: 12px;
color: #ccc;
}
.searchbox-button {
width: 18px;
height: 20px;
overflow: hidden;
display: inline-block;
vertical-align: top;
cursor: pointer;
opacity: 0.6;
filter: alpha(opacity=60);
}
.searchbox-button-hover {
opacity: 1.0;
filter: alpha(opacity=100);
}
.searchbox a.l-btn-plain {
height: 20px;
border: 0;
padding: 0 6px 0 0;
vertical-align: top;
-moz-border-radius: 0;
-webkit-border-radius: 0;
border-radius: 0;
opacity: 0.6;
filter: alpha(opacity=60);
}
.searchbox a.l-btn .l-btn-left {
padding: 2px 0 2px 4px;
}
.searchbox a.l-btn-plain:hover {
-moz-border-radius: 0;
-webkit-border-radius: 0;
border-radius: 0;
border: 0;
padding: 0 6px 0 0;
opacity: 1.0;
filter: alpha(opacity=100);
}
.searchbox a.m-btn-plain-active {
-moz-border-radius: 0;
-webkit-border-radius: 0;
border-radius: 0;
}
.searchbox-button {
background: url('images/searchbox_button.png') no-repeat center center;
}
.searchbox {
border-color: #95B8E7;
background-color: #fff;
}
.searchbox a.l-btn-plain {
background: #E0ECFF;
}
| zz-ms | trunk/zz-ms-v2.0/src/main/webapp/themes/default/searchbox.css | CSS | asf20 | 1,528 |
.spinner {
display: inline-block;
white-space: nowrap;
margin: 0;
padding: 0;
border-width: 1px;
border-style: solid;
overflow: hidden;
vertical-align: middle;
}
.spinner .spinner-text {
font-size: 12px;
border: 0px;
line-height: 20px;
height: 20px;
margin: 0;
padding: 0 2px;
*margin-top: -1px;
*height: 18px;
*line-height: 18px;
_height: 18px;
_line-height: 18px;
vertical-align: baseline;
}
.spinner-arrow {
display: inline-block;
overflow: hidden;
vertical-align: top;
margin: 0;
padding: 0;
}
.spinner-arrow-up,
.spinner-arrow-down {
opacity: 0.6;
filter: alpha(opacity=60);
display: block;
font-size: 1px;
width: 18px;
height: 10px;
}
.spinner-arrow-hover {
opacity: 1.0;
filter: alpha(opacity=100);
}
.spinner-arrow-up {
background: url('images/spinner_arrows.png') no-repeat 1px center;
}
.spinner-arrow-down {
background: url('images/spinner_arrows.png') no-repeat -15px center;
}
.spinner {
border-color: #95B8E7;
}
.spinner-arrow {
background-color: #E0ECFF;
}
.spinner-arrow-hover {
background-color: #eaf2ff;
}
| zz-ms | trunk/zz-ms-v2.0/src/main/webapp/themes/default/spinner.css | CSS | asf20 | 1,100 |
.layout {
position: relative;
overflow: hidden;
margin: 0;
padding: 0;
z-index: 0;
}
.layout-panel {
position: absolute;
overflow: hidden;
}
.layout-panel-east,
.layout-panel-west {
z-index: 2;
}
.layout-panel-north,
.layout-panel-south {
z-index: 3;
}
.layout-expand {
position: absolute;
padding: 0px;
font-size: 1px;
cursor: pointer;
z-index: 1;
}
.layout-expand .panel-header,
.layout-expand .panel-body {
background: transparent;
filter: none;
overflow: hidden;
}
.layout-expand .panel-header {
border-bottom-width: 0px;
}
.layout-split-proxy-h,
.layout-split-proxy-v {
position: absolute;
font-size: 1px;
display: none;
z-index: 5;
}
.layout-split-proxy-h {
width: 5px;
cursor: e-resize;
}
.layout-split-proxy-v {
height: 5px;
cursor: n-resize;
}
.layout-mask {
position: absolute;
background: #fafafa;
filter: alpha(opacity=10);
opacity: 0.10;
z-index: 4;
}
.layout-button-up {
background: url('images/layout_arrows.png') no-repeat -16px -16px;
}
.layout-button-down {
background: url('images/layout_arrows.png') no-repeat -16px 0;
}
.layout-button-left {
background: url('images/layout_arrows.png') no-repeat 0 0;
}
.layout-button-right {
background: url('images/layout_arrows.png') no-repeat 0 -16px;
}
.layout-split-proxy-h,
.layout-split-proxy-v {
background-color: #aac5e7;
}
.layout-split-north {
border-bottom: 5px solid #E6EEF8;
}
.layout-split-south {
border-top: 5px solid #E6EEF8;
}
.layout-split-east {
border-left: 5px solid #E6EEF8;
}
.layout-split-west {
border-right: 5px solid #E6EEF8;
}
.layout-expand {
background-color: #E0ECFF;
}
.layout-expand-over {
background-color: #E0ECFF;
}
/*添加box的样式*/
.easyui-textbox{height:18px;line-height:18px;width:160px;border:1px solid #95B8E7;vertical-align:middle; } | zz-ms | trunk/zz-ms-v2.0/src/main/webapp/themes/default/layout.css | CSS | asf20 | 1,822 |
.combobox-item {
padding: 2px;
font-size: 12px;
padding: 3px;
padding-right: 0px;
}
.combobox-item-hover {
background-color: #eaf2ff;
color: #000000;
}
.combobox-item-selected {
background-color: #FBEC88;
color: #000000;
}
| zz-ms | trunk/zz-ms-v2.0/src/main/webapp/themes/default/combobox.css | CSS | asf20 | 239 |
.panel {
overflow: hidden;
font-size: 12px;
text-align: left;
}
.panel-header,
.panel-body {
border-width: 1px;
border-style: solid;
}
.panel-header {
padding: 5px;
position: relative;
}
.panel-title {
background: url('images/blank.gif') no-repeat;
}
.panel-header-noborder {
border-width: 0 0 1px 0;
}
.panel-body {
overflow: auto;
border-top-width: 0px;
}
.panel-body-noheader {
border-top-width: 1px;
}
.panel-body-noborder {
border-width: 0px;
}
.panel-with-icon {
padding-left: 18px;
}
.panel-icon,
.panel-tool {
position: absolute;
top: 50%;
margin-top: -8px;
height: 16px;
overflow: hidden;
}
.panel-icon {
left: 5px;
width: 16px;
}
.panel-tool {
right: 5px;
width: auto;
}
.panel-tool a {
display: inline-block;
width: 16px;
height: 16px;
opacity: 0.6;
filter: alpha(opacity=60);
margin: 0 0 0 2px;
vertical-align: top;
}
.panel-tool a:hover {
opacity: 1;
filter: alpha(opacity=100);
background-color: #eaf2ff;
-moz-border-radius: 3px 3px 3px 3px;
-webkit-border-radius: 3px 3px 3px 3px;
border-radius: 3px 3px 3px 3px;
}
.panel-loading {
padding: 11px 0px 10px 30px;
}
.panel-noscroll {
overflow: hidden;
}
.panel-fit,
.panel-fit body {
height: 100%;
margin: 0;
padding: 0;
border: 0;
overflow: hidden;
}
.panel-loading {
background: url('images/loading.gif') no-repeat 10px 10px;
}
.panel-tool-close {
background: url('images/panel_tools.png') no-repeat -16px 0px;
}
.panel-tool-min {
background: url('images/panel_tools.png') no-repeat 0px 0px;
}
.panel-tool-max {
background: url('images/panel_tools.png') no-repeat 0px -16px;
}
.panel-tool-restore {
background: url('images/panel_tools.png') no-repeat -16px -16px;
}
.panel-tool-collapse {
background: url('images/panel_tools.png') no-repeat -32px 0;
}
.panel-tool-expand {
background: url('images/panel_tools.png') no-repeat -32px -16px;
}
.panel-header,
.panel-body {
border-color: #95B8E7;
}
.panel-header {
background-color: #E0ECFF;
background: -webkit-linear-gradient(top,#EFF5FF 0,#E0ECFF 100%);
background: -moz-linear-gradient(top,#EFF5FF 0,#E0ECFF 100%);
background: -o-linear-gradient(top,#EFF5FF 0,#E0ECFF 100%);
background: linear-gradient(to bottom,#EFF5FF 0,#E0ECFF 100%);
background-repeat: repeat-x;
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr=#EFF5FF,endColorstr=#E0ECFF,GradientType=0);
}
.panel-body {
background-color: #ffffff;
color: #000000;
}
.panel-title {
font-weight: bold;
color: #0E2D5F;
height: 16px;
line-height: 16px;
}
| zz-ms | trunk/zz-ms-v2.0/src/main/webapp/themes/default/panel.css | CSS | asf20 | 2,564 |
.propertygrid .datagrid-view1 .datagrid-body td {
padding-bottom: 1px;
border-width: 0 1px 0 0;
}
.propertygrid .datagrid-group {
height: 21px;
overflow: hidden;
border-width: 0 0 1px 0;
border-style: solid;
}
.propertygrid .datagrid-group span {
font-weight: bold;
}
.propertygrid .datagrid-view1 .datagrid-body td {
border-color: #dddddd;
}
.propertygrid .datagrid-view1 .datagrid-group {
border-color: #E0ECFF;
}
.propertygrid .datagrid-view2 .datagrid-group {
border-color: #dddddd;
}
.propertygrid .datagrid-group,
.propertygrid .datagrid-view1 .datagrid-body,
.propertygrid .datagrid-view1 .datagrid-row-over,
.propertygrid .datagrid-view1 .datagrid-row-selected {
background: #E0ECFF;
}
| zz-ms | trunk/zz-ms-v2.0/src/main/webapp/themes/default/propertygrid.css | CSS | asf20 | 716 |
.tabs-container {
overflow: hidden;
}
.tabs-header {
border-width: 1px;
border-style: solid;
border-bottom-width: 0;
position: relative;
padding: 0;
padding-top: 2px;
overflow: hidden;
}
.tabs-header-plain {
border: 0;
background: transparent;
}
.tabs-scroller-left,
.tabs-scroller-right {
position: absolute;
top: auto;
bottom: 0;
width: 18px;
height: 28px !important;
height: 30px;
font-size: 1px;
display: none;
cursor: pointer;
border-width: 1px;
border-style: solid;
}
.tabs-scroller-left {
left: 0;
}
.tabs-scroller-right {
right: 0;
}
.tabs-header-plain .tabs-scroller-left,
.tabs-header-plain .tabs-scroller-right {
height: 25px !important;
height: 27px;
}
.tabs-tool {
position: absolute;
bottom: 0;
padding: 1px;
overflow: hidden;
border-width: 1px;
border-style: solid;
}
.tabs-header-plain .tabs-tool {
padding: 0 1px;
}
.tabs-wrap {
position: relative;
left: 0;
overflow: hidden;
width: 100%;
margin: 0;
padding: 0;
}
.tabs-scrolling {
margin-left: 18px;
margin-right: 18px;
}
.tabs-disabled {
opacity: 0.3;
filter: alpha(opacity=30);
}
.tabs {
list-style-type: none;
height: 26px;
margin: 0px;
padding: 0px;
padding-left: 4px;
font-size: 12px;
width: 5000px;
border-style: solid;
border-width: 0 0 1px 0;
}
.tabs li {
float: left;
display: inline-block;
margin: 0 4px -1px 0;
padding: 0;
position: relative;
border: 0;
}
.tabs li a.tabs-inner {
display: inline-block;
text-decoration: none;
margin: 0;
padding: 0 10px;
height: 25px;
line-height: 25px;
text-align: center;
white-space: nowrap;
border-width: 1px;
border-style: solid;
-moz-border-radius: 5px 5px 0 0;
-webkit-border-radius: 5px 5px 0 0;
border-radius: 5px 5px 0 0;
}
.tabs li.tabs-selected a.tabs-inner {
font-weight: bold;
outline: none;
}
.tabs li.tabs-selected a:hover.tabs-inner {
cursor: default;
pointer: default;
}
.tabs li a.tabs-close,
.tabs-p-tool {
position: absolute;
font-size: 1px;
display: block;
height: 12px;
padding: 0;
top: 50%;
margin-top: -6px;
overflow: hidden;
}
.tabs li a.tabs-close {
width: 12px;
right: 5px;
opacity: 0.6;
filter: alpha(opacity=60);
}
.tabs-p-tool {
right: 16px;
}
.tabs-p-tool a {
display: inline-block;
font-size: 1px;
width: 12px;
height: 12px;
margin: 0;
opacity: 0.6;
filter: alpha(opacity=60);
}
.tabs li a:hover.tabs-close,
.tabs-p-tool a:hover {
opacity: 1;
filter: alpha(opacity=100);
cursor: hand;
cursor: pointer;
}
.tabs-with-icon {
padding-left: 18px;
}
.tabs-icon {
position: absolute;
width: 16px;
height: 16px;
left: 10px;
top: 50%;
margin-top: -8px;
}
.tabs-closable {
padding-right: 8px;
}
.tabs-panels {
margin: 0px;
padding: 0px;
border-width: 1px;
border-style: solid;
border-top-width: 0;
overflow: hidden;
}
.tabs-header-bottom {
border-width: 0 1px 1px 1px;
padding: 0 0 2px 0;
}
.tabs-header-bottom .tabs {
border-width: 1px 0 0 0;
}
.tabs-header-bottom .tabs li {
margin: -1px 4px 0 0;
}
.tabs-header-bottom .tabs li a.tabs-inner {
-moz-border-radius: 0 0 5px 5px;
-webkit-border-radius: 0 0 5px 5px;
border-radius: 0 0 5px 5px;
}
.tabs-header-bottom .tabs-tool {
top: 0;
}
.tabs-header-bottom .tabs-scroller-left,
.tabs-header-bottom .tabs-scroller-right {
top: 0;
bottom: auto;
}
.tabs-panels-top {
border-width: 1px 1px 0 1px;
}
.tabs-header-left {
float: left;
border-width: 1px 0 1px 1px;
padding: 0;
}
.tabs-header-right {
float: right;
border-width: 1px 1px 1px 0;
padding: 0;
}
.tabs-header-left .tabs-wrap,
.tabs-header-right .tabs-wrap {
height: 100%;
}
.tabs-header-left .tabs {
height: 100%;
padding: 4px 0 0 4px;
border-width: 0 1px 0 0;
}
.tabs-header-right .tabs {
height: 100%;
padding: 4px 4px 0 0;
border-width: 0 0 0 1px;
}
.tabs-header-left .tabs li,
.tabs-header-right .tabs li {
display: block;
width: 100%;
position: relative;
}
.tabs-header-left .tabs li {
left: auto;
right: 0;
margin: 0 -1px 4px 0;
float: right;
}
.tabs-header-right .tabs li {
left: 0;
right: auto;
margin: 0 0 4px -1px;
float: left;
}
.tabs-header-left .tabs li a.tabs-inner {
display: block;
text-align: left;
-moz-border-radius: 5px 0 0 5px;
-webkit-border-radius: 5px 0 0 5px;
border-radius: 5px 0 0 5px;
}
.tabs-header-right .tabs li a.tabs-inner {
display: block;
text-align: left;
-moz-border-radius: 0 5px 5px 0;
-webkit-border-radius: 0 5px 5px 0;
border-radius: 0 5px 5px 0;
}
.tabs-panels-right {
float: right;
border-width: 1px 1px 1px 0;
}
.tabs-panels-left {
float: left;
border-width: 1px 0 1px 1px;
}
.tabs-header-noborder,
.tabs-panels-noborder {
border: 0px;
}
.tabs-header-plain {
border: 0px;
background: transparent;
}
.tabs-scroller-left {
background: #E0ECFF url('images/tabs_icons.png') no-repeat 1px center;
}
.tabs-scroller-right {
background: #E0ECFF url('images/tabs_icons.png') no-repeat -15px center;
}
.tabs li a.tabs-close {
background: url('images/tabs_icons.png') no-repeat -34px center;
}
.tabs li a.tabs-inner:hover {
background: #eaf2ff;
color: #000000;
filter: none;
}
.tabs li.tabs-selected a.tabs-inner {
background-color: #ffffff;
color: #0E2D5F;
background: -webkit-linear-gradient(top,#EFF5FF 0,#ffffff 100%);
background: -moz-linear-gradient(top,#EFF5FF 0,#ffffff 100%);
background: -o-linear-gradient(top,#EFF5FF 0,#ffffff 100%);
background: linear-gradient(to bottom,#EFF5FF 0,#ffffff 100%);
background-repeat: repeat-x;
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr=#EFF5FF,endColorstr=#ffffff,GradientType=0);
}
.tabs-header-bottom .tabs li.tabs-selected a.tabs-inner {
background: -webkit-linear-gradient(top,#ffffff 0,#EFF5FF 100%);
background: -moz-linear-gradient(top,#ffffff 0,#EFF5FF 100%);
background: -o-linear-gradient(top,#ffffff 0,#EFF5FF 100%);
background: linear-gradient(to bottom,#ffffff 0,#EFF5FF 100%);
background-repeat: repeat-x;
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr=#ffffff,endColorstr=#EFF5FF,GradientType=0);
}
.tabs-header-left .tabs li.tabs-selected a.tabs-inner {
background: -webkit-linear-gradient(left,#EFF5FF 0,#ffffff 100%);
background: -moz-linear-gradient(left,#EFF5FF 0,#ffffff 100%);
background: -o-linear-gradient(left,#EFF5FF 0,#ffffff 100%);
background: linear-gradient(to right,#EFF5FF 0,#ffffff 100%);
background-repeat: repeat-y;
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr=#EFF5FF,endColorstr=#ffffff,GradientType=1);
}
.tabs-header-right .tabs li.tabs-selected a.tabs-inner {
background: -webkit-linear-gradient(left,#ffffff 0,#EFF5FF 100%);
background: -moz-linear-gradient(left,#ffffff 0,#EFF5FF 100%);
background: -o-linear-gradient(left,#ffffff 0,#EFF5FF 100%);
background: linear-gradient(to right,#ffffff 0,#EFF5FF 100%);
background-repeat: repeat-y;
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr=#ffffff,endColorstr=#EFF5FF,GradientType=1);
}
.tabs li a.tabs-inner {
color: #0E2D5F;
background-color: #E0ECFF;
background: -webkit-linear-gradient(top,#EFF5FF 0,#E0ECFF 100%);
background: -moz-linear-gradient(top,#EFF5FF 0,#E0ECFF 100%);
background: -o-linear-gradient(top,#EFF5FF 0,#E0ECFF 100%);
background: linear-gradient(to bottom,#EFF5FF 0,#E0ECFF 100%);
background-repeat: repeat-x;
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr=#EFF5FF,endColorstr=#E0ECFF,GradientType=0);
}
.tabs-header,
.tabs-tool {
background-color: #E0ECFF;
}
.tabs-header-plain {
background: transparent;
}
.tabs-header,
.tabs-scroller-left,
.tabs-scroller-right,
.tabs-tool,
.tabs,
.tabs-panels,
.tabs li a.tabs-inner,
.tabs li.tabs-selected a.tabs-inner,
.tabs-header-bottom .tabs li.tabs-selected a.tabs-inner,
.tabs-header-left .tabs li.tabs-selected a.tabs-inner,
.tabs-header-right .tabs li.tabs-selected a.tabs-inner {
border-color: #95B8E7;
}
.tabs-p-tool a:hover,
.tabs li a:hover.tabs-close,
.tabs-scroller-over {
background-color: #eaf2ff;
}
.tabs li.tabs-selected a.tabs-inner {
border-bottom: 1px solid #ffffff;
}
.tabs-header-bottom .tabs li.tabs-selected a.tabs-inner {
border-top: 1px solid #ffffff;
}
.tabs-header-left .tabs li.tabs-selected a.tabs-inner {
border-right: 1px solid #ffffff;
}
.tabs-header-right .tabs li.tabs-selected a.tabs-inner {
border-left: 1px solid #ffffff;
}
| zz-ms | trunk/zz-ms-v2.0/src/main/webapp/themes/default/tabs.css | CSS | asf20 | 8,448 |
.messager-body {
padding: 10px;
overflow: hidden;
}
.messager-button {
text-align: center;
padding-top: 10px;
}
.messager-icon {
float: left;
width: 32px;
height: 32px;
margin: 0 10px 10px 0;
}
.messager-error {
background: url('images/messager_icons.png') no-repeat scroll -64px 0;
}
.messager-info {
background: url('images/messager_icons.png') no-repeat scroll 0 0;
}
.messager-question {
background: url('images/messager_icons.png') no-repeat scroll -32px 0;
}
.messager-warning {
background: url('images/messager_icons.png') no-repeat scroll -96px 0;
}
.messager-progress {
padding: 10px;
}
.messager-p-msg {
margin-bottom: 5px;
}
.messager-body .messager-input {
width: 100%;
padding: 1px 0;
border: 1px solid #95B8E7;
}
| zz-ms | trunk/zz-ms-v2.0/src/main/webapp/themes/default/messager.css | CSS | asf20 | 761 |
.slider-disabled {
opacity: 0.5;
filter: alpha(opacity=50);
}
.slider-h {
height: 22px;
}
.slider-v {
width: 22px;
}
.slider-inner {
position: relative;
height: 6px;
top: 7px;
border-width: 1px;
border-style: solid;
border-radius: 3px;
}
.slider-handle {
position: absolute;
display: block;
outline: none;
width: 20px;
height: 20px;
top: -7px;
margin-left: -10px;
}
.slider-tip {
position: absolute;
display: inline-block;
line-height: 12px;
white-space: nowrap;
top: -22px;
}
.slider-rule {
position: relative;
top: 15px;
}
.slider-rule span {
position: absolute;
display: inline-block;
font-size: 0;
height: 5px;
border-width: 0 0 0 1px;
border-style: solid;
}
.slider-rulelabel {
position: relative;
top: 20px;
}
.slider-rulelabel span {
position: absolute;
display: inline-block;
}
.slider-v .slider-inner {
width: 6px;
left: 7px;
top: 0;
float: left;
}
.slider-v .slider-handle {
left: 3px;
margin-top: -10px;
}
.slider-v .slider-tip {
left: -10px;
margin-top: -6px;
}
.slider-v .slider-rule {
float: left;
top: 0;
left: 16px;
}
.slider-v .slider-rule span {
width: 5px;
height: 'auto';
border-left: 0;
border-width: 1px 0 0 0;
border-style: solid;
}
.slider-v .slider-rulelabel {
float: left;
top: 0;
left: 23px;
}
.slider-handle {
background: url('images/slider_handle.png') no-repeat;
}
.slider-inner {
border-color: #95B8E7;
background: #E0ECFF;
}
.slider-rule span {
border-color: #95B8E7;
}
.slider-rulelabel span {
color: #000000;
}
| zz-ms | trunk/zz-ms-v2.0/src/main/webapp/themes/default/slider.css | CSS | asf20 | 1,561 |
.s-btn-downarrow {
display: inline-block;
margin: 0 0 0 4px;
padding: 0 0 0 1px;
width: 14px;
height: 16px;
line-height: 16px;
border-width: 0;
border-style: solid;
_vertical-align: middle;
}
a.s-btn-active {
background-position: bottom right;
}
a.s-btn-active span.l-btn-left {
background-position: bottom left;
}
a.s-btn-plain-active {
background: transparent;
padding: 0 5px 0 0;
border-width: 1px;
border-style: solid;
-moz-border-radius: 5px 5px 5px 5px;
-webkit-border-radius: 5px 5px 5px 5px;
border-radius: 5px 5px 5px 5px;
}
.s-btn-downarrow {
background: url('images/menu_arrows.png') no-repeat 2px center;
border-color: #aac5e7;
}
a:hover.l-btn .s-btn-downarrow,
a.s-btn-active .s-btn-downarrow,
a.s-btn-plain-active .s-btn-downarrow {
background-position: 1px center;
padding: 0;
border-width: 0 0 0 1px;
}
a.s-btn-plain-active {
border-color: #b7d2ff;
background-color: #eaf2ff;
color: #000000;
}
| zz-ms | trunk/zz-ms-v2.0/src/main/webapp/themes/default/splitbutton.css | CSS | asf20 | 962 |
.tree {
margin: 0;
padding: 0;
list-style-type: none;
}
.tree li {
white-space: nowrap;
}
.tree li ul {
list-style-type: none;
margin: 0;
padding: 0;
}
.tree-node {
height: 18px;
white-space: nowrap;
cursor: pointer;
}
.tree-hit {
cursor: pointer;
}
.tree-expanded,
.tree-collapsed,
.tree-folder,
.tree-file,
.tree-checkbox,
.tree-indent {
display: inline-block;
width: 16px;
height: 18px;
vertical-align: top;
overflow: hidden;
}
.tree-expanded {
background: url('images/tree_icons.png') no-repeat -18px 0px;
}
.tree-expanded-hover {
background: url('images/tree_icons.png') no-repeat -50px 0px;
}
.tree-collapsed {
background: url('images/tree_icons.png') no-repeat 0px 0px;
}
.tree-collapsed-hover {
background: url('images/tree_icons.png') no-repeat -32px 0px;
}
.tree-lines .tree-expanded,
.tree-lines .tree-root-first .tree-expanded {
background: url('images/tree_icons.png') no-repeat -144px 0;
}
.tree-lines .tree-collapsed,
.tree-lines .tree-root-first .tree-collapsed {
background: url('images/tree_icons.png') no-repeat -128px 0;
}
.tree-lines .tree-node-last .tree-expanded,
.tree-lines .tree-root-one .tree-expanded {
background: url('images/tree_icons.png') no-repeat -80px 0;
}
.tree-lines .tree-node-last .tree-collapsed,
.tree-lines .tree-root-one .tree-collapsed {
background: url('images/tree_icons.png') no-repeat -64px 0;
}
.tree-line {
background: url('images/tree_icons.png') no-repeat -176px 0;
}
.tree-join {
background: url('images/tree_icons.png') no-repeat -192px 0;
}
.tree-joinbottom {
background: url('images/tree_icons.png') no-repeat -160px 0;
}
.tree-folder {
background: url('images/tree_icons.png') no-repeat -208px 0;
}
.tree-folder-open {
background: url('images/tree_icons.png') no-repeat -224px 0;
}
.tree-file {
background: url('images/tree_icons.png') no-repeat -240px 0;
}
.tree-loading {
background: url('images/loading.gif') no-repeat center center;
}
.tree-checkbox0 {
background: url('images/tree_icons.png') no-repeat -208px -18px;
}
.tree-checkbox1 {
background: url('images/tree_icons.png') no-repeat -224px -18px;
}
.tree-checkbox2 {
background: url('images/tree_icons.png') no-repeat -240px -18px;
}
.tree-title {
font-size: 12px;
display: inline-block;
text-decoration: none;
vertical-align: top;
white-space: nowrap;
padding: 0 2px;
height: 18px;
line-height: 18px;
}
.tree-node-proxy {
font-size: 12px;
line-height: 20px;
padding: 0 2px 0 20px;
border-width: 1px;
border-style: solid;
z-index: 9900000;
}
.tree-dnd-icon {
display: inline-block;
position: absolute;
width: 16px;
height: 18px;
left: 2px;
top: 50%;
margin-top: -9px;
}
.tree-dnd-yes {
background: url('images/tree_icons.png') no-repeat -256px 0;
}
.tree-dnd-no {
background: url('images/tree_icons.png') no-repeat -256px -18px;
}
.tree-node-top {
border-top: 1px dotted red;
}
.tree-node-bottom {
border-bottom: 1px dotted red;
}
.tree-node-append .tree-title {
border: 1px dotted red;
}
.tree-editor {
border: 1px solid #ccc;
font-size: 12px;
height: 14px !important;
height: 18px;
line-height: 14px;
padding: 1px 2px;
width: 80px;
position: absolute;
top: 0;
}
.tree-node-proxy {
background-color: #ffffff;
color: #000000;
border-color: #95B8E7;
}
.tree-node-hover {
background: #eaf2ff;
color: #000000;
}
.tree-node-selected {
background: #FBEC88;
color: #000000;
}
| zz-ms | trunk/zz-ms-v2.0/src/main/webapp/themes/default/tree.css | CSS | asf20 | 3,440 |