diff --git a/module/bug/model.php b/module/bug/model.php index bdae0cbc99..9a73603d2d 100644 --- a/module/bug/model.php +++ b/module/bug/model.php @@ -53,7 +53,7 @@ class bugModel extends model ->setDefault('openedBuild', '') ->setIF($this->post->assignedTo != '', 'assignedDate', $now) ->setIF($this->post->story != false, 'storyVersion', $this->loadModel('story')->getVersion($this->post->story)) - ->specialChars('title,steps,keyword') + ->specialChars('title,keyword') ->cleanInt('product, module, severity') ->join('openedBuild', ',') ->remove('files, labels') @@ -110,7 +110,7 @@ class bugModel extends model $now = helper::now(); $bug = fixer::input('post') ->cleanInt('product,module,severity,project,story,task') - ->specialChars('title,steps,keyword') + ->specialChars('title,keyword') ->remove('comment,files,labels') ->setDefault('project,module,project,story,task,duplicateBug', 0) ->setDefault('openedBuild', '') diff --git a/module/bug/view/buildtemplates.html.php b/module/bug/view/buildtemplates.html.php index bc721a113c..fb57365d5c 100644 --- a/module/bug/view/buildtemplates.html.php +++ b/module/bug/view/buildtemplates.html.php @@ -1,13 +1,37 @@
@@ -191,7 +198,7 @@ $(function() { - +
fetch('bug', 'buildTemplates');?>
diff --git a/module/bug/view/edit.html.php b/module/bug/view/edit.html.php index c5a20de872..238fb587ea 100644 --- a/module/bug/view/edit.html.php +++ b/module/bug/view/edit.html.php @@ -25,9 +25,10 @@ - + @@ -141,8 +142,13 @@ function setDuplicate(resolution) $('#duplicateBugBox').hide(); } } + +/* 富文本编辑器。*/ +KE.show({ + id:'steps', + items:bugTools +}); var userList = "".split(','); -tools = simpleTools; $(function() { $("#mailto").autocomplete(userList, { multiple: true, mustMatch: true}); $("#searchStories").colorbox({width:680, height:400, iframe:true, transition:'none'}); @@ -167,7 +173,7 @@ $(function() {
bug->legendSteps;?> -
steps, "rows='8' class='xhe'");?>
+
steps, "id='kindeditor' rows='12'");?>
bug->legendComment;?> diff --git a/module/bug/view/view.html.php b/module/bug/view/view.html.php index a9e87064b4..e8cb09aeea 100644 --- a/module/bug/view/view.html.php +++ b/module/bug/view/view.html.php @@ -24,7 +24,6 @@ ?> -
deleted) echo "class='deleted'";?>>BUG #id . $lang->colon . $bug->title;?>
@@ -53,7 +52,7 @@
bug->legendSteps;?> -
steps);?>
+
steps;?>
bug->legendAttatch;?> diff --git a/module/common/view/kindeditor.html.php b/module/common/view/kindeditor.html.php new file mode 100644 index 0000000000..c330928294 --- /dev/null +++ b/module/common/view/kindeditor.html.php @@ -0,0 +1,17 @@ +getExtViewFile(__FILE__)){include $extView; return helper::cd();}?> + + diff --git a/module/common/view/xheditor.html.php b/module/common/view/xheditor.html.php deleted file mode 100644 index d520594866..0000000000 --- a/module/common/view/xheditor.html.php +++ /dev/null @@ -1,54 +0,0 @@ -getExtViewFile(__FILE__)){include $extView; return helper::cd();}?> - - - - diff --git a/module/story/model.php b/module/story/model.php index 1c0c230a49..307a4a53d5 100644 --- a/module/story/model.php +++ b/module/story/model.php @@ -117,7 +117,7 @@ class storyModel extends model $data->story = $storyID; $data->version = 1; $data->title = $story->title; - $data->spec = htmlspecialchars($this->post->spec); + $data->spec = $this->post->spec; $this->dao->insert(TABLE_STORYSPEC)->data($data)->exec(); return $storyID; } @@ -160,7 +160,7 @@ class storyModel extends model $data->story = $storyID; $data->version = $oldStory->version + 1; $data->title = $story->title; - $data->spec = htmlspecialchars($this->post->spec); + $data->spec = $this->post->spec; $this->dao->insert(TABLE_STORYSPEC)->data($data)->exec(); $story->spec = $this->post->spec; } diff --git a/module/story/view/change.html.php b/module/story/view/change.html.php index 90c8dfeb8d..4d24150c7b 100644 --- a/module/story/view/change.html.php +++ b/module/story/view/change.html.php @@ -23,6 +23,14 @@ */ ?> + +
@@ -37,7 +45,7 @@ - + diff --git a/module/story/view/create.html.php b/module/story/view/create.html.php index 0bb471046b..fb4dfa0327 100644 --- a/module/story/view/create.html.php +++ b/module/story/view/create.html.php @@ -23,7 +23,15 @@ */ ?> + +
story->spec;?>spec, 'rows=5 class="area-1"');?>
story->specTemplate;?>
spec, 'rows=8 class="area-1"');?>
story->specTemplate;?>
story->comment;?>
@@ -57,7 +65,7 @@ - + diff --git a/module/story/view/view.html.php b/module/story/view/view.html.php index f379775ee1..24bae49d55 100644 --- a/module/story/view/view.html.php +++ b/module/story/view/view.html.php @@ -51,7 +51,7 @@
story->legendSpec;?> -
spec);?>
+
spec;?>
story->legendAttatch;?> diff --git a/module/task/model.php b/module/task/model.php index bd59d1332f..ac521ffa2c 100644 --- a/module/task/model.php +++ b/module/task/model.php @@ -35,7 +35,6 @@ class taskModel extends model { $task = fixer::input('post') ->striptags('name') - ->specialChars('desc') ->add('project', (int)$projectID) ->setDefault('estimate, left, story', 0) ->setDefault('deadline', '0000-00-00') @@ -69,7 +68,6 @@ class taskModel extends model $oldTask = $this->getById($taskID); $task = fixer::input('post') ->striptags('name') - ->specialChars('desc') ->setDefault('story, estimate, left, consumed', 0) ->setIF($this->post->story != false and $this->post->story != $oldTask->story, 'storyVersion', $this->loadModel('story')->getVersion($this->post->story)) ->setIF($this->post->status == 'done', 'left', 0) diff --git a/module/task/view/create.html.php b/module/task/view/create.html.php index 138a5a84f0..6ce4f30b2c 100644 --- a/module/task/view/create.html.php +++ b/module/task/view/create.html.php @@ -25,6 +25,7 @@ +
story->spec;?>
story->specTemplate;?>

story->specTemplate;?>
story->keywords;?>
@@ -54,7 +62,7 @@ - diff --git a/module/testtask/view/edit.html.php b/module/testtask/view/edit.html.php index 8dd4bcea42..42f6618bd1 100644 --- a/module/testtask/view/edit.html.php +++ b/module/testtask/view/edit.html.php @@ -24,6 +24,14 @@ ?> + +
testtask->desc;?> +
@@ -54,7 +62,7 @@ - diff --git a/module/testtask/view/view.html.php b/module/testtask/view/view.html.php index 0cb8d69f40..5c3bea9cd0 100644 --- a/module/testtask/view/view.html.php +++ b/module/testtask/view/view.html.php @@ -53,7 +53,7 @@ -
testtask->desc;?>desc, "rows=8 class='area-1'");?> + desc, "rows=10 class='area-1'");?>
testtask->desc;?>desc);?> + desc;?>
diff --git a/module/todo/model.php b/module/todo/model.php index 3eee27ee66..1cdc3cce04 100644 --- a/module/todo/model.php +++ b/module/todo/model.php @@ -33,7 +33,7 @@ class todoModel extends model $todo = fixer::input('post') ->add('account', $this->app->user->account) ->add('idvalue', 0) - ->specialChars('type,name,desc') + ->specialChars('type,name') ->cleanInt('date, pri, begin, end, private') ->setIF($this->post->type != 'custom', 'name', '') ->setIF($this->post->type == 'bug' and $this->post->bug, 'idvalue', $this->post->bug) @@ -59,7 +59,7 @@ class todoModel extends model if($oldTodo->type != 'custom') $oldTodo->name = ''; $todo = fixer::input('post') ->cleanInt('date, pri, begin, end, private') - ->specialChars('type,name,desc') + ->specialChars('type,name') ->setIF($this->post->type != 'custom', 'name', '') ->setIF($this->post->begin == false, 'begin', '2400') ->setIF($this->post->end == false, 'end', '2400') diff --git a/module/todo/view/create.html.php b/module/todo/view/create.html.php index 066a4d8906..ca418c94de 100644 --- a/module/todo/view/create.html.php +++ b/module/todo/view/create.html.php @@ -23,7 +23,14 @@ */ ?> - + +
@@ -46,7 +53,7 @@ - diff --git a/module/todo/view/edit.html.php b/module/todo/view/edit.html.php index fcb62c8a39..4b5f4d43ed 100644 --- a/module/todo/view/edit.html.php +++ b/module/todo/view/edit.html.php @@ -23,6 +23,14 @@ */ ?> + +
todo->desc;?> +
todo->status;?>
@@ -51,7 +59,7 @@ - + diff --git a/module/todo/view/view.html.php b/module/todo/view/view.html.php index 674bf10e2a..70432bd138 100644 --- a/module/todo/view/view.html.php +++ b/module/todo/view/view.html.php @@ -58,7 +58,7 @@ - + diff --git a/www/js/jquery/kindeditor/kindeditor-min.js b/www/js/jquery/kindeditor/kindeditor-min.js new file mode 100644 index 0000000000..9f4730e401 --- /dev/null +++ b/www/js/jquery/kindeditor/kindeditor-min.js @@ -0,0 +1,168 @@ +(function(f){var d={};d.version="3.5.1 (2010-07-18)";d.scriptPath=function(){for(var a=document.getElementsByTagName("script"),b=0,c=a.length;b-1&&a.indexOf("opera")==-1,GECKO:a.indexOf("gecko")>-1&&a.indexOf("khtml")== +-1,WEBKIT:a.indexOf("applewebkit")>-1,OPERA:a.indexOf("opera")>-1}}();d.setting={wyswygMode:true,loadStyleMode:true,resizeMode:2,filterMode:false,autoSetDataMode:true,shadowMode:true,urlType:"",skinType:"default",newlineTag:"p",dialogAlignType:"page",cssPath:"",skinsPath:d.scriptPath===""?"":d.scriptPath+"skins/",pluginsPath:d.scriptPath===""?"":d.scriptPath+"plugins/",minWidth:200,minHeight:100,minChangeSize:5,toolbarLineHeight:24,statusbarHeight:11,items:["source","|","fullscreen","undo","redo", +"print","cut","copy","paste","plainpaste","wordpaste","|","justifyleft","justifycenter","justifyright","justifyfull","insertorderedlist","insertunorderedlist","indent","outdent","subscript","superscript","|","selectall","-","title","fontname","fontsize","|","textcolor","bgcolor","bold","italic","underline","strikethrough","removeformat","|","image","flash","media","advtable","hr","emoticons","link","unlink","|","about"],colorTable:[["#E53333","#E56600","#FF9900","#64451D","#DFC5A4","#FFE500"],["#009900", +"#006600","#99BB00","#B8D100","#60D978","#00D5FF"],["#337FE5","#003399","#4C33E5","#9933E5","#CC33E5","#EE33EE"],["#FFFFFF","#CCCCCC","#999999","#666666","#333333","#000000"]],noEndTags:["br","hr","img","area","col","embed","input","param"],inlineTags:["b","del","em","font","i","span","strike","strong","sub","sup","u"],endlineTags:["br","hr","table","tbody","td","tr","th","div","p","ol","ul","li","blockquote","h1","h2","h3","h4","h5","h6","script","style","marquee"],htmlTags:{font:["color","size", +"face",".background-color"],span:[".color",".background-color",".font-size",".font-family",".background",".font-weight",".font-style",".text-decoration",".vertical-align"],div:["align",".border",".margin",".padding",".text-align",".color",".background-color",".font-size",".font-family",".font-weight",".background",".font-style",".text-decoration",".vertical-align",".margin-left"],table:["border","cellspacing","cellpadding","width","height","align","bordercolor",".padding",".margin",".border","bgcolor", +".text-align",".color",".background-color",".font-size",".font-family",".font-weight",".font-style",".text-decoration",".background",".width",".height"],"td,th":["align","valign","width","height","colspan","rowspan","bgcolor",".text-align",".color",".background-color",".font-size",".font-family",".font-weight",".font-style",".text-decoration",".vertical-align",".background"],a:["href","target","name"],embed:["src","width","height","type","loop","autostart","quality",".width",".height","align","allowscriptaccess", +"/"],img:["src","width","height","border","alt","title",".width",".height","/"],hr:["/"],br:["/"],"p,ol,ul,li,blockquote,h1,h2,h3,h4,h5,h6":["align",".text-align",".color",".background-color",".font-size",".font-family",".background",".font-weight",".font-style",".text-decoration",".vertical-align",".text-indent",".margin-left"],"tbody,tr,strong,b,sub,sup,em,i,u,strike":[]},mediaTypes:{rm:"audio/x-pn-realaudio-plugin",flash:"application/x-shockwave-flash",media:"video/x-ms-asf-plugin"}};d.g={};d.plugin= +{};d.$=function(a,b){return(b||document).getElementById(a)};d.$$=function(a,b){return(b||document).createElement(a)};d.event={add:function(a,b,c,e){if(a.addEventListener)a.addEventListener(b,c,false);else a.attachEvent&&a.attachEvent("on"+b,c);e!==f&&d.g[e].eventStack.push({el:a,type:b,fn:c})},remove:function(a,b,c,e){if(a.removeEventListener)a.removeEventListener(b,c,false);else a.detachEvent&&a.detachEvent("on"+b,c);if(e!==f){e=d.g[e].eventStack;for(var g=0,h=e.length;g18)&&g.keyCode!=116){b(g);d.event.stop(g); +return false}},c);a=a.nodeName=="#document"?a.body:a;this.add(a,"paste",e,c);this.add(a,"cut",e,c)},ctrl:function(a,b,c,e){b=b.toString().match(/^\d{2,}$/)?b:b.toUpperCase().charCodeAt(0);this.add(a,"keydown",function(g){if(g.ctrlKey&&g.keyCode==b&&!g.shiftKey&&!g.altKey){c(g);d.event.stop(g);return false}},e)},ready:function(a,b,c,e){b=b||window;c=c||document;var g=false,h=function(){if(!g){g=true;a()}};if(c.addEventListener)this.add(c,"DOMContentLoaded",h,e);else if(c.attachEvent){this.add(c,"readystatechange", +function(){c.readyState=="complete"&&h()},e);if(c.documentElement.doScroll&&typeof b.frameElement==="undefined"){var i=function(){if(!g){try{c.documentElement.doScroll("left")}catch(j){window.setTimeout(i,0);return}h()}};i()}}this.add(b,"load",h,e)}};d.each=function(a,b){for(var c in a)a.hasOwnProperty(c)&&b(c,a[c])};d.eachNode=function(a,b){var c=function(e){if(d.util.getNodeType(e)!=1)return true;for(e=e.firstChild;e;){var g=e.nextSibling;if(!b(e))return false;if(!c(e))return false;e=g}return true}; +c(a)};d.selection=function(a){this.keRange=this.range=this.sel=null;this.isControl=false;var b=a.parentWindow||a.defaultView;this.init=function(){var c=b.getSelection?b.getSelection():a.selection,e;try{e=c.rangeCount>0?c.getRangeAt(0):c.createRange()}catch(g){}e||(e=d.util.createRange(a));this.sel=c;this.range=e;var h,i,j;if(d.browser.IE)if(e.item){this.isControl=true;c=i=e.item(0);h=j=0}else{this.isControl=false;c=function(l){var m=e.duplicate();m.collapse(l);var p=m.parentElement(),o=p.childNodes; +if(o.length==0)return{node:p,pos:0};var q,r=0,u=false,n=e.duplicate();d.util.moveToElementText(n,p);for(var v=0,t=o.length;v0)u=true;else if(x==0)if(l.nodeType==1){m=new d.range(a);m.selectTextNode(l);return{node:m.startNode,pos:0}}else return{node:l,pos:0};if(l.nodeType==1){x=e.duplicate();d.util.moveToElementText(x,l);n.setEndPoint("StartToEnd",x);if(u)r+=x.text.length;else r=0}else if(l.nodeType==3){n.moveStart("character",l.nodeValue.length); +r+=l.nodeValue.length}u||(q=l)}if(!u&&q.nodeType==1){q=p.lastChild;return{node:q,pos:q.nodeType==1?1:q.nodeValue.length}}n=e.duplicate();d.util.moveToElementText(n,p);n.setEndPoint("StartToEnd",m);r-=n.text.replace(/\r\n|\n|\r/g,"").length;return{node:q,pos:r}};h=c(true);j=c(false);c=h.node;h=h.pos;i=j.node;j=j.pos}else{c=e.startContainer;h=e.startOffset;i=e.endContainer;j=e.endOffset;if(c.nodeType==1&&typeof c.childNodes[h]!="undefined"){c=c.childNodes[h];h=0}if(i.nodeType==1){j=j==0?1:j;if(typeof i.childNodes[j- +1]!="undefined"){i=i.childNodes[j-1];j=i.nodeType==1?0:i.nodeValue.length}}this.isControl=c.nodeType==1&&c===i&&e.startOffset+1==e.endOffset;if(c.nodeType==1&&i.nodeType==3&&j==0&&i.previousSibling)for(var k=i.previousSibling;k;){if(k===c){i=c;break}if(k.childNodes.length!=1)break;k=k.childNodes[0]}if(e.collapsed){k=new d.range(a);k.setTextStart(c,h);i=k.startNode;j=k.startPos}}k=new d.range(a);k.setTextStart(c,h);k.setTextEnd(i,j);this.keRange=k};this.init();this.addRange=function(c){if(!(d.browser.GECKO&& +d.browser.VERSION<3)){this.keRange=c;if(d.browser.IE){var e=function(j){var k=d.util.createRange(a),l=j?c.startNode:c.endNode;if(l.nodeType==1){d.util.moveToElementText(k,l);k.collapse(j)}else if(l.nodeType==3){k=d.util.getNodeStartRange(a,l);k.moveStart("character",j?c.startPos:c.endPos)}return k};if(!this.range.item){var g=c.startNode;if(g==c.endNode&&d.util.getNodeType(g)==1&&d.util.getNodeTextLength(g)==0){e=a.createTextNode(" ");g.appendChild(e);d.util.moveToElementText(this.range,g);this.range.collapse(false); +this.range.select();g.removeChild(e)}else{if(g.nodeType==3&&c.collapsed()){this.range=e(true);this.range.collapse(true)}else{this.range.setEndPoint("StartToStart",e(true));this.range.setEndPoint("EndToStart",e(false))}this.range.select()}}}else{g=function(j){for(var k=0;j;){j=j.previousSibling;k++}return--k};e=new d.range(a);e.setTextStart(c.startNode,c.startPos);e.setTextEnd(c.endNode,c.endPos);var h=e.startNode,i=e.endNode;d.util.getNodeType(h)==88?this.range.setStart(h.parentNode,g(e.startNode)): +this.range.setStart(h,e.startPos);d.util.getNodeType(i)==88?this.range.setEnd(i.parentNode,g(e.endNode)+1):this.range.setEnd(i,e.endPos);this.sel.removeAllRanges();this.sel.addRange(this.range)}}};this.focus=function(){d.browser.IE&&this.range!=null&&this.range.select()}};d.range=function(a){this.endPos=this.endNode=this.startPos=this.startNode=null;this.getParentElement=function(){var b=function(g,h){for(;g&&(!g.tagName||g.tagName.toLowerCase()!="body");){g=g.parentNode;if(h(g))return}},c=[];b(this.startNode, +function(g){c.push(g)});var e;b(this.endNode,function(g){if(d.util.inArray(g,c)){e=g;return true}});return e?e:a.body};this.getNodeList=function(){var b=this,c=this.getParentElement(),e=[],g=false;if(c==b.startNode)g=true;g&&e.push(c);d.eachNode(c,function(h){if(h==b.startNode)g=true;var i=new d.range(a);i.selectTextNode(h);var j=i.comparePoints("START_TO_END",b);if(j>0)return false;else if(j==0)if(i.startNode!==i.endNode||i.startPos!==i.endPos)return false;g&&e.push(h);return true});return e};this.comparePoints= +function(b,c){var e=function(g,h,i,j){if(d.browser.IE){var k=function(m,p,o){var q=d.util.createRange(a),r=d.util.getNodeType(m);if(r==1){d.util.moveToElementText(q,m);q.collapse(o)}else if(r==3){q=d.util.getNodeStartRange(a,m);q.moveStart("character",p);q.collapse(true)}return q},l;l=b=="START_TO_START"||b=="START_TO_END"?k(g,h,true):k(g,h,false);g=b=="START_TO_START"||b=="END_TO_START"?k(i,j,true):k(i,j,false);return l.compareEndPoints("StartToStart",g)}else{l=d.util.createRange(a);l.selectNode(g); +b=="START_TO_START"||b=="START_TO_END"?l.collapse(true):l.collapse(false);g=d.util.createRange(a);g.selectNode(i);b=="START_TO_START"||b=="END_TO_START"?g.collapse(true):g.collapse(false);h=l.compareBoundaryPoints(Range.START_TO_START,g)>0?1:l.compareBoundaryPoints(Range.START_TO_START,g)==0?h>j?1:h==j?0:-1:-1}return h};if(b=="START_TO_START")return e(this.startNode,this.startPos,c.startNode,c.startPos);if(b=="START_TO_END")return e(this.startNode,this.startPos,c.endNode,c.endPos);if(b=="END_TO_START")return e(this.endNode, +this.endPos,c.startNode,c.startPos);if(b=="END_TO_END")return e(this.endNode,this.endPos,c.endNode,c.endPos)};this.collapsed=function(){return this.startNode===this.endNode&&this.startPos===this.endPos};this.collapse=function(b){b?this.setEnd(this.startNode,this.startPos):this.setStart(this.endNode,this.endPos)};this.setTextStart=function(b,c){var e=b;d.eachNode(b,function(g){if(d.util.getNodeType(g)==3&&g.nodeValue.length>0||d.util.getNodeType(g)==88){e=g;c=0;return false}return true});this.setStart(e, +c)};this.setStart=function(b,c){this.startNode=b;this.startPos=c;if(this.endNode===null){this.endNode=b;this.endPos=c}};this.setTextEnd=function(b,c){var e=b;d.eachNode(b,function(g){if(d.util.getNodeType(g)==3&&g.nodeValue.length>0||d.util.getNodeType(g)==88){e=g;c=d.util.getNodeType(g)==3?g.nodeValue.length:0}return true});this.setEnd(e,c)};this.setEnd=function(b,c){this.endNode=b;this.endPos=c;if(this.startNode===null){this.startNode=b;this.startPos=c}};this.selectNode=function(b){this.setStart(b, +0);this.setEnd(b,b.nodeType==1?0:b.nodeValue.length)};this.selectTextNode=function(b){this.setTextStart(b,0);this.setTextEnd(b,b.nodeType==1?0:b.nodeValue.length)};this.extractContents=function(b){b=b===f?true:b;var c=this,e=this.startNode,g=this.startPos,h=this.endNode,i=this.endPos,j=function(r,u,n){var v=r.nodeValue.length,t=r.cloneNode(true).splitText(u);t.splitText(n-u);if(b){var x=r;if(u>0)x=r.splitText(u);n/g,"")===""&&u.parentNode&&u.parentNode.removeChild(u);return true},o=this.getParentElement(),q=o.cloneNode(false);p(o,q);return q};this.cloneContents=function(){return this.extractContents(false)};this.getText=function(){return this.cloneContents().innerHTML.replace(/<.*?>/g, +"")}};d.cmd=function(a){this.doc=d.g[a].iframeDoc;this.keSel=d.g[a].keSel;this.keRange=d.g[a].keRange;this.mergeAttributes=function(b,c){for(var e=0,g=c.length;e=0){this.mergeAttributes(b.parentNode,h);return b}else{g=g.cloneNode(true);if(j){c=b.cloneNode(true);g.appendChild(c);b.parentNode.replaceChild(g,b);return c}else{j=b;if(c0)j=b.splitText(c);e0?o.parentNode.appendChild(g):o.parentNode.insertBefore(g, +o);else o.appendChild(g);h.selectNode(g);return false}else if(o==i)h.setStart(o,0);else{if(o==k){h.setEnd(o,0);return false}}else if(o.nodeType==3)if(p)if(o==i&&o==k){o=e.wrapTextNode(o,j,l,g,c);h.selectNode(o);return false}else if(o==i){o=e.wrapTextNode(o,j,o.nodeValue.length,g,c);h.setStart(o,0)}else if(o==k){o=e.wrapTextNode(o,0,l,g,c);h.setEnd(o,o.nodeType==1?0:o.nodeValue.length);return false}else e.wrapTextNode(o,0,o.nodeValue.length,g,c);return true});this.keSel.addRange(h)}};this.getTopParent= +function(b,c){for(var e=null;c;){c=c.parentNode;if(d.util.inArray(c.tagName.toLowerCase(),b))e=c;else break}return e};this.splitNodeParent=function(b,c,e){var g=new d.range(this.doc);g.selectNode(b.firstChild);g.setEnd(c,e);c=g.extractContents();b.parentNode.insertBefore(c,b);return{left:c,right:b}};this.remove=function(b){var c=this.keRange,e=c.startNode,g=c.startPos,h=c.endNode,i=c.endPos;this.keSel.focus();if(!d.util.inMarquee(c.getParentElement())){var j=c.getText().replace(/\s+/g,"")==="";if(!(j&& +!d.browser.IE)){var k=[];d.each(b,function(r){r!="*"&&k.push(r)});var l=this.getTopParent(k,e),m=this.getTopParent(k,h);if(l){var p=this.splitNodeParent(l,e,g);c.setStart(p.right,0);if(e==h&&d.util.getNodeTextLength(p.right)>0){c.selectNode(p.right);e=new d.range(this.doc);e.selectTextNode(p.left);if(g>0)i-=e.endNode.nodeValue.length;e.selectTextNode(p.right);h=e.startNode}}if(j){l=c.startNode;if(l.nodeType==1){if(l.nodeName.toLowerCase()=="br")return;c.selectNode(l)}else return}else if(m){g=this.splitNodeParent(m, +h,i);c.setEnd(g.left,0);l==m&&c.setStart(g.left,0)}m=function(r,u){if(u.charAt(0)=="."){var n=d.util.getJsKey(u.substr(1));r.style[n]=""}else{if(d.browser.IE&&d.browser.VERSION<8&&u=="class")u="className";r.removeAttribute(u)}};g=c.getNodeList();c.setTextStart(c.startNode,c.startPos);c.setTextEnd(c.endNode,c.endPos);i=0;for(j=g.length;i0&&paths.pop();else l!==""&&l!="."&&paths.push(l)}return"/"+paths.join("/")};if(a.match(/^\//))a=c+g(a.substr(1));else a.match(/^\w+:\/\//)||(a=c+g(e+"/"+a));if(b=="relative"){var h=function(i,j){if(a.substr(0,i.length)=== +i){for(var k=[],l=0;l0)l+="/"+k.join("/");if(e=="/")l+="/";return l+a.substr(i.length)}else if(k=i.match(/^(.*)\//))return h(k[1],++j)};a=h(c+e,0).substr(2)}else if(b=="absolute")if(a.substr(0,c.length)===c)a=a.substr(c.length);return a},getHtml:function(a,b,c){var e=b?true:false;a=a.replace(/(]*>)([\s\S]*?)(<\/pre>)/ig,function(m,p,o,q){return p+o.replace(/]*>/ig,"\n")+q});var g={},h=["xx-small","x-small","small","medium","large","x-large","xx-large"]; +e&&d.each(b,function(m,p){for(var o=m.split(","),q=0,r=o.length;q]+)|(?:\s+[\w-:]+="[^"]*")|(?:\s+[\w-:]+='[^']*'))*)(\/)?>((?:\r\n|\n|\r)*)/g,function(m,p,o,q,r,u,n){m=p||"";o=o||"";var v=q.toLowerCase();q=r||"";u=u?" "+u:"";n=n||"";if(e&& +typeof g[v]=="undefined")return"";if(u===""&&typeof i[v]!="undefined")u=" /";if(v in j){if(o||u)n="\n"}else if(n)n=" ";if(v!=="script"&&v!=="style")m="";if(v==="font"){var t={},x="";q=q.replace(/\s*([\w-:]+)=([^\s"'<>]+|"[^"]*"|'[^']*')/g,function(w,y,s){y=y.toLowerCase();s=s||"";s=s.replace(/^["']|["']$/g,"");if(y==="color"){t.color=s;return" "}if(y==="size"){t["font-size"]=h[parseInt(s)-1]||"";return" "}if(y==="face"){t["font-family"]=s;return" "}if(y==="style"){x=s;return" "}return w});if(x&&!/;$/.test(x))x+= +";";d.each(t,function(w,y){if(y!==""){if(/\s/.test(y))y="'"+y+"'";x+=w+":"+y+";"}});if(x)q+=' style="'+x+'"';v="span"}if(q!==""){q=q.replace(/\s*([\w-:]+)=([^\s"'<>]+|"[^"]*"|'[^']*')/g,function(w,y,s){w=y.toLowerCase();s=s||"";if(e)if(w.charAt(0)==="."||w!=="style"&&typeof g[v][w]=="undefined")return" ";if(s==="")s='""';else{if(w==="style"){s=s.substr(1,s.length-2);s=s.replace(/\s*([^\s]+?)\s*:(.*?)(;|$)/g,function(z,A,B){z=A.toLowerCase();if(e)if(typeof g[v].style=="undefined"&&typeof g[v]["."+ +z]=="undefined")return"";B=d.util.trim(B);B=d.util.rgbToHex(B);return z+":"+B+";"});s=d.util.trim(s);if(s==="")return"";s='"'+s+'"'}if(d.util.inArray(w,["src","href"])){if(s.charAt(0)==='"')s=s.substr(1,s.length-2);s=d.format.getUrl(s,c)}if(s.charAt(0)!=='"')s='"'+s+'"'}return" "+w+"="+s+" "});q=q.replace(/\s+(checked|selected|disabled|readonly)(\s+|$)/ig,function(w,y){var s=y.toLowerCase();if(e)if(s.charAt(0)==="."||typeof g[v][s]=="undefined")return" ";return" "+s+'="'+s+'" '});q=d.util.trim(q); +if(q=q.replace(/\s+/g," "))q=" "+q;return m+"<"+o+v+q+u+">"+n}else return m+"<"+o+v+u+">"+n});if(!d.browser.IE){a=a.replace(/

\n<\/p>/ig,"

 

");a=a.replace(/\n<\/p>/ig,"

")}var k=d.setting.inlineTags.join("|"),l=function(m){var p=m.replace(new RegExp("<("+k+")[^>]*><\\/("+k+")>","ig"),function(o,q,r){return q==r?"":o});if(m!==p)p=l(p);return p};return d.util.trim(l(a))}};d.addClass=function(a,b){if(typeof a=="object"){var c=a.className;if(c){if((" "+c+" ").indexOf(" "+ +b+" ")<0)a.className=c+" "+b}else a.className=b}else if(typeof a=="string")a=/\s+class\s*=/.test(a)?a.replace(/(\s+class=["']?)([^"']*)(["']?[\s>])/,function(e,g,h,i){return(" "+h+" ").indexOf(" "+b+" ")<0?h===""?g+b+i:g+h+" "+b+i:e}):a.substr(0,a.length-1)+' class="'+b+'">';return a};d.removeClass=function(a,b){var c=a.className||"";c=" "+c+" ";b=" "+b+" ";if(c.indexOf(b)>=0){c=d.util.trim(c.replace(new RegExp(b,"ig"),""));if(c===""){c=a.getAttribute("class")?"class":"className";a.removeAttribute(c)}else a.className= +c}return a};d.getComputedStyle=function(a,b){var c=a.ownerDocument,e=c.parentWindow||c.defaultView;c=d.util.getJsKey(b);var g="";if(e.getComputedStyle){e=e.getComputedStyle(a,null);g=e[c]||e.getPropertyValue(b)||a.style[c]}else if(a.currentStyle)g=a.currentStyle[c]||a.style[c];return g};d.getCommonAncestor=function(a,b){function c(i){for(;i;){if(i.nodeType==1)if(i.tagName.toLowerCase()===b)return i;i=i.parentNode}return null}var e=a.range,g=a.keRange,h=g.startNode;g=g.endNode;if(d.util.inArray(b, +["table","td","tr"]))if(d.browser.IE)if(e.item){if(e.item(0).nodeName.toLowerCase()===b)h=g=e.item(0)}else{h=e.duplicate();h.collapse(true);e=e.duplicate();e.collapse(false);h=h.parentElement();g=e.parentElement()}else{h=e.cloneRange();h.collapse(true);e=e.cloneRange();e.collapse(false);h=h.startContainer;g=e.startContainer}e=c(h);h=c(g);if(e&&h&&e===h)return e;return null};d.queryCommandValue=function(a,b){function c(){var i=a.queryCommandValue(b);if(typeof i!=="string")i="";return i}b=b.toLowerCase(); +var e="";if(b==="fontname"){e=c();e=e.replace(/['"]/g,"")}else if(b==="formatblock"){e=c();if(e===""){var g=new d.selection(a),h=d.getCommonAncestor(g,"h1");h||(h=d.getCommonAncestor(g,"h2"));h||(h=d.getCommonAncestor(g,"h3"));h||(h=d.getCommonAncestor(g,"h4"));h||(h=d.getCommonAncestor(g,"p"));if(h)e=h.nodeName}if(e==="Normal")e="p"}else if(b==="fontsize"){g=new d.selection(a);if(h=d.getCommonAncestor(g,"span"))e=d.getComputedStyle(h,"font-size")}else if(b==="textcolor"){g=new d.selection(a);if(h= +d.getCommonAncestor(g,"span"))e=d.getComputedStyle(h,"color");e=d.util.rgbToHex(e);if(e==="")e="default"}else if(b==="bgcolor"){g=new d.selection(a);if(h=d.getCommonAncestor(g,"span"))e=d.getComputedStyle(h,"background-color");e=d.util.rgbToHex(e);if(e==="")e="default"}return e.toLowerCase()};d.util={getDocumentElement:function(a){a=a||document;return a.compatMode!="CSS1Compat"?a.body:a.documentElement},getDocumentHeight:function(a){a=this.getDocumentElement(a);return Math.max(a.scrollHeight,a.clientHeight)}, +getDocumentWidth:function(a){a=this.getDocumentElement(a);return Math.max(a.scrollWidth,a.clientWidth)},createTable:function(a){a=d.$$("table",a);a.cellPadding=0;a.cellSpacing=0;a.border=0;return{table:a,cell:a.insertRow(0).insertCell(0)}},loadStyle:function(a){var b=d.$$("link");b.setAttribute("type","text/css");b.setAttribute("rel","stylesheet");b.setAttribute("href",a);document.getElementsByTagName("head")[0].appendChild(b)},getAttrList:function(a){for(var b=/\s+(?:([\w-:]+)|(?:([\w-:]+)=([\w-:]+))|(?:([\w-:]+)="([^"]*)")|(?:([\w-:]+)='([^']*)'))(?=(?:\s|\/|>)+)/g, +c,e,g={};c=b.exec(a);){e=c[1]||c[2]||c[4]||c[6];c=c[1]||(c[2]?c[3]:c[4]?c[5]:c[7]);g[e]=c}return g},inArray:function(a,b){for(var c=0;c0?b[c].charAt(0).toUpperCase()+b[c].substr(1):b[c];return a},arrayToHash:function(a){for(var b={},c=0,e=a.length;c/g,">");return a=a.replace(/"/g,""")},unescape:function(a){a=a.replace(/</g,"<");a=a.replace(/>/g,">");a=a.replace(/"/g,'"');return a=a.replace(/&/g,"&")},getScrollPos:function(){var a,b;if(d.browser.IE||d.browser.OPERA){b=this.getDocumentElement();a=b.scrollLeft;b=b.scrollTop}else{a=window.scrollX;b=window.scrollY}return{x:a,y:b}},getElementPos:function(a){var b=0,c=0;if(a.getBoundingClientRect){c=a.getBoundingClientRect();a=this.getScrollPos(); +b=c.left+a.x;c=c.top+a.y}else{b=a.offsetLeft;c=a.offsetTop;for(a=a.offsetParent;a;){b+=a.offsetLeft;c+=a.offsetTop;a=a.offsetParent}}return{x:b,y:c}},getCoords:function(a){a=a||window.event;return{x:a.clientX,y:a.clientY}},setOpacity:function(a,b){if(typeof a.style.opacity=="undefined")a.style.filter=b==100?"":"alpha(opacity="+b+")";else a.style.opacity=b==100?"":"0."+b.toString()},getIframeDoc:function(a){return a.contentDocument||a.contentWindow.document},rgbToHex:function(a){function b(c){c=parseInt(c).toString(16); +return c.length>1?c:"0"+c}return a.replace(/rgb\s*?\(\s*?(\d+)\s*?,\s*?(\d+)\s*?,\s*?(\d+)\s*?\)/ig,function(c,e,g,h){return"#"+b(e)+b(g)+b(h)})},parseJson:function(a){var b=/[\u0000\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g;b.lastIndex=0;if(b.test(a))a=a.replace(b,function(c){return"\\u"+("0000"+c.charCodeAt(0).toString(16)).slice(-4)});if(/^[\],:{}\s]*$/.test(a.replace(/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g,"@").replace(/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g, +"]").replace(/(?:^|:|,)(?:\s*\[)+/g,"")))return eval("("+a+")");throw"JSON parse error";},createRange:function(a){return a.createRange?a.createRange():a.body.createTextRange()},getNodeType:function(a){return a.nodeType==1&&d.util.inArray(a.tagName.toLowerCase(),d.setting.noEndTags)?88:a.nodeType},inMarquee:function(a){for(a=a;a;){if(a.nodeName.toLowerCase()==="marquee")return true;a=a.parentNode}return false},moveToElementText:function(a,b){this.inMarquee(b)||a.moveToElementText(b)},getNodeTextLength:function(a){var b= +d.util.getNodeType(a);if(b==1)return a.innerHTML.replace(/<.*?>/ig,"").length;else if(b==3)return a.nodeValue.length},getNodeStartRange:function(a,b){var c=d.util.createRange(a),e=b.nodeType;if(e==1){d.util.moveToElementText(c,b);return c}else if(e==3){e=0;for(var g=b.previousSibling;g;){if(g.nodeType==1){var h=d.util.createRange(a);d.util.moveToElementText(h,g);c.setEndPoint("StartToEnd",h);c.moveStart("character",e);return c}else if(g.nodeType==3)e+=g.nodeValue.length;g=g.previousSibling}d.util.moveToElementText(c, +b.parentNode);c.moveStart("character",e);return c}},removeParent:function(a){if(a.hasChildNodes)for(var b=a.firstChild;b;){var c=b.nextSibling;a.parentNode.insertBefore(b,a);b=c}a.parentNode.removeChild(a)},pluginLang:function(a,b){d.each(d.lang.plugins[a],function(c,e){var g=d.$("lang."+c,b);if(g){g.parentNode.insertBefore(b.createTextNode(e),g);g.parentNode.removeChild(g)}})},drag:function(a,b,c,e){var g=d.g[a];b.onmousedown=function(h){function i(s){if(x){var z=d.util.getCoords(s),A=d.util.getScrollPos(); +s=parseInt(z.y-u-v+A.y);z=parseInt(z.x-n-t+A.x);e(p,o,q,r,s,z)}}function j(s){if(x){var z=d.util.getCoords(s,g.iframeDoc);s=parseInt(w.y+z.y-u-v);z=parseInt(w.x+z.x-n-t);e(p,o,q,r,s,z)}}function k(s){x=false;l.releaseCapture&&l.releaseCapture();d.event.remove(document,"mousemove",i);d.event.remove(document,"mouseup",k);d.event.remove(g.iframeDoc,"mousemove",j);d.event.remove(g.iframeDoc,"mouseup",k);d.event.remove(document,"selectstart",y);d.event.stop(s);return false}var l=this;h=h||window.event; +var m=d.util.getCoords(h),p=parseInt(c.style.top),o=parseInt(c.style.left),q=c.style.width,r=c.style.height;if(q.match(/%$/))q=c.offsetWidth+"px";if(r.match(/%$/))r=c.offsetHeight+"px";q=parseInt(q);r=parseInt(r);var u=m.y,n=m.x;m=d.util.getScrollPos();var v=m.y,t=m.x,x=true,w=d.util.getElementPos(g.iframe),y=function(){return false};d.event.add(document,"mousemove",i);d.event.add(document,"mouseup",k);d.event.add(g.iframeDoc,"mousemove",j);d.event.add(g.iframeDoc,"mouseup",k);d.event.add(document, +"selectstart",y);l.setCapture&&l.setCapture();d.event.stop(h);return false}},resize:function(a,b,c,e,g){g=typeof g=="undefined"?true:g;a=d.g[a];if(a.container)if(!(e&&(parseInt(b)<=a.minWidth||parseInt(c)<=a.minHeight))){if(g)a.container.style.width=b;a.container.style.height=c;b=parseInt(c)-a.toolbarHeight-a.statusbarHeight;if(b>=0){a.iframe.style.height=b+"px";a.newTextarea.style.height=(d.browser.IE&&d.browser.VERSION<8||document.compatMode!="CSS1Compat"?b-2:b)+"px"}}},hideLoadingPage:function(a){a= +d.g[a].dialogStack;a=a[a.length-1];a.loading.style.display="none";a.iframe.style.display=""},showLoadingPage:function(a){a=d.g[a].dialogStack;a=a[a.length-1];a.loading.style.display="";a.iframe.style.display="none"},setDefaultPlugin:function(){for(var a=["selectall","justifyleft","justifycenter","justifyright","justifyfull","insertorderedlist","insertunorderedlist","indent","outdent","subscript","superscript","bold","italic","underline","strikethrough"],b={bold:"B",italic:"I",underline:"U"},c=0;c< +a.length;c++){var e=a[c],g={};if(e in b)g.init=function(h){return function(i){d.event.ctrl(d.g[i].iframeDoc,b[h],function(){d.plugin[h].click(i);d.util.focus(i)},i)}}(e);g.click=function(h){return function(i){d.util.execCommand(i,h,null)}}(e);d.plugin[e]=g}},getFullHtml:function(a){var b="";b+="";b+='';b+="KindEditor";b+=''; +a=d.g[a].cssPath;if(typeof a=="string")a=[a];for(var c=0,e=a.length;c';b+="";b+='';b+="";return b},getMediaType:function(a){return a.match(/\.(rm|rmvb)(\?|$)/i)?"rm":a.match(/\.(swf|flv)(\?|$)/i)?"flash":"media"},getMediaImage:function(a,b,c){var e=c.width,g=c.height;b=b||this.getMediaType(c.src);c=this.getMediaEmbed(c);var h="";if(e>0)h+="width:"+e+"px;";if(g>0)h+="height:"+ +g+"px;";a='';return a},getMediaEmbed:function(a){var b="]*>\s*$/ig,"");e=e.replace(/^\s*

\s* \s*<\/p>\s*$/ig,"");return c.filterMode?d.format.getHtml(e,c.htmlTags,c.urlType):d.format.getHtml(e,null,c.urlType)},getData:function(a,b){var c=d.g[a];(b=b===f?c.wyswygMode:b)||this.innerHtml(c.iframeDoc.body,d.util.execSetHtmlHooks(a,c.newTextarea.value));return this.toData(a,c.iframeDoc.body.innerHTML)}, +getSrcData:function(a){var b=d.g[a];b.wyswygMode||this.innerHtml(b.iframeDoc.body,d.util.execSetHtmlHooks(a,b.newTextarea.value));return b.iframeDoc.body.innerHTML},getPureData:function(a){return this.extractText(this.getData(a))},extractText:function(a){a=a.replace(/<(?!img|embed).*?>/ig,"");return a=a.replace(/ /ig," ")},isEmpty:function(a){return this.getPureData(a).replace(/\r\n|\n|\r/,"").replace(/^\s+|\s+$/,"")===""},setData:function(a){var b=d.g[a];if(b.srcTextarea)b.srcTextarea.value= +this.getData(a)},focus:function(a){a=d.g[a];a.wyswygMode?a.iframeWin.focus():a.newTextarea.focus()},click:function(a,b){this.focus(a);d.hideMenu(a);d.plugin[b].click(a)},selection:function(a){if(!d.browser.IE||!d.g[a].keRange)this.setSelection(a)},setSelection:function(a){a=d.g[a];var b=new d.selection(a.iframeDoc);if(!d.browser.IE||b.range.item||b.range.parentElement().ownerDocument===a.iframeDoc){a.keSel=b;a.keRange=a.keSel.keRange;a.sel=a.keSel.sel;a.range=a.keSel.range}},select:function(a){d.browser.IE&& +d.g[a].wyswygMode&&d.g[a].range&&d.g[a].range.select()},execCommand:function(a,b,c){d.util.focus(a);d.util.select(a);try{d.g[a].iframeDoc.execCommand(b,false,c)}catch(e){}d.toolbar.updateState(a);d.util.execOnchangeHandler(a)},innerHtml:function(a,b){if(d.browser.IE){a.innerHTML=''+b;var c=d.$("__ke_temp_tag__",a.ownerDocument);c&&c.parentNode.removeChild(c)}else a.innerHTML=b},pasteHtml:function(a,b,c){a=d.g[a];if(c)b=''+ +b;else b+='';if(d.browser.IE)if(a.range.item)a.range.item(0).outerHTML=b;else a.range.pasteHTML(b);else{a.range.deleteContents();b=a.range.createContextualFragment(b);a.range.insertNode(b)}b=d.$("__ke_temp_tag__",a.iframeDoc);c=a.iframeDoc.createTextNode("");b.parentNode.replaceChild(c,b);a.keRange.selectNode(c);a.keSel.addRange(a.keRange)},insertHtml:function(a,b){if(b!==""){var c=d.g[a];if(c.wyswygMode)if(c.range){b=this.execSetHtmlHooks(a,b);if(d.browser.IE){this.select(a); +if(c.range.item)try{c.range.item(0).outerHTML=b}catch(e){c=c.range.item(0);var g=c.parentNode;g.removeChild(c);if(g.nodeName.toLowerCase()!="body")g=g.parentNode;this.innerHtml(g,b+g.innerHTML)}else c.range.pasteHTML(b)}else if(d.browser.GECKO&&d.browser.VERSION<3){this.execCommand(a,"inserthtml",b);return}else this.pasteHtml(a,b);d.util.execOnchangeHandler(a)}}},setFullHtml:function(a,b){var c=d.g[a];if(!d.browser.IE&&b==="")b="
";b=d.util.execSetHtmlHooks(a,b);this.innerHtml(c.iframeDoc.body, +b);if(!c.wyswygMode)c.newTextarea.value=d.util.getData(a,true);d.util.execOnchangeHandler(a)},selectImageWebkit:function(a,b,c){if(d.browser.WEBKIT){b=b.srcElement||b.target;if(b.tagName.toLowerCase()=="img"){c&&d.util.selection(a);c=d.g[a].keRange;c.selectNode(b);d.g[a].keSel.addRange(c)}}},addTabEvent:function(a){d.event.add(d.g[a].iframeDoc,"keydown",function(b){if(b.keyCode==9){d.util.setSelection(a);d.util.insertHtml(a,"    ");d.event.stop(b);return false}},a)},addContextmenuEvent:function(a){var b= +d.g[a];b.contextmenuItems.length!=0&&d.event.add(b.iframeDoc,"contextmenu",function(c){d.hideMenu(a);d.util.setSelection(a);d.util.selectImageWebkit(a,c,false);for(var e=0,g=[],h=0,i=b.contextmenuItems.length;he)e=k}}j=j}for(;g.length>0&&g[0]==="-";)g.shift();for(;g.length>0&&g[g.length-1]==="-";)g.pop();j=null;h=0;for(i=g.length;h0){var l=new d.menu({id:a,event:c,type:"contextmenu",width:e});h=0;for(i=g.length;h");e=b.keRange.startNode.nextSibling;if(d.browser.IE)e||d.util.pasteHtml(a,"
",true);else if(d.browser.WEBKIT)if(e){var g=new d.range(b.iframeDoc);g.selectNode(e.parentNode);g.setStart(e, +0);g.cloneContents().innerHTML.replace(/<(?!img|embed).*?>/ig,"")===""&&d.util.pasteHtml(a,"
",true)}else d.util.pasteHtml(a,"
",true);d.event.stop(c);return false}}else d.util.inArray(e,["p","h1","h2","h3","h4","h5","h6","pre","div","li"])||d.util.execCommand(a,"formatblock","

");return true}},a)}};d.layout={hide:function(a){var b=d.g[a];d.hideMenu(a);for(a=b.dialogStack;a.length>0;)a[a.length-1].hide();b.maskDiv.style.display="none"}};d.hideMenu=function(a){a=d.g[a];a.hideDiv.innerHTML= +"";a.hideDiv.style.display="none"};d.colorpicker=function(a){var b,c=a.x||0,e=a.y||0,g=a.z||0,h=a.colors||d.setting.colorTable,i=a.doc||document,j=a.onclick,k=(a.selectedColor||"").toLowerCase();b=d.$$("div");b.className="ke-colorpicker";b.style.top=e+"px";b.style.left=c+"px";b.style.zIndex=g;this.remove=function(){i.body.removeChild(b)};this.getElement=function(){function l(n,v,t){if(k===v.toLowerCase())t+=" ke-colorpicker-cell-selected";n.className=t;n.title=v||d.lang.noColor;n.onmouseover=function(){this.className= +t+" ke-colorpicker-cell-on"};n.onmouseout=function(){this.className=t};n.onclick=function(){j(v)};if(v){var x=d.$$("div");x.className="ke-colorpicker-cell-color";x.style.backgroundColor=v;n.appendChild(x)}else n.innerHTML=d.lang.noColor}var m=d.$$("table");m.className="ke-colorpicker-table";m.cellPadding=0;m.cellSpacing=0;m.border=0;var p=m.insertRow(0),o=p.insertCell(0);o.colSpan=h[0].length;l(o,"","ke-colorpicker-cell-top");for(var q=0;q0||e>0){g=d.util.getScrollPos(); +var j=d.util.getDocumentElement();g=g.x+j.clientWidth-c-2;if(h>g)h=g}return{x:h,y:i}}(function(){var c=a.width;this.type=a.type&&a.type=="contextmenu"?a.type:"menu";var e=d.$$("div");e.className="ke-"+this.type;e.setAttribute("name",a.cmd);var g=b.call(this,0,0);e.style.top=g.y+"px";e.style.left=g.x+"px";if(a.width)e.style.width=/^\d+$/.test(c)?c+"px":c;d.event.bind(e,"click",function(){},a.id);d.event.bind(e,"mousedown",function(){},a.id);this.div=e}).call(this);this.add=function(c,e,g){var h,i, +j=false;if(g!==f){h=g.height;i=g.iconHtml;j=g.checked}var k=this;g=d.$$("div");g.className="ke-"+k.type+"-item";if(h)g.style.height=h;var l=d.$$("div");l.className="ke-"+this.type+"-left";var m=d.$$("div");m.className="ke-"+k.type+"-center";if(h)m.style.height=h;var p=d.$$("div");p.className="ke-"+this.type+"-right";if(h)p.style.lineHeight=h;g.onmouseover=function(){this.className="ke-"+k.type+"-item ke-"+k.type+"-item-on";m.className="ke-"+k.type+"-center ke-"+k.type+"-center-on"};g.onmouseout=function(){this.className= +"ke-"+k.type+"-item";m.className="ke-"+k.type+"-center"};g.onclick=e;g.appendChild(l);g.appendChild(m);g.appendChild(p);if(j)d.util.innerHtml(l,'');else i&&d.util.innerHtml(l,i);d.util.innerHtml(p,c);this.append(g)};this.addSeparator=function(){var c=d.$$("div");c.className="ke-"+this.type+"-separator";this.append(c)};this.append=function(c){this.div.appendChild(c)};this.insert=function(c){d.util.innerHtml(this.div,c)};this.hide= +function(){d.hideMenu(a.id)};this.show=function(){this.hide();var c=a.id;d.g[c].hideDiv.style.display="";d.g[c].hideDiv.appendChild(this.div);c=b.call(this,this.div.clientWidth,this.div.clientHeight);this.div.style.top=c.y+"px";this.div.style.left=c.x+"px"};this.picker=function(c){this.append((new d.colorpicker({colors:d.g[a.id].colorTable,onclick:function(e){d.plugin[a.cmd].exec(a.id,e)},selectedColor:c})).getElement());this.show()}};d.dialog=function(a){function b(){d.util.getDocumentElement(); +var h=d.util.getScrollPos();e=h.y;g=h.x}function c(){var h=this.width+this.widthMargin,i=this.height+this.heightMargin,j=a.id,k=d.g[j],l=0,m=0;if(k.dialogAlignType=="page"){k=d.util.getDocumentElement();j=d.util.getScrollPos();l=Math.round(j.x+(k.clientWidth-h)/2);m=Math.round(j.y+(k.clientHeight-i)/2)}else{j=d.util.getElementPos(d.g[j].container);k=k.container;l=Math.round(k.clientWidth/2)-Math.round(h/2);i=Math.round(k.clientHeight/2)-Math.round(i/2);l=l<0?j.x:j.x+l;m=i<0?j.y:j.y+i}return{x:l<0? +0:l,y:m<0?0:m}}this.widthMargin=30;this.heightMargin=100;this.zIndex=19811214;this.width=a.width;this.height=a.height;var e,g;this.beforeHide=a.beforeHide;this.afterHide=a.afterHide;this.beforeShow=a.beforeShow;this.afterShow=a.afterShow;this.ondrag=a.ondrag;this.resize=function(h,i){if(h)this.width=h;if(i)this.height=i;this.hide();this.show()};this.hide=function(){this.beforeHide&&this.beforeHide(h);var h=a.id,i=d.g[h].dialogStack;if(i[i.length-1]==this){var j=i.pop().iframe;j.src="javascript:false"; +j.parentNode.removeChild(j);document.body.removeChild(this.div);if(i.length<1)d.g[h].maskDiv.style.display="none";d.event.remove(window,"resize",b);d.event.remove(window,"scroll",b);this.afterHide&&this.afterHide(h);d.util.focus(h)}};this.show=function(){this.beforeShow&&this.beforeShow(i);var h=this,i=a.id,j=d.$$("div");j.className="ke-dialog";d.event.bind(j,"click",function(){},i);d.event.bind(j,"mousedown",function(){},i);var k=d.g[i].dialogStack;if(k.length>0)this.zIndex=k[k.length-1].zIndex+ +1;j.style.zIndex=this.zIndex;k=c.call(this);j.style.top=k.y+"px";j.style.left=k.x+"px";var l;if(d.g[i].shadowMode){k=d.$$("table");k.className="ke-dialog-table";k.cellPadding=0;k.cellSpacing=0;k.border=0;for(var m=["t","m","b"],p=["l","c","r"],o=0;o<3;o++)for(var q=k.insertRow(o),r=0;r<3;r++){var u=q.insertCell(r);u.className="ke-"+m[o]+p[r];if(o==1&&r==1)l=u;else u.innerHTML=''}j.appendChild(k)}else{d.addClass(j,"ke-dialog-no-shadow");l=j}k=d.$$("div");k.className= +"ke-dialog-title";k.innerHTML=a.title;m=d.$$("span");m.className="ke-dialog-close";d.g[i].shadowMode?d.addClass(m,"ke-dialog-close-shadow"):d.addClass(m,"ke-dialog-close-no-shadow");m.alt=d.lang.close;m.title=d.lang.close;m.onclick=function(){h.hide();d.util.select(i)};k.appendChild(m);b();d.event.add(window,"resize",b);d.event.add(window,"scroll",b);d.util.drag(i,k,j,function(n,v,t,x,w,y){h.ondrag&&h.ondrag(i);b();w=n+w;y=v+y;if(w0)c=a[a.length-1];if(a.length==0||b!==c)a.push(b)},add:function(a, +b){var c=d.g[a],e=d.util.getSrcData(a);if(c.undoStack.length>0)if(Math.abs(e.length-c.undoStack[c.undoStack.length-1].length)0)e=b.undoStack.pop();e=d.util.toData(a,e);if(b.wyswygMode)d.util.innerHtml(b.iframeDoc.body,d.util.execSetHtmlHooks(a,e));else b.newTextarea.value=e}},redo:function(a){var b= +d.g[a];if(b.redoStack.length!=0){var c=d.util.getSrcData(a);this.addStackData(b.undoStack,c);c=b.redoStack.pop();c=d.util.toData(a,c);if(b.wyswygMode)d.util.innerHtml(b.iframeDoc.body,d.util.execSetHtmlHooks(a,c));else b.newTextarea.value=c}}};d.readonly=function(a,b){b=b==f?true:b;var c=d.g[a];if(d.browser.IE)c.iframeDoc.body.contentEditable=b?"false":"true";else c.iframeDoc.designMode=b?"off":"on"};d.focus=function(a,b){b=(b||"").toLowerCase();if(d.g[a].container){d.util.focus(a);if(b==="end"){d.util.setSelection(a); +if(d.g[a].sel){var c=d.g[a].keSel,e=d.g[a].keRange;e.selectTextNode(d.g[a].iframeDoc.body);e.collapse(false);c.addRange(e)}}}};d.html=function(a,b){if(b===f)return d.util.getData(a);else if(d.g[a].container){d.util.setFullHtml(a,b);d.focus(a,"end")}};d.text=function(a,b){if(b===f){b=d.html(a);b=b.replace(/<.*?>/ig,"");b=b.replace(/ /ig," ");return b=d.util.trim(b)}else d.html(a,d.util.escape(b))};d.insertHtml=function(a,b){if(d.g[a].container)if(d.g[a].range){d.focus(a);d.util.selection(a);d.util.insertHtml(a, +b)}else d.appendHtml(a,b)};d.appendHtml=function(a,b){d.html(a,d.html(a)+b);d.focus(a,"end")};d.isEmpty=function(a){return d.util.isEmpty(a)};d.selectedHtml=function(a){var b=d.g[a].range;if(!b)return"";var c="";if(d.browser.IE)c=b.item?b.item(0).outerHTML:b.htmlText;else{c=d.$$("div",d.g[a].iframeDoc);c.appendChild(b.cloneContents());c=c.innerHTML}return d.util.toData(a,c)};d.count=function(a,b){b=(b||"html").toLowerCase();if(b==="html")return d.html(a).length;else if(b==="text"){var c=d.util.getPureData(a); +c=c.replace(/<(?:img|embed).*?>/ig,"K");c=c.replace(/\r\n|\n|\r/g,"");c=d.util.trim(c);return c.length}return 0};d.remove=function(a,b){var c=d.g[a];if(!c.container)return false;b=typeof b=="undefined"?0:b;d.util.setData(a);for(var e=c.container,g=c.eventStack,h=0,i=g.length;h0&&d.util.resize(a,A+"px",B+C+"px",true,false)});d.each(d.plugin,function(s,z){z.init&&z.init(a)});d.g[a].getHtmlHooks.push(function(s){return s.replace(/(<[^>]*)kesrc="([^"]+)"([^>]*>)/ig,function(z,A,B){z=z.replace(/(\s+(?:href|src)=")[^"]+(")/i,"$1"+B+"$2");return z=z.replace(/\s+kesrc="[^"]+"/i,"")})});d.g[a].setHtmlHooks.push(function(s){return s.replace(/(<[^>]*)(href|src)="([^"]+)"([^>]*>)/ig, +function(z,A,B,C,D){if(z.match(/\skesrc="[^"]+"/i))return z;return A+B+'="'+C+'" kesrc="'+C+'"'+D})});d.util.addContextmenuEvent(a);d.util.addNewlineEvent(a);d.util.addTabEvent(a);d.event.input(w,g,a);d.event.add(w,"mouseup",g,a);d.event.add(document,"mousedown",g,a);d.onchange(a,function(s){if(d.g[s].autoSetDataMode){d.util.setData(s);d.g[s].afterSetData&&d.g[s].afterSetData(s)}d.history.add(s,d.g[s].minChangeSize)});d.browser.IE&&d.browser.VERSION>7&&d.readonly(a,false);d.util.setFullHtml(a,i.value); +d.history.add(a,0);b>0&&d.util.focus(a);d.g[a].afterCreate&&d.g[a].afterCreate(a)}};d.onchange=function(a,b){function c(){b(a)}var e=d.g[a];e.onchangeHandlerStack.push(c);d.event.input(e.iframeDoc,c,a);d.event.input(e.newTextarea,c,a);d.event.add(e.iframeDoc,"mouseup",function(){window.setTimeout(function(){b(a)},0)},a)};d.init=function(a){var b=d.g[a.id]=a;b.config={};b.undoStack=[];b.redoStack=[];b.dialogStack=[];b.contextmenuItems=[];b.getHtmlHooks=[];b.setHtmlHooks=[];b.onchangeHandlerStack=[]; +b.eventStack=[];d.each(d.setting,function(c,e){b[c]=typeof a[c]=="undefined"?e:a[c];b.config[c]=b[c]});b.loadStyleMode&&d.util.loadStyle(b.skinsPath+b.skinType+".css")};d.show=function(a){d.init(a);d.event.ready(function(){d.create(a.id)})};if(window.KE===f)window.KE=d;window.KindEditor=d})(); +(function(f){f.langType="zh_CN";f.lang={source:"HTML\u4ee3\u7801",undo:"\u540e\u9000(Ctrl+Z)",redo:"\u524d\u8fdb(Ctrl+Y)",cut:"\u526a\u5207(Ctrl+X)",copy:"\u590d\u5236(Ctrl+C)",paste:"\u7c98\u8d34(Ctrl+V)",plainpaste:"\u7c98\u8d34\u4e3a\u65e0\u683c\u5f0f\u6587\u672c",wordpaste:"\u4eceWord\u7c98\u8d34",selectall:"\u5168\u9009",justifyleft:"\u5de6\u5bf9\u9f50",justifycenter:"\u5c45\u4e2d",justifyright:"\u53f3\u5bf9\u9f50",justifyfull:"\u4e24\u7aef\u5bf9\u9f50",insertorderedlist:"\u7f16\u53f7",insertunorderedlist:"\u9879\u76ee\u7b26\u53f7", +indent:"\u589e\u52a0\u7f29\u8fdb",outdent:"\u51cf\u5c11\u7f29\u8fdb",subscript:"\u4e0b\u6807",superscript:"\u4e0a\u6807",title:"\u6807\u9898",fontname:"\u5b57\u4f53",fontsize:"\u6587\u5b57\u5927\u5c0f",textcolor:"\u6587\u5b57\u989c\u8272",bgcolor:"\u6587\u5b57\u80cc\u666f",bold:"\u7c97\u4f53(Ctrl+B)",italic:"\u659c\u4f53(Ctrl+I)",underline:"\u4e0b\u5212\u7ebf(Ctrl+U)",strikethrough:"\u5220\u9664\u7ebf",removeformat:"\u5220\u9664\u683c\u5f0f",image:"\u56fe\u7247",flash:"\u63d2\u5165Flash",media:"\u63d2\u5165\u591a\u5a92\u4f53", +table:"\u63d2\u5165\u8868\u683c",hr:"\u63d2\u5165\u6a2a\u7ebf",emoticons:"\u63d2\u5165\u8868\u60c5",link:"\u8d85\u7ea7\u94fe\u63a5",unlink:"\u53d6\u6d88\u8d85\u7ea7\u94fe\u63a5",fullscreen:"\u5168\u5c4f\u663e\u793a",about:"\u5173\u4e8e",print:"\u6253\u5370",fileManager:"\u6d4f\u89c8\u670d\u52a1\u5668",advtable:"\u8868\u683c",yes:"\u786e\u5b9a",no:"\u53d6\u6d88",close:"\u5173\u95ed",editImage:"\u56fe\u7247\u5c5e\u6027",deleteImage:"\u5220\u9664\u56fe\u7247",editLink:"\u8d85\u7ea7\u94fe\u63a5\u5c5e\u6027", +deleteLink:"\u53d6\u6d88\u8d85\u7ea7\u94fe\u63a5",tableprop:"\u8868\u683c\u5c5e\u6027",tableinsert:"\u63d2\u5165\u8868\u683c",tabledelete:"\u5220\u9664\u8868\u683c",tablecolinsertleft:"\u5de6\u4fa7\u63d2\u5165\u5217",tablecolinsertright:"\u53f3\u4fa7\u63d2\u5165\u5217",tablerowinsertabove:"\u4e0a\u65b9\u63d2\u5165\u884c",tablerowinsertbelow:"\u4e0b\u65b9\u63d2\u5165\u884c",tablecoldelete:"\u5220\u9664\u5217",tablerowdelete:"\u5220\u9664\u884c",noColor:"\u65e0\u989c\u8272",invalidImg:"\u8bf7\u8f93\u5165\u6709\u6548\u7684URL\u5730\u5740\u3002\n\u53ea\u5141\u8bb8jpg,gif,bmp,png\u683c\u5f0f\u3002", +invalidMedia:"\u8bf7\u8f93\u5165\u6709\u6548\u7684URL\u5730\u5740\u3002\n\u53ea\u5141\u8bb8swf,flv,mp3,wav,wma,wmv,mid,avi,mpg,asf,rm,rmvb\u683c\u5f0f\u3002",invalidWidth:"\u5bbd\u5ea6\u5fc5\u987b\u4e3a\u6570\u5b57\u3002",invalidHeight:"\u9ad8\u5ea6\u5fc5\u987b\u4e3a\u6570\u5b57\u3002",invalidBorder:"\u8fb9\u6846\u5fc5\u987b\u4e3a\u6570\u5b57\u3002",invalidUrl:"\u8bf7\u8f93\u5165\u6709\u6548\u7684URL\u5730\u5740\u3002",invalidRows:"\u884c\u6570\u4e3a\u5fc5\u9009\u9879\uff0c\u53ea\u5141\u8bb8\u8f93\u5165\u5927\u4e8e0\u7684\u6570\u5b57\u3002", +invalidCols:"\u5217\u6570\u4e3a\u5fc5\u9009\u9879\uff0c\u53ea\u5141\u8bb8\u8f93\u5165\u5927\u4e8e0\u7684\u6570\u5b57\u3002",invalidPadding:"\u8fb9\u8ddd\u5fc5\u987b\u4e3a\u6570\u5b57\u3002",invalidSpacing:"\u95f4\u8ddd\u5fc5\u987b\u4e3a\u6570\u5b57\u3002",invalidBorder:"\u8fb9\u6846\u5fc5\u987b\u4e3a\u6570\u5b57\u3002",pleaseInput:"\u8bf7\u8f93\u5165\u5185\u5bb9\u3002",invalidJson:"\u670d\u52a1\u5668\u53d1\u751f\u6545\u969c\u3002",cutError:"\u60a8\u7684\u6d4f\u89c8\u5668\u5b89\u5168\u8bbe\u7f6e\u4e0d\u5141\u8bb8\u4f7f\u7528\u526a\u5207\u64cd\u4f5c\uff0c\u8bf7\u4f7f\u7528\u5feb\u6377\u952e(Ctrl+X)\u6765\u5b8c\u6210\u3002", +copyError:"\u60a8\u7684\u6d4f\u89c8\u5668\u5b89\u5168\u8bbe\u7f6e\u4e0d\u5141\u8bb8\u4f7f\u7528\u590d\u5236\u64cd\u4f5c\uff0c\u8bf7\u4f7f\u7528\u5feb\u6377\u952e(Ctrl+C)\u6765\u5b8c\u6210\u3002",pasteError:"\u60a8\u7684\u6d4f\u89c8\u5668\u5b89\u5168\u8bbe\u7f6e\u4e0d\u5141\u8bb8\u4f7f\u7528\u7c98\u8d34\u64cd\u4f5c\uff0c\u8bf7\u4f7f\u7528\u5feb\u6377\u952e(Ctrl+V)\u6765\u5b8c\u6210\u3002"};var d=f.lang.plugins={};d.about={version:f.version,title:"HTML\u53ef\u89c6\u5316\u7f16\u8f91\u5668"};d.plainpaste= +{comment:"\u8bf7\u4f7f\u7528\u5feb\u6377\u952e(Ctrl+V)\u628a\u5185\u5bb9\u7c98\u8d34\u5230\u4e0b\u9762\u7684\u65b9\u6846\u91cc\u3002"};d.wordpaste={comment:"\u8bf7\u4f7f\u7528\u5feb\u6377\u952e(Ctrl+V)\u628a\u5185\u5bb9\u7c98\u8d34\u5230\u4e0b\u9762\u7684\u65b9\u6846\u91cc\u3002"};d.link={url:"URL\u5730\u5740",linkType:"\u6253\u5f00\u7c7b\u578b",newWindow:"\u65b0\u7a97\u53e3",selfWindow:"\u5f53\u524d\u7a97\u53e3"};d.flash={url:"Flash\u5730\u5740",width:"\u5bbd\u5ea6",height:"\u9ad8\u5ea6"};d.media= +{url:"\u5a92\u4f53\u6587\u4ef6\u5730\u5740",width:"\u5bbd\u5ea6",height:"\u9ad8\u5ea6",autostart:"\u81ea\u52a8\u64ad\u653e"};d.image={remoteImage:"\u8fdc\u7a0b\u56fe\u7247",localImage:"\u672c\u5730\u4e0a\u4f20",remoteUrl:"\u56fe\u7247\u5730\u5740",localUrl:"\u56fe\u7247\u5730\u5740",size:"\u56fe\u7247\u5927\u5c0f",width:"\u5bbd",height:"\u9ad8",resetSize:"\u91cd\u7f6e\u5927\u5c0f",align:"\u5bf9\u9f50\u65b9\u5f0f",defaultAlign:"\u9ed8\u8ba4\u65b9\u5f0f",leftAlign:"\u5de6\u5bf9\u9f50",rightAlign:"\u53f3\u5bf9\u9f50", +imgTitle:"\u56fe\u7247\u8bf4\u660e",viewServer:"\u6d4f\u89c8..."};d.file_manager={emptyFolder:"\u7a7a\u6587\u4ef6\u5939",moveup:"\u79fb\u5230\u4e0a\u4e00\u7ea7\u6587\u4ef6\u5939",viewType:"\u663e\u793a\u65b9\u5f0f\uff1a",viewImage:"\u7f29\u7565\u56fe",listImage:"\u8be6\u7ec6\u4fe1\u606f",orderType:"\u6392\u5e8f\u65b9\u5f0f\uff1a",fileName:"\u540d\u79f0",fileSize:"\u5927\u5c0f",fileType:"\u7c7b\u578b"};d.advtable={cells:"\u5355\u5143\u683c\u6570",rows:"\u884c\u6570",cols:"\u5217\u6570",size:"\u8868\u683c\u5927\u5c0f", +width:"\u5bbd\u5ea6",height:"\u9ad8\u5ea6",percent:"%",px:"px",space:"\u8fb9\u8ddd\u95f4\u8ddd",padding:"\u8fb9\u8ddd",spacing:"\u95f4\u8ddd",align:"\u5bf9\u9f50\u65b9\u5f0f",alignDefault:"\u9ed8\u8ba4",alignLeft:"\u5de6\u5bf9\u9f50",alignCenter:"\u5c45\u4e2d",alignRight:"\u53f3\u5bf9\u9f50",border:"\u8868\u683c\u8fb9\u6846",borderWidth:"\u8fb9\u6846",borderColor:"\u989c\u8272",backgroundColor:"\u80cc\u666f\u989c\u8272"};d.title={h1:"\u6807\u9898 1",h2:"\u6807\u9898 2",h3:"\u6807\u9898 3",h4:"\u6807\u9898 4", +p:"\u6b63 \u6587"};d.fontname={fontName:{SimSun:"\u5b8b\u4f53",NSimSun:"\u65b0\u5b8b\u4f53",FangSong_GB2312:"\u4eff\u5b8b_GB2312",KaiTi_GB2312:"\u6977\u4f53_GB2312",SimHei:"\u9ed1\u4f53","Microsoft YaHei":"\u5fae\u8f6f\u96c5\u9ed1",Arial:"Arial","Arial Black":"Arial Black","Times New Roman":"Times New Roman","Courier New":"Courier New",Tahoma:"Tahoma",Verdana:"Verdana"}}})(KindEditor); +(function(f,d){f.plugin.about={click:function(a){f.util.selection(a);(new f.dialog({id:a,cmd:"about",file:"about.html",width:300,height:70,loadingMode:true,title:f.lang.about,noButton:f.lang.close})).show()}};f.plugin.undo={init:function(a){f.event.ctrl(f.g[a].iframeDoc,"Z",function(){f.plugin.undo.click(a);f.util.focus(a)},a);f.event.ctrl(f.g[a].newTextarea,"Z",function(){f.plugin.undo.click(a);f.util.focus(a)},a)},click:function(a){f.history.undo(a);f.util.execOnchangeHandler(a)}};f.plugin.redo= +{init:function(a){f.event.ctrl(f.g[a].iframeDoc,"Y",function(){f.plugin.redo.click(a);f.util.focus(a)},a);f.event.ctrl(f.g[a].newTextarea,"Y",function(){f.plugin.redo.click(a);f.util.focus(a)},a)},click:function(a){f.history.redo(a);f.util.execOnchangeHandler(a)}};f.plugin.cut={click:function(a){try{if(!f.g[a].iframeDoc.queryCommandSupported("cut"))throw"e";}catch(b){alert(f.lang.cutError);return}f.util.execCommand(a,"cut",null)}};f.plugin.copy={click:function(a){try{if(!f.g[a].iframeDoc.queryCommandSupported("copy"))throw"e"; +}catch(b){alert(f.lang.copyError);return}f.util.execCommand(a,"copy",null)}};f.plugin.paste={click:function(a){try{if(!f.g[a].iframeDoc.queryCommandSupported("paste"))throw"e";}catch(b){alert(f.lang.pasteError);return}f.util.execCommand(a,"paste",null)}};f.plugin.plainpaste={click:function(a){f.util.selection(a);this.dialog=new f.dialog({id:a,cmd:"plainpaste",file:"plainpaste.html",width:450,height:300,loadingMode:true,title:f.lang.plainpaste,yesButton:f.lang.yes,noButton:f.lang.no});this.dialog.show()}, +exec:function(a){var b=f.util.getIframeDoc(this.dialog.iframe);b=f.$("textArea",b).value;b=f.util.escape(b);b=b.replace(/ /g," ");b=b.replace(/\r\n|\n|\r/g,"
$&");f.util.insertHtml(a,b);this.dialog.hide();f.util.focus(a)}};f.plugin.wordpaste={click:function(a){f.util.selection(a);this.dialog=new f.dialog({id:a,cmd:"wordpaste",file:"wordpaste.html",width:450,height:300,loadingMode:true,title:f.lang.wordpaste,yesButton:f.lang.yes,noButton:f.lang.no});this.dialog.show()},exec:function(a){var b= +f.util.getIframeDoc(this.dialog.iframe);b=f.$("wordIframe",b);b=f.util.getIframeDoc(b).body.innerHTML;b=b.replace(//ig,"");b=b.replace(//ig,"");b=b.replace(/]*>(\n|.)*?<\/style>/ig,"");b=b.replace(/]*>(\n|.)*?<\/script>/ig,"");b=b.replace(/]+>(\n|.)*?<\/w:[^>]+>/ig,"");b=b.replace(/(\n|.)*?<\/xml>/ig,"");b=b.replace(/\r\n|\n|\r/ig,"");b=f.util.execGetHtmlHooks(a,b);b=f.format.getHtml(b,f.g[a].htmlTags,f.g[a].urlType);f.util.insertHtml(a,b);this.dialog.hide(); +f.util.focus(a)}};f.plugin.fullscreen={click:function(a){var b=f.g[a],c=this,e=function(){var k=f.util.getDocumentElement();b.width=k.clientWidth+"px";b.height=k.clientHeight+"px"},g="",h=function(){if(c.isSelected){var k=f.util.getDocumentElement();k=[k.clientWidth,k.clientHeight].join("");if(g!=k){g=k;e();f.util.resize(a,b.width,b.height)}}};if(this.isSelected){this.isSelected=false;f.util.setData(a);f.remove(a,1);b.width=this.width;b.height=this.height;f.create(a,2);document.body.parentNode.style.overflow= +"auto";f.event.remove(window,"resize",h);b.resizeMode=b.config.resizeMode;f.toolbar.unselect(a,"fullscreen")}else{this.isSelected=true;this.width=b.container.style.width;this.height=b.container.style.height;f.util.setData(a);f.remove(a,2);document.body.parentNode.style.overflow="hidden";e();f.create(a,1);var i=f.util.getScrollPos(),j=b.container;j.style.position="absolute";j.style.left=i.x+"px";j.style.top=i.y+"px";j.style.zIndex=19811211;f.event.add(window,"resize",h);b.resizeMode=0;f.toolbar.select(a, +"fullscreen")}}};f.plugin.bgcolor={click:function(a){f.util.selection(a);var b=f.queryCommandValue(f.g[a].iframeDoc,"bgcolor");this.menu=new f.menu({id:a,cmd:"bgcolor"});this.menu.picker(b)},exec:function(a,b){var c=new f.cmd(a);b==""?c.remove({span:[".background-color"]}):c.wrap("span",[{".background-color":b}]);f.util.execOnchangeHandler(a);this.menu.hide();f.util.focus(a)}};f.plugin.fontname={click:function(a){var b=f.lang.plugins.fontname.fontName;f.util.selection(a);var c=new f.menu({id:a,cmd:"fontname", +width:150}),e=f.queryCommandValue(f.g[a].iframeDoc,"fontname");f.each(b,function(g,h){c.add(''+h+"",function(){f.plugin.fontname.exec(a,g)},{checked:e===g.toLowerCase()||e===h.toLowerCase()})});c.show();this.menu=c},exec:function(a,b){(new f.cmd(a)).wrap("span",[{".font-family":b}]);f.util.execOnchangeHandler(a);this.menu.hide();f.util.focus(a)}};f.plugin.fontsize={click:function(a){var b=["9px","10px","12px","14px","16px","18px","24px","32px"]; +f.util.selection(a);for(var c=f.queryCommandValue(f.g[a].iframeDoc,"fontsize"),e=new f.menu({id:a,cmd:"fontsize",width:120}),g=0,h=b.length;g'+i+"",function(j){return function(){f.plugin.fontsize.exec(a,j)}}(i),{height:parseInt(i)+12+"px",checked:c===i})}e.show();this.menu=e},exec:function(a,b){(new f.cmd(a)).wrap("span",[{".font-size":b}]);f.util.execOnchangeHandler(a);this.menu.hide();f.util.focus(a)}};f.plugin.hr= +{click:function(a){f.util.selection(a);f.util.insertHtml(a,"


");f.util.focus(a)}};f.plugin.print={click:function(a){f.util.selection(a);f.g[a].iframeWin.print()}};f.plugin.removeformat={click:function(a){f.util.selection(a);for(var b=new f.cmd(a),c={"*":["class","style"]},e=0,g=f.g[a].inlineTags.length;e'+i+"",function(){f.plugin.title.exec(a,"<"+h+">")},{height:c[h]+12+"px",checked:e===h.toLowerCase()||e===i.toLowerCase()})});g.show();this.menu=g},exec:function(a,b){f.util.select(a);f.util.execCommand(a,"formatblock",b);this.menu.hide();f.util.focus(a)}};f.plugin.emoticons={click:function(a){function b(v){var t= +f.$$("table");if(q){t.onmouseover=function(){q.style.display="block"};t.onmouseout=function(){q.style.display="none"}}t.className="ke-plugin-emoticons-table";t.cellPadding=0;t.cellSpacing=0;t.border=0;v=(v-1)*j+i;for(var x=0;xl){q.style.left=0;q.style.right=""}else{q.style.left="";q.style.right=0}r.src=p+B+".gif";this.className="ke-plugin-emoticons-cell ke-plugin-emoticons-cell-on"}}(y, +v):function(){this.className="ke-plugin-emoticons-cell ke-plugin-emoticons-cell-on"};s.onmouseout=function(){this.className="ke-plugin-emoticons-cell"};s.onclick=function(A){return function(){e.exec(a,A);return false}}(v);var z=f.$$("span");z.className="ke-plugin-emoticons-img";z.style.backgroundPosition="-"+24*v+"px 0px";s.appendChild(z);v++}return t}function c(v){for(var t=1;t<=k;t++){if(v!==t){var x=f.$$("a");x.href="javascript:;";x.innerHTML="["+t+"]";x.onclick=function(w){return function(){o.removeChild(u); +var y=b(w);o.insertBefore(y,n);u=y;n.innerHTML="";c(w);return false}}(t);n.appendChild(x)}else n.appendChild(document.createTextNode("["+t+"]"));n.appendChild(document.createTextNode(" "))}}var e=this,g=5,h=9,i=0,j=g*h,k=Math.ceil(135/j),l=Math.floor(h/2),m=f.g[a],p=m.pluginsPath+"emoticons/";m=m.allowPreviewEmoticons===d?true:m.allowPreviewEmoticons;f.util.selection(a);var o=f.$$("div");o.className="ke-plugin-emoticons-wrapper";var q,r;if(m){q=f.$$("div");q.className="ke-plugin-emoticons-preview"; +q.style.right=0;r=f.$$("img");r.className="ke-reset";r.src=p+"0.gif";r.border=0;q.appendChild(r);o.appendChild(q)}var u=b(1);o.appendChild(u);var n=f.$$("div");n.className="ke-plugin-emoticons-page";o.appendChild(n);c(1);m=new f.menu({id:a,cmd:"emoticons"});m.append(o);m.show();this.menu=m},exec:function(a,b){var c=f.g[a].pluginsPath+"emoticons/"+b+".gif";f.util.insertHtml(a,'');this.menu.hide();f.util.focus(a)}};f.plugin.flash={init:function(a){f.g[a].getHtmlHooks.push(function(b){return b.replace(/]*class="?ke-flash"?[^>]*>/ig, +function(c){var e=c.match(/style="[^"]*;?\s*width:\s*(\d+)/i)?RegExp.$1:0,g=c.match(/style="[^"]*;?\s*height:\s*(\d+)/i)?RegExp.$1:0;e=e||(c.match(/width="([^"]+)"/i)?RegExp.$1:0);g=g||(c.match(/height="([^"]+)"/i)?RegExp.$1:0);if(c.match(/kesrctag="([^"]+)"/i)){c=f.util.getAttrList(unescape(RegExp.$1));c.width=e||c.width||0;c.height=g||c.height||0;c.kesrc=c.src;return f.util.getMediaEmbed(c)}})});f.g[a].setHtmlHooks.push(function(b){return b.replace(/]*type="application\/x-shockwave-flash"[^>]*>(?:<\/embed>)?/ig, +function(c){var e=c.match(/\s+src="([^"]+)"/i)?RegExp.$1:"";if(c.match(/\s+kesrc="([^"]+)"/i))e=RegExp.$1;var g=c.match(/\s+width="([^"]+)"/i)?RegExp.$1:0,h=c.match(/\s+height="([^"]+)"/i)?RegExp.$1:0;c=f.util.getAttrList(c);c.src=e;c.width=g;c.height=h;return f.util.getMediaImage(a,"flash",c)})})},click:function(a){f.util.selection(a);this.dialog=new f.dialog({id:a,cmd:"flash",file:"flash.html",width:400,height:140,loadingMode:true,title:f.lang.flash,yesButton:f.lang.yes,noButton:f.lang.no});this.dialog.show()}, +check:function(a,b,c,e){a=f.util.getIframeDoc(this.dialog.iframe);if(!b.match(/^.{3,}$/)){alert(f.lang.invalidUrl);f.$("url",a).focus();return false}if(!c.match(/^\d*$/)){alert(f.lang.invalidWidth);f.$("width",a).focus();return false}if(!e.match(/^\d*$/)){alert(f.lang.invalidHeight);f.$("height",a).focus();return false}return true},exec:function(a){var b=f.util.getIframeDoc(this.dialog.iframe),c=f.$("url",b).value,e=f.$("width",b).value;b=f.$("height",b).value;if(!this.check(a,c,e,b))return false; +c=f.util.getMediaImage(a,"flash",{src:c,type:f.g[a].mediaTypes.flash,width:e,height:b,quality:"high"});f.util.insertHtml(a,c);this.dialog.hide();f.util.focus(a)}};f.plugin.image={getSelectedNode:function(a){a=f.g[a];var b=a.keRange.startNode,c=a.keRange.endNode;if(f.browser.WEBKIT||a.keSel.isControl)if(b.nodeType==1)if(b.tagName.toLowerCase()=="img")if(b==c)if(!b.className.match(/^ke-\w+/i))return b},init:function(a){var b=this;a=f.g[a];a.contextmenuItems.push({text:f.lang.editImage,click:function(c, +e){f.util.select(c);e.hide();b.click(c)},cond:function(c){return b.getSelectedNode(c)},options:{width:"150px",iconHtml:''}});a.contextmenuItems.push({text:f.lang.deleteImage,click:function(c,e){f.util.select(c);e.hide();var g=b.getSelectedNode(c);g.parentNode.removeChild(g);f.util.execOnchangeHandler(c)},cond:function(c){return b.getSelectedNode(c)},options:{width:"150px"}});a.contextmenuItems.push("-")},click:function(a){f.util.selection(a); +this.dialog=new f.dialog({id:a,cmd:"image",file:"image/image.html",width:400,height:220,loadingMode:true,title:f.lang.image,yesButton:f.lang.yes,noButton:f.lang.no});this.dialog.show()},check:function(){var a=f.util.getIframeDoc(this.dialog.iframe),b=f.$("type",a).value,c=f.$("imgWidth",a).value,e=f.$("imgHeight",a).value;f.$("imgTitle",a);b=b==2?f.$("imgFile",a):f.$("url",a);if(!b.value.match(/\.(jpg|jpeg|gif|bmp|png)(\s|\?|$)/i)){alert(f.lang.invalidImg);b.focus();return false}if(!c.match(/^\d*$/)){alert(f.lang.invalidWidth); +f.$("imgWidth",a).focus();return false}if(!e.match(/^\d*$/)){alert(f.lang.invalidHeight);f.$("imgHeight",a).focus();return false}return true},exec:function(a){for(var b=this,c=f.util.getIframeDoc(this.dialog.iframe),e=f.$("type",c).value,g=f.$("imgWidth",c).value,h=f.$("imgHeight",c).value,i=f.$("imgTitle",c).value,j=c.getElementsByName("align"),k="",l=0,m=j.length;l0)b+= +'width="'+e+'" ';if(g>0)b+='height="'+g+'" ';if(c)b+='title="'+c+'" ';if(i)b+='align="'+i+'" ';b+='alt="'+c+'" ';b+='border="'+h+'" />';f.util.insertHtml(a,b);this.dialog.hide();f.util.focus(a)}};f.plugin.link={getSelectedNode:function(a){return f.getCommonAncestor(f.g[a].keSel,"a")},init:function(a){var b=this;f.g[a].contextmenuItems.push({text:f.lang.editLink,click:function(c,e){f.util.select(c);e.hide();b.click(c)},cond:function(c){return b.getSelectedNode(c)},options:{width:"150px",iconHtml:''}})}, +click:function(a){f.util.selection(a);this.dialog=new f.dialog({id:a,cmd:"link",file:"link/link.html",width:400,height:90,loadingMode:true,title:f.lang.link,yesButton:f.lang.yes,noButton:f.lang.no});this.dialog.show()},exec:function(a){var b=f.g[a];f.util.select(a);var c=b.keRange,e=c.startNode,g=c.endNode,h=b.iframeDoc,i=f.util.getIframeDoc(this.dialog.iframe),j=f.$("hyperLink",i).value,k=f.$("linkType",i).value;if(!j.match(/.+/)||j.match(/^\w+:\/\/\/?$/)){alert(f.lang.invalidUrl);f.$("hyperLink", +i).focus();return false}for(i=c.getParentElement();i;){if(i.tagName.toLowerCase()=="a"||i.tagName.toLowerCase()=="body")break;i=i.parentNode}i=i.parentNode;g=f.browser.IE?!!b.range.item:e.nodeType==1&&e===g&&e.nodeName.toLowerCase()!="br";var l=!g;g||(l=f.browser.IE?b.range.text==="":b.range.toString()==="");if(l||f.util.isEmpty(a)){b='";f.util.insertHtml(a,b)}else{h.execCommand("createlink",false,"__ke_temp_url__");i=i.getElementsByTagName("a"); +l=0;for(var m=i.length;l'}});f.g[a].contextmenuItems.push("-")},click:function(a){var b=f.g[a],c=b.iframeDoc;f.util.selection(a);var e=b.keRange,g=e.startNode;e=e.endNode;e=g.nodeType==1&&g===e;var h=!e;e||(h= +f.browser.IE?b.range.text==="":b.range.toString()==="");if(h){h=f.plugin.link.getSelectedNode(a);if(!h)return;e=b.keRange;e.selectTextNode(h);b.keSel.addRange(e);f.util.select(a);c.execCommand("unlink",false,null);if(f.browser.WEBKIT&&g.tagName.toLowerCase()=="img"){c=g.parentNode;if(c.tagName.toLowerCase()=="a"){f.util.removeParent(c);b.keSel.addRange(e)}}}else c.execCommand("unlink",false,null);f.util.execOnchangeHandler(a);f.toolbar.updateState(a);f.util.focus(a)}};f.plugin.media={init:function(a){var b= +{};f.each(f.g[a].mediaTypes,function(c,e){b[e]=c});f.g[a].getHtmlHooks.push(function(c){return c.replace(/]*class="?ke-\w+"?[^>]*>/ig,function(e){var g=e.match(/style="[^"]*;?\s*width:\s*(\d+)/i)?RegExp.$1:0,h=e.match(/style="[^"]*;?\s*height:\s*(\d+)/i)?RegExp.$1:0;g=g||(e.match(/width="([^"]+)"/i)?RegExp.$1:0);h=h||(e.match(/height="([^"]+)"/i)?RegExp.$1:0);if(e.match(/\s+kesrctag="([^"]+)"/i)){e=f.util.getAttrList(unescape(RegExp.$1));e.width=g||e.width||0;e.height=h||e.height||0;e.kesrc= +e.src;return f.util.getMediaEmbed(e)}})});f.g[a].setHtmlHooks.push(function(c){return c.replace(/]*type="([^"]+)"[^>]*>(?:<\/embed>)?/ig,function(e,g){if(typeof b[g]=="undefined")return e;var h=e.match(/\s+src="([^"]+)"/i)?RegExp.$1:"";if(e.match(/\s+kesrc="([^"]+)"/i))h=RegExp.$1;var i=e.match(/\s+width="([^"]+)"/i)?RegExp.$1:0,j=e.match(/\s+height="([^"]+)"/i)?RegExp.$1:0,k=f.util.getAttrList(e);k.src=h;k.width=i;k.height=j;return f.util.getMediaImage(a,"",k)})})},click:function(a){f.util.selection(a); +this.dialog=new f.dialog({id:a,cmd:"media",file:"media.html",width:400,height:170,loadingMode:true,title:f.lang.media,yesButton:f.lang.yes,noButton:f.lang.no});this.dialog.show()},check:function(a,b,c,e){a=f.util.getIframeDoc(this.dialog.iframe);if(!b.match(/^.{3,}\.(swf|flv|mp3|wav|wma|wmv|mid|avi|mpg|mpeg|asf|rm|rmvb)(\?|$)/i)){alert(f.lang.invalidMedia);f.$("url",a).focus();return false}if(!c.match(/^\d*$/)){alert(f.lang.invalidWidth);f.$("width",a).focus();return false}if(!e.match(/^\d*$/)){alert(f.lang.invalidHeight); +f.$("height",a).focus();return false}return true},exec:function(a){var b=f.util.getIframeDoc(this.dialog.iframe),c=f.$("url",b).value,e=f.$("width",b).value,g=f.$("height",b).value;if(!this.check(a,c,e,g))return false;b=f.$("autostart",b).checked?"true":"false";c=f.util.getMediaImage(a,"",{src:c,type:f.g[a].mediaTypes[f.util.getMediaType(c)],width:e,height:g,autostart:b,loop:"true"});f.util.insertHtml(a,c);this.dialog.hide();f.util.focus(a)}};f.plugin.advtable={getSelectedTable:function(a){return f.getCommonAncestor(f.g[a].keSel, +"table")},getSelectedRow:function(a){return f.getCommonAncestor(f.g[a].keSel,"tr")},getSelectedCell:function(a){return f.getCommonAncestor(f.g[a].keSel,"td")},tableprop:function(a){this.click(a)},tableinsert:function(a){this.click(a,"insert")},tabledelete:function(a){a=this.getSelectedTable(a);a.parentNode.removeChild(a)},tablecolinsert:function(a,b){for(var c=this.getSelectedTable(a),e=this.getSelectedCell(a).cellIndex+b,g=0,h=c.rows.length;g'}})}f.g[a].contextmenuItems.push("-");f.g[a].setHtmlHooks.push(function(i){return i.replace(/]*)>/ig,function(j,k){if(k.match(/\s+border=["']?(\d*)["']?/ig)){var l=RegExp.$1;return k.indexOf("ke-zeroborder")<0&&(l===""||l==="0")?f.addClass(j,"ke-zeroborder"):j}else return f.addClass(j, +"ke-zeroborder")})})},click:function(a,b){b=b||"default";f.util.selection(a);this.dialog=new f.dialog({id:a,cmd:"advtable",file:"advtable/advtable.html?mode="+b,width:420,height:220,loadingMode:true,title:f.lang.advtable,yesButton:f.lang.yes,noButton:f.lang.no});this.dialog.show()},exec:function(a){var b=f.util.getIframeDoc(this.dialog.iframe),c=f.$("mode",b),e=f.$("rows",b),g=f.$("cols",b),h=f.$("width",b),i=f.$("height",b),j=f.$("widthType",b),k=f.$("heightType",b),l=f.$("padding",b),m=f.$("spacing", +b),p=f.$("align",b),o=f.$("border",b),q=f.$("borderColor",b),r=f.$("backgroundColor",b);b=e.value;var u=g.value,n=h.value,v=i.value;j=j.value;var t=k.value;k=l.value;var x=m.value;p=p.value;var w=o.value;q=q.innerHTML;r=r.innerHTML;if(b==""||b==0||!b.match(/^\d*$/)){alert(f.lang.invalidRows);e.focus();return false}if(u==""||u==0||!u.match(/^\d*$/)){alert(f.lang.invalidCols);g.focus();return false}if(!n.match(/^\d*$/)){alert(f.lang.invalidWidth);h.focus();return false}if(!v.match(/^\d*$/)){alert(f.lang.invalidHeight); +i.focus();return false}if(!k.match(/^\d*$/)){alert(f.lang.invalidPadding);l.focus();return false}if(!x.match(/^\d*$/)){alert(f.lang.invalidSpacing);m.focus();return false}if(!w.match(/^\d*$/)){alert(f.lang.invalidBorder);o.focus();return false}if(c.value==="update"){b=this.getSelectedTable(a);if(n!=="")b.style.width=n+j;else if(b.style.width)b.style.width="";b.width!==d&&b.removeAttribute("width");if(v!=="")b.style.height=v+t;else if(b.style.height)b.style.height="";b.height!==d&&b.removeAttribute("height"); +if(r!=="")b.style.backgroundColor=r;else if(b.style.backgroundColor)b.style.backgroundColor="";b.bgColor!==d&&b.removeAttribute("bgColor");if(k!=="")b.cellPadding=k;else b.removeAttribute("cellPadding");if(x!=="")b.cellSpacing=x;else b.removeAttribute("cellSpacing");if(p!=="")b.align=p;else b.removeAttribute("align");w===""||w==="0"?f.addClass(b,"ke-zeroborder"):f.removeClass(b,"ke-zeroborder");w!==""?b.setAttribute("border",w):b.removeAttribute("border");q!==""?b.setAttribute("borderColor",q):b.removeAttribute("borderColor"); +f.util.execOnchangeHandler(a)}else{c="";if(n!=="")c+="width:"+n+j+";";if(v!=="")c+="height:"+v+t+";";if(r!=="")c+="background-color:"+r+";";n="";for(c=0;c ";n+="
"}n+="
todo->desc;?>desc, "rows=5 class=area-1");?>desc, "rows=8 class=area-1");?>
todo->status;?>
todo->desc;?>desc);?>desc;?>
todo->status;?>
";f.util.insertHtml(a, +n)}this.dialog.hide();f.util.focus(a)}}})(KindEditor); diff --git a/www/js/jquery/kindeditor/kindeditor.js b/www/js/jquery/kindeditor/kindeditor.js new file mode 100644 index 0000000000..c9e4db3120 --- /dev/null +++ b/www/js/jquery/kindeditor/kindeditor.js @@ -0,0 +1,4444 @@ +/******************************************************************************* +* KindEditor - WYSIWYG HTML Editor for Internet +* Copyright (C) 2006-2010 Longhao Luo +* +* @author Roddy +* @site http://www.kindsoft.net/ +* @licence LGPL(http://www.opensource.org/licenses/lgpl-license.php) +* @version 3.5.1 (2010-07-18) +*******************************************************************************/ + +(function (undefined) { + +var KE = {}; + +KE.version = '3.5.1 (2010-07-18)'; + +KE.scriptPath = (function() { + var elements = document.getElementsByTagName('script'); + for (var i = 0, len = elements.length; i < len; i++) { + if (elements[i].src && elements[i].src.match(/kindeditor[\w\-\.]*\.js/)) { + return elements[i].src.substring(0, elements[i].src.lastIndexOf('/') + 1); + } + } + return ''; +})(); + +KE.browser = (function() { + var ua = navigator.userAgent.toLowerCase(); + return { + VERSION: ua.match(/(msie|firefox|webkit|opera)[\/:\s](\d+)/) ? RegExp.$2 : '0', + IE: (ua.indexOf('msie') > -1 && ua.indexOf('opera') == -1), + GECKO: (ua.indexOf('gecko') > -1 && ua.indexOf('khtml') == -1), + WEBKIT: (ua.indexOf('applewebkit') > -1), + OPERA: (ua.indexOf('opera') > -1) + }; +})(); + +KE.setting = { + wyswygMode : true, + loadStyleMode : true, + resizeMode : 2, + filterMode : false, + autoSetDataMode : true, + shadowMode : true, + urlType : '', + skinType : 'default', + newlineTag : 'p', + dialogAlignType : 'page', + cssPath : '', + skinsPath : KE.scriptPath === '' ? '' : KE.scriptPath + 'skins/', + pluginsPath : KE.scriptPath === '' ? '' : KE.scriptPath + 'plugins/', + minWidth : 200, + minHeight : 100, + minChangeSize : 5, + toolbarLineHeight : 24, + statusbarHeight : 11, + items : [ + 'source', '|', 'fullscreen', 'undo', 'redo', 'print', 'cut', 'copy', 'paste', + 'plainpaste', 'wordpaste', '|', 'justifyleft', 'justifycenter', 'justifyright', + 'justifyfull', 'insertorderedlist', 'insertunorderedlist', 'indent', 'outdent', 'subscript', + 'superscript', '|', 'selectall', + 'title', 'fontname', 'fontsize', '|', 'textcolor', 'bgcolor', 'bold', + 'italic', 'underline', 'strikethrough', 'removeformat', '|', 'image', + 'flash', 'media', 'advtable', 'hr', 'emoticons', 'link', 'unlink', '|', 'about' + ], + colorTable : [ + ['#E53333', '#E56600', '#FF9900', '#64451D', '#DFC5A4', '#FFE500'], + ['#009900', '#006600', '#99BB00', '#B8D100', '#60D978', '#00D5FF'], + ['#337FE5', '#003399', '#4C33E5', '#9933E5', '#CC33E5', '#EE33EE'], + ['#FFFFFF', '#CCCCCC', '#999999', '#666666', '#333333', '#000000'] + ], + noEndTags : ['br', 'hr', 'img', 'area', 'col', 'embed', 'input', 'param'], + inlineTags : ['b', 'del', 'em', 'font', 'i', 'span', 'strike', 'strong', 'sub', 'sup', 'u'], + endlineTags : [ + 'br', 'hr', 'table', 'tbody', 'td', 'tr', 'th', 'div', 'p', 'ol', 'ul', + 'li', 'blockquote', 'h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'script', 'style', 'marquee' + ], + htmlTags : { + font : ['color', 'size', 'face', '.background-color'], + span : [ + '.color', '.background-color', '.font-size', '.font-family', '.background', + '.font-weight', '.font-style', '.text-decoration', '.vertical-align' + ], + div : [ + 'align', '.border', '.margin', '.padding', '.text-align', '.color', + '.background-color', '.font-size', '.font-family', '.font-weight', '.background', + '.font-style', '.text-decoration', '.vertical-align', '.margin-left' + ], + table: [ + 'border', 'cellspacing', 'cellpadding', 'width', 'height', 'align', 'bordercolor', + '.padding', '.margin', '.border', 'bgcolor', '.text-align', '.color', '.background-color', + '.font-size', '.font-family', '.font-weight', '.font-style', '.text-decoration', '.background', + '.width', '.height' + ], + 'td,th': [ + 'align', 'valign', 'width', 'height', 'colspan', 'rowspan', 'bgcolor', + '.text-align', '.color', '.background-color', '.font-size', '.font-family', '.font-weight', + '.font-style', '.text-decoration', '.vertical-align', '.background' + ], + a : ['href', 'target', 'name'], + embed : ['src', 'width', 'height', 'type', 'loop', 'autostart', 'quality', '.width', '.height', 'align', 'allowscriptaccess', '/'], + img : ['src', 'width', 'height', 'border', 'alt', 'title', '.width', '.height', '/'], + hr : ['/'], + br : ['/'], + 'p,ol,ul,li,blockquote,h1,h2,h3,h4,h5,h6' : [ + 'align', '.text-align', '.color', '.background-color', '.font-size', '.font-family', '.background', + '.font-weight', '.font-style', '.text-decoration', '.vertical-align', '.text-indent', '.margin-left' + ], + 'tbody,tr,strong,b,sub,sup,em,i,u,strike' : [] + }, + mediaTypes : { + rm : 'audio/x-pn-realaudio-plugin', + flash : 'application/x-shockwave-flash', + media : 'video/x-ms-asf-plugin' + } +}; + +KE.g = {}; + +KE.plugin = {}; + +KE.$ = function(id, doc){ + var doc = doc || document; + return doc.getElementById(id); +}; + +KE.$$ = function(name, doc){ + var doc = doc || document; + return doc.createElement(name); +}; + +KE.event = { + add : function(el, type, fn, id) { + if (el.addEventListener){ + el.addEventListener(type, fn, false); + } else if (el.attachEvent){ + el.attachEvent('on' + type, fn); + } + if (id !== undefined) { + KE.g[id].eventStack.push({ + el : el, + type : type, + fn : fn + }); + } + }, + remove : function(el, type, fn, id) { + if (el.removeEventListener){ + el.removeEventListener(type, fn, false); + } else if (el.detachEvent){ + el.detachEvent('on' + type, fn); + } + if (id !== undefined) { + var stack = KE.g[id].eventStack; + for (var i = 0, len = stack.length; i < len; i++) { + var item = stack[i]; + if (item && el === item.el && type === item.type && fn === item.fn) { + delete stack[i]; + } + } + } + }, + stop : function(e) { + if (e.preventDefault) e.preventDefault(); + if (e.stopPropagation) e.stopPropagation(); + if (e.cancelBubble !== undefined) e.cancelBubble = true; + if (e.returnValue !== undefined) e.returnValue = false; + }, + bind : function(el, type, fn, id) { + this.add(el, type, function(e) { + fn(e); + KE.event.stop(e); + return false; + }, id); + }, + input : function(el, func, id) { + this.add(el, 'keyup', function(e) { + if (!e.ctrlKey && !e.altKey && (e.keyCode < 16 || e.keyCode > 18) && e.keyCode != 116) { + func(e); + KE.event.stop(e); + return false; + } + }, id); + function handler (e) { + window.setTimeout(function() { + func(e); + }, 1); + } + var newElement = (el.nodeName == '#document') ? el.body : el; + this.add(newElement, 'paste', handler, id); + this.add(newElement, 'cut', handler, id); + }, + ctrl : function(el, key, func, id) { + key = key.toString().match(/^\d{2,}$/) ? key : key.toUpperCase().charCodeAt(0); + this.add(el, 'keydown', function(e) { + if (e.ctrlKey && e.keyCode == key && !e.shiftKey && !e.altKey) { + func(e); + KE.event.stop(e); + return false; + } + }, id); + }, + ready : function(func, win, doc, id) { + var win = win || window; + var doc = doc || document; + var loaded = false; + var readyFunc = function() { + if (loaded) return; + loaded = true; + func(); + }; + if (doc.addEventListener) { + this.add(doc, "DOMContentLoaded", readyFunc, id); + } else if (doc.attachEvent){ + this.add(doc, "readystatechange", function() { + if (doc.readyState == "complete") readyFunc(); + }, id); + if ( doc.documentElement.doScroll && typeof win.frameElement === "undefined" ) { + var ieReadyFunc = function() { + if (loaded) return; + try { + doc.documentElement.doScroll("left"); + } catch(e) { + window.setTimeout(ieReadyFunc, 0); + return; + } + readyFunc(); + }; + ieReadyFunc(); + } + } + this.add(win, 'load', readyFunc, id); + } +}; + +KE.each = function(obj, func) { + for (var key in obj) { + if (obj.hasOwnProperty(key)) func(key, obj[key]); + } +}; + +KE.eachNode = function(node, func) { + var walkNodes = function(parent) { + if (KE.util.getNodeType(parent) != 1) return true; + var n = parent.firstChild; + while (n) { + var next = n.nextSibling; + if (!func(n)) return false; + if (!walkNodes(n)) return false; + n = next; + } + return true; + }; + walkNodes(node); +}; + +KE.selection = function(doc) { + this.sel = null; + this.range = null; + this.keRange = null; + this.isControl = false; + var win = doc.parentWindow || doc.defaultView; + this.init = function() { + var sel = win.getSelection ? win.getSelection() : doc.selection; + var range; + try { + if (sel.rangeCount > 0) range = sel.getRangeAt(0); + else range = sel.createRange(); + } catch(e) {} + if (!range) range = KE.util.createRange(doc); + this.sel = sel; + this.range = range; + var startNode, startPos, endNode, endPos; + if (KE.browser.IE) { + if (range.item) { + this.isControl = true; + var el = range.item(0); + startNode = endNode = el; + startPos = endPos = 0; + } else { + this.isControl = false; + var getStartEnd = function(isStart) { + var pointRange = range.duplicate(); + pointRange.collapse(isStart); + var parentNode = pointRange.parentElement(); + var nodes = parentNode.childNodes; + if (nodes.length == 0) return {node: parentNode, pos: 0}; + var startNode; + var endElement; + var startPos = 0; + var isEnd = false; + var testRange = range.duplicate(); + KE.util.moveToElementText(testRange, parentNode); + for (var i = 0, len = nodes.length; i < len; i++) { + var node = nodes[i]; + var cmp = testRange.compareEndPoints('StartToStart', pointRange); + if (cmp > 0) { + isEnd = true; + } else if (cmp == 0) { + if (node.nodeType == 1) { + var keRange = new KE.range(doc); + keRange.selectTextNode(node); + return {node: keRange.startNode, pos: 0}; + } else { + return {node: node, pos: 0}; + } + } + if (node.nodeType == 1) { + var nodeRange = range.duplicate(); + KE.util.moveToElementText(nodeRange, node); + testRange.setEndPoint('StartToEnd', nodeRange); + if (isEnd) startPos += nodeRange.text.length; + else startPos = 0; + } else if (node.nodeType == 3) { + testRange.moveStart('character', node.nodeValue.length); + startPos += node.nodeValue.length; + } + if (!isEnd) startNode = node; + } + if (!isEnd && startNode.nodeType == 1) { + var startNode = parentNode.lastChild; + return {node: startNode, pos: startNode.nodeType == 1 ? 1 : startNode.nodeValue.length}; + } + testRange = range.duplicate(); + KE.util.moveToElementText(testRange, parentNode); + testRange.setEndPoint('StartToEnd', pointRange); + startPos -= testRange.text.replace(/\r\n|\n|\r/g, '').length; + return {node: startNode, pos: startPos}; + }; + var start = getStartEnd(true); + var end = getStartEnd(false); + startNode = start.node; + startPos = start.pos; + endNode = end.node; + endPos = end.pos; + } + } else { + startNode = range.startContainer; + startPos = range.startOffset; + endNode = range.endContainer; + endPos = range.endOffset; + if (startNode.nodeType == 1 && typeof startNode.childNodes[startPos] != 'undefined') { + startNode = startNode.childNodes[startPos]; + startPos = 0; + } + if (endNode.nodeType == 1) { + endPos = endPos == 0 ? 1 : endPos; + if (typeof endNode.childNodes[endPos - 1] != 'undefined') { + endNode = endNode.childNodes[endPos - 1]; + endPos = (endNode.nodeType == 1) ? 0 : endNode.nodeValue.length; + } + } + this.isControl = (startNode.nodeType == 1 && startNode === endNode && range.startOffset + 1 == range.endOffset); + if (startNode.nodeType == 1 && endNode.nodeType == 3 && endPos == 0 && endNode.previousSibling) { + var node = endNode.previousSibling; + while (node) { + if (node === startNode) { + endNode = startNode; + break; + } + if (node.childNodes.length != 1) break; + node = node.childNodes[0]; + } + } + if (range.collapsed) { + var keRange = new KE.range(doc); + keRange.setTextStart(startNode, startPos); + endNode = keRange.startNode; + endPos = keRange.startPos; + } + } + var keRange = new KE.range(doc); + keRange.setTextStart(startNode, startPos); + keRange.setTextEnd(endNode, endPos); + this.keRange = keRange; + }; + this.init(); + this.addRange = function(keRange) { + if (KE.browser.GECKO && KE.browser.VERSION < 3) return; + this.keRange = keRange; + if (KE.browser.IE) { + var getEndRange = function(isStart) { + var range = KE.util.createRange(doc); + var node = isStart ? keRange.startNode : keRange.endNode; + if (node.nodeType == 1) { + KE.util.moveToElementText(range, node); + range.collapse(isStart); + } else if (node.nodeType == 3) { + range = KE.util.getNodeStartRange(doc, node); + var pos = isStart ? keRange.startPos : keRange.endPos; + range.moveStart('character', pos); + } + return range; + } + if (!this.range.item) { + var node = keRange.startNode; + if (node == keRange.endNode && KE.util.getNodeType(node) == 1 && KE.util.getNodeTextLength(node) == 0) { + var temp = doc.createTextNode(" "); + node.appendChild(temp); + KE.util.moveToElementText(this.range, node); + this.range.collapse(false); + this.range.select(); + node.removeChild(temp); + } else { + if (node.nodeType == 3 && keRange.collapsed()) { + this.range = getEndRange(true); + this.range.collapse(true); + } else { + this.range.setEndPoint('StartToStart', getEndRange(true)); + this.range.setEndPoint('EndToStart', getEndRange(false)); + } + this.range.select(); + } + } + } else { + var getNodePos = function(node) { + var pos = 0; + while (node) { + node = node.previousSibling; + pos++; + } + return --pos; + }; + var range = new KE.range(doc); + range.setTextStart(keRange.startNode, keRange.startPos); + range.setTextEnd(keRange.endNode, keRange.endPos); + var startNode = range.startNode; + var endNode = range.endNode; + if (KE.util.getNodeType(startNode) == 88) { + this.range.setStart(startNode.parentNode, getNodePos(range.startNode)); + } else { + this.range.setStart(startNode, range.startPos); + } + if (KE.util.getNodeType(endNode) == 88) { + this.range.setEnd(endNode.parentNode, getNodePos(range.endNode) + 1); + } else { + this.range.setEnd(endNode, range.endPos); + } + this.sel.removeAllRanges(); + this.sel.addRange(this.range); + } + }; + this.focus = function() { + if (KE.browser.IE && this.range != null) this.range.select(); + } +}; + +KE.range = function(doc) { + this.startNode = null; + this.startPos = null; + this.endNode = null; + this.endPos = null; + this.getParentElement = function() { + var scanParent = function(node, func) { + while (node && (!node.tagName || node.tagName.toLowerCase() != 'body')) { + node = node.parentNode; + if (func(node)) return; + } + } + var nodeList = []; + scanParent(this.startNode, function(node) { + nodeList.push(node); + }); + var parentNode; + scanParent(this.endNode, function(node) { + if (KE.util.inArray(node, nodeList)) { + parentNode = node; + return true; + } + }); + return parentNode ? parentNode : doc.body; + }; + this.getNodeList = function() { + var self = this; + var parentNode = this.getParentElement(); + var nodeList = []; + var isStarted = false; + if (parentNode == self.startNode) isStarted = true; + if (isStarted) nodeList.push(parentNode); + KE.eachNode(parentNode, function(node) { + if (node == self.startNode) isStarted = true; + var range = new KE.range(doc); + range.selectTextNode(node); + var cmp = range.comparePoints('START_TO_END', self); + if (cmp > 0) { + return false; + } else if (cmp == 0) { + if (range.startNode !== range.endNode || range.startPos !== range.endPos) return false; + } + if (isStarted) nodeList.push(node); + return true; + }); + return nodeList; + }; + this.comparePoints = function(how, range) { + var compareNodes = function(nodeA, posA, nodeB, posB) { + var cmp; + if (KE.browser.IE) { + var getStartRange = function(node, pos, isStart) { + var range = KE.util.createRange(doc); + var type = KE.util.getNodeType(node); + if (type == 1) { + KE.util.moveToElementText(range, node); + range.collapse(isStart); + } else if (type == 3) { + range = KE.util.getNodeStartRange(doc, node); + range.moveStart('character', pos); + range.collapse(true); + } + return range; + } + var rangeA, rangeB; + if (how == 'START_TO_START' || how == 'START_TO_END') rangeA = getStartRange(nodeA, posA, true); + else rangeA = getStartRange(nodeA, posA, false); + if (how == 'START_TO_START' || how == 'END_TO_START') rangeB = getStartRange(nodeB, posB, true); + else rangeB = getStartRange(nodeB, posB, false); + return rangeA.compareEndPoints('StartToStart', rangeB); + } else { + var rangeA = KE.util.createRange(doc); + rangeA.selectNode(nodeA); + if (how == 'START_TO_START' || how == 'START_TO_END') rangeA.collapse(true); + else rangeA.collapse(false); + var rangeB = KE.util.createRange(doc); + rangeB.selectNode(nodeB); + if (how == 'START_TO_START' || how == 'END_TO_START') rangeB.collapse(true); + else rangeB.collapse(false); + if (rangeA.compareBoundaryPoints(Range.START_TO_START, rangeB) > 0) { + cmp = 1; + } else if (rangeA.compareBoundaryPoints(Range.START_TO_START, rangeB) == 0) { + if (posA > posB) cmp = 1; + else if (posA == posB) cmp = 0; + else cmp = -1; + } else { + cmp = -1; + } + } + return cmp; + } + if (how == 'START_TO_START') return compareNodes(this.startNode, this.startPos, range.startNode, range.startPos); + if (how == 'START_TO_END') return compareNodes(this.startNode, this.startPos, range.endNode, range.endPos); + if (how == 'END_TO_START') return compareNodes(this.endNode, this.endPos, range.startNode, range.startPos); + if (how == 'END_TO_END') return compareNodes(this.endNode, this.endPos, range.endNode, range.endPos); + }; + this.collapsed = function() { + return (this.startNode === this.endNode && this.startPos === this.endPos); + }; + this.collapse = function(toStart) { + if (toStart) { + this.setEnd(this.startNode, this.startPos); + } else { + this.setStart(this.endNode, this.endPos); + } + }; + this.setTextStart = function(node, pos) { + var textNode = node; + KE.eachNode(node, function(n) { + if (KE.util.getNodeType(n) == 3 && n.nodeValue.length > 0 || KE.util.getNodeType(n) == 88) { + textNode = n; + pos = 0; + return false; + } + return true; + }); + this.setStart(textNode, pos); + }; + this.setStart = function(node, pos) { + this.startNode = node; + this.startPos = pos; + if (this.endNode === null) { + this.endNode = node; + this.endPos = pos; + } + }; + this.setTextEnd = function(node, pos) { + var textNode = node; + KE.eachNode(node, function(n) { + if (KE.util.getNodeType(n) == 3 && n.nodeValue.length > 0 || KE.util.getNodeType(n) == 88) { + textNode = n; + pos = KE.util.getNodeType(n) == 3 ? n.nodeValue.length : 0; + } + return true; + }); + this.setEnd(textNode, pos); + }; + this.setEnd = function(node, pos) { + this.endNode = node; + this.endPos = pos; + if (this.startNode === null) { + this.startNode = node; + this.startPos = pos; + } + }; + this.selectNode = function(node) { + this.setStart(node, 0); + this.setEnd(node, node.nodeType == 1 ? 0 : node.nodeValue.length); + }; + this.selectTextNode = function(node) { + this.setTextStart(node, 0); + this.setTextEnd(node, node.nodeType == 1 ? 0 : node.nodeValue.length); + }; + this.extractContents = function(isDelete) { + isDelete = (isDelete === undefined) ? true : isDelete; + var thisRange = this; + var startNode = this.startNode; + var startPos = this.startPos; + var endNode = this.endNode; + var endPos = this.endPos; + var extractTextNode = function(node, startPos, endPos) { + var length = node.nodeValue.length; + var cloneNode = node.cloneNode(true); + var centerNode = cloneNode.splitText(startPos); + centerNode.splitText(endPos - startPos); + if (isDelete) { + var center = node; + if (startPos > 0) center = node.splitText(startPos); + if (endPos < length) center.splitText(endPos - startPos); + center.parentNode.removeChild(center); + } + return centerNode; + }; + var noEndTagHash = KE.util.arrayToHash(KE.setting.noEndTags); + var isStarted = false; + var isEnd = false; + var extractNodes = function(parent, frag) { + if (KE.util.getNodeType(parent) != 1) return true; + var node = parent.firstChild; + while (node) { + if (node == startNode) isStarted = true; + if (node == endNode) isEnd = true; + var nextNode = node.nextSibling; + var type = node.nodeType; + if (type == 1) { + var range = new KE.range(doc); + range.selectNode(node); + var cmp = range.comparePoints('END_TO_END', thisRange); + if (isStarted && (cmp < 0 || (cmp == 0 && noEndTagHash[node.nodeName.toLowerCase()] !== undefined))) { + var cloneNode = node.cloneNode(true); + frag.appendChild(cloneNode); + if (isDelete) { + node.parentNode.removeChild(node); + } + } else { + var childFlag = node.cloneNode(false); + if (noEndTagHash[childFlag.nodeName.toLowerCase()] === undefined) { + frag.appendChild(childFlag); + if (!extractNodes(node, childFlag)) return false; + } + } + } else if (type == 3) { + if (isStarted) { + var textNode; + if (node == startNode && node == endNode) { + textNode = extractTextNode(node, startPos, endPos); + frag.appendChild(textNode); + return false; + } else if (node == startNode) { + textNode = extractTextNode(node, startPos, node.nodeValue.length); + frag.appendChild(textNode); + } else if (node == endNode) { + textNode = extractTextNode(node, 0, endPos); + frag.appendChild(textNode); + return false; + } else { + textNode = extractTextNode(node, 0, node.nodeValue.length); + frag.appendChild(textNode); + } + } + } + node = nextNode; + if (isEnd) return false; + } + if (frag.innerHTML.replace(/<.*?>/g, '') === '' && frag.parentNode) { + frag.parentNode.removeChild(frag); + } + return true; + } + var parentNode = this.getParentElement(); + var docFrag = parentNode.cloneNode(false); + extractNodes(parentNode, docFrag); + return docFrag; + }; + this.cloneContents = function() { + return this.extractContents(false); + }; + this.getText = function() { + var html = this.cloneContents().innerHTML; + return html.replace(/<.*?>/g, ""); + }; +}; + +KE.cmd = function(id) { + this.doc = KE.g[id].iframeDoc; + this.keSel = KE.g[id].keSel; + this.keRange = KE.g[id].keRange; + this.mergeAttributes = function(el, attr) { + for (var i = 0, len = attr.length; i < len; i++) { + KE.each(attr[i], function(key, value) { + if (key.charAt(0) == '.') { + var jsKey = KE.util.getJsKey(key.substr(1)); + el.style[jsKey] = value; + } else { + if (KE.browser.IE && KE.browser.VERSION < 8 && key == 'class') key = 'className'; + el.setAttribute(key, value); + } + }); + } + return el; + }; + this.wrapTextNode = function(node, startPos, endPos, element, attributes) { + var length = node.nodeValue.length; + var isFull = (startPos == 0 && endPos == length); + var range = new KE.range(this.doc); + range.selectTextNode(node.parentNode); + if (isFull && + node.parentNode.tagName == element.tagName && + range.comparePoints('END_TO_END', this.keRange) <= 0 && + range.comparePoints('START_TO_START', this.keRange) >= 0) { + this.mergeAttributes(node.parentNode, attributes); + return node; + } else { + var el = element.cloneNode(true); + if (isFull) { + var cloneNode = node.cloneNode(true); + el.appendChild(cloneNode); + node.parentNode.replaceChild(el, node); + return cloneNode; + } else { + var centerNode = node; + if (startPos < endPos) { + if (startPos > 0) centerNode = node.splitText(startPos); + if (endPos < length) centerNode.splitText(endPos - startPos); + var cloneNode = centerNode.cloneNode(true); + el.appendChild(cloneNode); + centerNode.parentNode.replaceChild(el, centerNode); + return cloneNode; + } else { + if (startPos < length) { + centerNode = node.splitText(startPos); + centerNode.parentNode.insertBefore(el, centerNode); + } else { + if (centerNode.nextSibling) { + centerNode.parentNode.insertBefore(el, centerNode.nextSibling); + } else { + centerNode.parentNode.appendChild(el); + } + } + return el; + } + } + } + }; + this.wrap = function(tagName, attributes) { + attributes = attributes || []; + var self = this; + this.keSel.focus(); + var element = KE.$$(tagName, this.doc); + this.mergeAttributes(element, attributes); + var keRange = this.keRange; + var startNode = keRange.startNode; + var startPos = keRange.startPos; + var endNode = keRange.endNode; + var endPos = keRange.endPos; + var parentNode = keRange.getParentElement(); + if (KE.util.inMarquee(parentNode)) return; + var isStarted = false; + KE.eachNode(parentNode, function(node) { + if (node == startNode) isStarted = true; + if (node.nodeType == 1) { + if (node == startNode && node == endNode) { + if (KE.util.inArray(node.tagName.toLowerCase(), KE.g[id].noEndTags)) { + if (startPos > 0) node.parentNode.appendChild(element); + else node.parentNode.insertBefore(element, node); + } else { + node.appendChild(element); + } + keRange.selectNode(element); + return false; + } else if (node == startNode) { + keRange.setStart(node, 0); + } else if (node == endNode) { + keRange.setEnd(node, 0); + return false; + } + } else if (node.nodeType == 3) { + if (isStarted) { + if (node == startNode && node == endNode) { + var rangeNode = self.wrapTextNode(node, startPos, endPos, element, attributes); + keRange.selectNode(rangeNode); + return false; + } else if (node == startNode) { + var rangeNode = self.wrapTextNode(node, startPos, node.nodeValue.length, element, attributes); + keRange.setStart(rangeNode, 0); + } else if (node == endNode) { + var rangeNode = self.wrapTextNode(node, 0, endPos, element, attributes); + keRange.setEnd(rangeNode, rangeNode.nodeType == 1 ? 0 : rangeNode.nodeValue.length); + return false; + } else { + self.wrapTextNode(node, 0, node.nodeValue.length, element, attributes); + } + } + } + return true; + }); + this.keSel.addRange(keRange); + }; + this.getTopParent = function(tagNames, node) { + var parent = null; + while (node) { + node = node.parentNode; + if (KE.util.inArray(node.tagName.toLowerCase(), tagNames)) { + parent = node; + } else { + break; + } + } + return parent; + }; + this.splitNodeParent = function(parent, node, pos) { + var leftRange = new KE.range(this.doc); + leftRange.selectNode(parent.firstChild); + leftRange.setEnd(node, pos); + var leftFrag = leftRange.extractContents(); + parent.parentNode.insertBefore(leftFrag, parent); + return {left : leftFrag, right : parent}; + }; + this.remove = function(tags) { + var self = this; + var keRange = this.keRange; + var startNode = keRange.startNode; + var startPos = keRange.startPos; + var endNode = keRange.endNode; + var endPos = keRange.endPos; + this.keSel.focus(); + if (KE.util.inMarquee(keRange.getParentElement())) return; + var isCollapsed = (keRange.getText().replace(/\s+/g, '') === ''); + if (isCollapsed && !KE.browser.IE) return; + var tagNames = []; + KE.each(tags, function(key, val) { + if (key != '*') tagNames.push(key); + }); + var startParent = this.getTopParent(tagNames, startNode); + var endParent = this.getTopParent(tagNames, endNode); + if (startParent) { + var startFrags = this.splitNodeParent(startParent, startNode, startPos); + keRange.setStart(startFrags.right, 0); + if (startNode == endNode && KE.util.getNodeTextLength(startFrags.right) > 0) { + keRange.selectNode(startFrags.right); + var range = new KE.range(this.doc); + range.selectTextNode(startFrags.left); + if (startPos > 0) endPos -= range.endNode.nodeValue.length; + range.selectTextNode(startFrags.right); + endNode = range.startNode; + } + } + if (isCollapsed) { + var node = keRange.startNode; + if (node.nodeType == 1) { + if (node.nodeName.toLowerCase() == 'br') return; + keRange.selectNode(node); + } else { + return; + } + } else if (endParent) { + var endFrags = this.splitNodeParent(endParent, endNode, endPos); + keRange.setEnd(endFrags.left, 0); + if (startParent == endParent) { + keRange.setStart(endFrags.left, 0); + } + } + var removeAttr = function(node, attr) { + if (attr.charAt(0) == '.') { + var jsKey = KE.util.getJsKey(attr.substr(1)); + node.style[jsKey] = ''; + } else { + if (KE.browser.IE && KE.browser.VERSION < 8 && attr == 'class') attr = 'className'; + node.removeAttribute(attr); + } + }; + var nodeList = keRange.getNodeList(); + keRange.setTextStart(keRange.startNode, keRange.startPos); + keRange.setTextEnd(keRange.endNode, keRange.endPos); + for (var i = 0, length = nodeList.length; i < length; i++) { + var node = nodeList[i]; + if (node.nodeType == 1) { + var tagName = node.tagName.toLowerCase(); + if (tags[tagName]) { + var attr = tags[tagName]; + for (var j = 0, len = attr.length; j < len; j++) { + if (attr[j] == '*') { + KE.util.removeParent(node); + break; + } else { + removeAttr(node, attr[j]); + var attrs = []; + if (node.outerHTML) { + attrHash = KE.util.getAttrList(node.outerHTML); + KE.each(attrHash, function(key, val) { + attrs.push({ + name : key, + value : val + }); + }); + } else { + attrs = node.attributes; + } + if (attrs.length == 0) { + KE.util.removeParent(node); + break; + } else if (attrs[0].name == 'style' && attrs[0].value === '') { + KE.util.removeParent(node); + break; + } + } + } + } + if (tags['*']) { + var attr = tags['*']; + for (var j = 0, len = attr.length; j < len; j++) { + removeAttr(node, attr[j]); + } + } + } + } + try { + this.keSel.addRange(keRange); + } catch(e) {} + }; +}; + +KE.format = { + getUrl : function(url, mode, host, pathname) { + if (!mode) return url; + mode = mode.toLowerCase(); + if (!KE.util.inArray(mode, ['absolute', 'relative', 'domain'])) return url; + host = host || location.protocol + '//' + location.host; + if (pathname === undefined) { + var m = location.pathname.match(/^(\/.*)\//); + pathname = m ? m[1] : ''; + } + var matches = url.match(/^(\w+:\/\/[^\/]*)/); + if (matches) { + if (matches[1] !== host) return url; + } else if (url.match(/^\w+:/)) { + return url; + } + var getRealPath = function(path) { + var parts = path.split('/'); + paths = []; + for (var i = 0, len = parts.length; i < len; i++) { + var part = parts[i]; + if (part == '..') { + if (paths.length > 0) paths.pop(); + } else if (part !== '' && part != '.') { + paths.push(part); + } + } + return '/' + paths.join('/'); + }; + if (url.match(/^\//)) { + url = host + getRealPath(url.substr(1)); + } else if (!url.match(/^\w+:\/\//)) { + url = host + getRealPath(pathname + '/' + url); + } + if (mode == 'relative') { + var getRelativePath = function(path, depth) { + if (url.substr(0, path.length) === path) { + var arr = []; + for (var i = 0; i < depth; i++) { + arr.push('..'); + } + var prefix = '.'; + if (arr.length > 0) prefix += '/' + arr.join('/'); + if (pathname == '/') prefix += '/'; + return prefix + url.substr(path.length); + } else { + var m = path.match(/^(.*)\//); + if (m) { + return getRelativePath(m[1], ++depth); + } + } + }; + url = getRelativePath(host + pathname, 0).substr(2); + } else if (mode == 'absolute') { + if (url.substr(0, host.length) === host) { + url = url.substr(host.length); + } + } + return url; + }, + getHtml : function(html, htmlTags, urlType) { + var isFilter = htmlTags ? true : false; + html = html.replace(/(]*>)([\s\S]*?)(<\/pre>)/ig, function($0, $1, $2, $3){ + return $1 + $2.replace(/]*>/ig, '\n') + $3; + }); + var htmlTagHash = {}; + var fontSizeHash = ['xx-small', 'x-small', 'small', 'medium', 'large', 'x-large', 'xx-large']; + if (isFilter) { + KE.each(htmlTags, function(key, val) { + var arr = key.split(','); + for (var i = 0, len = arr.length; i < len; i++) htmlTagHash[arr[i]] = KE.util.arrayToHash(val); + }); + } + var noEndTagHash = KE.util.arrayToHash(KE.setting.noEndTags); + var inlineTagHash = KE.util.arrayToHash(KE.setting.inlineTags); + var endlineTagHash = KE.util.arrayToHash(KE.setting.endlineTags); + var re = /((?:\r\n|\n|\r)*)<(\/)?([\w-:]+)((?:\s+|(?:\s+[\w-:]+)|(?:\s+[\w-:]+=[^\s"'<>]+)|(?:\s+[\w-:]+="[^"]*")|(?:\s+[\w-:]+='[^']*'))*)(\/)?>((?:\r\n|\n|\r)*)/g; + html = html.replace(re, function($0, $1, $2, $3, $4, $5, $6) { + var startNewline = $1 || ''; + var startSlash = $2 || ''; + var tagName = $3.toLowerCase(); + var attr = $4 || ''; + var endSlash = $5 ? ' ' + $5 : ''; + var endNewline = $6 || ''; + if (isFilter && typeof htmlTagHash[tagName] == "undefined") return ''; + if (endSlash === '' && typeof noEndTagHash[tagName] != "undefined") endSlash = ' /'; + if (tagName in endlineTagHash) { + if (startSlash || endSlash) endNewline = '\n'; + } else { + if (endNewline) endNewline = ' '; + } + if (tagName !== 'script' && tagName !== 'style') { + startNewline = ''; + } + if (tagName === 'font') { + var style = {}, styleStr = ''; + attr = attr.replace(/\s*([\w-:]+)=([^\s"'<>]+|"[^"]*"|'[^']*')/g, function($0, $1, $2) { + var key = $1.toLowerCase(); + var val = $2 || ''; + val = val.replace(/^["']|["']$/g, ''); + if (key === 'color') { + style['color'] = val; + return ' '; + } + if (key === 'size') { + style['font-size'] = fontSizeHash[parseInt(val) - 1] || ''; + return ' '; + } + if (key === 'face') { + style['font-family'] = val; + return ' '; + } + if (key === 'style') { + styleStr = val; + return ' '; + } + return $0; + }); + if (styleStr && !/;$/.test(styleStr)) styleStr += ';'; + KE.each(style, function(key, val) { + if (val !== '') { + if (/\s/.test(val)) val = "'" + val + "'"; + styleStr += key + ':' + val + ';'; + } + }); + if (styleStr) attr += ' style="' + styleStr + '"'; + tagName = 'span'; + } + if (attr !== '') { + attr = attr.replace(/\s*([\w-:]+)=([^\s"'<>]+|"[^"]*"|'[^']*')/g, function($0, $1, $2) { + var key = $1.toLowerCase(); + var val = $2 || ''; + if (isFilter) { + if (key.charAt(0) === "." || (key !== "style" && typeof htmlTagHash[tagName][key] == "undefined")) return ' '; + } + if (val === '') { + val = '""'; + } else { + if (key === "style") { + val = val.substr(1, val.length - 2); + val = val.replace(/\s*([^\s]+?)\s*:(.*?)(;|$)/g, function($0, $1, $2) { + var k = $1.toLowerCase(); + if (isFilter) { + if (typeof htmlTagHash[tagName]['style'] == "undefined" && typeof htmlTagHash[tagName]['.' + k] == "undefined") return ''; + } + var v = KE.util.trim($2); + v = KE.util.rgbToHex(v); + return k + ':' + v + ';'; + }); + val = KE.util.trim(val); + if (val === '') return ''; + val = '"' + val + '"'; + } + if (KE.util.inArray(key, ['src', 'href'])) { + if (val.charAt(0) === '"') { + val = val.substr(1, val.length - 2); + } + val = KE.format.getUrl(val, urlType); + } + if (val.charAt(0) !== '"') val = '"' + val + '"'; + } + return ' ' + key + '=' + val + ' '; + }); + attr = attr.replace(/\s+(checked|selected|disabled|readonly)(\s+|$)/ig, function($0, $1) { + var key = $1.toLowerCase(); + if (isFilter) { + if (key.charAt(0) === "." || typeof htmlTagHash[tagName][key] == "undefined") return ' '; + } + return ' ' + key + '="' + key + '"' + ' '; + }); + attr = KE.util.trim(attr); + attr = attr.replace(/\s+/g, ' '); + if (attr) attr = ' ' + attr; + return startNewline + '<' + startSlash + tagName + attr + endSlash + '>' + endNewline; + } else { + return startNewline + '<' + startSlash + tagName + endSlash + '>' + endNewline; + } + }); + if (!KE.browser.IE) { + html = html.replace(/

\n<\/p>/ig, '

 

'); + html = html.replace(/\n<\/p>/ig, '

'); + } + var reg = KE.setting.inlineTags.join('|'); + var trimHtml = function(inHtml) { + var outHtml = inHtml.replace(new RegExp('<(' + reg + ')[^>]*><\\/(' + reg + ')>', 'ig'), function($0, $1, $2) { + if ($1 == $2) return ''; + else return $0; + }); + if (inHtml !== outHtml) outHtml = trimHtml(outHtml); + return outHtml; + }; + return KE.util.trim(trimHtml(html)); + } +}; + +KE.addClass = function(el, className) { + if (typeof el == 'object') { + var cls = el.className; + if (cls) { + if ((' ' + cls + ' ').indexOf(' ' + className + ' ') < 0) { + el.className = cls + ' ' + className; + } + } else { + el.className = className; + } + } else if (typeof el == 'string') { + if (/\s+class\s*=/.test(el)) { + el = el.replace(/(\s+class=["']?)([^"']*)(["']?[\s>])/, function($0, $1, $2, $3) { + if ((' ' + $2 + ' ').indexOf(' ' + className + ' ') < 0) { + return $2 === '' ? $1 + className + $3 : $1 + $2 + ' ' + className + $3; + } else { + return $0; + } + }); + } else { + el = el.substr(0, el.length - 1) + ' class="' + className + '">'; + } + } + return el; +}; + +KE.removeClass = function(el, className) { + var cls = el.className || ''; + cls = ' ' + cls + ' '; + className = ' ' + className + ' '; + if (cls.indexOf(className) >= 0) { + cls = KE.util.trim(cls.replace(new RegExp(className, 'ig'), '')); + if (cls === '') { + var key = el.getAttribute('class') ? 'class' : 'className'; + el.removeAttribute(key); + } else { + el.className = cls; + } + } + return el; +}; + +KE.getComputedStyle = function(el, key) { + var doc = el.ownerDocument, + win = doc.parentWindow || doc.defaultView, + jsKey = KE.util.getJsKey(key), + val = ''; + if (win.getComputedStyle) { + var style = win.getComputedStyle(el, null); + val = style[jsKey] || style.getPropertyValue(key) || el.style[jsKey]; + } else if (el.currentStyle) { + val = el.currentStyle[jsKey] || el.style[jsKey]; + } + return val; +}; + +KE.getCommonAncestor = function(keSel, tagName) { + var range = keSel.range, + keRange = keSel.keRange, + startNode = keRange.startNode, + endNode = keRange.endNode; + if (KE.util.inArray(tagName, ['table', 'td', 'tr'])) { + if (KE.browser.IE) { + if (range.item) { + if (range.item(0).nodeName.toLowerCase() === tagName) { + startNode = endNode = range.item(0); + } + } else { + var rangeA = range.duplicate(); + rangeA.collapse(true); + var rangeB = range.duplicate(); + rangeB.collapse(false); + startNode = rangeA.parentElement(); + endNode = rangeB.parentElement(); + } + } else { + var rangeA = range.cloneRange(); + rangeA.collapse(true); + var rangeB = range.cloneRange(); + rangeB.collapse(false); + startNode = rangeA.startContainer; + endNode = rangeB.startContainer; + } + } + function find(node) { + while (node) { + if (node.nodeType == 1) { + if (node.tagName.toLowerCase() === tagName) return node; + } + node = node.parentNode; + } + return null; + }; + var start = find(startNode), + end = find(endNode); + if (start && end && start === end) { + return start; + } + return null; +}; + +KE.queryCommandValue = function(doc, cmd) { + cmd = cmd.toLowerCase(); + function commandValue() { + var val = doc.queryCommandValue(cmd); + if (typeof val !== 'string') val = ''; + return val; + } + var val = ''; + if (cmd === 'fontname') { + val = commandValue(); + val = val.replace(/['"]/g, ''); + } else if (cmd === 'formatblock') { + val = commandValue(); + if (val === '') { + var keSel = new KE.selection(doc); + var el = KE.getCommonAncestor(keSel, 'h1'); + if (!el) el = KE.getCommonAncestor(keSel, 'h2'); + if (!el) el = KE.getCommonAncestor(keSel, 'h3'); + if (!el) el = KE.getCommonAncestor(keSel, 'h4'); + if (!el) el = KE.getCommonAncestor(keSel, 'p'); + if (el) val = el.nodeName; + } + if (val === 'Normal') val = 'p'; + } else if (cmd === 'fontsize') { + var keSel = new KE.selection(doc); + var el = KE.getCommonAncestor(keSel, 'span'); + if (el) val = KE.getComputedStyle(el, 'font-size'); + } else if (cmd === 'textcolor') { + var keSel = new KE.selection(doc); + var el = KE.getCommonAncestor(keSel, 'span'); + if (el) val = KE.getComputedStyle(el, 'color'); + val = KE.util.rgbToHex(val); + if (val === '') val = 'default'; + } else if (cmd === 'bgcolor') { + var keSel = new KE.selection(doc); + var el = KE.getCommonAncestor(keSel, 'span'); + if (el) val = KE.getComputedStyle(el, 'background-color'); + val = KE.util.rgbToHex(val); + if (val === '') val = 'default'; + } + return val.toLowerCase(); +}; + +KE.util = { + getDocumentElement : function(doc) { + doc = doc || document; + return (doc.compatMode != "CSS1Compat") ? doc.body : doc.documentElement; + }, + getDocumentHeight : function(doc) { + var el = this.getDocumentElement(doc); + return Math.max(el.scrollHeight, el.clientHeight); + }, + getDocumentWidth : function(doc) { + var el = this.getDocumentElement(doc); + return Math.max(el.scrollWidth, el.clientWidth); + }, + createTable : function(doc) { + var table = KE.$$('table', doc); + table.cellPadding = 0; + table.cellSpacing = 0; + table.border = 0; + return {table: table, cell: table.insertRow(0).insertCell(0)}; + }, + loadStyle : function(path) { + var link = KE.$$('link'); + link.setAttribute('type', 'text/css'); + link.setAttribute('rel', 'stylesheet'); + link.setAttribute('href', path); + document.getElementsByTagName("head")[0].appendChild(link); + }, + getAttrList : function(tag) { + var re = /\s+(?:([\w-:]+)|(?:([\w-:]+)=([\w-:]+))|(?:([\w-:]+)="([^"]*)")|(?:([\w-:]+)='([^']*)'))(?=(?:\s|\/|>)+)/g; + var arr, key, val, list = {}; + while ((arr = re.exec(tag))) { + key = arr[1] || arr[2] || arr[4] || arr[6]; + val = arr[1] || (arr[2] ? arr[3] : (arr[4] ? arr[5] : arr[7])); + list[key] = val; + } + return list; + }, + inArray : function(str, arr) { + for (var i = 0; i < arr.length; i++) {if (str == arr[i]) return true;} + return false; + }, + trim : function(str) { + return str.replace(/^\s+|\s+$/g, ""); + }, + getJsKey : function(key) { + var arr = key.split('-'); + key = ''; + for (var i = 0, len = arr.length; i < len; i++) { + key += (i > 0) ? arr[i].charAt(0).toUpperCase() + arr[i].substr(1) : arr[i]; + } + return key; + }, + arrayToHash : function(arr) { + var hash = {}; + for (var i = 0, len = arr.length; i < len; i++) hash[arr[i]] = 1; + return hash; + }, + escape : function(str) { + str = str.replace(/&/g, '&'); + str = str.replace(//g, '>'); + str = str.replace(/"/g, '"'); + return str; + }, + unescape : function(str) { + str = str.replace(/</g, '<'); + str = str.replace(/>/g, '>'); + str = str.replace(/"/g, '"'); + str = str.replace(/&/g, '&'); + return str; + }, + getScrollPos : function() { + var x, y; + if (KE.browser.IE || KE.browser.OPERA) { + var el = this.getDocumentElement(); + x = el.scrollLeft; + y = el.scrollTop; + } else { + x = window.scrollX; + y = window.scrollY; + } + return {x : x, y : y}; + }, + getElementPos : function(el) { + var x = 0, y = 0; + if (el.getBoundingClientRect) { + var box = el.getBoundingClientRect(); + var pos = this.getScrollPos(); + x = box.left + pos.x; + y = box.top + pos.y; + } else { + x = el.offsetLeft; + y = el.offsetTop; + var parent = el.offsetParent; + while (parent) { + x += parent.offsetLeft; + y += parent.offsetTop; + parent = parent.offsetParent; + } + } + return {x : x, y : y}; + }, + getCoords : function(ev) { + ev = ev || window.event; + return { + x : ev.clientX, + y : ev.clientY + }; + }, + setOpacity : function(el, opacity) { + if (typeof el.style.opacity == "undefined") { + el.style.filter = (opacity == 100) ? "" : "alpha(opacity=" + opacity + ")"; + } else { + el.style.opacity = (opacity == 100) ? "" : "0." + opacity.toString(); + } + }, + getIframeDoc : function(iframe) { + return iframe.contentDocument || iframe.contentWindow.document; + }, + rgbToHex : function(str) { + function hex(s) { + s = parseInt(s).toString(16); + return s.length > 1 ? s : '0' + s; + }; + return str.replace(/rgb\s*?\(\s*?(\d+)\s*?,\s*?(\d+)\s*?,\s*?(\d+)\s*?\)/ig, + function($0, $1, $2, $3) { + return '#' + hex($1) + hex($2) + hex($3); + } + ); + }, + parseJson : function (text) { + var cx = /[\u0000\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g; + cx.lastIndex = 0; + if (cx.test(text)) { + text = text.replace(cx, function (a) { + return '\\u' + ('0000' + a.charCodeAt(0).toString(16)).slice(-4); + }); + } + if (/^[\],:{}\s]*$/. + test(text.replace(/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g, '@'). + replace(/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g, ']'). + replace(/(?:^|:|,)(?:\s*\[)+/g, ''))) { + return eval('(' + text + ')'); + } + throw 'JSON parse error'; + }, + createRange : function(doc) { + return doc.createRange ? doc.createRange() : doc.body.createTextRange(); + }, + getNodeType : function(node) { + return (node.nodeType == 1 && KE.util.inArray(node.tagName.toLowerCase(), KE.setting.noEndTags)) ? 88 : node.nodeType; + }, + inMarquee : function(node) { + var n = node; + while (n) { + if (n.nodeName.toLowerCase() === 'marquee') return true; + n = n.parentNode; + } + return false; + }, + moveToElementText : function (range, el) { + if (!this.inMarquee(el)) range.moveToElementText(el); + }, + getNodeTextLength : function(node) { + var type = KE.util.getNodeType(node); + if (type == 1) { + var html = node.innerHTML; + return html.replace(/<.*?>/ig, "").length; + } else if (type == 3) { + return node.nodeValue.length; + } + }, + getNodeStartRange : function(doc, node) { + var range = KE.util.createRange(doc); + var type = node.nodeType; + if (type == 1) { + KE.util.moveToElementText(range, node); + return range; + } else if (type == 3) { + var offset = 0; + var sibling = node.previousSibling; + while (sibling) { + if (sibling.nodeType == 1) { + var nodeRange = KE.util.createRange(doc); + KE.util.moveToElementText(nodeRange, sibling); + range.setEndPoint('StartToEnd', nodeRange); + range.moveStart('character', offset); + return range; + } else if (sibling.nodeType == 3) { + offset += sibling.nodeValue.length; + } + sibling = sibling.previousSibling; + } + KE.util.moveToElementText(range, node.parentNode); + range.moveStart('character', offset); + return range; + } + }, + removeParent : function(parent) { + if (parent.hasChildNodes) { + var node = parent.firstChild; + while (node) { + var nextNode = node.nextSibling; + parent.parentNode.insertBefore(node, parent); + node = nextNode; + } + } + parent.parentNode.removeChild(parent); + }, + pluginLang : function(pluginName, doc) { + KE.each(KE.lang.plugins[pluginName], function (key, val) { + var span = KE.$('lang.' + key, doc); + if (span) { + span.parentNode.insertBefore(doc.createTextNode(val), span); + span.parentNode.removeChild(span); + } + }); + }, + drag : function(id, mousedownObj, moveObj, func) { + var g = KE.g[id]; + mousedownObj.onmousedown = function(e) { + var self = this; + e = e || window.event; + var pos = KE.util.getCoords(e); + var objTop = parseInt(moveObj.style.top); + var objLeft = parseInt(moveObj.style.left); + var objWidth = moveObj.style.width; + var objHeight = moveObj.style.height; + if (objWidth.match(/%$/)) objWidth = moveObj.offsetWidth + 'px'; + if (objHeight.match(/%$/)) objHeight = moveObj.offsetHeight + 'px'; + objWidth = parseInt(objWidth); + objHeight = parseInt(objHeight); + var mouseTop = pos.y; + var mouseLeft = pos.x; + var scrollPos = KE.util.getScrollPos(); + var scrollTop = scrollPos.y; + var scrollLeft = scrollPos.x; + var dragFlag = true; + function moveListener(e) { + if (dragFlag) { + var pos = KE.util.getCoords(e); + var scrollPos = KE.util.getScrollPos(); + var top = parseInt(pos.y - mouseTop - scrollTop + scrollPos.y); + var left = parseInt(pos.x - mouseLeft - scrollLeft + scrollPos.x); + func(objTop, objLeft, objWidth, objHeight, top, left); + } + } + var iframePos = KE.util.getElementPos(g.iframe); + function iframeMoveListener(e) { + if (dragFlag) { + var pos = KE.util.getCoords(e, g.iframeDoc); + var top = parseInt(iframePos.y + pos.y - mouseTop - scrollTop); + var left = parseInt(iframePos.x + pos.x - mouseLeft - scrollLeft); + func(objTop, objLeft, objWidth, objHeight, top, left); + } + } + var selectListener = function() { return false; }; + function upListener(e) { + dragFlag = false; + if (self.releaseCapture) self.releaseCapture(); + KE.event.remove(document, 'mousemove', moveListener); + KE.event.remove(document, 'mouseup', upListener); + KE.event.remove(g.iframeDoc, 'mousemove', iframeMoveListener); + KE.event.remove(g.iframeDoc, 'mouseup', upListener); + KE.event.remove(document, 'selectstart', selectListener); + KE.event.stop(e); + return false; + } + KE.event.add(document, 'mousemove', moveListener); + KE.event.add(document, 'mouseup', upListener); + KE.event.add(g.iframeDoc, 'mousemove', iframeMoveListener); + KE.event.add(g.iframeDoc, 'mouseup', upListener); + KE.event.add(document, 'selectstart', selectListener); + if (self.setCapture) self.setCapture(); + KE.event.stop(e); + return false; + }; + }, + resize : function(id, width, height, isCheck, isResizeWidth) { + isResizeWidth = (typeof isResizeWidth == "undefined") ? true : isResizeWidth; + var g = KE.g[id]; + if (!g.container) return; + if (isCheck && (parseInt(width) <= g.minWidth || parseInt(height) <= g.minHeight)) return; + if (isResizeWidth) g.container.style.width = width; + g.container.style.height = height; + var diff = parseInt(height) - g.toolbarHeight - g.statusbarHeight; + if (diff >= 0) { + g.iframe.style.height = diff + 'px'; + g.newTextarea.style.height = (((KE.browser.IE && KE.browser.VERSION < 8) || document.compatMode != 'CSS1Compat') ? diff - 2 : diff) + 'px'; + } + }, + hideLoadingPage : function(id) { + var stack = KE.g[id].dialogStack; + var dialog = stack[stack.length - 1]; + dialog.loading.style.display = 'none'; + dialog.iframe.style.display = ''; + }, + showLoadingPage : function(id) { + var stack = KE.g[id].dialogStack; + var dialog = stack[stack.length - 1]; + dialog.loading.style.display = ''; + dialog.iframe.style.display = 'none'; + }, + setDefaultPlugin : function(id) { + var items = [ + 'selectall', 'justifyleft', 'justifycenter', 'justifyright', 'justifyfull', + 'insertorderedlist', 'insertunorderedlist', 'indent', 'outdent', 'subscript', + 'superscript', 'bold', 'italic', 'underline', 'strikethrough' + ]; + var shortcuts = { + bold : 'B', + italic : 'I', + underline : 'U' + }; + for (var i = 0; i < items.length; i++) { + var item = items[i], + plugin = {}; + if (item in shortcuts) { + plugin.init = (function(item) { + return function(id) { + KE.event.ctrl(KE.g[id].iframeDoc, shortcuts[item], function(e) { + KE.plugin[item].click(id); + KE.util.focus(id); + }, id); + }; + })(item); + } + plugin.click = (function(item) { + return function(id) { + KE.util.execCommand(id, item, null); + }; + })(item); + KE.plugin[item] = plugin; + } + }, + getFullHtml : function(id) { + var html = ''; + html += ''; + html += ''; + html += 'KindEditor'; + html += ''; + var cssPath = KE.g[id].cssPath; + if (typeof cssPath == 'string') cssPath = [cssPath]; + for (var i = 0, len = cssPath.length; i < len; i++) { + if (cssPath[i] !== '') html += ''; + } + html += ''; + html += ''; + html += ''; + return html; + }, + getMediaType : function(src) { + if (src.match(/\.(rm|rmvb)(\?|$)/i)) return 'rm'; + else if (src.match(/\.(swf|flv)(\?|$)/i)) return 'flash'; + else return 'media'; + }, + getMediaImage : function(id, type, attrs) { + var width = attrs.width; + var height = attrs.height; + type = type || this.getMediaType(attrs.src); + var srcTag = this.getMediaEmbed(attrs); + var style = ''; + if (width > 0) style += 'width:' + width + 'px;'; + if (height > 0) style += 'height:' + height + 'px;'; + var className = 'ke-' + type; + var html = ''; + return html; + }, + getMediaEmbed : function(attrs) { + var html = ']*>\s*$/ig, ''); + html = html.replace(/^\s*

\s* \s*<\/p>\s*$/ig, ''); + if (g.filterMode) { + return KE.format.getHtml(html, g.htmlTags, g.urlType); + } else { + return KE.format.getHtml(html, null, g.urlType); + } + }, + getData : function(id, wyswygMode) { + var g = KE.g[id]; + wyswygMode = (wyswygMode === undefined) ? g.wyswygMode : wyswygMode; + if (!wyswygMode) { + this.innerHtml(g.iframeDoc.body, KE.util.execSetHtmlHooks(id, g.newTextarea.value)); + } + return this.toData(id, g.iframeDoc.body.innerHTML); + }, + getSrcData : function(id) { + var g = KE.g[id]; + if (!g.wyswygMode) { + this.innerHtml(g.iframeDoc.body, KE.util.execSetHtmlHooks(id, g.newTextarea.value)); + } + return g.iframeDoc.body.innerHTML; + }, + getPureData : function(id) { + return this.extractText(this.getData(id)); + }, + extractText : function(str) { + str = str.replace(/<(?!img|embed).*?>/ig, ''); + str = str.replace(/ /ig, ' '); + return str; + }, + isEmpty : function(id) { + return this.getPureData(id).replace(/\r\n|\n|\r/, '').replace(/^\s+|\s+$/, '') === ''; + }, + setData : function(id) { + var g = KE.g[id]; + if (g.srcTextarea) g.srcTextarea.value = this.getData(id); + }, + focus : function(id) { + var g = KE.g[id]; + if (g.wyswygMode) { + g.iframeWin.focus(); + } else { + g.newTextarea.focus(); + } + }, + click : function(id, cmd) { + this.focus(id); + KE.hideMenu(id); + KE.plugin[cmd].click(id); + }, + selection : function(id) { + if (!KE.browser.IE || !KE.g[id].keRange) { + this.setSelection(id); + } + }, + setSelection : function(id) { + var g = KE.g[id]; + var keSel = new KE.selection(g.iframeDoc); + if (!KE.browser.IE || keSel.range.item || keSel.range.parentElement().ownerDocument === g.iframeDoc) { + g.keSel = keSel; + g.keRange = g.keSel.keRange; + g.sel = g.keSel.sel; + g.range = g.keSel.range; + } + }, + select : function(id) { + if (KE.browser.IE && KE.g[id].wyswygMode && KE.g[id].range) KE.g[id].range.select(); + }, + execCommand : function(id, cmd, value) { + KE.util.focus(id); + KE.util.select(id); + try { + KE.g[id].iframeDoc.execCommand(cmd, false, value); + } catch(e) {} + KE.toolbar.updateState(id); + KE.util.execOnchangeHandler(id); + }, + innerHtml : function(el, html) { + if (KE.browser.IE) { + el.innerHTML = '' + html; + var temp = KE.$('__ke_temp_tag__', el.ownerDocument); + if (temp) temp.parentNode.removeChild(temp); + } else { + el.innerHTML = html; + } + }, + pasteHtml : function(id, html, isStart) { + var g = KE.g[id]; + var imgStr = ''; + if (isStart) html = imgStr + html; + else html += imgStr; + if (KE.browser.IE) { + if (g.range.item) g.range.item(0).outerHTML = html; + else g.range.pasteHTML(html); + } else { + g.range.deleteContents(); + var frag = g.range.createContextualFragment(html); + g.range.insertNode(frag); + } + var node = KE.$('__ke_temp_tag__', g.iframeDoc); + var blank = g.iframeDoc.createTextNode(''); + node.parentNode.replaceChild(blank, node); + g.keRange.selectNode(blank); + g.keSel.addRange(g.keRange); + }, + insertHtml : function(id, html) { + if (html === '') return; + var g = KE.g[id]; + if (!g.wyswygMode) return; + if (!g.range) return; + html = this.execSetHtmlHooks(id, html); + if (KE.browser.IE) { + this.select(id); + if (g.range.item) { + try { + g.range.item(0).outerHTML = html; + } catch(e) { + var el = g.range.item(0); + var parent = el.parentNode; + parent.removeChild(el); + if (parent.nodeName.toLowerCase() != 'body') parent = parent.parentNode; + this.innerHtml(parent, html + parent.innerHTML); + } + } else { + g.range.pasteHTML(html); + } + } else if (KE.browser.GECKO && KE.browser.VERSION < 3) { + this.execCommand(id, 'inserthtml', html); + return; + } else { + this.pasteHtml(id, html); + } + KE.util.execOnchangeHandler(id); + }, + setFullHtml : function(id, html) { + var g = KE.g[id]; + if (!KE.browser.IE && html === '') html = '
'; + var html = KE.util.execSetHtmlHooks(id, html); + this.innerHtml(g.iframeDoc.body, html); + if (!g.wyswygMode) g.newTextarea.value = KE.util.getData(id, true); + KE.util.execOnchangeHandler(id); + }, + selectImageWebkit : function(id, e, isSelection) { + if (KE.browser.WEBKIT) { + var target = e.srcElement || e.target; + if (target.tagName.toLowerCase() == 'img') { + if (isSelection) KE.util.selection(id); + var range = KE.g[id].keRange; + range.selectNode(target); + KE.g[id].keSel.addRange(range); + } + } + }, + addTabEvent : function(id) { + KE.event.add(KE.g[id].iframeDoc, 'keydown', function(e) { + if (e.keyCode == 9) { + KE.util.setSelection(id); + KE.util.insertHtml(id, '    '); + KE.event.stop(e); + return false; + } + }, id); + }, + addContextmenuEvent : function(id) { + var g = KE.g[id]; + if (g.contextmenuItems.length == 0) return; + KE.event.add(g.iframeDoc, 'contextmenu', function(e){ + KE.hideMenu(id); + KE.util.setSelection(id); + KE.util.selectImageWebkit(id, e, false); + var maxWidth = 0; + var items = []; + for (var i = 0, len = g.contextmenuItems.length; i < len; i++) { + var item = g.contextmenuItems[i]; + if (item === '-') { + items.push(item); + } else if (item.cond && item.cond(id)) { + items.push(item); + if (item.options) { + var width = parseInt(item.options.width) || 0; + if (width > maxWidth) maxWidth = width; + } + } + prevItem = item; + } + while (items.length > 0 && items[0] === '-') { + items.shift(); + } + while (items.length > 0 && items[items.length - 1] === '-') { + items.pop(); + } + var prevItem = null; + for (var i = 0, len = items.length; i < len; i++) { + if (items[i] === '-' && prevItem === '-') delete items[i]; + prevItem = items[i] || null; + } + if (items.length > 0) { + var menu = new KE.menu({ + id : id, + event : e, + type : 'contextmenu', + width : maxWidth + }); + for (var i = 0, len = items.length; i < len; i++) { + var item = items[i]; + if (!item) continue; + if (item === '-') { + if (i < len - 1) menu.addSeparator(); + } else { + menu.add(item.text, (function(item) { + return function() { + item.click(id, menu); + }; + })(item), item.options); + } + } + menu.show(); + KE.event.stop(e); + return false; + } + return true; + }, id); + }, + addNewlineEvent : function(id) { + var g = KE.g[id]; + if (KE.browser.IE && g.newlineTag.toLowerCase() != 'br') return; + if (KE.browser.GECKO && KE.browser.VERSION < 3 && g.newlineTag.toLowerCase() != 'p') return; + if (KE.browser.OPERA) return; + KE.event.add(g.iframeDoc, 'keydown', function(e) { + if (e.keyCode != 13 || e.shiftKey || e.ctrlKey || e.altKey) return true; + KE.util.setSelection(id); + var parent = g.keRange.getParentElement(); + if (KE.util.inMarquee(parent)) return; + var tagName = parent.tagName.toLowerCase(); + if (g.newlineTag.toLowerCase() == 'br') { + if (!KE.util.inArray(tagName, ['h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'li'])) { + KE.util.pasteHtml(id, '
'); + var nextNode = g.keRange.startNode.nextSibling; + if (KE.browser.IE) { + if (!nextNode) KE.util.pasteHtml(id, '
', true); + } else if (KE.browser.WEBKIT) { + if (!nextNode) { + KE.util.pasteHtml(id, '
', true); + } else { + var range = new KE.range(g.iframeDoc); + range.selectNode(nextNode.parentNode); + range.setStart(nextNode, 0); + if (range.cloneContents().innerHTML.replace(/<(?!img|embed).*?>/ig, '') === '') { + KE.util.pasteHtml(id, '
', true); + } + } + } + KE.event.stop(e); + return false; + } + } else { + if (!KE.util.inArray(tagName, ['p', 'h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'pre', 'div', 'li'])) { + KE.util.execCommand(id, 'formatblock', '

'); + } + } + return true; + }, id); + } +}; + +KE.layout = { + hide : function(id) { + var g = KE.g[id]; + KE.hideMenu(id); + var stack = g.dialogStack; + while (stack.length > 0) { + var dialog = stack[stack.length - 1]; + dialog.hide(); + } + g.maskDiv.style.display = 'none'; + } +}; + +KE.hideMenu = function(id) { + var g = KE.g[id]; + g.hideDiv.innerHTML = ''; + g.hideDiv.style.display = 'none'; +}; + +KE.colorpicker = function(arg) { + var wrapper; + var x = arg.x || 0; + var y = arg.y || 0; + var z = arg.z || 0; + var colors = arg.colors || KE.setting.colorTable; + var doc = arg.doc || document; + var onclick = arg.onclick; + var selectedColor = (arg.selectedColor || '').toLowerCase(); + function init() { + wrapper = KE.$$('div'); + wrapper.className = 'ke-colorpicker'; + wrapper.style.top = y + 'px'; + wrapper.style.left = x + 'px'; + wrapper.style.zIndex = z; + } + init.call(this); + this.remove = function() { + doc.body.removeChild(wrapper); + }; + this.getElement = function() { + function addAttr(cell, color, cls) { + if (selectedColor === color.toLowerCase()) cls += ' ke-colorpicker-cell-selected'; + cell.className = cls; + cell.title = color || KE.lang['noColor']; + cell.onmouseover = function() { this.className = cls + ' ke-colorpicker-cell-on'; }; + cell.onmouseout = function() { this.className = cls; }; + cell.onclick = function() { onclick(color); }; + if (color) { + var div = KE.$$('div'); + div.className = 'ke-colorpicker-cell-color'; + div.style.backgroundColor = color; + cell.appendChild(div); + } else { + cell.innerHTML = KE.lang['noColor']; + } + } + var table = KE.$$('table'); + table.className = 'ke-colorpicker-table'; + table.cellPadding = 0; + table.cellSpacing = 0; + table.border = 0; + var row = table.insertRow(0), + cell = row.insertCell(0); + cell.colSpan = colors[0].length; + addAttr(cell, '', 'ke-colorpicker-cell-top'); + for (var i = 0; i < colors.length; i++) { + var row = table.insertRow(i + 1); + for (var j = 0; j < colors[i].length; j++) { + var color = colors[i][j], + cell = row.insertCell(j); + addAttr(cell, color, 'ke-colorpicker-cell'); + } + + } + return table; + }; + this.create = function() { + wrapper.appendChild(this.getElement()); + KE.event.bind(wrapper, 'click', function(e){}); + KE.event.bind(wrapper, 'mousedown', function(e){}); + doc.body.appendChild(wrapper); + }; +}; + +KE.menu = function(arg){ + function getPos(width, height) { + var id = arg.id; + var x = 0; + var y = 0; + if (this.type == 'menu') { + var obj = KE.g[id].toolbarIcon[arg.cmd]; + var pos = KE.util.getElementPos(obj[0]); + x = pos.x; + y = pos.y + obj[0].offsetHeight; + } else { + var pos = KE.util.getCoords(arg.event); + var iframePos = KE.util.getElementPos(KE.g[id].iframe); + x = pos.x + iframePos.x; + y = pos.y + iframePos.y + 5; + } + if (width > 0 || height > 0) { + var scrollPos = KE.util.getScrollPos(); + var docEl = KE.util.getDocumentElement(); + var maxLeft = scrollPos.x + docEl.clientWidth - width - 2; + if (x > maxLeft) x = maxLeft; + } + return {x : x, y : y}; + }; + function init() { + var width = arg.width; + this.type = (arg.type && arg.type == 'contextmenu') ? arg.type : 'menu'; + var div = KE.$$('div'); + div.className = 'ke-' + this.type; + div.setAttribute('name', arg.cmd); + var pos = getPos.call(this, 0, 0); + div.style.top = pos.y + 'px'; + div.style.left = pos.x + 'px'; + if (arg.width) div.style.width = (/^\d+$/.test(width)) ? width + 'px' : width; + KE.event.bind(div, 'click', function(e){}, arg.id); + KE.event.bind(div, 'mousedown', function(e){}, arg.id); + this.div = div; + }; + init.call(this); + this.add = function(html, event, options) { + var height, iconHtml, checked = false; + if (options !== undefined) { + height = options.height; + iconHtml = options.iconHtml; + checked = options.checked; + } + var self = this; + var cDiv = KE.$$('div'); + cDiv.className = 'ke-' + self.type + '-item'; + if (height) cDiv.style.height = height; + var left = KE.$$('div'); + left.className = 'ke-' + this.type + '-left'; + var center = KE.$$('div'); + center.className = 'ke-' + self.type + '-center'; + if (height) center.style.height = height; + var right = KE.$$('div'); + right.className = 'ke-' + this.type + '-right'; + if (height) right.style.lineHeight = height; + cDiv.onmouseover = function() { + this.className = 'ke-' + self.type + '-item ke-' + self.type + '-item-on'; + center.className = 'ke-' + self.type + '-center ke-' + self.type + '-center-on'; + }; + cDiv.onmouseout = function() { + this.className = 'ke-' + self.type + '-item'; + center.className = 'ke-' + self.type + '-center'; + }; + cDiv.onclick = event; + cDiv.appendChild(left); + cDiv.appendChild(center); + cDiv.appendChild(right); + if (checked) { + KE.util.innerHtml(left, ''); + } else { + if (iconHtml) KE.util.innerHtml(left, iconHtml); + } + KE.util.innerHtml(right, html); + this.append(cDiv); + }; + this.addSeparator = function() { + var div = KE.$$('div'); + div.className = 'ke-' + this.type + '-separator'; + this.append(div); + }; + this.append = function(el) { + this.div.appendChild(el); + }; + this.insert = function(html) { + KE.util.innerHtml(this.div, html); + }; + this.hide = function() { + KE.hideMenu(arg.id); + }; + this.show = function() { + this.hide(); + var id = arg.id; + KE.g[id].hideDiv.style.display = ''; + KE.g[id].hideDiv.appendChild(this.div); + var pos = getPos.call(this, this.div.clientWidth, this.div.clientHeight); + this.div.style.top = pos.y + 'px'; + this.div.style.left = pos.x + 'px'; + }; + this.picker = function(color) { + var colorTable = KE.g[arg.id].colorTable; + var picker = new KE.colorpicker({ + colors : colorTable, + onclick : function(color) { KE.plugin[arg.cmd].exec(arg.id, color); }, + selectedColor : color + }); + this.append(picker.getElement()); + this.show(); + }; +}; + +KE.dialog = function(arg){ + var self = this; + this.widthMargin = 30; + this.heightMargin = 100; + this.zIndex = 19811214; + this.width = arg.width; + this.height = arg.height; + var minTop, minLeft; + function setLimitNumber() { + var docEl = KE.util.getDocumentElement(); + var pos = KE.util.getScrollPos(); + minTop = pos.y; + minLeft = pos.x; + } + function init() { + this.beforeHide = arg.beforeHide; + this.afterHide = arg.afterHide; + this.beforeShow = arg.beforeShow; + this.afterShow = arg.afterShow; + this.ondrag = arg.ondrag; + } + init.call(this); + function getPos() { + var width = this.width + this.widthMargin; + var height = this.height + this.heightMargin; + var id = arg.id; + var g = KE.g[id]; + var x = 0, y = 0; + if (g.dialogAlignType == 'page') { + var el = KE.util.getDocumentElement(); + var scrollPos = KE.util.getScrollPos(); + x = Math.round(scrollPos.x + (el.clientWidth - width) / 2); + y = Math.round(scrollPos.y + (el.clientHeight - height) / 2); + } else { + var pos = KE.util.getElementPos(KE.g[id].container); + var el = g.container; + var xDiff = Math.round(el.clientWidth / 2) - Math.round(width / 2); + var yDiff = Math.round(el.clientHeight / 2) - Math.round(height / 2); + x = xDiff < 0 ? pos.x : pos.x + xDiff; + y = yDiff < 0 ? pos.y : pos.y + yDiff; + } + x = x < 0 ? 0 : x; + y = y < 0 ? 0 : y; + return {x : x, y : y}; + }; + this.resize = function(width, height) { + if (width) this.width = width; + if (height) this.height = height; + this.hide(); + this.show(); + }; + this.hide = function() { + if (this.beforeHide) this.beforeHide(id); + var id = arg.id; + var stack = KE.g[id].dialogStack; + if (stack[stack.length - 1] != this) return; + var dialog = stack.pop(); + var iframe = dialog.iframe; + iframe.src = 'javascript:false'; + iframe.parentNode.removeChild(iframe); + document.body.removeChild(this.div); + if (stack.length < 1) { + KE.g[id].maskDiv.style.display = 'none'; + } + KE.event.remove(window, 'resize', setLimitNumber); + KE.event.remove(window, 'scroll', setLimitNumber); + if (this.afterHide) this.afterHide(id); + KE.util.focus(id); + }; + this.show = function() { + if (this.beforeShow) this.beforeShow(id); + var self = this; + var id = arg.id; + var div = KE.$$('div'); + div.className = 'ke-dialog'; + KE.event.bind(div, 'click', function(e){}, id); + KE.event.bind(div, 'mousedown', function(e){}, id); + var stack = KE.g[id].dialogStack; + if (stack.length > 0) { + this.zIndex = stack[stack.length - 1].zIndex + 1; + } + div.style.zIndex = this.zIndex; + var pos = getPos.call(this); + div.style.top = pos.y + 'px'; + div.style.left = pos.x + 'px'; + var contentCell; + if (KE.g[id].shadowMode) { + var table = KE.$$('table'); + table.className = 'ke-dialog-table'; + table.cellPadding = 0; + table.cellSpacing = 0; + table.border = 0; + var rowNames = ['t', 'm', 'b']; + var colNames = ['l', 'c', 'r']; + for (var i = 0, len = 3; i < len; i++) { + var row = table.insertRow(i); + for (var j = 0, l = 3; j < l; j++) { + var cell = row.insertCell(j); + cell.className = 'ke-' + rowNames[i] + colNames[j]; + if (i == 1 && j == 1) contentCell = cell; + else cell.innerHTML = ''; + } + } + div.appendChild(table); + } else { + KE.addClass(div, 'ke-dialog-no-shadow'); + contentCell = div; + } + var titleDiv = KE.$$('div'); + titleDiv.className = 'ke-dialog-title'; + titleDiv.innerHTML = arg.title; + var span = KE.$$('span'); + span.className = 'ke-dialog-close'; + if (KE.g[id].shadowMode) KE.addClass(span, 'ke-dialog-close-shadow'); + else KE.addClass(span, 'ke-dialog-close-no-shadow'); + span.alt = KE.lang['close']; + span.title = KE.lang['close']; + span.onclick = function () { + self.hide(); + KE.util.select(id); + }; + titleDiv.appendChild(span); + setLimitNumber(); + KE.event.add(window, 'resize', setLimitNumber); + KE.event.add(window, 'scroll', setLimitNumber); + KE.util.drag(id, titleDiv, div, function(objTop, objLeft, objWidth, objHeight, top, left) { + if (self.ondrag) self.ondrag(id); + setLimitNumber(); + top = objTop + top; + left = objLeft + left; + if (top < minTop) top = minTop; + if (left < minLeft) left = minLeft; + div.style.top = top + 'px'; + div.style.left = left + 'px'; + }); + contentCell.appendChild(titleDiv); + var bodyDiv = KE.$$('div'); + bodyDiv.className = 'ke-dialog-body'; + var loadingTable = KE.util.createTable(); + loadingTable.table.className = 'ke-loading-table'; + loadingTable.table.style.width = this.width + 'px'; + loadingTable.table.style.height = this.height + 'px'; + var loadingImg = KE.$$('span'); + loadingImg.className = 'ke-loading-img'; + loadingTable.cell.appendChild(loadingImg); + var iframe = (KE.g[id].dialogStack.length == 0 && KE.g[id].dialog) ? KE.g[id].dialog : KE.$$('iframe'); + if (arg.useFrameCSS) { + iframe.className = 'ke-dialog-iframe ke-dialog-iframe-border'; + } else { + iframe.className = 'ke-dialog-iframe'; + } + iframe.setAttribute("frameBorder", "0"); + iframe.style.width = this.width + 'px'; + iframe.style.height = this.height + 'px'; + iframe.style.display = 'none'; + bodyDiv.appendChild(iframe); + bodyDiv.appendChild(loadingTable.table); + contentCell.appendChild(bodyDiv); + + var bottomDiv = KE.$$('div'); + bottomDiv.className = 'ke-dialog-bottom'; + var noButton = null; + var yesButton = null; + var previewButton = null; + if (arg.previewButton) { + previewButton = KE.$$('input'); + previewButton.className = 'ke-button ke-dialog-preview'; + previewButton.type = 'button'; + previewButton.name = 'previewButton'; + previewButton.value = arg.previewButton; + previewButton.onclick = function() { + var stack = KE.g[id].dialogStack; + if (stack[stack.length - 1] == self) { + KE.plugin[arg.cmd].preview(id); + } + }; + bottomDiv.appendChild(previewButton); + } + if (arg.yesButton) { + yesButton = KE.$$('input'); + yesButton.className = 'ke-button ke-dialog-yes'; + yesButton.type = 'button'; + yesButton.name = 'yesButton'; + yesButton.value = arg.yesButton; + yesButton.onclick = function() { + var stack = KE.g[id].dialogStack; + if (stack[stack.length - 1] == self) { + KE.plugin[arg.cmd].exec(id); + } + }; + bottomDiv.appendChild(yesButton); + } + if (arg.noButton) { + noButton = KE.$$('input'); + noButton.className = 'ke-button ke-dialog-no'; + noButton.type = 'button'; + noButton.name = 'noButton'; + noButton.value = arg.noButton; + noButton.onclick = function () { + self.hide(); + KE.util.select(id); + }; + bottomDiv.appendChild(noButton); + } + if (arg.yesButton || arg.noButton || arg.previewButton) { + contentCell.appendChild(bottomDiv); + } + document.body.appendChild(div); + window.focus(); + if (yesButton) yesButton.focus(); + else if (noButton) noButton.focus(); + if (arg.html !== undefined) { + var dialogDoc = KE.util.getIframeDoc(iframe); + var html = KE.util.getFullHtml(id); + dialogDoc.open(); + dialogDoc.write(html); + dialogDoc.close(); + KE.util.innerHtml(dialogDoc.body, arg.html); + } else if (arg.url !== undefined) { + iframe.src = arg.url; + } else { + var param = 'id=' + escape(id) + '&ver=' + escape(KE.version); + if (arg.file === undefined) { + iframe.src = KE.g[id].pluginsPath + arg.cmd + '.html?' + param; + } else { + param = (/\?/.test(arg.file) ? '&' : '?') + param; + iframe.src = KE.g[id].pluginsPath + arg.file + param; + } + } + KE.g[id].maskDiv.style.width = KE.util.getDocumentWidth() + 'px'; + KE.g[id].maskDiv.style.height = KE.util.getDocumentHeight() + 'px'; + KE.g[id].maskDiv.style.display = 'block'; + this.iframe = iframe; + this.loading = loadingTable.table; + this.noButton = noButton; + this.yesButton = yesButton; + this.previewButton = previewButton; + this.div = div; + KE.g[id].dialogStack.push(this); + KE.g[id].dialog = iframe; + KE.g[id].yesButton = yesButton; + KE.g[id].noButton = noButton; + KE.g[id].previewButton = previewButton; + if (!arg.loadingMode) KE.util.hideLoadingPage(id); + if (this.afterShow) this.afterShow(id); + if (KE.g[id].afterDialogCreate) KE.g[id].afterDialogCreate(id); + }; +}; + +KE.toolbar = { + updateState : function(id) { + var cmdList = [ + 'justifyleft', 'justifycenter', 'justifyright', + 'justifyfull', 'insertorderedlist', 'insertunorderedlist', 'indent', 'outdent', 'subscript','superscript', + 'bold', 'italic', 'underline', 'strikethrough' + ]; + for (var i = 0; i < cmdList.length; i++) { + var cmd = cmdList[i]; + var state = false; + try { + state = KE.g[id].iframeDoc.queryCommandState(cmd); + } catch(e) {} + if (state) { + KE.toolbar.select(id, cmd); + } else { + KE.toolbar.unselect(id, cmd); + } + } + }, + isSelected : function(id, cmd) { + if (KE.plugin[cmd] && KE.plugin[cmd].isSelected) return true; + else return false; + }, + select : function(id, cmd) { + if (KE.g[id].toolbarIcon[cmd]) { + var a = KE.g[id].toolbarIcon[cmd][0]; + a.className = 'ke-icon ke-icon-selected'; + a.onmouseover = null; + a.onmouseout = null; + } + }, + unselect : function(id, cmd) { + if (KE.g[id].toolbarIcon[cmd]) { + var a = KE.g[id].toolbarIcon[cmd][0]; + a.className = 'ke-icon'; + a.onmouseover = function(){ this.className = 'ke-icon ke-icon-on'; }; + a.onmouseout = function(){ this.className = 'ke-icon'; }; + } + }, + _setAttr : function(id, a, cmd) { + a.className = 'ke-icon'; + a.href = 'javascript:;'; + a.onclick = function(e) { + e = e || window.event; + var div = KE.g[id].hideDiv.firstChild; + if (div && div.getAttribute('name') == cmd) { + KE.hideMenu(id); + } else { + KE.util.click(id, cmd); + } + if (e.preventDefault) e.preventDefault(); + if (e.stopPropagation) e.stopPropagation(); + if (e.cancelBubble !== undefined) e.cancelBubble = true; + return false; + }; + a.onmouseover = function(){ this.className = 'ke-icon ke-icon-on'; }; + a.onmouseout = function(){ this.className = 'ke-icon'; }; + a.hidefocus = true; + a.title = KE.lang[cmd]; + }, + able : function(id, arr) { + var self = this; + KE.each(KE.g[id].toolbarIcon, function(cmd, obj) { + if (!KE.util.inArray(cmd, arr)) { + var a = obj[0]; + var span = obj[1]; + self._setAttr(id, a, cmd); + KE.util.setOpacity(span, 100); + } + }); + }, + disable : function(id, arr) { + KE.each(KE.g[id].toolbarIcon, function(cmd, obj) { + if (!KE.util.inArray(cmd, arr)) { + var a = obj[0]; + var span = obj[1]; + a.className = 'ke-icon ke-icon-disabled'; + KE.util.setOpacity(span, 50); + a.onclick = null; + a.onmouseover = null; + a.onmouseout = null; + } + }); + }, + create : function(id) { + var self = this; + var defaultItemHash = KE.util.arrayToHash(KE.setting.items); + KE.g[id].toolbarIcon = []; + var tableObj = KE.util.createTable(); + var toolbar = tableObj.table; + toolbar.className = 'ke-toolbar'; + toolbar.oncontextmenu = function() { return false; }; + toolbar.onmousedown = function() { return false; }; + toolbar.onmousemove = function() { return false; }; + var toolbarCell = tableObj.cell; + var length = KE.g[id].items.length; + var cellNum = 0; + var row; + KE.g[id].toolbarHeight = KE.g[id].toolbarLineHeight; + for (var i = 0; i < length; i++) { + var cmd = KE.g[id].items[i]; + if (i == 0 || cmd == '-') { + var table = KE.util.createTable().table; + table.className = 'ke-toolbar-table'; + row = table.insertRow(0); + cellNum = 0; + toolbarCell.appendChild(table); + if (cmd == '-') { + KE.g[id].toolbarHeight += KE.g[id].toolbarLineHeight; + continue; + } + } + var cell = row.insertCell(cellNum); + cell.hideforcus = true; + cellNum++; + if (cmd == '|') { + var div = KE.$$('div'); + div.className = 'ke-toolbar-separator'; + cell.appendChild(div); + continue; + } + var a = KE.$$('a'); + self._setAttr(id, a, cmd); + var span = KE.$$('span'); + if (typeof defaultItemHash[cmd] == 'undefined') { + span.className = 'ke-common-icon ke-icon-' + cmd; + } else { + span.className = 'ke-common-icon ke-common-icon-url ke-icon-' + cmd; + } + a.appendChild(span); + cell.appendChild(a); + KE.g[id].toolbarIcon[cmd] = [a, span]; + if (KE.toolbar.isSelected(id, cmd)) KE.toolbar.select(id, cmd); + } + return toolbar; + } +}; + +KE.history = { + addStackData : function(stack, data) { + var prev = ''; + if (stack.length > 0) { + prev = stack[stack.length - 1]; + } + if (stack.length == 0 || data !== prev) stack.push(data); + }, + add : function(id, minChangeSize) { + var g = KE.g[id]; + var html = KE.util.getSrcData(id); + if (g.undoStack.length > 0) { + var prevHtml = g.undoStack[g.undoStack.length - 1]; + if (Math.abs(html.length - prevHtml.length) < minChangeSize) return; + } + this.addStackData(g.undoStack, html); + }, + undo : function(id) { + var g = KE.g[id]; + if (g.undoStack.length == 0) return; + var html = KE.util.getSrcData(id); + this.addStackData(g.redoStack, html); + var prevHtml = g.undoStack.pop(); + if (html === prevHtml && g.undoStack.length > 0) { + prevHtml = g.undoStack.pop(); + } + prevHtml = KE.util.toData(id, prevHtml); + if (g.wyswygMode) { + KE.util.innerHtml(g.iframeDoc.body, KE.util.execSetHtmlHooks(id, prevHtml)); + } else { + g.newTextarea.value = prevHtml; + } + }, + redo : function(id) { + var g = KE.g[id]; + if (g.redoStack.length == 0) return; + var html = KE.util.getSrcData(id); + this.addStackData(g.undoStack, html); + var nextHtml = g.redoStack.pop(); + nextHtml = KE.util.toData(id, nextHtml); + if (g.wyswygMode) { + KE.util.innerHtml(g.iframeDoc.body, KE.util.execSetHtmlHooks(id, nextHtml)); + } else { + g.newTextarea.value = nextHtml; + } + } +}; + +KE.readonly = function(id, isReadonly) { + isReadonly = isReadonly == undefined ? true : isReadonly; + var g = KE.g[id]; + if (KE.browser.IE) g.iframeDoc.body.contentEditable = isReadonly ? 'false' : 'true'; + else g.iframeDoc.designMode = isReadonly ? 'off' : 'on'; +}; + +KE.focus = function(id, position) { + position = (position || '').toLowerCase(); + if (!KE.g[id].container) return; + KE.util.focus(id); + if (position === 'end') { + KE.util.setSelection(id); + if (!KE.g[id].sel) return; //issue #120: Sometimes Firefox does not get selection + var sel = KE.g[id].keSel, + range = KE.g[id].keRange, + doc = KE.g[id].iframeDoc; + range.selectTextNode(doc.body); + range.collapse(false); + sel.addRange(range); + } +}; + +KE.html = function(id, val) { + if (val === undefined) { + return KE.util.getData(id); + } else { + if (!KE.g[id].container) return; + KE.util.setFullHtml(id, val); + KE.focus(id, 'end'); + } +}; + +KE.text = function(id, val) { + if (val === undefined) { + val = KE.html(id); + val = val.replace(/<.*?>/ig, ''); + val = val.replace(/ /ig, ' '); + val = KE.util.trim(val); + return val; + } else { + KE.html(id, KE.util.escape(val)); + } +}; + +KE.insertHtml = function(id, val) { + if (!KE.g[id].container) return; + var range = KE.g[id].range; + if (!range) { + KE.appendHtml(id, val); + } else { + KE.focus(id); + KE.util.selection(id); + KE.util.insertHtml(id, val); + } +}; + +KE.appendHtml = function(id, val) { + KE.html(id, KE.html(id) + val); + KE.focus(id, 'end'); +}; + +KE.isEmpty = function(id) { + return KE.util.isEmpty(id); +}; + +KE.selectedHtml = function(id) { + var range = KE.g[id].range; + if (!range) return ''; + var html = ''; + if (KE.browser.IE) { + if (range.item) { + html = range.item(0).outerHTML; + } else { + html = range.htmlText; + } + } else { + var temp = KE.$$('div', KE.g[id].iframeDoc); + temp.appendChild(range.cloneContents()); + html = temp.innerHTML; + } + return KE.util.toData(id, html); +}; + +KE.count = function(id, mode) { + mode = (mode || 'html').toLowerCase(); + if (mode === 'html') { + return KE.html(id).length; + } else if (mode === 'text') { + var data = KE.util.getPureData(id); + data = data.replace(/<(?:img|embed).*?>/ig, 'K'); + data = data.replace(/\r\n|\n|\r/g, ''); + data = KE.util.trim(data); + return data.length; + } + return 0; +}; + +KE.remove = function(id, mode) { + var g = KE.g[id]; + if (!g.container) return false; + mode = (typeof mode == "undefined") ? 0 : mode; + KE.util.setData(id); + var container = g.container; + var eventStack = g.eventStack; + for (var i = 0, len = eventStack.length; i < len; i++) { + var item = eventStack[i]; + if (item) KE.event.remove(item.el, item.type, item.fn, id); + } + g.iframeDoc.src = 'javascript:false'; + g.iframe.parentNode.removeChild(g.iframe); + if (mode == 1) { + document.body.removeChild(container); + } else { + var srcTextarea = g.srcTextarea; + srcTextarea.parentNode.removeChild(container); + if (mode == 0) srcTextarea.style.display = ''; + } + document.body.removeChild(g.hideDiv); + document.body.removeChild(g.maskDiv); + g.container = null; + g.dialogStack = []; + g.contextmenuItems = []; + g.getHtmlHooks = []; + g.setHtmlHooks = []; + g.onchangeHandlerStack = []; + g.eventStack = []; +}; + +KE.create = function(id, mode) { + if (KE.g[id].beforeCreate) KE.g[id].beforeCreate(id); + if (KE.browser.IE && KE.browser.VERSION < 7) try { document.execCommand('BackgroundImageCache', false, true); }catch(e){} + var srcTextarea = KE.$(id) || document.getElementsByName(id)[0]; + mode = (typeof mode == "undefined") ? 0 : mode; + if (mode == 0 && KE.g[id].container) return; + var width = KE.g[id].width || srcTextarea.style.width || srcTextarea.offsetWidth + 'px'; + var height = KE.g[id].height || srcTextarea.style.height || srcTextarea.offsetHeight + 'px'; + var tableObj = KE.util.createTable(); + var container = tableObj.table; + container.className = 'ke-container'; + container.style.width = width; + container.style.height = height; + var toolbarOuter = tableObj.cell; + toolbarOuter.className = 'ke-toolbar-outer'; + var textareaOuter = container.insertRow(1).insertCell(0); + textareaOuter.className = 'ke-textarea-outer'; + tableObj = KE.util.createTable(); + var textareaTable = tableObj.table; + textareaTable.className = 'ke-textarea-table'; + var textareaCell = tableObj.cell; + textareaOuter.appendChild(textareaTable); + var bottomOuter = container.insertRow(2).insertCell(0); + bottomOuter.className = 'ke-bottom-outer'; + srcTextarea.style.display = 'none'; + if (mode == 1) document.body.appendChild(container); + else srcTextarea.parentNode.insertBefore(container, srcTextarea); + var toolbarTable = KE.toolbar.create(id); + toolbarTable.style.height = KE.g[id].toolbarHeight + 'px'; + toolbarOuter.appendChild(toolbarTable); + var iframe = KE.g[id].iframe || KE.$$('iframe'); + iframe.className = 'ke-iframe'; + iframe.setAttribute("frameBorder", "0"); + var newTextarea = KE.$$('textarea'); + newTextarea.className = 'ke-textarea'; + newTextarea.style.display = 'none'; + KE.g[id].container = container; + KE.g[id].iframe = iframe; + KE.g[id].newTextarea = newTextarea; + KE.util.resize(id, width, height); + textareaCell.appendChild(iframe); + textareaCell.appendChild(newTextarea); + var bottom = KE.$$('table'); + bottom.className = 'ke-bottom'; + bottom.cellPadding = 0; + bottom.cellSpacing = 0; + bottom.border = 0; + bottom.style.height = KE.g[id].statusbarHeight + 'px'; + var row = bottom.insertRow(0); + var bottomLeft = row.insertCell(0); + bottomLeft.className = 'ke-bottom-left'; + var leftImg = KE.$$('span'); + leftImg.className = 'ke-bottom-left-img'; + if (KE.g[id].config.resizeMode == 0 || mode == 1) { + bottomLeft.style.cursor = 'default'; + leftImg.style.visibility = 'hidden'; + } + bottomLeft.appendChild(leftImg); + var bottomRight = row.insertCell(1); + bottomRight.className = 'ke-bottom-right'; + var rightImg = KE.$$('span'); + rightImg.className = 'ke-bottom-right-img'; + if (KE.g[id].config.resizeMode == 0 || mode == 1) { + bottomRight.style.cursor = 'default'; + rightImg.style.visibility = 'hidden'; + } else if (KE.g[id].config.resizeMode == 1) { + bottomRight.style.cursor = 's-resize'; + rightImg.style.visibility = 'hidden'; + } + bottomRight.appendChild(rightImg); + bottomOuter.appendChild(bottom); + var hideDiv = KE.$$('div'); + hideDiv.className = 'ke-reset'; + hideDiv.style.display = 'none'; + var maskDiv = KE.$$('div'); + maskDiv.className = 'ke-mask'; + KE.util.setOpacity(maskDiv, 50); + KE.event.bind(maskDiv, 'click', function(e){}, id); + KE.event.bind(maskDiv, 'mousedown', function(e){}, id); + document.body.appendChild(hideDiv); + document.body.appendChild(maskDiv); + KE.util.setDefaultPlugin(id); + var iframeWin = iframe.contentWindow; + var iframeDoc = KE.util.getIframeDoc(iframe); + if (!KE.browser.IE || KE.browser.VERSION < 8) iframeDoc.designMode = 'on'; + var html = KE.util.getFullHtml(id); + iframeDoc.open(); + iframeDoc.write(html); + iframeDoc.close(); + if (!KE.g[id].wyswygMode) { + newTextarea.value = KE.util.execSetHtmlHooks(id, srcTextarea.value); + newTextarea.style.display = 'block'; + iframe.style.display = 'none'; + KE.toolbar.disable(id, ['source', 'fullscreen']); + KE.toolbar.select(id, 'source'); + } + function hideMenu() { + KE.hideMenu(id); + } + function updateToolbar() { + KE.toolbar.updateState(id); + } + if (KE.browser.WEBKIT) { + KE.event.add(iframeDoc, 'click', function(e) { + KE.util.selectImageWebkit(id, e, true); + }, id); + } + if (KE.browser.IE) { + KE.event.add(iframeDoc, 'keydown', function(e) { + if (e.keyCode == 8) { + var range = KE.g[id].range; + if (range.item) { + var item = range.item(0); + item.parentNode.removeChild(item); + KE.util.execOnchangeHandler(id); + KE.event.stop(id); + return false; + } + } + }, id); + } + KE.event.add(iframeDoc, 'click', hideMenu, id); + KE.event.add(iframeDoc, 'click', updateToolbar, id); + KE.event.input(iframeDoc, updateToolbar, id); + KE.event.bind(newTextarea, 'click', hideMenu, id); + KE.event.add(document, 'click', hideMenu, id); + KE.g[id].toolbarTable = toolbarTable; + KE.g[id].textareaTable = textareaTable; + KE.g[id].srcTextarea = srcTextarea; + KE.g[id].bottom = bottom; + KE.g[id].hideDiv = hideDiv; + KE.g[id].maskDiv = maskDiv; + KE.g[id].iframeWin = iframeWin; + KE.g[id].iframeDoc = iframeDoc; + KE.g[id].width = width; + KE.g[id].height = height; + KE.util.drag(id, bottomRight, container, function(objTop, objLeft, objWidth, objHeight, top, left) { + if (KE.g[id].resizeMode == 2) KE.util.resize(id, (objWidth + left) + 'px', (objHeight + top) + 'px', true); + else if (KE.g[id].resizeMode == 1) KE.util.resize(id, objWidth + 'px', (objHeight + top) + 'px', true, false); + }); + KE.util.drag(id, bottomLeft, container, function(objTop, objLeft, objWidth, objHeight, top, left) { + if (KE.g[id].resizeMode > 0) KE.util.resize(id, objWidth + 'px', (objHeight + top) + 'px', true, false); + }); + KE.each(KE.plugin, function(cmd, plugin) { + if (plugin.init) plugin.init(id); + }); + KE.g[id].getHtmlHooks.push(function(html) { + return html.replace(/(<[^>]*)kesrc="([^"]+)"([^>]*>)/ig, function(full, start, src, end) { + full = full.replace(/(\s+(?:href|src)=")[^"]+(")/i, '$1' + src + '$2'); + full = full.replace(/\s+kesrc="[^"]+"/i, ''); + return full; + }); + }); + KE.g[id].setHtmlHooks.push(function(html) { + return html.replace(/(<[^>]*)(href|src)="([^"]+)"([^>]*>)/ig, function(full, start, key, src, end) { + if (full.match(/\skesrc="[^"]+"/i)) return full; + full = start + key + '="' + src + '"' + ' kesrc="' + src + '"' + end; + return full; + }); + }); + KE.util.addContextmenuEvent(id); + KE.util.addNewlineEvent(id); + KE.util.addTabEvent(id); + function setSelectionHandler() { + KE.util.setSelection(id); + } + KE.event.input(iframeDoc, setSelectionHandler, id); + KE.event.add(iframeDoc, 'mouseup', setSelectionHandler, id); + KE.event.add(document, 'mousedown', setSelectionHandler, id); + KE.onchange(id, function(id) { + if (KE.g[id].autoSetDataMode) { + KE.util.setData(id); + if (KE.g[id].afterSetData) KE.g[id].afterSetData(id); + } + KE.history.add(id, KE.g[id].minChangeSize); + }); + if (KE.browser.IE && KE.browser.VERSION > 7) KE.readonly(id, false); + KE.util.setFullHtml(id, srcTextarea.value); + KE.history.add(id, 0); + if (mode > 0) KE.util.focus(id); + if (KE.g[id].afterCreate) KE.g[id].afterCreate(id); +}; + +KE.onchange = function(id, func) { + var g = KE.g[id]; + function handler() { + func(id); + }; + g.onchangeHandlerStack.push(handler); + KE.event.input(g.iframeDoc, handler, id); + KE.event.input(g.newTextarea, handler, id); + KE.event.add(g.iframeDoc, 'mouseup', function(e) { + window.setTimeout(function() { + func(id); + }, 0); + }, id); +}; + +KE.init = function(args) { + var g = KE.g[args.id] = args; + g.config = {}; + g.undoStack = []; + g.redoStack = []; + g.dialogStack = []; + g.contextmenuItems = []; + g.getHtmlHooks = []; + g.setHtmlHooks = []; + g.onchangeHandlerStack = []; + g.eventStack = []; + KE.each(KE.setting, function(key, val) { + g[key] = (typeof args[key] == 'undefined') ? val : args[key]; + g.config[key] = g[key]; + }); + if (g.loadStyleMode) KE.util.loadStyle(g.skinsPath + g.skinType + '.css'); +} + +KE.show = function(args) { + KE.init(args); + KE.event.ready(function() { KE.create(args.id); }); +}; + +if (window.KE === undefined) window.KE = KE; +window.KindEditor = KE; + +})(); + +(function (KE, undefined) { + +KE.langType = 'zh_CN'; + +KE.lang = { + source : 'HTML代码', + undo : '后退(Ctrl+Z)', + redo : '前进(Ctrl+Y)', + cut : '剪切(Ctrl+X)', + copy : '复制(Ctrl+C)', + paste : '粘贴(Ctrl+V)', + plainpaste : '粘贴为无格式文本', + wordpaste : '从Word粘贴', + selectall : '全选', + justifyleft : '左对齐', + justifycenter : '居中', + justifyright : '右对齐', + justifyfull : '两端对齐', + insertorderedlist : '编号', + insertunorderedlist : '项目符号', + indent : '增加缩进', + outdent : '减少缩进', + subscript : '下标', + superscript : '上标', + title : '标题', + fontname : '字体', + fontsize : '文字大小', + textcolor : '文字颜色', + bgcolor : '文字背景', + bold : '粗体(Ctrl+B)', + italic : '斜体(Ctrl+I)', + underline : '下划线(Ctrl+U)', + strikethrough : '删除线', + removeformat : '删除格式', + image : '图片', + flash : '插入Flash', + media : '插入多媒体', + table : '插入表格', + hr : '插入横线', + emoticons : '插入表情', + link : '超级链接', + unlink : '取消超级链接', + fullscreen : '全屏显示', + about : '关于', + print : '打印', + fileManager : '浏览服务器', + advtable : '表格', + yes : '确定', + no : '取消', + close : '关闭', + editImage : '图片属性', + deleteImage : '删除图片', + editLink : '超级链接属性', + deleteLink : '取消超级链接', + tableprop : '表格属性', + tableinsert : '插入表格', + tabledelete : '删除表格', + tablecolinsertleft : '左侧插入列', + tablecolinsertright : '右侧插入列', + tablerowinsertabove : '上方插入行', + tablerowinsertbelow : '下方插入行', + tablecoldelete : '删除列', + tablerowdelete : '删除行', + noColor : '无颜色', + invalidImg : "请输入有效的URL地址。\n只允许jpg,gif,bmp,png格式。", + invalidMedia : "请输入有效的URL地址。\n只允许swf,flv,mp3,wav,wma,wmv,mid,avi,mpg,asf,rm,rmvb格式。", + invalidWidth : "宽度必须为数字。", + invalidHeight : "高度必须为数字。", + invalidBorder : "边框必须为数字。", + invalidUrl : "请输入有效的URL地址。", + invalidRows : '行数为必选项,只允许输入大于0的数字。', + invalidCols : '列数为必选项,只允许输入大于0的数字。', + invalidPadding : '边距必须为数字。', + invalidSpacing : '间距必须为数字。', + invalidBorder : '边框必须为数字。', + pleaseInput : "请输入内容。", + invalidJson : '服务器发生故障。', + cutError : '您的浏览器安全设置不允许使用剪切操作,请使用快捷键(Ctrl+X)来完成。', + copyError : '您的浏览器安全设置不允许使用复制操作,请使用快捷键(Ctrl+C)来完成。', + pasteError : '您的浏览器安全设置不允许使用粘贴操作,请使用快捷键(Ctrl+V)来完成。' +}; + +var plugins = KE.lang.plugins = {}; + +plugins.about = { + version : KE.version, + title : 'HTML可视化编辑器' +}; + +plugins.plainpaste = { + comment : '请使用快捷键(Ctrl+V)把内容粘贴到下面的方框里。' +}; + +plugins.wordpaste = { + comment : '请使用快捷键(Ctrl+V)把内容粘贴到下面的方框里。' +}; + +plugins.link = { + url : 'URL地址', + linkType : '打开类型', + newWindow : '新窗口', + + selfWindow : '当前窗口' +}; + +plugins.flash = { + url : 'Flash地址', + width : '宽度', + height : '高度' +}; + +plugins.media = { + url : '媒体文件地址', + width : '宽度', + height : '高度', + autostart : '自动播放' +}; + +plugins.image = { + remoteImage : '远程图片', + localImage : '本地上传', + remoteUrl : '图片地址', + localUrl : '图片地址', + size : '图片大小', + width : '宽', + height : '高', + resetSize : '重置大小', + align : '对齐方式', + defaultAlign : '默认方式', + leftAlign : '左对齐', + rightAlign : '右对齐', + imgTitle : '图片说明', + viewServer : '浏览...' +}; + +plugins.file_manager = { + emptyFolder : '空文件夹', + moveup : '移到上一级文件夹', + viewType : '显示方式:', + viewImage : '缩略图', + listImage : '详细信息', + orderType : '排序方式:', + fileName : '名称', + fileSize : '大小', + fileType : '类型' +}; + +plugins.advtable = { + cells : '单元格数', + rows : '行数', + cols : '列数', + size : '表格大小', + width : '宽度', + height : '高度', + percent : '%', + px : 'px', + space : '边距间距', + padding : '边距', + spacing : '间距', + align : '对齐方式', + alignDefault : '默认', + alignLeft : '左对齐', + alignCenter : '居中', + alignRight : '右对齐', + border : '表格边框', + borderWidth : '边框', + borderColor : '颜色', + backgroundColor : '背景颜色' +}; + +plugins.title = { + h1 : '标题 1', + h2 : '标题 2', + h3 : '标题 3', + h4 : '标题 4', + p : '正 文' +}; + +plugins.fontname = { + fontName : { + 'SimSun' : '宋体', + 'NSimSun' : '新宋体', + 'FangSong_GB2312' : '仿宋_GB2312', + 'KaiTi_GB2312' : '楷体_GB2312', + 'SimHei' : '黑体', + 'Microsoft YaHei' : '微软雅黑', + 'Arial' : 'Arial', + 'Arial Black' : 'Arial Black', + 'Times New Roman' : 'Times New Roman', + 'Courier New' : 'Courier New', + 'Tahoma' : 'Tahoma', + 'Verdana' : 'Verdana' + } +}; + +})(KindEditor); + +(function (KE, undefined) { + +KE.plugin['about'] = { + click : function(id) { + KE.util.selection(id); + var dialog = new KE.dialog({ + id : id, + cmd : 'about', + file : 'about.html', + width : 300, + height : 70, + loadingMode : true, + title : KE.lang['about'], + noButton : KE.lang['close'] + }); + dialog.show(); + } +}; + +KE.plugin['undo'] = { + init : function(id) { + KE.event.ctrl(KE.g[id].iframeDoc, 'Z', function(e) { + KE.plugin['undo'].click(id); + KE.util.focus(id); + }, id); + KE.event.ctrl(KE.g[id].newTextarea, 'Z', function(e) { + KE.plugin['undo'].click(id); + KE.util.focus(id); + }, id); + }, + click : function(id) { + KE.history.undo(id); + KE.util.execOnchangeHandler(id); + } +}; + +KE.plugin['redo'] = { + init : function(id) { + KE.event.ctrl(KE.g[id].iframeDoc, 'Y', function(e) { + KE.plugin['redo'].click(id); + KE.util.focus(id); + }, id); + KE.event.ctrl(KE.g[id].newTextarea, 'Y', function(e) { + KE.plugin['redo'].click(id); + KE.util.focus(id); + }, id); + }, + click : function(id) { + KE.history.redo(id); + KE.util.execOnchangeHandler(id); + } +}; + +KE.plugin['cut'] = { + click : function(id) { + try { + if (!KE.g[id].iframeDoc.queryCommandSupported('cut')) throw 'e'; + } catch(e) { + alert(KE.lang.cutError); + return; + } + KE.util.execCommand(id, 'cut', null); + } +}; + +KE.plugin['copy'] = { + click : function(id) { + try { + if (!KE.g[id].iframeDoc.queryCommandSupported('copy')) throw 'e'; + } catch(e) { + alert(KE.lang.copyError); + return; + } + KE.util.execCommand(id, 'copy', null); + } +}; + +KE.plugin['paste'] = { + click : function(id) { + try { + if (!KE.g[id].iframeDoc.queryCommandSupported('paste')) throw 'e'; + } catch(e) { + alert(KE.lang.pasteError); + return; + } + KE.util.execCommand(id, 'paste', null); + } +}; + +KE.plugin['plainpaste'] = { + click : function(id) { + KE.util.selection(id); + this.dialog = new KE.dialog({ + id : id, + cmd : 'plainpaste', + file : 'plainpaste.html', + width : 450, + height : 300, + loadingMode : true, + title : KE.lang['plainpaste'], + yesButton : KE.lang['yes'], + noButton : KE.lang['no'] + }); + this.dialog.show(); + }, + exec : function(id) { + var dialogDoc = KE.util.getIframeDoc(this.dialog.iframe); + var html = KE.$('textArea', dialogDoc).value; + html = KE.util.escape(html); + html = html.replace(/ /g, ' '); + html = html.replace(/\r\n|\n|\r/g, "
$&"); + KE.util.insertHtml(id, html); + this.dialog.hide(); + KE.util.focus(id); + } +}; + +KE.plugin['wordpaste'] = { + click : function(id) { + KE.util.selection(id); + this.dialog = new KE.dialog({ + id : id, + cmd : 'wordpaste', + file : 'wordpaste.html', + width : 450, + height : 300, + loadingMode : true, + title : KE.lang['wordpaste'], + yesButton : KE.lang['yes'], + noButton : KE.lang['no'] + }); + this.dialog.show(); + }, + exec : function(id) { + var dialogDoc = KE.util.getIframeDoc(this.dialog.iframe); + var wordIframe = KE.$('wordIframe', dialogDoc); + var str = KE.util.getIframeDoc(wordIframe).body.innerHTML; + str = str.replace(//ig, ""); + str = str.replace(//ig, ""); + str = str.replace(/]*>(\n|.)*?<\/style>/ig, ""); + str = str.replace(/]*>(\n|.)*?<\/script>/ig, ""); + str = str.replace(/]+>(\n|.)*?<\/w:[^>]+>/ig, ""); + str = str.replace(/(\n|.)*?<\/xml>/ig, ""); + str = str.replace(/\r\n|\n|\r/ig, ""); + str = KE.util.execGetHtmlHooks(id, str); + str = KE.format.getHtml(str, KE.g[id].htmlTags, KE.g[id].urlType); + KE.util.insertHtml(id, str); + this.dialog.hide(); + KE.util.focus(id); + } +}; + +KE.plugin['fullscreen'] = { + click : function(id) { + var g = KE.g[id]; + var self = this; + var resetSize = function() { + var el = KE.util.getDocumentElement(); + g.width = el.clientWidth + 'px'; + g.height = el.clientHeight + 'px'; + }; + var windowSize = ''; + var resizeListener = function() { + if (!self.isSelected) return; + var el = KE.util.getDocumentElement(); + var size = [el.clientWidth, el.clientHeight].join(''); + if (windowSize != size) { + windowSize = size; + resetSize(); + KE.util.resize(id, g.width, g.height); + } + } + if (this.isSelected) { + this.isSelected = false; + KE.util.setData(id); + KE.remove(id, 1); + g.width = this.width; + g.height = this.height; + KE.create(id, 2); + document.body.parentNode.style.overflow = 'auto'; + KE.event.remove(window, 'resize', resizeListener); + g.resizeMode = g.config.resizeMode; + KE.toolbar.unselect(id, "fullscreen"); + } else { + this.isSelected = true; + this.width = g.container.style.width; + this.height = g.container.style.height; + KE.util.setData(id); + KE.remove(id, 2); + document.body.parentNode.style.overflow = 'hidden'; + resetSize(); + KE.create(id, 1); + var pos = KE.util.getScrollPos(); + var div = g.container; + div.style.position = 'absolute'; + div.style.left = pos.x + 'px'; + div.style.top = pos.y + 'px'; + div.style.zIndex = 19811211; + KE.event.add(window, 'resize', resizeListener); + g.resizeMode = 0; + KE.toolbar.select(id, "fullscreen"); + } + } +}; + +KE.plugin['bgcolor'] = { + click : function(id) { + KE.util.selection(id); + var color = KE.queryCommandValue(KE.g[id].iframeDoc, 'bgcolor'); + this.menu = new KE.menu({ + id : id, + cmd : 'bgcolor' + }); + this.menu.picker(color); + }, + exec : function(id, value) { + var cmd = new KE.cmd(id); + if (value == '') { + cmd.remove({ + 'span' : ['.background-color'] + }); + } else { + cmd.wrap('span', [{'.background-color': value}]); + } + KE.util.execOnchangeHandler(id); + this.menu.hide(); + KE.util.focus(id); + } +}; + +KE.plugin['fontname'] = { + click : function(id) { + var fontName = KE.lang.plugins.fontname.fontName; + var cmd = 'fontname'; + KE.util.selection(id); + var menu = new KE.menu({ + id : id, + cmd : cmd, + width : 150 + }); + var font = KE.queryCommandValue(KE.g[id].iframeDoc, cmd); + KE.each(fontName, function(key, value) { + var html = '' + value + ''; + menu.add( + html, + function() { KE.plugin[cmd].exec(id, key); }, + { checked : (font === key.toLowerCase() || font === value.toLowerCase()) } + ); + }); + menu.show(); + this.menu = menu; + }, + exec : function(id, value) { + var cmd = new KE.cmd(id); + cmd.wrap('span', [{'.font-family': value}]); + KE.util.execOnchangeHandler(id); + this.menu.hide(); + KE.util.focus(id); + } +}; + +KE.plugin['fontsize'] = { + click : function(id) { + var fontSize = ['9px', '10px', '12px', '14px', '16px', '18px', '24px', '32px']; + var cmd = 'fontsize'; + KE.util.selection(id); + var size = KE.queryCommandValue(KE.g[id].iframeDoc, 'fontsize'); + var menu = new KE.menu({ + id : id, + cmd : cmd, + width : 120 + }); + for (var i = 0, len = fontSize.length; i < len; i++) { + var value = fontSize[i]; + var html = '' + value + ''; + menu.add( + html, + (function(value) { + return function() { + KE.plugin[cmd].exec(id, value); + }; + })(value), + { + height : (parseInt(value) + 12) + 'px', + checked : (size === value) + } + ); + } + menu.show(); + this.menu = menu; + }, + exec : function(id, value) { + var cmd = new KE.cmd(id); + cmd.wrap('span', [{'.font-size': value}]); + KE.util.execOnchangeHandler(id); + this.menu.hide(); + KE.util.focus(id); + } +}; + +KE.plugin['hr'] = { + click : function(id) { + KE.util.selection(id); + KE.util.insertHtml(id, '


'); + KE.util.focus(id); + } +}; + +KE.plugin['print'] = { + click : function(id) { + KE.util.selection(id); + KE.g[id].iframeWin.print(); + } +}; + +KE.plugin['removeformat'] = { + click : function(id) { + KE.util.selection(id); + var cmd = new KE.cmd(id); + var tags = { + '*' : ['class', 'style'] + }; + for (var i = 0, len = KE.g[id].inlineTags.length; i < len; i++) { + tags[KE.g[id].inlineTags[i]] = ['*']; + } + cmd.remove(tags); + KE.util.execOnchangeHandler(id); + KE.toolbar.updateState(id); + KE.util.focus(id); + } +}; + +KE.plugin['source'] = { + click : function(id) { + var g = KE.g[id]; + if (!g.wyswygMode) { + KE.util.setFullHtml(id, g.newTextarea.value); + g.iframe.style.display = 'block'; + g.newTextarea.style.display = 'none'; + KE.toolbar.able(id, ['source', 'fullscreen']); + g.wyswygMode = true; + this.isSelected = false; + KE.toolbar.unselect(id, "source"); + } else { + KE.hideMenu(id); + g.newTextarea.value = KE.util.getData(id); + g.iframe.style.display = 'none'; + g.newTextarea.style.display = 'block'; + KE.toolbar.disable(id, ['source', 'fullscreen']); + g.wyswygMode = false; + this.isSelected = true; + KE.toolbar.select(id, "source"); + } + KE.util.focus(id); + } +}; + +KE.plugin['textcolor'] = { + click : function(id) { + KE.util.selection(id); + var color = KE.queryCommandValue(KE.g[id].iframeDoc, 'textcolor'); + this.menu = new KE.menu({ + id : id, + cmd : 'textcolor' + }); + this.menu.picker(color); + }, + exec : function(id, value) { + var cmd = new KE.cmd(id); + if (value == '') { + cmd.remove({ + 'span' : ['.color'], + 'font' : ['color'] + }); + } else { + cmd.wrap('span', [{'.color': value}]); + } + KE.util.execOnchangeHandler(id); + this.menu.hide(); + KE.util.focus(id); + } +}; + +KE.plugin['title'] = { + click : function(id) { + var lang = KE.lang.plugins.title; + var title = { + 'H1' : lang.h1, + 'H2' : lang.h2, + 'H3' : lang.h3, + 'H4' : lang.h4, + 'P' : lang.p + }; + var sizeHash = { + 'H1' : 28, + 'H2' : 24, + 'H3' : 18, + 'H4' : 14, + 'P' : 12 + }; + var cmd = 'title'; + KE.util.selection(id); + var block = KE.queryCommandValue(KE.g[id].iframeDoc, 'formatblock'); + var menu = new KE.menu({ + id : id, + cmd : cmd, + width : (KE.langType == 'en' ? 200 : 150) + }); + KE.each(title, function(key, value) { + var style = 'font-size:' + sizeHash[key] + 'px;' + if (key !== 'P') style += 'font-weight:bold;'; + var html = '' + value + ''; + menu.add(html, function() { + KE.plugin[cmd].exec(id, '<' + key + '>'); }, + { + height : (sizeHash[key] + 12) + 'px', + checked : (block === key.toLowerCase() || block === value.toLowerCase() ) + } + ); + }); + menu.show(); + this.menu = menu; + }, + exec : function(id, value) { + KE.util.select(id); + KE.util.execCommand(id, 'formatblock', value); + this.menu.hide(); + KE.util.focus(id); + } +}; + +KE.plugin['emoticons'] = { + click : function(id) { + var self = this, + cmd = 'emoticons', + rows = 5, + cols = 9, + total = 135, + startNum = 0, + cells = rows * cols, + pages = Math.ceil(total / cells), + colsHalf = Math.floor(cols / 2), + g = KE.g[id], + path = g.pluginsPath + 'emoticons/', + allowPreview = (g.allowPreviewEmoticons === undefined) ? true : g.allowPreviewEmoticons; + KE.util.selection(id); + var wrapperDiv = KE.$$('div'); + wrapperDiv.className = 'ke-plugin-emoticons-wrapper'; + var previewDiv, previewImg; + if (allowPreview) { + previewDiv = KE.$$('div'); + previewDiv.className = 'ke-plugin-emoticons-preview'; + previewDiv.style.right = 0; + var previewImg = KE.$$('img'); + previewImg.className = 'ke-reset'; + previewImg.src = path + '0.gif'; + previewImg.border = 0; + previewDiv.appendChild(previewImg); + wrapperDiv.appendChild(previewDiv); + } + function createEmoticonsTable(pageNum) { + var table = KE.$$('table'); + if (previewDiv) { + table.onmouseover = function() { previewDiv.style.display = 'block'; }; + table.onmouseout = function() { previewDiv.style.display = 'none'; }; + } + table.className = 'ke-plugin-emoticons-table'; + table.cellPadding = 0; + table.cellSpacing = 0; + table.border = 0; + var num = (pageNum - 1) * cells + startNum; + for (var i = 0; i < rows; i++) { + var row = table.insertRow(i); + for (var j = 0; j < cols; j++) { + var cell = row.insertCell(j); + cell.className = 'ke-plugin-emoticons-cell'; + if (previewDiv) { + cell.onmouseover = (function(j, num) { + return function() { + if (j > colsHalf) { + previewDiv.style.left = 0; + previewDiv.style.right = ''; + } else { + previewDiv.style.left = ''; + previewDiv.style.right = 0; + } + previewImg.src = path + num + '.gif';; + this.className = 'ke-plugin-emoticons-cell ke-plugin-emoticons-cell-on'; + }; + })(j, num); + } else { + cell.onmouseover = function() { + this.className = 'ke-plugin-emoticons-cell ke-plugin-emoticons-cell-on'; + }; + } + cell.onmouseout = function() { this.className = 'ke-plugin-emoticons-cell'; }; + cell.onclick = (function(num) { + return function() { + self.exec(id, num); + return false; + }; + })(num); + var span = KE.$$('span'); + span.className = 'ke-plugin-emoticons-img'; + span.style.backgroundPosition = '-' + (24 * num) + 'px 0px'; + cell.appendChild(span); + num++; + } + } + return table; + } + var table = createEmoticonsTable(1); + wrapperDiv.appendChild(table); + var pageDiv = KE.$$('div'); + pageDiv.className = 'ke-plugin-emoticons-page'; + wrapperDiv.appendChild(pageDiv); + function createPageTable(currentPageNum) { + for (var pageNum = 1; pageNum <= pages; pageNum++) { + if (currentPageNum !== pageNum) { + var a = KE.$$('a'); + a.href = 'javascript:;'; + a.innerHTML = '[' + pageNum + ']'; + a.onclick = (function(pageNum) { + return function() { + wrapperDiv.removeChild(table); + var newTable = createEmoticonsTable(pageNum); + wrapperDiv.insertBefore(newTable, pageDiv); + table = newTable; + pageDiv.innerHTML = ''; + createPageTable(pageNum); + return false; + }; + })(pageNum); + pageDiv.appendChild(a); + } else { + pageDiv.appendChild(document.createTextNode('[' + pageNum + ']')); + } + pageDiv.appendChild(document.createTextNode(' ')); + } + } + createPageTable(1); + var menu = new KE.menu({ + id : id, + cmd : cmd + }); + menu.append(wrapperDiv); + menu.show(); + this.menu = menu; + }, + exec : function(id, num) { + var src = KE.g[id].pluginsPath + 'emoticons/' + num + '.gif'; + var html = ''; + KE.util.insertHtml(id, html); + this.menu.hide(); + KE.util.focus(id); + } +}; + +KE.plugin['flash'] = { + init : function(id) { + var self = this; + KE.g[id].getHtmlHooks.push(function(html) { + return html.replace(/]*class="?ke-flash"?[^>]*>/ig, function(imgStr) { + var width = imgStr.match(/style="[^"]*;?\s*width:\s*(\d+)/i) ? RegExp.$1 : 0; + var height = imgStr.match(/style="[^"]*;?\s*height:\s*(\d+)/i) ? RegExp.$1 : 0; + width = width || (imgStr.match(/width="([^"]+)"/i) ? RegExp.$1 : 0); + height = height || (imgStr.match(/height="([^"]+)"/i) ? RegExp.$1 : 0); + if (imgStr.match(/kesrctag="([^"]+)"/i)) { + var attrs = KE.util.getAttrList(unescape(RegExp.$1)); + attrs.width = width || attrs.width || 0; + attrs.height = height || attrs.height || 0; + attrs.kesrc = attrs.src; + return KE.util.getMediaEmbed(attrs); + } + }); + }); + KE.g[id].setHtmlHooks.push(function(html) { + return html.replace(/]*type="application\/x-shockwave-flash"[^>]*>(?:<\/embed>)?/ig, function($0) { + var src = $0.match(/\s+src="([^"]+)"/i) ? RegExp.$1 : ''; + if ($0.match(/\s+kesrc="([^"]+)"/i)) src = RegExp.$1; + var width = $0.match(/\s+width="([^"]+)"/i) ? RegExp.$1 : 0; + var height = $0.match(/\s+height="([^"]+)"/i) ? RegExp.$1 : 0; + var attrs = KE.util.getAttrList($0); + attrs.src = src; + attrs.width = width; + attrs.height = height; + return KE.util.getMediaImage(id, 'flash', attrs); + }); + }); + }, + click : function(id) { + KE.util.selection(id); + this.dialog = new KE.dialog({ + id : id, + cmd : 'flash', + file : 'flash.html', + width : 400, + height : 140, + loadingMode : true, + title : KE.lang['flash'], + yesButton : KE.lang['yes'], + noButton : KE.lang['no'] + }); + this.dialog.show(); + }, + check : function(id, url, width, height) { + var dialogDoc = KE.util.getIframeDoc(this.dialog.iframe); + if (!url.match(/^.{3,}$/)) { + alert(KE.lang['invalidUrl']); + KE.$('url', dialogDoc).focus(); + return false; + } + if (!width.match(/^\d*$/)) { + alert(KE.lang['invalidWidth']); + KE.$('width', dialogDoc).focus(); + return false; + } + if (!height.match(/^\d*$/)) { + alert(KE.lang['invalidHeight']); + KE.$('height', dialogDoc).focus(); + return false; + } + return true; + }, + exec : function(id) { + var dialogDoc = KE.util.getIframeDoc(this.dialog.iframe); + var url = KE.$('url', dialogDoc).value; + var width = KE.$('width', dialogDoc).value; + var height = KE.$('height', dialogDoc).value; + if (!this.check(id, url, width, height)) return false; + var html = KE.util.getMediaImage(id, 'flash', { + src : url, + type : KE.g[id].mediaTypes['flash'], + width : width, + height : height, + quality : 'high' + }); + KE.util.insertHtml(id, html); + this.dialog.hide(); + KE.util.focus(id); + } +}; + +KE.plugin['image'] = { + getSelectedNode : function(id) { + var g = KE.g[id]; + var startNode = g.keRange.startNode; + var endNode = g.keRange.endNode; + if (!KE.browser.WEBKIT && !g.keSel.isControl) return; + if (startNode.nodeType != 1) return; + if (startNode.tagName.toLowerCase() != 'img') return; + if (startNode != endNode) return; + if (!startNode.className.match(/^ke-\w+/i)) return startNode; + }, + init : function(id) { + var self = this; + var g = KE.g[id]; + g.contextmenuItems.push({ + text : KE.lang['editImage'], + click : function(id, menu) { + KE.util.select(id); + menu.hide(); + self.click(id); + }, + cond : function(id) { + return self.getSelectedNode(id); + }, + options : { + width : '150px', + iconHtml : '' + } + }); + g.contextmenuItems.push({ + text : KE.lang['deleteImage'], + click : function(id, menu) { + KE.util.select(id); + menu.hide(); + var img = self.getSelectedNode(id); + img.parentNode.removeChild(img); + KE.util.execOnchangeHandler(id); + }, + cond : function(id) { + return self.getSelectedNode(id); + }, + options : { + width : '150px' + } + }); + g.contextmenuItems.push('-'); + }, + click : function(id) { + KE.util.selection(id); + this.dialog = new KE.dialog({ + id : id, + cmd : 'image', + file : 'image/image.html', + width : 400, + height : 220, + loadingMode : true, + title : KE.lang['image'], + yesButton : KE.lang['yes'], + noButton : KE.lang['no'] + }); + this.dialog.show(); + }, + check : function(id) { + var dialogDoc = KE.util.getIframeDoc(this.dialog.iframe); + var type = KE.$('type', dialogDoc).value; + var width = KE.$('imgWidth', dialogDoc).value; + var height = KE.$('imgHeight', dialogDoc).value; + var title = KE.$('imgTitle', dialogDoc).value; + var urlBox; + if (type == 2) { + urlBox = KE.$('imgFile', dialogDoc); + } else { + urlBox = KE.$('url', dialogDoc); + } + if (!urlBox.value.match(/\.(jpg|jpeg|gif|bmp|png)(\s|\?|$)/i)) { + alert(KE.lang['invalidImg']); + urlBox.focus(); + return false; + } + if (!width.match(/^\d*$/)) { + alert(KE.lang['invalidWidth']); + KE.$('imgWidth', dialogDoc).focus(); + return false; + } + if (!height.match(/^\d*$/)) { + alert(KE.lang['invalidHeight']); + KE.$('imgHeight', dialogDoc).focus(); + return false; + } + return true; + }, + exec : function(id) { + var self = this; + var dialogDoc = KE.util.getIframeDoc(this.dialog.iframe); + var type = KE.$('type', dialogDoc).value; + var width = KE.$('imgWidth', dialogDoc).value; + var height = KE.$('imgHeight', dialogDoc).value; + var title = KE.$('imgTitle', dialogDoc).value; + var alignElements = dialogDoc.getElementsByName('align'); + var align = ''; + for (var i = 0, len = alignElements.length; i < len; i++) { + if (alignElements[i].checked) { + align = alignElements[i].value; + break; + } + } + if (!this.check(id)) return false; + if (type == 2) { + KE.$('editorId', dialogDoc).value = id; + var uploadIframe = KE.$('uploadIframe', dialogDoc); + KE.util.showLoadingPage(id); + var onloadFunc = function() { + KE.event.remove(uploadIframe, 'load', onloadFunc); + KE.util.hideLoadingPage(id); + var uploadDoc = KE.util.getIframeDoc(uploadIframe); + var data = ''; + try { + data = KE.util.parseJson(uploadDoc.body.innerHTML); + } catch(e) { + alert(KE.lang.invalidJson); + } + if (typeof data === 'object' && 'error' in data) { + if (data.error === 0) { + self.insert(id, data.url, title, width, height, 0, align); + } else { + alert(data.message); + return false; + } + } + }; + KE.event.add(uploadIframe, 'load', onloadFunc); + dialogDoc.uploadForm.submit(); + return; + } else { + var url = KE.$('url', dialogDoc).value; + this.insert(id, url, title, width, height, 0, align); + } + }, + insert : function(id, url, title, width, height, border, align) { + var html = ' 0) html += 'width="' + width + '" '; + if (height > 0) html += 'height="' + height + '" '; + if (title) html += 'title="' + title + '" '; + if (align) html += 'align="' + align + '" '; + html += 'alt="' + title + '" '; + html += 'border="' + border + '" />'; + KE.util.insertHtml(id, html); + this.dialog.hide(); + KE.util.focus(id); + } +}; + +KE.plugin['link'] = { + getSelectedNode : function(id) { + return KE.getCommonAncestor(KE.g[id].keSel, 'a'); + }, + init : function(id) { + var self = this; + KE.g[id].contextmenuItems.push({ + text : KE.lang['editLink'], + click : function(id, menu) { + KE.util.select(id); + menu.hide(); + self.click(id); + }, + cond : function(id) { + return self.getSelectedNode(id); + }, + options : { + width : '150px', + iconHtml : '' + } + }); + }, + click : function(id) { + KE.util.selection(id); + this.dialog = new KE.dialog({ + id : id, + cmd : 'link', + file : 'link/link.html', + width : 400, + height : 90, + loadingMode : true, + title : KE.lang['link'], + yesButton : KE.lang['yes'], + noButton : KE.lang['no'] + }); + this.dialog.show(); + }, + exec : function(id) { + var g = KE.g[id]; + KE.util.select(id); + var range = g.keRange; + var startNode = range.startNode; + var endNode = range.endNode; + var iframeDoc = g.iframeDoc; + var dialogDoc = KE.util.getIframeDoc(this.dialog.iframe); + var url = KE.$('hyperLink', dialogDoc).value; + var target = KE.$('linkType', dialogDoc).value; + if (!url.match(/.+/) || url.match(/^\w+:\/\/\/?$/)) { + alert(KE.lang['invalidUrl']); + KE.$('hyperLink', dialogDoc).focus(); + return false; + } + var node = range.getParentElement(); + while (node) { + if (node.tagName.toLowerCase() == 'a' || node.tagName.toLowerCase() == 'body') break; + node = node.parentNode; + } + node = node.parentNode; + var isItem; + if (KE.browser.IE) { + isItem = !!g.range.item; + } else { + isItem = (startNode.nodeType == 1 && startNode === endNode && startNode.nodeName.toLowerCase() != 'br'); + } + var isEmpty = !isItem; + if (!isItem) isEmpty = KE.browser.IE ? g.range.text === '' : g.range.toString() === ''; + if (isEmpty || KE.util.isEmpty(id)) { + var html = '
'; + KE.util.insertHtml(id, html); + } else { + iframeDoc.execCommand('createlink', false, '__ke_temp_url__'); + var arr = node.getElementsByTagName('a'); + for (var i = 0, l = arr.length; i < l; i++) { + if (arr[i].href.match(/\/?__ke_temp_url__$/)) { + arr[i].href = url; + arr[i].setAttribute('kesrc', url); + if (target) arr[i].target = target; + else arr[i].removeAttribute('target'); + } + } + if (KE.browser.WEBKIT && isItem && startNode.tagName.toLowerCase() == 'img') { + var parent = startNode.parentNode; + if (parent.tagName.toLowerCase() != 'a') { + var a = KE.$$('a', iframeDoc); + parent.insertBefore(a, startNode); + a.appendChild(startNode); + parent = a; + } + parent.href = url; + parent.setAttribute('kesrc', url); + if (target) parent.target = target; + else parent.removeAttribute('target'); + g.keSel.addRange(range); + } + } + KE.util.execOnchangeHandler(id); + this.dialog.hide(); + KE.util.focus(id); + } +}; + +KE.plugin['unlink'] = { + init : function(id) { + var self = this; + KE.g[id].contextmenuItems.push({ + text : KE.lang['deleteLink'], + click : function(id, menu) { + KE.util.select(id); + menu.hide(); + self.click(id); + }, + cond : function(id) { + return KE.plugin['link'].getSelectedNode(id); + }, + options : { + width : '150px', + iconHtml : '' + } + }); + KE.g[id].contextmenuItems.push('-'); + }, + click : function(id) { + var g = KE.g[id]; + var iframeDoc = g.iframeDoc; + KE.util.selection(id); + var range = g.keRange; + var startNode = range.startNode; + var endNode = range.endNode; + var isItem = (startNode.nodeType == 1 && startNode === endNode); + var isEmpty = !isItem; + if (!isItem) isEmpty = KE.browser.IE ? g.range.text === '' : g.range.toString() === ''; + if (isEmpty) { + var linkNode = KE.plugin['link'].getSelectedNode(id); + if (!linkNode) return; + var range = g.keRange; + range.selectTextNode(linkNode); + g.keSel.addRange(range); + KE.util.select(id); + iframeDoc.execCommand('unlink', false, null); + if (KE.browser.WEBKIT && startNode.tagName.toLowerCase() == 'img') { + var parent = startNode.parentNode; + if (parent.tagName.toLowerCase() == 'a') { + KE.util.removeParent(parent); + g.keSel.addRange(range); + } + } + } else { + iframeDoc.execCommand('unlink', false, null); + } + KE.util.execOnchangeHandler(id); + KE.toolbar.updateState(id); + KE.util.focus(id); + } +}; + +KE.plugin['media'] = { + init : function(id) { + var self = this; + var typeHash = {}; + KE.each(KE.g[id].mediaTypes, function(key, val) { + typeHash[val] = key; + }); + KE.g[id].getHtmlHooks.push(function(html) { + return html.replace(/]*class="?ke-\w+"?[^>]*>/ig, function($0) { + var width = $0.match(/style="[^"]*;?\s*width:\s*(\d+)/i) ? RegExp.$1 : 0; + var height = $0.match(/style="[^"]*;?\s*height:\s*(\d+)/i) ? RegExp.$1 : 0; + width = width || ($0.match(/width="([^"]+)"/i) ? RegExp.$1 : 0); + height = height || ($0.match(/height="([^"]+)"/i) ? RegExp.$1 : 0); + if ($0.match(/\s+kesrctag="([^"]+)"/i)) { + var attrs = KE.util.getAttrList(unescape(RegExp.$1)); + attrs.width = width || attrs.width || 0; + attrs.height = height || attrs.height || 0; + attrs.kesrc = attrs.src; + return KE.util.getMediaEmbed(attrs); + } + }); + }); + KE.g[id].setHtmlHooks.push(function(html) { + return html.replace(/]*type="([^"]+)"[^>]*>(?:<\/embed>)?/ig, function($0, $1) { + if (typeof typeHash[$1] == 'undefined') return $0; + var src = $0.match(/\s+src="([^"]+)"/i) ? RegExp.$1 : ''; + if ($0.match(/\s+kesrc="([^"]+)"/i)) src = RegExp.$1; + var width = $0.match(/\s+width="([^"]+)"/i) ? RegExp.$1 : 0; + var height = $0.match(/\s+height="([^"]+)"/i) ? RegExp.$1 : 0; + var attrs = KE.util.getAttrList($0); + attrs.src = src; + attrs.width = width; + attrs.height = height; + return KE.util.getMediaImage(id, '', attrs); + }); + }); + }, + click : function(id) { + KE.util.selection(id); + this.dialog = new KE.dialog({ + id : id, + cmd : 'media', + file : 'media.html', + width : 400, + height : 170, + loadingMode : true, + title : KE.lang['media'], + yesButton : KE.lang['yes'], + noButton : KE.lang['no'] + }); + this.dialog.show(); + }, + check : function(id, url, width, height) { + var dialogDoc = KE.util.getIframeDoc(this.dialog.iframe); + if (!url.match(/^.{3,}\.(swf|flv|mp3|wav|wma|wmv|mid|avi|mpg|mpeg|asf|rm|rmvb)(\?|$)/i)) { + alert(KE.lang['invalidMedia']); + KE.$('url', dialogDoc).focus(); + return false; + } + if (!width.match(/^\d*$/)) { + alert(KE.lang['invalidWidth']); + KE.$('width', dialogDoc).focus(); + return false; + } + if (!height.match(/^\d*$/)) { + alert(KE.lang['invalidHeight']); + KE.$('height', dialogDoc).focus(); + return false; + } + return true; + }, + exec : function(id) { + var dialogDoc = KE.util.getIframeDoc(this.dialog.iframe); + var url = KE.$('url', dialogDoc).value; + var width = KE.$('width', dialogDoc).value; + var height = KE.$('height', dialogDoc).value; + if (!this.check(id, url, width, height)) return false; + var autostart = KE.$('autostart', dialogDoc).checked ? 'true' : 'false'; + var html = KE.util.getMediaImage(id, '', { + src : url, + type : KE.g[id].mediaTypes[KE.util.getMediaType(url)], + width : width, + height : height, + autostart : autostart, + loop : 'true' + }); + KE.util.insertHtml(id, html); + this.dialog.hide(); + KE.util.focus(id); + } +}; + +KE.plugin['advtable'] = { + getSelectedTable : function(id) { + return KE.getCommonAncestor(KE.g[id].keSel, 'table'); + }, + getSelectedRow : function(id) { + return KE.getCommonAncestor(KE.g[id].keSel, 'tr'); + }, + getSelectedCell : function(id) { + return KE.getCommonAncestor(KE.g[id].keSel, 'td'); + }, + tableprop : function(id) { + this.click(id); + }, + tableinsert : function(id) { + this.click(id, 'insert'); + }, + tabledelete : function(id) { + var table = this.getSelectedTable(id); + table.parentNode.removeChild(table); + }, + tablecolinsert : function(id, offset) { + var table = this.getSelectedTable(id), + cell = this.getSelectedCell(id), + index = cell.cellIndex + offset; + for (var i = 0, len = table.rows.length; i < len; i++) { + var newCell = table.rows[i].insertCell(index); + newCell.innerHTML = ' '; + } + }, + tablecolinsertleft : function(id) { + this.tablecolinsert(id, 0); + }, + tablecolinsertright : function(id) { + this.tablecolinsert(id, 1); + }, + tablerowinsert : function(id, offset) { + var table = this.getSelectedTable(id), + row = this.getSelectedRow(id), + newRow = table.insertRow(row.rowIndex + offset); + for (var i = 0, len = row.cells.length; i < len; i++) { + var cell = newRow.insertCell(i); + cell.innerHTML = ' '; + } + }, + tablerowinsertabove : function(id) { + this.tablerowinsert(id, 0); + }, + tablerowinsertbelow : function(id) { + this.tablerowinsert(id, 1); + }, + tablecoldelete : function(id) { + var table = this.getSelectedTable(id); + var cell = this.getSelectedCell(id); + for (var i = 0, len = table.rows.length; i < len; i++) { + table.rows[i].deleteCell(cell.cellIndex); + } + }, + tablerowdelete : function(id) { + var table = this.getSelectedTable(id); + var row = this.getSelectedRow(id); + table.deleteRow(row.rowIndex); + }, + init : function(id) { + var self = this; + var zeroborder = 'ke-zeroborder'; + var tableCmds = 'prop,colinsertleft,colinsertright,rowinsertabove,rowinsertbelow,coldelete,rowdelete,insert,delete'.split(','); + for (var i = 0, len = tableCmds.length; i < len; i++) { + var name = 'table' + tableCmds[i]; + KE.g[id].contextmenuItems.push({ + text : KE.lang[name], + click : (function(name) { + return function(id, menu) { + KE.util.select(id); + menu.hide(); + if (self[name] !== undefined) self[name](id); + if (!/prop/.test(name)) { + KE.util.execOnchangeHandler(id); + } + }; + })(name), + cond : (function(name) { + if (KE.util.inArray(name, ['tableprop', 'tabledelete'])) { + return function(id) { + return self.getSelectedTable(id); + }; + } else { + return function(id) { + return self.getSelectedCell(id); + }; + } + })(name), + options : { + width : '170px', + iconHtml : '' + } + }); + } + KE.g[id].contextmenuItems.push('-'); + KE.g[id].setHtmlHooks.push(function(html) { + return html.replace(/]*)>/ig, function($0, $1) { + if ($1.match(/\s+border=["']?(\d*)["']?/ig)) { + var border = RegExp.$1; + if ($1.indexOf(zeroborder) < 0 && (border === '' || border === '0')) { + return KE.addClass($0, zeroborder); + } else { + return $0; + } + } else { + return KE.addClass($0, zeroborder); + } + }); + }); + }, + click : function(id, mode) { + mode = mode || 'default'; + var cmd = 'advtable'; + KE.util.selection(id); + this.dialog = new KE.dialog({ + id : id, + cmd : cmd, + file : 'advtable/advtable.html?mode=' + mode, + width : 420, + height : 220, + loadingMode : true, + title : KE.lang['advtable'], + yesButton : KE.lang['yes'], + noButton : KE.lang['no'] + }); + this.dialog.show(); + }, + exec : function(id) { + var zeroborder = 'ke-zeroborder'; + var dialogDoc = KE.util.getIframeDoc(this.dialog.iframe); + var modeBox = KE.$('mode', dialogDoc); + var rowsBox = KE.$('rows', dialogDoc); + var colsBox = KE.$('cols', dialogDoc); + var widthBox = KE.$('width', dialogDoc); + var heightBox = KE.$('height', dialogDoc); + var widthTypeBox = KE.$('widthType', dialogDoc); + var heightTypeBox = KE.$('heightType', dialogDoc); + var paddingBox = KE.$('padding', dialogDoc); + var spacingBox = KE.$('spacing', dialogDoc); + var alignBox = KE.$('align', dialogDoc); + var borderBox = KE.$('border', dialogDoc); + var borderColorBox = KE.$('borderColor', dialogDoc); + var backgroundColorBox = KE.$('backgroundColor', dialogDoc); + var rows = rowsBox.value; + var cols = colsBox.value; + var width = widthBox.value; + var height = heightBox.value; + var widthType = widthTypeBox.value; + var heightType = heightTypeBox.value; + var padding = paddingBox.value; + var spacing = spacingBox.value; + var align = alignBox.value; + var border = borderBox.value; + var borderColor = borderColorBox.innerHTML; + var backgroundColor = backgroundColorBox.innerHTML; + if (rows == '' || rows == 0 || !rows.match(/^\d*$/)) { + alert(KE.lang['invalidRows']); + rowsBox.focus(); + return false; + } + if (cols == '' || cols == 0 || !cols.match(/^\d*$/)) { + alert(KE.lang['invalidCols']); + colsBox.focus(); + return false; + } + if (!width.match(/^\d*$/)) { + alert(KE.lang['invalidWidth']); + widthBox.focus(); + return false; + } + if (!height.match(/^\d*$/)) { + alert(KE.lang['invalidHeight']); + heightBox.focus(); + return false; + } + if (!padding.match(/^\d*$/)) { + alert(KE.lang['invalidPadding']); + paddingBox.focus(); + return false; + } + if (!spacing.match(/^\d*$/)) { + alert(KE.lang['invalidSpacing']); + spacingBox.focus(); + return false; + } + if (!border.match(/^\d*$/)) { + alert(KE.lang['invalidBorder']); + borderBox.focus(); + return false; + } + if (modeBox.value === 'update') { + var table = this.getSelectedTable(id); + if (width !== '') { + table.style.width = width + widthType; + } else if (table.style.width) { + table.style.width = ''; + } + if (table.width !== undefined) { + table.removeAttribute('width'); + } + if (height !== '') { + table.style.height = height + heightType; + } else if (table.style.height) { + table.style.height = ''; + } + if (table.height !== undefined) { + table.removeAttribute('height'); + } + if (backgroundColor !== '') { + table.style.backgroundColor = backgroundColor; + } else if (table.style.backgroundColor) { + table.style.backgroundColor = ''; + } + if (table.bgColor !== undefined) { + table.removeAttribute('bgColor'); + } + if (padding !== '') { + table.cellPadding = padding; + } else { + table.removeAttribute('cellPadding'); + } + if (spacing !== '') { + table.cellSpacing = spacing; + } else { + table.removeAttribute('cellSpacing'); + } + if (align !== '') { + table.align = align; + } else { + table.removeAttribute('align'); + } + if (border === '' || border === '0') { + KE.addClass(table, zeroborder); + } else { + KE.removeClass(table, zeroborder); + } + if (border !== '') { + table.setAttribute('border', border); + } else { + table.removeAttribute('border'); + } + if (borderColor !== '') { + table.setAttribute('borderColor', borderColor); + } else { + table.removeAttribute('borderColor'); + } + KE.util.execOnchangeHandler(id); + } else { + var style = ''; + if (width !== '') style += 'width:' + width + widthType + ';'; + if (height !== '') style += 'height:' + height + heightType + ';'; + if (backgroundColor !== '') style += 'background-color:' + backgroundColor + ';'; + var html = ' + + + + About + + + + + + + diff --git a/www/js/jquery/kindeditor/plugins/advtable/advtable.html b/www/js/jquery/kindeditor/plugins/advtable/advtable.html new file mode 100644 index 0000000000..f05e15fca8 --- /dev/null +++ b/www/js/jquery/kindeditor/plugins/advtable/advtable.html @@ -0,0 +1,233 @@ + + + + + Table + + + + +
+ +
    +
  • + +   +   +
  • +
  • + +   + +   + +
  • +
  • + +   +   +
  • +
  • + + +
  • +
  • + +   +   +
  • +
  • + + +
  • +
+
+ + \ No newline at end of file diff --git a/www/js/jquery/kindeditor/plugins/emoticons/0.gif b/www/js/jquery/kindeditor/plugins/emoticons/0.gif new file mode 100644 index 0000000000..5be27cb0ec Binary files /dev/null and b/www/js/jquery/kindeditor/plugins/emoticons/0.gif differ diff --git a/www/js/jquery/kindeditor/plugins/emoticons/1.gif b/www/js/jquery/kindeditor/plugins/emoticons/1.gif new file mode 100644 index 0000000000..a2644a9ee8 Binary files /dev/null and b/www/js/jquery/kindeditor/plugins/emoticons/1.gif differ diff --git a/www/js/jquery/kindeditor/plugins/emoticons/10.gif b/www/js/jquery/kindeditor/plugins/emoticons/10.gif new file mode 100644 index 0000000000..905c15be3c Binary files /dev/null and b/www/js/jquery/kindeditor/plugins/emoticons/10.gif differ diff --git a/www/js/jquery/kindeditor/plugins/emoticons/100.gif b/www/js/jquery/kindeditor/plugins/emoticons/100.gif new file mode 100644 index 0000000000..92ad35d2bf Binary files /dev/null and b/www/js/jquery/kindeditor/plugins/emoticons/100.gif differ diff --git a/www/js/jquery/kindeditor/plugins/emoticons/101.gif b/www/js/jquery/kindeditor/plugins/emoticons/101.gif new file mode 100644 index 0000000000..1f27663ae0 Binary files /dev/null and b/www/js/jquery/kindeditor/plugins/emoticons/101.gif differ diff --git a/www/js/jquery/kindeditor/plugins/emoticons/102.gif b/www/js/jquery/kindeditor/plugins/emoticons/102.gif new file mode 100644 index 0000000000..748ded1ac4 Binary files /dev/null and b/www/js/jquery/kindeditor/plugins/emoticons/102.gif differ diff --git a/www/js/jquery/kindeditor/plugins/emoticons/103.gif b/www/js/jquery/kindeditor/plugins/emoticons/103.gif new file mode 100644 index 0000000000..be9eaa0544 Binary files /dev/null and b/www/js/jquery/kindeditor/plugins/emoticons/103.gif differ diff --git a/www/js/jquery/kindeditor/plugins/emoticons/104.gif b/www/js/jquery/kindeditor/plugins/emoticons/104.gif new file mode 100644 index 0000000000..d7c2066316 Binary files /dev/null and b/www/js/jquery/kindeditor/plugins/emoticons/104.gif differ diff --git a/www/js/jquery/kindeditor/plugins/emoticons/105.gif b/www/js/jquery/kindeditor/plugins/emoticons/105.gif new file mode 100644 index 0000000000..2f353cadc8 Binary files /dev/null and b/www/js/jquery/kindeditor/plugins/emoticons/105.gif differ diff --git a/www/js/jquery/kindeditor/plugins/emoticons/106.gif b/www/js/jquery/kindeditor/plugins/emoticons/106.gif new file mode 100644 index 0000000000..51935349b4 Binary files /dev/null and b/www/js/jquery/kindeditor/plugins/emoticons/106.gif differ diff --git a/www/js/jquery/kindeditor/plugins/emoticons/107.gif b/www/js/jquery/kindeditor/plugins/emoticons/107.gif new file mode 100644 index 0000000000..70d38d3bb2 Binary files /dev/null and b/www/js/jquery/kindeditor/plugins/emoticons/107.gif differ diff --git a/www/js/jquery/kindeditor/plugins/emoticons/108.gif b/www/js/jquery/kindeditor/plugins/emoticons/108.gif new file mode 100644 index 0000000000..749d500830 Binary files /dev/null and b/www/js/jquery/kindeditor/plugins/emoticons/108.gif differ diff --git a/www/js/jquery/kindeditor/plugins/emoticons/109.gif b/www/js/jquery/kindeditor/plugins/emoticons/109.gif new file mode 100644 index 0000000000..6f57d5642f Binary files /dev/null and b/www/js/jquery/kindeditor/plugins/emoticons/109.gif differ diff --git a/www/js/jquery/kindeditor/plugins/emoticons/11.gif b/www/js/jquery/kindeditor/plugins/emoticons/11.gif new file mode 100644 index 0000000000..b512dd5da1 Binary files /dev/null and b/www/js/jquery/kindeditor/plugins/emoticons/11.gif differ diff --git a/www/js/jquery/kindeditor/plugins/emoticons/110.gif b/www/js/jquery/kindeditor/plugins/emoticons/110.gif new file mode 100644 index 0000000000..e253abcff6 Binary files /dev/null and b/www/js/jquery/kindeditor/plugins/emoticons/110.gif differ diff --git a/www/js/jquery/kindeditor/plugins/emoticons/111.gif b/www/js/jquery/kindeditor/plugins/emoticons/111.gif new file mode 100644 index 0000000000..0c567233d0 Binary files /dev/null and b/www/js/jquery/kindeditor/plugins/emoticons/111.gif differ diff --git a/www/js/jquery/kindeditor/plugins/emoticons/112.gif b/www/js/jquery/kindeditor/plugins/emoticons/112.gif new file mode 100644 index 0000000000..c8ddce88a4 Binary files /dev/null and b/www/js/jquery/kindeditor/plugins/emoticons/112.gif differ diff --git a/www/js/jquery/kindeditor/plugins/emoticons/113.gif b/www/js/jquery/kindeditor/plugins/emoticons/113.gif new file mode 100644 index 0000000000..272710453f Binary files /dev/null and b/www/js/jquery/kindeditor/plugins/emoticons/113.gif differ diff --git a/www/js/jquery/kindeditor/plugins/emoticons/114.gif b/www/js/jquery/kindeditor/plugins/emoticons/114.gif new file mode 100644 index 0000000000..53918e2ae6 Binary files /dev/null and b/www/js/jquery/kindeditor/plugins/emoticons/114.gif differ diff --git a/www/js/jquery/kindeditor/plugins/emoticons/115.gif b/www/js/jquery/kindeditor/plugins/emoticons/115.gif new file mode 100644 index 0000000000..4db3369733 Binary files /dev/null and b/www/js/jquery/kindeditor/plugins/emoticons/115.gif differ diff --git a/www/js/jquery/kindeditor/plugins/emoticons/116.gif b/www/js/jquery/kindeditor/plugins/emoticons/116.gif new file mode 100644 index 0000000000..57326bd2fd Binary files /dev/null and b/www/js/jquery/kindeditor/plugins/emoticons/116.gif differ diff --git a/www/js/jquery/kindeditor/plugins/emoticons/117.gif b/www/js/jquery/kindeditor/plugins/emoticons/117.gif new file mode 100644 index 0000000000..14611b6ef9 Binary files /dev/null and b/www/js/jquery/kindeditor/plugins/emoticons/117.gif differ diff --git a/www/js/jquery/kindeditor/plugins/emoticons/118.gif b/www/js/jquery/kindeditor/plugins/emoticons/118.gif new file mode 100644 index 0000000000..8c255004ce Binary files /dev/null and b/www/js/jquery/kindeditor/plugins/emoticons/118.gif differ diff --git a/www/js/jquery/kindeditor/plugins/emoticons/119.gif b/www/js/jquery/kindeditor/plugins/emoticons/119.gif new file mode 100644 index 0000000000..65bb468b95 Binary files /dev/null and b/www/js/jquery/kindeditor/plugins/emoticons/119.gif differ diff --git a/www/js/jquery/kindeditor/plugins/emoticons/12.gif b/www/js/jquery/kindeditor/plugins/emoticons/12.gif new file mode 100644 index 0000000000..547529cab6 Binary files /dev/null and b/www/js/jquery/kindeditor/plugins/emoticons/12.gif differ diff --git a/www/js/jquery/kindeditor/plugins/emoticons/120.gif b/www/js/jquery/kindeditor/plugins/emoticons/120.gif new file mode 100644 index 0000000000..5ce77c05f0 Binary files /dev/null and b/www/js/jquery/kindeditor/plugins/emoticons/120.gif differ diff --git a/www/js/jquery/kindeditor/plugins/emoticons/121.gif b/www/js/jquery/kindeditor/plugins/emoticons/121.gif new file mode 100644 index 0000000000..a021abaa6d Binary files /dev/null and b/www/js/jquery/kindeditor/plugins/emoticons/121.gif differ diff --git a/www/js/jquery/kindeditor/plugins/emoticons/122.gif b/www/js/jquery/kindeditor/plugins/emoticons/122.gif new file mode 100644 index 0000000000..9a79e111c4 Binary files /dev/null and b/www/js/jquery/kindeditor/plugins/emoticons/122.gif differ diff --git a/www/js/jquery/kindeditor/plugins/emoticons/123.gif b/www/js/jquery/kindeditor/plugins/emoticons/123.gif new file mode 100644 index 0000000000..b9480be254 Binary files /dev/null and b/www/js/jquery/kindeditor/plugins/emoticons/123.gif differ diff --git a/www/js/jquery/kindeditor/plugins/emoticons/124.gif b/www/js/jquery/kindeditor/plugins/emoticons/124.gif new file mode 100644 index 0000000000..7fed477280 Binary files /dev/null and b/www/js/jquery/kindeditor/plugins/emoticons/124.gif differ diff --git a/www/js/jquery/kindeditor/plugins/emoticons/125.gif b/www/js/jquery/kindeditor/plugins/emoticons/125.gif new file mode 100644 index 0000000000..e2c3c11c92 Binary files /dev/null and b/www/js/jquery/kindeditor/plugins/emoticons/125.gif differ diff --git a/www/js/jquery/kindeditor/plugins/emoticons/126.gif b/www/js/jquery/kindeditor/plugins/emoticons/126.gif new file mode 100644 index 0000000000..24105c9888 Binary files /dev/null and b/www/js/jquery/kindeditor/plugins/emoticons/126.gif differ diff --git a/www/js/jquery/kindeditor/plugins/emoticons/127.gif b/www/js/jquery/kindeditor/plugins/emoticons/127.gif new file mode 100644 index 0000000000..0cead364a0 Binary files /dev/null and b/www/js/jquery/kindeditor/plugins/emoticons/127.gif differ diff --git a/www/js/jquery/kindeditor/plugins/emoticons/128.gif b/www/js/jquery/kindeditor/plugins/emoticons/128.gif new file mode 100644 index 0000000000..3185861818 Binary files /dev/null and b/www/js/jquery/kindeditor/plugins/emoticons/128.gif differ diff --git a/www/js/jquery/kindeditor/plugins/emoticons/129.gif b/www/js/jquery/kindeditor/plugins/emoticons/129.gif new file mode 100644 index 0000000000..ffd7c6ba33 Binary files /dev/null and b/www/js/jquery/kindeditor/plugins/emoticons/129.gif differ diff --git a/www/js/jquery/kindeditor/plugins/emoticons/13.gif b/www/js/jquery/kindeditor/plugins/emoticons/13.gif new file mode 100644 index 0000000000..34753001ef Binary files /dev/null and b/www/js/jquery/kindeditor/plugins/emoticons/13.gif differ diff --git a/www/js/jquery/kindeditor/plugins/emoticons/130.gif b/www/js/jquery/kindeditor/plugins/emoticons/130.gif new file mode 100644 index 0000000000..d828e3da10 Binary files /dev/null and b/www/js/jquery/kindeditor/plugins/emoticons/130.gif differ diff --git a/www/js/jquery/xheditor/xheditor_plugins/multiupload/img/bg1.gif b/www/js/jquery/kindeditor/plugins/emoticons/131.gif old mode 100755 new mode 100644 similarity index 67% rename from www/js/jquery/xheditor/xheditor_plugins/multiupload/img/bg1.gif rename to www/js/jquery/kindeditor/plugins/emoticons/131.gif index 3c16444abd..dcb096f0da Binary files a/www/js/jquery/xheditor/xheditor_plugins/multiupload/img/bg1.gif and b/www/js/jquery/kindeditor/plugins/emoticons/131.gif differ diff --git a/www/js/jquery/xheditor/xheditor_plugins/multiupload/img/bg2.gif b/www/js/jquery/kindeditor/plugins/emoticons/132.gif old mode 100755 new mode 100644 similarity index 68% rename from www/js/jquery/xheditor/xheditor_plugins/multiupload/img/bg2.gif rename to www/js/jquery/kindeditor/plugins/emoticons/132.gif index e242c90639..1b272a690b Binary files a/www/js/jquery/xheditor/xheditor_plugins/multiupload/img/bg2.gif and b/www/js/jquery/kindeditor/plugins/emoticons/132.gif differ diff --git a/www/js/jquery/kindeditor/plugins/emoticons/133.gif b/www/js/jquery/kindeditor/plugins/emoticons/133.gif new file mode 100644 index 0000000000..0d0e864264 Binary files /dev/null and b/www/js/jquery/kindeditor/plugins/emoticons/133.gif differ diff --git a/www/js/jquery/kindeditor/plugins/emoticons/134.gif b/www/js/jquery/kindeditor/plugins/emoticons/134.gif new file mode 100644 index 0000000000..cf48356e33 Binary files /dev/null and b/www/js/jquery/kindeditor/plugins/emoticons/134.gif differ diff --git a/www/js/jquery/kindeditor/plugins/emoticons/14.gif b/www/js/jquery/kindeditor/plugins/emoticons/14.gif new file mode 100644 index 0000000000..6a788f8be0 Binary files /dev/null and b/www/js/jquery/kindeditor/plugins/emoticons/14.gif differ diff --git a/www/js/jquery/kindeditor/plugins/emoticons/15.gif b/www/js/jquery/kindeditor/plugins/emoticons/15.gif new file mode 100644 index 0000000000..debab8ed08 Binary files /dev/null and b/www/js/jquery/kindeditor/plugins/emoticons/15.gif differ diff --git a/www/js/jquery/kindeditor/plugins/emoticons/16.gif b/www/js/jquery/kindeditor/plugins/emoticons/16.gif new file mode 100644 index 0000000000..ed5d29f428 Binary files /dev/null and b/www/js/jquery/kindeditor/plugins/emoticons/16.gif differ diff --git a/www/js/jquery/kindeditor/plugins/emoticons/17.gif b/www/js/jquery/kindeditor/plugins/emoticons/17.gif new file mode 100644 index 0000000000..85886fef9d Binary files /dev/null and b/www/js/jquery/kindeditor/plugins/emoticons/17.gif differ diff --git a/www/js/jquery/kindeditor/plugins/emoticons/18.gif b/www/js/jquery/kindeditor/plugins/emoticons/18.gif new file mode 100644 index 0000000000..b6af2189c8 Binary files /dev/null and b/www/js/jquery/kindeditor/plugins/emoticons/18.gif differ diff --git a/www/js/jquery/kindeditor/plugins/emoticons/19.gif b/www/js/jquery/kindeditor/plugins/emoticons/19.gif new file mode 100644 index 0000000000..e045ff2af2 Binary files /dev/null and b/www/js/jquery/kindeditor/plugins/emoticons/19.gif differ diff --git a/www/js/jquery/kindeditor/plugins/emoticons/2.gif b/www/js/jquery/kindeditor/plugins/emoticons/2.gif new file mode 100644 index 0000000000..40cfda436f Binary files /dev/null and b/www/js/jquery/kindeditor/plugins/emoticons/2.gif differ diff --git a/www/js/jquery/kindeditor/plugins/emoticons/20.gif b/www/js/jquery/kindeditor/plugins/emoticons/20.gif new file mode 100644 index 0000000000..efd650f559 Binary files /dev/null and b/www/js/jquery/kindeditor/plugins/emoticons/20.gif differ diff --git a/www/js/jquery/kindeditor/plugins/emoticons/21.gif b/www/js/jquery/kindeditor/plugins/emoticons/21.gif new file mode 100644 index 0000000000..cb8cf6d2a1 Binary files /dev/null and b/www/js/jquery/kindeditor/plugins/emoticons/21.gif differ diff --git a/www/js/jquery/kindeditor/plugins/emoticons/22.gif b/www/js/jquery/kindeditor/plugins/emoticons/22.gif new file mode 100644 index 0000000000..96b04df865 Binary files /dev/null and b/www/js/jquery/kindeditor/plugins/emoticons/22.gif differ diff --git a/www/js/jquery/kindeditor/plugins/emoticons/23.gif b/www/js/jquery/kindeditor/plugins/emoticons/23.gif new file mode 100644 index 0000000000..96516b8d93 Binary files /dev/null and b/www/js/jquery/kindeditor/plugins/emoticons/23.gif differ diff --git a/www/js/jquery/kindeditor/plugins/emoticons/24.gif b/www/js/jquery/kindeditor/plugins/emoticons/24.gif new file mode 100644 index 0000000000..5f925c7bc1 Binary files /dev/null and b/www/js/jquery/kindeditor/plugins/emoticons/24.gif differ diff --git a/www/js/jquery/kindeditor/plugins/emoticons/25.gif b/www/js/jquery/kindeditor/plugins/emoticons/25.gif new file mode 100644 index 0000000000..97f8b1afab Binary files /dev/null and b/www/js/jquery/kindeditor/plugins/emoticons/25.gif differ diff --git a/www/js/jquery/kindeditor/plugins/emoticons/26.gif b/www/js/jquery/kindeditor/plugins/emoticons/26.gif new file mode 100644 index 0000000000..a7cded7312 Binary files /dev/null and b/www/js/jquery/kindeditor/plugins/emoticons/26.gif differ diff --git a/www/js/jquery/kindeditor/plugins/emoticons/27.gif b/www/js/jquery/kindeditor/plugins/emoticons/27.gif new file mode 100644 index 0000000000..bb468901e4 Binary files /dev/null and b/www/js/jquery/kindeditor/plugins/emoticons/27.gif differ diff --git a/www/js/jquery/kindeditor/plugins/emoticons/28.gif b/www/js/jquery/kindeditor/plugins/emoticons/28.gif new file mode 100644 index 0000000000..f59dd58257 Binary files /dev/null and b/www/js/jquery/kindeditor/plugins/emoticons/28.gif differ diff --git a/www/js/jquery/kindeditor/plugins/emoticons/29.gif b/www/js/jquery/kindeditor/plugins/emoticons/29.gif new file mode 100644 index 0000000000..3c5227e8e7 Binary files /dev/null and b/www/js/jquery/kindeditor/plugins/emoticons/29.gif differ diff --git a/www/js/jquery/kindeditor/plugins/emoticons/3.gif b/www/js/jquery/kindeditor/plugins/emoticons/3.gif new file mode 100644 index 0000000000..6d6f762996 Binary files /dev/null and b/www/js/jquery/kindeditor/plugins/emoticons/3.gif differ diff --git a/www/js/jquery/kindeditor/plugins/emoticons/30.gif b/www/js/jquery/kindeditor/plugins/emoticons/30.gif new file mode 100644 index 0000000000..e24a1801c4 Binary files /dev/null and b/www/js/jquery/kindeditor/plugins/emoticons/30.gif differ diff --git a/www/js/jquery/kindeditor/plugins/emoticons/31.gif b/www/js/jquery/kindeditor/plugins/emoticons/31.gif new file mode 100644 index 0000000000..073e743ce5 Binary files /dev/null and b/www/js/jquery/kindeditor/plugins/emoticons/31.gif differ diff --git a/www/js/jquery/kindeditor/plugins/emoticons/32.gif b/www/js/jquery/kindeditor/plugins/emoticons/32.gif new file mode 100644 index 0000000000..772eff23e3 Binary files /dev/null and b/www/js/jquery/kindeditor/plugins/emoticons/32.gif differ diff --git a/www/js/jquery/kindeditor/plugins/emoticons/33.gif b/www/js/jquery/kindeditor/plugins/emoticons/33.gif new file mode 100644 index 0000000000..217c1c5810 Binary files /dev/null and b/www/js/jquery/kindeditor/plugins/emoticons/33.gif differ diff --git a/www/js/jquery/kindeditor/plugins/emoticons/34.gif b/www/js/jquery/kindeditor/plugins/emoticons/34.gif new file mode 100644 index 0000000000..e9d42131a9 Binary files /dev/null and b/www/js/jquery/kindeditor/plugins/emoticons/34.gif differ diff --git a/www/js/jquery/kindeditor/plugins/emoticons/35.gif b/www/js/jquery/kindeditor/plugins/emoticons/35.gif new file mode 100644 index 0000000000..d6da2c33ab Binary files /dev/null and b/www/js/jquery/kindeditor/plugins/emoticons/35.gif differ diff --git a/www/js/jquery/kindeditor/plugins/emoticons/36.gif b/www/js/jquery/kindeditor/plugins/emoticons/36.gif new file mode 100644 index 0000000000..c1e6ac913b Binary files /dev/null and b/www/js/jquery/kindeditor/plugins/emoticons/36.gif differ diff --git a/www/js/jquery/kindeditor/plugins/emoticons/37.gif b/www/js/jquery/kindeditor/plugins/emoticons/37.gif new file mode 100644 index 0000000000..92efec6ae1 Binary files /dev/null and b/www/js/jquery/kindeditor/plugins/emoticons/37.gif differ diff --git a/www/js/jquery/kindeditor/plugins/emoticons/38.gif b/www/js/jquery/kindeditor/plugins/emoticons/38.gif new file mode 100644 index 0000000000..489f0f948d Binary files /dev/null and b/www/js/jquery/kindeditor/plugins/emoticons/38.gif differ diff --git a/www/js/jquery/kindeditor/plugins/emoticons/39.gif b/www/js/jquery/kindeditor/plugins/emoticons/39.gif new file mode 100644 index 0000000000..734f6d82eb Binary files /dev/null and b/www/js/jquery/kindeditor/plugins/emoticons/39.gif differ diff --git a/www/js/jquery/kindeditor/plugins/emoticons/4.gif b/www/js/jquery/kindeditor/plugins/emoticons/4.gif new file mode 100644 index 0000000000..6ccdaa2c9c Binary files /dev/null and b/www/js/jquery/kindeditor/plugins/emoticons/4.gif differ diff --git a/www/js/jquery/kindeditor/plugins/emoticons/40.gif b/www/js/jquery/kindeditor/plugins/emoticons/40.gif new file mode 100644 index 0000000000..24a8eb6914 Binary files /dev/null and b/www/js/jquery/kindeditor/plugins/emoticons/40.gif differ diff --git a/www/js/jquery/kindeditor/plugins/emoticons/41.gif b/www/js/jquery/kindeditor/plugins/emoticons/41.gif new file mode 100644 index 0000000000..99139e1d1e Binary files /dev/null and b/www/js/jquery/kindeditor/plugins/emoticons/41.gif differ diff --git a/www/js/jquery/kindeditor/plugins/emoticons/42.gif b/www/js/jquery/kindeditor/plugins/emoticons/42.gif new file mode 100644 index 0000000000..f60897e40b Binary files /dev/null and b/www/js/jquery/kindeditor/plugins/emoticons/42.gif differ diff --git a/www/js/jquery/kindeditor/plugins/emoticons/43.gif b/www/js/jquery/kindeditor/plugins/emoticons/43.gif new file mode 100644 index 0000000000..4350491002 Binary files /dev/null and b/www/js/jquery/kindeditor/plugins/emoticons/43.gif differ diff --git a/www/js/jquery/kindeditor/plugins/emoticons/44.gif b/www/js/jquery/kindeditor/plugins/emoticons/44.gif new file mode 100644 index 0000000000..650d3dd840 Binary files /dev/null and b/www/js/jquery/kindeditor/plugins/emoticons/44.gif differ diff --git a/www/js/jquery/kindeditor/plugins/emoticons/45.gif b/www/js/jquery/kindeditor/plugins/emoticons/45.gif new file mode 100644 index 0000000000..5c8e071815 Binary files /dev/null and b/www/js/jquery/kindeditor/plugins/emoticons/45.gif differ diff --git a/www/js/jquery/kindeditor/plugins/emoticons/46.gif b/www/js/jquery/kindeditor/plugins/emoticons/46.gif new file mode 100644 index 0000000000..f3cb0742d7 Binary files /dev/null and b/www/js/jquery/kindeditor/plugins/emoticons/46.gif differ diff --git a/www/js/jquery/kindeditor/plugins/emoticons/47.gif b/www/js/jquery/kindeditor/plugins/emoticons/47.gif new file mode 100644 index 0000000000..5b3057ab7e Binary files /dev/null and b/www/js/jquery/kindeditor/plugins/emoticons/47.gif differ diff --git a/www/js/jquery/kindeditor/plugins/emoticons/48.gif b/www/js/jquery/kindeditor/plugins/emoticons/48.gif new file mode 100644 index 0000000000..27a30c15c7 Binary files /dev/null and b/www/js/jquery/kindeditor/plugins/emoticons/48.gif differ diff --git a/www/js/jquery/kindeditor/plugins/emoticons/49.gif b/www/js/jquery/kindeditor/plugins/emoticons/49.gif new file mode 100644 index 0000000000..dcfa48af01 Binary files /dev/null and b/www/js/jquery/kindeditor/plugins/emoticons/49.gif differ diff --git a/www/js/jquery/kindeditor/plugins/emoticons/5.gif b/www/js/jquery/kindeditor/plugins/emoticons/5.gif new file mode 100644 index 0000000000..ab0b81ba4d Binary files /dev/null and b/www/js/jquery/kindeditor/plugins/emoticons/5.gif differ diff --git a/www/js/jquery/kindeditor/plugins/emoticons/50.gif b/www/js/jquery/kindeditor/plugins/emoticons/50.gif new file mode 100644 index 0000000000..029cf0feab Binary files /dev/null and b/www/js/jquery/kindeditor/plugins/emoticons/50.gif differ diff --git a/www/js/jquery/kindeditor/plugins/emoticons/51.gif b/www/js/jquery/kindeditor/plugins/emoticons/51.gif new file mode 100644 index 0000000000..69f183f043 Binary files /dev/null and b/www/js/jquery/kindeditor/plugins/emoticons/51.gif differ diff --git a/www/js/jquery/kindeditor/plugins/emoticons/52.gif b/www/js/jquery/kindeditor/plugins/emoticons/52.gif new file mode 100644 index 0000000000..d41e8aab1e Binary files /dev/null and b/www/js/jquery/kindeditor/plugins/emoticons/52.gif differ diff --git a/www/js/jquery/kindeditor/plugins/emoticons/53.gif b/www/js/jquery/kindeditor/plugins/emoticons/53.gif new file mode 100644 index 0000000000..56352dde46 Binary files /dev/null and b/www/js/jquery/kindeditor/plugins/emoticons/53.gif differ diff --git a/www/js/jquery/kindeditor/plugins/emoticons/54.gif b/www/js/jquery/kindeditor/plugins/emoticons/54.gif new file mode 100644 index 0000000000..b28d8481ea Binary files /dev/null and b/www/js/jquery/kindeditor/plugins/emoticons/54.gif differ diff --git a/www/js/jquery/kindeditor/plugins/emoticons/55.gif b/www/js/jquery/kindeditor/plugins/emoticons/55.gif new file mode 100644 index 0000000000..e18da84c6e Binary files /dev/null and b/www/js/jquery/kindeditor/plugins/emoticons/55.gif differ diff --git a/www/js/jquery/kindeditor/plugins/emoticons/56.gif b/www/js/jquery/kindeditor/plugins/emoticons/56.gif new file mode 100644 index 0000000000..edf96f0a63 Binary files /dev/null and b/www/js/jquery/kindeditor/plugins/emoticons/56.gif differ diff --git a/www/js/jquery/kindeditor/plugins/emoticons/57.gif b/www/js/jquery/kindeditor/plugins/emoticons/57.gif new file mode 100644 index 0000000000..3f0e2b9af4 Binary files /dev/null and b/www/js/jquery/kindeditor/plugins/emoticons/57.gif differ diff --git a/www/js/jquery/kindeditor/plugins/emoticons/58.gif b/www/js/jquery/kindeditor/plugins/emoticons/58.gif new file mode 100644 index 0000000000..47b1aaa34e Binary files /dev/null and b/www/js/jquery/kindeditor/plugins/emoticons/58.gif differ diff --git a/www/js/jquery/kindeditor/plugins/emoticons/59.gif b/www/js/jquery/kindeditor/plugins/emoticons/59.gif new file mode 100644 index 0000000000..918288b007 Binary files /dev/null and b/www/js/jquery/kindeditor/plugins/emoticons/59.gif differ diff --git a/www/js/jquery/kindeditor/plugins/emoticons/6.gif b/www/js/jquery/kindeditor/plugins/emoticons/6.gif new file mode 100644 index 0000000000..ceab12242b Binary files /dev/null and b/www/js/jquery/kindeditor/plugins/emoticons/6.gif differ diff --git a/www/js/jquery/kindeditor/plugins/emoticons/60.gif b/www/js/jquery/kindeditor/plugins/emoticons/60.gif new file mode 100644 index 0000000000..66d21136de Binary files /dev/null and b/www/js/jquery/kindeditor/plugins/emoticons/60.gif differ diff --git a/www/js/jquery/kindeditor/plugins/emoticons/61.gif b/www/js/jquery/kindeditor/plugins/emoticons/61.gif new file mode 100644 index 0000000000..034933ec3e Binary files /dev/null and b/www/js/jquery/kindeditor/plugins/emoticons/61.gif differ diff --git a/www/js/jquery/kindeditor/plugins/emoticons/62.gif b/www/js/jquery/kindeditor/plugins/emoticons/62.gif new file mode 100644 index 0000000000..8d5c4fd39a Binary files /dev/null and b/www/js/jquery/kindeditor/plugins/emoticons/62.gif differ diff --git a/www/js/jquery/kindeditor/plugins/emoticons/63.gif b/www/js/jquery/kindeditor/plugins/emoticons/63.gif new file mode 100644 index 0000000000..d58fcf671b Binary files /dev/null and b/www/js/jquery/kindeditor/plugins/emoticons/63.gif differ diff --git a/www/js/jquery/kindeditor/plugins/emoticons/64.gif b/www/js/jquery/kindeditor/plugins/emoticons/64.gif new file mode 100644 index 0000000000..c4e00bdfda Binary files /dev/null and b/www/js/jquery/kindeditor/plugins/emoticons/64.gif differ diff --git a/www/js/jquery/kindeditor/plugins/emoticons/65.gif b/www/js/jquery/kindeditor/plugins/emoticons/65.gif new file mode 100644 index 0000000000..da23bfaac7 Binary files /dev/null and b/www/js/jquery/kindeditor/plugins/emoticons/65.gif differ diff --git a/www/js/jquery/kindeditor/plugins/emoticons/66.gif b/www/js/jquery/kindeditor/plugins/emoticons/66.gif new file mode 100644 index 0000000000..310ec65f10 Binary files /dev/null and b/www/js/jquery/kindeditor/plugins/emoticons/66.gif differ diff --git a/www/js/jquery/kindeditor/plugins/emoticons/67.gif b/www/js/jquery/kindeditor/plugins/emoticons/67.gif new file mode 100644 index 0000000000..51761ba456 Binary files /dev/null and b/www/js/jquery/kindeditor/plugins/emoticons/67.gif differ diff --git a/www/js/jquery/kindeditor/plugins/emoticons/68.gif b/www/js/jquery/kindeditor/plugins/emoticons/68.gif new file mode 100644 index 0000000000..345cb43910 Binary files /dev/null and b/www/js/jquery/kindeditor/plugins/emoticons/68.gif differ diff --git a/www/js/jquery/kindeditor/plugins/emoticons/69.gif b/www/js/jquery/kindeditor/plugins/emoticons/69.gif new file mode 100644 index 0000000000..e0f28a0736 Binary files /dev/null and b/www/js/jquery/kindeditor/plugins/emoticons/69.gif differ diff --git a/www/js/jquery/kindeditor/plugins/emoticons/7.gif b/www/js/jquery/kindeditor/plugins/emoticons/7.gif new file mode 100644 index 0000000000..2f45399984 Binary files /dev/null and b/www/js/jquery/kindeditor/plugins/emoticons/7.gif differ diff --git a/www/js/jquery/kindeditor/plugins/emoticons/70.gif b/www/js/jquery/kindeditor/plugins/emoticons/70.gif new file mode 100644 index 0000000000..24284cf39d Binary files /dev/null and b/www/js/jquery/kindeditor/plugins/emoticons/70.gif differ diff --git a/www/js/jquery/kindeditor/plugins/emoticons/71.gif b/www/js/jquery/kindeditor/plugins/emoticons/71.gif new file mode 100644 index 0000000000..a0ccf2edf5 Binary files /dev/null and b/www/js/jquery/kindeditor/plugins/emoticons/71.gif differ diff --git a/www/js/jquery/kindeditor/plugins/emoticons/72.gif b/www/js/jquery/kindeditor/plugins/emoticons/72.gif new file mode 100644 index 0000000000..7e113eead2 Binary files /dev/null and b/www/js/jquery/kindeditor/plugins/emoticons/72.gif differ diff --git a/www/js/jquery/kindeditor/plugins/emoticons/73.gif b/www/js/jquery/kindeditor/plugins/emoticons/73.gif new file mode 100644 index 0000000000..c0293c3ab0 Binary files /dev/null and b/www/js/jquery/kindeditor/plugins/emoticons/73.gif differ diff --git a/www/js/jquery/kindeditor/plugins/emoticons/74.gif b/www/js/jquery/kindeditor/plugins/emoticons/74.gif new file mode 100644 index 0000000000..1c52bde9cc Binary files /dev/null and b/www/js/jquery/kindeditor/plugins/emoticons/74.gif differ diff --git a/www/js/jquery/kindeditor/plugins/emoticons/75.gif b/www/js/jquery/kindeditor/plugins/emoticons/75.gif new file mode 100644 index 0000000000..9cb9aa7961 Binary files /dev/null and b/www/js/jquery/kindeditor/plugins/emoticons/75.gif differ diff --git a/www/js/jquery/kindeditor/plugins/emoticons/76.gif b/www/js/jquery/kindeditor/plugins/emoticons/76.gif new file mode 100644 index 0000000000..27019f8ff8 Binary files /dev/null and b/www/js/jquery/kindeditor/plugins/emoticons/76.gif differ diff --git a/www/js/jquery/kindeditor/plugins/emoticons/77.gif b/www/js/jquery/kindeditor/plugins/emoticons/77.gif new file mode 100644 index 0000000000..8f882f5317 Binary files /dev/null and b/www/js/jquery/kindeditor/plugins/emoticons/77.gif differ diff --git a/www/js/jquery/kindeditor/plugins/emoticons/78.gif b/www/js/jquery/kindeditor/plugins/emoticons/78.gif new file mode 100644 index 0000000000..d0d0856045 Binary files /dev/null and b/www/js/jquery/kindeditor/plugins/emoticons/78.gif differ diff --git a/www/js/jquery/kindeditor/plugins/emoticons/79.gif b/www/js/jquery/kindeditor/plugins/emoticons/79.gif new file mode 100644 index 0000000000..61652a7168 Binary files /dev/null and b/www/js/jquery/kindeditor/plugins/emoticons/79.gif differ diff --git a/www/js/jquery/kindeditor/plugins/emoticons/8.gif b/www/js/jquery/kindeditor/plugins/emoticons/8.gif new file mode 100644 index 0000000000..f6c883447c Binary files /dev/null and b/www/js/jquery/kindeditor/plugins/emoticons/8.gif differ diff --git a/www/js/jquery/kindeditor/plugins/emoticons/80.gif b/www/js/jquery/kindeditor/plugins/emoticons/80.gif new file mode 100644 index 0000000000..9a779364b3 Binary files /dev/null and b/www/js/jquery/kindeditor/plugins/emoticons/80.gif differ diff --git a/www/js/jquery/kindeditor/plugins/emoticons/81.gif b/www/js/jquery/kindeditor/plugins/emoticons/81.gif new file mode 100644 index 0000000000..2329101a71 Binary files /dev/null and b/www/js/jquery/kindeditor/plugins/emoticons/81.gif differ diff --git a/www/js/jquery/kindeditor/plugins/emoticons/82.gif b/www/js/jquery/kindeditor/plugins/emoticons/82.gif new file mode 100644 index 0000000000..644748a96c Binary files /dev/null and b/www/js/jquery/kindeditor/plugins/emoticons/82.gif differ diff --git a/www/js/jquery/kindeditor/plugins/emoticons/83.gif b/www/js/jquery/kindeditor/plugins/emoticons/83.gif new file mode 100644 index 0000000000..fbf275ba50 Binary files /dev/null and b/www/js/jquery/kindeditor/plugins/emoticons/83.gif differ diff --git a/www/js/jquery/kindeditor/plugins/emoticons/84.gif b/www/js/jquery/kindeditor/plugins/emoticons/84.gif new file mode 100644 index 0000000000..076f0c65cf Binary files /dev/null and b/www/js/jquery/kindeditor/plugins/emoticons/84.gif differ diff --git a/www/js/jquery/kindeditor/plugins/emoticons/85.gif b/www/js/jquery/kindeditor/plugins/emoticons/85.gif new file mode 100644 index 0000000000..d254af4421 Binary files /dev/null and b/www/js/jquery/kindeditor/plugins/emoticons/85.gif differ diff --git a/www/js/jquery/kindeditor/plugins/emoticons/86.gif b/www/js/jquery/kindeditor/plugins/emoticons/86.gif new file mode 100644 index 0000000000..8f09d336a3 Binary files /dev/null and b/www/js/jquery/kindeditor/plugins/emoticons/86.gif differ diff --git a/www/js/jquery/kindeditor/plugins/emoticons/87.gif b/www/js/jquery/kindeditor/plugins/emoticons/87.gif new file mode 100644 index 0000000000..df70756f0c Binary files /dev/null and b/www/js/jquery/kindeditor/plugins/emoticons/87.gif differ diff --git a/www/js/jquery/kindeditor/plugins/emoticons/88.gif b/www/js/jquery/kindeditor/plugins/emoticons/88.gif new file mode 100644 index 0000000000..4d8b15e7e6 Binary files /dev/null and b/www/js/jquery/kindeditor/plugins/emoticons/88.gif differ diff --git a/www/js/jquery/kindeditor/plugins/emoticons/89.gif b/www/js/jquery/kindeditor/plugins/emoticons/89.gif new file mode 100644 index 0000000000..05726dc4ab Binary files /dev/null and b/www/js/jquery/kindeditor/plugins/emoticons/89.gif differ diff --git a/www/js/jquery/kindeditor/plugins/emoticons/9.gif b/www/js/jquery/kindeditor/plugins/emoticons/9.gif new file mode 100644 index 0000000000..c2d8450752 Binary files /dev/null and b/www/js/jquery/kindeditor/plugins/emoticons/9.gif differ diff --git a/www/js/jquery/kindeditor/plugins/emoticons/90.gif b/www/js/jquery/kindeditor/plugins/emoticons/90.gif new file mode 100644 index 0000000000..adaf20e8bb Binary files /dev/null and b/www/js/jquery/kindeditor/plugins/emoticons/90.gif differ diff --git a/www/js/jquery/kindeditor/plugins/emoticons/91.gif b/www/js/jquery/kindeditor/plugins/emoticons/91.gif new file mode 100644 index 0000000000..608d0ad87c Binary files /dev/null and b/www/js/jquery/kindeditor/plugins/emoticons/91.gif differ diff --git a/www/js/jquery/kindeditor/plugins/emoticons/92.gif b/www/js/jquery/kindeditor/plugins/emoticons/92.gif new file mode 100644 index 0000000000..b909e16a89 Binary files /dev/null and b/www/js/jquery/kindeditor/plugins/emoticons/92.gif differ diff --git a/www/js/jquery/kindeditor/plugins/emoticons/93.gif b/www/js/jquery/kindeditor/plugins/emoticons/93.gif new file mode 100644 index 0000000000..7f71a8c94c Binary files /dev/null and b/www/js/jquery/kindeditor/plugins/emoticons/93.gif differ diff --git a/www/js/jquery/kindeditor/plugins/emoticons/94.gif b/www/js/jquery/kindeditor/plugins/emoticons/94.gif new file mode 100644 index 0000000000..4f26d7d734 Binary files /dev/null and b/www/js/jquery/kindeditor/plugins/emoticons/94.gif differ diff --git a/www/js/jquery/kindeditor/plugins/emoticons/95.gif b/www/js/jquery/kindeditor/plugins/emoticons/95.gif new file mode 100644 index 0000000000..5ef6d3823c Binary files /dev/null and b/www/js/jquery/kindeditor/plugins/emoticons/95.gif differ diff --git a/www/js/jquery/kindeditor/plugins/emoticons/96.gif b/www/js/jquery/kindeditor/plugins/emoticons/96.gif new file mode 100644 index 0000000000..2b709e15ba Binary files /dev/null and b/www/js/jquery/kindeditor/plugins/emoticons/96.gif differ diff --git a/www/js/jquery/kindeditor/plugins/emoticons/97.gif b/www/js/jquery/kindeditor/plugins/emoticons/97.gif new file mode 100644 index 0000000000..cf29be87c8 Binary files /dev/null and b/www/js/jquery/kindeditor/plugins/emoticons/97.gif differ diff --git a/www/js/jquery/kindeditor/plugins/emoticons/98.gif b/www/js/jquery/kindeditor/plugins/emoticons/98.gif new file mode 100644 index 0000000000..c70e7d339f Binary files /dev/null and b/www/js/jquery/kindeditor/plugins/emoticons/98.gif differ diff --git a/www/js/jquery/kindeditor/plugins/emoticons/99.gif b/www/js/jquery/kindeditor/plugins/emoticons/99.gif new file mode 100644 index 0000000000..05c18635da Binary files /dev/null and b/www/js/jquery/kindeditor/plugins/emoticons/99.gif differ diff --git a/www/js/jquery/kindeditor/plugins/emoticons/qq.gif b/www/js/jquery/kindeditor/plugins/emoticons/qq.gif new file mode 100644 index 0000000000..b8c444b5a2 Binary files /dev/null and b/www/js/jquery/kindeditor/plugins/emoticons/qq.gif differ diff --git a/www/js/jquery/kindeditor/plugins/file_manager/file_manager.css b/www/js/jquery/kindeditor/plugins/file_manager/file_manager.css new file mode 100644 index 0000000000..8fb692b751 --- /dev/null +++ b/www/js/jquery/kindeditor/plugins/file_manager/file_manager.css @@ -0,0 +1,64 @@ +body { + font-size:12px; + font-family: "sans serif",tahoma,verdana,helvetica; + margin: 0; + padding: 0; + background-color:#F0F0EE; + overflow: hidden; +} +td { + font-size:12px; +} +.top { + background-color:#F0F0EE; +} +.file-view { + overflow: scroll; + background-color:#FFFFFF; + width: 500px; + height: 370px; +} +.file-view-area { + float:left; + border: 1px solid #FFFFFF; + margin: 5px; +} +.file-view-area .photo { + width: 100px; + height: 100px; + margin: 3px; +} +.file-view-area .name { + margin: 2px; + text-align: center; + overflow: hidden; + width: 100px; + height: 16px; +} +.selected { + border: 1px solid #888888; + background-color: #F0F0EE; +} +.noselected { + border: 1px solid #DDDDDD; + background-color: #FFFFFF; +} +.file-list { + overflow: scroll; + background-color:#FFFFFF; + width: 500px; + height: 370px; +} +.file-list-table { + width: 95%; +} +.file-list-table .name { + width: 55%; +} +.file-list-table .size { + width: 15%; +} +.file-list-table .datetime { + width: 30%; + text-align: center; +} \ No newline at end of file diff --git a/www/js/jquery/kindeditor/plugins/file_manager/file_manager.html b/www/js/jquery/kindeditor/plugins/file_manager/file_manager.html new file mode 100644 index 0000000000..3b38a969c6 --- /dev/null +++ b/www/js/jquery/kindeditor/plugins/file_manager/file_manager.html @@ -0,0 +1,29 @@ + + + + + File Manager + + + + + + + + + + + + + +
+ + + + + +
+
+
+ + diff --git a/www/js/jquery/kindeditor/plugins/file_manager/file_manager.js b/www/js/jquery/kindeditor/plugins/file_manager/file_manager.js new file mode 100644 index 0000000000..121d51f416 --- /dev/null +++ b/www/js/jquery/kindeditor/plugins/file_manager/file_manager.js @@ -0,0 +1,216 @@ +var JSON_URL = '../../php/file_manager_json.php'; + +var KE = parent.KindEditor; +location.href.match(/\?id=([\w-]+)/i); +var id = RegExp.$1; +var fileManagerJson = (typeof KE.g[id].fileManagerJson == 'undefined') ? JSON_URL : KE.g[id].fileManagerJson; +var lang = KE.lang.plugins.file_manager; +KE.event.ready(function() { + var moveupImg = KE.$('moveupImg', document); + var moveupLink = KE.$('moveup', document); + var viewType = KE.$('viewType', document); + var orderType = KE.$('orderType', document); + var listTable = KE.$('listTable', document); + var viewTable = KE.$('viewTable', document); + var listDiv = KE.$('listDiv', document); + var viewDiv = KE.$('viewDiv', document); + moveupImg.alt = moveupImg.title = lang.moveup; + viewType.options[0] = new Option(lang.viewImage, 'VIEW'); + viewType.options[1] = new Option(lang.listImage, 'LIST'); + orderType.options[0] = new Option(lang.fileName, 'NAME'); + orderType.options[1] = new Option(lang.fileSize, 'SIZE'); + orderType.options[2] = new Option(lang.fileType, 'TYPE'); + var changeType = function(type) { + if (type == 'VIEW') { + listDiv.style.display = 'none'; + viewDiv.style.display = ''; + } else { + listDiv.style.display = ''; + viewDiv.style.display = 'none'; + } + }; + var insertLink = function(url) { + var stack = KE.g[id].dialogStack; + if (stack.length > 1) { + var parentDialog = stack[stack.length - 2]; + var dialogDoc = KE.util.getIframeDoc(parentDialog.iframe); + KE.$('url', dialogDoc).value = url; + var currentDialog = stack[stack.length - 1]; + currentDialog.hide(); + return true; + } else { + return false; + } + } + var insertImage = function(url, title) { + if (!insertLink(url)) { + KE.util.insertHtml(id, '' + title + ''); + } + }; + var insertFile = function(url, title) { + if (!insertLink(url)) { + KE.util.insertHtml(id, '' + title + ''); + } + }; + var makeFileTitle = function (filename, filesize, datetime) { + var title = filename + ' (' + Math.ceil(filesize / 1024) + 'KB, ' + datetime + ')'; + return title; + }; + var bindTitle = function (el, data) { + if (data.is_dir) { + el.title = data.filename; + } else { + el.title = makeFileTitle(data.filename, data.filesize, data.datetime); + } + }; + var bindEvent = function (el, result, data, createFunc) { + var fileUrl = result.current_url + data.filename; + fileUrl = KE.format.getUrl(fileUrl, 'absolute'); + if (data.is_dir) { + el.onclick = (function (url, path, title) { + return function () { + reloadPage(path, orderType.value, createFunc); + } + })(fileUrl, escape(result.current_dir_path + data.filename + '/'), data.filename); + } else if (data.is_photo) { + el.onclick = (function (url, title) { + return function () { + insertImage(url, title); + } + })(fileUrl, data.filename); + } else { + el.onclick = (function (url, title) { + return function () { + insertFile(url, title); + } + })(fileUrl, data.filename); + } + }; + var createCommon = function(result, createFunc) { + if (result.current_dir_path) { + moveupLink.onclick = function () { + reloadPage(result.moveup_dir_path, orderType.value, createFunc); + }; + } else { + moveupLink.onclick = null; + } + var onchangeFunc = function() { + changeType(viewType.value); + if (viewType.value == 'VIEW') reloadPage(result.current_dir_path, orderType.value, createView); + else reloadPage(result.current_dir_path, orderType.value, createList); + }; + viewType.onchange = onchangeFunc; + orderType.onchange = onchangeFunc; + }; + var createList = function(responseText) { + listDiv.innerHTML = ''; + var result = KE.util.parseJson(responseText); + createCommon(result, createList); + var table = KE.$$('table', document); + table.className = 'file-list-table'; + table.cellPadding = 0; + table.cellSpacing = 2; + table.border = 0; + listDiv.appendChild(table); + var fileList = result.file_list; + for (var i = 0, len = fileList.length; i < len; i++) { + var data = fileList[i]; + var row = table.insertRow(i); + row.onmouseover = function () { this.className = 'selected'; }; + row.onmouseout = function () { this.className = 'noselected'; }; + var cell0 = row.insertCell(0); + cell0.className = 'name'; + var iconName = data.is_dir ? 'folder-16.gif' : 'file-16.gif'; + var img = KE.$$('img', document); + img.src = './images/' + iconName; + img.width = 16; + img.height = 16; + img.align = 'absmiddle'; + img.alt = data.filename; + cell0.appendChild(img); + cell0.appendChild(document.createTextNode(' ' + data.filename)); + if (!data.is_dir || data.has_file) { + row.style.cursor = 'pointer'; + img.title = data.filename; + cell0.title = data.filename; + bindEvent(cell0, result, data, createList); + } else { + img.title = lang.emptyFolder; + cell0.title = lang.emptyFolder; + } + var cell1 = row.insertCell(1); + cell1.className = 'size'; + cell1.innerHTML = data.is_dir ? '-' : Math.ceil(data.filesize / 1024) + 'KB'; + var cell2 = row.insertCell(2); + cell2.className = 'datetime'; + cell2.innerHTML = data.datetime; + } + }; + var createView = function(responseText) { + viewDiv.innerHTML = ''; + var result = KE.util.parseJson(responseText); + createCommon(result, createView); + var fileList = result.file_list; + for (var i = 0, len = fileList.length; i < len; i++) { + var data = fileList[i]; + var div = KE.$$('div', document); + div.className = 'file-view-area'; + viewDiv.appendChild(div); + var tableObj = KE.util.createTable(document); + var table = tableObj.table; + table.className = 'photo noselected'; + table.onmouseover = function () { this.className = 'photo selected'; }; + table.onmouseout = function () { this.className = 'photo noselected'; }; + var cell = tableObj.cell; + cell.valign = 'middle'; + cell.align = 'center'; + var fileUrl = result.current_url + data.filename; + var iconUrl = data.is_dir ? './images/folder-64.gif' : (data.is_photo ? fileUrl : './images/file-64.gif'); + var img = KE.$$('img', document); + img.src = iconUrl; + img.width = data.is_dir ? 64 : 80; + img.height = data.is_dir ? 64 : 80; + img.alt = data.filename; + if (!data.is_dir || data.has_file) { + table.style.cursor = 'pointer'; + bindTitle(img, data); + bindTitle(table, data); + bindEvent(table, result, data, createView); + } else { + img.title = lang.emptyFolder; + table.title = lang.emptyFolder; + } + cell.appendChild(img); + div.appendChild(table); + var titleDiv = KE.$$('div', document); + titleDiv.className = 'name'; + titleDiv.title = data.filename; + titleDiv.innerHTML = data.filename; + div.appendChild(titleDiv); + } + }; + var httpRequest = function (param, func) { + KE.util.showLoadingPage(id); + var req = window.ActiveXObject ? new ActiveXObject("Microsoft.XMLHTTP") : new XMLHttpRequest(); + var url = fileManagerJson; + url += param; + url += (url.match(/\?/) ? "&" : "?") + (new Date()).getTime() + req.open('GET', url, true); + req.onreadystatechange = function () { + if (req.readyState == 4) { + if(req.status == 200) { + func(req.responseText); + KE.util.pluginLang('file_manager', document); + KE.util.hideLoadingPage(id); + } + } + }; + req.send(null); + }; + var reloadPage = function (path, order, func) { + httpRequest('?path=' + path + '&order=' + order, func); + }; + changeType('VIEW'); + viewType.value = 'VIEW'; + reloadPage('', orderType.value, createView); +}, window, document); \ No newline at end of file diff --git a/www/js/jquery/kindeditor/plugins/file_manager/images/file-16.gif b/www/js/jquery/kindeditor/plugins/file_manager/images/file-16.gif new file mode 100644 index 0000000000..2cf6e47ede Binary files /dev/null and b/www/js/jquery/kindeditor/plugins/file_manager/images/file-16.gif differ diff --git a/www/js/jquery/kindeditor/plugins/file_manager/images/file-64.gif b/www/js/jquery/kindeditor/plugins/file_manager/images/file-64.gif new file mode 100644 index 0000000000..aa838d1b3f Binary files /dev/null and b/www/js/jquery/kindeditor/plugins/file_manager/images/file-64.gif differ diff --git a/www/js/jquery/kindeditor/plugins/file_manager/images/folder-16.gif b/www/js/jquery/kindeditor/plugins/file_manager/images/folder-16.gif new file mode 100644 index 0000000000..850b5a350d Binary files /dev/null and b/www/js/jquery/kindeditor/plugins/file_manager/images/folder-16.gif differ diff --git a/www/js/jquery/kindeditor/plugins/file_manager/images/folder-64.gif b/www/js/jquery/kindeditor/plugins/file_manager/images/folder-64.gif new file mode 100644 index 0000000000..11d3f17dfe Binary files /dev/null and b/www/js/jquery/kindeditor/plugins/file_manager/images/folder-64.gif differ diff --git a/www/js/jquery/kindeditor/plugins/file_manager/images/go-up.gif b/www/js/jquery/kindeditor/plugins/file_manager/images/go-up.gif new file mode 100644 index 0000000000..92ae23d76b Binary files /dev/null and b/www/js/jquery/kindeditor/plugins/file_manager/images/go-up.gif differ diff --git a/www/js/jquery/kindeditor/plugins/flash.html b/www/js/jquery/kindeditor/plugins/flash.html new file mode 100644 index 0000000000..4240d94384 --- /dev/null +++ b/www/js/jquery/kindeditor/plugins/flash.html @@ -0,0 +1,72 @@ + + + + + Flash + + + + +
+
    +
  • + + +
  • +
  • +   + px +
  • +
  • +   + px +
  • +
+
+ + diff --git a/www/js/jquery/kindeditor/plugins/image/image.html b/www/js/jquery/kindeditor/plugins/image/image.html new file mode 100644 index 0000000000..53161a5415 --- /dev/null +++ b/www/js/jquery/kindeditor/plugins/image/image.html @@ -0,0 +1,268 @@ + + + + + Image + + + + +
+
+
    +
  • +
  • +
+
+ + + + + + +
    +
  • + + +
  • +
  • +   + + + +
  • +
  • +   + + + +
  • +
  • + + +
  • +
+ +
+ + diff --git a/www/js/jquery/kindeditor/plugins/image/images/align_left.gif b/www/js/jquery/kindeditor/plugins/image/images/align_left.gif new file mode 100644 index 0000000000..ab17f56797 Binary files /dev/null and b/www/js/jquery/kindeditor/plugins/image/images/align_left.gif differ diff --git a/www/js/jquery/kindeditor/plugins/image/images/align_right.gif b/www/js/jquery/kindeditor/plugins/image/images/align_right.gif new file mode 100644 index 0000000000..e8ebe6a636 Binary files /dev/null and b/www/js/jquery/kindeditor/plugins/image/images/align_right.gif differ diff --git a/www/js/jquery/kindeditor/plugins/image/images/align_top.gif b/www/js/jquery/kindeditor/plugins/image/images/align_top.gif new file mode 100644 index 0000000000..d8826a5bce Binary files /dev/null and b/www/js/jquery/kindeditor/plugins/image/images/align_top.gif differ diff --git a/www/js/jquery/kindeditor/plugins/image/images/refresh.gif b/www/js/jquery/kindeditor/plugins/image/images/refresh.gif new file mode 100644 index 0000000000..201ebfe71d Binary files /dev/null and b/www/js/jquery/kindeditor/plugins/image/images/refresh.gif differ diff --git a/www/js/jquery/kindeditor/plugins/link/link.html b/www/js/jquery/kindeditor/plugins/link/link.html new file mode 100644 index 0000000000..a7c0ab73ef --- /dev/null +++ b/www/js/jquery/kindeditor/plugins/link/link.html @@ -0,0 +1,86 @@ + + + + + Link + + + + +
+
    +
  • + + +
  • +
  • +   + +
  • +
+
+ + \ No newline at end of file diff --git a/www/js/jquery/kindeditor/plugins/media.html b/www/js/jquery/kindeditor/plugins/media.html new file mode 100644 index 0000000000..2a94016ac6 --- /dev/null +++ b/www/js/jquery/kindeditor/plugins/media.html @@ -0,0 +1,76 @@ + + + + + Media + + + + +
+
    +
  • + + +
  • +
  • +   + px +
  • +
  • +   + px +
  • +
  • +   + +
  • +
+
+ + diff --git a/www/js/jquery/kindeditor/plugins/plainpaste.html b/www/js/jquery/kindeditor/plugins/plainpaste.html new file mode 100644 index 0000000000..dd7d095971 --- /dev/null +++ b/www/js/jquery/kindeditor/plugins/plainpaste.html @@ -0,0 +1,43 @@ + + + + + PlainPaste + + + + +
+ + + diff --git a/www/js/jquery/kindeditor/plugins/wordpaste.html b/www/js/jquery/kindeditor/plugins/wordpaste.html new file mode 100644 index 0000000000..921a80b7fb --- /dev/null +++ b/www/js/jquery/kindeditor/plugins/wordpaste.html @@ -0,0 +1,50 @@ + + + + + WordPaste + + + + +
+ + + diff --git a/www/js/jquery/kindeditor/skins/common/blank.gif b/www/js/jquery/kindeditor/skins/common/blank.gif new file mode 100644 index 0000000000..5bfd67a2d6 Binary files /dev/null and b/www/js/jquery/kindeditor/skins/common/blank.gif differ diff --git a/www/js/jquery/kindeditor/skins/common/editor.css b/www/js/jquery/kindeditor/skins/common/editor.css new file mode 100644 index 0000000000..bc4acc015d --- /dev/null +++ b/www/js/jquery/kindeditor/skins/common/editor.css @@ -0,0 +1,47 @@ +html { + margin: 0; + padding: 0; +} +body { + margin: 0; + padding: 5px; + background-color: #FFFFFF; + color: #000000; + font: 12px/1.5 "sans serif",tahoma,verdana,helvetica; +} +td { + font: 12px/1.5 "sans serif",tahoma,verdana,helvetica; +} +p { + margin: 5px 0; +} +.ke-flash { + border:1px solid #AAAAAA; + background-image:url(./flash.gif); + background-position:center center; + background-repeat:no-repeat; + width:100px; + height:100px; +} +.ke-rm { + border:1px solid #AAAAAA; + background-image:url(./rm.gif); + background-position:center center; + background-repeat:no-repeat; + width:100px; + height:100px; +} +.ke-media { + border:1px solid #AAAAAA; + background-image:url(./media.gif); + background-position:center center; + background-repeat:no-repeat; + width:100px; + height:100px; +} +table { + border-collapse:collapse; +} +table.ke-zeroborder td { + border:1px dotted #AAAAAA; +} \ No newline at end of file diff --git a/www/js/jquery/kindeditor/skins/common/flash.gif b/www/js/jquery/kindeditor/skins/common/flash.gif new file mode 100644 index 0000000000..2cb12b2842 Binary files /dev/null and b/www/js/jquery/kindeditor/skins/common/flash.gif differ diff --git a/www/js/jquery/kindeditor/skins/common/loading.gif b/www/js/jquery/kindeditor/skins/common/loading.gif new file mode 100644 index 0000000000..e192ca895c Binary files /dev/null and b/www/js/jquery/kindeditor/skins/common/loading.gif differ diff --git a/www/js/jquery/kindeditor/skins/common/media.gif b/www/js/jquery/kindeditor/skins/common/media.gif new file mode 100644 index 0000000000..e1c0e30afb Binary files /dev/null and b/www/js/jquery/kindeditor/skins/common/media.gif differ diff --git a/www/js/jquery/kindeditor/skins/common/rm.gif b/www/js/jquery/kindeditor/skins/common/rm.gif new file mode 100644 index 0000000000..d013d551de Binary files /dev/null and b/www/js/jquery/kindeditor/skins/common/rm.gif differ diff --git a/www/js/jquery/kindeditor/skins/default.css b/www/js/jquery/kindeditor/skins/default.css new file mode 100644 index 0000000000..aa94ca1e20 --- /dev/null +++ b/www/js/jquery/kindeditor/skins/default.css @@ -0,0 +1,918 @@ +.ke-text { + font-size: 12px; + font-family: "sans serif",tahoma,verdana,helvetica; +} +.ke-icon-source { + background-position: 0px 0px; + width: 16px; + height: 16px; +} +.ke-icon-print { + background-position: 0px -32px; + width: 16px; + height: 16px; +} +.ke-icon-undo { + background-position: 0px -48px; + width: 16px; + height: 16px; +} +.ke-icon-redo { + background-position: 0px -64px; + width: 16px; + height: 16px; +} +.ke-icon-cut { + background-position: 0px -80px; + width: 16px; + height: 16px; +} +.ke-icon-copy { + background-position: 0px -96px; + width: 16px; + height: 16px; +} +.ke-icon-paste { + background-position: 0px -112px; + width: 16px; + height: 16px; +} +.ke-icon-selectall { + background-position: 0px -128px; + width: 16px; + height: 16px; +} +.ke-icon-justifyleft { + background-position: 0px -144px; + width: 16px; + height: 16px; +} +.ke-icon-justifycenter { + background-position: 0px -160px; + width: 16px; + height: 16px; +} +.ke-icon-justifyright { + background-position: 0px -176px; + width: 16px; + height: 16px; +} +.ke-icon-justifyfull { + background-position: 0px -192px; + width: 16px; + height: 16px; +} +.ke-icon-insertorderedlist { + background-position: 0px -208px; + width: 16px; + height: 16px; +} +.ke-icon-insertunorderedlist { + background-position: 0px -224px; + width: 16px; + height: 16px; +} +.ke-icon-indent { + background-position: 0px -240px; + width: 16px; + height: 16px; +} +.ke-icon-outdent { + background-position: 0px -256px; + width: 16px; + height: 16px; +} +.ke-icon-subscript { + background-position: 0px -272px; + width: 16px; + height: 16px; +} +.ke-icon-superscript { + background-position: 0px -288px; + width: 16px; + height: 16px; +} +.ke-icon-title { + background-position: 0px -336px; + width: 25px; + height: 16px; +} +.ke-icon-fontname { + background-position: 0px -352px; + width: 21px; + height: 16px; +} +.ke-icon-fontsize { + background-position: 0px -368px; + width: 23px; + height: 16px; +} +.ke-icon-textcolor { + background-position: 0px -384px; + width: 20px; + height: 16px; +} +.ke-icon-bgcolor { + background-position: 0px -400px; + width: 20px; + height: 16px; +} +.ke-icon-bold { + background-position: 0px -416px; + width: 16px; + height: 16px; +} +.ke-icon-italic { + background-position: 0px -432px; + width: 16px; + height: 16px; +} +.ke-icon-underline { + background-position: 0px -448px; + width: 16px; + height: 16px; +} +.ke-icon-strikethrough { + background-position: 0px -464px; + width: 16px; + height: 16px; +} +.ke-icon-removeformat { + background-position: 0px -480px; + width: 16px; + height: 16px; +} +.ke-icon-image { + background-position: 0px -496px; + width: 16px; + height: 16px; +} +.ke-icon-flash { + background-position: 0px -512px; + width: 16px; + height: 16px; +} +.ke-icon-media { + background-position: 0px -528px; + width: 16px; + height: 16px; +} +.ke-icon-hr { + background-position: 0px -592px; + width: 16px; + height: 16px; +} +.ke-icon-emoticons { + background-position: 0px -608px; + width: 16px; + height: 16px; +} +.ke-icon-link { + background-position: 0px -624px; + width: 16px; + height: 16px; +} +.ke-icon-unlink { + background-position: 0px -640px; + width: 16px; + height: 16px; +} +.ke-icon-fullscreen { + background-position: 0px -656px; + width: 16px; + height: 16px; +} +.ke-icon-about { + background-position: 0px -672px; + width: 16px; + height: 16px; +} +.ke-icon-plainpaste { + background-position: 0px -704px; + width: 16px; + height: 16px; +} +.ke-icon-wordpaste { + background-position: 0px -720px; + width: 16px; + height: 16px; +} +.ke-icon-advtable { + background-position: 0px -784px; + width: 16px; + height: 16px; +} +.ke-icon-tablemenu { + background-position: 0px -768px; + width: 16px; + height: 16px; +} +.ke-icon-tableinsert { + background-position: 0px -784px; + width: 16px; + height: 16px; +} +.ke-icon-tabledelete { + background-position: 0px -800px; + width: 16px; + height: 16px; +} +.ke-icon-tablecolinsertleft { + background-position: 0px -816px; + width: 16px; + height: 16px; +} +.ke-icon-tablecolinsertright { + background-position: 0px -832px; + width: 16px; + height: 16px; +} +.ke-icon-tablerowinsertabove { + background-position: 0px -848px; + width: 16px; + height: 16px; +} +.ke-icon-tablerowinsertbelow { + background-position: 0px -864px; + width: 16px; + height: 16px; +} +.ke-icon-tablecoldelete { + background-position: 0px -880px; + width: 16px; + height: 16px; +} +.ke-icon-tablerowdelete { + background-position: 0px -896px; + width: 16px; + height: 16px; +} +.ke-icon-tablecellprop { + background-position: 0px -912px; + width: 16px; + height: 16px; +} +.ke-icon-tableprop { + background-position: 0px -928px; + width: 16px; + height: 16px; +} +.ke-icon-checked { + background-position: 0px -944px; + width: 16px; + height: 16px; +} +.ke-container { + font-family: "sans serif",tahoma,verdana,helvetica; + border: 1px solid #CCCCCC; + background-color: #F0F0EE; + table-layout: fixed; + overflow: hidden; + border-collapse:separate; + padding:0; + margin:0; +} +.ke-toolbar-outer { + border: 0; + padding: 0; + margin: 0; +} +.ke-toolbar { + width: 100%; + border:0; + padding:0; + margin:0; + border-collapse:separate; +} +.ke-toolbar td { + border:0; + padding: 2px 5px; + margin:0; +} +.ke-toolbar-table { + font-size: 0; + line-height: 0; + float: left; + clear: both; + border:0; + padding:0; + margin:0; + border-collapse:separate; +} +.ke-toolbar-separator { + border-left: 1px solid #A0A0A0; + border-right: 1px solid #FFFFFF; + border-top:0; + border-bottom:0; + width: 0; + padding: 0; + margin: 0 2px; + height: 16px; +} +.ke-toolbar-table td { + border:0; + padding: 0; + margin:0; +} +.ke-bottom-outer { + border: 0; + padding: 0; + margin: 0; +} +.ke-bottom { + width: 100%; + font-size: 0; + line-height: 0; + border: 0; + padding:0; + margin:0; + height:11px; + border-collapse:separate; +} +.ke-bottom-left { + width: 100%; + cursor: s-resize; + border:0; + margin:0; + padding:0; + text-align: center; + vertical-align: middle; +} +.ke-bottom-left-img { + display: -moz-inline-stack; + display: inline-block; + vertical-align: middle; + zoom: 1; + *display: inline; + background-position: -0px -754px; + width: 15px; + height: 11px; + background-image: url(./default/default.gif); + margin: 0; + padding: 0; + border: 0; +} +.ke-bottom-right { + cursor: se-resize; + border:0; + margin:0; + padding:0; + text-align: right; + vertical-align: bottom; +} +.ke-bottom-right-img { + display: -moz-inline-stack; + display: inline-block; + vertical-align: middle; + zoom: 1; + *display: inline; + background-position: -9px -745px; + width: 7px; + height: 7px; + background-image: url(./default/default.gif); + margin: 0; + padding: 0; + border: 0; +} +.ke-textarea-outer { + border: 0; + padding: 0; + margin: 0; +} +.ke-textarea-table { + width: 100%; + padding: 0; + margin: 0; + border-top: 1px solid #CCCCCC; + border-bottom: 1px solid #CCCCCC; + border-left:0; + border-right:0; + background-color: #FFFFFF; + border-collapse:separate; + table-layout: fixed; +} +.ke-textarea-table td { + border:0; + padding:0; + margin:0; +} +.ke-textarea { + width: 100%; + display: block; + margin: 0; + padding: 0; + border: 0; + background-color: #FFFFFF; + color: #000000; + font-size: 12px; + font-family: "Consolas", "Monaco", "Bitstream Vera Sans Mono", "Courier New", Courier, monospace !important; + line-height: 18px; + overflow: auto; + resize: none; +} +.ke-textarea:focus { + outline: none; +} +.ke-iframe { + width: 100%; + display: block; + margin: 0; + padding: 0; + border: 0; + background-color: #FFFFFF; +} +.ke-common-icon { + margin: 0; + padding: 0; + border: 0; + background-repeat: no-repeat; + overflow: hidden; + display: -moz-inline-stack; + display: inline-block; + vertical-align: middle; + zoom: 1; + *display: inline; +} +.ke-common-icon-url { + background-image: url(./default/default.gif); +} +.ke-icon { + display: block; + border: 1px solid #F0F0EE; + background-color: transparent; + padding: 1px 2px; + margin: 1px; + cursor: pointer; +} +.ke-icon-on { + border: 1px solid #5690D2; +} +.ke-icon-selected { + border: 1px solid #5690D2; + background-color: #E9EFF6; +} +.ke-icon-disabled { + border: 1px solid #F0F0EE; + cursor: default; +} +.ke-menu { + position: absolute; + border: 1px solid #A0A0A0; + background-color: #F1F1F1; + color: #222222; + padding: 2px; + margin: 0; + font-family: "sans serif",tahoma,verdana,helvetica; + font-size: 12px; + text-align: left; + z-index: 19811214; +} +.ke-menu-item { + border: 1px solid #F1F1F1; + background-color: #F1F1F1; + color: #222222; + padding: 0; + margin: 0; + height: 24px; + overflow: hidden; + cursor: pointer; +} +.ke-menu-item-on { + border: 1px solid #5690D2; + background-color: #E9EFF6; +} +.ke-menu-left { + border: 0; + margin: 0; + padding: 0; + width: 20px; + overflow: hidden; + display: -moz-inline-stack; + display: inline-block; + vertical-align: middle; + zoom: 1; + *display: inline; +} +.ke-menu-center { + margin: 0; + padding: 0; + width: 0; + height: 24px; + border-top: 0; + border-bottom: 0; + border-left: 1px solid #F1F1F1; + border-right: 1px solid #F1F1F1; + display: -moz-inline-stack; + display: inline-block; + vertical-align: middle; + zoom: 1; + *display: inline; +} +.ke-menu-center-on { + border-left: 1px solid #E9EFF6; + border-right: 1px solid #E9EFF6; +} +.ke-menu-right { + border: 0; + margin: 0; + padding: 0; + line-height: 24px; + text-align: left; + overflow: hidden; + display: -moz-inline-stack; + display: inline-block; + vertical-align: middle; + zoom: 1; + *display: inline; +} +.ke-menu-separator { + margin: 2px 0; + padding: 0; + height: 0; + overflow: hidden; + border-top: 1px solid #CCCCCC; + border-bottom: 1px solid #FFFFFF; + border-left: 0; + border-right: 0; +} +.ke-contextmenu { + position: absolute; + border: 1px solid #A0A0A0; + background-color: #F1F1F1; + color: #222222; + padding: 2px; + margin: 0; + width: 200px; + font-family: "sans serif",tahoma,verdana,helvetica; + font-size: 12px; + text-align: left; + z-index: 19811214; +} +.ke-contextmenu-item { + border: 1px solid #F1F1F1; + background-color: #F1F1F1; + color: #222222; + padding: 0; + margin: 0; + height: 24px; + overflow: hidden; + cursor: pointer; +} +.ke-contextmenu-item-on { + border: 1px solid #5690D2; + background-color: #E9EFF6; +} +.ke-contextmenu-left { + border: 0; + margin: 0; + padding: 0; + width: 27px; + text-align: center; + overflow: hidden; + display: -moz-inline-stack; + display: inline-block; + vertical-align: middle; + zoom: 1; + *display: inline; +} +.ke-contextmenu-center { + margin: 0; + padding: 0; + width: 0; + height: 24px; + border-left: 1px solid #E3E3E3; + border-right: 1px solid #FFFFFF; + border-top: 0; + border-bottom: 0; + display: -moz-inline-stack; + display: inline-block; + vertical-align: middle; + zoom: 1; + *display: inline; +} +.ke-contextmenu-center-on { + border-left: 1px solid #E9EFF6; + border-right: 1px solid #E9EFF6; +} +.ke-contextmenu-right { + border: 0; + margin: 0; + padding: 0 0 0 5px; + line-height: 24px; + text-align: left; + overflow: hidden; + display: -moz-inline-stack; + display: inline-block; + vertical-align: middle; + zoom: 1; + *display: inline; +} +.ke-contextmenu-separator { + margin: 2px 0; + padding: 0; + height: 0; + overflow: hidden; + border-top: 1px solid #CCCCCC; + border-bottom: 1px solid #FFFFFF; + border-left: 0; + border-right: 0; +} +.ke-dialog { + position: absolute; + border:0; + margin:0; + padding:0; +} +.ke-dialog-no-shadow { + border: 1px solid #A0A0A0; + background-color: #F0F0EE; + color: #222222; +} +.ke-dialog-table { + border:0; + padding:0; + margin:0; + border-collapse:separate; + empty-cells:show; +} +span.ke-dialog-empty { + display:block; + width:5px; + height:5px; + line-height:0; + margin: 0; + padding: 0; + border: 0; +} +.ke-mc { + border: 1px solid #F0F0EE; + margin:0; + padding:0; + background-color: #F0F0EE; + color: #222222; +} +.ke-tl, .ke-tc, .ke-tr, .ke-ml, .ke-mr, .ke-bl, .ke-bc, .ke-br { + background-color:#000; + filter:alpha(opacity=20); + opacity:0.2; + font-size:0; + line-height:0; + overflow:hidden; + border:0; + margin:0; + padding:0; +} +.ke-ml, .ke-mr { + width:5px; +} +.ke-tc, .ke-bc { + height:5px; +} +.ke-tl, .ke-tr, .ke-bl, .ke-br { + width:5px; + height:5px; +} +.ke-tl { + -moz-border-radius:5px 0 0 0; + border-radius:5px 0 0 0; +} +.ke-tr { + -moz-border-radius:0 5px 0 0; + border-radius:0 5px 0 0; +} +.ke-bl { + -moz-border-radius:0 0 0 5px; + border-radius:0 0 0 5px; +} +.ke-br { + -moz-border-radius:0 0 5px 0; + border-radius:0 0 5px 0; +} +.ke-dialog-title { + border:0; + margin:0; + padding:0; + background-color: #F0F0EE; + padding: 10px; + text-align: left; + font: 14px/1 "sans serif",tahoma,verdana,helvetica; + font-weight: bold; + color: #222222; + cursor: move; +} +.ke-dialog-close { + display: block; + background-position: 0px -688px; + width: 16px; + height: 16px; + position: absolute; + border: 0; + margin: 0; + padding: 0; + right: 15px; + top: 15px; + cursor: pointer; + background-image: url(./default/default.gif); + overflow: hidden; +} +.ke-dialog-close-shadow { + right: 15px; + top: 15px; +} +.ke-dialog-close-no-shadow { + right: 10px; + top: 10px; +} +.ke-dialog-body { + border:0; + margin:0; + padding:0; + margin: 10px 10px 0 10px; +} +.ke-dialog-iframe { + display: block; + margin: 0; + padding: 0; +} +.ke-dialog-iframe-border { + border: 1px solid #A0A0A0; +} +.ke-dialog-bottom { + border:0; + margin:0; + padding:0; + font: 12px/1 "sans serif",tahoma,verdana,helvetica; + text-align: right; + padding:0 0 5px 0; +} +.ke-dialog-preview { + margin: 5px; +} +.ke-dialog-yes { + margin: 5px; +} +.ke-dialog-no { + margin: 5px 10px 5px 5px; +} +.ke-mask { + border:0; + margin:0; + padding:0; + position: absolute; + z-index: 19811212; + top: 0; + left: 0; + display: none; + background-color: #FFFFFF; +} +.ke-button { + font-family: "sans serif",tahoma,verdana,helvetica; + font-size: 12px; + line-height: 1; + padding: 2px 10px; +} +.ke-text-input { + background-color:#FFFFFF; + font-family: "sans serif",tahoma,verdana,helvetica; + font-size: 12px; + line-height: 1; +} +.ke-colorpicker { + position: absolute; + border: 1px solid #A0A0A0; + background-color: #F1F1F1; + color: #222222; + padding: 2px; + margin: 0; + font-size: 12px; + text-align: left; +} +.ke-colorpicker-table { + border:0; + margin:0; + padding:0; + border-collapse: separate; +} +.ke-colorpicker-cell { + font-size: 0; + line-height: 0; + border: 1px solid #F0F0EE; + cursor: pointer; + margin:3px; + padding:0; +} +.ke-colorpicker-cell-top { + font-family: "sans serif",tahoma,verdana,helvetica; + font-size: 12px; + line-height: 24px; + border: 1px solid #F0F0EE; + cursor: pointer; + margin:0; + padding:0; + text-align: center; +} +.ke-colorpicker-cell-on { + border: 1px solid #5690D2; +} +.ke-colorpicker-cell-selected { + border: 1px solid #2446AB; +} +.ke-colorpicker-cell-color { + width: 14px; + height: 14px; + margin: 3px; + padding: 0; + border: 0; +} +.ke-loading-table { + border:0; + margin:0; + padding:0; + border-collapse: separate; +} +.ke-loading-table td{ + border:0; + margin:0; + padding:0; + font-size: 12px; + text-align: center; + vertical-align: middle; +} +.ke-loading-img { + display: -moz-inline-stack; + display: inline-block; + vertical-align: middle; + zoom: 1; + *display: inline; + background-repeat: no-repeat; + background-image: url(./common/loading.gif); + width: 16px; + height: 16px; + margin: 0; + padding: 0; + border: 0; +} +.ke-reset { + margin: 0; + padding: 0; + border: 0; +} +.ke-plugin-emoticons-wrapper { + position: relative; + margin: 0; + padding: 0; + border: 0; +} +.ke-plugin-emoticons-preview { + position: absolute; + text-align: center; + margin: 2px; + padding: 10px; + top: 0; + border: 1px solid #A0A0A0; + background-color: #FFFFFF; + display: none; +} +.ke-plugin-emoticons-table { + border:0; + margin:0; + padding:0; + border-collapse:separate; +} +.ke-plugin-emoticons-cell { + margin:0; + padding:1px; + border:1px solid #F0F0EE; + cursor:pointer; +} +.ke-plugin-emoticons-cell-on { + border: 1px solid #5690D2; + background-color: #E9EFF6; +} +.ke-plugin-emoticons-img { + display:block; + background-repeat:no-repeat; + overflow:hidden; + margin:2px; + width:24px; + height:24px; + background-image:url(../plugins/emoticons/qq.gif); + margin: 0; + padding: 0; + border: 0; +} +.ke-plugin-emoticons-page { + text-align: right; + margin: 5px; + padding: 0; + border: 0; + font-family: "sans serif",tahoma,verdana,helvetica; + font-size:12px; + line-height: 1; + color: #333333; + text-decoration: none; +} +.ke-plugin-emoticons-page a { + color: #337FE5; + text-decoration: none; +} diff --git a/www/js/jquery/kindeditor/skins/default/default.gif b/www/js/jquery/kindeditor/skins/default/default.gif new file mode 100644 index 0000000000..f007c28475 Binary files /dev/null and b/www/js/jquery/kindeditor/skins/default/default.gif differ diff --git a/www/js/jquery/xheditor/xheditor-en.min.js b/www/js/jquery/xheditor/xheditor-en.min.js deleted file mode 100644 index 010536cbcc..0000000000 --- a/www/js/jquery/xheditor/xheditor-en.min.js +++ /dev/null @@ -1,93 +0,0 @@ -(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","

");else{b.pasteHTML("
");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('');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=[''],d,g,m=/Separator|BtnBr/i;e.each(b.settings.tools,function(i,f){d=ha[f];f.match(m)&&c.push('');if(f=="Separator")c.push('');else if(f=="BtnBr")c.push("
");else{g=d.c?d.c:"xheIcon xheBtn"+f;c.push('');d.s&& -b.addShortcuts(d.s,f)}f.match(m)&&c.push('')});c.push('
');P.after(e(''));J=e("#"+Pa);O=e("#"+Qa);a='';var j=b.settings.loadCSS;if(j)if($(j,"array"))for(var l in j)a+='';else a+=j.match(/\s*]*?)?>[\s\S]+?<\/style>\s*/i)?j:'';a+='';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('

').mousedown(function(i){i.stopPropagation()});ea=e('
');fa=e('
');setTimeout(function(){e(document.body).append(L).append(ea).append(fa);if(D)e(document.body).append(xa=e(''));J=e("#"+Pa);O=e("#"+Qa);a='';var j=b.settings.loadCSS;if(j)if($(j,"array"))for(var l in j)a+='';else a+=j.match(/\s*]*?)?>[\s\S]+?<\/style>\s*/i)?j:'';a+='';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('
').mousedown(function(i){i.stopPropagation()});ea=e('
');fa=e('
');setTimeout(function(){e(document.body).append(L).append(ea).append(fa);if(D)e(document.body).append(xa=e(''));J=e("#"+Pa);O=e("#"+Qa);a='';var j=b.settings.loadCSS;if(j)if($(j,"array"))for(var l in j)a+='';else a+=j.match(/\s*]*?)?>[\s\S]+?<\/style>\s*/i)?j:'';a+='';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('
').mousedown(function(i){i.stopPropagation()});ea=e('
'); -fa=e('
');setTimeout(function(){e(document.body).append(L).append(ea).append(fa);if(D)e(document.body).append(xa=e('