From 37d945e64fccdb8ae713216247e1aab47b0b7de1 Mon Sep 17 00:00:00 2001 From: taggon Date: Wed, 24 Nov 2010 12:54:59 +0000 Subject: [PATCH] =?UTF-8?q?=EC=9E=90=EB=8F=99=20=EC=A0=80=EC=9E=A5?= =?UTF-8?q?=EC=8B=9C=20=EC=BD=9C=EB=B0=B1=20=EA=B8=B0=EB=8A=A5=20=EC=B6=94?= =?UTF-8?q?=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit git-svn-id: http://xe-core.googlecode.com/svn/sandbox@7888 201d5d3c-b55e-5fd7-737f-ddc643e51545 --- modules/editor/tpl/js/editor_common.js | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/modules/editor/tpl/js/editor_common.js b/modules/editor/tpl/js/editor_common.js index d90458cf2..8bbcceefc 100644 --- a/modules/editor/tpl/js/editor_common.js +++ b/modules/editor/tpl/js/editor_common.js @@ -31,12 +31,16 @@ function editorFocus(editor_sequence) { * 자동 저장 기능 **/ // 자동 저장 활성화 시키는 함수 (50초마다 자동저장) -function editorEnableAutoSave(fo_obj, editor_sequence) { - var title = fo_obj.title.value; +function editorEnableAutoSave(fo_obj, editor_sequence, callback) { + var title = fo_obj.title.value; var content = editorRelKeys[editor_sequence]['content'].value; + editorAutoSaveObj = {"fo_obj":fo_obj, "editor_sequence":editor_sequence, "title":title, "content":content, locked:false}; - setTimeout('_editorAutoSave()', 50000); + + clearTimeout(editorEnableAutoSave.timer); + editorEnableAutoSave.timer = setTimeout(function(){_editorAutoSave(false, callback)}, 5000); } +editorEnableAutoSave.timer = null; // ajax를 이용하여 editor.procEditorSaveDoc 호출하여 자동 저장시킴 exe는 강제 코드 function _editorAutoSave(exe, callback) { @@ -44,7 +48,10 @@ function _editorAutoSave(exe, callback) { var editor_sequence = editorAutoSaveObj.editor_sequence; // 50초마다 동기화를 시킴 강제 실행은 제외 - if(!exe) setTimeout('_editorAutoSave()', 50000); + if(!exe) { + clearTimeout(editorEnableAutoSave.timer); + editorEnableAutoSave.timer = setTimeout(function(){ _editorAutoSave(exe, callback) }, 50000); + } // 현재 자동저장중이면 중지 if(editorAutoSaveObj.locked == true) return;