Skip to content

Commit

Permalink
fix(script): 优化超星人脸识别检测警告
Browse files Browse the repository at this point in the history
  • Loading branch information
enncy committed May 23, 2024
1 parent a570f82 commit 311d8ad
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions packages/scripts/src/projects/cx.ts
Original file line number Diff line number Diff line change
Expand Up @@ -505,6 +505,7 @@ export const CXProject = Project.create({
namespace: 'cx.new.study-dispatcher',
hideInPanel: true,
async oncomplete() {
// 注册快捷菜单
$menu('🖥️', { scriptPanelLink: CXProject.scripts.study });
$menu('⚙️', { scriptPanelLink: CommonProject.scripts.settings });
$menu('🌏', { scriptPanelLink: CommonProject.scripts.workResults });
Expand Down Expand Up @@ -1808,8 +1809,17 @@ function waitForFaceRecognition() {

return new Promise<void>((resolve) => {
const interval = setInterval(() => {
const face = $el('#fcqrimg', top?.document);
if (face) {
// 人脸元素有时候 src 属性为空字符串,所以这里需要判断 src 是否为空字符串,如是则人脸识别会出现。
const faces = $$el<HTMLImageElement>('#fcqrimg', top?.document);
let active = false;
for (const face of faces) {
const src = face.getAttribute('src');
if (src) {
active = true;
break;
}
}
if (active) {
if (!notified) {
notified = true;
const msg = '检测到人脸识别,请手动进行识别后脚本才会继续运行。';
Expand Down

0 comments on commit 311d8ad

Please sign in to comment.