@@ -6,30 +6,46 @@ import { initializeApp } from "firebase/app";
66import { getAnalytics } from "firebase/analytics" ;
77import { getPerformance } from "firebase/performance" ;
88
9- const firebaseConfig = {
10- apiKey : "AIzaSyANVvapu0ihi1cM8ZzuXTkwjx9lM_J1RyQ" ,
11- authDomain : "rw-api-code-d0779.firebaseapp.com" ,
12- projectId : "rw-api-code-d0779" ,
13- storageBucket : "rw-api-code-d0779.appspot.com" ,
14- messagingSenderId : "363611843335" ,
15- appId : "1:363611843335:web:f15aef7ab427f52b4033a2" ,
16- measurementId : "G-XJH5TKP5VL"
9+ const initializeFirebase = ( ) => {
10+ const firebaseConfig = {
11+ apiKey : "AIzaSyANVvapu0ihi1cM8ZzuXTkwjx9lM_J1RyQ" ,
12+ authDomain : "rw-api-code-d0779.firebaseapp.com" ,
13+ projectId : "rw-api-code-d0779" ,
14+ storageBucket : "rw-api-code-d0779.appspot.com" ,
15+ messagingSenderId : "363611843335" ,
16+ appId : "1:363611843335:web:f15aef7ab427f52b4033a2" ,
17+ measurementId : "G-XJH5TKP5VL" ,
18+ } ;
19+
20+ // Initialize Firebase
21+ const app = initializeApp ( firebaseConfig ) ;
22+ const analytics = getAnalytics ( app ) ;
23+ const perf = getPerformance ( app ) ;
24+
25+ return "Firebase initialized successfully" ;
1726} ;
18- // Initialize Firebase
19- const app = initializeApp ( firebaseConfig ) ;
20- const analytics = getAnalytics ( app ) ;
21- const perf = getPerformance ( app ) ;
27+
28+ ( async function ( ) {
29+ try {
30+ const result = await initializeFirebase ( ) ;
31+ console . log ( result ) ;
32+ } catch ( error ) {
33+ console . error ( error ) ;
34+ }
35+ } ) ( ) ;
2236
2337function wait ( timeout ) {
2438 return new Promise ( ( resolve ) => setTimeout ( resolve , timeout ) ) ;
2539}
40+
2641async function requestClipboardPermission ( ) {
2742 try {
2843 await navigator . permissions . query ( { name : "clipboard-write" } ) ;
2944 } catch ( error ) {
3045 console . error ( error ) ;
3146 }
3247}
48+
3349async function init ( ) {
3450 try {
3551 await wait ( 1000 ) ;
@@ -73,24 +89,23 @@ async function init() {
7389}
7490
7591setTimeout ( ( ) => {
76- const notFoundDiv = document . querySelector ( '.NotFound' )
77- // 添加404图片
78- const img = document . createElement ( 'img' )
79- img . src = 'https://img.quankexia.com/kelongwo/wp-content/uploads/2021/07/2021072708045950.png'
80- img . alt = '404 Error'
81- notFoundDiv . insertBefore ( img , notFoundDiv . firstChild )
92+ const notFoundDiv = document . querySelector ( ".NotFound" ) ;
93+ // 添加404图片
94+ const img = document . createElement ( "img" ) ;
95+ img . src =
96+ "https://img.quankexia.com/kelongwo/wp-content/uploads/2021/07/2021072708045950.png" ;
97+ img . alt = "404 Error" ;
98+ notFoundDiv . insertBefore ( img , notFoundDiv . firstChild ) ;
8299
83- // 将PAGE NOT FOUND改为无法找到该页面
84- notFoundDiv . querySelector ( ' .title' ) . textContent = ' 无法找到该页面'
100+ // 将PAGE NOT FOUND改为无法找到该页面
101+ notFoundDiv . querySelector ( " .title" ) . textContent = " 无法找到该页面" ;
85102
86- // 将But if you don't change your direction, and if you keep looking, you may end up where you are heading.改为无法找到该页面
87- notFoundDiv . querySelector ( '.quote' ) . textContent = '无法找到该页面'
88-
89- // 将 Take me home 按钮文字替换为返回首页
90- notFoundDiv . querySelector ( '.link' ) . textContent = '返回首页'
103+ // 将But if you don't change your direction, and if you keep looking, you may end up where you are heading.改为无法找到该页面
104+ notFoundDiv . querySelector ( ".quote" ) . textContent = "无法找到该页面" ;
91105
106+ // 将 Take me home 按钮文字替换为返回首页
107+ notFoundDiv . querySelector ( ".link" ) . textContent = "返回首页" ;
92108} , 200 ) ;
93109
94-
95110init ( ) ;
96111export default DefaultTheme ;
0 commit comments