Fix notice not clear (#1416)

This commit is contained in:
沈唁
2022-04-26 10:29:26 +08:00
committed by GitHub
parent f8a9d95e43
commit f31e6daf7b
2 changed files with 24 additions and 5 deletions
+6 -5
View File
@@ -13,7 +13,9 @@
noticeType : $.cookie(prefix + '__typecho_notice_type'),
highlight : $.cookie(prefix + '__typecho_notice_highlight')
},
path = '<?php echo \Typecho\Cookie::getPath(); ?>';
path = '<?php echo \Typecho\Cookie::getPath(); ?>',
domain = '<?php echo \Typecho\Cookie::getDomain(); ?>',
secure = <?php echo json_encode(\Typecho\Cookie::getSecure()); ?>;
if (!!cookies.notice && 'success|notice|error'.indexOf(cookies.noticeType) >= 0) {
var head = $('.typecho-head-nav'),
@@ -63,14 +65,13 @@
});
});
$.cookie(prefix + '__typecho_notice', null, {path : path});
$.cookie(prefix + '__typecho_notice_type', null, {path : path});
$.cookie(prefix + '__typecho_notice', null, {path : path, domain: domain, secure: secure});
$.cookie(prefix + '__typecho_notice_type', null, {path : path, domain: domain, secure: secure});
}
if (cookies.highlight) {
$('#' + cookies.highlight).effect('highlight', 1000);
$.cookie(prefix + '__typecho_notice_highlight', null, {path : path});
$.cookie(prefix + '__typecho_notice_highlight', null, {path : path, domain: domain, secure: secure});
}
})();
+18
View File
@@ -85,6 +85,24 @@ class Cookie
return self::$path;
}
/**
* @access public
* @return string
*/
public static function getDomain(): string
{
return self::$domain;
}
/**
* @access public
* @return bool
*/
public static function getSecure(): bool
{
return self::$secure ?: false;
}
/**
* 设置额外的选项
*