将cookie存储替换为sessionStorage

This commit is contained in:
joyqi 2013-11-23 10:49:29 +08:00
parent 1d7f07ae15
commit 298780e6ee
3 changed files with 10 additions and 8 deletions

View File

@ -118,7 +118,9 @@ include 'common-js.php';
<script>
$(document).ready(function () {
var ul = $('.intro-link ul'), html = $.cookie('__typecho_feed'), update = $.cookie('__typecho_update');
var ul = $('.intro-link ul'), cache = window.sessionStorage,
html = cache ? cache.getItem('feed') : '',
update = cache ? cache.getItem('update') : '';
if (!!html) {
ul.html(html);
@ -132,8 +134,8 @@ $(document).ready(function () {
}
ul.html(html);
$.cookie('__typecho_feed', html);
});
cache.setItem('feed', html);
}, 'json');
}
function applyUpdate(update) {
@ -152,8 +154,8 @@ $(document).ready(function () {
update = '';
$.get('<?php $options->index('/action/ajax?do=checkVersion'); ?>', function (o, status, resp) {
applyUpdate(o);
$.cookie('__typecho_update', resp.responseText);
});
cache.setItem('update', resp.responseText);
}, 'json');
}
});

View File

@ -261,7 +261,7 @@ $(document).ready(function () {
$.post(t.attr('action'), t.serialize(), function (o) {
reply.html(o.comment.content)
.effect('highlight');
});
}, 'json');
t.remove();
return false;
@ -333,7 +333,7 @@ $(document).ready(function () {
$.post(t.attr('action'), comment, function (o) {
$('.comment-content', oldTr).html(o.comment.content)
.effect('highlight');
});
}, 'json');
oldTr.show();
tr.remove();

View File

@ -149,7 +149,7 @@ $(document).ready(function() {
cid = o.cid;
autoSave.text('<?php _e('内容已经保存'); ?>' + ' (' + o.time + ')').effect('highlight', 1000);
locked = false;
});
}, 'json');
}
}, 10000);
}