🐛 修复公告链接无法打开,调整链接样式

This commit is contained in:
目棃
2024-07-11 14:37:03 +08:00
parent 3f93be29b6
commit cee7d192ae
4 changed files with 11 additions and 13 deletions

View File

@@ -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",

View File

@@ -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",

View File

@@ -1,7 +1,7 @@
/*
* @file assets/css/post-parser.css
* @description 游戏公告解析 css
* @since Beta v0.4.5
* @since Beta v0.5.0
*/
.anno-body {
@@ -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) {

View File

@@ -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";
@@ -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);