diff --git a/src/assets/js/i18n.jsx b/src/assets/js/i18n.jsx index 3244cb0..d85b7ca 100644 --- a/src/assets/js/i18n.jsx +++ b/src/assets/js/i18n.jsx @@ -6,6 +6,7 @@ import Image from 'next/image.js'; import FooterIcon from '../../components/FooterIcon.jsx'; import message from '@/utils/message.js'; +import notice from '@/utils/notice.js'; const collator = new Intl.Collator('zh-Hans-CN', { numeric: true, @@ -186,8 +187,7 @@ function structureInfobarShare() { this.parentNode, ) } - className='i ri-file-copy-2-fill' - > + className='i ri-file-copy-2-fill'> @@ -203,8 +203,7 @@ function structureInfobarShare() { this.parentNode, ) } - className='i ri-file-copy-2-fill' - > + className='i ri-file-copy-2-fill'> @@ -297,15 +296,13 @@ function getstructureMusicSearchResult(name, url, artist, pic, album) { data-album={album} data-url={url} data-artist={artist} - data-pic={pic} - > + data-pic={pic}> { global.musicChange(`${name} - ${artist}`, url); - }} - > + }}>
@@ -331,8 +328,7 @@ function structureMusicExport(e) { album + '' } - src={pic} - > + src={pic}> {name} ); @@ -344,8 +340,7 @@ function getMailFeedbackButton() { href={ 'mailto:ravelloh@outlook.com?subject=[错误反馈]网站资源错误&body=错误地址:' + window.location.pathname - } - > + }> 邮件反馈 ); @@ -442,8 +437,7 @@ function structureShareInput(id, path) { this.parentNode, ); }} - className='i ri-file-copy-2-fill' - > + className='i ri-file-copy-2-fill'> @@ -763,19 +757,26 @@ function structureInfobarFeed() { return ( <>
- +
RSS
- +
Sitemap
- {addToFavorites(config.siteURL)}} className='no-effect' target='_blank'> + { + if (!notice.check()) { + notice.request(); + } + }} + className='no-effect' + target='_blank'>
- 收藏本站 + 启用通知
@@ -800,9 +801,9 @@ function addToFavorites() { window.external.addFavorite(url, title); } catch (e) { try { - window.sidebar.addPanel(title, url, ""); + window.sidebar.addPanel(title, url, ''); } catch (e) { - message.error("请使用Ctrl+D添加到收藏夹"); + message.error('请使用Ctrl+D添加到收藏夹'); } } } @@ -860,4 +861,4 @@ const i18nModule = { structureUptime, }; -export default i18nModule; \ No newline at end of file +export default i18nModule; diff --git a/src/utils/notice.js b/src/utils/notice.js index 21d3dd2..922f49d 100644 --- a/src/utils/notice.js +++ b/src/utils/notice.js @@ -5,13 +5,13 @@ const notice = { request: () => { Notification.requestPermission().then((permission) => { if (permission === 'granted') { - this.send('通知', '通知功能已成功开启', '/icon/512x'); + notice.send('通知开启成功', '通知功能已成功开启,可在设置中随时关闭', '/icon/512x'); } else { return false; } }); }, - send: (title, body, icon) => { + send: (title, body, icon = "/icon/512x") => { const options = { body: body, icon: icon,