Skip to content

Commit

Permalink
4.2 update
Browse files Browse the repository at this point in the history
  • Loading branch information
EnderWolf006 committed Apr 1, 2024
1 parent 0c63c3c commit 62db1cd
Show file tree
Hide file tree
Showing 6 changed files with 49 additions and 18 deletions.
1 change: 1 addition & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ jobs:
- - 2024/3/29: 已支持配置课间分隔线,适配Windows7/8系统
- - 2024/3/30: 已支持最多四周课表轮换,支持配置倒计时上方箭头小三角大小
- - 2024/3/31: 已支持单例模式(软件窗口唯一),替换更容易辨别的倒计时字体
- - 2024/4/02: 已支持课程简写角标,已支持隐藏星期显示与天数倒计时,优化倒计时字体
- 喜欢本项目的话, 点击右上角的Star支持一下作者吧😘
draft: false
prerelease: false
Expand Down
13 changes: 9 additions & 4 deletions css/style.css
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
@font-face {
font-family: Rec;
src: url("../font/Recursive-Bold.ttf");
font-family: JETB;
src: url("../font/JETBRAINSMONO-BOLD.TTF");
}

@font-face {
Expand Down Expand Up @@ -148,7 +148,7 @@
.countdown {
color: rgba(255, 255, 255, 1);
display: inline;
font-family: Rec;
font-family: JETB;
}

.miniCountdown {
Expand All @@ -160,7 +160,7 @@
background-color: rgba(0, 0, 0, var(--global-bg-opacity));
padding: var(--countdown-bg-padding);
font-size: var(--countdown-font-size);
font-family: Rec;
font-family: JETB;
color: #FFF;
display: none;
}
Expand All @@ -170,4 +170,9 @@
background-color: #aaa;
border-radius: calc(var(--divider-width) / 2);
margin: var(--divider-margin);
}

.subClass {
display: inline;
font-size: var(--sub-font-size);
}
Binary file added font/JETBRAINSMONO-BOLD.TTF
Binary file not shown.
Binary file removed font/Recursive-Bold.ttf
Binary file not shown.
26 changes: 19 additions & 7 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,9 @@
<div class="countdown" id="countdownText">00:00</div>
</div>
</div>
<div class="leftSidebar sidebar background"><span id="weekEN" class="t">Load</span><div class="corner options notIgnoreClick" id="weekCH">ing</div>
<div class="leftSidebar sidebar background" id="leftSidebar"><span id="weekEN" class="t">Load</span><div class="corner options notIgnoreClick" id="weekCH">ing</div>
</div>
<div class="rightSidebar sidebar background"><span id="countdownDays" class="t">000</span><div class="corner"></div>
<div class="rightSidebar sidebar background" id="rightSidebar"><span id="countdownDays" class="t">000</span><div class="corner"></div>
</div>
</div>
<div class="miniCountdown" id="miniCountdown">00:00</div>
Expand All @@ -47,6 +47,8 @@
let weekCH = document.getElementById('weekCH')
let countdownDays = document.getElementById('countdownDays')
let miniCountdown = document.getElementById('miniCountdown')
let rightSidebar = document.getElementById('rightSidebar')
let leftSidebar = document.getElementById('leftSidebar')
let root = document.querySelector(':root');
let isClassCountdown = true
let isClassHidden = true
Expand All @@ -66,17 +68,21 @@
function setScheduleClass() {
let classHtml = '';
for (let i = 0; i < scheduleData.scheduleArray.length; i++) {
let inner = scheduleData.scheduleArray[i]
if(scheduleData.scheduleArray[i].indexOf('@') != -1){
inner = `<div><div style="display:inline">${inner.split('@')[0]}</div><div class="subClass">${inner.split('@')[1]}</div></div>`
}
if (scheduleData.currentHighlight.index == i) {
if (scheduleData.currentHighlight.type === 'current')
classHtml += `<div class="class current" id="highlighted">${scheduleData.scheduleArray[i]}</div>`
classHtml += `<div class="class current" id="highlighted">${inner}</div>`
else if (scheduleData.currentHighlight.type === 'upcoming')
classHtml += `<div class="class upcoming" id="highlighted">${scheduleData.scheduleArray[i]}</div>`
classHtml += `<div class="class upcoming" id="highlighted">${inner}</div>`
}
else {
if (scheduleData.currentHighlight.index > i)
classHtml += `<div class="class" style="color:rgba(166,166,166);">${scheduleData.scheduleArray[i]}</div>`
classHtml += `<div class="class" style="color:rgba(166,166,166);">${inner}</div>`
else
classHtml += `<div class="class">${scheduleData.scheduleArray[i]}</div>`
classHtml += `<div class="class">${inner}</div>`
}
if (scheduleData.divider.indexOf(i) != -1)
classHtml += '<div class="divider"></div>'
Expand Down Expand Up @@ -153,7 +159,13 @@
let data = scheduleConfig.daily_class[week]
weekCH.innerText = data.Chinese
weekEN.innerText = data.English
countdownDays.innerText = Math.ceil(Math.abs(new Date(scheduleConfig.countdown_target) - date) / (1000 * 60 * 60 * 24))
if(scheduleConfig.countdown_target === 'hidden'){
rightSidebar.style.display = 'none'
}else{
rightSidebar.style.display = 'block'
countdownDays.innerText = Math.ceil(Math.abs(new Date(scheduleConfig.countdown_target) - date) / (1000 * 60 * 60 * 24))
}
leftSidebar.style.display = scheduleConfig.week_display ? 'block' : 'none'
}

function tick(reset = false) {
Expand Down
27 changes: 20 additions & 7 deletions js/scheduleConfig.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,23 @@
const _scheduleConfig = {

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

// 科目名称:所有课程科目的简写及其对应全称,冒号前面(key)为一个字简写,后面(value)为全称,不限字数,
// 星期显示:左侧框是否显示,显示为true,隐藏为false
// 直接将true或false填入冒号后边,没有引号
week_display: true,

// 科目名称:所有课程科目的简写及其对应全称,冒号前面(key)为简写,后面(value)为全称,不限字数,
// 若存在多个课程简写相同,需要加以区分,可以为简写添加下角标,使用@分隔,如'自@语',@前为简写,@后为下角标
// 要求必须做到覆盖完全,否则可能会保错
subject_name: {
'自@语': '语文周测',
'自@数': '数学周测',
'自@英': '英语周测',
'自@物': '物理周测',
'自@化': '化学周测',
'自@走': '走班周测',
'自': '自习',
'物': '物理',
'英': '英语',
Expand Down Expand Up @@ -95,37 +107,37 @@ const _scheduleConfig = {
{
Chinese: '一',
English: 'MON',
classList: ['物', '英', '数', '语', '数', '自', '自', '化', '走', ['语', '语', '语'], ['语', '语', '语'], '自'],
classList: ['物', '英', '数', '语', '数', '自', '自', '化', '走', ['语', '语', '语'], ['语', '语', '语'], '自@语'],
timetable: 'workday'
},
{
Chinese: '二',
English: 'TUE',
classList: ['英', '数', '物', '化', '语', '自', '语', '走', '自', ['化', '英', '化'], ['化', '英', '化'], '自'],
classList: ['英', '数', '物', '化', '语', '自', '语', '走', '自', ['化', '英', '化'], ['化', '英', '化'], '自@数'],
timetable: 'workday'
},
{
Chinese: '三',
English: 'WED',
classList: ['数', '化', '英', '英', '走', '体', '语', '物', '自', ['物', '物', '英'], ['物', '物', '英'], '自'],
classList: ['数', '化', '英', '英', '走', '体', '语', '物', '自', ['物', '物', '英'], ['物', '物', '英'], '自@英'],
timetable: 'workday'
},
{
Chinese: '四',
English: 'THR',
classList: ['物', '化', '数', '走', '体', '自', '英', '语', '自', ['英', '走', '走'], ['英', '走', '走'], '自'],
classList: ['物', '化', '数', '走', '体', '自', '英', '语', '自', ['英', '走', '走'], ['英', '走', '走'], '自@物'],
timetable: 'workday'
},
{
Chinese: '五',
English: 'FRI',
classList: ['英', '数', '语', '走', '物', '自', '化', '自', '自', ['数', '数', '数'], ['数', '数', '数'], '自'],
classList: ['英', '数', '语', '走', '物', '自', '化', '自', '自', ['数', '数', '数'], ['数', '数', '数'], '自@化'],
timetable: 'workday'
},
{
Chinese: '六',
English: 'SAT',
classList: [['物', '化', '英'], ['语', '数', '走'], ['化', '英', '物'], ['数', '走', '语'], ['英', '物', '化'], ['走', '语', '数'], '自', ['走', '物', '化']],
classList: [['物', '化', '英'], ['语', '数', '走'], ['化', '英', '物'], ['数', '走', '语'], ['英', '物', '化'], ['走', '语', '数'], '自@走', ['走', '物', '化']],
timetable: 'weekend'
}
],
Expand All @@ -147,6 +159,7 @@ const _scheduleConfig = {
'--divider-width': '2px', // 分隔线宽度
'--divider-margin': '6px', // 分隔线外边距
'--triangle-size': '16px', // 倒计时框上方小三角箭头的大小
'--sub-font-size': '20px', // 中间课表中的课程下角标(X@X)的字体大小
}
}

Expand Down

0 comments on commit 62db1cd

Please sign in to comment.