|
|
@ -30,18 +30,7 @@ |
|
|
})(); |
|
|
})(); |
|
|
//#endregion
|
|
|
//#endregion
|
|
|
//#region js/common.js
|
|
|
//#region js/common.js
|
|
|
$(function() { |
|
|
|
|
|
AOS.init({ duration: 800 }); |
|
|
|
|
|
const lenis = new Lenis(); |
|
|
|
|
|
window.lenis = lenis; |
|
|
|
|
|
gsap.registerPlugin(ScrollTrigger, Observer); |
|
|
|
|
|
lenis.on("scroll", ScrollTrigger.update); |
|
|
|
|
|
gsap.ticker.add((time) => { |
|
|
|
|
|
lenis.raf(time * 1e3); |
|
|
|
|
|
}); |
|
|
|
|
|
gsap.ticker.lagSmoothing(0); |
|
|
|
|
|
|
|
|
|
|
|
const UI_I18N = { |
|
|
|
|
|
|
|
|
const UI_I18N = { |
|
|
zh: { |
|
|
zh: { |
|
|
"video.play": "视频播放", |
|
|
"video.play": "视频播放", |
|
|
"filter.by_product": "按产品筛选", |
|
|
"filter.by_product": "按产品筛选", |
|
|
@ -58,7 +47,6 @@ $(function() { |
|
|
"contact.success": "提交成功,我们会尽快与您联系!", |
|
|
"contact.success": "提交成功,我们会尽快与您联系!", |
|
|
"contact.fail": "提交失败,请稍后重试", |
|
|
"contact.fail": "提交失败,请稍后重试", |
|
|
"contact.network_error": "网络错误,请稍后重试", |
|
|
"contact.network_error": "网络错误,请稍后重试", |
|
|
"earth.hq_fuzhou": "全球总部福州", |
|
|
|
|
|
"earth.hq_fuzhou_html": "全球总部<br>福州" |
|
|
"earth.hq_fuzhou_html": "全球总部<br>福州" |
|
|
}, |
|
|
}, |
|
|
en: { |
|
|
en: { |
|
|
@ -77,19 +65,18 @@ $(function() { |
|
|
"contact.success": "Submitted successfully. We will contact you soon.", |
|
|
"contact.success": "Submitted successfully. We will contact you soon.", |
|
|
"contact.fail": "Submission failed. Please try again later.", |
|
|
"contact.fail": "Submission failed. Please try again later.", |
|
|
"contact.network_error": "Network error. Please try again later.", |
|
|
"contact.network_error": "Network error. Please try again later.", |
|
|
"earth.hq_fuzhou": "Global HQ Fuzhou", |
|
|
|
|
|
"earth.hq_fuzhou_html": "Global HQ<br>Fuzhou" |
|
|
"earth.hq_fuzhou_html": "Global HQ<br>Fuzhou" |
|
|
} |
|
|
} |
|
|
}; |
|
|
|
|
|
|
|
|
}; |
|
|
|
|
|
|
|
|
function getUiLang() { |
|
|
|
|
|
|
|
|
function getUiLang() { |
|
|
const fromHeader = document.querySelector(".site-header__lang")?.getAttribute("data-lang-current"); |
|
|
const fromHeader = document.querySelector(".site-header__lang")?.getAttribute("data-lang-current"); |
|
|
if (fromHeader === "en" || fromHeader === "zh") return fromHeader; |
|
|
if (fromHeader === "en" || fromHeader === "zh") return fromHeader; |
|
|
const seg = location.pathname.replace(/^\//, "").split("/")[0] || ""; |
|
|
const seg = location.pathname.replace(/^\//, "").split("/")[0] || ""; |
|
|
return seg === "en" ? "en" : "zh"; |
|
|
return seg === "en" ? "en" : "zh"; |
|
|
} |
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
function t(key, vars) { |
|
|
|
|
|
|
|
|
function t(key, vars) { |
|
|
const lang = getUiLang(); |
|
|
const lang = getUiLang(); |
|
|
const table = UI_I18N[lang] || UI_I18N.zh; |
|
|
const table = UI_I18N[lang] || UI_I18N.zh; |
|
|
let str = table[key] ?? UI_I18N.zh[key] ?? key; |
|
|
let str = table[key] ?? UI_I18N.zh[key] ?? key; |
|
|
@ -99,10 +86,21 @@ $(function() { |
|
|
}); |
|
|
}); |
|
|
} |
|
|
} |
|
|
return str; |
|
|
return str; |
|
|
} |
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
window.getUiLang = getUiLang; |
|
|
|
|
|
window.t = t; |
|
|
|
|
|
|
|
|
window.getUiLang = getUiLang; |
|
|
|
|
|
window.t = t; |
|
|
|
|
|
|
|
|
$(function() { |
|
|
|
|
|
AOS.init({ duration: 800 }); |
|
|
|
|
|
const lenis = new Lenis(); |
|
|
|
|
|
window.lenis = lenis; |
|
|
|
|
|
gsap.registerPlugin(ScrollTrigger, Observer); |
|
|
|
|
|
lenis.on("scroll", ScrollTrigger.update); |
|
|
|
|
|
gsap.ticker.add((time) => { |
|
|
|
|
|
lenis.raf(time * 1e3); |
|
|
|
|
|
}); |
|
|
|
|
|
gsap.ticker.lagSmoothing(0); |
|
|
|
|
|
|
|
|
const $header = $(".site-header"); |
|
|
const $header = $(".site-header"); |
|
|
const $mask = $(".mask"); |
|
|
const $mask = $(".mask"); |
|
|
|