mirror of
https://github.com/jerryc127/hexo-theme-butterfly.git
synced 2026-04-16 17:50:54 +08:00
pjax
This commit is contained in:
@@ -6,7 +6,6 @@
|
||||
const translateDelay = translate.translateDelay // 延遲時間,若不在前, 要設定延遲翻譯時間, 如100表示100ms,默認為0
|
||||
const msgToTraditionalChinese = translate.msgToTraditionalChinese // 此處可以更改為你想要顯示的文字
|
||||
const msgToSimplifiedChinese = translate.msgToSimplifiedChinese // 同上,但兩處均不建議更改
|
||||
const translateButtonId = 'translateLink' // 默認互換id
|
||||
let currentEncoding = defaultEncoding
|
||||
const targetEncodingCookie = 'translate-chn-cht'
|
||||
let targetEncoding =
|
||||
@@ -86,7 +85,7 @@
|
||||
return str
|
||||
}
|
||||
function translateInitilization () {
|
||||
translateButtonObject = document.getElementById(translateButtonId)
|
||||
translateButtonObject = document.getElementById('translateLink')
|
||||
if (translateButtonObject) {
|
||||
if (currentEncoding !== targetEncoding) {
|
||||
setTimeout(function () { translateBody() }, translateDelay)
|
||||
@@ -96,4 +95,5 @@
|
||||
}
|
||||
}
|
||||
translateInitilization()
|
||||
document.addEventListener('pjax:complete', translateInitilization)
|
||||
})()
|
||||
|
||||
Reference in New Issue
Block a user