issue 1292, minify js

git-svn-id: http://xe-core.googlecode.com/svn/branches/1.5.0@10388 201d5d3c-b55e-5fd7-737f-ddc643e51545
This commit is contained in:
flyskyko 2012-03-08 05:37:30 +00:00
parent a2688b864f
commit 9677cdf70f
2 changed files with 18 additions and 11 deletions

View file

@ -5143,7 +5143,6 @@ xe.XE_XHTMLFormatter = $.Class({
TO_IR : function(sContent) {
var stack = [];
// remove xeHandled attrs
/*
sContent = sContent.replace(/xeHandled="YES"/ig,'');
@ -5210,19 +5209,26 @@ xe.XE_XHTMLFormatter = $.Class({
return '<'+tag+' '+$.trim(attrs)+'>';
} else {
stack[stack.length] = {tag:tag, state:state};
stack.push({tag:tag, state:state});
}
} else {
var tags = [], t = '';
// remove unnecessary closing tag
if (!stack.length) return '';
if (!stack.length){
return '';
}
do {
t = stack.pop();
if (t.tag != tag) continue;
if (t.state != 'deleted') tags.push('</'+t.tag+'>');
} while(stack.length && t.tag != tag);
t = stack[stack.length-1];
if (t.tag != tag){
continue;
}
if (t.state != 'deleted'){
tags.push('</'+t.tag+'>');
}
stack.pop();
} while(stack.length && t.tag == tag);
return tags.join('');
}
@ -5237,6 +5243,7 @@ xe.XE_XHTMLFormatter = $.Class({
t = stack.pop();
if (t.state != 'deleted') sContent += '</'+t.tag+'>';
} while(stack.length);
}
return sContent;

View file

@ -175,10 +175,10 @@ void 0)this._prevHeight=this.inputArea.style.height;this.oVerticalResizer.style.
this.oIframe.style.height=this.oIframeBody[0].scrollHeight+"px"}});xe.XpressCore.oMessageMap={"XE_EditingAreaManager.onExit":"%uB0B4%uC6A9%uC774%20%uBCC0%uACBD%uB418%uC5C8%uC2B5%uB2C8%uB2E4.","XE_FontColor.invalidColorCode":"%uC0C9%uC0C1%20%uCF54%uB4DC%uB97C%20%uC62C%uBC14%uB974%uAC8C%20%uC785%uB825%uD558%uC5EC%20%uC8FC%uC2DC%uAE30%20%uBC14%uB78D%uB2C8%uB2E4.\n\n%uC608%29%20%23000000%2C%20%23FF0000%2C%20%23FFFFFF%2C%20%23ffffff%2C%20ffffff","XE_BGColor.invalidColorCode":"%uC0C9%uC0C1%20%uCF54%uB4DC%uB97C%20%uC62C%uBC14%uB974%uAC8C%20%uC785%uB825%uD558%uC5EC%20%uC8FC%uC2DC%uAE30%20%uBC14%uB78D%uB2C8%uB2E4.\n\n%uC608%29%20%23000000%2C%20%23FF0000%2C%20%23FFFFFF%2C%20%23ffffff%2C%20ffffff",
"XE_Hyperlink.invalidURL":"%uC785%uB825%uD558%uC2E0%20URL%uC774%20%uC62C%uBC14%uB974%uC9C0%20%uC54A%uC2B5%uB2C8%uB2E4."};regex_handler=/<(.*?)\s+on[a-z]+\s*=(?:\s*".*?"|\s*'.*?'|[^\s>]+)(.*?)>/ig;regex_font_color=/color\s*=(?:\s*"(.*?)"|\s*'(.*?)'|([^\s>]+))/i;regex_font_face=/face\s*=(?:\s*"(.*?)"|\s*'(.*?)'|([^\s>]+))/i;regex_font_size=/size\s*=(?:\s*"(\d+)"|\s*'(\d+)'|(\d+))/i;regex_style=/style\s*=\s*(?:\s*"(.*?)"|\s*'(.*?)'|([^\s>]+))/i;regex_font_weight=/font-weight\s*:\s*([a-z]+);?/i;regex_font_style=
/font-style\s*:\s*italic;?/i;regex_font_decoration=/text-decoration\s*:\s*([a-z -]+);?/i;regex_jquery=/jQuery\d+\s*=(\s*"\d+"|\d+)/ig;regex_quote_attr=/([\w-]+\s*=(?:\s*"[^"]+"|\s*'[^']+'))|([\w-]+)=([^\s]+)/g;var p="area,br,col,embed,hr,img,input,param".split(",");xe.XE_XHTMLFormatter=c.Class({name:"XE_XHTMLFormatter",$ON_MSG_APP_READY:function(){this.oApp.addConverter("WYSIWYG_TO_IR",this.TO_IR);this.oApp.addConverter("HTMLSrc_TO_IR",this.TO_IR);this.oApp.addConverter("IR_TO_HTMLSrc",this.IR_TO);
this.oApp.addConverter("IR_TO_WYSIWYG",this.IR_TO)},TO_IR:function(a){var b=[];if(c.browser.msie){a=a.replace(regex_jquery,"");a=a.replace(/<(\w+) ([^>]+)>/g,function(a,b,c){return"<"+b+" "+c.replace(regex_quote_attr,function(a,b,c,d){return b?b:/^"/.test(d)||/"$/.test(d)?c+"="+d:c+'="'+(d||c)+'"'})+">"})}regex=/<(\/)?([:\w\/-]+)(.*?)>/ig;a=a.replace(regex,function(a,d,g,h){d=d||"";g=g.toLowerCase();h=c.trim(h||"");if(d){h=[];a="";if(!b.length)return"";do{a=b.pop();a.tag==g&&a.state!="deleted"&&h.push("</"+
a.tag+">")}while(b.length&&a.tag!=g);return h.join("")}if(c.inArray(g,p)>=0){a=h.length;g=="br"&&(h="");if(!h||h.substring(a-1,a)!="/")h=h+"/";return"<"+g+" "+c.trim(h)+">"}b[b.length]={tag:g,state:""};return"<"+d+g+(h?" "+h:"")+">"});if(b.length){var d="";do{d=b.pop();d.state!="deleted"&&(a=a+("</"+d.tag+">"))}while(b.length)}return a},IR_TO:function(a){return a}});xe.XE_Extension=c.Class({name:"XE_Extension",seq:"",last_doc:"",$init:function(a,b){this.seq=b;this._assignHTMLObjects(a)},_assignHTMLObjects:function(a){this.elDropdownLayer=
c("DIV.xpress_xeditor_extension_layer",a).get(0)},_removeAttrs:function(a){return a},_addEvent:function(){if(this.oApp.getEditingMode()=="WYSIWYG"){var a=this.oApp.getWYSIWYGDocument(),b=this.seq,d=function(){var a=c(this),d=a.attr("editor_component");if(d&&c.isFunction(openComponent)){editorPrevNode=a.get(0);openComponent(d,b)}};c(a).find("img,div[editor_component]").each(function(){var b=c(this);this.nodeName=="IMG"&&!b.attr("editor_component")&&!b.attr("widget")&&b.attr("editor_component","image_link");
if(this.last_doc!=a){b.unbind("dblclick.widget").bind("dblclick.widget",d);this.last_doc=a}})}},$ON_MSG_APP_READY:function(){var a=this.oApp;a.exec("REGISTER_UI_EVENT",["extension","click","TOGGLE_EXTENSION_LAYER"]);var b=function(){a.exec("HIDE_ACTIVE_LAYER",[])};c("a",this.elDropdownLayer).each(function(){var a=c(this);if(!a.attr("component_onclick_event_added")){a.click(b);a.attr("component_onclick_event_added","Y")}})},$ON_TOGGLE_EXTENSION_LAYER:function(){this.oApp.exec("TOGGLE_TOOLBAR_ACTIVE_LAYER",
this.oApp.addConverter("IR_TO_WYSIWYG",this.IR_TO)},TO_IR:function(a){var b=[];if(c.browser.msie){a=a.replace(regex_jquery,"");a=a.replace(/<(\w+) ([^>]+)>/g,function(a,b,c){return"<"+b+" "+c.replace(regex_quote_attr,function(a,b,c,d){return b?b:/^"/.test(d)||/"$/.test(d)?c+"="+d:c+'="'+(d||c)+'"'})+">"})}regex=/<(\/)?([:\w\/-]+)(.*?)>/ig;a=a.replace(regex,function(a,d,g,h){d=d||"";g=g.toLowerCase();h=c.trim(h||"");if(d){h=[];a="";if(!b.length)return"";do{a=b[b.length-1];if(a.tag==g){a.state!="deleted"&&
h.push("</"+a.tag+">");b.pop()}}while(b.length&&a.tag==g);return h.join("")}if(c.inArray(g,p)>=0){a=h.length;g=="br"&&(h="");if(!h||h.substring(a-1,a)!="/")h=h+"/";return"<"+g+" "+c.trim(h)+">"}b.push({tag:g,state:""});return"<"+d+g+(h?" "+h:"")+">"});if(b.length){var d="";do{d=b.pop();d.state!="deleted"&&(a=a+("</"+d.tag+">"))}while(b.length)}return a},IR_TO:function(a){return a}});xe.XE_Extension=c.Class({name:"XE_Extension",seq:"",last_doc:"",$init:function(a,b){this.seq=b;this._assignHTMLObjects(a)},
_assignHTMLObjects:function(a){this.elDropdownLayer=c("DIV.xpress_xeditor_extension_layer",a).get(0)},_removeAttrs:function(a){return a},_addEvent:function(){if(this.oApp.getEditingMode()=="WYSIWYG"){var a=this.oApp.getWYSIWYGDocument(),b=this.seq,d=function(){var a=c(this),d=a.attr("editor_component");if(d&&c.isFunction(openComponent)){editorPrevNode=a.get(0);openComponent(d,b)}};c(a).find("img,div[editor_component]").each(function(){var b=c(this);this.nodeName=="IMG"&&!b.attr("editor_component")&&
!b.attr("widget")&&b.attr("editor_component","image_link");if(this.last_doc!=a){b.unbind("dblclick.widget").bind("dblclick.widget",d);this.last_doc=a}})}},$ON_MSG_APP_READY:function(){var a=this.oApp;a.exec("REGISTER_UI_EVENT",["extension","click","TOGGLE_EXTENSION_LAYER"]);var b=function(){a.exec("HIDE_ACTIVE_LAYER",[])};c("a",this.elDropdownLayer).each(function(){var a=c(this);if(!a.attr("component_onclick_event_added")){a.click(b);a.attr("component_onclick_event_added","Y")}})},$ON_TOGGLE_EXTENSION_LAYER:function(){this.oApp.exec("TOGGLE_TOOLBAR_ACTIVE_LAYER",
[this.elDropdownLayer])},$ON_CHANGE_EDITING_MODE:function(){var a=this;setTimeout(function(){a._addEvent()},100)},$ON_PASTE_HTML:function(){var a=this;setTimeout(function(){a._addEvent()},100)},$ON_LOAD_IR_FIELD:function(){var a=this;setTimeout(function(){a._addEvent()},100)},$ON_SET_IR:function(){var a=this;setTimeout(function(){a._addEvent()},100)}});xe.XE_AutoSave=c.Class({name:"XE_AutoSave",form:null,textarea:null,$init:function(a,b){this.form=a.form;this.textarea=a;this._assignHTMLObjects(b)},
_assignHTMLObjects:function(){this.welMessageBox=c("autosave_message")},$ON_MSG_APP_READY:function(){var a=c(this.form._saved_doc_title),b=c(this.form._saved_doc_content),a=c.trim(a.val()),b=c.trim(b.val());if(a||b)if(confirm(this.form._saved_doc_message.value)){c(this.form.title).val(a);this.oApp.setIR(b);typeof editorGetAutoSavedDoc=="function"&&editorGetAutoSavedDoc(this.form)}else editorRemoveSavedDoc();editorEnableAutoSave(this.form,c(this.form).attr("editor_sequence"));this.oApp.exec("REGISTER_HOTKEY",
["ctrl+shift+s","AUTO_SAVE"])},$ON_AUTO_SAVE:function(){_editorAutoSave()}});xe.XE_FormatWithSelectUI=c.Class({name:"XE_FormatWithSelectUI",$init:function(a){this._assignHTMLObjects(a)},_assignHTMLObjects:function(a){this.elFormatSelect=c("SELECT.xpress_xeditor_ui_format_select",a).get(0)},$ON_MSG_APP_READY:function(){this.oApp.registerBrowserEvent(this.elFormatSelect,"change","SET_FORMAT_FROM_SELECT_UI");this.elFormatSelect.selectedIndex=0},$ON_MSG_STYLE_CHANGED:function(){var a=this.oApp.getWYSIWYGDocument().queryCommandValue("FormatBlock");