Skip to content

Commit

Permalink
Improve layout styles
Browse files Browse the repository at this point in the history
  • Loading branch information
Super12138 committed Aug 31, 2024
1 parent b52911f commit 00d6c2f
Show file tree
Hide file tree
Showing 3 changed files with 45 additions and 36 deletions.
55 changes: 28 additions & 27 deletions src/index.css
Original file line number Diff line number Diff line change
Expand Up @@ -90,11 +90,37 @@ strong {
transition: 0.1s opacity;
}

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

#testArea {
display: none;
}

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

#resultArea {
margin-top: 3%;
display: none;
}

#backBtn {
display: none;
}

.link {
text-overflow: ellipsis;
overflow: hidden;
white-space: nowrap;
max-width: 200px;
margin: 0;
/* max-width: 200px; */
/* 设置最大宽度 */
}

Expand Down Expand Up @@ -145,31 +171,6 @@ a {
text-align: center;
}

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

#testArea {
display: none;
}

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

#resultArea {
margin-top: 3%;
display: none;
}

#backBtn {
display: none;
}

.result-tips {
line-height: var(--mdui-typescale-body-large-line-height);
font-size: var(--mdui-typescale-body-large-size);
Expand Down
2 changes: 1 addition & 1 deletion src/settings/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ document.addEventListener('settingsPageLoaded', async () => {
const appVersion: HTMLParagraphElement = document.querySelector('#appVersion')!;
const listVersion: HTMLParagraphElement = document.querySelector('#listVersion')!;
appVersion.innerHTML = `网站版本:${VERSION_NAME}-${VARIANT}-${COMMIT_HASH} (${VERSION_CODE})`;

getFile(`https://cdn.jsdelivr.net/gh/Super12138/AY-Questionnaires-DB@main/list.json?${new Date().getTime()}`)
.then((response: string) => {
const json: QuestionnairesList = JSON.parse(response);
Expand Down
24 changes: 16 additions & 8 deletions src/test/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -107,14 +107,22 @@ document.addEventListener('testPageLoaded', async () => {

document.querySelector<HTMLParagraphElement>('#questionnaireDescription')!.textContent = json.description; // 将问卷描述设置为问卷描述
document.querySelector<HTMLElement>('#questionnaireTips')!.textContent = json.answerTips; // 将提示设置为问卷提示
for (const links of json.references) { // 将引用内容上屏
const a: HTMLAnchorElement = document.createElement('a');
const br: HTMLBRElement = document.createElement('br');
a.target = '_blank'; // 在新页面打开链接
a.href = links;
a.textContent = links;
referencesElement.appendChild(a);
referencesElement.appendChild(br);
for (const link of json.references) { // 将引用内容上屏
if (link.includes("http")) { // 判断是不是URL
const a: HTMLAnchorElement = document.createElement('a');
const br: HTMLBRElement = document.createElement('br');
a.target = '_blank'; // 在新页面打开链接
a.href = link;
a.classList.add('link');
a.textContent = link;
referencesElement.appendChild(a);
referencesElement.appendChild(br);
} else {
const p: HTMLParagraphElement = document.createElement('p');
p.textContent = link;
p.classList.add('link');
referencesElement.appendChild(p);
}
}

/**
Expand Down

0 comments on commit 00d6c2f

Please sign in to comment.