/*! * UEditor * version: ueditor * build: Wed Aug 10 2016 11:06:19 GMT+0800 (CST) */ (function(){(function(){UE=window.UE||{};var isIE=!!window.ActiveXObject;var utils={removeLastbs:function(url){return url.replace(/\/$/,'')},extend:function(t,s){var a=arguments,notCover=this.isBoolean(a[a.length-1])?a[a.length-1]:false,len=this.isBoolean(a[a.length-1])?a.length-1:a.length;for(var i=1;i=start&&v===item){index=i;return false}});return index},hasClass:function(element,className){className=className.replace(/(^[ ]+)|([ ]+$)/g,'').replace(/[ ]{2,}/g,' ').split(' ');for(var i=0,ci,cls=element.className;ci=className[i++];){if(!new RegExp('\\b'+ci+'\\b','i').test(cls)){return false}}return i-1==className.length},addClass:function(elm,classNames){if(!elm)return;classNames=this.trim(classNames).replace(/[ ]{2,}/g,' ').split(' ');for(var i=0,ci,cls=elm.className;ci=classNames[i++];){if(!new RegExp('\\b'+ci+'\\b').test(cls)){cls+=' '+ci}}elm.className=utils.trim(cls)},removeClass:function(elm,classNames){classNames=this.isArray(classNames)?classNames:this.trim(classNames).replace(/[ ]{2,}/g,' ').split(' ');for(var i=0,ci,cls=elm.className;ci=classNames[i++];){cls=cls.replace(new RegExp('\\b'+ci+'\\b'),'')}cls=this.trim(cls).replace(/[ ]{2,}/g,' ');elm.className=cls;!cls&&elm.removeAttribute('className')},on:function(element,type,handler){var types=this.isArray(type)?type:type.split(/\s+/),k=types.length;if(k)while(k--){type=types[k];if(element.addEventListener){element.addEventListener(type,handler,false)}else{if(!handler._d){handler._d={els:[]}}var key=type+handler.toString(),index=utils.indexOf(handler._d.els,element);if(!handler._d[key]||index==-1){if(index==-1){handler._d.els.push(element)}if(!handler._d[key]){handler._d[key]=function(evt){return handler.call(evt.srcElement,evt||window.event)}}element.attachEvent('on'+type,handler._d[key])}}}element=null},off:function(element,type,handler){var types=this.isArray(type)?type:type.split(/\s+/),k=types.length;if(k)while(k--){type=types[k];if(element.removeEventListener){element.removeEventListener(type,handler,false)}else{var key=type+handler.toString();try{element.detachEvent('on'+type,handler._d?handler._d[key]:handler)}catch(e){}if(handler._d&&handler._d[key]){var index=utils.indexOf(handler._d.els,element);if(index!=-1){handler._d.els.splice(index,1)}handler._d.els.length==0&&delete handler._d[key]}}}},loadFile:function(){var tmpList=[];function getItem(doc,obj){try{for(var i=0,ci;ci=tmpList[i++];){if(ci.doc===doc&&ci.url==(obj.src||obj.href)){return ci}}}catch(e){return null}}return function(doc,obj,fn){var item=getItem(doc,obj);if(item){if(item.ready){fn&&fn()}else{item.funs.push(fn)}return}tmpList.push({doc:doc,url:obj.src||obj.href,funs:[fn]});if(!doc.body){var html=[];for(var p in obj){if(p=='tag')continue;html.push(p+'="'+obj[p]+'"')}doc.write('<'+obj.tag+' '+html.join(' ')+' >');return}if(obj.id&&doc.getElementById(obj.id)){return}var element=doc.createElement(obj.tag);delete obj.tag;for(var p in obj){element.setAttribute(p,obj[p])}element.onload=element.onreadystatechange=function(){if(!this.readyState||/loaded|complete/.test(this.readyState)){item=getItem(doc,obj);if(item.funs.length>0){item.ready=1;for(var fi;fi=item.funs.pop();){fi()}}element.onload=element.onreadystatechange=null}};element.onerror=function(){throw Error('The load '+(obj.href||obj.src)+' fails,check the url')};doc.getElementsByTagName("head")[0].appendChild(element)}}()};utils.each(['String','Function','Array','Number','RegExp','Object','Boolean'],function(v){utils['is'+v]=function(obj){return Object.prototype.toString.apply(obj)=='[object '+v+']'}});var parselist={};UE.parse={register:function(parseName,fn){parselist[parseName]=fn},load:function(opt){utils.each(parselist,function(v){v.call(opt,utils)})}};uParse=function(selector,opt){utils.domReady(function(){var contents;if(document.querySelectorAll){contents=document.querySelectorAll(selector)}else{if(/^#/.test(selector)){contents=[document.getElementById(selector.replace(/^#/,''))]}else if(/^\./.test(selector)){var contents=[];utils.each(document.getElementsByTagName('*'),function(node){if(node.className&&new RegExp('\\b'+selector.replace(/^\./,'')+'\\b','i').test(node.className)){contents.push(node)}})}else{contents=document.getElementsByTagName(selector)}}utils.each(contents,function(v){UE.parse.load(utils.extend({root:v,selector:selector},opt))})})}})();UE.parse.register('insertcode',function(utils){var pres=this.root.getElementsByTagName('pre');if(pres.length){if(typeof XRegExp=="undefined"){var jsurl,cssurl;if(this.rootPath!==undefined){jsurl=utils.removeLastbs(this.rootPath)+'/third-party/SyntaxHighlighter/shCore.js';cssurl=utils.removeLastbs(this.rootPath)+'/third-party/SyntaxHighlighter/shCoreDefault.css'}else{jsurl=this.highlightJsUrl;cssurl=this.highlightCssUrl}utils.loadFile(document,{id:"syntaxhighlighter_css",tag:"link",rel:"stylesheet",type:"text/css",href:cssurl});utils.loadFile(document,{id:"syntaxhighlighter_js",src:jsurl,tag:"script",type:"text/javascript",defer:"defer"},function(){utils.each(pres,function(pi){if(pi&&/brush/i.test(pi.className)){SyntaxHighlighter.highlight(pi)}})})}else{utils.each(pres,function(pi){if(pi&&/brush/i.test(pi.className)){SyntaxHighlighter.highlight(pi)}})}}});UE.parse.register('table',function(utils){var me=this,root=this.root,tables=root.getElementsByTagName('table');if(tables.length){var selector=this.selector;utils.cssRule('table',selector+' table.noBorderTable td,'+selector+' table.noBorderTable th,'+selector+' table.noBorderTable caption{border:1px dashed #ddd !important}'+selector+' table.sortEnabled tr.firstRow th,'+selector+' table.sortEnabled tr.firstRow td{padding-right:20px; background-repeat: no-repeat;background-position: center right; background-image:url('+this.rootPath+'themes/default/images/sortable.png);}'+selector+' table.sortEnabled tr.firstRow th:hover,'+selector+' table.sortEnabled tr.firstRow td:hover{background-color: #EEE;}'+selector+' table{margin-bottom:10px;border-collapse:collapse;display:table;}'+selector+' td,'+selector+' th{ background:white; padding: 5px 10px;border: 1px solid #DDD;}'+selector+' caption{border:1px dashed #DDD;border-bottom:0;padding:3px;text-align:center;}'+selector+' th{border-top:1px solid #BBB;background:#F7F7F7;}'+selector+' table tr.firstRow th{border-top:2px solid #BBB;background:#F7F7F7;}'+selector+' tr.ue-table-interlace-color-single td{ background: #fcfcfc; }'+selector+' tr.ue-table-interlace-color-double td{ background: #f7faff; }'+selector+' td p{margin:0;padding:0;}',document);utils.each('td th caption'.split(' '),function(tag){var cells=root.getElementsByTagName(tag);cells.length&&utils.each(cells,function(node){if(!node.firstChild){node.innerHTML=' '}})});var tables=root.getElementsByTagName('table');utils.each(tables,function(table){if(/\bsortEnabled\b/.test(table.className)){utils.on(table,'click',function(e){var target=e.target||e.srcElement,cell=findParentByTagName(target,['td','th']);var table=findParentByTagName(target,'table'),colIndex=utils.indexOf(table.rows[0].cells,cell),sortType=table.getAttribute('data-sort-type');if(colIndex!=-1){sortTable(table,colIndex,me.tableSortCompareFn||sortType);updateTable(table)}})}});function findParentByTagName(target,tagNames){var i,current=target;tagNames=utils.isArray(tagNames)?tagNames:[tagNames];while(current){for(i=0;i0){var t=array[i];array[i]=array[j];array[j]=t}}}return array}function updateTable(table){if(!utils.hasClass(table.rows[0],"firstRow")){for(var i=1;i