@@ -6,7 +6,7 @@ import { makeSearchable } from '../../scripts/components/search.mjs'
66import { renderTemplate , usingTemplates } from '../../scripts/features/template.mjs'
77import { showToastI18n } from '../../scripts/features/toast.mjs'
88import { waitForFountService , saveFountHostUrl , getFountHostUrl , pingFount } from '../../scripts/fountHostGetter.mjs'
9- import { initTranslations , geti18n , console , getAvailableLocales , getLocaleNames , setLocales , onLanguageChange } from '../../scripts/i18n/index.mjs'
9+ import { initTranslations , geti18n , console , getAvailableLocales , getLocaleNames , setLocales , onLanguageChange , setElementI18n } from '../../scripts/i18n/index.mjs'
1010import { escapeHtml } from '../../scripts/lib/escapeHtml.mjs'
1111import { viewTransition } from '../../scripts/lib/viewTransition.mjs'
1212import {
@@ -45,6 +45,8 @@ const starThankYouEl = document.getElementById('star-thank-you')
4545const testimonialsBlock = document . getElementById ( 'testimonials-block' )
4646const testimonialCurrent = document . getElementById ( 'testimonial-current' )
4747const testimonialNext = document . getElementById ( 'testimonial-next' )
48+ const utmWelcomeDialog = document . getElementById ( 'utm-welcome-dialog' )
49+ const utmWelcomeMessage = document . getElementById ( 'utm-welcome-message' )
4850
4951/**
5052 * 从指定 URL 获取 JSON 数据。
@@ -159,6 +161,19 @@ async function playHeroAnimation() {
159161 }
160162}
161163
164+ /**
165+ * 若 URL 带 utm_source,在 hero 入场结束后弹出欢迎对话框。
166+ * @returns {void }
167+ */
168+ function maybeShowUtmWelcome ( ) {
169+ const source = new URLSearchParams ( location . search ) . get ( 'utm_source' ) ?. trim ( )
170+ if ( ! source ) return
171+ setElementI18n ( utmWelcomeMessage , 'installer_wait_screen.utm_welcome.message' , {
172+ source : escapeHtml ( source ) ,
173+ } )
174+ utmWelcomeDialog . showModal ( )
175+ }
176+
162177/**
163178 * 渲染主题预览。
164179 */
@@ -700,6 +715,7 @@ async function main() {
700715 initTranslations ( 'installer_wait_screen' ) ,
701716 playHeroAnimation ( )
702717 ] )
718+ maybeShowUtmWelcome ( )
703719
704720 adjectiveRotator = createRotatingText ( rotatingAdjectiveEl , [ ] , 2500 )
705721 nounRotator = createRotatingText ( rotatingNounEl , [ ] , 2500 )
0 commit comments