Skip to content

Commit

Permalink
设置选择文本高亮颜色匹配主题色
Browse files Browse the repository at this point in the history
  • Loading branch information
Super12138 committed Nov 15, 2024
1 parent 0e4e013 commit 764247f
Show file tree
Hide file tree
Showing 2 changed files with 66 additions and 53 deletions.
109 changes: 61 additions & 48 deletions src/index.css
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,19 @@ a:active {
text-decoration: none;
}

/* 选中文本高亮颜色 */
::selection {
background: rgb(var(--mdui-color-secondary-container)) !important;
}

::-moz-selection {
background: rgb(var(--mdui-color-secondary-container)) !important;
}

::-webkit-selection {
background: rgb(var(--mdui-color-secondary-container)) !important;
}

/* 题库列表自适应宽度 */
mdui-list {
width: 100%;
Expand Down Expand Up @@ -83,54 +96,6 @@ mdui-radio {
flex-wrap: wrap;
}

/* 答题页面样式 */
#testContainer {
margin: 8px;
display: none;
opacity: 0;
transition: 0.1s opacity;
/*
display: flex;
flex-direction: column;
min-height: 100vh; */
/* 或者设置为具体的高度 */
}

#controlArea {
margin: 5% 2% 22% 2%;
}

#loadingTip {
opacity: 1;
transition: 0.1s opacity;
}

#listContent {
display: none;
opacity: 0;
transition: 0.1s opacity;
}

#nullTip {
display: none;
width: 100%;
}

#testArea {
display: none;
}

#references {
text-overflow: ellipsis;
overflow: hidden;
white-space: nowrap;
width: 100%;
}

#resultArea {
display: none;
}

.link {
text-overflow: ellipsis;
overflow: hidden;
Expand Down Expand Up @@ -216,6 +181,54 @@ mdui-radio {
color: #1B5E20;
}

/* 答题页面样式 */
#testContainer {
margin: 8px;
display: none;
opacity: 0;
transition: 0.1s opacity;
/*
display: flex;
flex-direction: column;
min-height: 100vh; */
/* 或者设置为具体的高度 */
}

#controlArea {
margin: 5% 2% 22% 2%;
}

#loadingTip {
opacity: 1;
transition: 0.1s opacity;
}

#listContent {
display: none;
opacity: 0;
transition: 0.1s opacity;
}

#nullTip {
display: none;
width: 100%;
}

#testArea {
display: none;
}

#references {
text-overflow: ellipsis;
overflow: hidden;
white-space: nowrap;
width: 100%;
}

#resultArea {
display: none;
}

@media (prefers-color-scheme: dark) {
.red {
color: #D32F2F;
Expand Down
10 changes: 5 additions & 5 deletions src/pwa/pwa.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@ import { snackbar } from "mdui/functions/snackbar.js";
import { registerSW } from 'virtual:pwa-register';

export function initPWA() {
let refreshSW: (reloadPage?: boolean) => Promise<void> | undefined
let refreshSW: (reloadPage?: boolean) => Promise<void> | undefined;

let swActivated = false
let swActivated = false;
// 每小时检查一次更新
const period = 60 * 60 * 1000
const period = 60 * 60 * 1000;

window.addEventListener('load', () => {
refreshSW = registerSW({
Expand All @@ -27,7 +27,7 @@ export function initPWA() {
});
},
onRegisteredSW(swUrl, r) {
if (period <= 0) return
if (period <= 0) return;
if (r?.active?.state === 'activated') {
swActivated = true
registerPeriodicSync(period, swUrl, r)
Expand Down Expand Up @@ -69,5 +69,5 @@ function registerPeriodicSync(period: number, swUrl: string, r: ServiceWorkerReg

if (resp?.status === 200)
await r.update()
}, period)
}, period);
}

0 comments on commit 764247f

Please sign in to comment.