如下所示的这段代码,需要怎么修改,求指教?这段代码我不会改。
// 自动保存草稿
if($('#wmd-input').length){
if(G_DRAFT_ENABLED == 'Y'){
if (G_ADVANCED_EDITOR_ENABLE == 'Y'){
//富文本
EDITOR_CALLBACK = function (evt){
if (evt.editor.getData().length){
$.post(G_BASE_URL + '/account/ajax/save_draft/item_id-1__type-' + PUBLISH_TYPE, 'message=' + evt.editor.getData(), function (result) {
$('#question_detail_message').html(result.err + ' <a href="#" onclick="$(\'textarea#advanced_editor\').attr(\'value\', \'\'); AWS.User.delete_draft(1, \'' + PUBLISH_TYPE + '\'); $(this).parent().html(\' \'); return false;">' + _t('删除草稿') + '</a>');
}, 'json');
}
}
// 自动保存草稿
editor.on( 'blur', EDITOR_CALLBACK);
}else{
//纯文本
$('#wmd-input').bind('blur',function(){
var article_textarea = $('#wmd-input').val();
if(article_textarea != ''){
$.post(G_BASE_URL + '/account/ajax/save_draft/item_id-1__type-' + PUBLISH_TYPE, 'message=' + article_textarea, function (result) {
$('#question_detail_message').html(result.err + ' <a href="#" onclick="$(\'textarea#advanced_editor\').attr(\'value\', \'\'); AWS.User.delete_draft(1, \'' + PUBLISH_TYPE + '\'); $(this).parent().html(\' \'); return false;">' + _t('删除草稿') + '</a>');
}, 'json');
}
});
}
}
}
// 手动保存草稿
$('#draft').click(function() {
if (G_ADVANCED_EDITOR_ENABLE == 'Y' && G_DRAFT_ENABLED == 'N'){
var article_textarea = CKEDITOR.instances['wmd-input'].getData();
}else{
var article_textarea = $('#wmd-input').val();
}
if(article_textarea != ''){
$.post(G_BASE_URL + '/account/ajax/save_draft/item_id-1__type-' + PUBLISH_TYPE, 'message=' + article_textarea, function (result) {
$('#question_detail_message').html(result.err + ' <a href="#" onclick="$(\'textarea#advanced_editor\').attr(\'value\', \'\'); AWS.User.delete_draft(1, \'' + PUBLISH_TYPE + '\'); $(this).parent().html(\' \'); return false;">' + _t('删除草稿') + '</a>');
}, 'json');
}
});
阅读全文
收起全文