Skip to content

Commit

Permalink
调整
Browse files Browse the repository at this point in the history
  • Loading branch information
onresize committed Jun 13, 2024
1 parent b6019f5 commit 2dae009
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 25 deletions.
2 changes: 1 addition & 1 deletion docs/.vuepress/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ function reWriteLog() {
return isProd ? function () {} : log
})(console.log)
}
// reWriteLog() // 线上重写console.log
reWriteLog() // 线上重写console.log

export default defineUserConfig({
// 打包工具
Expand Down
43 changes: 19 additions & 24 deletions docs/.vuepress/public/static/js/auto-upgrade.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,29 +3,24 @@ void (function () {
s = document.createElement('script')
s.type = 'text/javascript'
s.id = 'version-polling'
setTimeout(() => {
console.log('是否为github:', location.href.includes('github.io'))
s.src =
'https://web-blogs-embrance-t-59e6df9d980ba7c216f8993005a68b570df639f055.gitlab.io/static/js/version-polling.js'

s.src = location.href.includes('github.io')
? '/web-blogs/static/js/version-polling.js'
: '/static/js/version-polling.js'

t = document.getElementsByTagName('script')[0]
t.parentNode.appendChild(s, t)
s.onload = function () {
VersionPolling.createVersionPolling({
appETagKey: '__APP_ETAG__',
pollingInterval: 5 * 1000,
silent: globalThis?.location?.port == '3080', // 3080端口下不检测
onUpdate: (self) => {
const result = confirm('页面有更新,点击确定刷新页面!')
if (result) {
self.onRefresh()
} else {
self.onCancel()
}
},
})
}
}, 1e3)
t = document.getElementsByTagName('script')[0]
t.parentNode.appendChild(s, t)
s.onload = function () {
VersionPolling.createVersionPolling({
appETagKey: '__APP_ETAG__',
pollingInterval: 5 * 1000,
silent: globalThis?.location?.port == '3080', // 3080端口下不检测
onUpdate: (self) => {
const result = confirm('页面有更新,点击确定刷新页面!')
if (result) {
self.onRefresh()
} else {
self.onCancel()
}
},
})
}
})()

0 comments on commit 2dae009

Please sign in to comment.