mirror of
https://github.com/Lastorder-DC/rhymix.git
synced 2026-01-20 19:59:54 +09:00
1 line
No EOL
5.7 KiB
JavaScript
1 line
No EOL
5.7 KiB
JavaScript
function editorGetContent(a){var b=editorRelKeys[a].func(a),c=new RegExp(request_uri.replace(/\//g,"\\/")+"(files|common|modules|layouts|widgets)","ig");return b.replace(c,"$1")}function editorFocus(a){try{var b=editorGetIFrame(a);jQuery.isFunction(b.setFocus)?b.setFocus():b.contentWindow.focus()}catch(c){}}function editorEnableAutoSave(a,b,c){var d=a.title.value,e=editorRelKeys[b].content.value;editorAutoSaveObj={fo_obj:a,editor_sequence:b,title:d,content:e,locked:!1},clearTimeout(editorEnableAutoSave.timer),editorEnableAutoSave.timer=setTimeout(function(){_editorAutoSave(!1,c)},5e4)}function _editorAutoSave(a,b){var c=editorAutoSaveObj.fo_obj,d=editorAutoSaveObj.editor_sequence;if(a||(clearTimeout(editorEnableAutoSave.timer),editorEnableAutoSave.timer=setTimeout(function(){_editorAutoSave(a,b)},5e4)),1!=editorAutoSaveObj.locked&&c&&"undefined"!=typeof c.title&&d){var e=c.title.value,f="";try{f=editorGetContent(d)}catch(g){}if(e!=editorAutoSaveObj.title||f!=editorAutoSaveObj.content||a){var h,i=new Date;h={title:e,content:f,mid:current_mid,document_srl:editorRelKeys[d].primary.value},editorAutoSaveObj.title=e,editorAutoSaveObj.content=f,jQuery("#editor_autosaved_message_"+d).text(i.getHours()+":"+i.getMinutes()+" "+auto_saved_msg).show(300),editorAutoSaveObj.locked=!0,show_waiting_message=!1,exec_xml("editor","procEditorSaveDoc",h,function(){var a=jQuery.extend({},h,{auto_saved_msg:auto_saved_msg});editorAutoSaveObj.locked=!1,jQuery.isFunction(b)&&b(a)}),show_waiting_message=!0}}}function editorRemoveSavedDoc(){var a=new Array;a.mid=current_mid,exec_xml("editor","procEditorRemoveSavedDoc",a)}function editorGetIFrame(a){return void 0!=editorRelKeys&&void 0!=editorRelKeys[a]&&void 0!=editorRelKeys[a].editor?editorRelKeys[a].editor.getFrame(a):document.getElementById("editor_iframe_"+a)}function editorGetTextarea(a){return document.getElementById("editor_textarea_"+a)}function eOptionOver(a){a.style.marginTop="-21px",a.style.zIndex="99"}function eOptionOut(a){a.style.marginTop="0",a.style.zIndex="1"}function eOptionClick(a){a.style.marginTop="-42px",a.style.zIndex="99"}function editorEventCheck(a){editorPrevNode=null;var b=a.target.id;if(b){var c=b.split("_");if("component"==c[0]){var d=c[1],e=b.replace(/^component_[0-9]+_/,"");if(d&&e&&"html"!=editorMode[d])switch(e){case"Bold":case"Italic":case"Underline":case"StrikeThrough":case"undo":case"redo":case"JustifyLeft":case"JustifyCenter":case"JustifyRight":case"JustifyFull":case"Indent":case"Outdent":case"InsertOrderedList":case"InsertUnorderedList":case"SaveAs":case"Print":case"Copy":case"Cut":case"Paste":case"RemoveFormat":case"Subscript":case"Superscript":editorDo(e,"",d);break;default:return openComponent(e,d),!1}}}}function openComponent(a,b,c){if(editorPrevSrl=b,"html"!=editorMode[b]){var d=request_uri+"?module=editor&act=dispEditorPopup&editor_sequence="+b+"&component="+a;"undefined"!=typeof c&&c&&(d+="&manual_url="+escape(c)),popopen(d,"editorComponent")}}function editorSearchComponent(a){var b=new xEvent(a);editorPrevNode=null;var c=b.target;if(c.getAttribute("widget")){for(var d=c;d&&"BODY"!=d.nodeName;)d=xParent(d);if(!d||"BODY"!=d.nodeName||!d.getAttribute("editor_sequence"))return editorPrevNode=null,void 0;var e=d.getAttribute("editor_sequence"),f=c.getAttribute("widget");if(editorPrevNode=c,"html"==editorMode[e])return;return popopen(request_uri+"?module=widget&act=dispWidgetGenerateCodeInPage&selected_widget="+f+"&module_srl="+e,"GenerateCodeInPage"),void 0}if(!c.getAttribute("editor_component"))for(;c&&!c.getAttribute("editor_component");)c=c.parentElement?c.parentElement:xParent(c);c||(c=b.target);var g=c.getAttribute("editor_component");if(g?editorPrevNode=c:"IMG"!=c.nodeName||c.getAttribute("widget")||(g="image_link",editorPrevNode=c),!g)return editorPrevNode=null,void 0;for(var d=c;d&&"BODY"!=d.nodeName;)d=xParent(d);if(!d||"BODY"!=d.nodeName||!d.getAttribute("editor_sequence"))return editorPrevNode=null,void 0;var e=d.getAttribute("editor_sequence");openComponent(g,e)}function editorReplaceHTML(a,b){var c=/src=("|\'){1}(\.\/)?(files\/attach|files\/cache|files\/faceOff|files\/member_extra_info|modules|common|widgets|widgetstyle|layouts|addons)\/([^"\']+)\.(jpg|jpeg|png|gif)("|\'){1}/g;b=b.replace(c,'src="'+request_uri+'$3/$4.$5"');var d=/href=("|\'){1}(\.\/)?\?([^"\']+)("|\'){1}/g;b=b.replace(d,'href="'+request_uri+'?$3"');a.editor_sequence||a.contentWindow.document.body.getAttribute("editor_sequence");try{a.contentWindow.focus()}catch(e){}if(jQuery.isFunction(a.replaceHTML))a.replaceHTML(b);else if(xIE4Up){var f=a.contentWindow.document.selection.createRange();f.pasteHTML?f.pasteHTML(b):editorPrevNode&&(editorPrevNode.outerHTML=b)}else try{if("HTML"==a.contentWindow.getSelection().focusNode.tagName){var f=a.contentDocument.createRange();f.setStart(a.contentDocument.body,0),f.setEnd(a.contentDocument.body,0),f.insertNode(f.createContextualFragment(b))}else{var f=a.contentWindow.getSelection().getRangeAt(0);f.deleteContents(),f.insertNode(f.createContextualFragment(b))}}catch(e){xInnerHtml(a.contentWindow.document.body,b+xInnerHtml(a.contentWindow.document.body))}}function editorGetSelectedHtml(a){var b=editorGetIFrame(a);if(jQuery.isFunction(b.getSelectedHTML))return b.getSelectedHTML();if(xIE4Up){var c=b.contentWindow.document.selection.createRange(),d=c.htmlText;return d}var c=b.contentWindow.getSelection().getRangeAt(0),e=xCreateElement("div");e.appendChild(c.cloneContents());var d=xInnerHtml(e);return d}var editorMode=new Array,editorAutoSaveObj={fo_obj:null,editor_sequence:0,title:"",content:"",locked:!1},editorRelKeys=new Array,editorDragObj={isDrag:!1,y:0,obj:null,id:"",det:0,source_height:0};editorEnableAutoSave.timer=null;var editorPrevSrl=null;jQuery(document).click(editorEventCheck);var editorPrevNode=null;!function(a){}(jQuery); |