Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fe: 如果有未完成的签到,显示有未读消息的提示。 #2042

Open
wants to merge 1 commit into
base: dev
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions resource/i18n/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,7 @@
"selectColumns": "Select Columns",
"selectedTags": "Selected Tags",
"week": "Expressed in weeks",
"showNotAttended": "Show not attended",
"timeline": "Time line",
"settings": "Settings",
"statistic": "Statistic",
Expand Down
1 change: 1 addition & 0 deletions resource/i18n/zh-CN.json
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,7 @@
"selectColumns": "过滤列",
"selectedTags": "标签分组过滤",
"week": "时间显示为周数",
"showNotAttended": "未签到的站点",
"timeline": "时间轴",
"settings": "参数",
"statistic": "数据图表",
Expand Down
4 changes: 4 additions & 0 deletions resource/schemas/NexusPHP/config.json
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,10 @@
"messageCount": {
"selector": ["td[style*='background: red'] a[href*='messages.php']", "div[style*='background: red'] a[href*='messages.php']"],
"filters": ["query.text().match(/(\\d+)/)", "(query && query.length>=2)?parseInt(query[1]):0"]
},
"notAttended": {
"selector": ["a.faqlink"],
"filters": ["query.text().match(/(签到得|簽到得|Attend today|今日签到|立即签到)/)", "(query && query.length>=1)?1:0"]
}
}
},
Expand Down
4 changes: 4 additions & 0 deletions resource/sites/crabpt.vip/config.json
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,10 @@
"query.text().match(/(\\d+)/)",
"(query && query.length>=2)?parseInt(query[1]):0"
]
},
"notAttended": {
"selector": ["a[class*='faqlink']"],
"filters": ["query.text().match(/\\[(签到得|簽到得|Attend)/)", "(query && query.length>=1)?1:0"]
}
}
},
Expand Down
4 changes: 4 additions & 0 deletions resource/sites/cyanbug.net/config.json
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,10 @@
"query.text().match(/(\\d+)/)",
"(query && query.length>=2)?parseInt(query[1]):0"
]
},
"notAttended": {
"selector": ["a[href*='attendance.php']"],
"filters": ["query.text().match(/(签到得|簽到得|\\[Attend)/)", "(query && query.length>=1)?1:0"]
}
}
},
Expand Down
9 changes: 9 additions & 0 deletions resource/sites/hdarea.club/config.json
Original file line number Diff line number Diff line change
Expand Up @@ -290,6 +290,15 @@
"filters": [ "query[0].childNodes[0].textContent" ]
}
}
},
"userBaseInfo": {
"merge": true,
"fields": {
"notAttended": {
"selector": ["a[href*='#'] font"],
"filters": ["['[签到]', '[Sign in]', '[簽到]'].includes(query.text())?1:0"]
}
}
}
}
}
9 changes: 9 additions & 0 deletions resource/sites/hdsky.me/config.json
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,15 @@
}
},
"selectors": {
"userBaseInfo": {
"merge": true,
"fields": {
"notAttended": {
"selector": ["a#showup"],
"filters": ["['签到', 'Show Up', '簽到'].includes(query.text())?1:0"]
}
}
},
"/torrents.php": {
"merge": true,
"fields": {
Expand Down
3 changes: 2 additions & 1 deletion resource/sites/hhanclub.top/config.json
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,8 @@
"messageCount": {
"selector": ["div.w-full > a[href='messages.php']"],
"filters": ["query.text().match(/(\\d+)/)", "(query && query.length>=2)?parseInt(query[1]):0"]
}
},
"notAttended": { }
}
},
"userExtendInfo": {
Expand Down
9 changes: 9 additions & 0 deletions resource/sites/open.cd/config.json
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,15 @@
}]
}],
"selectors": {
"userBaseInfo": {
"merge": true,
"fields": {
"notAttended": {
"selector": ["a[href*='#']"],
"filters": ["['签到', 'ShowUP', '簽到'].includes(query.text())?1:0"]
}
}
},
"userExtendInfo": {
"merge": true,
"fields": {
Expand Down
11 changes: 11 additions & 0 deletions resource/sites/pt.btschool.club/config.json
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,17 @@
"seedingPoints": "1000000",
"privilege": "十个邀请名额;发送邀请"
}],
"selectors": {
"userBaseInfo": {
"merge": true,
"fields": {
"notAttended": {
"selector": ["a[href*='index.php?action=addbonus'] font"],
"filters": ["['每日签到', 'Sign in every day'].includes(query.text())?1:0"]
}
}
}
},
"searchEntryConfig": {
"area": [
{
Expand Down
4 changes: 4 additions & 0 deletions resource/sites/qingwapt.com/config.json
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,10 @@
"query.text().match(/(\\d+)/)",
"(query && query.length>=2)?parseInt(query[1]):0"
]
},
"notAttended": {
"selector": ["a[class*='faqlink']"],
"filters": ["query.text().match(/\\[(签到得|簽到得|Attend)/)", "(query && query.length>=1)?1:0"]
}
}
},
Expand Down
4 changes: 4 additions & 0 deletions resource/sites/totheglory.im/config.json
Original file line number Diff line number Diff line change
Expand Up @@ -261,6 +261,10 @@
"messageCount": {
"selector": ["td[style*='background'] > b > a[href*='messages.php'], a[href='#notice']"],
"filters": ["query.text().match(/(\\d+)/)", "(query && query.length>=2)?parseInt(query[1]):0"]
},
"notAttended": {
"selector": ["a#signed b"],
"filters": ["['签到', 'Check-in', '출석하기'].includes(query.text())?1:0"]
}
}
},
Expand Down
4 changes: 4 additions & 0 deletions resource/sites/www.haidan.video/config.json
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,10 @@
"classPoints": {
"selector": ["a[href='classpoint.php']+span"],
"filters": ["query.text().replace(/\\D/g,'')", "query ? parseInt(query) : 0"]
},
"notAttended": {
"selector": ["input#modalBtn"],
"filters": ["query.length>0 && ['每日打卡'].includes(query[0].value)?1:0"]
}
}
}
Expand Down
17 changes: 13 additions & 4 deletions src/options/views/Home.vue
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,8 @@
@change="updateViewOptions"></v-switch>
<v-switch color="success" v-model="showLastUpdateTimeAsRelativeTime" :label="$t('home.showLastUpdateTimeAsRelativeTime')"
@change="updateViewOptions"></v-switch>
<v-switch color="success" v-model="showNotAttended" :label="$t('home.showNotAttended')"
@change="updateViewOptions"></v-switch>
</v-container>
</v-card>
</v-menu>
Expand Down Expand Up @@ -91,12 +93,13 @@
<!-- 站点 -->
<td v-if="showColumn('name')" class="center">
<v-badge color="red messageCount" overlap>
<!-- 有未读消息或签到消息。未读消息可以在站点设置里关闭。签到消息可以在本页顶部设置里关闭。 -->
<template v-slot:badge v-if="
!props.item.disableMessageCount &&
props.item.user.messageCount > 0
(!props.item.disableMessageCount && props.item.user.messageCount > 0 ) ||
(showNotAttended && props.item.user.notAttended > 0)
" :title="$t('home.newMessage')">
{{
props.item.user.messageCount > 10
(props.item.user.messageCount > 10 || props.item.user.messageCount == 0)
? ""
: props.item.user.messageCount
}}
Expand Down Expand Up @@ -605,6 +608,7 @@ export default Vue.extend({
showHnR: true,
showLastUpdateTimeAsRelativeTime:true,
showWeek: false,
showNotAttended: false,
};
},
created() {
Expand Down Expand Up @@ -655,7 +659,10 @@ export default Vue.extend({
},
allUnReadMsgSites() {
// @ts-ignore
return this.allSitesSorted.filter((site: Site) => !site.disableMessageCount && ((site.user?.messageCount || 0) > 0))
return this.allSitesSorted.filter((site: Site) =>
(!site.disableMessageCount && (site.user?.messageCount || 0) > 0) ||
(this.showNotAttended && (site.user?.notAttended || 0) > 0)
)
},
allTaggedSites() {
// @ts-ignore
Expand Down Expand Up @@ -786,6 +793,7 @@ export default Vue.extend({
showHnR: true,
showLastUpdateTimeAsRelativeTime:true,
showWeek: false,
showNotAttended: false,
selectedHeaders: this.selectedHeaders,
});
Object.assign(this, viewOptions);
Expand Down Expand Up @@ -1329,6 +1337,7 @@ export default Vue.extend({
showHnR: this.showHnR,
showLastUpdateTimeAsRelativeTime: this.showLastUpdateTimeAsRelativeTime,
showWeek: this.showWeek,
showNotAttended: this.showNotAttended,
selectedHeaders: this.selectedHeaders,
selectedTags: this.selectedTags,
},
Expand Down
3 changes: 2 additions & 1 deletion src/options/views/UserDataTimeline.vue
Original file line number Diff line number Diff line change
Expand Up @@ -331,7 +331,8 @@ export default Vue.extend({
res = res.concat(allUnTaggedSites)
}
if (tags.includes(ETagType.unReadMsg)) {
let allUnReadMsgSites = sites.filter((site: Site) => (site.user?.messageCount || 0) > 0)
// 有未读消息或签到消息
let allUnReadMsgSites = sites.filter((site: Site) => (site.user?.messageCount || 0) > 0 || (site.user?.notAttended || 0) > 0)
res = res.concat(allUnReadMsgSites)
}
if (tags.includes(ETagType.statusError)) {
Expand Down