1
0
mirror of https://github.com/haiwen/seahub.git synced 2025-09-02 15:38:15 +00:00

[cookie]changed 'topinfo' to 'note_id'

This commit is contained in:
llj
2012-08-21 11:27:09 +08:00
parent 81c88a323e
commit 468cc92f9b
2 changed files with 8 additions and 8 deletions

View File

@@ -31,7 +31,7 @@ class InfobarMiddleware(object):
return ret
def process_request(self, request):
topinfo_close = request.COOKIES.get('topinfo', '')
topinfo_close = request.COOKIES.get('note_id', '')
cur_note = cache.get('CUR_TOPINFO') if cache.get('CUR_TOPINFO') else \
self.get_from_db()

View File

@@ -136,17 +136,17 @@ $('#info-bar .close').click(function() {
$('#info-bar').addClass('hide');
if (navigator.cookieEnabled) {
var cookies = document.cookie.split('; '),
topinfo_exist = false,
topinfo_new_value = $(this).attr('data') + ',' + '; max-age=' + 14*24*60*60 + '; path=' + '{{ SITE_ROOT }}';
note_id_exist = false,
new_note_id = $(this).attr('data') + ',' + '; max-age=' + 14*24*60*60 + '; path=' + '{{ SITE_ROOT }}';
for (var i = 0, len = cookies.length; i < len; i++) {
if (cookies[i].split('=')[0] == 'topinfo') {
topinfo_exist = true;
document.cookie = 'topinfo=' + cookies[i].split('=')[1] + topinfo_new_value;
if (cookies[i].split('=')[0] == 'note_id') {
note_id_exist = true;
document.cookie = 'note_id=' + cookies[i].split('=')[1] + new_note_id;
break;
}
}
if (!topinfo_exist) {
document.cookie = 'topinfo=' + topinfo_new_value;
if (!note_id_exist) {
document.cookie = 'note_id=' + new_note_id;
}
}
});