From 045a2a70162bfa71c2afdf5c4e57e1fd435d7f40 Mon Sep 17 00:00:00 2001 From: teaSummer Date: Tue, 13 Aug 2024 17:18:50 +0800 Subject: [PATCH] fix: title --- scripts/main.js | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/scripts/main.js b/scripts/main.js index abb9cf5..7dc34f5 100644 --- a/scripts/main.js +++ b/scripts/main.js @@ -413,19 +413,20 @@ const pre_list = ((e) => { else dom += `
${category}`; let content; // 生成元素 - for (const [title, url, description, autoLang] of block[category]) { + for (const [_title, url, description, autoLang] of block[category]) { let template = '|DOM|'; - if (autoLang && description) template = `|DOM|`; + if (autoLang && description != '') template = `|DOM|`; else if (description) template = `|DOM|`; + const title = autoLang ? `al="${_title}">` : `>${_title}`; // 判断是否为内部链接 if (url.startsWith('#')) { // 内部链接 - content = `${title}`; + content = ``; } else { // 外部链接 if (importantPattern.test(title)) { - content = `${title.replace(importantPattern, '$1')}`; - } else content = `${title}`; + content = `$1')}`; + } else content = ``; }; dom += template.replace('|DOM|', content); };