Skip to content

Commit 62db1cd

Browse files
committed
4.2 update
1 parent 0c63c3c commit 62db1cd

File tree

6 files changed

+49
-18
lines changed

6 files changed

+49
-18
lines changed

.github/workflows/main.yml

+1
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,7 @@ jobs:
6767
- - 2024/3/29: 已支持配置课间分隔线,适配Windows7/8系统
6868
- - 2024/3/30: 已支持最多四周课表轮换,支持配置倒计时上方箭头小三角大小
6969
- - 2024/3/31: 已支持单例模式(软件窗口唯一),替换更容易辨别的倒计时字体
70+
- - 2024/4/02: 已支持课程简写角标,已支持隐藏星期显示与天数倒计时,优化倒计时字体
7071
- 喜欢本项目的话, 点击右上角的Star支持一下作者吧😘
7172
draft: false
7273
prerelease: false

css/style.css

+9-4
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
@font-face {
2-
font-family: Rec;
3-
src: url("../font/Recursive-Bold.ttf");
2+
font-family: JETB;
3+
src: url("../font/JETBRAINSMONO-BOLD.TTF");
44
}
55

66
@font-face {
@@ -148,7 +148,7 @@
148148
.countdown {
149149
color: rgba(255, 255, 255, 1);
150150
display: inline;
151-
font-family: Rec;
151+
font-family: JETB;
152152
}
153153

154154
.miniCountdown {
@@ -160,7 +160,7 @@
160160
background-color: rgba(0, 0, 0, var(--global-bg-opacity));
161161
padding: var(--countdown-bg-padding);
162162
font-size: var(--countdown-font-size);
163-
font-family: Rec;
163+
font-family: JETB;
164164
color: #FFF;
165165
display: none;
166166
}
@@ -170,4 +170,9 @@
170170
background-color: #aaa;
171171
border-radius: calc(var(--divider-width) / 2);
172172
margin: var(--divider-margin);
173+
}
174+
175+
.subClass {
176+
display: inline;
177+
font-size: var(--sub-font-size);
173178
}

font/JETBRAINSMONO-BOLD.TTF

278 KB
Binary file not shown.

font/Recursive-Bold.ttf

-229 KB
Binary file not shown.

index.html

+19-7
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,9 @@
2626
<div class="countdown" id="countdownText">00:00</div>
2727
</div>
2828
</div>
29-
<div class="leftSidebar sidebar background"><span id="weekEN" class="t">Load</span><div class="corner options notIgnoreClick" id="weekCH">ing</div>
29+
<div class="leftSidebar sidebar background" id="leftSidebar"><span id="weekEN" class="t">Load</span><div class="corner options notIgnoreClick" id="weekCH">ing</div>
3030
</div>
31-
<div class="rightSidebar sidebar background"><span id="countdownDays" class="t">000</span><div class="corner"></div>
31+
<div class="rightSidebar sidebar background" id="rightSidebar"><span id="countdownDays" class="t">000</span><div class="corner"></div>
3232
</div>
3333
</div>
3434
<div class="miniCountdown" id="miniCountdown">00:00</div>
@@ -47,6 +47,8 @@
4747
let weekCH = document.getElementById('weekCH')
4848
let countdownDays = document.getElementById('countdownDays')
4949
let miniCountdown = document.getElementById('miniCountdown')
50+
let rightSidebar = document.getElementById('rightSidebar')
51+
let leftSidebar = document.getElementById('leftSidebar')
5052
let root = document.querySelector(':root');
5153
let isClassCountdown = true
5254
let isClassHidden = true
@@ -66,17 +68,21 @@
6668
function setScheduleClass() {
6769
let classHtml = '';
6870
for (let i = 0; i < scheduleData.scheduleArray.length; i++) {
71+
let inner = scheduleData.scheduleArray[i]
72+
if(scheduleData.scheduleArray[i].indexOf('@') != -1){
73+
inner = `<div><div style="display:inline">${inner.split('@')[0]}</div><div class="subClass">${inner.split('@')[1]}</div></div>`
74+
}
6975
if (scheduleData.currentHighlight.index == i) {
7076
if (scheduleData.currentHighlight.type === 'current')
71-
classHtml += `<div class="class current" id="highlighted">${scheduleData.scheduleArray[i]}</div>`
77+
classHtml += `<div class="class current" id="highlighted">${inner}</div>`
7278
else if (scheduleData.currentHighlight.type === 'upcoming')
73-
classHtml += `<div class="class upcoming" id="highlighted">${scheduleData.scheduleArray[i]}</div>`
79+
classHtml += `<div class="class upcoming" id="highlighted">${inner}</div>`
7480
}
7581
else {
7682
if (scheduleData.currentHighlight.index > i)
77-
classHtml += `<div class="class" style="color:rgba(166,166,166);">${scheduleData.scheduleArray[i]}</div>`
83+
classHtml += `<div class="class" style="color:rgba(166,166,166);">${inner}</div>`
7884
else
79-
classHtml += `<div class="class">${scheduleData.scheduleArray[i]}</div>`
85+
classHtml += `<div class="class">${inner}</div>`
8086
}
8187
if (scheduleData.divider.indexOf(i) != -1)
8288
classHtml += '<div class="divider"></div>'
@@ -153,7 +159,13 @@
153159
let data = scheduleConfig.daily_class[week]
154160
weekCH.innerText = data.Chinese
155161
weekEN.innerText = data.English
156-
countdownDays.innerText = Math.ceil(Math.abs(new Date(scheduleConfig.countdown_target) - date) / (1000 * 60 * 60 * 24))
162+
if(scheduleConfig.countdown_target === 'hidden'){
163+
rightSidebar.style.display = 'none'
164+
}else{
165+
rightSidebar.style.display = 'block'
166+
countdownDays.innerText = Math.ceil(Math.abs(new Date(scheduleConfig.countdown_target) - date) / (1000 * 60 * 60 * 24))
167+
}
168+
leftSidebar.style.display = scheduleConfig.week_display ? 'block' : 'none'
157169
}
158170

159171
function tick(reset = false) {

js/scheduleConfig.js

+20-7
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,23 @@
11
const _scheduleConfig = {
22

33
// 倒计时目标:位于右侧框中的倒计时,输入日期即可,可以是中考高考期末等等,格式YYYY-MM-DD
4+
// 若想隐藏右侧的倒计时,请在下方冒号后填入'hidden', (包括引号)
45
countdown_target: '2024-6-7',
56

6-
// 科目名称:所有课程科目的简写及其对应全称,冒号前面(key)为一个字简写,后面(value)为全称,不限字数,
7+
// 星期显示:左侧框是否显示,显示为true,隐藏为false
8+
// 直接将true或false填入冒号后边,没有引号
9+
week_display: true,
10+
11+
// 科目名称:所有课程科目的简写及其对应全称,冒号前面(key)为简写,后面(value)为全称,不限字数,
12+
// 若存在多个课程简写相同,需要加以区分,可以为简写添加下角标,使用@分隔,如'自@语',@前为简写,@后为下角标
713
// 要求必须做到覆盖完全,否则可能会保错
814
subject_name: {
15+
'自@语': '语文周测',
16+
'自@数': '数学周测',
17+
'自@英': '英语周测',
18+
'自@物': '物理周测',
19+
'自@化': '化学周测',
20+
'自@走': '走班周测',
921
'自': '自习',
1022
'物': '物理',
1123
'英': '英语',
@@ -95,37 +107,37 @@ const _scheduleConfig = {
95107
{
96108
Chinese: '一',
97109
English: 'MON',
98-
classList: ['物', '英', '数', '语', '数', '自', '自', '化', '走', ['语', '语', '语'], ['语', '语', '语'], '自'],
110+
classList: ['物', '英', '数', '语', '数', '自', '自', '化', '走', ['语', '语', '语'], ['语', '语', '语'], '自@语'],
99111
timetable: 'workday'
100112
},
101113
{
102114
Chinese: '二',
103115
English: 'TUE',
104-
classList: ['英', '数', '物', '化', '语', '自', '语', '走', '自', ['化', '英', '化'], ['化', '英', '化'], '自'],
116+
classList: ['英', '数', '物', '化', '语', '自', '语', '走', '自', ['化', '英', '化'], ['化', '英', '化'], '自@数'],
105117
timetable: 'workday'
106118
},
107119
{
108120
Chinese: '三',
109121
English: 'WED',
110-
classList: ['数', '化', '英', '英', '走', '体', '语', '物', '自', ['物', '物', '英'], ['物', '物', '英'], '自'],
122+
classList: ['数', '化', '英', '英', '走', '体', '语', '物', '自', ['物', '物', '英'], ['物', '物', '英'], '自@英'],
111123
timetable: 'workday'
112124
},
113125
{
114126
Chinese: '四',
115127
English: 'THR',
116-
classList: ['物', '化', '数', '走', '体', '自', '英', '语', '自', ['英', '走', '走'], ['英', '走', '走'], '自'],
128+
classList: ['物', '化', '数', '走', '体', '自', '英', '语', '自', ['英', '走', '走'], ['英', '走', '走'], '自@物'],
117129
timetable: 'workday'
118130
},
119131
{
120132
Chinese: '五',
121133
English: 'FRI',
122-
classList: ['英', '数', '语', '走', '物', '自', '化', '自', '自', ['数', '数', '数'], ['数', '数', '数'], '自'],
134+
classList: ['英', '数', '语', '走', '物', '自', '化', '自', '自', ['数', '数', '数'], ['数', '数', '数'], '自@化'],
123135
timetable: 'workday'
124136
},
125137
{
126138
Chinese: '六',
127139
English: 'SAT',
128-
classList: [['物', '化', '英'], ['语', '数', '走'], ['化', '英', '物'], ['数', '走', '语'], ['英', '物', '化'], ['走', '语', '数'], '自', ['走', '物', '化']],
140+
classList: [['物', '化', '英'], ['语', '数', '走'], ['化', '英', '物'], ['数', '走', '语'], ['英', '物', '化'], ['走', '语', '数'], '自@走', ['走', '物', '化']],
129141
timetable: 'weekend'
130142
}
131143
],
@@ -147,6 +159,7 @@ const _scheduleConfig = {
147159
'--divider-width': '2px', // 分隔线宽度
148160
'--divider-margin': '6px', // 分隔线外边距
149161
'--triangle-size': '16px', // 倒计时框上方小三角箭头的大小
162+
'--sub-font-size': '20px', // 中间课表中的课程下角标(X@X)的字体大小
150163
}
151164
}
152165

0 commit comments

Comments
 (0)