File tree Expand file tree Collapse file tree 3 files changed +24
-7
lines changed
Expand file tree Collapse file tree 3 files changed +24
-7
lines changed Original file line number Diff line number Diff line change @@ -54,6 +54,10 @@ function setupEventListeners() {
5454
5555 try {
5656 const events = await fetchCalendarData ( sesskey ) ;
57+ if ( events . length === 0 ) {
58+ document . getElementById ( "result" ) . textContent = "沒有行事曆事件" ;
59+ return ;
60+ }
5761 downloadICS ( events ) ;
5862 document . getElementById ( "result" ) . textContent = `成功匯出 ${ events . length } 個行事曆事件` ;
5963 } catch ( error ) {
Original file line number Diff line number Diff line change 55 < meta name ="viewport " content ="width=device-width, initial-scale=1.0 " />
66 < link href ="./css/output.css " rel ="stylesheet " />
77 </ head >
8- < body class ="p-4 w-52 flex items-center justify-center flex-col bg-white shadow-md rounded-lg ">
8+ < body class ="p-4 w-56 flex items-center justify-center flex-col bg-white shadow-md rounded-lg ">
99 < h1 class ="text-xl font-bold "> Moodle Calendar</ h1 >
10- < div class ="my-2 ">
11- < input type ="number " id ="yearInput " class ="w-16 p-1 border rounded " /> 年
12- < input type ="number " id ="monthInput " class ="w-12 p-1 border rounded " /> 月
10+ < div class ="my-2 flex items-center space-x-2 ">
11+ < input
12+ type ="number "
13+ id ="yearInput "
14+ class ="w-20 px-2 py-1 text-center border border-gray-300 rounded-md shadow-sm focus:outline-none focus:ring-2 focus:ring-violet-500 focus:border-violet-500 "
15+ placeholder ="年 "
16+ />
17+ < span class ="text-gray-700 "> 年</ span >
18+ < input
19+ type ="number "
20+ id ="monthInput "
21+ class ="w-16 px-2 py-1 text-center border border-gray-300 rounded-md shadow-sm focus:outline-none focus:ring-2 focus:ring-violet-500 focus:border-violet-500 "
22+ placeholder ="月 "
23+ />
24+ < span class ="text-gray-700 "> 月</ span >
1325 </ div >
1426 < button
1527 id ="exportBtn "
16- class ="bg-violet-400 text-white px-4 py-2 my-2 rounded cursor-pointer hover:bg-violet-700 "
28+ class ="bg-violet-400 text-white px-4 py-2 my-2 rounded-md shadow-md cursor-pointer hover:bg-violet-700 focus:outline-none focus:ring-2 focus:ring-violet-500 "
1729 >
1830 取得行事曆
1931 </ button >
2032 < pre id ="result " class ="text-sm whitespace-pre-wrap "> </ pre >
21- < div > This tool help you to export your Moodle calendar events to a .ics file.</ div >
33+ < div class ="text-gray-600 text-sm text-center ">
34+ This tool helps you export your Moodle calendar events to a .ics file.
35+ </ div >
2236
2337 <!-- Use type="module" for ES module support -->
2438 < script type ="module " src ="./js/popup.js "> </ script >
You can’t perform that action at this time.
0 commit comments