mirror of
https://github.com/haiwen/seahub.git
synced 2025-09-03 07:55:36 +00:00
[info-bar]modified cookie set for safari
This commit is contained in:
@@ -41,14 +41,14 @@ class InfobarMiddleware(object):
|
||||
return ret
|
||||
|
||||
def process_request(self, request):
|
||||
topinfo_close = request.COOKIES.get('note_id', '')
|
||||
topinfo_close = request.COOKIES.get('info_id', '')
|
||||
|
||||
cur_note = cache.get('CUR_TOPINFO') if cache.get('CUR_TOPINFO') else \
|
||||
self.get_from_db()
|
||||
if not cur_note:
|
||||
request.cur_note = None
|
||||
else:
|
||||
if str(cur_note[0].id) in topinfo_close.split(','):
|
||||
if str(cur_note[0].id) in topinfo_close.split('_'):
|
||||
request.cur_note = None
|
||||
else:
|
||||
request.cur_note = cur_note[0]
|
||||
|
@@ -154,19 +154,19 @@ $('#info-bar .close').click(function() {
|
||||
if (navigator.cookieEnabled) {
|
||||
var date = new Date(),
|
||||
cookies = document.cookie.split('; '),
|
||||
note_id_exist = false,
|
||||
new_note_id = $(this).attr('data') + ',';
|
||||
info_id_exist = false,
|
||||
new_info_id = $(this).attr('data') + '_';
|
||||
date.setTime(date.getTime() + 14*24*60*60*1000);
|
||||
new_note_id += '; expires=' + date.toGMTString() + '; path=' + '{{ SITE_ROOT }}';
|
||||
new_info_id += '; expires=' + date.toGMTString() + '; path=' + '{{ SITE_ROOT }}';
|
||||
for (var i = 0, len = cookies.length; i < len; i++) {
|
||||
if (cookies[i].split('=')[0] == 'note_id') {
|
||||
note_id_exist = true;
|
||||
document.cookie = 'note_id=' + cookies[i].split('=')[1] + new_note_id;
|
||||
if (cookies[i].split('=')[0] == 'info_id') {
|
||||
info_id_exist = true;
|
||||
document.cookie = 'info_id=' + cookies[i].split('=')[1] + new_info_id;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!note_id_exist) {
|
||||
document.cookie = 'note_id=' + new_note_id;
|
||||
if (!info_id_exist) {
|
||||
document.cookie = 'info_id=' + new_info_id;
|
||||
}
|
||||
}
|
||||
});
|
||||
|
Reference in New Issue
Block a user