博客的自动保存

This commit is contained in:
cxt 2016-07-21 14:05:15 +08:00
parent 9a4c210d16
commit 60bbe89c0d
4 changed files with 21 additions and 2 deletions

View File

@ -39,6 +39,8 @@
%>
<div class="cl"></div>
<p id="message_content_span"></p>
<p id="e_tip" class="c_grey"></p>
<p id="e_tips" class="c_grey"></p>
</div>
<div class="cl"></div>
<div class="mt10">
@ -56,4 +58,11 @@
</div>
</div>
</div>
</div>
</div>
<script type="text/javascript">
$(function(){
setTimeout(function(){
elocalStorage(message_content_editor,'blog_<%=User.current.id %>');
}, 10000);
});
</script>

View File

@ -36,6 +36,8 @@
:maxlength => 5000 }%>
<div class="cl"></div>
<p id="message_content_span"></p>
<p id="e_tip" class="c_grey"></p>
<p id="e_tips" class="c_grey"></p>
</div>
<div class="cl"></div>
<div class="mt10">
@ -62,4 +64,4 @@
<div class="cl"></div>
</li>-->
</div>
</div>
</div>

View File

@ -184,3 +184,10 @@ function nh_init_board(params){
</script>
<script type="text/javascript">
$(function(){
setTimeout(function(){
elocalStorage(message_content_editor,'blog_<%=User.current.id %>');
}, 10000);
});
</script>

View File

@ -1261,6 +1261,7 @@ function elocalStorage(editor,mdu){
h = h < 10 ? '0' + h : h;
m = m < 10 ? '0' + m : m;
s = s < 10 ? '0' + s : s;
editor.sync();
if(!editor.isEmpty()){
add_data("content",mdu,editor.html());
$('#e_tip').html(" 数据已于 " + h + ':' + m + ':' + s +" 保存 ");