Skip to content

Commit

Permalink
🐛 修复公告链接无法打开,调整链接样式
Browse files Browse the repository at this point in the history
  • Loading branch information
BTMuli committed Jul 11, 2024
1 parent 3f93be2 commit cee7d19
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 13 deletions.
2 changes: 2 additions & 0 deletions src-tauri/capabilities/SubWindow.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@
"log:default",
"path:allow-resolve-directory",
"path:default",
"shell:allow-open",
"shell:default",
"sql:allow-load",
"sql:allow-execute",
"sql:default",
Expand Down
2 changes: 2 additions & 0 deletions src-tauri/gen/schemas/capabilities.json
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,8 @@
"log:default",
"path:allow-resolve-directory",
"path:default",
"shell:allow-open",
"shell:default",
"sql:allow-load",
"sql:allow-execute",
"sql:default",
Expand Down
13 changes: 5 additions & 8 deletions src/assets/css/anno-parser.css
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*
* @file assets/css/post-parser.css
* @description 游戏公告解析 css
* @since Beta v0.4.5
* @since Beta v0.5.0
*/

.anno-body {
Expand Down Expand Up @@ -37,15 +37,12 @@
line-height: 2;
}

.anno-link-icon {
width: 18px;
height: 18px;
color: #00c3ff;
}

.anno-content :deep(a) {
color: #00c3ff;
text-decoration: none;
cursor: pointer;
text-decoration: underline solid #00c3ff;
text-underline-position: under;
transform: translateY(2px);
}

.anno-content :deep(p) {
Expand Down
7 changes: 2 additions & 5 deletions src/web/utils/parseAnno.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/**
* @file web/utils/parseAnno.ts
* @description 解析游戏内公告数据
* @since Beta v0.4.7
* @since Beta v0.5.0
*/

import { saveImgLocal } from "../../utils/TGShare.js";
Expand All @@ -11,14 +11,11 @@ import { decodeRegExp } from "./tools.js";

/**
* @description 解析 a
* @since Beta v0.4.4
* @since Beta v0.5.0
* @param {HTMLAnchorElement} a a 元素
* @returns {HTMLAnchorElement} 解析后的 a 元素
*/
function parseAnnoA(a: HTMLAnchorElement): HTMLAnchorElement {
const span = document.createElement("i");
span.classList.add("mdi", "mdi-link-variant", "anno-link-icon");
a.prepend(span);
const regex = /javascript:miHoYoGameJSSDK.openIn(Browser|Webview)\('(.+)'\);/;
if (regex.test(a.getAttribute("href") ?? "")) {
const href = a.getAttribute("href")?.match(regex);
Expand Down

0 comments on commit cee7d19

Please sign in to comment.