2
2
< html >
3
3
< head >
4
4
< meta charset ="UTF-8 " />
5
- < link
6
- rel ="icon "
7
- href ="https://raw.githubusercontent.com/JacobLinCool/leetcode-stats-card/main/favicon/leetcode.ico "
8
- />
5
+ < link rel ="icon " href ="https://raw.githubusercontent.com/JacobLinCool/leetcode-stats-card/main/favicon/leetcode.ico " />
9
6
< meta name ="viewport " content ="width=device-width, initial-scale=1.0 " />
10
7
< title > LeetCode Stats Card</ title >
11
8
< meta property ="og:title " content ="LeetCode Stats Card " />
12
- < meta
13
- property ="og:description "
14
- content ="A simple tool for every leetcoder. Show your leetcode stats on your GitHub profile or your website! "
15
- />
9
+ < meta property ="og:description " content ="A simple tool for every leetcoder. Show your leetcode stats on your GitHub profile or your website! " />
16
10
</ head >
17
11
< body >
18
12
< h1 > LeetCode Stats Card</ h1 >
19
- < input id ="username " placeholder ="Your LeetCode Username " />
20
- < select id ="theme ">
21
- ${theme_options}
22
- </ select >
23
- < select id ="font ">
24
- ${font_options}
25
- </ select >
26
- < select id ="extension ">
27
- < option value ="" selected > No Extension</ option >
28
- < option value ="activity "> Activity</ option >
29
- < option value ="contest "> Contest</ option >
30
- < option value ="heatmap "> Heatmap</ option >
31
- </ select >
32
- < select id ="site ">
33
- < option value ="us " selected > Source: LeetCode</ option >
34
- < option value ="cn "> Source: LeetCode CN</ option >
35
- </ select >
13
+ < div class ="input-group ">
14
+ < label for ="username "> Username:</ label >
15
+ < input id ="username " placeholder ="Your LeetCode Username " />
16
+ </ div >
17
+ < div class ="input-group ">
18
+ < label for ="theme "> Theme:</ label >
19
+ < select id ="theme "> ${theme_options}</ select >
20
+ </ div >
21
+ < div class ="input-group ">
22
+ < label for ="font "> Font:</ label >
23
+ < select id ="font "> ${font_options}</ select >
24
+ </ div >
25
+ < div class ="input-group ">
26
+ < label for ="extension "> Extension:</ label >
27
+ < select id ="extension ">
28
+ < option value ="" selected > No Extension</ option >
29
+ < option value ="activity "> Activity</ option >
30
+ < option value ="contest "> Contest</ option >
31
+ < option value ="heatmap "> Heatmap</ option >
32
+ </ select >
33
+ </ div >
34
+ < div class ="input-group ">
35
+ < label for ="site "> Source:</ label >
36
+ < select id ="site ">
37
+ < option value ="us " selected > Source: LeetCode</ option >
38
+ < option value ="cn "> Source: LeetCode CN</ option >
39
+ </ select >
40
+ </ div >
36
41
< div >
37
42
< button onclick ="preview() "> Preview</ button >
38
43
< button onclick ="go() "> Go</ button >
39
44
< button onclick ="md() "> Markdown</ button >
40
45
</ div >
41
46
< div > < img id ="preview " /> </ div >
42
47
< div style ="margin-top: 20px ">
43
- < a
44
- href ="https://github.com/JacobLinCool/LeetCode-Stats-Card "
45
- target ="_blank "
46
- style ="color: royalblue; text-decoration: none "
47
- > Documentation on GitHub</ a
48
- >
48
+ < a href ="https://github.com/JacobLinCool/LeetCode-Stats-Card " target ="_blank " style ="color: royalblue; text-decoration: none "> Documentation on GitHub</ a >
49
+ </ div >
50
+ < div class ="theme-toggle " onclick ="toggleTheme() ">
51
+ < svg id ="theme-icon " width ="24 " height ="24 " viewBox ="0 0 24 24 " fill ="none " stroke ="currentColor " stroke-width ="2 " stroke-linecap ="round " stroke-linejoin ="round ">
52
+ < circle cx ="12 " cy ="12 " r ="5 "> </ circle >
53
+ < path d ="M12 1v2 "> </ path >
54
+ < path d ="M12 21v2 "> </ path >
55
+ < path d ="M4.22 4.22l1.42 1.42 "> </ path >
56
+ < path d ="M18.36 18.36l1.42 1.42 "> </ path >
57
+ < path d ="M1 12h2 "> </ path >
58
+ < path d ="M21 12h2 "> </ path >
59
+ < path d ="M4.22 19.78l1.42-1.42 "> </ path >
60
+ < path d ="M18.36 5.64l1.42-1.42 "> </ path >
61
+ </ svg >
49
62
</ div >
50
63
< style >
51
- html ,
52
- body {
64
+ html , body {
53
65
width : 100% ;
54
66
height : 100% ;
55
67
margin : 0 ;
56
68
padding : 0 ;
57
-
58
69
display : flex;
59
70
flex-direction : column;
60
71
justify-content : center;
61
72
align-items : center;
62
-
63
73
font-family : sans-serif;
74
+ background-color : var (--bg-color );
75
+ color : var (--text-color );
64
76
}
65
77
h1 {
66
78
margin : 8px 0 ;
67
79
}
68
- input ,
69
- select {
80
+ .input-group {
81
+ display : flex;
82
+ align-items : center;
70
83
width : 320px ;
71
84
margin : 8px 0 ;
85
+ }
86
+ .input-group label {
87
+ width : 100px ;
88
+ text-align : left;
89
+ font-weight : 600 ;
90
+ }
91
+ input , select {
92
+ flex-grow : 1 ;
72
93
padding : 2px ;
73
94
}
74
95
button {
@@ -78,7 +99,6 @@ <h1>LeetCode Stats Card</h1>
78
99
div {
79
100
width : 320px ;
80
101
margin : 8px 0 ;
81
-
82
102
display : flex;
83
103
flex-direction : row;
84
104
justify-content : center;
@@ -88,9 +108,26 @@ <h1>LeetCode Stats Card</h1>
88
108
width : 100% ;
89
109
min-height : 128px ;
90
110
}
111
+ .theme-toggle {
112
+ cursor : pointer;
113
+ margin-top : 10px ;
114
+ }
115
+ : root {
116
+ --bg-color : white;
117
+ --text-color : black;
118
+ }
119
+ .dark-mode {
120
+ --bg-color : black;
121
+ --text-color : white;
122
+ }
91
123
</ style >
92
124
< script >
93
- preview ( ) ;
125
+ function toggleTheme ( ) {
126
+ document . body . classList . toggle ( 'dark-mode' ) ;
127
+ }
128
+ function preview ( ) {
129
+ document . querySelector ( "#preview" ) . src = url ( ) ;
130
+ }
94
131
function url ( ) {
95
132
if ( ! value ( "username" ) ) document . querySelector ( "#username" ) . value = "JacobLinCool" ;
96
133
return (
@@ -105,9 +142,6 @@ <h1>LeetCode Stats Card</h1>
105
142
( value ( "site" ) === "cn" ? "&site=cn" : "" )
106
143
) ;
107
144
}
108
- function preview ( ) {
109
- document . querySelector ( "#preview" ) . src = url ( ) ;
110
- }
111
145
function go ( ) {
112
146
let win = window . open ( ) ;
113
147
win . location = url ( ) ;
0 commit comments