@@ -10,22 +10,6 @@ function setTemplate(templateID)
|
||||
$("#steps").val(steps);
|
||||
}
|
||||
|
||||
/* 保存bug模板。*/
|
||||
function saveTemplate()
|
||||
{
|
||||
content = $("#steps").val();
|
||||
jPrompt(setTemplateTitle, '','', function(r)
|
||||
{
|
||||
if(!r || !content) return;
|
||||
saveTemplateLink = createLink('bug', 'saveTemplate');
|
||||
steps = $("#steps").val();
|
||||
$.post(saveTemplateLink, {title:r, content:content}, function(data)
|
||||
{
|
||||
$('#tplBox').html(data);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
/* 删除bug模板。*/
|
||||
function deleteTemplate(templateID)
|
||||
{
|
||||
@@ -33,16 +17,13 @@ function deleteTemplate(templateID)
|
||||
hiddenwin.location.href = createLink('bug', 'deleteTemplate', 'templateID=' + templateID);
|
||||
$('#tplBox' + templateID).addClass('hidden');
|
||||
}
|
||||
|
||||
var setTemplateTitle = '<?php echo $lang->bug->setTemplateTitle;?>';
|
||||
</script>
|
||||
<?php
|
||||
foreach($templates as $key => $template)
|
||||
{
|
||||
echo "<span id='tplBox$template->id'>";
|
||||
echo ($key + 1) . ". <span id='tplTitleBox$template->id' onclick='setTemplate($template->id)' style='text-decoration:underline; color:blue' class='hand'>$template->title</span>";
|
||||
echo $lang->arrow. "<span id='tplTitleBox$template->id' onclick='setTemplate($template->id)' style='text-decoration:underline; color:blue' class='hand'>$template->title</span>";
|
||||
echo html::commonButton('x', "onclick=deleteTemplate($template->id)");
|
||||
echo "<span id='template$template->id' class='hidden'>$template->content</span>";
|
||||
echo '<br /></span>';
|
||||
}
|
||||
echo html::commonButton($lang->save, 'onclick=saveTemplate()');
|
||||
|
||||
@@ -25,6 +25,7 @@
|
||||
<?php include '../../common/view/header.html.php';?>
|
||||
<?php include '../../common/view/autocomplete.html.php';?>
|
||||
<?php include '../../common/view/alert.html.php';?>
|
||||
<?php include '../../common/view/xheditor.html.php';?>
|
||||
<style>
|
||||
#project, #product {width:200px}
|
||||
#module, #task {width:400px}
|
||||
@@ -153,7 +154,7 @@ $(function() {
|
||||
<tr>
|
||||
<th class='rowhead'><?php echo $lang->bug->openedBuild;?></th>
|
||||
<td>
|
||||
<span id='buildBox'><?php echo html::select('openedBuild[]', $builds, $buildID, 'size=4 multiple=multiple class=select-3');?></span>
|
||||
<span id='buildBox'><?php echo html::select('openedBuild[]', $builds, $buildID, 'size=3 multiple=multiple class=select-3');?></span>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
@@ -187,7 +188,7 @@ $(function() {
|
||||
<td>
|
||||
<table class='w-p100 bd-none'>
|
||||
<tr class='bd-none' valign='top'>
|
||||
<td class='w-p85 bd-none padding-zero'><?php echo html::textarea('steps', $steps, "class='w-p100' rows='6'");?></td>
|
||||
<td class='w-p85 bd-none padding-zero'><?php echo html::textarea('steps', $steps, "class='xhe' rows='9'");?></td>
|
||||
<td class='bd-none pl-10px' id='tplBox'><?php echo $this->fetch('bug', 'buildTemplates');?></td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
@@ -24,6 +24,8 @@
|
||||
?>
|
||||
<?php include '../../common/view/header.html.php';?>
|
||||
<?php include '../../common/view/autocomplete.html.php';?>
|
||||
<?php include '../../common/view/alert.html.php';?>
|
||||
<?php include '../../common/view/xheditor.html.php';?>
|
||||
<style>
|
||||
#product, #module, #project, #story, #task, #resolvedBuild{width:230px}
|
||||
.select-3 {width:230px}
|
||||
@@ -161,7 +163,7 @@ $(function() {
|
||||
<tr class='bd-none'><td class='bd-none'>
|
||||
<fieldset>
|
||||
<legend><?php echo $lang->bug->legendSteps;?></legend>
|
||||
<?php echo html::textarea('steps', $bug->steps, "rows='8' class='area-1'");?>
|
||||
<legend class='w-p90'><?php echo html::textarea('steps', $bug->steps, "rows='8' class='xhe'");?></legend>
|
||||
</fieldset>
|
||||
<fieldset>
|
||||
<legend><?php echo $lang->bug->legendComment;?></legend>
|
||||
|
||||
@@ -260,3 +260,37 @@ define('DT_DATE2', 'Ymd');
|
||||
define('DT_DATE3', 'Y年m月d日');
|
||||
define('DT_TIME1', 'H:i:s');
|
||||
define('DT_TIME2', 'H:i');
|
||||
|
||||
/* 表情。*/
|
||||
$lang->smilies->smile = '微笑';
|
||||
$lang->smilies->sad = '悲伤';
|
||||
$lang->smilies->wink = '眨眼';
|
||||
$lang->smilies->tongue = '吐舌头';
|
||||
$lang->smilies->shocked = '惊讶';
|
||||
$lang->smilies->eyesdown = '失望';
|
||||
$lang->smilies->angry = '愤怒';
|
||||
$lang->smilies->cool = '耍酷';
|
||||
$lang->smilies->indifferent = '冷漠';
|
||||
$lang->smilies->sick = '病中';
|
||||
$lang->smilies->blush = '尴尬';
|
||||
$lang->smilies->angel = '天使';
|
||||
$lang->smilies->confused = '困惑';
|
||||
$lang->smilies->cry = '大哭';
|
||||
$lang->smilies->footinmouth = '保密';
|
||||
$lang->smilies->biggrin = '大笑';
|
||||
$lang->smilies->nerd = '书呆子';
|
||||
$lang->smilies->tired = '好累';
|
||||
$lang->smilies->rose = '玫瑰';
|
||||
$lang->smilies->kiss = '吻';
|
||||
$lang->smilies->heart = '心';
|
||||
$lang->smilies->hug = '拥抱';
|
||||
$lang->smilies->dog = '狗狗';
|
||||
$lang->smilies->deadrose = '残花';
|
||||
$lang->smilies->clock = '时钟';
|
||||
$lang->smilies->brokenheart = '伤心';
|
||||
$lang->smilies->coffee = '咖啡';
|
||||
$lang->smilies->computer = '计算机';
|
||||
$lang->smilies->devil = '魔鬼';
|
||||
$lang->smilies->thumbsup = '赞同';
|
||||
$lang->smilies->thumbsdown = '反对';
|
||||
$lang->smilies->mail = '邮件';
|
||||
|
||||
54
trunk/module/common/view/xheditor.html.php
Normal file
@@ -0,0 +1,54 @@
|
||||
<?php if($extView = $this->getExtViewFile(__FILE__)){include $extView; return helper::cd();}?>
|
||||
<link rel='stylesheet' href='<?php echo $clientTheme;?>xheditor.css' />
|
||||
<style>
|
||||
.saveTemplate {
|
||||
background: transparent url(theme/default/images/xheditor/save.gif) no-repeat;
|
||||
background-position: center;
|
||||
}
|
||||
</style>
|
||||
<script src='<?php echo $jsRoot;?>jquery/xheditor/xheditor-<?php echo $app->getClientLang();?>.min.js' type='text/javascript'></script>
|
||||
<script src='<?php echo $jsRoot;?>jquery/xheditor/xheditor_plugins/ubb.min.js' type='text/javascript'></script>
|
||||
<script language='javascript'>
|
||||
var smiles = <?php echo json_encode($lang->smilies);?>;
|
||||
var save = '<?php echo $lang->save;?>';
|
||||
var setTemplateTitle = '<?php echo $lang->bug->setTemplateTitle;?>';
|
||||
var simpleTools = "Blocktag,Fontface,FontSize,Bold,Italic,Underline,Strikethrough,FontColor,BackColor,Removeformat,Separator,Align,List,Outdent,Indent,Separator,Link,Img,Emot,Source,Fullscreen,About,Separator,Save";
|
||||
$(function() {
|
||||
var allPlugin={
|
||||
Save:{
|
||||
c:'saveTemplate',
|
||||
t:save,
|
||||
e:function(){
|
||||
content = $("#steps").val();
|
||||
jPrompt(setTemplateTitle, '','', function(r)
|
||||
{
|
||||
if(!r || !content) return;
|
||||
saveTemplateLink = createLink('bug', 'saveTemplate');
|
||||
steps = $("#steps").val();
|
||||
$.post(saveTemplateLink, {title:r, content:content}, function(data)
|
||||
{
|
||||
$('#tplBox').html(data);
|
||||
});
|
||||
});
|
||||
}}
|
||||
};
|
||||
|
||||
$('.xhe').xheditor({
|
||||
plugins:allPlugin,
|
||||
tools:simpleTools,
|
||||
skin:'default',
|
||||
width:'100%',
|
||||
forcePtag:false,
|
||||
beforeSetSource:ubb2html,
|
||||
beforeGetSource:html2ubb,
|
||||
emots:{
|
||||
'default':{
|
||||
name:'default',
|
||||
width:22,height:22,line:8,
|
||||
list:smiles}}});
|
||||
|
||||
$('.saveTemplate').css({width:'58px'});
|
||||
$('.saveTemplate').parent().css({width:'58px'});
|
||||
|
||||
});
|
||||
</script>
|
||||
93
trunk/www/js/jquery/xheditor/xheditor-en.min.js
vendored
Normal file
@@ -0,0 +1,93 @@
|
||||
(function(e){if(e.xheditor)return false;e.fn.xheditor=function(C){var F=[];this.each(function(){if(e.nodeName(this,"TEXTAREA"))if(C===false){if(this.xheditor){this.xheditor.remove();this.xheditor=null}}else if(!this.xheditor){var G=/({.*})/.exec(e(this).attr("class"));if(G){try{G=eval("("+G[1]+")")}catch(Q){}C=e.extend({},G,C)}G=new e.xheditor(this,C);if(G.init()){this.xheditor=G;F.push(G)}}});if(F.length==0)F=false;if(F.length==1)F=F[0];return F};var Y=0,wa=e.browser.version,D=e.browser.msie,oa=
|
||||
e.browser.mozilla,Z=e.browser.safari,Xa=e.browser.opera,T=false,pa=true,L,ea,fa,ga,xa,U;e("script[src*=xheditor]").each(function(){var C=this.src;if(C.match(/xheditor[^\/]*\.js/i)){U=C.replace(/[\?#].*$/,"").replace(/(^|[\/\\])[^\/]*$/,"$1");return false}});var Ya={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"},Za=["#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"],$a=[{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"}],ab=
|
||||
[{n:"Arial"},{n:"Arial Narrow"},{n:"Arial Black"},{n:"Comic Sans MS"},{n:"Courier New"},{n:"System"},{n:"Times New Roman"},{n:"Tahoma"},{n:"Verdana"}],N=[{n:"xx-small",wkn:"x-small",s:"8pt",t:"xx-small"},{n:"x-small",wkn:"small",s:"10pt",t:"x-small"},{n:"small",wkn:"medium",s:"12pt",t:"small"},{n:"medium",wkn:"large",s:"14pt",t:"medium"},{n:"large",wkn:"x-large",s:"18pt",t:"large"},{n:"x-large",wkn:"xx-large",s:"24pt",t:"x-large"},{n:"xx-large",wkn:"-webkit-xxx-large",s:"36pt",t:"xx-large"}],bb=[{s:"Align left",
|
||||
v:"justifyleft",t:"Align left"},{s:"Align center",v:"justifycenter",t:"Align center"},{s:"Align right",v:"justifyright",t:"Align right"},{s:"Align full",v:"justifyfull",t:"Align full"}],cb=[{s:"Ordered list",v:"insertOrderedList",t:"Ordered list"},{s:"Unordered list",v:"insertUnorderedList",t:"Unordered list"}],db={"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"}}},ha={Cut:{t:"Cut (Ctrl+X)"},Copy:{t:"Copy (Ctrl+C)"},Paste:{t:"Paste (Ctrl+V)"},Pastetext:{t:"Paste as plain text",h:D?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 (Ctrl+S)",s:"Ctrl+S"},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 (Shift+Tab)",s:"Shift+Tab"},Indent:{t:"Indent (Tab)",s:"Tab"},Link:{t:"Insert/edit link",h:1},Unlink:{t:"Unlink"},Img:{t:"Insert/edit image",
|
||||
h:1},Flash:{t:"Insert/edit flash",h:1},Media:{t:"Insert/edit media",h:1},Emot:{t:"Emotions",s:"ctrl+e",h:1},Table:{t:"Insert a new table",h:1},Source:{t:"Edit source code"},Print:{t:"Print (Ctrl+P)",s:"Ctrl+P"},Fullscreen:{t:"Toggle fullscreen (Esc)",s:"Esc"},About:{t:"About xhEditor"}},ya={mini:"Bold,Italic,Underline,Strikethrough,Separator,Align,List,Separator,Link,Img,About",simple:"Blocktag,Fontface,FontSize,Bold,Italic,Underline,Strikethrough,FontColor,BackColor,Separator,Align,List,Outdent,Indent,Separator,Link,Img,Emot,About",
|
||||
full:"Cut,Copy,Paste,Pastetext,Separator,Blocktag,Fontface,FontSize,Bold,Italic,Underline,Strikethrough,FontColor,BackColor,SelectAll,Removeformat,Separator,Align,List,Outdent,Indent,Separator,Link,Unlink,Img,Flash,Media,Emot,Table,Separator,Source,Print,Fullscreen,About"};ya.mfull=ya.full.replace(/Separator(,Align)/i,"BtnBr$1");e.xheditor=function(C,F){function G(){setTimeout(b.setSource,10)}function Q(){b.getSource()}function eb(){if(D&&!H){var a;a=xa[0].contentWindow.document.body;a.innerHTML=
|
||||
"";a.createTextRange().execCommand("Paste");a=a.innerHTML;if(!a.match(/mso-|MsoNormal/i))return true;if(a.indexOf(" ")==0)a=a.substring(6);a=b.cleanHTML(a);a=b.formatXHTML(a);a=b.cleanWord(a);b.pasteHTML(a);return false}}function za(a){try{b._exec("styleWithCSS",a,true)}catch(c){try{b._exec("useCSS",!a,true)}catch(d){}}}function Aa(){if(Ba&&!H){za(false);try{b._exec("enableObjectResizing",true,true)}catch(a){}if(D)try{b._exec("BackgroundImageCache",true,true)}catch(c){}}}function fb(a){if(H||
|
||||
a.which!=13||a.shiftKey||a.ctrlKey||a.altKey)return true;a=b.getParent("p,h1,h2,h3,h4,h5,h6,pre,address,div,li");if(a.is("li"))return true;if(b.settings.forcePtag)a.length==0&&b._exec("formatblock","<p>");else{b.pasteHTML("<br />");return false}}function Ca(){if(!oa&&!Z){ia&&O.height("100%").css("height",O.outerHeight()-J.outerHeight());D&&J.hide().show()}}function gb(a){a=a.target;if(a.tagName.match(/(img|embed)/i)){var c=b.getSel(),d=b.getRng();d.selectNode(a);c.removeAllRanges();c.addRange(d)}}
|
||||
function V(a,c,d){if(!c)return false;var g="_xhe_"+c;d&&a.attr(c,d).removeAttr(g).attr(g,d);return a.attr(g)||a.attr(c)}function Ia(){pa&&b.hidePanel()}function hb(a){if(H)return true;var c=a.which,d=Ya[c];c=d?d:String.fromCharCode(c).toLowerCase();sKey="";sKey+=a.ctrlKey?"ctrl+":"";sKey+=a.altKey?"alt+":"";sKey+=a.shiftKey?"shift+":"";sKey+=c;a=ja[sKey];var g;for(g in a){g=a[g];if(e.isFunction(g)){if(g.call(b)===false)return false}else{b.exec(g);return false}}}function $(a,c){var d=typeof a;if(!c)return d!=
|
||||
"undefined";if(c=="array"&&a.hasOwnProperty&&a instanceof Array)return true;return d==c}function Da(a,c){var d=location.protocol,g=location.hostname,m=location.port,j=location.pathname.replace(/\\/g,"/").replace(/[^\/]+$/i,"");m=m==""?"80":m;a=e.trim(a);if(d=="file:")c="abs";if(c!="abs")a=a.replace(RegExp(d+"\\/\\/"+g.replace(/\./g,"\\.")+"(?::"+m+")"+(m=="80"?"?":"")+"(/|$)","i"),"/");if(c=="rel")a=a.replace(RegExp("^"+j.replace(/([\/\.\+\[\]\(\)])/g,"\\$1"),"i"),"");if(c!="rel")a.match(/^((https?|file):\/\/|\/)/i)||
|
||||
(a=j+a);if(c=="abs")a.match(/(https?|file):\/\//i)||(a=d+"//"+location.host+a);return a}function Ja(a){var c=Math.floor(Math.log(a)/Math.log(1024));return(a/Math.pow(1024,Math.floor(c))).toFixed(2)+["Byte","KB","MB","GB","TB","PB"][c]}function W(){return false}var b=this,P=e(C),Ka=P.closest("form"),J,O,R,qa,w,ra,aa,Ba=false,H=false,ia=false,La,ka=false,Ma="",M=null,Ea,la=false,Fa=false,ba=null,X=null,S=0;this.settings=e.extend({},{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 to open link",layerShadow:3,emotMark:false,upBtnText:"Upload",wordDeepClean:true,hoverExecDelay:100,html5Upload:true,upMultiple:99},F);var sa=b.settings.plugins,ta=[];if(sa){ha=e.extend({},ha,sa);e.each(sa,function(a){ta.push(a)});ta=ta.join(",")}if(b.settings.tools.match(/^\s*(m?full|simple|mini)\s*$/i)){var Na=
|
||||
ya[e.trim(b.settings.tools)];b.settings.tools=b.settings.tools.match(/m?full/i)&&sa?Na.replace("Table","Table,"+ta):Na}b.settings.tools.match(/(^|,)\s*About\s*(,|$)/i)||(b.settings.tools+=",About");b.settings.tools=b.settings.tools.split(",");U=Da(U,"abs");var Oa="xheCSS_"+b.settings.skin,ma="xhe"+Y+"_container",Pa="xhe"+Y+"_Tool",Qa="xhe"+Y+"_iframearea",Ra="xhe"+Y+"_iframe",ua="xhe"+Y+"_fixffcursor",ca="",Ga=U+"xheditor_skin/"+b.settings.skin+"/",va=db,Sa=Da(U,"rel")+"xheditor_emot/",Ha="";va=e.extend({},
|
||||
va,b.settings.emots);if(ka=b.settings.showBlocktag)ca+=" showBlocktag";var ja=[];this.init=function(){e("#"+Oa).length==0&&e("head").append('<link id="'+Oa+'" rel="stylesheet" type="text/css" href="'+Ga+'ui.css" />');var a=b.settings.width||C.style.width||P.outerWidth();S=b.settings.height||C.style.height||P.outerHeight();if($(S,"string"))S=S.replace(/[^\d]+/g,"");if(a<=0||S<=0){alert("Current textarea is hidden, please make it show before initialization xhEditor, or directly initialize the height.");
|
||||
return false}if(/^[0-9\.]+$/i.test(""+a))a+="px";var c=['<span class="xheGStart"/>'],d,g,m=/Separator|BtnBr/i;e.each(b.settings.tools,function(i,f){d=ha[f];f.match(m)&&c.push('<span class="xheGEnd"/>');if(f=="Separator")c.push('<span class="xheSeparator"/>');else if(f=="BtnBr")c.push("<br />");else{g=d.c?d.c:"xheIcon xheBtn"+f;c.push('<span><a href="javascript:void(0);" title="'+d.t+'" name="'+f+'" class="xheButton xheEnabled" tabindex="-1"><span class="'+g+'" unselectable="on" /></a></span>');d.s&&
|
||||
b.addShortcuts(d.s,f)}f.match(m)&&c.push('<span class="xheGStart"/>')});c.push('<span class="xheGEnd"/><br />');P.after(e('<input type="text" id="'+ua+'" style="position:absolute;display:none;" /><span id="'+ma+'" class="xhe_'+b.settings.skin+'" style="display:none"><table cellspacing="0" cellpadding="0" class="xheLayout" style="width:'+a+";height:"+S+'px;"><tbody><tr><td id="'+Pa+'" class="xheTool" unselectable="on" style="height:1px;"></td></tr><tr><td id="'+Qa+'" class="xheIframeArea"><iframe frameborder="0" id="'+
|
||||
Ra+'" src="javascript:;" style="width:100%;"></iframe></td></tr></tbody></table></span>'));J=e("#"+Pa);O=e("#"+Qa);a='<html><head><base /><meta content="text/html; charset=UTF-8" http-equiv="Content-Type"/><link rel="stylesheet" href="'+Ga+'iframe.css"/>';var j=b.settings.loadCSS;if(j)if($(j,"array"))for(var l in j)a+='<link rel="stylesheet" href="'+j[l]+'"/>';else a+=j.match(/\s*<style(\s+[^>]*?)?>[\s\S]+?<\/style>\s*/i)?j:'<link rel="stylesheet" href="'+j+'"/>';a+='</head><body spellcheck="false" dir="ltr" class="editMode'+
|
||||
ca+'"></body></html>';b.win=R=e("#"+Ra)[0].contentWindow;qa=e(R);try{this.doc=w=R.document;ra=e(w);w.open();w.write(a);w.close();if(D)w.body.contentEditable="true";else w.designMode="On"}catch(h){}setTimeout(Aa,300);b.setSource();R.setInterval=null;J.append(c.join("")).bind("mousedown contextmenu",W).click(function(i){var f=e(i.target).closest("a");if(f.is(".xheEnabled")){M=i;b.exec(f.attr("name"))}return false});J.find(".xheButton").hover(function(i){var f=e(this),k=b.settings.hoverExecDelay,n=X;
|
||||
X=null;if(k==-1||la||!f.is(".xheEnabled"))return false;if(n&&n>10){la=true;setTimeout(function(){la=false},100);return false}var q=f.attr("name");if(ha[q].h!=1){b.hidePanel();return false}if(Fa)k=0;if(k>=0)Ea=setTimeout(function(){M=i;ba={x:M.clientX,y:M.clientY};b.exec(q)},k)},function(){ba=null;Ea&&clearTimeout(Ea)}).mousemove(function(i){if(ba){var f={x:i.clientX-ba.x,y:i.clientY-ba.y};if(Math.abs(f.x)>1||Math.abs(f.y)>1){if(f.x>0&&f.y>0){f=Math.round(Math.atan(f.y/f.x)/0.017453293);X=X?(X+f)/
|
||||
2:f}else X=null;ba={x:i.clientX,y:i.clientY}}}});L=e("#xhePanel");ea=e("#xheShadow");fa=e("#xheCntLine");xa=e("#xheTempIframe");if(L.length==0){L=e('<div id="xhePanel"></div>').mousedown(function(i){i.stopPropagation()});ea=e('<div id="xheShadow"></div>');fa=e('<div id="xheCntLine"></div>');setTimeout(function(){e(document.body).append(L).append(ea).append(fa);if(D)e(document.body).append(xa=e('<iframe id="xheTempIframe" class="xheHideArea" />'))},10)}e(document).mousedown(Ia);ra.mousedown(Ia);e("#"+
|
||||
ma).show();O.css("height",S-J.outerHeight());P.hide();P.focus(b.focus);Ka.submit(Q).bind("reset",G);l=e(window);l.unload(Q).bind("beforeunload",Q);l.resize(Ca);qa.focus(function(){b.settings.focus&&b.settings.focus()}).blur(function(){b.settings.blur&&b.settings.blur()});Z&&qa.click(gb);ra.keydown(hb).keypress(fb).bind("mousedown click",function(i){P.trigger(i.type)});e("body",ra).bind("paste",eb);(l=b.settings.shortcuts)&&e.each(l,function(i,f){b.addShortcuts(i,f)});Y++;Ba=true;if(b.settings.fullscreen)b.toggleFullscreen();
|
||||
else b.settings.sourceMode&&setTimeout(b.toggleSource,20);return true};this.remove=function(){b.hidePanel();Q();P.unbind("focus",b.focus);Ka.unbind("submit",Q).unbind("reset",G);var a=e(window);a.unbind("unload",Q).unbind("beforeunload",Q);a.unbind("resize",Ca);e("#"+ma).remove();e("#"+ua).remove();P.show();Ba=false};this.saveBookmark=function(){H||(aa=b.getRng())};this.loadBookmark=function(){if(!(H||!aa)){b.focus();if(D)aa.select();else{var a=b.getSel();a.removeAllRanges();a.addRange(aa)}aa=null}};
|
||||
this.focus=function(){H?e("#sourceCode",w).focus():qa.focus();return false};this.setCursorFirst=function(a){b.focus();R.scrollTo(0,0);var c=b.getRng(),d=w.body,g=d,m;if(a&&g.firstChild&&(m=g.firstChild.tagName)&&m.match(/^p|div|h[1-6]$/i))g=d.firstChild;D?c.moveToElementText(g):c.setStart(g,0);c.collapse(true);if(D)c.select();else{a=b.getSel();a.removeAllRanges();a.addRange(c)}};this.getSel=function(){return R.getSelection?R.getSelection():w.selection};this.getRng=function(){var a=b.getSel(),c;try{c=
|
||||
a.rangeCount>0?a.getRangeAt(0):a.createRange?a.createRange():w.createRange()}catch(d){}c||(c=D?w.body.createTextRange():w.createRange());return c};this.getParent=function(a){var c=b.getRng(),d;if(D)d=c.item?c.item(0):c.parentElement();else{d=c.commonAncestorContainer;if(!c.collapsed)if(c.startContainer==c.endContainer&&c.startOffset-c.endOffset<2&&c.startContainer.hasChildNodes())d=c.startContainer.childNodes[c.startOffset]}a=a?a:"*";d=e(d);d.is(a)||(d=e(d).closest(a));return d};this.getSelect=function(a){var c=
|
||||
b.getSel(),d=b.getRng(),g=true;g=!d||d.item?false:!c||d.boundingWidth==0||d.collapsed;if(a=="text")return g?"":d.text||(c.toString?c.toString():"");if(d.cloneContents){a=e("<div></div>");(d=d.cloneContents())&&a.append(d);d=a.html()}else d=$(d.item)?d.item(0).outerHTML:$(d.htmlText)?d.htmlText:d.toString();if(g)d="";d=b.processHTML(d,"read");d=b.cleanHTML(d);return d=b.formatXHTML(d)};this.pasteHTML=function(a,c){if(H)return false;b.focus();a=b.processHTML(a,"write");var d=b.getSel(),g=b.getRng();
|
||||
if(c!=undefined){if(g.item){var m=g.item(0);g=w.body.createTextRange();g.moveToElementText(m);g.select()}g.collapse(c)}if(g.insertNode){g.deleteContents();m=g.createContextualFragment(a);var j=m.lastChild;g.insertNode(m);g.setEndAfter(j);g.collapse(false);d.removeAllRanges();d.addRange(g)}else{if(d.type.toLowerCase()=="control"){d.clear();g=b.getRng()}g.pasteHTML(a)}};this.pasteText=function(a,c){a||(a="");a=b.domEncode(a);a=a.replace(/\r?\n/g,"<br />");b.pasteHTML(a,c)};this.appendHTML=function(a){if(H)return false;
|
||||
b.focus();a=b.processHTML(a,"write");e(w.body).append(a)};this.domEncode=function(a){return a.replace(/[<>]/g,function(c){return{"<":"<",">":">"}[c]})};this.setSource=function(a){aa=null;if(typeof a!="string"&&a!="")a=C.value;if(H)e("#sourceCode",w).val(a);else{if(b.settings.beforeSetSource)a=b.settings.beforeSetSource(a);a=b.cleanHTML(a);a=b.formatXHTML(a);a=b.cleanWord(a);w.body.innerHTML=b.processHTML(a,"write")}};this.processHTML=function(a,c){if(c=="write"){a=a.replace(/<img(?:\s+[^>]*?)?(\s+emot\s*=\s*(["']?)\s*(.*?)\s*\2)(?:\s+[^>]*?)?\/?>/ig,
|
||||
function(j,l,h,i){i=i.split(",");if(!i[1]){i[1]=i[0];i[0]=""}if(i[0]=="default")i[0]="";return j.replace(/\s+src\s*=\s*(["']?).*?\1(\s|$|\/|>)/i,"$2").replace(l,' src="'+Sa+(i[0]?i[0]:"default")+"/"+i[1]+'.gif"'+(b.settings.emotMark?' emot="'+(i[0]?i[0]+",":"")+i[1]+'" alt="'+i[1]+'"':""))});a=a.replace(/<(\w+(?:\:\w+)?)(?:\s+[^>]*?)?(\s+(src|href)\s*=\s*(["']?)\s*(.*?)\s*\4)(?:\s+[^>]*?)?\/?>/ig,function(j,l,h,i,f,k){return j.replace(h,h+" _xhe_"+i+'="'+k+'"')});a=a.replace(/<(\/?)del(\s+[^>]*?)?>/ig,
|
||||
"<$1strike$2>");if(oa){a=a.replace(/<(\/?)strong(\s+[^>]*?)?>/ig,"<$1b$2>");a=a.replace(/<(\/?)em(\s+[^>]*?)?>/ig,"<$1i$2>")}else if(Z){a=a.replace(/("|;)\s*font-size\s*:\s*([a-z-]+)(;?)/ig,function(j,l,h,i){for(var f,k=0;k<N.length;k++){j=N[k];if(h==j.n){f=j.wkn;break}}return l+"font-size:"+f+i});a=a.replace(/<strong(\s+[^>]*?)?>/ig,'<span class="Apple-style-span" style="font-weight: bold;"$1>');a=a.replace(/<em(\s+[^>]*?)?>/ig,'<span class="Apple-style-span" style="font-style: italic;"$1>');a=a.replace(/<u(\s+[^>]*?)?>/ig,
|
||||
'<span class="Apple-style-span" style="text-decoration: underline;"$1>');a=a.replace(/<strike(\s+[^>]*?)?>/ig,'<span class="Apple-style-span" style="text-decoration: line-through;"$1>');a=a.replace(/<\/(strong|em|u|strike)>/ig,"</span>");a=a.replace(/<span((?:\s+[^>]*?)?\s+style="([^"]*;)*\s*(font-family|font-size|color|background-color)\s*:\s*[^;"]+\s*;?"[^>]*)>/ig,'<span class="Apple-style-span"$1>')}else if(D){a=a.replace(/'/ig,"'");a=a.replace(/\s+(disabled|checked|readonly|selected)\s*=\s*[\"\']?(false|0)[\"\']?/ig,
|
||||
"")}a=a.replace(/<a(\s+[^>]*?)?\/>/,"<a$1></a>");if(!Z){var d=function(j,l,h,i){l="";var f,k;if(f=h.match(/font-family\s*:\s*([^;"]+)/i))l+=' face="'+f[1]+'"';if(f=h.match(/font-size\s*:\s*([^;"]+)/i)){f=f[1].toLowerCase();for(var n=0;n<N.length;n++)if(f==N[n].n||f==N[n].s){k=n+1;break}if(k){l+=' size="'+k+'"';h=h.replace(/(^|;)(\s*font-size\s*:\s*[^;"]+;?)+/ig,"$1")}}if(k=h.match(/(?:^|[\s;])color\s*:\s*([^;"]+)/i)){if(f=k[1].match(/\s*rgb\s*\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*\)/i)){k[1]="#";for(n=
|
||||
1;n<=3;n++)k[1]+=(f[n]-0).toString(16)}k[1]=k[1].replace(/^#([0-9a-f])([0-9a-f])([0-9a-f])$/i,"#$1$1$2$2$3$3");l+=' color="'+k[1]+'"'}h=h.replace(/(^|;)(\s*(font-family|color)\s*:\s*[^;"]+;?)+/ig,"$1");if(l!=""){if(h)l+=' style="'+h+'"';return"<font"+l+">"+i+"</font>"}else return j};a=a.replace(/<(span)(?:\s+[^>]*?)?\s+style\s*=\s*"((?:[^"]*?;)*\s*(?:font-family|font-size|color)\s*:[^"]*)"(?: [^>]+)?>(((?!<\1(\s+[^>]*?)?>)[\s\S])*?)<\/\1>/ig,d);a=a.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,
|
||||
d);a=a.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,d)}}else{var g=b.settings.localUrl;a=a.replace(/<(?:\w+(?:\:\w+)?)(?:\s+[^>]*?)?\s+_xhe_(src|href)\s*=\s*(["']?)\s*(.*?)\s*\2(?:\s+[^>]*?)?\/?>/ig,function(j,l,h,i){if(g)i=Da(i,g);return j.replace(RegExp("\\s+"+l+"\\s*=\\s*([\"']?).*?\\1(\\s|/?>)",
|
||||
"ig")," "+l+'="'+i.replace(/\$/g,"$$$$")+'"$2')});if(Z){a=a.replace(/("|;)\s*font-size\s*:\s*([a-z-]+)(;?)/ig,function(j,l,h,i){for(var f,k=0;k<N.length;k++){j=N[k];if(h==j.wkn){f=j.n;break}}return l+"font-size:"+f+i});var m=[{r:/font-weight:\sbold/ig,t:"strong"},{r:/font-style:\sitalic/ig,t:"em"},{r:/text-decoration:\sunderline/ig,t:"u"},{r:/text-decoration:\sline-through/ig,t:"strike"}];d=function(j,l,h,i,f){l=h+i;h="";for(i=0;i<m.length;i++)if(l.match(m[i].r)){h=m[i].t;break}return h?"<"+h+">"+
|
||||
f+"</"+h+">":j};a=a.replace(/<(span)(\s+[^>]*?)?\s+class\s*=\s*"Apple-style-span"(\s+[^>]*?)?>(((?!<\1(\s+[^>]*?)?>)[\s\S])*?)<\/\1>/ig,d);a=a.replace(/<(span)(\s+[^>]*?)?\s+class\s*=\s*"Apple-style-span"(\s+[^>]*?)?>(((?!<\1(\s+[^>]*?)?>)[\s\S]|<\1(\s+[^>]*?)?>((?!<\1(\s+[^>]*?)?>)[\s\S])*?<\/\1>)*?)<\/\1>/ig,d);a=a.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,
|
||||
d)}a=a.replace(/(<\w+(?:\s+[^>]*?)?)\s+(?:_xhe_|_moz_|_webkit_)[^=]+?\s*=\s*(["']?).*?\2(\s|\/?>)/ig,"$1$3");a=a.replace(/(<\w+[^>]*?)\s+class\s*=\s*(["']?)\s*(?:apple|webkit)\-.+?\s*\2(\s|\/?>)/ig,"$1$3");a=a.replace(/<img(\s+[^>]+?)\/?>/ig,function(j,l){l.match(/\s+alt\s*(["']?).*?\1(\s|$)/i)||(l+=' alt=""');return"<img"+l+" />"})}return a};this.getSource=function(a){var c,d=b.settings.beforeGetSource;if(H){c=e("#sourceCode",w).val();d||(c=c.replace(/(\t*\r?\n\t*)+/g,""))}else{c=b.processHTML(w.body.innerHTML,
|
||||
"read");c=c.replace(/^\s*(?:<(p|div)(?:\s+[^>]*?)?>)?\s*(<br(?:\s+[^>]*?)?>)*\s*(?:<\/\1>)?\s*$/i,"");c=b.cleanHTML(c);c=b.formatXHTML(c,a);c=b.cleanWord(c);if(d)c=d(c)}return C.value=c};this.cleanWord=function(a){if(a.match(/mso(-|normal)/i)){var c=b.settings.wordDeepClean;a=a.replace(/(<link(?:\s+[^>]*?)?)\s+href\s*=\s*(["']?)\s*file:\/\/.+?\s*\2((?:\s+[^>]*?)?\s*\/?>)/ig,"");a=a.replace(/<!--[\s\S]*?--\>|<!(--)?\[[\s\S]+?\](--)?>|<style(\s+[^>]*?)?>[\s\S]*?<\/style>/ig,"");a=a.replace(/<\/?\w+:[^>]*>/ig,
|
||||
"");if(c)a=a.replace(/<\/?(span|a|img)(\s+[^>]*?)?>/ig,"");a=a.replace(/(<\w+(?:\s+[^>]*?)?)\s+class\s*=\s*(["']?)\s*mso.+?\s*\2((?:\s+[^>]*?)?\s*\/?>)/ig,"$1$3");a=a.replace(/(<\w+(?:\s+[^>]*?)?)\s+lang\s*=\s*(["']?)\s*.+?\s*\2((?:\s+[^>]*?)?\s*\/?>)/ig,"$1$3");a=a.replace(/(<\w+(?:\s+[^>]*?)?)\s+align\s*=\s*(["']?)\s*left\s*\2((?:\s+[^>]*?)?\s*\/?>)/ig,"$1$3");a=a.replace(/<\w+(?:\s+[^>]*?)?(\s+style\s*=\s*(["']?)\s*([\s\S]*?)\s*\2)(?:\s+[^>]*?)?\s*\/?>/ig,function(d,g,m,j){j=e.trim(j.replace(/\s*(mso-[^:]+:.+?|margin\s*:\s*0cm 0cm 0pt\s*|(text-align|font-variant|line-height)\s*:\s*.+?)(;|$)\s*/ig,
|
||||
""));return d.replace(g,c?"":j?' style="'+j+'"':"")})}return a};this.cleanHTML=function(a){a=a.replace(/<!?\/?(DOCTYPE|html|body|meta)(\s+[^>]*?)?>/ig,"");var c;a=a.replace(/<head(?:\s+[^>]*?)?>([\s\S]*?)<\/head>/i,function(d,g){c=g.match(/<(script|style)(\s+[^>]*?)?>[\s\S]*?<\/\1>/ig);return""});if(c)a=c.join("")+a;a=a.replace(/<\??xml(:\w+)?(\s+[^>]*?)?>([\s\S]*?<\/xml>)?/ig,"");b.settings.linkTag||(a=a.replace(/<link(\s+[^>]*?)?>/ig,""));b.settings.internalScript||(a=a.replace(/<script(\s+[^>]*?)?>[\s\S]*?<\/script>/ig,
|
||||
""));b.settings.inlineScript||(a=a.replace(/(<\w+)(\s+[^>]*?)?\s+on(?:click|dblclick|mousedown|mouseup|mousemove|mouseover|mouseout|mouseenter|mouseleave|keydown|keypress|keyup|change|select|submit|reset|blur|focus|load|unload)\s*=\s*(["']?).*?\3((?:\s+[^>]*?)?\/?>)/ig,"$1$2$4"));b.settings.internalStyle||(a=a.replace(/<style(\s+[^>]*?)?>[\s\S]*?<\/style>/ig,""));b.settings.inlineStyle||(a=a.replace(/(<\w+)(\s+[^>]*?)?\s+(style|class)\s*=\s*(["']?).*?\4((?:\s+[^>]*?)?\/?>)/ig,"$1$2$5"));return a=
|
||||
a.replace(/<\/(strong|b|u|strike|em|i)>((?:\s|<br\/?>| )*?)<\1(\s+[^>]*?)?>/ig,"$2")};this.formatXHTML=function(a,c){function d(p){var x={};p=p.split(",");for(var E=0;E<p.length;E++)x[p[E]]=true;return x}function g(p){if(p){p=p.toLowerCase();var x=o[p];if(x)p=x}else p="";return p}function m(p,x,E){p=g(p);if(k[p])for(;y.last()&&n[y.last()];)j(y.last());q[p]&&y.last()==p&&j(p);(E=f[p]||!!E)||y.push(p);var I=[];I.push("<"+p);x.replace(A,function(Ta,na,Ua,Va,Wa){na=na.toLowerCase();I.push(" "+na+
|
||||
'="'+(Ua?Ua:Va?Va:Wa?Wa:r[na]?na:"")+'"')});I.push((E?" /":"")+">");l(I.join(""),p,true)}function j(p){if(p){p=g(p);for(x=y.length-1;x>=0;x--)if(y[x]==p)break}else var x=0;if(x>=0){for(p=y.length-1;p>=x;p--)l("</"+y[p]+">",y[p]);y.length=x}}function l(p,x,E){if(c==true){p=p.replace(/(\t*\r?\n\t*)+/g,"");if(!p.match(/^\s*$/)){var I=k[x],Ta=I?x:"";if(I){E&&K++;da==""&&K--}else da&&K++;if(Ta!=da||I)h();B.push(p);x=="br"&&h();if(I&&(f[x]||!E))K--;da=I?x:"";ib=E}}else B.push(p)}function h(){B.push("\r\n");
|
||||
if(K>0)for(var p=K;p--;)B.push("\t")}function i(p,x,E,I){p="";if(x=E.match(/ face\s*=\s*"\s*([^"]+)\s*"/i))p+="font-family:"+x[1]+";";if(x=E.match(/ size\s*=\s*"\s*(\d+)\s*"/i))p+="font-size:"+N[(x[1]>7?7:x[1]<1?1:x[1])-1].n+";";if(x=E.match(/ color\s*=\s*"\s*([^"]+)\s*"/i))p+="color:"+x[1]+";";if(E=E.match(/ style\s*=\s*"\s*([^"]+)\s*"/i))p+=E[1];if(p)I='<span style="'+p+'">'+I+"</span>";return I}var f=d("area,base,basefont,br,col,frame,hr,img,input,isindex,link,meta,param,embed"),k=d("address,applet,blockquote,button,center,dd,dir,div,dl,dt,fieldset,form,frameset,hr,iframe,ins,isindex,li,map,menu,noframes,noscript,object,ol,p,pre,script,table,tbody,td,tfoot,th,thead,tr,ul"),
|
||||
n=d("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"),q=d("colgroup,dd,dt,li,options,p,td,tfoot,th,thead,tr"),r=d("checked,compact,declare,defer,disabled,ismap,multiple,nohref,noresize,noshade,nowrap,readonly,selected"),s=d("script,style"),o={b:"strong",i:"em",s:"del",strike:"del"},t=/^<\??(\w+(?:\:\w+)?)((?:\s+[\w-\:]*(?:\s*=\s*(?:(?:"[^"]*")|(?:'[^']*')|[^>\s]+))?)*)\s*(\/?)>/,
|
||||
v=/^<\/(\w+(?:\:\w+)?)[^>]*>/,A=/([\w-(?:\:\w+)?]+)(?:\s*=\s*(?:(?:"((?:\\.|[^"])*)")|(?:'((?:\\.|[^'])*)')|([^>\s]+)))?/g,u=0,y=[],z=a,B=[],K=-1,da="body",ib;for(y.last=function(){return this[this.length-1]};z.length>0;)if(!y.last()||!s[y.last()]){u=0;if(z.substring(0,4)=="<!--"){u=z.indexOf("--\>");if(u!=-1){u+=3;l(z.substring(0,u))}}else if(z.substring(0,2)=="</"){if(match=z.match(v)){j(match[1]);u=match[0].length}}else if(z.charAt(0)=="<")if(match=z.match(t)){m(match[1],match[2],match[3]);u=match[0].length}if(u==
|
||||
0){u=z.indexOf("<");if(u==0)u=1;else if(u<0)u=z.length;l(b.domEncode(z.substring(0,u)))}z=z.substring(u)}else{z=z.replace(/^([\s\S]*?)<\/(style|script)>/i,function(p,x){l(x);return""});j(y.last())}j();a=B.join("");B=null;a=a.replace(/<(font)(\s+[^>]*?)?>(((?!<\1(\s+[^>]*?)?>)[\s\S])*?)<\/\1>/ig,i);a=a.replace(/<(font)(\s+[^>]*?)?>(((?!<\1(\s+[^>]*?)?>)[\s\S]|<\1(\s+[^>]*?)?>((?!<\1(\s+[^>]*?)?>)[\s\S])*?<\/\1>)*?)<\/\1>/ig,i);a=a.replace(/<(font)(\s+[^>]*?)?>(((?!<\1(\s+[^>]*?)?>)[\s\S]|<\1(\s+[^>]*?)?>((?!<\1(\s+[^>]*?)?>)[\s\S]|<\1(\s+[^>]*?)?>((?!<\1(\s+[^>]*?)?>)[\s\S])*?<\/\1>)*?<\/\1>)*?)<\/\1>/ig,
|
||||
i);a=a.replace(/^(\s*\r?\n)+|(\s*\r?\n)+$/g,"");return a=a.replace(/(\t*\r?\n)+/g,"\r\n")};this.toggleShowBlocktag=function(a){if(ka!==a){ka=!ka;a=e(w.body);if(ka){ca+=" showBlocktag";a.addClass("showBlocktag")}else{ca=ca.replace(" showBlocktag","");a.removeClass("showBlocktag")}}};this.toggleSource=function(a){if(H!==a){J.find("[name=Source]").toggleClass("xheEnabled").toggleClass("xheActive");var c=w.body,d=e(c),g,m,j="_xhe_cursor"+(new Date).getTime();a=0;if(H){g=b.getSource();d.find("#sourceCode").remove();
|
||||
d.removeAttr("scroll").attr("class","editMode"+ca);if(D)c.contentEditable="true";else w.designMode="On";if(oa){b._exec("inserthtml","-");e("#"+ua).show().focus().hide()}}else{b.pasteHTML(j,true);g=b.getSource(true);a=g.indexOf(j);if(!Xa)a=g.substring(0,a).replace(/\r/g,"").length;g=g.replace(j,"");if(D)c.contentEditable="false";else w.designMode="Off";d.attr("scroll","no").attr("class","sourceMode").html('<textarea id="sourceCode" wrap="soft" spellcheck="false" height="100%" />');m=e("#sourceCode",
|
||||
d).blur(b.getSource)[0]}H=!H;b.setSource(g);if(H){b.focus();if(m.setSelectionRange)m.setSelectionRange(a,a);else{m=m.createTextRange();m.move("character",a);m.select()}}else b.setCursorFirst(true);J.find("[name=Source]").toggleClass("xheEnabled");J.find(".xheButton").not("[name=Source],[name=Fullscreen],[name=About]").toggleClass("xheEnabled");setTimeout(Aa,300)}};this.toggleFullscreen=function(a){if(ia!==a){a=e("#"+ma).find(".xheLayout");var c=e("#"+ma);if(ia){a.attr("style",Ma);O.height(S-J.outerHeight());
|
||||
setTimeout(function(){e(window).scrollTop(La)},10)}else{La=e(window).scrollTop();Ma=a.attr("style");a.removeAttr("style");O.height("100%");setTimeout(Ca,100)}if(oa){e("#"+ua).show().focus().hide();setTimeout(b.focus,1)}ia=!ia;c.toggleClass("xhe_Fullscreen");e("html").toggleClass("xhe_Fullfix");J.find("[name=Fullscreen]").toggleClass("xheActive");setTimeout(Aa,300)}};this.showMenu=function(a,c){var d=e('<div class="xheMenu"></div>'),g=[];e.each(a,function(m,j){g.push('<a href="javascript:void(0);" title="'+
|
||||
(j.t?j.t:j.s)+'" v="'+j.v+'">'+j.s+"</a>")});d.append(g.join(""));d.click(function(m){c(e(m.target).closest("a").attr("v"));b.hidePanel();return false}).mousedown(W);b.showPanel(d)};this.showColor=function(a){var c=e('<div class="xheColor"></div>'),d=[],g=0;e.each(Za,function(m,j){if(g%7==0)d.push((g>0?"</div>":"")+"<div>");d.push('<a href="javascript:void(0);" xhev="'+j+'" title="'+j+'" style="background:'+j+'"></a>');g++});d.push("</div>");c.append(d.join(""));c.click(function(m){m=m.target;if(e.nodeName(m,
|
||||
"A")){a(e(m).attr("xhev"));b.hidePanel();return false}}).mousedown(W);b.showPanel(c)};this.showPastetext=function(){var a=e('<div>Use Ctrl+V on your keyboard to paste the text.</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>'),c=e("#xhePastetextValue",a);e("#xheSave",a).click(function(){b.loadBookmark();var d=c.val();d&&b.pasteText(d);b.hidePanel();
|
||||
return false});b.showDialog(a)};this.showLink=function(){var a=e('<div>Link URL: <input type="text" id="xheLinkHref" value="http://" class="xheText" /></div><div>Target: <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">Link Text:<input type="text" id="xheLinkText" value="" class="xheText" /></div><div style="text-align:right;"><input type="button" id="xheSave" value="OK" /></div>'),
|
||||
c=b.getParent("a"),d=e("#xheLinkText",a),g=e("#xheLinkHref",a),m=e("#xheLinkTarget",a),j=e("#xheSave",a),l=b.getSelect();if(c.length==1){g.val(V(c,"href"));m.attr("value",c.attr("target"))}else l==""&&d.val(b.settings.defLinkText).closest("div").show();b.settings.upLinkUrl&&b.uploadInit(g,b.settings.upLinkUrl,b.settings.upLinkExt);j.click(function(){var h=g.val();b.loadBookmark();if(h==""||c.length==0)b._exec("unlink");if(h!=""&&h!="http://"){var i=h.split(" "),f=m.val(),k=d.val();if(i.length>1){b._exec("unlink");
|
||||
l=b.getSelect();var n='<a href="xhe_tmpurl"',q=[];if(f!="")n+=' target="'+f+'"';n+=">xhe_tmptext</a>";k=l!=""?l:k?k:h;for(var r in i){h=i[r];if(h!=""){h=h.split("||");f=n;f=f.replace("xhe_tmpurl",h[0]);f=f.replace("xhe_tmptext",h[1]?h[1]:k);q.push(f)}}b.pasteHTML(q.join(" "))}else{h=i[0].split("||");k||(k=h[0]);k=h[1]?h[1]:l!=""?"":k?k:h[0];if(c.length==0){k?b.pasteHTML('<a href="#xhe_tmpurl">'+k+"</a>"):b._exec("createlink","#xhe_tmpurl");c=e('a[href$="#xhe_tmpurl"]',w)}V(c,"href",h[0]);f!=
|
||||
""?c.attr("target",f):c.removeAttr("target");k&&!Z&&c.text(k)}}b.hidePanel();return false});b.showDialog(a)};this.showImg=function(){var a=e('<div>Img URL: <input type="text" id="xheImgSrc" value="http://" class="xheText" /></div><div>Alt text: <input type="text" id="xheImgAlt" /></div><div>Alignment:<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>Dimension:<input type="text" id="xheImgWidth" style="width:40px;" /> x <input type="text" id="xheImgHeight" style="width:40px;" /></div><div>Border: <input type="text" id="xheImgBorder" style="width:40px;" /></div><div>Hspace: <input type="text" id="xheImgHspace" style="width:40px;" /> Vspace:<input type="text" id="xheImgVspace" style="width:40px;" /></div><div style="text-align:right;"><input type="button" id="xheSave" value="OK" /></div>'),
|
||||
c=b.getParent("img"),d=e("#xheImgSrc",a),g=e("#xheImgAlt",a),m=e("#xheImgAlign",a),j=e("#xheImgWidth",a),l=e("#xheImgHeight",a),h=e("#xheImgBorder",a),i=e("#xheImgVspace",a),f=e("#xheImgHspace",a),k=e("#xheSave",a);if(c.length==1){d.val(V(c,"src"));g.val(c.attr("alt"));m.val(c.attr("align"));j.val(c.attr("width"));l.val(c.attr("height"));h.val(c.attr("border"));var n=c.attr("vspace"),q=c.attr("hspace");i.val(n<=0?"":n);f.val(q<=0?"":q)}b.settings.upImgUrl&&b.uploadInit(d,b.settings.upImgUrl,b.settings.upImgExt);
|
||||
k.click(function(){b.loadBookmark();var r=d.val();if(r!=""&&r!="http://"){var s=r.split(" "),o=g.val(),t=m.val(),v=j.val(),A=l.val(),u=h.val(),y=i.val(),z=f.val();if(s.length>1){var B='<img src="xhe_tmpurl"',K=[];if(o!="")B+=' alt="'+o+'"';if(t!="")B+=' align="'+t+'"';if(v!="")B+=' width="'+v+'"';if(A!="")B+=' height="'+A+'"';if(u!="")B+=' border="'+u+'"';if(y!="")B+=' vspace="'+y+'"';if(z!="")B+=' hspace="'+z+'"';B+=" />";for(var da in s){r=s[da];if(r!=""){r=r.split("||");o=B;o=o.replace("xhe_tmpurl",
|
||||
r[0]);if(r[1])o='<a href="'+r[1]+'" target="_blank">'+o+"</a>";K.push(o)}}b.pasteHTML(K.join(" "))}else if(s.length==1){r=s[0];if(r!=""){r=r.split("||");if(c.length==0){b.pasteHTML('<img src="'+r[0]+'#xhe_tmpurl" />');c=e('img[src$="#xhe_tmpurl"]',w)}V(c,"src",r[0]);o!=""&&c.attr("alt",o);t!=""?c.attr("align",t):c.removeAttr("align");v!=""?c.attr("width",v):c.removeAttr("width");A!=""?c.attr("height",A):c.removeAttr("height");u!=""?c.attr("border",u):c.removeAttr("border");y!=""?c.attr("vspace",
|
||||
y):c.removeAttr("vspace");z!=""?c.attr("hspace",z):c.removeAttr("hspace");if(r[1]){s=c.parent("a");if(s.length==0){c.wrap("<a></a>");s=c.parent("a")}V(s,"href",r[1]);s.attr("target","_blank")}}}}else c.length==1&&c.remove();b.hidePanel();return false});b.showDialog(a)};this.showEmbed=function(a,c,d,g,m,j,l){c=e(c);var h=b.getParent('embed[type="'+d+'"],embed[classid="'+g+'"]'),i=e("#xhe"+a+"Src",c),f=e("#xhe"+a+"Width",c),k=e("#xhe"+a+"Height",c);a=e("#xheSave",c);j&&b.uploadInit(i,j,l);b.showDialog(c);
|
||||
if(h.length==1){i.val(V(h,"src"));f.val(h.attr("width"));k.val(h.attr("height"))}a.click(function(){b.loadBookmark();var n=i.val();if(n!=""&&n!="http://"){var q=f.val(),r=k.val(),s=/^[0-9]+$/;s.test(q)||(q=412);s.test(r)||(r=300);var o='<embed type="'+d+'" classid="'+g+'" src="xhe_tmpurl"'+m;s=n.split(" ");if(s.length>1){o=o+"";var t,v=[];o+=' width="xhe_width" height="xhe_height" />';for(var A in s){n=s[A].split("||");t=o;t=t.replace("xhe_tmpurl",n[0]);t=t.replace("xhe_width",n[1]?n[1]:q);t=t.replace("xhe_height",
|
||||
n[2]?n[2]:r);n!=""&&v.push(t)}b.pasteHTML(v.join(" "))}else if(s.length==1){n=s[0].split("||");if(h.length==0){b.pasteHTML(o.replace("xhe_tmpurl",n[0]+"#xhe_tmpurl")+" />");h=e('embed[src$="#xhe_tmpurl"]',w)}V(h,"src",n[0]);h.attr("width",n[1]?n[1]:q);h.attr("height",n[2]?n[2]:r)}}else h.length==1&&h.remove();b.hidePanel();return false})};this.showEmot=function(a){var c=e('<div class="xheEmot"></div>');a=a?a:Ha?Ha:"default";var d=va[a],g=Sa+a+"/",m=0,j=[],l="";l=d.width;var h=d.height,i=d.line,
|
||||
f=d.count;d=d.list;if(f)for(d=1;d<=f;d++){m++;j.push('<a href="javascript:void(0);" style="background-image:url('+g+d+'.gif);" emot="'+a+","+d+'" xhev=""> </a>');m%i==0&&j.push("<br />")}else e.each(d,function(q,r){m++;j.push('<a href="javascript:void(0);" style="background-image:url('+g+q+'.gif);" emot="'+a+","+q+'" title="'+r+'" xhev="'+r+'"> </a>');m%i==0&&j.push("<br />")});f=i*(l+12);d=f*0.75;if(Math.ceil(m/i)*(h+12)<=d)d="";l=e("<style>"+(d?".xheEmot div{width:"+(f+20)+"px;height:"+
|
||||
d+"px;}":"")+".xheEmot div a{width:"+l+"px;height:"+h+"px;}</style><div>"+j.join("")+"</div>").click(function(q){q=q.target;var r=e(q);if(e.nodeName(q,"A")){b.pasteHTML('<img emot="'+r.attr("emot")+'" alt="'+r.attr("xhev")+'">');b.hidePanel();return false}}).mousedown(W);c.append(l);var k=0,n=["<ul>"];e.each(va,function(q,r){k++;n.push("<li"+(a==q?' class="cur"':"")+'><a href="javascript:void(0);" group="'+q+'">'+r.name+"</a></li>")});if(k>1){n.push('</ul><br style="clear:both;" />');l=e(n.join("")).click(function(q){Ha=
|
||||
e(q.target).attr("group");b.exec("Emot");return false}).mousedown(W);c.append(l)}b.showPanel(c)};this.showTable=function(){var a=e('<div>Rows&Cols: <input type="text" id="xheTableRows" style="width:40px;" value="3" /> x <input type="text" id="xheTableColumns" style="width:40px;" value="2" /></div><div>Headers: <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>Dimension: <input type="text" id="xheTableWidth" style="width:40px;" value="200" /> x <input type="text" id="xheTableHeight" style="width:40px;" value="" /></div><div>Border: <input type="text" id="xheTableBorder" style="width:40px;" value="1" /></div><div>CellSpacing:<input type="text" id="xheTableCellSpacing" style="width:40px;" value="1" /> CellPadding:<input type="text" id="xheTableCellPadding" style="width:40px;" value="1" /></div><div>Align: <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>Caption: <input type="text" id="xheTableCaption" /></div><div style="text-align:right;"><input type="button" id="xheSave" value="OK" /></div>'),
|
||||
c=e("#xheTableRows",a),d=e("#xheTableColumns",a),g=e("#xheTableHeaders",a),m=e("#xheTableWidth",a),j=e("#xheTableHeight",a),l=e("#xheTableBorder",a),h=e("#xheTableCellSpacing",a),i=e("#xheTableCellPadding",a),f=e("#xheTableAlign",a),k=e("#xheTableCaption",a);e("#xheSave",a).click(function(){b.loadBookmark();var n=k.val(),q=l.val(),r=c.val(),s=d.val(),o=g.val(),t=m.val(),v=j.val(),A=h.val(),u=i.val(),y=f.val();q="<table"+(q!=""?' border="'+q+'"':"")+(t!=""?' width="'+t+'"':"")+(v!=""?' width="'+v+
|
||||
'"':"")+(A!=""?' cellspacing="'+A+'"':"")+(u!=""?' cellpadding="'+u+'"':"")+(y!=""?' align="'+y+'"':"")+">";if(n!="")q+="<caption>"+n+"</caption>";if(o=="row"||o=="both"){q+="<tr>";for(n=0;n<s;n++)q+='<th scope="col"> </th>';q+="</tr>";r--}q+="<tbody>";for(n=0;n<r;n++){q+="<tr>";for(t=0;t<s;t++)q+=t==0&&(o=="col"||o=="both")?'<th scope="row"> </th>':"<td> </td>";q+="</tr>"}q+="</tbody></table>";b.pasteHTML(q);b.hidePanel();return false});b.showDialog(a)};this.showAbout=function(){var a=
|
||||
e('<div style="font:12px Arial;width:245px;word-wrap:break-word;word-break:break-all;"><p><span style="font-size:20px;color:#1997DF;">xhEditor</span><br />v1.0.0 Final (build 100701)</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 \u00a9 <a href="http://xheditor.com/" target="_blank">xhEditor.com</a>. All rights reserved.</p></div>');b.showDialog(a)};
|
||||
this.addShortcuts=function(a,c){a=a.toLowerCase();if(ja[a]==undefined)ja[a]=[];ja[a].push(c)};this.delShortcuts=function(a){delete ja[a]};this.uploadInit=function(a,c,d){function g(){a.closest(".xheDialog").bind("dragenter dragover",W).bind("drop",function(o){o=o.originalEvent.dataTransfer;var t;if(n&&o&&(t=o.files)&&t.length>0)m(t);return false})}function m(o){s=[];var t,v,A=e('<div style="padding:22px 0;text-align:center;line-height:30px;">File uploading,please wait...<br /></div>'),u='<img src="'+
|
||||
Ga+'img/loading.gif">';if(!n||o.nodeType&&!((v=o.files)&&v[0])){if(!j(o.value))return;A.append(u);t=new b.html4Upload(o,c,l)}else{v||(v=o);var y=v.length;if(y>q){alert("Please do not upload more then "+q+" files.");return}for(o=0;o<y;o++)if(!j(v[o].fileName))return;var z=e('<div class="xheProgress"><div><span>0%</span></div></div>');A.append(z);t=new b.html5Upload(i,v,c,l,function(B){if(B.loaded>=0){var K=Math.round(B.loaded*100/B.total)+"%";e("div",z).css("width",K);e("span",z).text(K+" ( "+Ja(B.loaded)+
|
||||
" / "+Ja(B.total)+" )")}else z.replaceWith(u)})}T=false;b.showModal("File uploading(Esc cancel)",A,320,150,function(){T=true;t.remove()});t.start()}function j(o){if(d=="*"||o.match(RegExp(".("+d.replace(/,/g,"|")+")$","i")))return true;else{alert("Upload file extension required for this:"+d);return false}}function l(o,t){var v=Object,A=false,u=b.settings.onUpload;try{v=eval("("+o+")")}catch(y){}if(v.err==undefined||v.msg==undefined)alert(c+" upload interface error!\r\n\r\nreturn error:\r\n\r\n"+o);
|
||||
else if(v.err)alert(v.err);else{s.push(v.msg);A=true}if(!A||t)b.removeModal();if(t&&A){h(s);u&&u(s)}return A}function h(o){if($(o,"string"))o=[o];var t=false,v,A=o.length,u,y=[];for(v=0;v<A;v++){u=o[v];u=$(u,"string")?u:u.url;if(u.substr(0,1)=="!"){t=true;u=u.substr(1)}y.push(u)}a.val(y.join(" "));t&&a.closest(".xheDialog").find("#xheSave").click()}var i="filedata",f=e('<span class="xheUpload"><input type="text" style="visibility:hidden;" tabindex="-1" /><input type="button" value="'+b.settings.upBtnText+
|
||||
'" class="xheBtn" tabindex="-1" /></span>'),k=e(".xheBtn",f),n=b.settings.html5Upload,q=n?b.settings.upMultiple:1;a.after(f);k.before(a);c=c.replace(/{editorRoot}/ig,U);if(c.substr(0,1)=="!")k.click(function(){T=false;b.showIframeModal("Upload file",c.substr(1),h,null,null,function(){T=true})});else{f.append('<input type="file"'+(q>1?' multiple=""':"")+' class="xheFile" size="13" name="'+i+'" tabindex="-1" />');var r=e(".xheFile",f),s=[];r.change(function(){m(r[0])});setTimeout(g,10)}};this.html4Upload=
|
||||
function(a,c,d){var g="jUploadFrame"+(new Date).getTime(),m=this,j=e('<iframe name="'+g+'" class="xheHideArea" />').appendTo("body"),l=e('<form action="'+c+'" target="'+g+'" method="post" enctype="multipart/form-data" class="xheHideArea"></form>').appendTo("body"),h=e(a),i=h.clone().attr("disabled","true");h.before(i).appendTo(l);this.remove=function(){if(m!=null){i.before(h).remove();j.remove();l.remove();m=null}};this.onLoad=function(){d(e(j[0].contentWindow.document.body).text(),true)};this.start=
|
||||
function(){l.submit();j.load(m.onLoad)};return this};this.html5Upload=function(a,c,d,g,m){function j(s,o,t,v){h=new XMLHttpRequest;upload=h.upload;h.onreadystatechange=function(){h.readyState==4&&t(h.responseText)};if(upload)upload.onprogress=function(A){v(A.loaded)};else v(-1);h.open("POST",o);h.setRequestHeader("Content-Type","application/octet-stream");h.setRequestHeader("Content-Disposition",'attachment; name="'+a+'"; filename="'+s.fileName+'"');h.sendAsBinary?h.sendAsBinary(s.getAsBinary()):
|
||||
h.send(s)}function l(s){m&&m({loaded:k+s,total:n})}for(var h,i=0,f=c.length,k=0,n=0,q=this,r=0;r<f;r++)n+=c[r].fileSize;this.remove=function(){if(h){h.abort();h=null}};this.uploadNext=function(s){if(s){k+=c[i-1].fileSize;l(0)}if((!s||s&&g(s,i==f)==true)&&i<f)j(c[i++],d,q.uploadNext,function(o){l(o)})};this.start=function(){q.uploadNext()}};this.showIframeModal=function(a,c,d,g,m,j){c=e('<iframe frameborder="0" src="'+c.replace(/{editorRoot}/ig,U)+'" style="width:100%;height:100%;display:none;" /><div class="xheModalIfmWait"></div>');
|
||||
var l=e(c[0]),h=e(c[1]);b.showModal(a,c,g,m,j);l.load(function(){var i=l[0].contentWindow,f=e(i.document);i.callback=function(k){b.removeModal();d(k)};f.keydown(b.modalEscCheck);l.show();h.remove()})};this.showModal=function(a,c,d,g,m){if(e(".xheModal").length==1)return false;var j,l,h,i,f;d=d?d:b.settings.modalWidth;g=g?g:b.settings.modalHeight;i=b.settings.layerShadow;j=e('<div class="xheModal" style="width:'+(d-1)+"px;height:"+g+"px;margin-left:-"+Math.ceil(d/2)+"px;"+(D&&wa<=7?"":"margin-top:-"+
|
||||
Math.ceil(g/2)+"px")+'">'+(b.settings.modalTitle?'<div class="xheModalTitle"><span class="xheModalClose" title="Close (Esc)"></span>'+a+"</div>":"")+'<div class="xheModalContent"></div></div>').appendTo("body");h=e('<div class="xheModalOverlay"></div>').appendTo("body");if(i>0)l=e('<div class="xheModalShadow" style="width:'+j.outerWidth()+"px;height:"+j.outerHeight()+"px;margin-left:-"+(Math.ceil(d/2)-i-2)+"px;"+(D&&wa<=7?"":"margin-top:-"+(Math.ceil(g/2)-i-2)+"px")+'"></div>').appendTo("body");e(".xheModalContent",
|
||||
j).css("height",g-(b.settings.modalTitle?e(".xheModalTitle").outerHeight():0)).html(c);if(D&&wa==6)f=e("select:visible").css("visibility","hidden");this.removeModal=function(){f&&f.css("visibility","visible");e(document).unbind("keydown",b.modalEscCheck);j.remove();i>0&&l.remove();h.remove();m&&m()};this.modalEscCheck=function(k){if(k.which==27){b.removeModal();return false}};e(document).keydown(b.modalEscCheck);e(".xheModalClose",j).click(b.removeModal);h.show();i>0&&l.show();j.show()};this.showDialog=
|
||||
function(a){var c=e('<div class="xheDialog"></div>');a=e(a);var d=e("#xheSave",a);if(d.length==1){a.find("input[type=text],select").keypress(function(j){if(j.which==13){d.click();return false}});a.find("textarea").keydown(function(j){if(j.ctrlKey&&j.which==13){d.click();return false}});d.after(' <input type="button" id="xheCancel" value="Cancel" />');e("#xheCancel",a).click(b.hidePanel);if(!b.settings.clickCancelDialog){pa=false;var g=e('<div class="xheFixCancel"></div>').appendTo("body").mousedown(W),
|
||||
m=O.offset();g.css({left:m.left,top:m.top,width:O.outerWidth(),height:O.outerHeight()})}c.mousedown(function(){la=true})}c.append(a);b.showPanel(c);D||setTimeout(function(){c.find("input[type=text],textarea").filter(":visible").filter(function(){return e(this).css("visibility")!="hidden"}).eq(0).focus()},10)};this.showPanel=function(a){if(!M.target)return false;L.empty().append(a).css("left",-999).css("top",-999);ga=e(M.target).closest("a").addClass("xheActive");var c=ga.offset();a=c.left;c=c.top;
|
||||
c+=ga.outerHeight()-1;fa.css({left:a+1,top:c}).show();if(a+L.outerWidth()>document.body.clientWidth)a-=L.outerWidth()-ga.outerWidth();var d=b.settings.layerShadow;d>0&&ea.css({left:a+d,top:c+d,width:L.outerWidth(),height:L.outerHeight()}).show();L.css("left",a).css("top",c).show();Fa=T=true};this.hidePanel=function(){if(T){ga.removeClass("xheActive");ea.hide();fa.hide();L.hide();T=false;if(!pa){e(".xheFixCancel").remove();pa=true}Fa=la=false;X=null}};this.exec=function(a){b.hidePanel();b.saveBookmark();
|
||||
var c=ha[a];if(!c)return false;if(M==null){M={};var d=J.find(".xheButton[name="+a+"]");if(d.length==1)M.target=d}if(c.e)c.e.call(b);else{a=a.toLowerCase();switch(a){case "cut":try{w.execCommand(a);if(!w.queryCommandSupported(a))throw"Error";}catch(g){alert("Currently not supported by your browser, use keyboard shortcuts(Ctrl+X) instead.")}break;case "copy":try{w.execCommand(a);if(!w.queryCommandSupported(a))throw"Error";}catch(m){alert("Currently not supported by your browser, use keyboard shortcuts(Ctrl+C) instead.")}break;
|
||||
case "paste":try{w.execCommand(a);if(!w.queryCommandSupported(a))throw"Error";}catch(j){alert("Currently not supported by your browser, use keyboard shortcuts(Ctrl+V) instead.")}break;case "pastetext":window.clipboardData?b.pasteText(window.clipboardData.getData("Text",true)):b.showPastetext();break;case "blocktag":var l=[];e.each($a,function(f,k){l.push({s:"<"+k.n+">"+k.t+"</"+k.n+">",v:"<"+k.n+">",t:k.t})});b.showMenu(l,function(f){b._exec("formatblock",f)});break;case "fontface":var h=[];e.each(ab,
|
||||
function(f,k){k.c=k.c?k.c:k.n;h.push({s:'<span style="font-family:'+k.c+'">'+k.n+"</span>",v:k.c,t:k.n})});b.showMenu(h,function(f){b._exec("fontname",f)});break;case "fontsize":var i=[];e.each(N,function(f,k){i.push({s:'<span style="font-size:'+k.s+';">'+k.t+"("+k.s+")</span>",v:f+1,t:k.t})});b.showMenu(i,function(f){b._exec("fontsize",f)});break;case "fontcolor":b.showColor(function(f){b._exec("forecolor",f)});break;case "backcolor":b.showColor(function(f){if(D)b._exec("backcolor",f);else{za(true);
|
||||
b._exec("hilitecolor",f);za(false)}});break;case "align":b.showMenu(bb,function(f){b._exec(f)});break;case "list":b.showMenu(cb,function(f){b._exec(f)});break;case "link":b.showLink();break;case "img":b.showImg();break;case "flash":b.showEmbed("Flash",'<div>Flash URL:<input type="text" id="xheFlashSrc" value="http://" class="xheText" /></div><div>Dimension:<input type="text" id="xheFlashWidth" style="width:40px;" value="480" /> x <input type="text" id="xheFlashHeight" style="width:40px;" value="400" /></div><div style="text-align:right;"><input type="button" id="xheSave" value="OK" /></div>',
|
||||
"application/x-shockwave-flash","clsid:d27cdb6e-ae6d-11cf-96b8-4445535400000",' wmode="opaque" quality="high" menu="false" play="true" loop="true" allowfullscreen="true"',b.settings.upFlashUrl,b.settings.upFlashExt);break;case "media":b.showEmbed("Media",'<div>Media URL:<input type="text" id="xheMediaSrc" value="http://" class="xheText" /></div><div>Dimension:<input type="text" id="xheMediaWidth" style="width:40px;" value="480" /> x <input type="text" id="xheMediaHeight" style="width:40px;" value="400" /></div><div style="text-align:right;"><input type="button" id="xheSave" value="OK" /></div>',
|
||||
"application/x-mplayer2","clsid:6bf52a52-394a-11d3-b153-00c04f79faa6",' enablecontextmenu="false" autostart="false"',b.settings.upMediaUrl,b.settings.upMediaExt);break;case "emot":b.showEmot();break;case "table":b.showTable();break;case "source":b.toggleSource();break;case "print":R.print();break;case "fullscreen":b.toggleFullscreen();break;case "about":b.showAbout();break;default:b._exec(a);break}}M=null};this._exec=function(a,c,d){d||b.focus();return c!=undefined?w.execCommand(a,false,c):w.execCommand(a,
|
||||
false,null)}};e(function(){e.fn.oldVal=e.fn.val;e.fn.val=function(C){var F=this,G;if(C===undefined)return this[0]&&(G=this[0].xheditor)?G.getSource():F.oldVal(C);return this.each(function(){(G=this.xheditor)?G.setSource(C):F.oldVal(C)})};e("textarea").each(function(){var C=e(this),F=C.attr("class").match(/(?:^|\s)xheditor(?:\-(m?full|simple|mini))?(?:\s|$)/i);if(F)C.xheditor(F[1]?{tools:F[1]}:null)})})})(jQuery);
|
||||
95
trunk/www/js/jquery/xheditor/xheditor-zh-cn.min.js
vendored
Normal file
@@ -0,0 +1,95 @@
|
||||
(function(e){if(e.xheditor)return false;e.fn.xheditor=function(C){var F=[];this.each(function(){if(e.nodeName(this,"TEXTAREA"))if(C===false){if(this.xheditor){this.xheditor.remove();this.xheditor=null}}else if(!this.xheditor){var G=/({.*})/.exec(e(this).attr("class"));if(G){try{G=eval("("+G[1]+")")}catch(Q){}C=e.extend({},G,C)}G=new e.xheditor(this,C);if(G.init()){this.xheditor=G;F.push(G)}}});if(F.length==0)F=false;if(F.length==1)F=F[0];return F};var Y=0,wa=e.browser.version,D=e.browser.msie,oa=
|
||||
e.browser.mozilla,Z=e.browser.safari,Xa=e.browser.opera,T=false,pa=true,L,ea,fa,ga,xa,U;e("script[src*=xheditor]").each(function(){var C=this.src;if(C.match(/xheditor[^\/]*\.js/i)){U=C.replace(/[\?#].*$/,"").replace(/(^|[\/\\])[^\/]*$/,"$1");return false}});var Ya={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"},Za=["#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"],$a=[{n:"p",t:"\u666e\u901a\u6bb5\u843d"},{n:"h1",t:"\u6807\u98981"},{n:"h2",t:"\u6807\u98982"},{n:"h3",t:"\u6807\u98983"},{n:"h4",t:"\u6807\u98984"},{n:"h5",t:"\u6807\u98985"},{n:"h6",t:"\u6807\u98986"},{n:"pre",t:"\u5df2\u7f16\u6392\u683c\u5f0f"},
|
||||
{n:"address",t:"\u5730\u5740"}],ab=[{n:"\u5b8b\u4f53",c:"SimSun"},{n:"\u4eff\u5b8b\u4f53",c:"FangSong_GB2312"},{n:"\u9ed1\u4f53",c:"SimHei"},{n:"\u6977\u4f53",c:"KaiTi_GB2312"},{n:"\u5fae\u8f6f\u96c5\u9ed1",c:"Microsoft YaHei"},{n:"Arial"},{n:"Arial Narrow"},{n:"Arial Black"},{n:"Comic Sans MS"},{n:"Courier New"},{n:"System"},{n:"Times New Roman"},{n:"Tahoma"},{n:"Verdana"}],N=[{n:"xx-small",wkn:"x-small",s:"8pt",t:"\u6781\u5c0f"},{n:"x-small",wkn:"small",s:"10pt",t:"\u7279\u5c0f"},{n:"small",wkn:"medium",
|
||||
s:"12pt",t:"\u5c0f"},{n:"medium",wkn:"large",s:"14pt",t:"\u4e2d"},{n:"large",wkn:"x-large",s:"18pt",t:"\u5927"},{n:"x-large",wkn:"xx-large",s:"24pt",t:"\u7279\u5927"},{n:"xx-large",wkn:"-webkit-xxx-large",s:"36pt",t:"\u6781\u5927"}],bb=[{s:"\u5de6\u5bf9\u9f50",v:"justifyleft"},{s:"\u5c45\u4e2d",v:"justifycenter"},{s:"\u53f3\u5bf9\u9f50",v:"justifyright"},{s:"\u4e24\u7aef\u5bf9\u9f50",v:"justifyfull"}],cb=[{s:"\u6570\u5b57\u5217\u8868",v:"insertOrderedList"},{s:"\u7b26\u53f7\u5217\u8868",v:"insertUnorderedList"}],
|
||||
db={"default":{name:"\u9ed8\u8ba4",width:24,height:24,line:4,list:{smile:"\u5fae\u7b11",tongue:"\u5410\u820c\u5934",laugh:"\u5927\u7b11",sad:"\u96be\u8fc7",wail:"\u5927\u54ed",mad:"\u751f\u6c14",angry:"\u53d1\u706b",ohmy:"\u60ca\u8bb6",awkward:"\u5c34\u5c2c",envy:"\u7fa1\u6155",proud:"\u5f97\u610f",
|
||||
despise:"\u9119\u89c6"}}},ha={Cut:{t:"\u526a\u5207 (Ctrl+X)"},Copy:{t:"\u590d\u5236 (Ctrl+C)"},Paste:{t:"\u7c98\u8d34 (Ctrl+V)"},Pastetext:{t:"\u7c98\u8d34\u6587\u672c",h:D?0:1},Blocktag:{t:"\u6bb5\u843d\u6807\u7b7e",h:1},Fontface:{t:"\u5b57\u4f53",h:1},FontSize:{t:"\u5b57\u4f53\u5927\u5c0f",h:1},Bold:{t:"\u52a0\u7c97 (Ctrl+B)",s:"Ctrl+B"},Italic:{t:"\u659c\u4f53 (Ctrl+I)",
|
||||
s:"Ctrl+I"},Underline:{t:"\u4e0b\u5212\u7ebf (Ctrl+U)",s:"Ctrl+U"},Strikethrough:{t:"\u5220\u9664\u7ebf (Ctrl+S)",s:"Ctrl+S"},FontColor:{t:"\u5b57\u4f53\u989c\u8272",h:1},BackColor:{t:"\u80cc\u666f\u989c\u8272",h:1},SelectAll:{t:"\u5168\u9009 (Ctrl+A)"},Removeformat:{t:"\u5220\u9664\u6587\u5b57\u683c\u5f0f"},Align:{t:"\u5bf9\u9f50",h:1},List:{t:"\u5217\u8868",h:1},Outdent:{t:"\u51cf\u5c11\u7f29\u8fdb (Shift+Tab)",s:"Shift+Tab"},Indent:{t:"\u589e\u52a0\u7f29\u8fdb (Tab)",s:"Tab"},Link:{t:"\u8d85\u94fe\u63a5 (Ctrl+K)",
|
||||
s:"Ctrl+K",h:1},Unlink:{t:"\u53d6\u6d88\u8d85\u94fe\u63a5"},Img:{t:"\u56fe\u7247",h:1},Flash:{t:"Flash\u52a8\u753b",h:1},Media:{t:"\u591a\u5a92\u4f53\u6587\u4ef6",h:1},Emot:{t:"\u8868\u60c5",s:"ctrl+e",h:1},Table:{t:"\u8868\u683c",h:1},Source:{t:"\u6e90\u4ee3\u7801"},Print:{t:"\u6253\u5370 (Ctrl+P)",s:"Ctrl+P"},Fullscreen:{t:"\u5168\u5c4f\u7f16\u8f91 (Esc)",s:"Esc"},About:{t:"\u5173\u4e8e xhEditor"}},ya={mini:"Bold,Italic,Underline,Strikethrough,Separator,Align,List,Separator,Link,Img,About",simple:"Blocktag,Fontface,FontSize,Bold,Italic,Underline,Strikethrough,FontColor,BackColor,Separator,Align,List,Outdent,Indent,Separator,Link,Img,Emot,About",
|
||||
full:"Cut,Copy,Paste,Pastetext,Separator,Blocktag,Fontface,FontSize,Bold,Italic,Underline,Strikethrough,FontColor,BackColor,SelectAll,Removeformat,Separator,Align,List,Outdent,Indent,Separator,Link,Unlink,Img,Flash,Media,Emot,Table,Separator,Source,Print,Fullscreen"};ya.mfull=ya.full.replace(/Separator(,Align)/i,"BtnBr$1");e.xheditor=function(C,F){function G(){setTimeout(b.setSource,10)}function Q(){b.getSource()}function eb(){if(D&&!H){var a;a=xa[0].contentWindow.document.body;a.innerHTML=
|
||||
"";a.createTextRange().execCommand("Paste");a=a.innerHTML;if(!a.match(/mso-|MsoNormal/i))return true;if(a.indexOf(" ")==0)a=a.substring(6);a=b.cleanHTML(a);a=b.formatXHTML(a);a=b.cleanWord(a);b.pasteHTML(a);return false}}function za(a){try{b._exec("styleWithCSS",a,true)}catch(c){try{b._exec("useCSS",!a,true)}catch(d){}}}function Aa(){if(Ba&&!H){za(false);try{b._exec("enableObjectResizing",true,true)}catch(a){}if(D)try{b._exec("BackgroundImageCache",true,true)}catch(c){}}}function fb(a){if(H||
|
||||
a.which!=13||a.shiftKey||a.ctrlKey||a.altKey)return true;a=b.getParent("p,h1,h2,h3,h4,h5,h6,pre,address,div,li");if(a.is("li"))return true;if(b.settings.forcePtag)a.length==0&&b._exec("formatblock","<p>");else{b.pasteHTML("<br />");return false}}function Ca(){if(!oa&&!Z){ia&&O.height("100%").css("height",O.outerHeight()-J.outerHeight());D&&J.hide().show()}}function gb(a){a=a.target;if(a.tagName.match(/(img|embed)/i)){var c=b.getSel(),d=b.getRng();d.selectNode(a);c.removeAllRanges();c.addRange(d)}}
|
||||
function V(a,c,d){if(!c)return false;var g="_xhe_"+c;d&&a.attr(c,d).removeAttr(g).attr(g,d);return a.attr(g)||a.attr(c)}function Ia(){pa&&b.hidePanel()}function hb(a){if(H)return true;var c=a.which,d=Ya[c];c=d?d:String.fromCharCode(c).toLowerCase();sKey="";sKey+=a.ctrlKey?"ctrl+":"";sKey+=a.altKey?"alt+":"";sKey+=a.shiftKey?"shift+":"";sKey+=c;a=ja[sKey];var g;for(g in a){g=a[g];if(e.isFunction(g)){if(g.call(b)===false)return false}else{b.exec(g);return false}}}function $(a,c){var d=typeof a;if(!c)return d!=
|
||||
"undefined";if(c=="array"&&a.hasOwnProperty&&a instanceof Array)return true;return d==c}function Da(a,c){var d=location.protocol,g=location.hostname,m=location.port,j=location.pathname.replace(/\\/g,"/").replace(/[^\/]+$/i,"");m=m==""?"80":m;a=e.trim(a);if(d=="file:")c="abs";if(c!="abs")a=a.replace(RegExp(d+"\\/\\/"+g.replace(/\./g,"\\.")+"(?::"+m+")"+(m=="80"?"?":"")+"(/|$)","i"),"/");if(c=="rel")a=a.replace(RegExp("^"+j.replace(/([\/\.\+\[\]\(\)])/g,"\\$1"),"i"),"");if(c!="rel")a.match(/^((https?|file):\/\/|\/)/i)||
|
||||
(a=j+a);if(c=="abs")a.match(/(https?|file):\/\//i)||(a=d+"//"+location.host+a);return a}function Ja(a){var c=Math.floor(Math.log(a)/Math.log(1024));return(a/Math.pow(1024,Math.floor(c))).toFixed(2)+["Byte","KB","MB","GB","TB","PB"][c]}function W(){return false}var b=this,P=e(C),Ka=P.closest("form"),J,O,R,qa,w,ra,aa,Ba=false,H=false,ia=false,La,ka=false,Ma="",M=null,Ea,la=false,Fa=false,ba=null,X=null,S=0;this.settings=e.extend({},{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:"\u70b9\u51fb\u6253\u5f00\u94fe\u63a5",layerShadow:3,emotMark:false,upBtnText:"\u4e0a\u4f20",wordDeepClean:true,hoverExecDelay:100,html5Upload:true,upMultiple:99},F);var sa=b.settings.plugins,ta=[];if(sa){ha=e.extend({},ha,sa);e.each(sa,function(a){ta.push(a)});
|
||||
ta=ta.join(",")}if(b.settings.tools.match(/^\s*(m?full|simple|mini)\s*$/i)){var Na=ya[e.trim(b.settings.tools)];b.settings.tools=b.settings.tools.match(/m?full/i)&&sa?Na.replace("Table","Table,"+ta):Na}b.settings.tools.match(/(^|,)\s*About\s*(,|$)/i)||(b.settings.tools+=",About");b.settings.tools=b.settings.tools.split(",");U=Da(U,"abs");var Oa="xheCSS_"+b.settings.skin,ma="xhe"+Y+"_container",Pa="xhe"+Y+"_Tool",Qa="xhe"+Y+"_iframearea",Ra="xhe"+Y+"_iframe",ua="xhe"+Y+"_fixffcursor",ca="",Ga=U+"xheditor_skin/"+
|
||||
b.settings.skin+"/",va=db,Sa=Da(U,"rel")+"xheditor_emot/",Ha="";va=e.extend({},va,b.settings.emots);if(ka=b.settings.showBlocktag)ca+=" showBlocktag";var ja=[];this.init=function(){e("#"+Oa).length==0&&e("head").append('<link id="'+Oa+'" rel="stylesheet" type="text/css" href="'+Ga+'ui.css" />');var a=b.settings.width||C.style.width||P.outerWidth();S=b.settings.height||C.style.height||P.outerHeight();if($(S,"string"))S=S.replace(/[^\d]+/g,"");if(a<=0||S<=0){alert("\u5f53\u524dtextarea\u5904\u4e8e\u9690\u85cf\u72b6\u6001\uff0c\u8bf7\u5c06\u4e4b\u663e\u793a\u540e\u518d\u521d\u59cb\u5316xhEditor\uff0c\u6216\u8005\u76f4\u63a5\u8bbe\u7f6etextarea\u7684width\u548cheight\u6837\u5f0f");
|
||||
return false}if(/^[0-9\.]+$/i.test(""+a))a+="px";var c=['<span class="xheGStart"/>'],d,g,m=/Separator|BtnBr/i;e.each(b.settings.tools,function(i,f){d=ha[f];f.match(m)&&c.push('<span class="xheGEnd"/>');if(f=="Separator")c.push('<span class="xheSeparator"/>');else if(f=="BtnBr")c.push("<br />");else{g=d.c?d.c:"xheIcon xheBtn"+f;c.push('<span><a href="javascript:void(0);" title="'+d.t+'" name="'+f+'" class="xheButton xheEnabled" tabindex="-1"><span class="'+g+'" unselectable="on" /></a></span>');d.s&&
|
||||
b.addShortcuts(d.s,f)}f.match(m)&&c.push('<span class="xheGStart"/>')});c.push('<span class="xheGEnd"/><br />');P.after(e('<input type="text" id="'+ua+'" style="position:absolute;display:none;" /><span id="'+ma+'" class="xhe_'+b.settings.skin+'" style="display:none"><table cellspacing="0" cellpadding="0" class="xheLayout" style="width:'+a+";height:"+S+'px;"><tbody><tr><td id="'+Pa+'" class="xheTool" unselectable="on" style="height:1px;"></td></tr><tr><td id="'+Qa+'" class="xheIframeArea"><iframe frameborder="0" id="'+
|
||||
Ra+'" src="javascript:;" style="width:100%;"></iframe></td></tr></tbody></table></span>'));J=e("#"+Pa);O=e("#"+Qa);a='<html><head><base /><meta content="text/html; charset=UTF-8" http-equiv="Content-Type"/><link rel="stylesheet" href="'+Ga+'iframe.css"/>';var j=b.settings.loadCSS;if(j)if($(j,"array"))for(var l in j)a+='<link rel="stylesheet" href="'+j[l]+'"/>';else a+=j.match(/\s*<style(\s+[^>]*?)?>[\s\S]+?<\/style>\s*/i)?j:'<link rel="stylesheet" href="'+j+'"/>';a+='</head><body spellcheck="false" dir="ltr" class="editMode'+
|
||||
ca+'"></body></html>';b.win=R=e("#"+Ra)[0].contentWindow;qa=e(R);try{this.doc=w=R.document;ra=e(w);w.open();w.write(a);w.close();if(D)w.body.contentEditable="true";else w.designMode="On"}catch(h){}setTimeout(Aa,300);b.setSource();R.setInterval=null;J.append(c.join("")).bind("mousedown contextmenu",W).click(function(i){var f=e(i.target).closest("a");if(f.is(".xheEnabled")){M=i;b.exec(f.attr("name"))}return false});J.find(".xheButton").hover(function(i){var f=e(this),k=b.settings.hoverExecDelay,n=X;
|
||||
X=null;if(k==-1||la||!f.is(".xheEnabled"))return false;if(n&&n>10){la=true;setTimeout(function(){la=false},100);return false}var q=f.attr("name");if(ha[q].h!=1){b.hidePanel();return false}if(Fa)k=0;if(k>=0)Ea=setTimeout(function(){M=i;ba={x:M.clientX,y:M.clientY};b.exec(q)},k)},function(){ba=null;Ea&&clearTimeout(Ea)}).mousemove(function(i){if(ba){var f={x:i.clientX-ba.x,y:i.clientY-ba.y};if(Math.abs(f.x)>1||Math.abs(f.y)>1){if(f.x>0&&f.y>0){f=Math.round(Math.atan(f.y/f.x)/0.017453293);X=X?(X+f)/
|
||||
2:f}else X=null;ba={x:i.clientX,y:i.clientY}}}});L=e("#xhePanel");ea=e("#xheShadow");fa=e("#xheCntLine");xa=e("#xheTempIframe");if(L.length==0){L=e('<div id="xhePanel"></div>').mousedown(function(i){i.stopPropagation()});ea=e('<div id="xheShadow"></div>');fa=e('<div id="xheCntLine"></div>');setTimeout(function(){e(document.body).append(L).append(ea).append(fa);if(D)e(document.body).append(xa=e('<iframe id="xheTempIframe" class="xheHideArea" />'))},10)}e(document).mousedown(Ia);ra.mousedown(Ia);e("#"+
|
||||
ma).show();O.css("height",S-J.outerHeight());P.hide();P.focus(b.focus);Ka.submit(Q).bind("reset",G);l=e(window);l.unload(Q).bind("beforeunload",Q);l.resize(Ca);qa.focus(function(){b.settings.focus&&b.settings.focus()}).blur(function(){b.settings.blur&&b.settings.blur()});Z&&qa.click(gb);ra.keydown(hb).keypress(fb).bind("mousedown click",function(i){P.trigger(i.type)});e("body",ra).bind("paste",eb);(l=b.settings.shortcuts)&&e.each(l,function(i,f){b.addShortcuts(i,f)});Y++;Ba=true;if(b.settings.fullscreen)b.toggleFullscreen();
|
||||
else b.settings.sourceMode&&setTimeout(b.toggleSource,20);return true};this.remove=function(){b.hidePanel();Q();P.unbind("focus",b.focus);Ka.unbind("submit",Q).unbind("reset",G);var a=e(window);a.unbind("unload",Q).unbind("beforeunload",Q);a.unbind("resize",Ca);e("#"+ma).remove();e("#"+ua).remove();P.show();Ba=false};this.saveBookmark=function(){H||(aa=b.getRng())};this.loadBookmark=function(){if(!(H||!aa)){b.focus();if(D)aa.select();else{var a=b.getSel();a.removeAllRanges();a.addRange(aa)}aa=null}};
|
||||
this.focus=function(){H?e("#sourceCode",w).focus():qa.focus();return false};this.setCursorFirst=function(a){b.focus();R.scrollTo(0,0);var c=b.getRng(),d=w.body,g=d,m;if(a&&g.firstChild&&(m=g.firstChild.tagName)&&m.match(/^p|div|h[1-6]$/i))g=d.firstChild;D?c.moveToElementText(g):c.setStart(g,0);c.collapse(true);if(D)c.select();else{a=b.getSel();a.removeAllRanges();a.addRange(c)}};this.getSel=function(){return R.getSelection?R.getSelection():w.selection};this.getRng=function(){var a=b.getSel(),c;try{c=
|
||||
a.rangeCount>0?a.getRangeAt(0):a.createRange?a.createRange():w.createRange()}catch(d){}c||(c=D?w.body.createTextRange():w.createRange());return c};this.getParent=function(a){var c=b.getRng(),d;if(D)d=c.item?c.item(0):c.parentElement();else{d=c.commonAncestorContainer;if(!c.collapsed)if(c.startContainer==c.endContainer&&c.startOffset-c.endOffset<2&&c.startContainer.hasChildNodes())d=c.startContainer.childNodes[c.startOffset]}a=a?a:"*";d=e(d);d.is(a)||(d=e(d).closest(a));return d};this.getSelect=function(a){var c=
|
||||
b.getSel(),d=b.getRng(),g=true;g=!d||d.item?false:!c||d.boundingWidth==0||d.collapsed;if(a=="text")return g?"":d.text||(c.toString?c.toString():"");if(d.cloneContents){a=e("<div></div>");(d=d.cloneContents())&&a.append(d);d=a.html()}else d=$(d.item)?d.item(0).outerHTML:$(d.htmlText)?d.htmlText:d.toString();if(g)d="";d=b.processHTML(d,"read");d=b.cleanHTML(d);return d=b.formatXHTML(d)};this.pasteHTML=function(a,c){if(H)return false;b.focus();a=b.processHTML(a,"write");var d=b.getSel(),g=b.getRng();
|
||||
if(c!=undefined){if(g.item){var m=g.item(0);g=w.body.createTextRange();g.moveToElementText(m);g.select()}g.collapse(c)}if(g.insertNode){g.deleteContents();m=g.createContextualFragment(a);var j=m.lastChild;g.insertNode(m);g.setEndAfter(j);g.collapse(false);d.removeAllRanges();d.addRange(g)}else{if(d.type.toLowerCase()=="control"){d.clear();g=b.getRng()}g.pasteHTML(a)}};this.pasteText=function(a,c){a||(a="");a=b.domEncode(a);a=a.replace(/\r?\n/g,"<br />");b.pasteHTML(a,c)};this.appendHTML=function(a){if(H)return false;
|
||||
b.focus();a=b.processHTML(a,"write");e(w.body).append(a)};this.domEncode=function(a){return a.replace(/[<>]/g,function(c){return{"<":"<",">":">"}[c]})};this.setSource=function(a){aa=null;if(typeof a!="string"&&a!="")a=C.value;if(H)e("#sourceCode",w).val(a);else{if(b.settings.beforeSetSource)a=b.settings.beforeSetSource(a);a=b.cleanHTML(a);a=b.formatXHTML(a);a=b.cleanWord(a);w.body.innerHTML=b.processHTML(a,"write")}};this.processHTML=function(a,c){if(c=="write"){a=a.replace(/<img(?:\s+[^>]*?)?(\s+emot\s*=\s*(["']?)\s*(.*?)\s*\2)(?:\s+[^>]*?)?\/?>/ig,
|
||||
function(j,l,h,i){i=i.split(",");if(!i[1]){i[1]=i[0];i[0]=""}if(i[0]=="default")i[0]="";return j.replace(/\s+src\s*=\s*(["']?).*?\1(\s|$|\/|>)/i,"$2").replace(l,' src="'+Sa+(i[0]?i[0]:"default")+"/"+i[1]+'.gif"'+(b.settings.emotMark?' emot="'+(i[0]?i[0]+",":"")+i[1]+'" alt="'+i[1]+'"':""))});a=a.replace(/<(\w+(?:\:\w+)?)(?:\s+[^>]*?)?(\s+(src|href)\s*=\s*(["']?)\s*(.*?)\s*\4)(?:\s+[^>]*?)?\/?>/ig,function(j,l,h,i,f,k){return j.replace(h,h+" _xhe_"+i+'="'+k+'"')});a=a.replace(/<(\/?)del(\s+[^>]*?)?>/ig,
|
||||
"<$1strike$2>");if(oa){a=a.replace(/<(\/?)strong(\s+[^>]*?)?>/ig,"<$1b$2>");a=a.replace(/<(\/?)em(\s+[^>]*?)?>/ig,"<$1i$2>")}else if(Z){a=a.replace(/("|;)\s*font-size\s*:\s*([a-z-]+)(;?)/ig,function(j,l,h,i){for(var f,k=0;k<N.length;k++){j=N[k];if(h==j.n){f=j.wkn;break}}return l+"font-size:"+f+i});a=a.replace(/<strong(\s+[^>]*?)?>/ig,'<span class="Apple-style-span" style="font-weight: bold;"$1>');a=a.replace(/<em(\s+[^>]*?)?>/ig,'<span class="Apple-style-span" style="font-style: italic;"$1>');a=a.replace(/<u(\s+[^>]*?)?>/ig,
|
||||
'<span class="Apple-style-span" style="text-decoration: underline;"$1>');a=a.replace(/<strike(\s+[^>]*?)?>/ig,'<span class="Apple-style-span" style="text-decoration: line-through;"$1>');a=a.replace(/<\/(strong|em|u|strike)>/ig,"</span>");a=a.replace(/<span((?:\s+[^>]*?)?\s+style="([^"]*;)*\s*(font-family|font-size|color|background-color)\s*:\s*[^;"]+\s*;?"[^>]*)>/ig,'<span class="Apple-style-span"$1>')}else if(D){a=a.replace(/'/ig,"'");a=a.replace(/\s+(disabled|checked|readonly|selected)\s*=\s*[\"\']?(false|0)[\"\']?/ig,
|
||||
"")}a=a.replace(/<a(\s+[^>]*?)?\/>/,"<a$1></a>");if(!Z){var d=function(j,l,h,i){l="";var f,k;if(f=h.match(/font-family\s*:\s*([^;"]+)/i))l+=' face="'+f[1]+'"';if(f=h.match(/font-size\s*:\s*([^;"]+)/i)){f=f[1].toLowerCase();for(var n=0;n<N.length;n++)if(f==N[n].n||f==N[n].s){k=n+1;break}if(k){l+=' size="'+k+'"';h=h.replace(/(^|;)(\s*font-size\s*:\s*[^;"]+;?)+/ig,"$1")}}if(k=h.match(/(?:^|[\s;])color\s*:\s*([^;"]+)/i)){if(f=k[1].match(/\s*rgb\s*\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*\)/i)){k[1]="#";for(n=
|
||||
1;n<=3;n++)k[1]+=(f[n]-0).toString(16)}k[1]=k[1].replace(/^#([0-9a-f])([0-9a-f])([0-9a-f])$/i,"#$1$1$2$2$3$3");l+=' color="'+k[1]+'"'}h=h.replace(/(^|;)(\s*(font-family|color)\s*:\s*[^;"]+;?)+/ig,"$1");if(l!=""){if(h)l+=' style="'+h+'"';return"<font"+l+">"+i+"</font>"}else return j};a=a.replace(/<(span)(?:\s+[^>]*?)?\s+style\s*=\s*"((?:[^"]*?;)*\s*(?:font-family|font-size|color)\s*:[^"]*)"(?: [^>]+)?>(((?!<\1(\s+[^>]*?)?>)[\s\S])*?)<\/\1>/ig,d);a=a.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,
|
||||
d);a=a.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,d)}}else{var g=b.settings.localUrl;a=a.replace(/<(?:\w+(?:\:\w+)?)(?:\s+[^>]*?)?\s+_xhe_(src|href)\s*=\s*(["']?)\s*(.*?)\s*\2(?:\s+[^>]*?)?\/?>/ig,function(j,l,h,i){if(g)i=Da(i,g);return j.replace(RegExp("\\s+"+l+"\\s*=\\s*([\"']?).*?\\1(\\s|/?>)",
|
||||
"ig")," "+l+'="'+i.replace(/\$/g,"$$$$")+'"$2')});if(Z){a=a.replace(/("|;)\s*font-size\s*:\s*([a-z-]+)(;?)/ig,function(j,l,h,i){for(var f,k=0;k<N.length;k++){j=N[k];if(h==j.wkn){f=j.n;break}}return l+"font-size:"+f+i});var m=[{r:/font-weight:\sbold/ig,t:"strong"},{r:/font-style:\sitalic/ig,t:"em"},{r:/text-decoration:\sunderline/ig,t:"u"},{r:/text-decoration:\sline-through/ig,t:"strike"}];d=function(j,l,h,i,f){l=h+i;h="";for(i=0;i<m.length;i++)if(l.match(m[i].r)){h=m[i].t;break}return h?"<"+h+">"+
|
||||
f+"</"+h+">":j};a=a.replace(/<(span)(\s+[^>]*?)?\s+class\s*=\s*"Apple-style-span"(\s+[^>]*?)?>(((?!<\1(\s+[^>]*?)?>)[\s\S])*?)<\/\1>/ig,d);a=a.replace(/<(span)(\s+[^>]*?)?\s+class\s*=\s*"Apple-style-span"(\s+[^>]*?)?>(((?!<\1(\s+[^>]*?)?>)[\s\S]|<\1(\s+[^>]*?)?>((?!<\1(\s+[^>]*?)?>)[\s\S])*?<\/\1>)*?)<\/\1>/ig,d);a=a.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,
|
||||
d)}a=a.replace(/(<\w+(?:\s+[^>]*?)?)\s+(?:_xhe_|_moz_|_webkit_)[^=]+?\s*=\s*(["']?).*?\2(\s|\/?>)/ig,"$1$3");a=a.replace(/(<\w+[^>]*?)\s+class\s*=\s*(["']?)\s*(?:apple|webkit)\-.+?\s*\2(\s|\/?>)/ig,"$1$3");a=a.replace(/<img(\s+[^>]+?)\/?>/ig,function(j,l){l.match(/\s+alt\s*(["']?).*?\1(\s|$)/i)||(l+=' alt=""');return"<img"+l+" />"})}return a};this.getSource=function(a){var c,d=b.settings.beforeGetSource;if(H){c=e("#sourceCode",w).val();d||(c=c.replace(/(\t*\r?\n\t*)+/g,""))}else{c=b.processHTML(w.body.innerHTML,
|
||||
"read");c=c.replace(/^\s*(?:<(p|div)(?:\s+[^>]*?)?>)?\s*(<br(?:\s+[^>]*?)?>)*\s*(?:<\/\1>)?\s*$/i,"");c=b.cleanHTML(c);c=b.formatXHTML(c,a);c=b.cleanWord(c);if(d)c=d(c)}return C.value=c};this.cleanWord=function(a){if(a.match(/mso(-|normal)/i)){var c=b.settings.wordDeepClean;a=a.replace(/(<link(?:\s+[^>]*?)?)\s+href\s*=\s*(["']?)\s*file:\/\/.+?\s*\2((?:\s+[^>]*?)?\s*\/?>)/ig,"");a=a.replace(/<!--[\s\S]*?--\>|<!(--)?\[[\s\S]+?\](--)?>|<style(\s+[^>]*?)?>[\s\S]*?<\/style>/ig,"");a=a.replace(/<\/?\w+:[^>]*>/ig,
|
||||
"");if(c)a=a.replace(/<\/?(span|a|img)(\s+[^>]*?)?>/ig,"");a=a.replace(/(<\w+(?:\s+[^>]*?)?)\s+class\s*=\s*(["']?)\s*mso.+?\s*\2((?:\s+[^>]*?)?\s*\/?>)/ig,"$1$3");a=a.replace(/(<\w+(?:\s+[^>]*?)?)\s+lang\s*=\s*(["']?)\s*.+?\s*\2((?:\s+[^>]*?)?\s*\/?>)/ig,"$1$3");a=a.replace(/(<\w+(?:\s+[^>]*?)?)\s+align\s*=\s*(["']?)\s*left\s*\2((?:\s+[^>]*?)?\s*\/?>)/ig,"$1$3");a=a.replace(/<\w+(?:\s+[^>]*?)?(\s+style\s*=\s*(["']?)\s*([\s\S]*?)\s*\2)(?:\s+[^>]*?)?\s*\/?>/ig,function(d,g,m,j){j=e.trim(j.replace(/\s*(mso-[^:]+:.+?|margin\s*:\s*0cm 0cm 0pt\s*|(text-align|font-variant|line-height)\s*:\s*.+?)(;|$)\s*/ig,
|
||||
""));return d.replace(g,c?"":j?' style="'+j+'"':"")})}return a};this.cleanHTML=function(a){a=a.replace(/<!?\/?(DOCTYPE|html|body|meta)(\s+[^>]*?)?>/ig,"");var c;a=a.replace(/<head(?:\s+[^>]*?)?>([\s\S]*?)<\/head>/i,function(d,g){c=g.match(/<(script|style)(\s+[^>]*?)?>[\s\S]*?<\/\1>/ig);return""});if(c)a=c.join("")+a;a=a.replace(/<\??xml(:\w+)?(\s+[^>]*?)?>([\s\S]*?<\/xml>)?/ig,"");b.settings.linkTag||(a=a.replace(/<link(\s+[^>]*?)?>/ig,""));b.settings.internalScript||(a=a.replace(/<script(\s+[^>]*?)?>[\s\S]*?<\/script>/ig,
|
||||
""));b.settings.inlineScript||(a=a.replace(/(<\w+)(\s+[^>]*?)?\s+on(?:click|dblclick|mousedown|mouseup|mousemove|mouseover|mouseout|mouseenter|mouseleave|keydown|keypress|keyup|change|select|submit|reset|blur|focus|load|unload)\s*=\s*(["']?).*?\3((?:\s+[^>]*?)?\/?>)/ig,"$1$2$4"));b.settings.internalStyle||(a=a.replace(/<style(\s+[^>]*?)?>[\s\S]*?<\/style>/ig,""));b.settings.inlineStyle||(a=a.replace(/(<\w+)(\s+[^>]*?)?\s+(style|class)\s*=\s*(["']?).*?\4((?:\s+[^>]*?)?\/?>)/ig,"$1$2$5"));return a=
|
||||
a.replace(/<\/(strong|b|u|strike|em|i)>((?:\s|<br\/?>| )*?)<\1(\s+[^>]*?)?>/ig,"$2")};this.formatXHTML=function(a,c){function d(p){var x={};p=p.split(",");for(var E=0;E<p.length;E++)x[p[E]]=true;return x}function g(p){if(p){p=p.toLowerCase();var x=o[p];if(x)p=x}else p="";return p}function m(p,x,E){p=g(p);if(k[p])for(;y.last()&&n[y.last()];)j(y.last());q[p]&&y.last()==p&&j(p);(E=f[p]||!!E)||y.push(p);var I=[];I.push("<"+p);x.replace(A,function(Ta,na,Ua,Va,Wa){na=na.toLowerCase();I.push(" "+na+
|
||||
'="'+(Ua?Ua:Va?Va:Wa?Wa:r[na]?na:"")+'"')});I.push((E?" /":"")+">");l(I.join(""),p,true)}function j(p){if(p){p=g(p);for(x=y.length-1;x>=0;x--)if(y[x]==p)break}else var x=0;if(x>=0){for(p=y.length-1;p>=x;p--)l("</"+y[p]+">",y[p]);y.length=x}}function l(p,x,E){if(c==true){p=p.replace(/(\t*\r?\n\t*)+/g,"");if(!p.match(/^\s*$/)){var I=k[x],Ta=I?x:"";if(I){E&&K++;da==""&&K--}else da&&K++;if(Ta!=da||I)h();B.push(p);x=="br"&&h();if(I&&(f[x]||!E))K--;da=I?x:"";ib=E}}else B.push(p)}function h(){B.push("\r\n");
|
||||
if(K>0)for(var p=K;p--;)B.push("\t")}function i(p,x,E,I){p="";if(x=E.match(/ face\s*=\s*"\s*([^"]+)\s*"/i))p+="font-family:"+x[1]+";";if(x=E.match(/ size\s*=\s*"\s*(\d+)\s*"/i))p+="font-size:"+N[(x[1]>7?7:x[1]<1?1:x[1])-1].n+";";if(x=E.match(/ color\s*=\s*"\s*([^"]+)\s*"/i))p+="color:"+x[1]+";";if(E=E.match(/ style\s*=\s*"\s*([^"]+)\s*"/i))p+=E[1];if(p)I='<span style="'+p+'">'+I+"</span>";return I}var f=d("area,base,basefont,br,col,frame,hr,img,input,isindex,link,meta,param,embed"),k=d("address,applet,blockquote,button,center,dd,dir,div,dl,dt,fieldset,form,frameset,hr,iframe,ins,isindex,li,map,menu,noframes,noscript,object,ol,p,pre,script,table,tbody,td,tfoot,th,thead,tr,ul"),
|
||||
n=d("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"),q=d("colgroup,dd,dt,li,options,p,td,tfoot,th,thead,tr"),r=d("checked,compact,declare,defer,disabled,ismap,multiple,nohref,noresize,noshade,nowrap,readonly,selected"),s=d("script,style"),o={b:"strong",i:"em",s:"del",strike:"del"},t=/^<\??(\w+(?:\:\w+)?)((?:\s+[\w-\:]*(?:\s*=\s*(?:(?:"[^"]*")|(?:'[^']*')|[^>\s]+))?)*)\s*(\/?)>/,
|
||||
v=/^<\/(\w+(?:\:\w+)?)[^>]*>/,A=/([\w-(?:\:\w+)?]+)(?:\s*=\s*(?:(?:"((?:\\.|[^"])*)")|(?:'((?:\\.|[^'])*)')|([^>\s]+)))?/g,u=0,y=[],z=a,B=[],K=-1,da="body",ib;for(y.last=function(){return this[this.length-1]};z.length>0;)if(!y.last()||!s[y.last()]){u=0;if(z.substring(0,4)=="<!--"){u=z.indexOf("--\>");if(u!=-1){u+=3;l(z.substring(0,u))}}else if(z.substring(0,2)=="</"){if(match=z.match(v)){j(match[1]);u=match[0].length}}else if(z.charAt(0)=="<")if(match=z.match(t)){m(match[1],match[2],match[3]);u=match[0].length}if(u==
|
||||
0){u=z.indexOf("<");if(u==0)u=1;else if(u<0)u=z.length;l(b.domEncode(z.substring(0,u)))}z=z.substring(u)}else{z=z.replace(/^([\s\S]*?)<\/(style|script)>/i,function(p,x){l(x);return""});j(y.last())}j();a=B.join("");B=null;a=a.replace(/<(font)(\s+[^>]*?)?>(((?!<\1(\s+[^>]*?)?>)[\s\S])*?)<\/\1>/ig,i);a=a.replace(/<(font)(\s+[^>]*?)?>(((?!<\1(\s+[^>]*?)?>)[\s\S]|<\1(\s+[^>]*?)?>((?!<\1(\s+[^>]*?)?>)[\s\S])*?<\/\1>)*?)<\/\1>/ig,i);a=a.replace(/<(font)(\s+[^>]*?)?>(((?!<\1(\s+[^>]*?)?>)[\s\S]|<\1(\s+[^>]*?)?>((?!<\1(\s+[^>]*?)?>)[\s\S]|<\1(\s+[^>]*?)?>((?!<\1(\s+[^>]*?)?>)[\s\S])*?<\/\1>)*?<\/\1>)*?)<\/\1>/ig,
|
||||
i);a=a.replace(/^(\s*\r?\n)+|(\s*\r?\n)+$/g,"");return a=a.replace(/(\t*\r?\n)+/g,"\r\n")};this.toggleShowBlocktag=function(a){if(ka!==a){ka=!ka;a=e(w.body);if(ka){ca+=" showBlocktag";a.addClass("showBlocktag")}else{ca=ca.replace(" showBlocktag","");a.removeClass("showBlocktag")}}};this.toggleSource=function(a){if(H!==a){J.find("[name=Source]").toggleClass("xheEnabled").toggleClass("xheActive");var c=w.body,d=e(c),g,m,j="_xhe_cursor"+(new Date).getTime();a=0;if(H){g=b.getSource();d.find("#sourceCode").remove();
|
||||
d.removeAttr("scroll").attr("class","editMode"+ca);if(D)c.contentEditable="true";else w.designMode="On";if(oa){b._exec("inserthtml","-");e("#"+ua).show().focus().hide()}}else{b.pasteHTML(j,true);g=b.getSource(true);a=g.indexOf(j);if(!Xa)a=g.substring(0,a).replace(/\r/g,"").length;g=g.replace(j,"");if(D)c.contentEditable="false";else w.designMode="Off";d.attr("scroll","no").attr("class","sourceMode").html('<textarea id="sourceCode" wrap="soft" spellcheck="false" height="100%" />');m=e("#sourceCode",
|
||||
d).blur(b.getSource)[0]}H=!H;b.setSource(g);if(H){b.focus();if(m.setSelectionRange)m.setSelectionRange(a,a);else{m=m.createTextRange();m.move("character",a);m.select()}}else b.setCursorFirst(true);J.find("[name=Source]").toggleClass("xheEnabled");J.find(".xheButton").not("[name=Source],[name=Fullscreen],[name=About]").toggleClass("xheEnabled");setTimeout(Aa,300)}};this.toggleFullscreen=function(a){if(ia!==a){a=e("#"+ma).find(".xheLayout");var c=e("#"+ma);if(ia){a.attr("style",Ma);O.height(S-J.outerHeight());
|
||||
setTimeout(function(){e(window).scrollTop(La)},10)}else{La=e(window).scrollTop();Ma=a.attr("style");a.removeAttr("style");O.height("100%");setTimeout(Ca,100)}if(oa){e("#"+ua).show().focus().hide();setTimeout(b.focus,1)}ia=!ia;c.toggleClass("xhe_Fullscreen");e("html").toggleClass("xhe_Fullfix");J.find("[name=Fullscreen]").toggleClass("xheActive");setTimeout(Aa,300)}};this.showMenu=function(a,c){var d=e('<div class="xheMenu"></div>'),g=[];e.each(a,function(m,j){g.push('<a href="javascript:void(0);" title="'+
|
||||
(j.t?j.t:j.s)+'" v="'+j.v+'">'+j.s+"</a>")});d.append(g.join(""));d.click(function(m){c(e(m.target).closest("a").attr("v"));b.hidePanel();return false}).mousedown(W);b.showPanel(d)};this.showColor=function(a){var c=e('<div class="xheColor"></div>'),d=[],g=0;e.each(Za,function(m,j){if(g%7==0)d.push((g>0?"</div>":"")+"<div>");d.push('<a href="javascript:void(0);" xhev="'+j+'" title="'+j+'" style="background:'+j+'"></a>');g++});d.push("</div>");c.append(d.join(""));c.click(function(m){m=m.target;if(e.nodeName(m,
|
||||
"A")){a(e(m).attr("xhev"));b.hidePanel();return false}}).mousedown(W);b.showPanel(c)};this.showPastetext=function(){var a=e('<div>\u4f7f\u7528\u952e\u76d8\u5feb\u6377\u952e(Ctrl+V)\u628a\u5185\u5bb9\u7c98\u8d34\u5230\u65b9\u6846\u91cc\uff0c\u6309 \u786e\u5b9a</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="\u786e\u5b9a" /></div>'),c=e("#xhePastetextValue",a);
|
||||
e("#xheSave",a).click(function(){b.loadBookmark();var d=c.val();d&&b.pasteText(d);b.hidePanel();return false});b.showDialog(a)};this.showLink=function(){var a=e('<div>\u94fe\u63a5\u5730\u5740: <input type="text" id="xheLinkHref" value="http://" class="xheText" /></div><div>\u6253\u5f00\u65b9\u5f0f: <select id="xheLinkTarget"><option selected="selected" value="">\u9ed8\u8ba4</option><option value="_blank">\u65b0\u7a97\u53e3</option><option value="_self">\u5f53\u524d\u7a97\u53e3</option><option value="_parent">\u7236\u7a97\u53e3</option></select></div><div style="display:none">\u94fe\u63a5\u6587\u5b57: <input type="text" id="xheLinkText" value="" class="xheText" /></div><div style="text-align:right;"><input type="button" id="xheSave" value="\u786e\u5b9a" /></div>'),
|
||||
c=b.getParent("a"),d=e("#xheLinkText",a),g=e("#xheLinkHref",a),m=e("#xheLinkTarget",a),j=e("#xheSave",a),l=b.getSelect();if(c.length==1){g.val(V(c,"href"));m.attr("value",c.attr("target"))}else l==""&&d.val(b.settings.defLinkText).closest("div").show();b.settings.upLinkUrl&&b.uploadInit(g,b.settings.upLinkUrl,b.settings.upLinkExt);j.click(function(){var h=g.val();b.loadBookmark();if(h==""||c.length==0)b._exec("unlink");if(h!=""&&h!="http://"){var i=h.split(" "),f=m.val(),k=d.val();if(i.length>1){b._exec("unlink");
|
||||
l=b.getSelect();var n='<a href="xhe_tmpurl"',q=[];if(f!="")n+=' target="'+f+'"';n+=">xhe_tmptext</a>";k=l!=""?l:k?k:h;for(var r in i){h=i[r];if(h!=""){h=h.split("||");f=n;f=f.replace("xhe_tmpurl",h[0]);f=f.replace("xhe_tmptext",h[1]?h[1]:k);q.push(f)}}b.pasteHTML(q.join(" "))}else{h=i[0].split("||");k||(k=h[0]);k=h[1]?h[1]:l!=""?"":k?k:h[0];if(c.length==0){k?b.pasteHTML('<a href="#xhe_tmpurl">'+k+"</a>"):b._exec("createlink","#xhe_tmpurl");c=e('a[href$="#xhe_tmpurl"]',w)}V(c,"href",h[0]);f!=
|
||||
""?c.attr("target",f):c.removeAttr("target");k&&!Z&&c.text(k)}}b.hidePanel();return false});b.showDialog(a)};this.showImg=function(){var a=e('<div>\u56fe\u7247\u6587\u4ef6: <input type="text" id="xheImgSrc" value="http://" class="xheText" /></div><div>\u66ff\u6362\u6587\u672c: <input type="text" id="xheImgAlt" /></div><div>\u5bf9\u9f50\u65b9\u5f0f: <select id="xheImgAlign"><option selected="selected" value="">\u9ed8\u8ba4</option><option value="left">\u5de6\u5bf9\u9f50</option><option value="right">\u53f3\u5bf9\u9f50</option><option value="top">\u9876\u7aef</option><option value="middle">\u5c45\u4e2d</option><option value="baseline">\u57fa\u7ebf</option><option value="bottom">\u5e95\u8fb9</option></select></div><div>\u5bbd\u5ea6\u9ad8\u5ea6: <input type="text" id="xheImgWidth" style="width:40px;" /> x <input type="text" id="xheImgHeight" style="width:40px;" /></div><div>\u8fb9\u6846\u5927\u5c0f: <input type="text" id="xheImgBorder" style="width:40px;" /></div><div>\u6c34\u5e73\u95f4\u8ddd: <input type="text" id="xheImgHspace" style="width:40px;" /> \u5782\u76f4\u95f4\u8ddd: <input type="text" id="xheImgVspace" style="width:40px;" /></div><div style="text-align:right;"><input type="button" id="xheSave" value="\u786e\u5b9a" /></div>'),
|
||||
c=b.getParent("img"),d=e("#xheImgSrc",a),g=e("#xheImgAlt",a),m=e("#xheImgAlign",a),j=e("#xheImgWidth",a),l=e("#xheImgHeight",a),h=e("#xheImgBorder",a),i=e("#xheImgVspace",a),f=e("#xheImgHspace",a),k=e("#xheSave",a);if(c.length==1){d.val(V(c,"src"));g.val(c.attr("alt"));m.val(c.attr("align"));j.val(c.attr("width"));l.val(c.attr("height"));h.val(c.attr("border"));var n=c.attr("vspace"),q=c.attr("hspace");i.val(n<=0?"":n);f.val(q<=0?"":q)}b.settings.upImgUrl&&b.uploadInit(d,b.settings.upImgUrl,b.settings.upImgExt);
|
||||
k.click(function(){b.loadBookmark();var r=d.val();if(r!=""&&r!="http://"){var s=r.split(" "),o=g.val(),t=m.val(),v=j.val(),A=l.val(),u=h.val(),y=i.val(),z=f.val();if(s.length>1){var B='<img src="xhe_tmpurl"',K=[];if(o!="")B+=' alt="'+o+'"';if(t!="")B+=' align="'+t+'"';if(v!="")B+=' width="'+v+'"';if(A!="")B+=' height="'+A+'"';if(u!="")B+=' border="'+u+'"';if(y!="")B+=' vspace="'+y+'"';if(z!="")B+=' hspace="'+z+'"';B+=" />";for(var da in s){r=s[da];if(r!=""){r=r.split("||");o=B;o=o.replace("xhe_tmpurl",
|
||||
r[0]);if(r[1])o='<a href="'+r[1]+'" target="_blank">'+o+"</a>";K.push(o)}}b.pasteHTML(K.join(" "))}else if(s.length==1){r=s[0];if(r!=""){r=r.split("||");if(c.length==0){b.pasteHTML('<img src="'+r[0]+'#xhe_tmpurl" />');c=e('img[src$="#xhe_tmpurl"]',w)}V(c,"src",r[0]);o!=""&&c.attr("alt",o);t!=""?c.attr("align",t):c.removeAttr("align");v!=""?c.attr("width",v):c.removeAttr("width");A!=""?c.attr("height",A):c.removeAttr("height");u!=""?c.attr("border",u):c.removeAttr("border");y!=""?c.attr("vspace",
|
||||
y):c.removeAttr("vspace");z!=""?c.attr("hspace",z):c.removeAttr("hspace");if(r[1]){s=c.parent("a");if(s.length==0){c.wrap("<a></a>");s=c.parent("a")}V(s,"href",r[1]);s.attr("target","_blank")}}}}else c.length==1&&c.remove();b.hidePanel();return false});b.showDialog(a)};this.showEmbed=function(a,c,d,g,m,j,l){c=e(c);var h=b.getParent('embed[type="'+d+'"],embed[classid="'+g+'"]'),i=e("#xhe"+a+"Src",c),f=e("#xhe"+a+"Width",c),k=e("#xhe"+a+"Height",c);a=e("#xheSave",c);j&&b.uploadInit(i,j,l);b.showDialog(c);
|
||||
if(h.length==1){i.val(V(h,"src"));f.val(h.attr("width"));k.val(h.attr("height"))}a.click(function(){b.loadBookmark();var n=i.val();if(n!=""&&n!="http://"){var q=f.val(),r=k.val(),s=/^[0-9]+$/;s.test(q)||(q=412);s.test(r)||(r=300);var o='<embed type="'+d+'" classid="'+g+'" src="xhe_tmpurl"'+m;s=n.split(" ");if(s.length>1){o=o+"";var t,v=[];o+=' width="xhe_width" height="xhe_height" />';for(var A in s){n=s[A].split("||");t=o;t=t.replace("xhe_tmpurl",n[0]);t=t.replace("xhe_width",n[1]?n[1]:q);t=t.replace("xhe_height",
|
||||
n[2]?n[2]:r);n!=""&&v.push(t)}b.pasteHTML(v.join(" "))}else if(s.length==1){n=s[0].split("||");if(h.length==0){b.pasteHTML(o.replace("xhe_tmpurl",n[0]+"#xhe_tmpurl")+" />");h=e('embed[src$="#xhe_tmpurl"]',w)}V(h,"src",n[0]);h.attr("width",n[1]?n[1]:q);h.attr("height",n[2]?n[2]:r)}}else h.length==1&&h.remove();b.hidePanel();return false})};this.showEmot=function(a){var c=e('<div class="xheEmot"></div>');a=a?a:Ha?Ha:"default";var d=va[a],g=Sa+a+"/",m=0,j=[],l="";l=d.width;var h=d.height,i=d.line,
|
||||
f=d.count;d=d.list;if(f)for(d=1;d<=f;d++){m++;j.push('<a href="javascript:void(0);" style="background-image:url('+g+d+'.gif);" emot="'+a+","+d+'" xhev=""> </a>');m%i==0&&j.push("<br />")}else e.each(d,function(q,r){m++;j.push('<a href="javascript:void(0);" style="background-image:url('+g+q+'.gif);" emot="'+a+","+q+'" title="'+r+'" xhev="'+r+'"> </a>');m%i==0&&j.push("<br />")});f=i*(l+12);d=f*0.75;if(Math.ceil(m/i)*(h+12)<=d)d="";l=e("<style>"+(d?".xheEmot div{width:"+(f+20)+"px;height:"+
|
||||
d+"px;}":"")+".xheEmot div a{width:"+l+"px;height:"+h+"px;}</style><div>"+j.join("")+"</div>").click(function(q){q=q.target;var r=e(q);if(e.nodeName(q,"A")){b.pasteHTML('<img emot="'+r.attr("emot")+'" alt="'+r.attr("xhev")+'">');b.hidePanel();return false}}).mousedown(W);c.append(l);var k=0,n=["<ul>"];e.each(va,function(q,r){k++;n.push("<li"+(a==q?' class="cur"':"")+'><a href="javascript:void(0);" group="'+q+'">'+r.name+"</a></li>")});if(k>1){n.push('</ul><br style="clear:both;" />');l=e(n.join("")).click(function(q){Ha=
|
||||
e(q.target).attr("group");b.exec("Emot");return false}).mousedown(W);c.append(l)}b.showPanel(c)};this.showTable=function(){var a=e('<div>\u884c\u6570\u5217\u6570: <input type="text" id="xheTableRows" style="width:40px;" value="3" /> x <input type="text" id="xheTableColumns" style="width:40px;" value="2" /></div><div>\u6807\u9898\u5355\u5143: <select id="xheTableHeaders"><option selected="selected" value="">\u65e0</option><option value="row">\u7b2c\u4e00\u884c</option><option value="col">\u7b2c\u4e00\u5217</option><option value="both">\u7b2c\u4e00\u884c\u548c\u7b2c\u4e00\u5217</option></select></div><div>\u5bbd\u5ea6\u9ad8\u5ea6: <input type="text" id="xheTableWidth" style="width:40px;" value="200" /> x <input type="text" id="xheTableHeight" style="width:40px;" value="" /></div><div>\u8fb9\u6846\u5927\u5c0f: <input type="text" id="xheTableBorder" style="width:40px;" value="1" /></div><div>\u8868\u683c\u95f4\u8ddd: <input type="text" id="xheTableCellSpacing" style="width:40px;" value="1" /> \u8868\u683c\u586b\u5145: <input type="text" id="xheTableCellPadding" style="width:40px;" value="1" /></div><div>\u5bf9\u9f50\u65b9\u5f0f: <select id="xheTableAlign"><option selected="selected" value="">\u9ed8\u8ba4</option><option value="left">\u5de6\u5bf9\u9f50</option><option value="center">\u5c45\u4e2d</option><option value="right">\u53f3\u5bf9\u9f50</option></select></div><div>\u8868\u683c\u6807\u9898: <input type="text" id="xheTableCaption" /></div><div style="text-align:right;"><input type="button" id="xheSave" value="\u786e\u5b9a" /></div>'),
|
||||
c=e("#xheTableRows",a),d=e("#xheTableColumns",a),g=e("#xheTableHeaders",a),m=e("#xheTableWidth",a),j=e("#xheTableHeight",a),l=e("#xheTableBorder",a),h=e("#xheTableCellSpacing",a),i=e("#xheTableCellPadding",a),f=e("#xheTableAlign",a),k=e("#xheTableCaption",a);e("#xheSave",a).click(function(){b.loadBookmark();var n=k.val(),q=l.val(),r=c.val(),s=d.val(),o=g.val(),t=m.val(),v=j.val(),A=h.val(),u=i.val(),y=f.val();q="<table"+(q!=""?' border="'+q+'"':"")+(t!=""?' width="'+t+'"':"")+(v!=""?' width="'+v+
|
||||
'"':"")+(A!=""?' cellspacing="'+A+'"':"")+(u!=""?' cellpadding="'+u+'"':"")+(y!=""?' align="'+y+'"':"")+">";if(n!="")q+="<caption>"+n+"</caption>";if(o=="row"||o=="both"){q+="<tr>";for(n=0;n<s;n++)q+='<th scope="col"> </th>';q+="</tr>";r--}q+="<tbody>";for(n=0;n<r;n++){q+="<tr>";for(t=0;t<s;t++)q+=t==0&&(o=="col"||o=="both")?'<th scope="row"> </th>':"<td> </td>";q+="</tr>"}q+="</tbody></table>";b.pasteHTML(q);b.hidePanel();return false});b.showDialog(a)};this.showAbout=function(){var a=
|
||||
e('<div style="font:12px Arial;width:245px;word-wrap:break-word;word-break:break-all;"><p><span style="font-size:20px;color:#1997DF;">xhEditor</span><br />v1.0.0 Final (build 100701)</p><p>xhEditor\u662f\u57fa\u4e8ejQuery\u5f00\u53d1\u7684\u8de8\u5e73\u53f0\u8f7b\u91cfXHTML\u7f16\u8f91\u5668\uff0c\u57fa\u4e8e<a href="http://www.gnu.org/licenses/lgpl.html" target="_blank">LGPL</a>\u5f00\u6e90\u534f\u8bae\u53d1\u5e03\u3002</p><p>Copyright \u00a9 <a href="http://xheditor.com/" target="_blank">xhEditor.com</a>. All rights reserved.</p></div>');
|
||||
b.showDialog(a)};this.addShortcuts=function(a,c){a=a.toLowerCase();if(ja[a]==undefined)ja[a]=[];ja[a].push(c)};this.delShortcuts=function(a){delete ja[a]};this.uploadInit=function(a,c,d){function g(){a.closest(".xheDialog").bind("dragenter dragover",W).bind("drop",function(o){o=o.originalEvent.dataTransfer;var t;if(n&&o&&(t=o.files)&&t.length>0)m(t);return false})}function m(o){s=[];var t,v,A=e('<div style="padding:22px 0;text-align:center;line-height:30px;">\u6587\u4ef6\u4e0a\u4f20\u4e2d\uff0c\u8bf7\u7a0d\u5019\u2026\u2026<br /></div>'),
|
||||
u='<img src="'+Ga+'img/loading.gif">';if(!n||o.nodeType&&!((v=o.files)&&v[0])){if(!j(o.value))return;A.append(u);t=new b.html4Upload(o,c,l)}else{v||(v=o);var y=v.length;if(y>q){alert("\u8bf7\u4e0d\u8981\u4e00\u6b21\u4e0a\u4f20\u8d85\u8fc7"+q+"\u4e2a\u6587\u4ef6");return}for(o=0;o<y;o++)if(!j(v[o].fileName))return;var z=e('<div class="xheProgress"><div><span>0%</span></div></div>');A.append(z);t=new b.html5Upload(i,v,c,l,function(B){if(B.loaded>=0){var K=Math.round(B.loaded*100/B.total)+"%";e("div",
|
||||
z).css("width",K);e("span",z).text(K+" ( "+Ja(B.loaded)+" / "+Ja(B.total)+" )")}else z.replaceWith(u)})}T=false;b.showModal("\u6587\u4ef6\u4e0a\u4f20\u4e2d(Esc\u53d6\u6d88\u4e0a\u4f20)",A,320,150,function(){T=true;t.remove()});t.start()}function j(o){if(d=="*"||o.match(RegExp(".("+d.replace(/,/g,"|")+")$","i")))return true;else{alert("\u4e0a\u4f20\u6587\u4ef6\u6269\u5c55\u540d\u5fc5\u9700\u4e3a: "+d);return false}}function l(o,t){var v=Object,A=false,u=b.settings.onUpload;try{v=eval("("+o+")")}catch(y){}if(v.err==
|
||||
undefined||v.msg==undefined)alert(c+" \u4e0a\u4f20\u63a5\u53e3\u53d1\u751f\u9519\u8bef\uff01\r\n\r\n\u8fd4\u56de\u7684\u9519\u8bef\u5185\u5bb9\u4e3a: \r\n\r\n"+o);else if(v.err)alert(v.err);else{s.push(v.msg);A=true}if(!A||t)b.removeModal();if(t&&A){h(s);u&&u(s)}return A}function h(o){if($(o,"string"))o=[o];var t=false,v,A=o.length,u,y=[];for(v=0;v<A;v++){u=o[v];u=$(u,"string")?u:u.url;if(u.substr(0,1)=="!"){t=true;u=u.substr(1)}y.push(u)}a.val(y.join(" "));t&&a.closest(".xheDialog").find("#xheSave").click()}
|
||||
var i="filedata",f=e('<span class="xheUpload"><input type="text" style="visibility:hidden;" tabindex="-1" /><input type="button" value="'+b.settings.upBtnText+'" class="xheBtn" tabindex="-1" /></span>'),k=e(".xheBtn",f),n=b.settings.html5Upload,q=n?b.settings.upMultiple:1;a.after(f);k.before(a);c=c.replace(/{editorRoot}/ig,U);if(c.substr(0,1)=="!")k.click(function(){T=false;b.showIframeModal("\u4e0a\u4f20\u6587\u4ef6",c.substr(1),h,null,null,function(){T=true})});else{f.append('<input type="file"'+
|
||||
(q>1?' multiple=""':"")+' class="xheFile" size="13" name="'+i+'" tabindex="-1" />');var r=e(".xheFile",f),s=[];r.change(function(){m(r[0])});setTimeout(g,10)}};this.html4Upload=function(a,c,d){var g="jUploadFrame"+(new Date).getTime(),m=this,j=e('<iframe name="'+g+'" class="xheHideArea" />').appendTo("body"),l=e('<form action="'+c+'" target="'+g+'" method="post" enctype="multipart/form-data" class="xheHideArea"></form>').appendTo("body"),h=e(a),i=h.clone().attr("disabled","true");h.before(i).appendTo(l);
|
||||
this.remove=function(){if(m!=null){i.before(h).remove();j.remove();l.remove();m=null}};this.onLoad=function(){d(e(j[0].contentWindow.document.body).text(),true)};this.start=function(){l.submit();j.load(m.onLoad)};return this};this.html5Upload=function(a,c,d,g,m){function j(s,o,t,v){h=new XMLHttpRequest;upload=h.upload;h.onreadystatechange=function(){h.readyState==4&&t(h.responseText)};if(upload)upload.onprogress=function(A){v(A.loaded)};else v(-1);h.open("POST",o);h.setRequestHeader("Content-Type",
|
||||
"application/octet-stream");h.setRequestHeader("Content-Disposition",'attachment; name="'+a+'"; filename="'+s.fileName+'"');h.sendAsBinary?h.sendAsBinary(s.getAsBinary()):h.send(s)}function l(s){m&&m({loaded:k+s,total:n})}for(var h,i=0,f=c.length,k=0,n=0,q=this,r=0;r<f;r++)n+=c[r].fileSize;this.remove=function(){if(h){h.abort();h=null}};this.uploadNext=function(s){if(s){k+=c[i-1].fileSize;l(0)}if((!s||s&&g(s,i==f)==true)&&i<f)j(c[i++],d,q.uploadNext,function(o){l(o)})};this.start=function(){q.uploadNext()}};
|
||||
this.showIframeModal=function(a,c,d,g,m,j){c=e('<iframe frameborder="0" src="'+c.replace(/{editorRoot}/ig,U)+'" style="width:100%;height:100%;display:none;" /><div class="xheModalIfmWait"></div>');var l=e(c[0]),h=e(c[1]);b.showModal(a,c,g,m,j);l.load(function(){var i=l[0].contentWindow,f=e(i.document);i.callback=function(k){b.removeModal();d(k)};f.keydown(b.modalEscCheck);l.show();h.remove()})};this.showModal=function(a,c,d,g,m){if(e(".xheModal").length==1)return false;var j,l,h,i,f;d=d?d:b.settings.modalWidth;
|
||||
g=g?g:b.settings.modalHeight;i=b.settings.layerShadow;j=e('<div class="xheModal" style="width:'+(d-1)+"px;height:"+g+"px;margin-left:-"+Math.ceil(d/2)+"px;"+(D&&wa<=7?"":"margin-top:-"+Math.ceil(g/2)+"px")+'">'+(b.settings.modalTitle?'<div class="xheModalTitle"><span class="xheModalClose" title="\u5173\u95ed (Esc)"></span>'+a+"</div>":"")+'<div class="xheModalContent"></div></div>').appendTo("body");h=e('<div class="xheModalOverlay"></div>').appendTo("body");if(i>0)l=e('<div class="xheModalShadow" style="width:'+
|
||||
j.outerWidth()+"px;height:"+j.outerHeight()+"px;margin-left:-"+(Math.ceil(d/2)-i-2)+"px;"+(D&&wa<=7?"":"margin-top:-"+(Math.ceil(g/2)-i-2)+"px")+'"></div>').appendTo("body");e(".xheModalContent",j).css("height",g-(b.settings.modalTitle?e(".xheModalTitle").outerHeight():0)).html(c);if(D&&wa==6)f=e("select:visible").css("visibility","hidden");this.removeModal=function(){f&&f.css("visibility","visible");e(document).unbind("keydown",b.modalEscCheck);j.remove();i>0&&l.remove();h.remove();m&&m()};this.modalEscCheck=
|
||||
function(k){if(k.which==27){b.removeModal();return false}};e(document).keydown(b.modalEscCheck);e(".xheModalClose",j).click(b.removeModal);h.show();i>0&&l.show();j.show()};this.showDialog=function(a){var c=e('<div class="xheDialog"></div>');a=e(a);var d=e("#xheSave",a);if(d.length==1){a.find("input[type=text],select").keypress(function(j){if(j.which==13){d.click();return false}});a.find("textarea").keydown(function(j){if(j.ctrlKey&&j.which==13){d.click();return false}});d.after(' <input type="button" id="xheCancel" value="\u53d6\u6d88" />');
|
||||
e("#xheCancel",a).click(b.hidePanel);if(!b.settings.clickCancelDialog){pa=false;var g=e('<div class="xheFixCancel"></div>').appendTo("body").mousedown(W),m=O.offset();g.css({left:m.left,top:m.top,width:O.outerWidth(),height:O.outerHeight()})}c.mousedown(function(){la=true})}c.append(a);b.showPanel(c);D||setTimeout(function(){c.find("input[type=text],textarea").filter(":visible").filter(function(){return e(this).css("visibility")!="hidden"}).eq(0).focus()},10)};this.showPanel=function(a){if(!M.target)return false;
|
||||
L.empty().append(a).css("left",-999).css("top",-999);ga=e(M.target).closest("a").addClass("xheActive");var c=ga.offset();a=c.left;c=c.top;c+=ga.outerHeight()-1;fa.css({left:a+1,top:c}).show();if(a+L.outerWidth()>document.body.clientWidth)a-=L.outerWidth()-ga.outerWidth();var d=b.settings.layerShadow;d>0&&ea.css({left:a+d,top:c+d,width:L.outerWidth(),height:L.outerHeight()}).show();L.css("left",a).css("top",c).show();Fa=T=true};this.hidePanel=function(){if(T){ga.removeClass("xheActive");ea.hide();
|
||||
fa.hide();L.hide();T=false;if(!pa){e(".xheFixCancel").remove();pa=true}Fa=la=false;X=null}};this.exec=function(a){b.hidePanel();b.saveBookmark();var c=ha[a];if(!c)return false;if(M==null){M={};var d=J.find(".xheButton[name="+a+"]");if(d.length==1)M.target=d}if(c.e)c.e.call(b);else{a=a.toLowerCase();switch(a){case "cut":try{w.execCommand(a);if(!w.queryCommandSupported(a))throw"Error";}catch(g){alert("\u60a8\u7684\u6d4f\u89c8\u5668\u5b89\u5168\u8bbe\u7f6e\u4e0d\u5141\u8bb8\u4f7f\u7528\u526a\u5207\u64cd\u4f5c\uff0c\u8bf7\u4f7f\u7528\u952e\u76d8\u5feb\u6377\u952e(Ctrl + X)\u6765\u5b8c\u6210")}break;
|
||||
case "copy":try{w.execCommand(a);if(!w.queryCommandSupported(a))throw"Error";}catch(m){alert("\u60a8\u7684\u6d4f\u89c8\u5668\u5b89\u5168\u8bbe\u7f6e\u4e0d\u5141\u8bb8\u4f7f\u7528\u590d\u5236\u64cd\u4f5c\uff0c\u8bf7\u4f7f\u7528\u952e\u76d8\u5feb\u6377\u952e(Ctrl + C)\u6765\u5b8c\u6210")}break;case "paste":try{w.execCommand(a);if(!w.queryCommandSupported(a))throw"Error";}catch(j){alert("\u60a8\u7684\u6d4f\u89c8\u5668\u5b89\u5168\u8bbe\u7f6e\u4e0d\u5141\u8bb8\u4f7f\u7528\u7c98\u8d34\u64cd\u4f5c\uff0c\u8bf7\u4f7f\u7528\u952e\u76d8\u5feb\u6377\u952e(Ctrl + V)\u6765\u5b8c\u6210")}break;
|
||||
case "pastetext":window.clipboardData?b.pasteText(window.clipboardData.getData("Text",true)):b.showPastetext();break;case "blocktag":var l=[];e.each($a,function(f,k){l.push({s:"<"+k.n+">"+k.t+"</"+k.n+">",v:"<"+k.n+">",t:k.t})});b.showMenu(l,function(f){b._exec("formatblock",f)});break;case "fontface":var h=[];e.each(ab,function(f,k){k.c=k.c?k.c:k.n;h.push({s:'<span style="font-family:'+k.c+'">'+k.n+"</span>",v:k.c,t:k.n})});b.showMenu(h,function(f){b._exec("fontname",f)});break;case "fontsize":var i=
|
||||
[];e.each(N,function(f,k){i.push({s:'<span style="font-size:'+k.s+';">'+k.t+"("+k.s+")</span>",v:f+1,t:k.t})});b.showMenu(i,function(f){b._exec("fontsize",f)});break;case "fontcolor":b.showColor(function(f){b._exec("forecolor",f)});break;case "backcolor":b.showColor(function(f){if(D)b._exec("backcolor",f);else{za(true);b._exec("hilitecolor",f);za(false)}});break;case "align":b.showMenu(bb,function(f){b._exec(f)});break;case "list":b.showMenu(cb,function(f){b._exec(f)});break;case "link":b.showLink();
|
||||
break;case "img":b.showImg();break;case "flash":b.showEmbed("Flash",'<div>\u52a8\u753b\u6587\u4ef6: <input type="text" id="xheFlashSrc" value="http://" class="xheText" /></div><div>\u5bbd\u5ea6\u9ad8\u5ea6: <input type="text" id="xheFlashWidth" style="width:40px;" value="480" /> x <input type="text" id="xheFlashHeight" style="width:40px;" value="400" /></div><div style="text-align:right;"><input type="button" id="xheSave" value="\u786e\u5b9a" /></div>',"application/x-shockwave-flash","clsid:d27cdb6e-ae6d-11cf-96b8-4445535400000",
|
||||
' wmode="opaque" quality="high" menu="false" play="true" loop="true" allowfullscreen="true"',b.settings.upFlashUrl,b.settings.upFlashExt);break;case "media":b.showEmbed("Media",'<div>\u5a92\u4f53\u6587\u4ef6: <input type="text" id="xheMediaSrc" value="http://" class="xheText" /></div><div>\u5bbd\u5ea6\u9ad8\u5ea6: <input type="text" id="xheMediaWidth" style="width:40px;" value="480" /> x <input type="text" id="xheMediaHeight" style="width:40px;" value="400" /></div><div style="text-align:right;"><input type="button" id="xheSave" value="\u786e\u5b9a" /></div>',
|
||||
"application/x-mplayer2","clsid:6bf52a52-394a-11d3-b153-00c04f79faa6",' enablecontextmenu="false" autostart="false"',b.settings.upMediaUrl,b.settings.upMediaExt);break;case "emot":b.showEmot();break;case "table":b.showTable();break;case "source":b.toggleSource();break;case "print":R.print();break;case "fullscreen":b.toggleFullscreen();break;case "about":b.showAbout();break;default:b._exec(a);break}}M=null};this._exec=function(a,c,d){d||b.focus();return c!=undefined?w.execCommand(a,false,c):w.execCommand(a,
|
||||
false,null)}};e(function(){e.fn.oldVal=e.fn.val;e.fn.val=function(C){var F=this,G;if(C===undefined)return this[0]&&(G=this[0].xheditor)?G.getSource():F.oldVal(C);return this.each(function(){(G=this.xheditor)?G.setSource(C):F.oldVal(C)})};e("textarea").each(function(){var C=e(this),F=C.attr("class").match(/(?:^|\s)xheditor(?:\-(m?full|simple|mini))?(?:\s|$)/i);if(F)C.xheditor(F[1]?{tools:F[1]}:null)})})})(jQuery);
|
||||
96
trunk/www/js/jquery/xheditor/xheditor-zh-tw.min.js
vendored
Normal file
@@ -0,0 +1,96 @@
|
||||
(function(e){if(e.xheditor)return false;e.fn.xheditor=function(C){var F=[];this.each(function(){if(e.nodeName(this,"TEXTAREA"))if(C===false){if(this.xheditor){this.xheditor.remove();this.xheditor=null}}else if(!this.xheditor){var G=/({.*})/.exec(e(this).attr("class"));if(G){try{G=eval("("+G[1]+")")}catch(Q){}C=e.extend({},G,C)}G=new e.xheditor(this,C);if(G.init()){this.xheditor=G;F.push(G)}}});if(F.length==0)F=false;if(F.length==1)F=F[0];return F};var Y=0,wa=e.browser.version,D=e.browser.msie,oa=
|
||||
e.browser.mozilla,Z=e.browser.safari,Xa=e.browser.opera,T=false,pa=true,L,ea,fa,ga,xa,U;e("script[src*=xheditor]").each(function(){var C=this.src;if(C.match(/xheditor[^\/]*\.js/i)){U=C.replace(/[\?#].*$/,"").replace(/(^|[\/\\])[^\/]*$/,"$1");return false}});var Ya={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"},Za=["#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"],$a=[{n:"p",t:"\u666e\u901a\u6bb5\u843d"},{n:"h1",t:"\u6a19\u984c1"},{n:"h2",t:"\u6a19\u984c2"},{n:"h3",t:"\u6a19\u984c3"},{n:"h4",t:"\u6a19\u984c4"},{n:"h5",t:"\u6a19\u984c5"},{n:"h6",t:"\u6a19\u984c6"},{n:"pre",t:"\u5df2\u7de8\u6392\u683c\u5f0f"},
|
||||
{n:"address",t:"\u5730\u5740"}],ab=[{n:"\u65b0\u7d30\u660e\u9ad4",c:"PMingLiu"},{n:"\u7d30\u660e\u9ad4",c:"mingliu"},{n:"\u6a19\u6977\u9ad4",c:"DFKai-SB"},{n:"\u5fae\u8edf\u6b63\u9ed1\u9ad4",c:"Microsoft JhengHei"},{n:"Arial"},{n:"Arial Narrow"},{n:"Arial Black"},{n:"Comic Sans MS"},{n:"Courier New"},{n:"System"},{n:"Times New Roman"},{n:"Tahoma"},{n:"Verdana"}],N=[{n:"xx-small",wkn:"x-small",s:"8pt",t:"\u6975\u5c0f"},{n:"x-small",wkn:"small",s:"10pt",t:"\u7279\u5c0f"},{n:"small",wkn:"medium",s:"12pt",
|
||||
t:"\u5c0f"},{n:"medium",wkn:"large",s:"14pt",t:"\u4e2d"},{n:"large",wkn:"x-large",s:"18pt",t:"\u5927"},{n:"x-large",wkn:"xx-large",s:"24pt",t:"\u7279\u5927"},{n:"xx-large",wkn:"-webkit-xxx-large",s:"36pt",t:"\u6975\u5927"}],bb=[{s:"\u9760\u5de6\u5c0d\u9f4a",v:"justifyleft"},{s:"\u7f6e\u4e2d",v:"justifycenter"},{s:"\u9760\u53f3\u5c0d\u9f4a",v:"justifyright"},{s:"\u5de6\u53f3\u5c0d\u9f4a",v:"justifyfull"}],cb=[{s:"\u6578\u5b57\u5217\u8868",v:"insertOrderedList"},{s:"\u7b26\u865f\u5217\u8868",v:"insertUnorderedList"}],
|
||||
db={"default":{name:"\u9810\u8a2d",width:24,height:24,line:7,list:{smile:"\u5fae\u7b11",tongue:"\u5410\u820c\u982d",titter:"\u5077\u7b11",laugh:"\u5927\u7b11",sad:"\u96e3\u904e",wronged:"\u59d4\u5c48",fastcry:"\u5feb\u54ed\u4e86",cry:"\u54ed",wail:"\u5927\u54ed",mad:"\u751f\u6c23",knock:"\u6572\u6253",curse:"\u7f75\u4eba",crazy:"\u6293\u72c2",angry:"\u767c\u706b",ohmy:"\u9a5a\u8a1d",awkward:"\u5c37\u5c2c",panic:"\u9a5a\u6050",shy:"\u5bb3\u7f9e",cute:"\u53ef\u6190",envy:"\u7fa8\u6155",proud:"\u5f97\u610f",
|
||||
struggle:"\u596e\u9b25",quiet:"\u5b89\u975c",shutup:"\u9589\u5634",doubt:"\u7591\u554f",despise:"\u9119\u8996",sleep:"\u7761\u89ba",bye:"\u518d\u898b"}}},ha={Cut:{t:"\u526a\u4e0b (Ctrl+X)"},Copy:{t:"\u8907\u88fd (Ctrl+C)"},Paste:{t:"\u8cbc\u4e0a (Ctrl+V)"},Pastetext:{t:"\u8cbc\u4e0a\u6587\u672c",h:D?0:1},Blocktag:{t:"\u6bb5\u843d\u6a19\u7c64",h:1},Fontface:{t:"\u5b57\u578b",h:1},FontSize:{t:"\u5b57\u578b\u5927\u5c0f",h:1},Bold:{t:"\u7c97\u9ad4 (Ctrl+B)",s:"Ctrl+B"},Italic:{t:"\u659c\u9ad4 (Ctrl+I)",
|
||||
s:"Ctrl+I"},Underline:{t:"\u5e95\u7dda (Ctrl+U)",s:"Ctrl+U"},Strikethrough:{t:"\u522a\u9664\u7dda (Ctrl+S)",s:"Ctrl+S"},FontColor:{t:"\u5b57\u578b\u984f\u8272",h:1},BackColor:{t:"\u80cc\u666f\u984f\u8272",h:1},SelectAll:{t:"\u5168\u9078 (Ctrl+A)"},Removeformat:{t:"\u522a\u9664\u6587\u5b57\u683c\u5f0f"},Align:{t:"\u5c0d\u9f4a",h:1},List:{t:"\u5217\u8868",h:1},Outdent:{t:"\u6e1b\u5c11\u7e2e\u6392 (Shift+Tab)",s:"Shift+Tab"},Indent:{t:"\u589e\u52a0\u7e2e\u6392 (Tab)",s:"Tab"},Link:{t:"\u8d85\u9023\u7d50 (Ctrl+K)",
|
||||
s:"Ctrl+K",h:1},Unlink:{t:"\u53d6\u6d88\u8d85\u9023\u7d50"},Img:{t:"\u5716\u7247",h:1},Flash:{t:"Flash\u52d5\u756b",h:1},Media:{t:"\u591a\u5a92\u9ad4\u6587\u4ef6",h:1},Emot:{t:"\u8868\u60c5",s:"ctrl+e",h:1},Table:{t:"\u8868\u683c",h:1},Source:{t:"\u539f\u59cb\u78bc"},Print:{t:"\u6253\u5370 (Ctrl+P)",s:"Ctrl+P"},Fullscreen:{t:"\u5168\u87a2\u5e55\u7de8\u8f2f (Esc)",s:"Esc"},About:{t:"\u95dc\u65bc xhEditor"}},ya={mini:"Bold,Italic,Underline,Strikethrough,Separator,Align,List,Separator,Link,Img,About",
|
||||
simple:"Blocktag,Fontface,FontSize,Bold,Italic,Underline,Strikethrough,FontColor,BackColor,Separator,Align,List,Outdent,Indent,Separator,Link,Img,Emot,About",full:"Cut,Copy,Paste,Pastetext,Separator,Blocktag,Fontface,FontSize,Bold,Italic,Underline,Strikethrough,FontColor,BackColor,SelectAll,Removeformat,Separator,Align,List,Outdent,Indent,Separator,Link,Unlink,Img,Flash,Media,Emot,Table,Separator,Source,Print,Fullscreen,About"};ya.mfull=ya.full.replace(/Separator(,Align)/i,"BtnBr$1");e.xheditor=function(C,
|
||||
F){function G(){setTimeout(b.setSource,10)}function Q(){b.getSource()}function eb(){if(D&&!H){var a;a=xa[0].contentWindow.document.body;a.innerHTML="";a.createTextRange().execCommand("Paste");a=a.innerHTML;if(!a.match(/mso-|MsoNormal/i))return true;if(a.indexOf(" ")==0)a=a.substring(6);a=b.cleanHTML(a);a=b.formatXHTML(a);a=b.cleanWord(a);b.pasteHTML(a);return false}}function za(a){try{b._exec("styleWithCSS",a,true)}catch(c){try{b._exec("useCSS",!a,true)}catch(d){}}}function Aa(){if(Ba&&!H){za(false);
|
||||
try{b._exec("enableObjectResizing",true,true)}catch(a){}if(D)try{b._exec("BackgroundImageCache",true,true)}catch(c){}}}function fb(a){if(H||a.which!=13||a.shiftKey||a.ctrlKey||a.altKey)return true;a=b.getParent("p,h1,h2,h3,h4,h5,h6,pre,address,div,li");if(a.is("li"))return true;if(b.settings.forcePtag)a.length==0&&b._exec("formatblock","<p>");else{b.pasteHTML("<br />");return false}}function Ca(){if(!oa&&!Z){ia&&O.height("100%").css("height",O.outerHeight()-J.outerHeight());D&&J.hide().show()}}function gb(a){a=
|
||||
a.target;if(a.tagName.match(/(img|embed)/i)){var c=b.getSel(),d=b.getRng();d.selectNode(a);c.removeAllRanges();c.addRange(d)}}function V(a,c,d){if(!c)return false;var g="_xhe_"+c;d&&a.attr(c,d).removeAttr(g).attr(g,d);return a.attr(g)||a.attr(c)}function Ia(){pa&&b.hidePanel()}function hb(a){if(H)return true;var c=a.which,d=Ya[c];c=d?d:String.fromCharCode(c).toLowerCase();sKey="";sKey+=a.ctrlKey?"ctrl+":"";sKey+=a.altKey?"alt+":"";sKey+=a.shiftKey?"shift+":"";sKey+=c;a=ja[sKey];var g;for(g in a){g=
|
||||
a[g];if(e.isFunction(g)){if(g.call(b)===false)return false}else{b.exec(g);return false}}}function $(a,c){var d=typeof a;if(!c)return d!="undefined";if(c=="array"&&a.hasOwnProperty&&a instanceof Array)return true;return d==c}function Da(a,c){var d=location.protocol,g=location.hostname,m=location.port,j=location.pathname.replace(/\\/g,"/").replace(/[^\/]+$/i,"");m=m==""?"80":m;a=e.trim(a);if(d=="file:")c="abs";if(c!="abs")a=a.replace(RegExp(d+"\\/\\/"+g.replace(/\./g,"\\.")+"(?::"+m+")"+(m=="80"?"?":
|
||||
"")+"(/|$)","i"),"/");if(c=="rel")a=a.replace(RegExp("^"+j.replace(/([\/\.\+\[\]\(\)])/g,"\\$1"),"i"),"");if(c!="rel")a.match(/^((https?|file):\/\/|\/)/i)||(a=j+a);if(c=="abs")a.match(/(https?|file):\/\//i)||(a=d+"//"+location.host+a);return a}function Ja(a){var c=Math.floor(Math.log(a)/Math.log(1024));return(a/Math.pow(1024,Math.floor(c))).toFixed(2)+["Byte","KB","MB","GB","TB","PB"][c]}function W(){return false}var b=this,P=e(C),Ka=P.closest("form"),J,O,R,qa,w,ra,aa,Ba=false,H=false,ia=false,La,
|
||||
ka=false,Ma="",M=null,Ea,la=false,Fa=false,ba=null,X=null,S=0;this.settings=e.extend({},{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:"\u9ede\u64ca\u6253\u958b\u93c8\u63a5",layerShadow:3,emotMark:false,upBtnText:"\u4e0a\u50b3",
|
||||
wordDeepClean:true,hoverExecDelay:100,html5Upload:true,upMultiple:99},F);var sa=b.settings.plugins,ta=[];if(sa){ha=e.extend({},ha,sa);e.each(sa,function(a){ta.push(a)});ta=ta.join(",")}if(b.settings.tools.match(/^\s*(m?full|simple|mini)\s*$/i)){var Na=ya[e.trim(b.settings.tools)];b.settings.tools=b.settings.tools.match(/m?full/i)&&sa?Na.replace("Table","Table,"+ta):Na}b.settings.tools.match(/(^|,)\s*About\s*(,|$)/i)||(b.settings.tools+=",About");b.settings.tools=b.settings.tools.split(",");U=Da(U,
|
||||
"abs");var Oa="xheCSS_"+b.settings.skin,ma="xhe"+Y+"_container",Pa="xhe"+Y+"_Tool",Qa="xhe"+Y+"_iframearea",Ra="xhe"+Y+"_iframe",ua="xhe"+Y+"_fixffcursor",ca="",Ga=U+"xheditor_skin/"+b.settings.skin+"/",va=db,Sa=Da(U,"rel")+"xheditor_emot/",Ha="";va=e.extend({},va,b.settings.emots);if(ka=b.settings.showBlocktag)ca+=" showBlocktag";var ja=[];this.init=function(){e("#"+Oa).length==0&&e("head").append('<link id="'+Oa+'" rel="stylesheet" type="text/css" href="'+Ga+'ui.css" />');var a=b.settings.width||
|
||||
C.style.width||P.outerWidth();S=b.settings.height||C.style.height||P.outerHeight();if($(S,"string"))S=S.replace(/[^\d]+/g,"");if(a<=0||S<=0){alert("\u7576\u524dtextarea\u8655\u65bc\u96b1\u85cf\u72c0\u614b\uff0c\u8acb\u5c07\u4e4b\u986f\u793a\u5f8c\u518d\u521d\u59cb\u5316xhEditor\uff0c\u6216\u8005\u76f4\u63a5\u8a2d\u7f6etextarea\u7684width\u548cheight\u6a23\u5f0f");return false}if(/^[0-9\.]+$/i.test(""+a))a+="px";var c=['<span class="xheGStart"/>'],d,g,m=/Separator|BtnBr/i;e.each(b.settings.tools,function(i,
|
||||
f){d=ha[f];f.match(m)&&c.push('<span class="xheGEnd"/>');if(f=="Separator")c.push('<span class="xheSeparator"/>');else if(f=="BtnBr")c.push("<br />");else{g=d.c?d.c:"xheIcon xheBtn"+f;c.push('<span><a href="javascript:void(0);" title="'+d.t+'" name="'+f+'" class="xheButton xheEnabled" tabindex="-1"><span class="'+g+'" unselectable="on" /></a></span>');d.s&&b.addShortcuts(d.s,f)}f.match(m)&&c.push('<span class="xheGStart"/>')});c.push('<span class="xheGEnd"/><br />');P.after(e('<input type="text" id="'+
|
||||
ua+'" style="position:absolute;display:none;" /><span id="'+ma+'" class="xhe_'+b.settings.skin+'" style="display:none"><table cellspacing="0" cellpadding="0" class="xheLayout" style="width:'+a+";height:"+S+'px;"><tbody><tr><td id="'+Pa+'" class="xheTool" unselectable="on" style="height:1px;"></td></tr><tr><td id="'+Qa+'" class="xheIframeArea"><iframe frameborder="0" id="'+Ra+'" src="javascript:;" style="width:100%;"></iframe></td></tr></tbody></table></span>'));J=e("#"+Pa);O=e("#"+Qa);a='<html><head><base /><meta content="text/html; charset=UTF-8" http-equiv="Content-Type"/><link rel="stylesheet" href="'+
|
||||
Ga+'iframe.css"/>';var j=b.settings.loadCSS;if(j)if($(j,"array"))for(var l in j)a+='<link rel="stylesheet" href="'+j[l]+'"/>';else a+=j.match(/\s*<style(\s+[^>]*?)?>[\s\S]+?<\/style>\s*/i)?j:'<link rel="stylesheet" href="'+j+'"/>';a+='</head><body spellcheck="false" dir="ltr" class="editMode'+ca+'"></body></html>';b.win=R=e("#"+Ra)[0].contentWindow;qa=e(R);try{this.doc=w=R.document;ra=e(w);w.open();w.write(a);w.close();if(D)w.body.contentEditable="true";else w.designMode="On"}catch(h){}setTimeout(Aa,
|
||||
300);b.setSource();R.setInterval=null;J.append(c.join("")).bind("mousedown contextmenu",W).click(function(i){var f=e(i.target).closest("a");if(f.is(".xheEnabled")){M=i;b.exec(f.attr("name"))}return false});J.find(".xheButton").hover(function(i){var f=e(this),k=b.settings.hoverExecDelay,n=X;X=null;if(k==-1||la||!f.is(".xheEnabled"))return false;if(n&&n>10){la=true;setTimeout(function(){la=false},100);return false}var q=f.attr("name");if(ha[q].h!=1){b.hidePanel();return false}if(Fa)k=0;if(k>=0)Ea=setTimeout(function(){M=
|
||||
i;ba={x:M.clientX,y:M.clientY};b.exec(q)},k)},function(){ba=null;Ea&&clearTimeout(Ea)}).mousemove(function(i){if(ba){var f={x:i.clientX-ba.x,y:i.clientY-ba.y};if(Math.abs(f.x)>1||Math.abs(f.y)>1){if(f.x>0&&f.y>0){f=Math.round(Math.atan(f.y/f.x)/0.017453293);X=X?(X+f)/2:f}else X=null;ba={x:i.clientX,y:i.clientY}}}});L=e("#xhePanel");ea=e("#xheShadow");fa=e("#xheCntLine");xa=e("#xheTempIframe");if(L.length==0){L=e('<div id="xhePanel"></div>').mousedown(function(i){i.stopPropagation()});ea=e('<div id="xheShadow"></div>');
|
||||
fa=e('<div id="xheCntLine"></div>');setTimeout(function(){e(document.body).append(L).append(ea).append(fa);if(D)e(document.body).append(xa=e('<iframe id="xheTempIframe" class="xheHideArea" />'))},10)}e(document).mousedown(Ia);ra.mousedown(Ia);e("#"+ma).show();O.css("height",S-J.outerHeight());P.hide();P.focus(b.focus);Ka.submit(Q).bind("reset",G);l=e(window);l.unload(Q).bind("beforeunload",Q);l.resize(Ca);qa.focus(function(){b.settings.focus&&b.settings.focus()}).blur(function(){b.settings.blur&&
|
||||
b.settings.blur()});Z&&qa.click(gb);ra.keydown(hb).keypress(fb).bind("mousedown click",function(i){P.trigger(i.type)});e("body",ra).bind("paste",eb);(l=b.settings.shortcuts)&&e.each(l,function(i,f){b.addShortcuts(i,f)});Y++;Ba=true;if(b.settings.fullscreen)b.toggleFullscreen();else b.settings.sourceMode&&setTimeout(b.toggleSource,20);return true};this.remove=function(){b.hidePanel();Q();P.unbind("focus",b.focus);Ka.unbind("submit",Q).unbind("reset",G);var a=e(window);a.unbind("unload",Q).unbind("beforeunload",
|
||||
Q);a.unbind("resize",Ca);e("#"+ma).remove();e("#"+ua).remove();P.show();Ba=false};this.saveBookmark=function(){H||(aa=b.getRng())};this.loadBookmark=function(){if(!(H||!aa)){b.focus();if(D)aa.select();else{var a=b.getSel();a.removeAllRanges();a.addRange(aa)}aa=null}};this.focus=function(){H?e("#sourceCode",w).focus():qa.focus();return false};this.setCursorFirst=function(a){b.focus();R.scrollTo(0,0);var c=b.getRng(),d=w.body,g=d,m;if(a&&g.firstChild&&(m=g.firstChild.tagName)&&m.match(/^p|div|h[1-6]$/i))g=
|
||||
d.firstChild;D?c.moveToElementText(g):c.setStart(g,0);c.collapse(true);if(D)c.select();else{a=b.getSel();a.removeAllRanges();a.addRange(c)}};this.getSel=function(){return R.getSelection?R.getSelection():w.selection};this.getRng=function(){var a=b.getSel(),c;try{c=a.rangeCount>0?a.getRangeAt(0):a.createRange?a.createRange():w.createRange()}catch(d){}c||(c=D?w.body.createTextRange():w.createRange());return c};this.getParent=function(a){var c=b.getRng(),d;if(D)d=c.item?c.item(0):c.parentElement();else{d=
|
||||
c.commonAncestorContainer;if(!c.collapsed)if(c.startContainer==c.endContainer&&c.startOffset-c.endOffset<2&&c.startContainer.hasChildNodes())d=c.startContainer.childNodes[c.startOffset]}a=a?a:"*";d=e(d);d.is(a)||(d=e(d).closest(a));return d};this.getSelect=function(a){var c=b.getSel(),d=b.getRng(),g=true;g=!d||d.item?false:!c||d.boundingWidth==0||d.collapsed;if(a=="text")return g?"":d.text||(c.toString?c.toString():"");if(d.cloneContents){a=e("<div></div>");(d=d.cloneContents())&&a.append(d);d=a.html()}else d=
|
||||
$(d.item)?d.item(0).outerHTML:$(d.htmlText)?d.htmlText:d.toString();if(g)d="";d=b.processHTML(d,"read");d=b.cleanHTML(d);return d=b.formatXHTML(d)};this.pasteHTML=function(a,c){if(H)return false;b.focus();a=b.processHTML(a,"write");var d=b.getSel(),g=b.getRng();if(c!=undefined){if(g.item){var m=g.item(0);g=w.body.createTextRange();g.moveToElementText(m);g.select()}g.collapse(c)}if(g.insertNode){g.deleteContents();m=g.createContextualFragment(a);var j=m.lastChild;g.insertNode(m);g.setEndAfter(j);g.collapse(false);
|
||||
d.removeAllRanges();d.addRange(g)}else{if(d.type.toLowerCase()=="control"){d.clear();g=b.getRng()}g.pasteHTML(a)}};this.pasteText=function(a,c){a||(a="");a=b.domEncode(a);a=a.replace(/\r?\n/g,"<br />");b.pasteHTML(a,c)};this.appendHTML=function(a){if(H)return false;b.focus();a=b.processHTML(a,"write");e(w.body).append(a)};this.domEncode=function(a){return a.replace(/[<>]/g,function(c){return{"<":"<",">":">"}[c]})};this.setSource=function(a){aa=null;if(typeof a!="string"&&a!="")a=C.value;if(H)e("#sourceCode",
|
||||
w).val(a);else{if(b.settings.beforeSetSource)a=b.settings.beforeSetSource(a);a=b.cleanHTML(a);a=b.formatXHTML(a);a=b.cleanWord(a);w.body.innerHTML=b.processHTML(a,"write")}};this.processHTML=function(a,c){if(c=="write"){a=a.replace(/<img(?:\s+[^>]*?)?(\s+emot\s*=\s*(["']?)\s*(.*?)\s*\2)(?:\s+[^>]*?)?\/?>/ig,function(j,l,h,i){i=i.split(",");if(!i[1]){i[1]=i[0];i[0]=""}if(i[0]=="default")i[0]="";return j.replace(/\s+src\s*=\s*(["']?).*?\1(\s|$|\/|>)/i,"$2").replace(l,' src="'+Sa+(i[0]?i[0]:"default")+
|
||||
"/"+i[1]+'.gif"'+(b.settings.emotMark?' emot="'+(i[0]?i[0]+",":"")+i[1]+'" alt="'+i[1]+'"':""))});a=a.replace(/<(\w+(?:\:\w+)?)(?:\s+[^>]*?)?(\s+(src|href)\s*=\s*(["']?)\s*(.*?)\s*\4)(?:\s+[^>]*?)?\/?>/ig,function(j,l,h,i,f,k){return j.replace(h,h+" _xhe_"+i+'="'+k+'"')});a=a.replace(/<(\/?)del(\s+[^>]*?)?>/ig,"<$1strike$2>");if(oa){a=a.replace(/<(\/?)strong(\s+[^>]*?)?>/ig,"<$1b$2>");a=a.replace(/<(\/?)em(\s+[^>]*?)?>/ig,"<$1i$2>")}else if(Z){a=a.replace(/("|;)\s*font-size\s*:\s*([a-z-]+)(;?)/ig,
|
||||
function(j,l,h,i){for(var f,k=0;k<N.length;k++){j=N[k];if(h==j.n){f=j.wkn;break}}return l+"font-size:"+f+i});a=a.replace(/<strong(\s+[^>]*?)?>/ig,'<span class="Apple-style-span" style="font-weight: bold;"$1>');a=a.replace(/<em(\s+[^>]*?)?>/ig,'<span class="Apple-style-span" style="font-style: italic;"$1>');a=a.replace(/<u(\s+[^>]*?)?>/ig,'<span class="Apple-style-span" style="text-decoration: underline;"$1>');a=a.replace(/<strike(\s+[^>]*?)?>/ig,'<span class="Apple-style-span" style="text-decoration: line-through;"$1>');
|
||||
a=a.replace(/<\/(strong|em|u|strike)>/ig,"</span>");a=a.replace(/<span((?:\s+[^>]*?)?\s+style="([^"]*;)*\s*(font-family|font-size|color|background-color)\s*:\s*[^;"]+\s*;?"[^>]*)>/ig,'<span class="Apple-style-span"$1>')}else if(D){a=a.replace(/'/ig,"'");a=a.replace(/\s+(disabled|checked|readonly|selected)\s*=\s*[\"\']?(false|0)[\"\']?/ig,"")}a=a.replace(/<a(\s+[^>]*?)?\/>/,"<a$1></a>");if(!Z){var d=function(j,l,h,i){l="";var f,k;if(f=h.match(/font-family\s*:\s*([^;"]+)/i))l+=' face="'+f[1]+
|
||||
'"';if(f=h.match(/font-size\s*:\s*([^;"]+)/i)){f=f[1].toLowerCase();for(var n=0;n<N.length;n++)if(f==N[n].n||f==N[n].s){k=n+1;break}if(k){l+=' size="'+k+'"';h=h.replace(/(^|;)(\s*font-size\s*:\s*[^;"]+;?)+/ig,"$1")}}if(k=h.match(/(?:^|[\s;])color\s*:\s*([^;"]+)/i)){if(f=k[1].match(/\s*rgb\s*\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*\)/i)){k[1]="#";for(n=1;n<=3;n++)k[1]+=(f[n]-0).toString(16)}k[1]=k[1].replace(/^#([0-9a-f])([0-9a-f])([0-9a-f])$/i,"#$1$1$2$2$3$3");l+=' color="'+k[1]+'"'}h=h.replace(/(^|;)(\s*(font-family|color)\s*:\s*[^;"]+;?)+/ig,
|
||||
"$1");if(l!=""){if(h)l+=' style="'+h+'"';return"<font"+l+">"+i+"</font>"}else return j};a=a.replace(/<(span)(?:\s+[^>]*?)?\s+style\s*=\s*"((?:[^"]*?;)*\s*(?:font-family|font-size|color)\s*:[^"]*)"(?: [^>]+)?>(((?!<\1(\s+[^>]*?)?>)[\s\S])*?)<\/\1>/ig,d);a=a.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,d);a=a.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,
|
||||
d)}}else{var g=b.settings.localUrl;a=a.replace(/<(?:\w+(?:\:\w+)?)(?:\s+[^>]*?)?\s+_xhe_(src|href)\s*=\s*(["']?)\s*(.*?)\s*\2(?:\s+[^>]*?)?\/?>/ig,function(j,l,h,i){if(g)i=Da(i,g);return j.replace(RegExp("\\s+"+l+"\\s*=\\s*([\"']?).*?\\1(\\s|/?>)","ig")," "+l+'="'+i.replace(/\$/g,"$$$$")+'"$2')});if(Z){a=a.replace(/("|;)\s*font-size\s*:\s*([a-z-]+)(;?)/ig,function(j,l,h,i){for(var f,k=0;k<N.length;k++){j=N[k];if(h==j.wkn){f=j.n;break}}return l+"font-size:"+f+i});var m=[{r:/font-weight:\sbold/ig,t:"strong"},
|
||||
{r:/font-style:\sitalic/ig,t:"em"},{r:/text-decoration:\sunderline/ig,t:"u"},{r:/text-decoration:\sline-through/ig,t:"strike"}];d=function(j,l,h,i,f){l=h+i;h="";for(i=0;i<m.length;i++)if(l.match(m[i].r)){h=m[i].t;break}return h?"<"+h+">"+f+"</"+h+">":j};a=a.replace(/<(span)(\s+[^>]*?)?\s+class\s*=\s*"Apple-style-span"(\s+[^>]*?)?>(((?!<\1(\s+[^>]*?)?>)[\s\S])*?)<\/\1>/ig,d);a=a.replace(/<(span)(\s+[^>]*?)?\s+class\s*=\s*"Apple-style-span"(\s+[^>]*?)?>(((?!<\1(\s+[^>]*?)?>)[\s\S]|<\1(\s+[^>]*?)?>((?!<\1(\s+[^>]*?)?>)[\s\S])*?<\/\1>)*?)<\/\1>/ig,
|
||||
d);a=a.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,d)}a=a.replace(/(<\w+(?:\s+[^>]*?)?)\s+(?:_xhe_|_moz_|_webkit_)[^=]+?\s*=\s*(["']?).*?\2(\s|\/?>)/ig,"$1$3");a=a.replace(/(<\w+[^>]*?)\s+class\s*=\s*(["']?)\s*(?:apple|webkit)\-.+?\s*\2(\s|\/?>)/ig,"$1$3");a=a.replace(/<img(\s+[^>]+?)\/?>/ig,function(j,l){l.match(/\s+alt\s*(["']?).*?\1(\s|$)/i)||
|
||||
(l+=' alt=""');return"<img"+l+" />"})}return a};this.getSource=function(a){var c,d=b.settings.beforeGetSource;if(H){c=e("#sourceCode",w).val();d||(c=c.replace(/(\t*\r?\n\t*)+/g,""))}else{c=b.processHTML(w.body.innerHTML,"read");c=c.replace(/^\s*(?:<(p|div)(?:\s+[^>]*?)?>)?\s*(<br(?:\s+[^>]*?)?>)*\s*(?:<\/\1>)?\s*$/i,"");c=b.cleanHTML(c);c=b.formatXHTML(c,a);c=b.cleanWord(c);if(d)c=d(c)}return C.value=c};this.cleanWord=function(a){if(a.match(/mso(-|normal)/i)){var c=b.settings.wordDeepClean;a=a.replace(/(<link(?:\s+[^>]*?)?)\s+href\s*=\s*(["']?)\s*file:\/\/.+?\s*\2((?:\s+[^>]*?)?\s*\/?>)/ig,
|
||||
"");a=a.replace(/<!--[\s\S]*?--\>|<!(--)?\[[\s\S]+?\](--)?>|<style(\s+[^>]*?)?>[\s\S]*?<\/style>/ig,"");a=a.replace(/<\/?\w+:[^>]*>/ig,"");if(c)a=a.replace(/<\/?(span|a|img)(\s+[^>]*?)?>/ig,"");a=a.replace(/(<\w+(?:\s+[^>]*?)?)\s+class\s*=\s*(["']?)\s*mso.+?\s*\2((?:\s+[^>]*?)?\s*\/?>)/ig,"$1$3");a=a.replace(/(<\w+(?:\s+[^>]*?)?)\s+lang\s*=\s*(["']?)\s*.+?\s*\2((?:\s+[^>]*?)?\s*\/?>)/ig,"$1$3");a=a.replace(/(<\w+(?:\s+[^>]*?)?)\s+align\s*=\s*(["']?)\s*left\s*\2((?:\s+[^>]*?)?\s*\/?>)/ig,"$1$3");a=
|
||||
a.replace(/<\w+(?:\s+[^>]*?)?(\s+style\s*=\s*(["']?)\s*([\s\S]*?)\s*\2)(?:\s+[^>]*?)?\s*\/?>/ig,function(d,g,m,j){j=e.trim(j.replace(/\s*(mso-[^:]+:.+?|margin\s*:\s*0cm 0cm 0pt\s*|(text-align|font-variant|line-height)\s*:\s*.+?)(;|$)\s*/ig,""));return d.replace(g,c?"":j?' style="'+j+'"':"")})}return a};this.cleanHTML=function(a){a=a.replace(/<!?\/?(DOCTYPE|html|body|meta)(\s+[^>]*?)?>/ig,"");var c;a=a.replace(/<head(?:\s+[^>]*?)?>([\s\S]*?)<\/head>/i,function(d,g){c=g.match(/<(script|style)(\s+[^>]*?)?>[\s\S]*?<\/\1>/ig);
|
||||
return""});if(c)a=c.join("")+a;a=a.replace(/<\??xml(:\w+)?(\s+[^>]*?)?>([\s\S]*?<\/xml>)?/ig,"");b.settings.linkTag||(a=a.replace(/<link(\s+[^>]*?)?>/ig,""));b.settings.internalScript||(a=a.replace(/<script(\s+[^>]*?)?>[\s\S]*?<\/script>/ig,""));b.settings.inlineScript||(a=a.replace(/(<\w+)(\s+[^>]*?)?\s+on(?:click|dblclick|mousedown|mouseup|mousemove|mouseover|mouseout|mouseenter|mouseleave|keydown|keypress|keyup|change|select|submit|reset|blur|focus|load|unload)\s*=\s*(["']?).*?\3((?:\s+[^>]*?)?\/?>)/ig,
|
||||
"$1$2$4"));b.settings.internalStyle||(a=a.replace(/<style(\s+[^>]*?)?>[\s\S]*?<\/style>/ig,""));b.settings.inlineStyle||(a=a.replace(/(<\w+)(\s+[^>]*?)?\s+(style|class)\s*=\s*(["']?).*?\4((?:\s+[^>]*?)?\/?>)/ig,"$1$2$5"));return a=a.replace(/<\/(strong|b|u|strike|em|i)>((?:\s|<br\/?>| )*?)<\1(\s+[^>]*?)?>/ig,"$2")};this.formatXHTML=function(a,c){function d(p){var x={};p=p.split(",");for(var E=0;E<p.length;E++)x[p[E]]=true;return x}function g(p){if(p){p=p.toLowerCase();var x=o[p];if(x)p=x}else p=
|
||||
"";return p}function m(p,x,E){p=g(p);if(k[p])for(;y.last()&&n[y.last()];)j(y.last());q[p]&&y.last()==p&&j(p);(E=f[p]||!!E)||y.push(p);var I=[];I.push("<"+p);x.replace(A,function(Ta,na,Ua,Va,Wa){na=na.toLowerCase();I.push(" "+na+'="'+(Ua?Ua:Va?Va:Wa?Wa:r[na]?na:"")+'"')});I.push((E?" /":"")+">");l(I.join(""),p,true)}function j(p){if(p){p=g(p);for(x=y.length-1;x>=0;x--)if(y[x]==p)break}else var x=0;if(x>=0){for(p=y.length-1;p>=x;p--)l("</"+y[p]+">",y[p]);y.length=x}}function l(p,x,E){if(c==true){p=
|
||||
p.replace(/(\t*\r?\n\t*)+/g,"");if(!p.match(/^\s*$/)){var I=k[x],Ta=I?x:"";if(I){E&&K++;da==""&&K--}else da&&K++;if(Ta!=da||I)h();B.push(p);x=="br"&&h();if(I&&(f[x]||!E))K--;da=I?x:"";ib=E}}else B.push(p)}function h(){B.push("\r\n");if(K>0)for(var p=K;p--;)B.push("\t")}function i(p,x,E,I){p="";if(x=E.match(/ face\s*=\s*"\s*([^"]+)\s*"/i))p+="font-family:"+x[1]+";";if(x=E.match(/ size\s*=\s*"\s*(\d+)\s*"/i))p+="font-size:"+N[(x[1]>7?7:x[1]<1?1:x[1])-1].n+";";if(x=E.match(/ color\s*=\s*"\s*([^"]+)\s*"/i))p+=
|
||||
"color:"+x[1]+";";if(E=E.match(/ style\s*=\s*"\s*([^"]+)\s*"/i))p+=E[1];if(p)I='<span style="'+p+'">'+I+"</span>";return I}var f=d("area,base,basefont,br,col,frame,hr,img,input,isindex,link,meta,param,embed"),k=d("address,applet,blockquote,button,center,dd,dir,div,dl,dt,fieldset,form,frameset,hr,iframe,ins,isindex,li,map,menu,noframes,noscript,object,ol,p,pre,script,table,tbody,td,tfoot,th,thead,tr,ul"),n=d("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"),
|
||||
q=d("colgroup,dd,dt,li,options,p,td,tfoot,th,thead,tr"),r=d("checked,compact,declare,defer,disabled,ismap,multiple,nohref,noresize,noshade,nowrap,readonly,selected"),s=d("script,style"),o={b:"strong",i:"em",s:"del",strike:"del"},t=/^<\??(\w+(?:\:\w+)?)((?:\s+[\w-\:]*(?:\s*=\s*(?:(?:"[^"]*")|(?:'[^']*')|[^>\s]+))?)*)\s*(\/?)>/,v=/^<\/(\w+(?:\:\w+)?)[^>]*>/,A=/([\w-(?:\:\w+)?]+)(?:\s*=\s*(?:(?:"((?:\\.|[^"])*)")|(?:'((?:\\.|[^'])*)')|([^>\s]+)))?/g,u=0,y=[],z=a,B=[],K=-1,da="body",ib;for(y.last=function(){return this[this.length-
|
||||
1]};z.length>0;)if(!y.last()||!s[y.last()]){u=0;if(z.substring(0,4)=="<!--"){u=z.indexOf("--\>");if(u!=-1){u+=3;l(z.substring(0,u))}}else if(z.substring(0,2)=="</"){if(match=z.match(v)){j(match[1]);u=match[0].length}}else if(z.charAt(0)=="<")if(match=z.match(t)){m(match[1],match[2],match[3]);u=match[0].length}if(u==0){u=z.indexOf("<");if(u==0)u=1;else if(u<0)u=z.length;l(b.domEncode(z.substring(0,u)))}z=z.substring(u)}else{z=z.replace(/^([\s\S]*?)<\/(style|script)>/i,function(p,x){l(x);return""});
|
||||
j(y.last())}j();a=B.join("");B=null;a=a.replace(/<(font)(\s+[^>]*?)?>(((?!<\1(\s+[^>]*?)?>)[\s\S])*?)<\/\1>/ig,i);a=a.replace(/<(font)(\s+[^>]*?)?>(((?!<\1(\s+[^>]*?)?>)[\s\S]|<\1(\s+[^>]*?)?>((?!<\1(\s+[^>]*?)?>)[\s\S])*?<\/\1>)*?)<\/\1>/ig,i);a=a.replace(/<(font)(\s+[^>]*?)?>(((?!<\1(\s+[^>]*?)?>)[\s\S]|<\1(\s+[^>]*?)?>((?!<\1(\s+[^>]*?)?>)[\s\S]|<\1(\s+[^>]*?)?>((?!<\1(\s+[^>]*?)?>)[\s\S])*?<\/\1>)*?<\/\1>)*?)<\/\1>/ig,i);a=a.replace(/^(\s*\r?\n)+|(\s*\r?\n)+$/g,"");return a=a.replace(/(\t*\r?\n)+/g,
|
||||
"\r\n")};this.toggleShowBlocktag=function(a){if(ka!==a){ka=!ka;a=e(w.body);if(ka){ca+=" showBlocktag";a.addClass("showBlocktag")}else{ca=ca.replace(" showBlocktag","");a.removeClass("showBlocktag")}}};this.toggleSource=function(a){if(H!==a){J.find("[name=Source]").toggleClass("xheEnabled").toggleClass("xheActive");var c=w.body,d=e(c),g,m,j="_xhe_cursor"+(new Date).getTime();a=0;if(H){g=b.getSource();d.find("#sourceCode").remove();d.removeAttr("scroll").attr("class","editMode"+ca);if(D)c.contentEditable=
|
||||
"true";else w.designMode="On";if(oa){b._exec("inserthtml","-");e("#"+ua).show().focus().hide()}}else{b.pasteHTML(j,true);g=b.getSource(true);a=g.indexOf(j);if(!Xa)a=g.substring(0,a).replace(/\r/g,"").length;g=g.replace(j,"");if(D)c.contentEditable="false";else w.designMode="Off";d.attr("scroll","no").attr("class","sourceMode").html('<textarea id="sourceCode" wrap="soft" spellcheck="false" height="100%" />');m=e("#sourceCode",d).blur(b.getSource)[0]}H=!H;b.setSource(g);if(H){b.focus();if(m.setSelectionRange)m.setSelectionRange(a,
|
||||
a);else{m=m.createTextRange();m.move("character",a);m.select()}}else b.setCursorFirst(true);J.find("[name=Source]").toggleClass("xheEnabled");J.find(".xheButton").not("[name=Source],[name=Fullscreen],[name=About]").toggleClass("xheEnabled");setTimeout(Aa,300)}};this.toggleFullscreen=function(a){if(ia!==a){a=e("#"+ma).find(".xheLayout");var c=e("#"+ma);if(ia){a.attr("style",Ma);O.height(S-J.outerHeight());setTimeout(function(){e(window).scrollTop(La)},10)}else{La=e(window).scrollTop();Ma=a.attr("style");
|
||||
a.removeAttr("style");O.height("100%");setTimeout(Ca,100)}if(oa){e("#"+ua).show().focus().hide();setTimeout(b.focus,1)}ia=!ia;c.toggleClass("xhe_Fullscreen");e("html").toggleClass("xhe_Fullfix");J.find("[name=Fullscreen]").toggleClass("xheActive");setTimeout(Aa,300)}};this.showMenu=function(a,c){var d=e('<div class="xheMenu"></div>'),g=[];e.each(a,function(m,j){g.push('<a href="javascript:void(0);" title="'+(j.t?j.t:j.s)+'" v="'+j.v+'">'+j.s+"</a>")});d.append(g.join(""));d.click(function(m){c(e(m.target).closest("a").attr("v"));
|
||||
b.hidePanel();return false}).mousedown(W);b.showPanel(d)};this.showColor=function(a){var c=e('<div class="xheColor"></div>'),d=[],g=0;e.each(Za,function(m,j){if(g%7==0)d.push((g>0?"</div>":"")+"<div>");d.push('<a href="javascript:void(0);" xhev="'+j+'" title="'+j+'" style="background:'+j+'"></a>');g++});d.push("</div>");c.append(d.join(""));c.click(function(m){m=m.target;if(e.nodeName(m,"A")){a(e(m).attr("xhev"));b.hidePanel();return false}}).mousedown(W);b.showPanel(c)};this.showPastetext=function(){var a=
|
||||
e('<div>\u4f7f\u7528\u9375\u76e4\u5feb\u6377\u9375(Ctrl+V)\u628a\u5167\u5bb9\u8cbc\u4e0a\u5230\u65b9\u6846\u88e1\uff0c\u6309 \u78ba\u5b9a</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="\u78ba\u5b9a" /></div>'),c=e("#xhePastetextValue",a);e("#xheSave",a).click(function(){b.loadBookmark();var d=c.val();d&&b.pasteText(d);b.hidePanel();return false});b.showDialog(a)};
|
||||
this.showLink=function(){var a=e('<div>\u93c8\u63a5\u5730\u5740: <input type="text" id="xheLinkHref" value="http://" class="xheText" /></div><div>\u6253\u958b\u65b9\u5f0f: <select id="xheLinkTarget"><option selected="selected" value="">\u9810\u8a2d</option><option value="_blank">\u65b0\u7a97\u53e3</option><option value="_self">\u7576\u524d\u7a97\u53e3</option><option value="_parent">\u7236\u7a97\u53e3</option></select></div><div style="display:none">\u93c8\u63a5\u6587\u5b57: <input type="text" id="xheLinkText" value="" class="xheText" /></div><div style="text-align:right;"><input type="button" id="xheSave" value="\u78ba\u5b9a" /></div>'),
|
||||
c=b.getParent("a"),d=e("#xheLinkText",a),g=e("#xheLinkHref",a),m=e("#xheLinkTarget",a),j=e("#xheSave",a),l=b.getSelect();if(c.length==1){g.val(V(c,"href"));m.attr("value",c.attr("target"))}else l==""&&d.val(b.settings.defLinkText).closest("div").show();b.settings.upLinkUrl&&b.uploadInit(g,b.settings.upLinkUrl,b.settings.upLinkExt);j.click(function(){var h=g.val();b.loadBookmark();if(h==""||c.length==0)b._exec("unlink");if(h!=""&&h!="http://"){var i=h.split(" "),f=m.val(),k=d.val();if(i.length>1){b._exec("unlink");
|
||||
l=b.getSelect();var n='<a href="xhe_tmpurl"',q=[];if(f!="")n+=' target="'+f+'"';n+=">xhe_tmptext</a>";k=l!=""?l:k?k:h;for(var r in i){h=i[r];if(h!=""){h=h.split("||");f=n;f=f.replace("xhe_tmpurl",h[0]);f=f.replace("xhe_tmptext",h[1]?h[1]:k);q.push(f)}}b.pasteHTML(q.join(" "))}else{h=i[0].split("||");k||(k=h[0]);k=h[1]?h[1]:l!=""?"":k?k:h[0];if(c.length==0){k?b.pasteHTML('<a href="#xhe_tmpurl">'+k+"</a>"):b._exec("createlink","#xhe_tmpurl");c=e('a[href$="#xhe_tmpurl"]',w)}V(c,"href",h[0]);f!=
|
||||
""?c.attr("target",f):c.removeAttr("target");k&&!Z&&c.text(k)}}b.hidePanel();return false});b.showDialog(a)};this.showImg=function(){var a=e('<div>\u5716\u7247\u6587\u4ef6: <input type="text" id="xheImgSrc" value="http://" class="xheText" /></div><div>\u66ff\u63db\u6587\u672c: <input type="text" id="xheImgAlt" /></div><div>\u5c0d\u9f4a\u65b9\u5f0f: <select id="xheImgAlign"><option selected="selected" value="">\u9810\u8a2d</option><option value="left">\u9760\u5de6\u5c0d\u9f4a</option><option value="right">\u9760\u53f3\u5c0d\u9f4a</option><option value="top">\u9802\u7aef</option><option value="middle">\u7f6e\u4e2d</option><option value="baseline">\u57fa\u7dda</option><option value="bottom">\u5e95\u908a</option></select></div><div>\u5bec\u5ea6\u9ad8\u5ea6: <input type="text" id="xheImgWidth" style="width:40px;" /> x <input type="text" id="xheImgHeight" style="width:40px;" /></div><div>\u908a\u6846\u5927\u5c0f: <input type="text" id="xheImgBorder" style="width:40px;" /></div><div>\u6c34\u5e73\u9593\u8ddd: <input type="text" id="xheImgHspace" style="width:40px;" /> \u5782\u76f4\u9593\u8ddd: <input type="text" id="xheImgVspace" style="width:40px;" /></div><div style="text-align:right;"><input type="button" id="xheSave" value="\u78ba\u5b9a" /></div>'),
|
||||
c=b.getParent("img"),d=e("#xheImgSrc",a),g=e("#xheImgAlt",a),m=e("#xheImgAlign",a),j=e("#xheImgWidth",a),l=e("#xheImgHeight",a),h=e("#xheImgBorder",a),i=e("#xheImgVspace",a),f=e("#xheImgHspace",a),k=e("#xheSave",a);if(c.length==1){d.val(V(c,"src"));g.val(c.attr("alt"));m.val(c.attr("align"));j.val(c.attr("width"));l.val(c.attr("height"));h.val(c.attr("border"));var n=c.attr("vspace"),q=c.attr("hspace");i.val(n<=0?"":n);f.val(q<=0?"":q)}b.settings.upImgUrl&&b.uploadInit(d,b.settings.upImgUrl,b.settings.upImgExt);
|
||||
k.click(function(){b.loadBookmark();var r=d.val();if(r!=""&&r!="http://"){var s=r.split(" "),o=g.val(),t=m.val(),v=j.val(),A=l.val(),u=h.val(),y=i.val(),z=f.val();if(s.length>1){var B='<img src="xhe_tmpurl"',K=[];if(o!="")B+=' alt="'+o+'"';if(t!="")B+=' align="'+t+'"';if(v!="")B+=' width="'+v+'"';if(A!="")B+=' height="'+A+'"';if(u!="")B+=' border="'+u+'"';if(y!="")B+=' vspace="'+y+'"';if(z!="")B+=' hspace="'+z+'"';B+=" />";for(var da in s){r=s[da];if(r!=""){r=r.split("||");o=B;o=o.replace("xhe_tmpurl",
|
||||
r[0]);if(r[1])o='<a href="'+r[1]+'" target="_blank">'+o+"</a>";K.push(o)}}b.pasteHTML(K.join(" "))}else if(s.length==1){r=s[0];if(r!=""){r=r.split("||");if(c.length==0){b.pasteHTML('<img src="'+r[0]+'#xhe_tmpurl" />');c=e('img[src$="#xhe_tmpurl"]',w)}V(c,"src",r[0]);o!=""&&c.attr("alt",o);t!=""?c.attr("align",t):c.removeAttr("align");v!=""?c.attr("width",v):c.removeAttr("width");A!=""?c.attr("height",A):c.removeAttr("height");u!=""?c.attr("border",u):c.removeAttr("border");y!=""?c.attr("vspace",
|
||||
y):c.removeAttr("vspace");z!=""?c.attr("hspace",z):c.removeAttr("hspace");if(r[1]){s=c.parent("a");if(s.length==0){c.wrap("<a></a>");s=c.parent("a")}V(s,"href",r[1]);s.attr("target","_blank")}}}}else c.length==1&&c.remove();b.hidePanel();return false});b.showDialog(a)};this.showEmbed=function(a,c,d,g,m,j,l){c=e(c);var h=b.getParent('embed[type="'+d+'"],embed[classid="'+g+'"]'),i=e("#xhe"+a+"Src",c),f=e("#xhe"+a+"Width",c),k=e("#xhe"+a+"Height",c);a=e("#xheSave",c);j&&b.uploadInit(i,j,l);b.showDialog(c);
|
||||
if(h.length==1){i.val(V(h,"src"));f.val(h.attr("width"));k.val(h.attr("height"))}a.click(function(){b.loadBookmark();var n=i.val();if(n!=""&&n!="http://"){var q=f.val(),r=k.val(),s=/^[0-9]+$/;s.test(q)||(q=412);s.test(r)||(r=300);var o='<embed type="'+d+'" classid="'+g+'" src="xhe_tmpurl"'+m;s=n.split(" ");if(s.length>1){o=o+"";var t,v=[];o+=' width="xhe_width" height="xhe_height" />';for(var A in s){n=s[A].split("||");t=o;t=t.replace("xhe_tmpurl",n[0]);t=t.replace("xhe_width",n[1]?n[1]:q);t=t.replace("xhe_height",
|
||||
n[2]?n[2]:r);n!=""&&v.push(t)}b.pasteHTML(v.join(" "))}else if(s.length==1){n=s[0].split("||");if(h.length==0){b.pasteHTML(o.replace("xhe_tmpurl",n[0]+"#xhe_tmpurl")+" />");h=e('embed[src$="#xhe_tmpurl"]',w)}V(h,"src",n[0]);h.attr("width",n[1]?n[1]:q);h.attr("height",n[2]?n[2]:r)}}else h.length==1&&h.remove();b.hidePanel();return false})};this.showEmot=function(a){var c=e('<div class="xheEmot"></div>');a=a?a:Ha?Ha:"default";var d=va[a],g=Sa+a+"/",m=0,j=[],l="";l=d.width;var h=d.height,i=d.line,
|
||||
f=d.count;d=d.list;if(f)for(d=1;d<=f;d++){m++;j.push('<a href="javascript:void(0);" style="background-image:url('+g+d+'.gif);" emot="'+a+","+d+'" xhev=""> </a>');m%i==0&&j.push("<br />")}else e.each(d,function(q,r){m++;j.push('<a href="javascript:void(0);" style="background-image:url('+g+q+'.gif);" emot="'+a+","+q+'" title="'+r+'" xhev="'+r+'"> </a>');m%i==0&&j.push("<br />")});f=i*(l+12);d=f*0.75;if(Math.ceil(m/i)*(h+12)<=d)d="";l=e("<style>"+(d?".xheEmot div{width:"+(f+20)+"px;height:"+
|
||||
d+"px;}":"")+".xheEmot div a{width:"+l+"px;height:"+h+"px;}</style><div>"+j.join("")+"</div>").click(function(q){q=q.target;var r=e(q);if(e.nodeName(q,"A")){b.pasteHTML('<img emot="'+r.attr("emot")+'" alt="'+r.attr("xhev")+'">');b.hidePanel();return false}}).mousedown(W);c.append(l);var k=0,n=["<ul>"];e.each(va,function(q,r){k++;n.push("<li"+(a==q?' class="cur"':"")+'><a href="javascript:void(0);" group="'+q+'">'+r.name+"</a></li>")});if(k>1){n.push('</ul><br style="clear:both;" />');l=e(n.join("")).click(function(q){Ha=
|
||||
e(q.target).attr("group");b.exec("Emot");return false}).mousedown(W);c.append(l)}b.showPanel(c)};this.showTable=function(){var a=e('<div>\u884c\u6578\u5217\u6578: <input type="text" id="xheTableRows" style="width:40px;" value="3" /> x <input type="text" id="xheTableColumns" style="width:40px;" value="2" /></div><div>\u6a19\u984c\u55ae\u5143: <select id="xheTableHeaders"><option selected="selected" value="">\u7121</option><option value="row">\u7b2c\u4e00\u884c</option><option value="col">\u7b2c\u4e00\u5217</option><option value="both">\u7b2c\u4e00\u884c\u548c\u7b2c\u4e00\u5217</option></select></div><div>\u5bec\u5ea6\u9ad8\u5ea6: <input type="text" id="xheTableWidth" style="width:40px;" value="200" /> x <input type="text" id="xheTableHeight" style="width:40px;" value="" /></div><div>\u908a\u6846\u5927\u5c0f: <input type="text" id="xheTableBorder" style="width:40px;" value="1" /></div><div>\u8868\u683c\u9593\u8ddd: <input type="text" id="xheTableCellSpacing" style="width:40px;" value="1" /> \u8868\u683c\u586b\u5145: <input type="text" id="xheTableCellPadding" style="width:40px;" value="1" /></div><div>\u5c0d\u9f4a\u65b9\u5f0f: <select id="xheTableAlign"><option selected="selected" value="">\u9810\u8a2d</option><option value="left">\u9760\u5de6\u5c0d\u9f4a</option><option value="center">\u7f6e\u4e2d</option><option value="right">\u9760\u53f3\u5c0d\u9f4a</option></select></div><div>\u8868\u683c\u6a19\u984c: <input type="text" id="xheTableCaption" /></div><div style="text-align:right;"><input type="button" id="xheSave" value="\u78ba\u5b9a" /></div>'),
|
||||
c=e("#xheTableRows",a),d=e("#xheTableColumns",a),g=e("#xheTableHeaders",a),m=e("#xheTableWidth",a),j=e("#xheTableHeight",a),l=e("#xheTableBorder",a),h=e("#xheTableCellSpacing",a),i=e("#xheTableCellPadding",a),f=e("#xheTableAlign",a),k=e("#xheTableCaption",a);e("#xheSave",a).click(function(){b.loadBookmark();var n=k.val(),q=l.val(),r=c.val(),s=d.val(),o=g.val(),t=m.val(),v=j.val(),A=h.val(),u=i.val(),y=f.val();q="<table"+(q!=""?' border="'+q+'"':"")+(t!=""?' width="'+t+'"':"")+(v!=""?' width="'+v+
|
||||
'"':"")+(A!=""?' cellspacing="'+A+'"':"")+(u!=""?' cellpadding="'+u+'"':"")+(y!=""?' align="'+y+'"':"")+">";if(n!="")q+="<caption>"+n+"</caption>";if(o=="row"||o=="both"){q+="<tr>";for(n=0;n<s;n++)q+='<th scope="col"> </th>';q+="</tr>";r--}q+="<tbody>";for(n=0;n<r;n++){q+="<tr>";for(t=0;t<s;t++)q+=t==0&&(o=="col"||o=="both")?'<th scope="row"> </th>':"<td> </td>";q+="</tr>"}q+="</tbody></table>";b.pasteHTML(q);b.hidePanel();return false});b.showDialog(a)};this.showAbout=function(){var a=
|
||||
e('<div style="font:12px Arial;width:245px;word-wrap:break-word;word-break:break-all;"><p><span style="font-size:20px;color:#1997DF;">xhEditor</span><br />v1.0.0 Final (build 100701)</p><p>xhEditor\u662f\u57fa\u65bcjQuery\u958b\u767c\u7684\u8de8\u5e73\u53f0\u8f15\u91cfXHTML\u7de8\u8f2f\u5668\uff0c\u57fa\u65bc<a href="http://www.gnu.org/licenses/lgpl.html" target="_blank">LGPL</a>\u958b\u6e90\u5354\u8b70\u767c\u4f48\u3002</p><p>Copyright c <a href="http://xheditor.com/" target="_blank">xhEditor.com</a>. All rights reserved.</p></div>');
|
||||
b.showDialog(a)};this.addShortcuts=function(a,c){a=a.toLowerCase();if(ja[a]==undefined)ja[a]=[];ja[a].push(c)};this.delShortcuts=function(a){delete ja[a]};this.uploadInit=function(a,c,d){function g(){a.closest(".xheDialog").bind("dragenter dragover",W).bind("drop",function(o){o=o.originalEvent.dataTransfer;var t;if(n&&o&&(t=o.files)&&t.length>0)m(t);return false})}function m(o){s=[];var t,v,A=e('<div style="padding:22px 0;text-align:center;line-height:30px;">\u6587\u4ef6\u4e0a\u50b3\u4e2d\uff0c\u8acb\u7a0d\u5019\u2026\u2026<br /></div>'),
|
||||
u='<img src="'+Ga+'img/loading.gif">';if(!n||o.nodeType&&!((v=o.files)&&v[0])){if(!j(o.value))return;A.append(u);t=new b.html4Upload(o,c,l)}else{v||(v=o);var y=v.length;if(y>q){alert("\u8acb\u4e0d\u8981\u4e00\u6b21\u4e0a\u50b3\u8d85\u904e"+q+"\u500b\u6587\u4ef6");return}for(o=0;o<y;o++)if(!j(v[o].fileName))return;var z=e('<div class="xheProgress"><div><span>0%</span></div></div>');A.append(z);t=new b.html5Upload(i,v,c,l,function(B){if(B.loaded>=0){var K=Math.round(B.loaded*100/B.total)+"%";e("div",
|
||||
z).css("width",K);e("span",z).text(K+" ( "+Ja(B.loaded)+" / "+Ja(B.total)+" )")}else z.replaceWith(u)})}T=false;b.showModal("\u6587\u4ef6\u4e0a\u50b3\u4e2d(Esc\u53d6\u6d88\u4e0a\u50b3)",A,320,150,function(){T=true;t.remove()});t.start()}function j(o){if(d=="*"||o.match(RegExp(".("+d.replace(/,/g,"|")+")$","i")))return true;else{alert("\u4e0a\u50b3\u6587\u4ef6\u64f4\u5c55\u540d\u5fc5\u9700\u70ba: "+d);return false}}function l(o,t){var v=Object,A=false,u=b.settings.onUpload;try{v=eval("("+o+")")}catch(y){}if(v.err==
|
||||
undefined||v.msg==undefined)alert(c+" \u4e0a\u50b3\u63a5\u53e3\u767c\u751f\u932f\u8aa4\uff01\r\n\r\n\u8fd4\u56de\u7684\u932f\u8aa4\u5167\u5bb9\u70ba: \r\n\r\n"+o);else if(v.err)alert(v.err);else{s.push(v.msg);A=true}if(!A||t)b.removeModal();if(t&&A){h(s);u&&u(s)}return A}function h(o){if($(o,"string"))o=[o];var t=false,v,A=o.length,u,y=[];for(v=0;v<A;v++){u=o[v];u=$(u,"string")?u:u.url;if(u.substr(0,1)=="!"){t=true;u=u.substr(1)}y.push(u)}a.val(y.join(" "));t&&a.closest(".xheDialog").find("#xheSave").click()}
|
||||
var i="filedata",f=e('<span class="xheUpload"><input type="text" style="visibility:hidden;" tabindex="-1" /><input type="button" value="'+b.settings.upBtnText+'" class="xheBtn" tabindex="-1" /></span>'),k=e(".xheBtn",f),n=b.settings.html5Upload,q=n?b.settings.upMultiple:1;a.after(f);k.before(a);c=c.replace(/{editorRoot}/ig,U);if(c.substr(0,1)=="!")k.click(function(){T=false;b.showIframeModal("\u4e0a\u50b3\u6587\u4ef6",c.substr(1),h,null,null,function(){T=true})});else{f.append('<input type="file"'+
|
||||
(q>1?' multiple=""':"")+' class="xheFile" size="13" name="'+i+'" tabindex="-1" />');var r=e(".xheFile",f),s=[];r.change(function(){m(r[0])});setTimeout(g,10)}};this.html4Upload=function(a,c,d){var g="jUploadFrame"+(new Date).getTime(),m=this,j=e('<iframe name="'+g+'" class="xheHideArea" />').appendTo("body"),l=e('<form action="'+c+'" target="'+g+'" method="post" enctype="multipart/form-data" class="xheHideArea"></form>').appendTo("body"),h=e(a),i=h.clone().attr("disabled","true");h.before(i).appendTo(l);
|
||||
this.remove=function(){if(m!=null){i.before(h).remove();j.remove();l.remove();m=null}};this.onLoad=function(){d(e(j[0].contentWindow.document.body).text(),true)};this.start=function(){l.submit();j.load(m.onLoad)};return this};this.html5Upload=function(a,c,d,g,m){function j(s,o,t,v){h=new XMLHttpRequest;upload=h.upload;h.onreadystatechange=function(){h.readyState==4&&t(h.responseText)};if(upload)upload.onprogress=function(A){v(A.loaded)};else v(-1);h.open("POST",o);h.setRequestHeader("Content-Type",
|
||||
"application/octet-stream");h.setRequestHeader("Content-Disposition",'attachment; name="'+a+'"; filename="'+s.fileName+'"');h.sendAsBinary?h.sendAsBinary(s.getAsBinary()):h.send(s)}function l(s){m&&m({loaded:k+s,total:n})}for(var h,i=0,f=c.length,k=0,n=0,q=this,r=0;r<f;r++)n+=c[r].fileSize;this.remove=function(){if(h){h.abort();h=null}};this.uploadNext=function(s){if(s){k+=c[i-1].fileSize;l(0)}if((!s||s&&g(s,i==f)==true)&&i<f)j(c[i++],d,q.uploadNext,function(o){l(o)})};this.start=function(){q.uploadNext()}};
|
||||
this.showIframeModal=function(a,c,d,g,m,j){c=e('<iframe frameborder="0" src="'+c.replace(/{editorRoot}/ig,U)+'" style="width:100%;height:100%;display:none;" /><div class="xheModalIfmWait"></div>');var l=e(c[0]),h=e(c[1]);b.showModal(a,c,g,m,j);l.load(function(){var i=l[0].contentWindow,f=e(i.document);i.callback=function(k){b.removeModal();d(k)};f.keydown(b.modalEscCheck);l.show();h.remove()})};this.showModal=function(a,c,d,g,m){if(e(".xheModal").length==1)return false;var j,l,h,i,f;d=d?d:b.settings.modalWidth;
|
||||
g=g?g:b.settings.modalHeight;i=b.settings.layerShadow;j=e('<div class="xheModal" style="width:'+(d-1)+"px;height:"+g+"px;margin-left:-"+Math.ceil(d/2)+"px;"+(D&&wa<=7?"":"margin-top:-"+Math.ceil(g/2)+"px")+'">'+(b.settings.modalTitle?'<div class="xheModalTitle"><span class="xheModalClose" title="\u95dc\u9589 (Esc)"></span>'+a+"</div>":"")+'<div class="xheModalContent"></div></div>').appendTo("body");h=e('<div class="xheModalOverlay"></div>').appendTo("body");if(i>0)l=e('<div class="xheModalShadow" style="width:'+
|
||||
j.outerWidth()+"px;height:"+j.outerHeight()+"px;margin-left:-"+(Math.ceil(d/2)-i-2)+"px;"+(D&&wa<=7?"":"margin-top:-"+(Math.ceil(g/2)-i-2)+"px")+'"></div>').appendTo("body");e(".xheModalContent",j).css("height",g-(b.settings.modalTitle?e(".xheModalTitle").outerHeight():0)).html(c);if(D&&wa==6)f=e("select:visible").css("visibility","hidden");this.removeModal=function(){f&&f.css("visibility","visible");e(document).unbind("keydown",b.modalEscCheck);j.remove();i>0&&l.remove();h.remove();m&&m()};this.modalEscCheck=
|
||||
function(k){if(k.which==27){b.removeModal();return false}};e(document).keydown(b.modalEscCheck);e(".xheModalClose",j).click(b.removeModal);h.show();i>0&&l.show();j.show()};this.showDialog=function(a){var c=e('<div class="xheDialog"></div>');a=e(a);var d=e("#xheSave",a);if(d.length==1){a.find("input[type=text],select").keypress(function(j){if(j.which==13){d.click();return false}});a.find("textarea").keydown(function(j){if(j.ctrlKey&&j.which==13){d.click();return false}});d.after(' <input type="button" id="xheCancel" value="\u53d6\u6d88" />');
|
||||
e("#xheCancel",a).click(b.hidePanel);if(!b.settings.clickCancelDialog){pa=false;var g=e('<div class="xheFixCancel"></div>').appendTo("body").mousedown(W),m=O.offset();g.css({left:m.left,top:m.top,width:O.outerWidth(),height:O.outerHeight()})}c.mousedown(function(){la=true})}c.append(a);b.showPanel(c);D||setTimeout(function(){c.find("input[type=text],textarea").filter(":visible").filter(function(){return e(this).css("visibility")!="hidden"}).eq(0).focus()},10)};this.showPanel=function(a){if(!M.target)return false;
|
||||
L.empty().append(a).css("left",-999).css("top",-999);ga=e(M.target).closest("a").addClass("xheActive");var c=ga.offset();a=c.left;c=c.top;c+=ga.outerHeight()-1;fa.css({left:a+1,top:c}).show();if(a+L.outerWidth()>document.body.clientWidth)a-=L.outerWidth()-ga.outerWidth();var d=b.settings.layerShadow;d>0&&ea.css({left:a+d,top:c+d,width:L.outerWidth(),height:L.outerHeight()}).show();L.css("left",a).css("top",c).show();Fa=T=true};this.hidePanel=function(){if(T){ga.removeClass("xheActive");ea.hide();
|
||||
fa.hide();L.hide();T=false;if(!pa){e(".xheFixCancel").remove();pa=true}Fa=la=false;X=null}};this.exec=function(a){b.hidePanel();b.saveBookmark();var c=ha[a];if(!c)return false;if(M==null){M={};var d=J.find(".xheButton[name="+a+"]");if(d.length==1)M.target=d}if(c.e)c.e.call(b);else{a=a.toLowerCase();switch(a){case "cut":try{w.execCommand(a);if(!w.queryCommandSupported(a))throw"Error";}catch(g){alert("\u60a8\u7684\u700f\u89bd\u5668\u5b89\u5168\u8a2d\u7f6e\u4e0d\u5141\u8a31\u4f7f\u7528\u526a\u4e0b\u64cd\u4f5c\uff0c\u8acb\u4f7f\u7528\u9375\u76e4\u5feb\u6377\u9375(Ctrl + X)\u4f86\u5b8c\u6210")}break;
|
||||
case "copy":try{w.execCommand(a);if(!w.queryCommandSupported(a))throw"Error";}catch(m){alert("\u60a8\u7684\u700f\u89bd\u5668\u5b89\u5168\u8a2d\u7f6e\u4e0d\u5141\u8a31\u4f7f\u7528\u8907\u88fd\u64cd\u4f5c\uff0c\u8acb\u4f7f\u7528\u9375\u76e4\u5feb\u6377\u9375(Ctrl + C)\u4f86\u5b8c\u6210")}break;case "paste":try{w.execCommand(a);if(!w.queryCommandSupported(a))throw"Error";}catch(j){alert("\u60a8\u7684\u700f\u89bd\u5668\u5b89\u5168\u8a2d\u7f6e\u4e0d\u5141\u8a31\u4f7f\u7528\u8cbc\u4e0a\u64cd\u4f5c\uff0c\u8acb\u4f7f\u7528\u9375\u76e4\u5feb\u6377\u9375(Ctrl + V)\u4f86\u5b8c\u6210")}break;
|
||||
case "pastetext":window.clipboardData?b.pasteText(window.clipboardData.getData("Text",true)):b.showPastetext();break;case "blocktag":var l=[];e.each($a,function(f,k){l.push({s:"<"+k.n+">"+k.t+"</"+k.n+">",v:"<"+k.n+">",t:k.t})});b.showMenu(l,function(f){b._exec("formatblock",f)});break;case "fontface":var h=[];e.each(ab,function(f,k){k.c=k.c?k.c:k.n;h.push({s:'<span style="font-family:'+k.c+'">'+k.n+"</span>",v:k.c,t:k.n})});b.showMenu(h,function(f){b._exec("fontname",f)});break;case "fontsize":var i=
|
||||
[];e.each(N,function(f,k){i.push({s:'<span style="font-size:'+k.s+';">'+k.t+"("+k.s+")</span>",v:f+1,t:k.t})});b.showMenu(i,function(f){b._exec("fontsize",f)});break;case "fontcolor":b.showColor(function(f){b._exec("forecolor",f)});break;case "backcolor":b.showColor(function(f){if(D)b._exec("backcolor",f);else{za(true);b._exec("hilitecolor",f);za(false)}});break;case "align":b.showMenu(bb,function(f){b._exec(f)});break;case "list":b.showMenu(cb,function(f){b._exec(f)});break;case "link":b.showLink();
|
||||
break;case "img":b.showImg();break;case "flash":b.showEmbed("Flash",'<div>\u52d5\u756b\u6587\u4ef6: <input type="text" id="xheFlashSrc" value="http://" class="xheText" /></div><div>\u5bec\u5ea6\u9ad8\u5ea6: <input type="text" id="xheFlashWidth" style="width:40px;" value="480" /> x <input type="text" id="xheFlashHeight" style="width:40px;" value="400" /></div><div style="text-align:right;"><input type="button" id="xheSave" value="\u78ba\u5b9a" /></div>',"application/x-shockwave-flash","clsid:d27cdb6e-ae6d-11cf-96b8-4445535400000",
|
||||
' wmode="opaque" quality="high" menu="false" play="true" loop="true" allowfullscreen="true"',b.settings.upFlashUrl,b.settings.upFlashExt);break;case "media":b.showEmbed("Media",'<div>\u5a92\u9ad4\u6587\u4ef6: <input type="text" id="xheMediaSrc" value="http://" class="xheText" /></div><div>\u5bec\u5ea6\u9ad8\u5ea6: <input type="text" id="xheMediaWidth" style="width:40px;" value="480" /> x <input type="text" id="xheMediaHeight" style="width:40px;" value="400" /></div><div style="text-align:right;"><input type="button" id="xheSave" value="\u78ba\u5b9a" /></div>',
|
||||
"application/x-mplayer2","clsid:6bf52a52-394a-11d3-b153-00c04f79faa6",' enablecontextmenu="false" autostart="false"',b.settings.upMediaUrl,b.settings.upMediaExt);break;case "emot":b.showEmot();break;case "table":b.showTable();break;case "source":b.toggleSource();break;case "print":R.print();break;case "fullscreen":b.toggleFullscreen();break;case "about":b.showAbout();break;default:b._exec(a);break}}M=null};this._exec=function(a,c,d){d||b.focus();return c!=undefined?w.execCommand(a,false,c):w.execCommand(a,
|
||||
false,null)}};e(function(){e.fn.oldVal=e.fn.val;e.fn.val=function(C){var F=this,G;if(C===undefined)return this[0]&&(G=this[0].xheditor)?G.getSource():F.oldVal(C);return this.each(function(){(G=this.xheditor)?G.setSource(C):F.oldVal(C)})};e("textarea").each(function(){var C=e(this),F=C.attr("class").match(/(?:^|\s)xheditor(?:\-(m?full|simple|mini))?(?:\s|$)/i);if(F)C.xheditor(F[1]?{tools:F[1]}:null)})})})(jQuery);
|
||||
BIN
trunk/www/js/jquery/xheditor/xheditor_emot/default/angel.gif
Normal file
|
After Width: | Height: | Size: 1.4 KiB |
BIN
trunk/www/js/jquery/xheditor/xheditor_emot/default/angry.gif
Normal file
|
After Width: | Height: | Size: 1.3 KiB |
BIN
trunk/www/js/jquery/xheditor/xheditor_emot/default/beer.gif
Normal file
|
After Width: | Height: | Size: 1.2 KiB |
BIN
trunk/www/js/jquery/xheditor/xheditor_emot/default/biggrin.gif
Normal file
|
After Width: | Height: | Size: 1.3 KiB |
|
After Width: | Height: | Size: 1.1 KiB |
BIN
trunk/www/js/jquery/xheditor/xheditor_emot/default/blush.gif
Normal file
|
After Width: | Height: | Size: 1.3 KiB |
BIN
trunk/www/js/jquery/xheditor/xheditor_emot/default/bowl.gif
Normal file
|
After Width: | Height: | Size: 1.1 KiB |
BIN
trunk/www/js/jquery/xheditor/xheditor_emot/default/brb.gif
Normal file
|
After Width: | Height: | Size: 727 B |
|
After Width: | Height: | Size: 1.2 KiB |
BIN
trunk/www/js/jquery/xheditor/xheditor_emot/default/buddy.gif
Normal file
|
After Width: | Height: | Size: 1.4 KiB |
BIN
trunk/www/js/jquery/xheditor/xheditor_emot/default/buddy1.gif
Normal file
|
After Width: | Height: | Size: 1.3 KiB |
BIN
trunk/www/js/jquery/xheditor/xheditor_emot/default/cake.gif
Normal file
|
After Width: | Height: | Size: 1.2 KiB |
BIN
trunk/www/js/jquery/xheditor/xheditor_emot/default/camera.gif
Normal file
|
After Width: | Height: | Size: 1.1 KiB |
BIN
trunk/www/js/jquery/xheditor/xheditor_emot/default/car.gif
Normal file
|
After Width: | Height: | Size: 1.3 KiB |
BIN
trunk/www/js/jquery/xheditor/xheditor_emot/default/cat.gif
Normal file
|
After Width: | Height: | Size: 1.2 KiB |
BIN
trunk/www/js/jquery/xheditor/xheditor_emot/default/cell.gif
Normal file
|
After Width: | Height: | Size: 651 B |
BIN
trunk/www/js/jquery/xheditor/xheditor_emot/default/clock.gif
Normal file
|
After Width: | Height: | Size: 1.2 KiB |
BIN
trunk/www/js/jquery/xheditor/xheditor_emot/default/coffee.gif
Normal file
|
After Width: | Height: | Size: 1.2 KiB |
BIN
trunk/www/js/jquery/xheditor/xheditor_emot/default/computer.gif
Normal file
|
After Width: | Height: | Size: 742 B |
BIN
trunk/www/js/jquery/xheditor/xheditor_emot/default/confused.gif
Normal file
|
After Width: | Height: | Size: 1.3 KiB |
BIN
trunk/www/js/jquery/xheditor/xheditor_emot/default/cool.gif
Normal file
|
After Width: | Height: | Size: 1.3 KiB |
BIN
trunk/www/js/jquery/xheditor/xheditor_emot/default/cry.gif
Normal file
|
After Width: | Height: | Size: 1.3 KiB |
BIN
trunk/www/js/jquery/xheditor/xheditor_emot/default/deadrose.gif
Normal file
|
After Width: | Height: | Size: 1.2 KiB |
BIN
trunk/www/js/jquery/xheditor/xheditor_emot/default/devil.gif
Normal file
|
After Width: | Height: | Size: 1.3 KiB |
BIN
trunk/www/js/jquery/xheditor/xheditor_emot/default/dog.gif
Normal file
|
After Width: | Height: | Size: 1.3 KiB |
BIN
trunk/www/js/jquery/xheditor/xheditor_emot/default/dontcare.gif
Normal file
|
After Width: | Height: | Size: 1.3 KiB |
BIN
trunk/www/js/jquery/xheditor/xheditor_emot/default/eyesdown.gif
Normal file
|
After Width: | Height: | Size: 1.3 KiB |
BIN
trunk/www/js/jquery/xheditor/xheditor_emot/default/filmreel.gif
Normal file
|
After Width: | Height: | Size: 1.2 KiB |
|
After Width: | Height: | Size: 1.3 KiB |
BIN
trunk/www/js/jquery/xheditor/xheditor_emot/default/gift.gif
Normal file
|
After Width: | Height: | Size: 1.1 KiB |
BIN
trunk/www/js/jquery/xheditor/xheditor_emot/default/girl.gif
Normal file
|
After Width: | Height: | Size: 712 B |
BIN
trunk/www/js/jquery/xheditor/xheditor_emot/default/handcuffs.gif
Normal file
|
After Width: | Height: | Size: 1.2 KiB |
BIN
trunk/www/js/jquery/xheditor/xheditor_emot/default/heart.gif
Normal file
|
After Width: | Height: | Size: 1.1 KiB |
BIN
trunk/www/js/jquery/xheditor/xheditor_emot/default/hug.gif
Normal file
|
After Width: | Height: | Size: 1.3 KiB |
|
After Width: | Height: | Size: 1.3 KiB |
BIN
trunk/www/js/jquery/xheditor/xheditor_emot/default/island.gif
Normal file
|
After Width: | Height: | Size: 1.1 KiB |
BIN
trunk/www/js/jquery/xheditor/xheditor_emot/default/kiss.gif
Normal file
|
After Width: | Height: | Size: 1.3 KiB |
BIN
trunk/www/js/jquery/xheditor/xheditor_emot/default/light.gif
Normal file
|
After Width: | Height: | Size: 1.1 KiB |
|
After Width: | Height: | Size: 1.1 KiB |
BIN
trunk/www/js/jquery/xheditor/xheditor_emot/default/mail.gif
Normal file
|
After Width: | Height: | Size: 704 B |
BIN
trunk/www/js/jquery/xheditor/xheditor_emot/default/male.gif
Normal file
|
After Width: | Height: | Size: 1.1 KiB |
BIN
trunk/www/js/jquery/xheditor/xheditor_emot/default/martini.gif
Normal file
|
After Width: | Height: | Size: 1.1 KiB |
BIN
trunk/www/js/jquery/xheditor/xheditor_emot/default/money.gif
Normal file
|
After Width: | Height: | Size: 1.2 KiB |
BIN
trunk/www/js/jquery/xheditor/xheditor_emot/default/moon.gif
Normal file
|
After Width: | Height: | Size: 1.1 KiB |
BIN
trunk/www/js/jquery/xheditor/xheditor_emot/default/msnlogo.gif
Normal file
|
After Width: | Height: | Size: 1.2 KiB |
BIN
trunk/www/js/jquery/xheditor/xheditor_emot/default/music.gif
Normal file
|
After Width: | Height: | Size: 1.1 KiB |
BIN
trunk/www/js/jquery/xheditor/xheditor_emot/default/nerd.gif
Normal file
|
After Width: | Height: | Size: 1.3 KiB |
BIN
trunk/www/js/jquery/xheditor/xheditor_emot/default/party.gif
Normal file
|
After Width: | Height: | Size: 1.3 KiB |
BIN
trunk/www/js/jquery/xheditor/xheditor_emot/default/phone.gif
Normal file
|
After Width: | Height: | Size: 1.1 KiB |
BIN
trunk/www/js/jquery/xheditor/xheditor_emot/default/pizza.gif
Normal file
|
After Width: | Height: | Size: 1.1 KiB |
BIN
trunk/www/js/jquery/xheditor/xheditor_emot/default/plane.gif
Normal file
|
After Width: | Height: | Size: 1.0 KiB |
BIN
trunk/www/js/jquery/xheditor/xheditor_emot/default/plate.gif
Normal file
|
After Width: | Height: | Size: 1.2 KiB |
BIN
trunk/www/js/jquery/xheditor/xheditor_emot/default/rainbow.gif
Normal file
|
After Width: | Height: | Size: 659 B |
BIN
trunk/www/js/jquery/xheditor/xheditor_emot/default/rose.gif
Normal file
|
After Width: | Height: | Size: 1.1 KiB |
BIN
trunk/www/js/jquery/xheditor/xheditor_emot/default/sad.gif
Normal file
|
After Width: | Height: | Size: 1.3 KiB |
BIN
trunk/www/js/jquery/xheditor/xheditor_emot/default/secret.gif
Normal file
|
After Width: | Height: | Size: 1.2 KiB |
BIN
trunk/www/js/jquery/xheditor/xheditor_emot/default/shocked.gif
Normal file
|
After Width: | Height: | Size: 1.3 KiB |
BIN
trunk/www/js/jquery/xheditor/xheditor_emot/default/sick.gif
Normal file
|
After Width: | Height: | Size: 1.3 KiB |
BIN
trunk/www/js/jquery/xheditor/xheditor_emot/default/skull.gif
Normal file
|
After Width: | Height: | Size: 1.2 KiB |
|
After Width: | Height: | Size: 1.3 KiB |
BIN
trunk/www/js/jquery/xheditor/xheditor_emot/default/smile.gif
Normal file
|
After Width: | Height: | Size: 1.3 KiB |
|
After Width: | Height: | Size: 1.1 KiB |
BIN
trunk/www/js/jquery/xheditor/xheditor_emot/default/snail.gif
Normal file
|
After Width: | Height: | Size: 1.2 KiB |
BIN
trunk/www/js/jquery/xheditor/xheditor_emot/default/soccer.gif
Normal file
|
After Width: | Height: | Size: 1.2 KiB |
BIN
trunk/www/js/jquery/xheditor/xheditor_emot/default/star.gif
Normal file
|
After Width: | Height: | Size: 1.1 KiB |
|
After Width: | Height: | Size: 661 B |
BIN
trunk/www/js/jquery/xheditor/xheditor_emot/default/sun.gif
Normal file
|
After Width: | Height: | Size: 1.2 KiB |
|
After Width: | Height: | Size: 1.3 KiB |
|
After Width: | Height: | Size: 1.1 KiB |
BIN
trunk/www/js/jquery/xheditor/xheditor_emot/default/thumbsup.gif
Normal file
|
After Width: | Height: | Size: 1.1 KiB |
BIN
trunk/www/js/jquery/xheditor/xheditor_emot/default/tired.gif
Normal file
|
After Width: | Height: | Size: 1.3 KiB |
BIN
trunk/www/js/jquery/xheditor/xheditor_emot/default/tongue.gif
Normal file
|
After Width: | Height: | Size: 1.3 KiB |
BIN
trunk/www/js/jquery/xheditor/xheditor_emot/default/turtle.gif
Normal file
|
After Width: | Height: | Size: 1.1 KiB |
BIN
trunk/www/js/jquery/xheditor/xheditor_emot/default/umbrella.gif
Normal file
|
After Width: | Height: | Size: 1.1 KiB |
BIN
trunk/www/js/jquery/xheditor/xheditor_emot/default/vamp.gif
Normal file
|
After Width: | Height: | Size: 1.3 KiB |
BIN
trunk/www/js/jquery/xheditor/xheditor_emot/default/videogame.gif
Normal file
|
After Width: | Height: | Size: 748 B |
BIN
trunk/www/js/jquery/xheditor/xheditor_emot/default/wink.gif
Normal file
|
After Width: | Height: | Size: 1.3 KiB |
BIN
trunk/www/js/jquery/xheditor/xheditor_emot/default/yay.gif
Normal file
|
After Width: | Height: | Size: 1.3 KiB |
BIN
trunk/www/js/jquery/xheditor/xheditor_plugins/multiupload/img/add.gif
Executable file
|
After Width: | Height: | Size: 1.3 KiB |
BIN
trunk/www/js/jquery/xheditor/xheditor_plugins/multiupload/img/bg1.gif
Executable file
|
After Width: | Height: | Size: 856 B |
BIN
trunk/www/js/jquery/xheditor/xheditor_plugins/multiupload/img/bg2.gif
Executable file
|
After Width: | Height: | Size: 816 B |
BIN
trunk/www/js/jquery/xheditor/xheditor_plugins/multiupload/img/btnbg.gif
Executable file
|
After Width: | Height: | Size: 416 B |
BIN
trunk/www/js/jquery/xheditor/xheditor_plugins/multiupload/img/btnbgr.gif
Executable file
|
After Width: | Height: | Size: 206 B |
BIN
trunk/www/js/jquery/xheditor/xheditor_plugins/multiupload/img/clear.gif
Executable file
|
After Width: | Height: | Size: 638 B |
BIN
trunk/www/js/jquery/xheditor/xheditor_plugins/multiupload/img/progressbg.gif
Executable file
|
After Width: | Height: | Size: 103 B |
BIN
trunk/www/js/jquery/xheditor/xheditor_plugins/multiupload/img/start.gif
Executable file
|
After Width: | Height: | Size: 239 B |
61
trunk/www/js/jquery/xheditor/xheditor_plugins/multiupload/multiupload.css
Executable file
@@ -0,0 +1,61 @@
|
||||
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;
|
||||
}
|
||||
93
trunk/www/js/jquery/xheditor/xheditor_plugins/multiupload/multiupload.html
Executable file
@@ -0,0 +1,93 @@
|
||||
<!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>MultiUpload Demo</title>
|
||||
<link href="multiupload.css" rel="stylesheet" type="text/css" />
|
||||
<script type="text/javascript" src="../../jquery/jquery-1.4.2.min.js"></script>
|
||||
<script type="text/javascript" src="swfupload/swfupload.js"></script>
|
||||
<script type="text/javascript" src="multiupload.js"></script>
|
||||
<script type="text/javascript">
|
||||
$(window).load(pageInit);
|
||||
function pageInit()
|
||||
{
|
||||
var uploadurl='../upload.php',ext='所有文件 (*.*)',size='2 MB',count=5,useget=0,params={}//默认值
|
||||
|
||||
uploadurl=getQuery('uploadurl')||uploadurl;ext=getQuery('ext')||ext;size=getQuery('size')||size;count=getQuery('count')||count;useget=getQuery('useget')||useget;
|
||||
var tmpParams=getQuery('params');
|
||||
if(tmpParams)
|
||||
{
|
||||
try{eval("tmpParams=" + tmpParams);}catch(ex){};
|
||||
params=$.extend({},params,tmpParams);
|
||||
}
|
||||
ext=ext.match(/([^\(]+?)\s*\(\s*([^\)]+?)\s*\)/i);
|
||||
setTimeout(fixHeight,10);
|
||||
swfu = new SWFUpload({
|
||||
// Flash组件
|
||||
flash_url : "swfupload/swfupload.swf",
|
||||
prevent_swf_caching : false,//是否缓存SWF文件
|
||||
|
||||
// 服务器端
|
||||
upload_url: uploadurl,
|
||||
file_post_name : "filedata",
|
||||
post_params: params,//随文件上传一同向上传接收程序提交的Post数据
|
||||
use_query_string : useget=='1'?true:false,//是否用GET方式发送参数
|
||||
|
||||
// 文件设置
|
||||
file_types : ext[2],//文件格式限制
|
||||
file_types_description : ext[1],//文件格式描述
|
||||
file_size_limit : size, // 文件大小限制
|
||||
file_upload_limit : count,//上传文件总数
|
||||
file_queue_limit:0,//上传队列总数
|
||||
custom_settings : {
|
||||
test : "aaa"
|
||||
},
|
||||
|
||||
// 事件处理
|
||||
file_queued_handler : fileQueued,//添加成功
|
||||
file_queue_error_handler : fileQueueError,//添加失败
|
||||
upload_start_handler : uploadStart,//上传开始
|
||||
upload_progress_handler : uploadProgress,//上传进度
|
||||
upload_error_handler : uploadError,//上传失败
|
||||
upload_success_handler : uploadSuccess,//上传成功
|
||||
upload_complete_handler : uploadComplete,//上传结束
|
||||
|
||||
// 按钮设置
|
||||
button_placeholder_id : "divAddFiles",
|
||||
button_width: 69,
|
||||
button_height: 17,
|
||||
button_window_mode: SWFUpload.WINDOW_MODE.TRANSPARENT,
|
||||
button_cursor: SWFUpload.CURSOR.HAND,
|
||||
button_image_url : "img/add.gif",
|
||||
button_text: '<span class="theFont">添加文件</span>',
|
||||
button_text_style: ".theFont { font-size: 12px; }",
|
||||
button_text_left_padding: 20,
|
||||
button_text_top_padding: 0,
|
||||
|
||||
// 调试设置
|
||||
debug: false
|
||||
});
|
||||
}
|
||||
function fixHeight(){$('#listArea').css('height',(document.body.clientHeight-56)+'px');}
|
||||
function getQuery(item){var svalue = location.search.match(new RegExp('[\?\&]' + item + '=([^\&]*)(\&?)','i'));return svalue?decodeURIComponent(svalue[1]):'';}
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
<div id="upload">
|
||||
<div id="buttonArea">
|
||||
<div id="controlBtns" style="display:none;"><a href="javascript:void(0);" id="btnClear" onclick="removeFile();" class="btn" style="display:none;"><span><img src="img/clear.gif" /> 删除文件</span></a> <a href="javascript:void(0);" id="btnStart" onclick="startUploadFiles();" class="btn"><span><img src="img/start.gif" /> 开始上传</span></a></div>
|
||||
<a href="javascript:void(0);" id="addFiles" class="btn"><span><div id="divAddFiles">添加文件</div></span></a>
|
||||
</div>
|
||||
<div id="listArea">
|
||||
<table width="100%" border="0" cellpadding="0" cellspacing="0">
|
||||
<thead id="listTitle"><tr><td width="53%">文件名</td><td width="25%">大小</td><td width="22%">状态</td></tr></thead>
|
||||
<tbody id="listBody">
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
<div id="progressArea">
|
||||
<div id="progressBar"><span>0%</span><div id="progress" style="width:1px;"></div></div>
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
125
trunk/www/js/jquery/xheditor/xheditor_plugins/multiupload/multiupload.js
vendored
Executable file
@@ -0,0 +1,125 @@
|
||||
/*!
|
||||
* 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];
|
||||
}
|
||||
980
trunk/www/js/jquery/xheditor/xheditor_plugins/multiupload/swfupload/swfupload.js
vendored
Executable file
@@ -0,0 +1,980 @@
|
||||
/**
|
||||
* SWFUpload: http://www.swfupload.org, http://swfupload.googlecode.com
|
||||
*
|
||||
* mmSWFUpload 1.0: Flash upload dialog - http://profandesign.se/swfupload/, http://www.vinterwebb.se/
|
||||
*
|
||||
* SWFUpload is (c) 2006-2007 Lars Huring, Olov Nilz<6C>n and Mammon Media and is released under the MIT License:
|
||||
* http://www.opensource.org/licenses/mit-license.php
|
||||
*
|
||||
* SWFUpload 2 is (c) 2007-2008 Jake Roberts and is released under the MIT License:
|
||||
* http://www.opensource.org/licenses/mit-license.php
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
/* ******************* */
|
||||
/* Constructor & Init */
|
||||
/* ******************* */
|
||||
var SWFUpload;
|
||||
|
||||
if (SWFUpload == undefined) {
|
||||
SWFUpload = function (settings) {
|
||||
this.initSWFUpload(settings);
|
||||
};
|
||||
}
|
||||
|
||||
SWFUpload.prototype.initSWFUpload = function (settings) {
|
||||
try {
|
||||
this.customSettings = {}; // A container where developers can place their own settings associated with this instance.
|
||||
this.settings = settings;
|
||||
this.eventQueue = [];
|
||||
this.movieName = "SWFUpload_" + SWFUpload.movieCount++;
|
||||
this.movieElement = null;
|
||||
|
||||
|
||||
// Setup global control tracking
|
||||
SWFUpload.instances[this.movieName] = this;
|
||||
|
||||
// Load the settings. Load the Flash movie.
|
||||
this.initSettings();
|
||||
this.loadFlash();
|
||||
this.displayDebugInfo();
|
||||
} catch (ex) {
|
||||
delete SWFUpload.instances[this.movieName];
|
||||
throw ex;
|
||||
}
|
||||
};
|
||||
|
||||
/* *************** */
|
||||
/* Static Members */
|
||||
/* *************** */
|
||||
SWFUpload.instances = {};
|
||||
SWFUpload.movieCount = 0;
|
||||
SWFUpload.version = "2.2.0 2009-03-25";
|
||||
SWFUpload.QUEUE_ERROR = {
|
||||
QUEUE_LIMIT_EXCEEDED : -100,
|
||||
FILE_EXCEEDS_SIZE_LIMIT : -110,
|
||||
ZERO_BYTE_FILE : -120,
|
||||
INVALID_FILETYPE : -130
|
||||
};
|
||||
SWFUpload.UPLOAD_ERROR = {
|
||||
HTTP_ERROR : -200,
|
||||
MISSING_UPLOAD_URL : -210,
|
||||
IO_ERROR : -220,
|
||||
SECURITY_ERROR : -230,
|
||||
UPLOAD_LIMIT_EXCEEDED : -240,
|
||||
UPLOAD_FAILED : -250,
|
||||
SPECIFIED_FILE_ID_NOT_FOUND : -260,
|
||||
FILE_VALIDATION_FAILED : -270,
|
||||
FILE_CANCELLED : -280,
|
||||
UPLOAD_STOPPED : -290
|
||||
};
|
||||
SWFUpload.FILE_STATUS = {
|
||||
QUEUED : -1,
|
||||
IN_PROGRESS : -2,
|
||||
ERROR : -3,
|
||||
COMPLETE : -4,
|
||||
CANCELLED : -5
|
||||
};
|
||||
SWFUpload.BUTTON_ACTION = {
|
||||
SELECT_FILE : -100,
|
||||
SELECT_FILES : -110,
|
||||
START_UPLOAD : -120
|
||||
};
|
||||
SWFUpload.CURSOR = {
|
||||
ARROW : -1,
|
||||
HAND : -2
|
||||
};
|
||||
SWFUpload.WINDOW_MODE = {
|
||||
WINDOW : "window",
|
||||
TRANSPARENT : "transparent",
|
||||
OPAQUE : "opaque"
|
||||
};
|
||||
|
||||
// Private: takes a URL, determines if it is relative and converts to an absolute URL
|
||||
// using the current site. Only processes the URL if it can, otherwise returns the URL untouched
|
||||
SWFUpload.completeURL = function(url) {
|
||||
if (typeof(url) !== "string" || url.match(/^https?:\/\//i) || url.match(/^\//)) {
|
||||
return url;
|
||||
}
|
||||
|
||||
var currentURL = window.location.protocol + "//" + window.location.hostname + (window.location.port ? ":" + window.location.port : "");
|
||||
|
||||
var indexSlash = window.location.pathname.lastIndexOf("/");
|
||||
if (indexSlash <= 0) {
|
||||
path = "/";
|
||||
} else {
|
||||
path = window.location.pathname.substr(0, indexSlash) + "/";
|
||||
}
|
||||
|
||||
return /*currentURL +*/ path + url;
|
||||
|
||||
};
|
||||
|
||||
|
||||
/* ******************** */
|
||||
/* Instance Members */
|
||||
/* ******************** */
|
||||
|
||||
// Private: initSettings ensures that all the
|
||||
// settings are set, getting a default value if one was not assigned.
|
||||
SWFUpload.prototype.initSettings = function () {
|
||||
this.ensureDefault = function (settingName, defaultValue) {
|
||||
this.settings[settingName] = (this.settings[settingName] == undefined) ? defaultValue : this.settings[settingName];
|
||||
};
|
||||
|
||||
// Upload backend settings
|
||||
this.ensureDefault("upload_url", "");
|
||||
this.ensureDefault("preserve_relative_urls", false);
|
||||
this.ensureDefault("file_post_name", "Filedata");
|
||||
this.ensureDefault("post_params", {});
|
||||
this.ensureDefault("use_query_string", false);
|
||||
this.ensureDefault("requeue_on_error", false);
|
||||
this.ensureDefault("http_success", []);
|
||||
this.ensureDefault("assume_success_timeout", 0);
|
||||
|
||||
// File Settings
|
||||
this.ensureDefault("file_types", "*.*");
|
||||
this.ensureDefault("file_types_description", "All Files");
|
||||
this.ensureDefault("file_size_limit", 0); // Default zero means "unlimited"
|
||||
this.ensureDefault("file_upload_limit", 0);
|
||||
this.ensureDefault("file_queue_limit", 0);
|
||||
|
||||
// Flash Settings
|
||||
this.ensureDefault("flash_url", "swfupload.swf");
|
||||
this.ensureDefault("prevent_swf_caching", true);
|
||||
|
||||
// Button Settings
|
||||
this.ensureDefault("button_image_url", "");
|
||||
this.ensureDefault("button_width", 1);
|
||||
this.ensureDefault("button_height", 1);
|
||||
this.ensureDefault("button_text", "");
|
||||
this.ensureDefault("button_text_style", "color: #000000; font-size: 16pt;");
|
||||
this.ensureDefault("button_text_top_padding", 0);
|
||||
this.ensureDefault("button_text_left_padding", 0);
|
||||
this.ensureDefault("button_action", SWFUpload.BUTTON_ACTION.SELECT_FILES);
|
||||
this.ensureDefault("button_disabled", false);
|
||||
this.ensureDefault("button_placeholder_id", "");
|
||||
this.ensureDefault("button_placeholder", null);
|
||||
this.ensureDefault("button_cursor", SWFUpload.CURSOR.ARROW);
|
||||
this.ensureDefault("button_window_mode", SWFUpload.WINDOW_MODE.WINDOW);
|
||||
|
||||
// Debug Settings
|
||||
this.ensureDefault("debug", false);
|
||||
this.settings.debug_enabled = this.settings.debug; // Here to maintain v2 API
|
||||
|
||||
// Event Handlers
|
||||
this.settings.return_upload_start_handler = this.returnUploadStart;
|
||||
this.ensureDefault("swfupload_loaded_handler", null);
|
||||
this.ensureDefault("file_dialog_start_handler", null);
|
||||
this.ensureDefault("file_queued_handler", null);
|
||||
this.ensureDefault("file_queue_error_handler", null);
|
||||
this.ensureDefault("file_dialog_complete_handler", null);
|
||||
|
||||
this.ensureDefault("upload_start_handler", null);
|
||||
this.ensureDefault("upload_progress_handler", null);
|
||||
this.ensureDefault("upload_error_handler", null);
|
||||
this.ensureDefault("upload_success_handler", null);
|
||||
this.ensureDefault("upload_complete_handler", null);
|
||||
|
||||
this.ensureDefault("debug_handler", this.debugMessage);
|
||||
|
||||
this.ensureDefault("custom_settings", {});
|
||||
|
||||
// Other settings
|
||||
this.customSettings = this.settings.custom_settings;
|
||||
|
||||
// Update the flash url if needed
|
||||
if (!!this.settings.prevent_swf_caching) {
|
||||
this.settings.flash_url = this.settings.flash_url + (this.settings.flash_url.indexOf("?") < 0 ? "?" : "&") + "preventswfcaching=" + new Date().getTime();
|
||||
}
|
||||
|
||||
if (!this.settings.preserve_relative_urls) {
|
||||
//this.settings.flash_url = SWFUpload.completeURL(this.settings.flash_url); // Don't need to do this one since flash doesn't look at it
|
||||
this.settings.upload_url = SWFUpload.completeURL(this.settings.upload_url);
|
||||
this.settings.button_image_url = SWFUpload.completeURL(this.settings.button_image_url);
|
||||
}
|
||||
|
||||
delete this.ensureDefault;
|
||||
};
|
||||
|
||||
// Private: loadFlash replaces the button_placeholder element with the flash movie.
|
||||
SWFUpload.prototype.loadFlash = function () {
|
||||
var targetElement, tempParent;
|
||||
|
||||
// Make sure an element with the ID we are going to use doesn't already exist
|
||||
if (document.getElementById(this.movieName) !== null) {
|
||||
throw "ID " + this.movieName + " is already in use. The Flash Object could not be added";
|
||||
}
|
||||
|
||||
// Get the element where we will be placing the flash movie
|
||||
targetElement = document.getElementById(this.settings.button_placeholder_id) || this.settings.button_placeholder;
|
||||
|
||||
if (targetElement == undefined) {
|
||||
throw "Could not find the placeholder element: " + this.settings.button_placeholder_id;
|
||||
}
|
||||
|
||||
// Append the container and load the flash
|
||||
tempParent = document.createElement("div");
|
||||
tempParent.innerHTML = this.getFlashHTML(); // Using innerHTML is non-standard but the only sensible way to dynamically add Flash in IE (and maybe other browsers)
|
||||
targetElement.parentNode.replaceChild(tempParent.firstChild, targetElement);
|
||||
|
||||
// Fix IE Flash/Form bug
|
||||
if (window[this.movieName] == undefined) {
|
||||
window[this.movieName] = this.getMovieElement();
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
// Private: getFlashHTML generates the object tag needed to embed the flash in to the document
|
||||
SWFUpload.prototype.getFlashHTML = function () {
|
||||
// Flash Satay object syntax: http://www.alistapart.com/articles/flashsatay
|
||||
return ['<object id="', this.movieName, '" type="application/x-shockwave-flash" data="', this.settings.flash_url, '" width="', this.settings.button_width, '" height="', this.settings.button_height, '" class="swfupload">',
|
||||
'<param name="wmode" value="', this.settings.button_window_mode, '" />',
|
||||
'<param name="movie" value="', this.settings.flash_url, '" />',
|
||||
'<param name="quality" value="high" />',
|
||||
'<param name="menu" value="false" />',
|
||||
'<param name="allowScriptAccess" value="always" />',
|
||||
'<param name="flashvars" value="' + this.getFlashVars() + '" />',
|
||||
'</object>'].join("");
|
||||
};
|
||||
|
||||
// Private: getFlashVars builds the parameter string that will be passed
|
||||
// to flash in the flashvars param.
|
||||
SWFUpload.prototype.getFlashVars = function () {
|
||||
// Build a string from the post param object
|
||||
var paramString = this.buildParamString();
|
||||
var httpSuccessString = this.settings.http_success.join(",");
|
||||
|
||||
// Build the parameter string
|
||||
return ["movieName=", encodeURIComponent(this.movieName),
|
||||
"&uploadURL=", encodeURIComponent(this.settings.upload_url),
|
||||
"&useQueryString=", encodeURIComponent(this.settings.use_query_string),
|
||||
"&requeueOnError=", encodeURIComponent(this.settings.requeue_on_error),
|
||||
"&httpSuccess=", encodeURIComponent(httpSuccessString),
|
||||
"&assumeSuccessTimeout=", encodeURIComponent(this.settings.assume_success_timeout),
|
||||
"&params=", encodeURIComponent(paramString),
|
||||
"&filePostName=", encodeURIComponent(this.settings.file_post_name),
|
||||
"&fileTypes=", encodeURIComponent(this.settings.file_types),
|
||||
"&fileTypesDescription=", encodeURIComponent(this.settings.file_types_description),
|
||||
"&fileSizeLimit=", encodeURIComponent(this.settings.file_size_limit),
|
||||
"&fileUploadLimit=", encodeURIComponent(this.settings.file_upload_limit),
|
||||
"&fileQueueLimit=", encodeURIComponent(this.settings.file_queue_limit),
|
||||
"&debugEnabled=", encodeURIComponent(this.settings.debug_enabled),
|
||||
"&buttonImageURL=", encodeURIComponent(this.settings.button_image_url),
|
||||
"&buttonWidth=", encodeURIComponent(this.settings.button_width),
|
||||
"&buttonHeight=", encodeURIComponent(this.settings.button_height),
|
||||
"&buttonText=", encodeURIComponent(this.settings.button_text),
|
||||
"&buttonTextTopPadding=", encodeURIComponent(this.settings.button_text_top_padding),
|
||||
"&buttonTextLeftPadding=", encodeURIComponent(this.settings.button_text_left_padding),
|
||||
"&buttonTextStyle=", encodeURIComponent(this.settings.button_text_style),
|
||||
"&buttonAction=", encodeURIComponent(this.settings.button_action),
|
||||
"&buttonDisabled=", encodeURIComponent(this.settings.button_disabled),
|
||||
"&buttonCursor=", encodeURIComponent(this.settings.button_cursor)
|
||||
].join("");
|
||||
};
|
||||
|
||||
// Public: getMovieElement retrieves the DOM reference to the Flash element added by SWFUpload
|
||||
// The element is cached after the first lookup
|
||||
SWFUpload.prototype.getMovieElement = function () {
|
||||
if (this.movieElement == undefined) {
|
||||
this.movieElement = document.getElementById(this.movieName);
|
||||
}
|
||||
|
||||
if (this.movieElement === null) {
|
||||
throw "Could not find Flash element";
|
||||
}
|
||||
|
||||
return this.movieElement;
|
||||
};
|
||||
|
||||
// Private: buildParamString takes the name/value pairs in the post_params setting object
|
||||
// and joins them up in to a string formatted "name=value&name=value"
|
||||
SWFUpload.prototype.buildParamString = function () {
|
||||
var postParams = this.settings.post_params;
|
||||
var paramStringPairs = [];
|
||||
|
||||
if (typeof(postParams) === "object") {
|
||||
for (var name in postParams) {
|
||||
if (postParams.hasOwnProperty(name)) {
|
||||
paramStringPairs.push(encodeURIComponent(name.toString()) + "=" + encodeURIComponent(postParams[name].toString()));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return paramStringPairs.join("&");
|
||||
};
|
||||
|
||||
// Public: Used to remove a SWFUpload instance from the page. This method strives to remove
|
||||
// all references to the SWF, and other objects so memory is properly freed.
|
||||
// Returns true if everything was destroyed. Returns a false if a failure occurs leaving SWFUpload in an inconsistant state.
|
||||
// Credits: Major improvements provided by steffen
|
||||
SWFUpload.prototype.destroy = function () {
|
||||
try {
|
||||
// Make sure Flash is done before we try to remove it
|
||||
this.cancelUpload(null, false);
|
||||
|
||||
|
||||
// Remove the SWFUpload DOM nodes
|
||||
var movieElement = null;
|
||||
movieElement = this.getMovieElement();
|
||||
|
||||
if (movieElement && typeof(movieElement.CallFunction) === "unknown") { // We only want to do this in IE
|
||||
// Loop through all the movie's properties and remove all function references (DOM/JS IE 6/7 memory leak workaround)
|
||||
for (var i in movieElement) {
|
||||
try {
|
||||
if (typeof(movieElement[i]) === "function") {
|
||||
movieElement[i] = null;
|
||||
}
|
||||
} catch (ex1) {}
|
||||
}
|
||||
|
||||
// Remove the Movie Element from the page
|
||||
try {
|
||||
movieElement.parentNode.removeChild(movieElement);
|
||||
} catch (ex) {}
|
||||
}
|
||||
|
||||
// Remove IE form fix reference
|
||||
window[this.movieName] = null;
|
||||
|
||||
// Destroy other references
|
||||
SWFUpload.instances[this.movieName] = null;
|
||||
delete SWFUpload.instances[this.movieName];
|
||||
|
||||
this.movieElement = null;
|
||||
this.settings = null;
|
||||
this.customSettings = null;
|
||||
this.eventQueue = null;
|
||||
this.movieName = null;
|
||||
|
||||
|
||||
return true;
|
||||
} catch (ex2) {
|
||||
return false;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
// Public: displayDebugInfo prints out settings and configuration
|
||||
// information about this SWFUpload instance.
|
||||
// This function (and any references to it) can be deleted when placing
|
||||
// SWFUpload in production.
|
||||
SWFUpload.prototype.displayDebugInfo = function () {
|
||||
this.debug(
|
||||
[
|
||||
"---SWFUpload Instance Info---\n",
|
||||
"Version: ", SWFUpload.version, "\n",
|
||||
"Movie Name: ", this.movieName, "\n",
|
||||
"Settings:\n",
|
||||
"\t", "upload_url: ", this.settings.upload_url, "\n",
|
||||
"\t", "flash_url: ", this.settings.flash_url, "\n",
|
||||
"\t", "use_query_string: ", this.settings.use_query_string.toString(), "\n",
|
||||
"\t", "requeue_on_error: ", this.settings.requeue_on_error.toString(), "\n",
|
||||
"\t", "http_success: ", this.settings.http_success.join(", "), "\n",
|
||||
"\t", "assume_success_timeout: ", this.settings.assume_success_timeout, "\n",
|
||||
"\t", "file_post_name: ", this.settings.file_post_name, "\n",
|
||||
"\t", "post_params: ", this.settings.post_params.toString(), "\n",
|
||||
"\t", "file_types: ", this.settings.file_types, "\n",
|
||||
"\t", "file_types_description: ", this.settings.file_types_description, "\n",
|
||||
"\t", "file_size_limit: ", this.settings.file_size_limit, "\n",
|
||||
"\t", "file_upload_limit: ", this.settings.file_upload_limit, "\n",
|
||||
"\t", "file_queue_limit: ", this.settings.file_queue_limit, "\n",
|
||||
"\t", "debug: ", this.settings.debug.toString(), "\n",
|
||||
|
||||
"\t", "prevent_swf_caching: ", this.settings.prevent_swf_caching.toString(), "\n",
|
||||
|
||||
"\t", "button_placeholder_id: ", this.settings.button_placeholder_id.toString(), "\n",
|
||||
"\t", "button_placeholder: ", (this.settings.button_placeholder ? "Set" : "Not Set"), "\n",
|
||||
"\t", "button_image_url: ", this.settings.button_image_url.toString(), "\n",
|
||||
"\t", "button_width: ", this.settings.button_width.toString(), "\n",
|
||||
"\t", "button_height: ", this.settings.button_height.toString(), "\n",
|
||||
"\t", "button_text: ", this.settings.button_text.toString(), "\n",
|
||||
"\t", "button_text_style: ", this.settings.button_text_style.toString(), "\n",
|
||||
"\t", "button_text_top_padding: ", this.settings.button_text_top_padding.toString(), "\n",
|
||||
"\t", "button_text_left_padding: ", this.settings.button_text_left_padding.toString(), "\n",
|
||||
"\t", "button_action: ", this.settings.button_action.toString(), "\n",
|
||||
"\t", "button_disabled: ", this.settings.button_disabled.toString(), "\n",
|
||||
|
||||
"\t", "custom_settings: ", this.settings.custom_settings.toString(), "\n",
|
||||
"Event Handlers:\n",
|
||||
"\t", "swfupload_loaded_handler assigned: ", (typeof this.settings.swfupload_loaded_handler === "function").toString(), "\n",
|
||||
"\t", "file_dialog_start_handler assigned: ", (typeof this.settings.file_dialog_start_handler === "function").toString(), "\n",
|
||||
"\t", "file_queued_handler assigned: ", (typeof this.settings.file_queued_handler === "function").toString(), "\n",
|
||||
"\t", "file_queue_error_handler assigned: ", (typeof this.settings.file_queue_error_handler === "function").toString(), "\n",
|
||||
"\t", "upload_start_handler assigned: ", (typeof this.settings.upload_start_handler === "function").toString(), "\n",
|
||||
"\t", "upload_progress_handler assigned: ", (typeof this.settings.upload_progress_handler === "function").toString(), "\n",
|
||||
"\t", "upload_error_handler assigned: ", (typeof this.settings.upload_error_handler === "function").toString(), "\n",
|
||||
"\t", "upload_success_handler assigned: ", (typeof this.settings.upload_success_handler === "function").toString(), "\n",
|
||||
"\t", "upload_complete_handler assigned: ", (typeof this.settings.upload_complete_handler === "function").toString(), "\n",
|
||||
"\t", "debug_handler assigned: ", (typeof this.settings.debug_handler === "function").toString(), "\n"
|
||||
].join("")
|
||||
);
|
||||
};
|
||||
|
||||
/* Note: addSetting and getSetting are no longer used by SWFUpload but are included
|
||||
the maintain v2 API compatibility
|
||||
*/
|
||||
// Public: (Deprecated) addSetting adds a setting value. If the value given is undefined or null then the default_value is used.
|
||||
SWFUpload.prototype.addSetting = function (name, value, default_value) {
|
||||
if (value == undefined) {
|
||||
return (this.settings[name] = default_value);
|
||||
} else {
|
||||
return (this.settings[name] = value);
|
||||
}
|
||||
};
|
||||
|
||||
// Public: (Deprecated) getSetting gets a setting. Returns an empty string if the setting was not found.
|
||||
SWFUpload.prototype.getSetting = function (name) {
|
||||
if (this.settings[name] != undefined) {
|
||||
return this.settings[name];
|
||||
}
|
||||
|
||||
return "";
|
||||
};
|
||||
|
||||
|
||||
|
||||
// Private: callFlash handles function calls made to the Flash element.
|
||||
// Calls are made with a setTimeout for some functions to work around
|
||||
// bugs in the ExternalInterface library.
|
||||
SWFUpload.prototype.callFlash = function (functionName, argumentArray) {
|
||||
argumentArray = argumentArray || [];
|
||||
|
||||
var movieElement = this.getMovieElement();
|
||||
var returnValue, returnString;
|
||||
|
||||
// Flash's method if calling ExternalInterface methods (code adapted from MooTools).
|
||||
try {
|
||||
returnString = movieElement.CallFunction('<invoke name="' + functionName + '" returntype="javascript">' + __flash__argumentsToXML(argumentArray, 0) + '</invoke>');
|
||||
returnValue = eval(returnString);
|
||||
} catch (ex) {
|
||||
throw "Call to " + functionName + " failed";
|
||||
}
|
||||
|
||||
// Unescape file post param values
|
||||
if (returnValue != undefined && typeof returnValue.post === "object") {
|
||||
returnValue = this.unescapeFilePostParams(returnValue);
|
||||
}
|
||||
|
||||
return returnValue;
|
||||
};
|
||||
|
||||
/* *****************************
|
||||
-- Flash control methods --
|
||||
Your UI should use these
|
||||
to operate SWFUpload
|
||||
***************************** */
|
||||
|
||||
// WARNING: this function does not work in Flash Player 10
|
||||
// Public: selectFile causes a File Selection Dialog window to appear. This
|
||||
// dialog only allows 1 file to be selected.
|
||||
SWFUpload.prototype.selectFile = function () {
|
||||
this.callFlash("SelectFile");
|
||||
};
|
||||
|
||||
// WARNING: this function does not work in Flash Player 10
|
||||
// Public: selectFiles causes a File Selection Dialog window to appear/ This
|
||||
// dialog allows the user to select any number of files
|
||||
// Flash Bug Warning: Flash limits the number of selectable files based on the combined length of the file names.
|
||||
// If the selection name length is too long the dialog will fail in an unpredictable manner. There is no work-around
|
||||
// for this bug.
|
||||
SWFUpload.prototype.selectFiles = function () {
|
||||
this.callFlash("SelectFiles");
|
||||
};
|
||||
|
||||
|
||||
// Public: startUpload starts uploading the first file in the queue unless
|
||||
// the optional parameter 'fileID' specifies the ID
|
||||
SWFUpload.prototype.startUpload = function (fileID) {
|
||||
this.callFlash("StartUpload", [fileID]);
|
||||
};
|
||||
|
||||
// Public: cancelUpload cancels any queued file. The fileID parameter may be the file ID or index.
|
||||
// If you do not specify a fileID the current uploading file or first file in the queue is cancelled.
|
||||
// If you do not want the uploadError event to trigger you can specify false for the triggerErrorEvent parameter.
|
||||
SWFUpload.prototype.cancelUpload = function (fileID, triggerErrorEvent) {
|
||||
if (triggerErrorEvent !== false) {
|
||||
triggerErrorEvent = true;
|
||||
}
|
||||
this.callFlash("CancelUpload", [fileID, triggerErrorEvent]);
|
||||
};
|
||||
|
||||
// Public: stopUpload stops the current upload and requeues the file at the beginning of the queue.
|
||||
// If nothing is currently uploading then nothing happens.
|
||||
SWFUpload.prototype.stopUpload = function () {
|
||||
this.callFlash("StopUpload");
|
||||
};
|
||||
|
||||
/* ************************
|
||||
* Settings methods
|
||||
* These methods change the SWFUpload settings.
|
||||
* SWFUpload settings should not be changed directly on the settings object
|
||||
* since many of the settings need to be passed to Flash in order to take
|
||||
* effect.
|
||||
* *********************** */
|
||||
|
||||
// Public: getStats gets the file statistics object.
|
||||
SWFUpload.prototype.getStats = function () {
|
||||
return this.callFlash("GetStats");
|
||||
};
|
||||
|
||||
// Public: setStats changes the SWFUpload statistics. You shouldn't need to
|
||||
// change the statistics but you can. Changing the statistics does not
|
||||
// affect SWFUpload accept for the successful_uploads count which is used
|
||||
// by the upload_limit setting to determine how many files the user may upload.
|
||||
SWFUpload.prototype.setStats = function (statsObject) {
|
||||
this.callFlash("SetStats", [statsObject]);
|
||||
};
|
||||
|
||||
// Public: getFile retrieves a File object by ID or Index. If the file is
|
||||
// not found then 'null' is returned.
|
||||
SWFUpload.prototype.getFile = function (fileID) {
|
||||
if (typeof(fileID) === "number") {
|
||||
return this.callFlash("GetFileByIndex", [fileID]);
|
||||
} else {
|
||||
return this.callFlash("GetFile", [fileID]);
|
||||
}
|
||||
};
|
||||
|
||||
// Public: addFileParam sets a name/value pair that will be posted with the
|
||||
// file specified by the Files ID. If the name already exists then the
|
||||
// exiting value will be overwritten.
|
||||
SWFUpload.prototype.addFileParam = function (fileID, name, value) {
|
||||
return this.callFlash("AddFileParam", [fileID, name, value]);
|
||||
};
|
||||
|
||||
// Public: removeFileParam removes a previously set (by addFileParam) name/value
|
||||
// pair from the specified file.
|
||||
SWFUpload.prototype.removeFileParam = function (fileID, name) {
|
||||
this.callFlash("RemoveFileParam", [fileID, name]);
|
||||
};
|
||||
|
||||
// Public: setUploadUrl changes the upload_url setting.
|
||||
SWFUpload.prototype.setUploadURL = function (url) {
|
||||
this.settings.upload_url = url.toString();
|
||||
this.callFlash("SetUploadURL", [url]);
|
||||
};
|
||||
|
||||
// Public: setPostParams changes the post_params setting
|
||||
SWFUpload.prototype.setPostParams = function (paramsObject) {
|
||||
this.settings.post_params = paramsObject;
|
||||
this.callFlash("SetPostParams", [paramsObject]);
|
||||
};
|
||||
|
||||
// Public: addPostParam adds post name/value pair. Each name can have only one value.
|
||||
SWFUpload.prototype.addPostParam = function (name, value) {
|
||||
this.settings.post_params[name] = value;
|
||||
this.callFlash("SetPostParams", [this.settings.post_params]);
|
||||
};
|
||||
|
||||
// Public: removePostParam deletes post name/value pair.
|
||||
SWFUpload.prototype.removePostParam = function (name) {
|
||||
delete this.settings.post_params[name];
|
||||
this.callFlash("SetPostParams", [this.settings.post_params]);
|
||||
};
|
||||
|
||||
// Public: setFileTypes changes the file_types setting and the file_types_description setting
|
||||
SWFUpload.prototype.setFileTypes = function (types, description) {
|
||||
this.settings.file_types = types;
|
||||
this.settings.file_types_description = description;
|
||||
this.callFlash("SetFileTypes", [types, description]);
|
||||
};
|
||||
|
||||
// Public: setFileSizeLimit changes the file_size_limit setting
|
||||
SWFUpload.prototype.setFileSizeLimit = function (fileSizeLimit) {
|
||||
this.settings.file_size_limit = fileSizeLimit;
|
||||
this.callFlash("SetFileSizeLimit", [fileSizeLimit]);
|
||||
};
|
||||
|
||||
// Public: setFileUploadLimit changes the file_upload_limit setting
|
||||
SWFUpload.prototype.setFileUploadLimit = function (fileUploadLimit) {
|
||||
this.settings.file_upload_limit = fileUploadLimit;
|
||||
this.callFlash("SetFileUploadLimit", [fileUploadLimit]);
|
||||
};
|
||||
|
||||
// Public: setFileQueueLimit changes the file_queue_limit setting
|
||||
SWFUpload.prototype.setFileQueueLimit = function (fileQueueLimit) {
|
||||
this.settings.file_queue_limit = fileQueueLimit;
|
||||
this.callFlash("SetFileQueueLimit", [fileQueueLimit]);
|
||||
};
|
||||
|
||||
// Public: setFilePostName changes the file_post_name setting
|
||||
SWFUpload.prototype.setFilePostName = function (filePostName) {
|
||||
this.settings.file_post_name = filePostName;
|
||||
this.callFlash("SetFilePostName", [filePostName]);
|
||||
};
|
||||
|
||||
// Public: setUseQueryString changes the use_query_string setting
|
||||
SWFUpload.prototype.setUseQueryString = function (useQueryString) {
|
||||
this.settings.use_query_string = useQueryString;
|
||||
this.callFlash("SetUseQueryString", [useQueryString]);
|
||||
};
|
||||
|
||||
// Public: setRequeueOnError changes the requeue_on_error setting
|
||||
SWFUpload.prototype.setRequeueOnError = function (requeueOnError) {
|
||||
this.settings.requeue_on_error = requeueOnError;
|
||||
this.callFlash("SetRequeueOnError", [requeueOnError]);
|
||||
};
|
||||
|
||||
// Public: setHTTPSuccess changes the http_success setting
|
||||
SWFUpload.prototype.setHTTPSuccess = function (http_status_codes) {
|
||||
if (typeof http_status_codes === "string") {
|
||||
http_status_codes = http_status_codes.replace(" ", "").split(",");
|
||||
}
|
||||
|
||||
this.settings.http_success = http_status_codes;
|
||||
this.callFlash("SetHTTPSuccess", [http_status_codes]);
|
||||
};
|
||||
|
||||
// Public: setHTTPSuccess changes the http_success setting
|
||||
SWFUpload.prototype.setAssumeSuccessTimeout = function (timeout_seconds) {
|
||||
this.settings.assume_success_timeout = timeout_seconds;
|
||||
this.callFlash("SetAssumeSuccessTimeout", [timeout_seconds]);
|
||||
};
|
||||
|
||||
// Public: setDebugEnabled changes the debug_enabled setting
|
||||
SWFUpload.prototype.setDebugEnabled = function (debugEnabled) {
|
||||
this.settings.debug_enabled = debugEnabled;
|
||||
this.callFlash("SetDebugEnabled", [debugEnabled]);
|
||||
};
|
||||
|
||||
// Public: setButtonImageURL loads a button image sprite
|
||||
SWFUpload.prototype.setButtonImageURL = function (buttonImageURL) {
|
||||
if (buttonImageURL == undefined) {
|
||||
buttonImageURL = "";
|
||||
}
|
||||
|
||||
this.settings.button_image_url = buttonImageURL;
|
||||
this.callFlash("SetButtonImageURL", [buttonImageURL]);
|
||||
};
|
||||
|
||||
// Public: setButtonDimensions resizes the Flash Movie and button
|
||||
SWFUpload.prototype.setButtonDimensions = function (width, height) {
|
||||
this.settings.button_width = width;
|
||||
this.settings.button_height = height;
|
||||
|
||||
var movie = this.getMovieElement();
|
||||
if (movie != undefined) {
|
||||
movie.style.width = width + "px";
|
||||
movie.style.height = height + "px";
|
||||
}
|
||||
|
||||
this.callFlash("SetButtonDimensions", [width, height]);
|
||||
};
|
||||
// Public: setButtonText Changes the text overlaid on the button
|
||||
SWFUpload.prototype.setButtonText = function (html) {
|
||||
this.settings.button_text = html;
|
||||
this.callFlash("SetButtonText", [html]);
|
||||
};
|
||||
// Public: setButtonTextPadding changes the top and left padding of the text overlay
|
||||
SWFUpload.prototype.setButtonTextPadding = function (left, top) {
|
||||
this.settings.button_text_top_padding = top;
|
||||
this.settings.button_text_left_padding = left;
|
||||
this.callFlash("SetButtonTextPadding", [left, top]);
|
||||
};
|
||||
|
||||
// Public: setButtonTextStyle changes the CSS used to style the HTML/Text overlaid on the button
|
||||
SWFUpload.prototype.setButtonTextStyle = function (css) {
|
||||
this.settings.button_text_style = css;
|
||||
this.callFlash("SetButtonTextStyle", [css]);
|
||||
};
|
||||
// Public: setButtonDisabled disables/enables the button
|
||||
SWFUpload.prototype.setButtonDisabled = function (isDisabled) {
|
||||
this.settings.button_disabled = isDisabled;
|
||||
this.callFlash("SetButtonDisabled", [isDisabled]);
|
||||
};
|
||||
// Public: setButtonAction sets the action that occurs when the button is clicked
|
||||
SWFUpload.prototype.setButtonAction = function (buttonAction) {
|
||||
this.settings.button_action = buttonAction;
|
||||
this.callFlash("SetButtonAction", [buttonAction]);
|
||||
};
|
||||
|
||||
// Public: setButtonCursor changes the mouse cursor displayed when hovering over the button
|
||||
SWFUpload.prototype.setButtonCursor = function (cursor) {
|
||||
this.settings.button_cursor = cursor;
|
||||
this.callFlash("SetButtonCursor", [cursor]);
|
||||
};
|
||||
|
||||
/* *******************************
|
||||
Flash Event Interfaces
|
||||
These functions are used by Flash to trigger the various
|
||||
events.
|
||||
|
||||
All these functions a Private.
|
||||
|
||||
Because the ExternalInterface library is buggy the event calls
|
||||
are added to a queue and the queue then executed by a setTimeout.
|
||||
This ensures that events are executed in a determinate order and that
|
||||
the ExternalInterface bugs are avoided.
|
||||
******************************* */
|
||||
|
||||
SWFUpload.prototype.queueEvent = function (handlerName, argumentArray) {
|
||||
// Warning: Don't call this.debug inside here or you'll create an infinite loop
|
||||
|
||||
if (argumentArray == undefined) {
|
||||
argumentArray = [];
|
||||
} else if (!(argumentArray instanceof Array)) {
|
||||
argumentArray = [argumentArray];
|
||||
}
|
||||
|
||||
var self = this;
|
||||
if (typeof this.settings[handlerName] === "function") {
|
||||
// Queue the event
|
||||
this.eventQueue.push(function () {
|
||||
this.settings[handlerName].apply(this, argumentArray);
|
||||
});
|
||||
|
||||
// Execute the next queued event
|
||||
setTimeout(function () {
|
||||
self.executeNextEvent();
|
||||
}, 0);
|
||||
|
||||
} else if (this.settings[handlerName] !== null) {
|
||||
throw "Event handler " + handlerName + " is unknown or is not a function";
|
||||
}
|
||||
};
|
||||
|
||||
// Private: Causes the next event in the queue to be executed. Since events are queued using a setTimeout
|
||||
// we must queue them in order to garentee that they are executed in order.
|
||||
SWFUpload.prototype.executeNextEvent = function () {
|
||||
// Warning: Don't call this.debug inside here or you'll create an infinite loop
|
||||
|
||||
var f = this.eventQueue ? this.eventQueue.shift() : null;
|
||||
if (typeof(f) === "function") {
|
||||
f.apply(this);
|
||||
}
|
||||
};
|
||||
|
||||
// Private: unescapeFileParams is part of a workaround for a flash bug where objects passed through ExternalInterface cannot have
|
||||
// properties that contain characters that are not valid for JavaScript identifiers. To work around this
|
||||
// the Flash Component escapes the parameter names and we must unescape again before passing them along.
|
||||
SWFUpload.prototype.unescapeFilePostParams = function (file) {
|
||||
var reg = /[$]([0-9a-f]{4})/i;
|
||||
var unescapedPost = {};
|
||||
var uk;
|
||||
|
||||
if (file != undefined) {
|
||||
for (var k in file.post) {
|
||||
if (file.post.hasOwnProperty(k)) {
|
||||
uk = k;
|
||||
var match;
|
||||
while ((match = reg.exec(uk)) !== null) {
|
||||
uk = uk.replace(match[0], String.fromCharCode(parseInt("0x" + match[1], 16)));
|
||||
}
|
||||
unescapedPost[uk] = file.post[k];
|
||||
}
|
||||
}
|
||||
|
||||
file.post = unescapedPost;
|
||||
}
|
||||
|
||||
return file;
|
||||
};
|
||||
|
||||
// Private: Called by Flash to see if JS can call in to Flash (test if External Interface is working)
|
||||
SWFUpload.prototype.testExternalInterface = function () {
|
||||
try {
|
||||
return this.callFlash("TestExternalInterface");
|
||||
} catch (ex) {
|
||||
return false;
|
||||
}
|
||||
};
|
||||
|
||||
// Private: This event is called by Flash when it has finished loading. Don't modify this.
|
||||
// Use the swfupload_loaded_handler event setting to execute custom code when SWFUpload has loaded.
|
||||
SWFUpload.prototype.flashReady = function () {
|
||||
// Check that the movie element is loaded correctly with its ExternalInterface methods defined
|
||||
var movieElement = this.getMovieElement();
|
||||
|
||||
if (!movieElement) {
|
||||
this.debug("Flash called back ready but the flash movie can't be found.");
|
||||
return;
|
||||
}
|
||||
|
||||
this.cleanUp(movieElement);
|
||||
|
||||
this.queueEvent("swfupload_loaded_handler");
|
||||
};
|
||||
|
||||
// Private: removes Flash added fuctions to the DOM node to prevent memory leaks in IE.
|
||||
// This function is called by Flash each time the ExternalInterface functions are created.
|
||||
SWFUpload.prototype.cleanUp = function (movieElement) {
|
||||
// Pro-actively unhook all the Flash functions
|
||||
try {
|
||||
if (this.movieElement && typeof(movieElement.CallFunction) === "unknown") { // We only want to do this in IE
|
||||
this.debug("Removing Flash functions hooks (this should only run in IE and should prevent memory leaks)");
|
||||
for (var key in movieElement) {
|
||||
try {
|
||||
if (typeof(movieElement[key]) === "function") {
|
||||
movieElement[key] = null;
|
||||
}
|
||||
} catch (ex) {
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (ex1) {
|
||||
|
||||
}
|
||||
|
||||
// Fix Flashes own cleanup code so if the SWFMovie was removed from the page
|
||||
// it doesn't display errors.
|
||||
window["__flash__removeCallback"] = function (instance, name) {
|
||||
try {
|
||||
if (instance) {
|
||||
instance[name] = null;
|
||||
}
|
||||
} catch (flashEx) {
|
||||
|
||||
}
|
||||
};
|
||||
|
||||
};
|
||||
|
||||
|
||||
/* This is a chance to do something before the browse window opens */
|
||||
SWFUpload.prototype.fileDialogStart = function () {
|
||||
this.queueEvent("file_dialog_start_handler");
|
||||
};
|
||||
|
||||
|
||||
/* Called when a file is successfully added to the queue. */
|
||||
SWFUpload.prototype.fileQueued = function (file) {
|
||||
file = this.unescapeFilePostParams(file);
|
||||
this.queueEvent("file_queued_handler", file);
|
||||
};
|
||||
|
||||
|
||||
/* Handle errors that occur when an attempt to queue a file fails. */
|
||||
SWFUpload.prototype.fileQueueError = function (file, errorCode, message) {
|
||||
file = this.unescapeFilePostParams(file);
|
||||
this.queueEvent("file_queue_error_handler", [file, errorCode, message]);
|
||||
};
|
||||
|
||||
/* Called after the file dialog has closed and the selected files have been queued.
|
||||
You could call startUpload here if you want the queued files to begin uploading immediately. */
|
||||
SWFUpload.prototype.fileDialogComplete = function (numFilesSelected, numFilesQueued, numFilesInQueue) {
|
||||
this.queueEvent("file_dialog_complete_handler", [numFilesSelected, numFilesQueued, numFilesInQueue]);
|
||||
};
|
||||
|
||||
SWFUpload.prototype.uploadStart = function (file) {
|
||||
file = this.unescapeFilePostParams(file);
|
||||
this.queueEvent("return_upload_start_handler", file);
|
||||
};
|
||||
|
||||
SWFUpload.prototype.returnUploadStart = function (file) {
|
||||
var returnValue;
|
||||
if (typeof this.settings.upload_start_handler === "function") {
|
||||
file = this.unescapeFilePostParams(file);
|
||||
returnValue = this.settings.upload_start_handler.call(this, file);
|
||||
} else if (this.settings.upload_start_handler != undefined) {
|
||||
throw "upload_start_handler must be a function";
|
||||
}
|
||||
|
||||
// Convert undefined to true so if nothing is returned from the upload_start_handler it is
|
||||
// interpretted as 'true'.
|
||||
if (returnValue === undefined) {
|
||||
returnValue = true;
|
||||
}
|
||||
|
||||
returnValue = !!returnValue;
|
||||
|
||||
this.callFlash("ReturnUploadStart", [returnValue]);
|
||||
};
|
||||
|
||||
|
||||
|
||||
SWFUpload.prototype.uploadProgress = function (file, bytesComplete, bytesTotal) {
|
||||
file = this.unescapeFilePostParams(file);
|
||||
this.queueEvent("upload_progress_handler", [file, bytesComplete, bytesTotal]);
|
||||
};
|
||||
|
||||
SWFUpload.prototype.uploadError = function (file, errorCode, message) {
|
||||
file = this.unescapeFilePostParams(file);
|
||||
this.queueEvent("upload_error_handler", [file, errorCode, message]);
|
||||
};
|
||||
|
||||
SWFUpload.prototype.uploadSuccess = function (file, serverData, responseReceived) {
|
||||
file = this.unescapeFilePostParams(file);
|
||||
this.queueEvent("upload_success_handler", [file, serverData, responseReceived]);
|
||||
};
|
||||
|
||||
SWFUpload.prototype.uploadComplete = function (file) {
|
||||
file = this.unescapeFilePostParams(file);
|
||||
this.queueEvent("upload_complete_handler", file);
|
||||
};
|
||||
|
||||
/* Called by SWFUpload JavaScript and Flash functions when debug is enabled. By default it writes messages to the
|
||||
internal debug console. You can override this event and have messages written where you want. */
|
||||
SWFUpload.prototype.debug = function (message) {
|
||||
this.queueEvent("debug_handler", message);
|
||||
};
|
||||
|
||||
|
||||
/* **********************************
|
||||
Debug Console
|
||||
The debug console is a self contained, in page location
|
||||
for debug message to be sent. The Debug Console adds
|
||||
itself to the body if necessary.
|
||||
|
||||
The console is automatically scrolled as messages appear.
|
||||
|
||||
If you are using your own debug handler or when you deploy to production and
|
||||
have debug disabled you can remove these functions to reduce the file size
|
||||
and complexity.
|
||||
********************************** */
|
||||
|
||||
// Private: debugMessage is the default debug_handler. If you want to print debug messages
|
||||
// call the debug() function. When overriding the function your own function should
|
||||
// check to see if the debug setting is true before outputting debug information.
|
||||
SWFUpload.prototype.debugMessage = function (message) {
|
||||
if (this.settings.debug) {
|
||||
var exceptionMessage, exceptionValues = [];
|
||||
|
||||
// Check for an exception object and print it nicely
|
||||
if (typeof message === "object" && typeof message.name === "string" && typeof message.message === "string") {
|
||||
for (var key in message) {
|
||||
if (message.hasOwnProperty(key)) {
|
||||
exceptionValues.push(key + ": " + message[key]);
|
||||
}
|
||||
}
|
||||
exceptionMessage = exceptionValues.join("\n") || "";
|
||||
exceptionValues = exceptionMessage.split("\n");
|
||||
exceptionMessage = "EXCEPTION: " + exceptionValues.join("\nEXCEPTION: ");
|
||||
SWFUpload.Console.writeLine(exceptionMessage);
|
||||
} else {
|
||||
SWFUpload.Console.writeLine(message);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
SWFUpload.Console = {};
|
||||
SWFUpload.Console.writeLine = function (message) {
|
||||
var console, documentForm;
|
||||
|
||||
try {
|
||||
console = document.getElementById("SWFUpload_Console");
|
||||
|
||||
if (!console) {
|
||||
documentForm = document.createElement("form");
|
||||
document.getElementsByTagName("body")[0].appendChild(documentForm);
|
||||
|
||||
console = document.createElement("textarea");
|
||||
console.id = "SWFUpload_Console";
|
||||
console.style.fontFamily = "monospace";
|
||||
console.setAttribute("wrap", "off");
|
||||
console.wrap = "off";
|
||||
console.style.overflow = "auto";
|
||||
console.style.width = "700px";
|
||||
console.style.height = "350px";
|
||||
console.style.margin = "5px";
|
||||
documentForm.appendChild(console);
|
||||
}
|
||||
|
||||
console.value += message + "\n";
|
||||
|
||||
console.scrollTop = console.scrollHeight - console.clientHeight;
|
||||
} catch (ex) {
|
||||
alert("Exception: " + ex.name + " Message: " + ex.message);
|
||||
}
|
||||
};
|
||||
20
trunk/www/js/jquery/xheditor/xheditor_plugins/ubb.min.js
vendored
Executable file
@@ -0,0 +1,20 @@
|
||||
function ubb2html(f){function o(h){return h!=null&&h!=""?!isNaN(h):false}var b=String(f),p=[],n=0;b=b.replace(/&/ig,"&");b=b.replace(/[<>]/g,function(h){return{"<":"<",">":">"}[h]});b=b.replace(/\r?\n/g,"<br />");b=b.replace(/\[code\s*(?:=\s*([^\]]+?))?\]([\s\S]*?)\[\/code\]/ig,function(h){n++;p[n]=h;return"[\tubbcodeplace_"+n+"\t]"});b=b.replace(/\[(\/?)(b|u|i|s|sup|sub)\]/ig,"<$1$2>");b=b.replace(/\[color\s*=\s*([^\]"]+?)(?:"[^\]]*?)?\s*\]/ig,'<font color="$1">');b=b.replace(/\[size\s*=\s*(\d+?)\s*\]/ig,
|
||||
'<font size="$1">');b=b.replace(/\[font\s*=\s*([^\]"]+?)(?:"[^\]]*?)?\s*\]/ig,'<font face="$1">');b=b.replace(/\[\/(color|size|font)\]/ig,"</font>");b=b.replace(/\[back\s*=\s*([^\]"]+?)(?:"[^\]]*?)?\s*\]/ig,'<span style="background-color:$1;">');b=b.replace(/\[\/back\]/ig,"</span>");for(f=0;f<3;f++)b=b.replace(/\[align\s*=\s*([^\]"]+?)(?:"[^\]]*?)?\s*\](((?!\[align(?:\s+[^\]]+)?\])[\s\S])*?)\[\/align\]/ig,'<p align="$1">$2</p>');b=b.replace(/\[img\]\s*(((?!")[\s\S])+?)(?:"[\s\S]*?)?\s*\[\/img\]/ig,
|
||||
'<img src="$1" alt="" />');b=b.replace(/\[img\s*=([^,\]]*)(?:\s*,\s*(\d*%?)\s*,\s*(\d*%?)\s*)?(?:,?\s*(\w+))?\s*\]\s*(((?!")[\s\S])+?)(?:"[\s\S]*)?\s*\[\/img\]/ig,function(h,i,a,k,m,g){h='<img src="'+g+'" alt="'+i+'"';m=m?m:!o(a)?a:"";if(o(a))h+=' width="'+a+'"';if(o(k))h+=' height="'+k+'"';if(m)h+=' align="'+m+'"';h+=" />";return h});b=b.replace(/\[emot\s*=\s*([^\]"]+?)(?:"[^\]]*?)?\s*\/\]/ig,'<img emot="$1" />');b=b.replace(/\[url\]\s*(((?!")[\s\S])*?)(?:"[\s\S]*?)?\s*\[\/url\]/ig,'<a href="$1">$1</a>');
|
||||
b=b.replace(/\[url\s*=\s*([^\]"]+?)(?:"[^\]]*?)?\s*\]\s*([\s\S]*?)\s*\[\/url\]/ig,'<a href="$1">$2</a>');b=b.replace(/\[email\]\s*(((?!")[\s\S])+?)(?:"[\s\S]*?)?\s*\[\/email\]/ig,'<a href="mailto:$1">$1</a>');b=b.replace(/\[email\s*=\s*([^\]"]+?)(?:"[^\]]*?)?\s*\]\s*([\s\S]+?)\s*\[\/email\]/ig,'<a href="mailto:$1">$2</a>');b=b.replace(/\[quote\]([\s\S]*?)\[\/quote\]/ig,"<blockquote>$1</blockquote>");b=b.replace(/\[flash\s*(?:=\s*(\d+)\s*,\s*(\d+)\s*)?\]\s*(((?!")[\s\S])+?)(?:"[\s\S]*?)?\s*\[\/flash\]/ig,
|
||||
function(h,i,a,k){i||(i=480);a||(a=400);return'<embed type="application/x-shockwave-flash" src="'+k+'" wmode="opaque" quality="high" bgcolor="#ffffff" menu="false" play="true" loop="true" width="'+i+'" height="'+a+'"/>'});b=b.replace(/\[media\s*(?:=\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*(\d+)\s*)?)?\]\s*(((?!")[\s\S])+?)(?:"[\s\S]*?)?\s*\[\/media\]/ig,function(h,i,a,k,m){i||(i=480);a||(a=400);return'<embed type="application/x-mplayer2" src="'+m+'" enablecontextmenu="false" autostart="'+(k=="1"?"true":"false")+
|
||||
'" width="'+i+'" height="'+a+'"/>'});b=b.replace(/\[table\s*(?:=\s*(\d{1,4}%?)\s*(?:,\s*([^\]"]+)(?:"[^\]]*?)?)?)?\s*\]/ig,function(h,i,a){h="<table";if(i)h+=' width="'+i+'"';if(a)h+=' bgcolor="'+a+'"';return h+">"});b=b.replace(/\[tr\s*(?:=\s*([^\]"]+?)(?:"[^\]]*?)?)?\s*\]/ig,function(h,i){return"<tr"+(i?' bgcolor="'+i+'"':"")+">"});b=b.replace(/\[td\s*(?:=\s*(\d{1,2})\s*,\s*(\d{1,2})\s*(?:,\s*(\d{1,4}%?))?)?\s*\]/ig,function(h,i,a,k){return"<td"+(i>1?' colspan="'+i+'"':"")+(a>1?' rowspan="'+a+'"':
|
||||
"")+(k?' width="'+k+'"':"")+">"});b=b.replace(/\[\/(table|tr|td)\]/ig,"</$1>");b=b.replace(/\[\*\]((?:(?!\[\*\]|\[\/list\]|\[list\s*(?:=[^\]]+)?\])[\s\S])+)/ig,"<li>$1</li>");b=b.replace(/\[list\s*(?:=\s*([^\]"]+?)(?:"[^\]]*?)?)?\s*\]/ig,function(h,i){var a="<ul";if(i)a+=' type="'+i+'"';return a+">"});b=b.replace(/\[\/list\]/ig,"</ul>");for(f=1;f<=n;f++)b=b.replace("[\tubbcodeplace_"+f+"\t]",p[f]);return b=b.replace(/(^|<\/?\w+(?:\s+[^>]*?)?>)([^<$]+)/ig,function(h,i,a){return i+a.replace(/[\t ]/g,
|
||||
function(k){return{"\t":" "," ":" "}[k]})})}
|
||||
function html2ubb(f){function o(g){var c;if(c=g.match(/\s*rgb\s*\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*\)/i)){for(g=(c[1]*65536+c[2]*256+c[3]*1).toString(16);g.length<6;)g="0"+g;g="#"+g}return g=g.replace(/^#([0-9a-f])([0-9a-f])([0-9a-f])$/i,"#$1$1$2$2$3$3")}var b={"xx-small":1,"8pt":1,"x-small":2,"10pt":2,small:3,"12pt":3,medium:4,"14pt":4,large:5,"18pt":5,"x-large":6,"24pt":6,"xx-large":7,"36pt":7},p=/\s+src\s*=\s*(["']?)\s*(.+?)\s*\1(\s|$)/i,n=/\s+width\s*=\s*(["']?)\s*(\d+(?:\.\d+)?%?)\s*\1(\s|$)/i,
|
||||
h=/\s+height\s*=\s*(["']?)\s*(\d+(?:\.\d+)?%?)\s*\1(\s|$)/i,i=/(?: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,a=String(f),k=[],m=0;a=a.replace(/\s*\r?\n\s*/g,"");a=a.replace(/<(script|style)(\s+[^>]*?)?>[\s\S]*?<\/\1>/ig,"");a=a.replace(/<!--[\s\S]*?--\>/ig,"");a=a.replace(/<br\s*?\/?>/ig,"\r\n");a=a.replace(/\[code\s*(=\s*([^\]]+?))?\]([\s\S]*?)\[\/code\]/ig,function(g){m++;k[m]=g;return"[\tubbcodeplace_"+
|
||||
m+"\t]"});a=a.replace(/<(\/?)(b|u|i|s)(\s+[^>]*?)?>/ig,"[$1$2]");a=a.replace(/<(\/?)strong(\s+[^>]*?)?>/ig,"[$1b]");a=a.replace(/<(\/?)em(\s+[^>]*?)?>/ig,"[$1i]");a=a.replace(/<(\/?)(strike|del)(\s+[^>]*?)?>/ig,"[$1s]");a=a.replace(/<(\/?)(sup|sub)(\s+[^>]*?)?>/ig,"[$1$2]");for(f=0;f<3;f++)a=a.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(g,c,d,e){g=d.match(/(?:^|;)\s*font-family\s*:\s*([^;]+)/i);c=d.match(/(?:^|;)\s*font-size\s*:\s*([^;]+)/i);var j=d.match(/(?:^|;)\s*color\s*:\s*([^;]+)/i);d=d.match(/(?:^|;)\s*(?:background|background-color)\s*:\s*([^;]+)/i);e=e;if(g)e="[font="+g[1]+"]"+e+"[/font]";if(c)if(c=b[c[1].toLowerCase()])e="[size="+c+"]"+e+"[/size]";if(j)e="[color="+o(j[1])+"]"+e+"[/color]";if(d)e="[back="+o(d[1])+"]"+e+"[/back]";return e});for(f=0;f<3;f++)a=a.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(f=0;f<3;f++)a=a.replace(/<(center)(?:\s+[^>]*?)?>(((?!<\1(\s+[^>]*?)?>)[\s\S])*?)<\/\1>/ig,"[align=center]$2[/align]");for(f=0;f<3;f++)a=a.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(){});a=a.replace(/<a(?:\s+[^>]*?)?\s+href=(["'])\s*(.+?)\s*\1[^>]*>\s*([\s\S]*?)\s*<\/a>/ig,
|
||||
function(g,c,d,e){if(!(d&&e))return"";g="url";if(d.match(/^mailto:/i)){g="email";d=d.replace(/mailto:(.+?)/i,"$1")}c="["+g;if(d!=e)c+="="+d;return c+"]"+e+"[/"+g+"]"});a=a.replace(/<img(\s+[^>]*?)\/?>/ig,function(g,c){var d=c.match(/\s+emot\s*=\s*(["']?)\s*(.+?)\s*\1(\s|$)/i);if(d)return"[emot="+d[2]+"/]";d=c.match(p);var e=c.match(/\s+alt\s*=\s*(["']?)\s*(.*?)\s*\1(\s|$)/i),j=c.match(n),l=c.match(h),q=c.match(/\s+align\s*=\s*(["']?)\s*(\w+)\s*\1(\s|$)/i),r="[img",s="";if(!d)return"";s+=e[2];if(j||
|
||||
l)s+=","+(j?j[2]:"")+","+(l?l[2]:"");if(q)s+=","+q[2];if(s)r+="="+s;r+="]"+d[2]+"[/img]";return r});a=a.replace(/<blockquote(?:\s+[^>]*?)?>([\s\S]+?)<\/blockquote>/ig,"[quote]$1[/quote]");a=a.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(g,c){var d=c.match(p),e=c.match(n),j=c.match(h),l="[flash";if(!d)return"";if(e&&j)l+="="+e[2]+","+j[2];l+="]"+d[2];return l+"[/flash]"});
|
||||
a=a.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(g,c){var d=c.match(p),e=c.match(n),j=c.match(h),l=c.match(/\s+autostart\s*=\s*(["']?)\s*(.+?)\s*\1(\s|$)/i),q="[media",r="0";if(!d)return"";if(l)if(l[2]=="true")r="1";if(e&&j)q+="="+e[2]+","+j[2]+","+r;q+="]"+d[2];return q+"[/media]"});a=a.replace(/<table(\s+[^>]*?)?>/ig,function(g,c){var d="[table";if(c){var e=c.match(n),j=c.match(i);
|
||||
if(e){d+="="+e[2];if(j)d+=","+j[2]}}return d+"]"});a=a.replace(/<tr(\s+[^>]*?)?>/ig,function(g,c){var d="[tr";if(c){var e=c.match(i);if(e)d+="="+e[2]}return d+"]"});a=a.replace(/<(?:th|td)(\s+[^>]*?)?>/ig,function(g,c){var d="[td";if(c){var e=c.match(/\s+colspan\s*=\s*(["']?)\s*(\d+)\s*\1(\s|$)/i),j=c.match(/\s+rowspan\s*=\s*(["']?)\s*(\d+)\s*\1(\s|$)/i),l=c.match(n);e=e?e[2]:1;j=j?j[2]:1;if(e>1||j>1||l)d+="="+e+","+j;if(l)d+=","+l[2]}return d+"]"});a=a.replace(/<\/(table|tr)>/ig,"[/$1]");a=a.replace(/<\/(th|td)>/ig,
|
||||
"[/td]");a=a.replace(/<ul(\s+[^>]*?)?>/ig,function(g,c){var d;if(c)d=c.match(/\s+type\s*=\s*(["']?)\s*(.+?)\s*\1(\s|$)/i);return"[list"+(d?"="+d[2]:"")+"]"});a=a.replace(/<ol(\s+[^>]*?)?>/ig,"[list=1]");a=a.replace(/<li(\s+[^>]*?)?>/ig,"[*]");a=a.replace(/<\/li>/ig,"");a=a.replace(/<\/(ul|ol)>/ig,"[/list]");a=a.replace(/<h([1-6])(\s+[^>]*?)?>/ig,function(g,c){return"\r\n\r\n[size="+(7-c)+"][b]"});a=a.replace(/<\/h[1-6]>/ig,"[/b][/size]\r\n\r\n");a=a.replace(/<address(\s+[^>]*?)?>/ig,"\r\n[i]");a=
|
||||
a.replace(/<\/address>/ig,"[i]\r\n");for(f=0;f<3;f++)a=a.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(f=0;f<3;f++)a=a.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");a=a.replace(/((\s| )*\r?\n){3,}/g,
|
||||
"\r\n\r\n");a=a.replace(/^((\s| )*\r?\n)+/g,"");a=a.replace(/((\s| )*\r?\n)+$/g,"");for(f=1;f<=m;f++)a=a.replace("[\tubbcodeplace_"+f+"\t]",k[f]);a=a.replace(/<[^<>]+?>/g,"");a=a.replace(/</ig,"<");a=a.replace(/>/ig,">");a=a.replace(/ /ig," ");return a=a.replace(/&/ig,"&")};
|
||||