add fontsize fixer

This commit is contained in:
Gabe Yuan
2023-09-09 23:32:17 +08:00
parent 7b6148302d
commit 26f213cad2

View File

@@ -5,7 +5,8 @@ import { apiFetch } from "../apis";
/** /**
* 修复程序类型 * 修复程序类型
*/ */
const WEBFIX_BR = "br"; const FIXER_BR = "br";
const FIXER_FONTSIZE = "fontSize";
/** /**
* 需要修复的站点列表 * 需要修复的站点列表
@@ -19,13 +20,19 @@ const DEFAULT_SITES = [
pattern: "www.phoronix.com", pattern: "www.phoronix.com",
selector: ".content", selector: ".content",
rootSlector: "", rootSlector: "",
fixer: WEBFIX_BR, fixer: FIXER_BR,
}, },
{ {
pattern: "t.me/s/*", pattern: "t.me/s/",
selector: ".tgme_widget_message_text", selector: ".tgme_widget_message_text",
rootSlector: ".tgme_channel_history", rootSlector: ".tgme_channel_history",
fixer: WEBFIX_BR, fixer: FIXER_BR,
},
{
pattern: "baidu.com",
selector: "html",
rootSlector: "",
fixer: FIXER_FONTSIZE,
}, },
]; ];
@@ -87,11 +94,20 @@ function brFixer(node) {
node.innerHTML = html; node.innerHTML = html;
} }
/**
* 修复字体大小问题,如 baidu.com
* @param {*} node
*/
function fontSizeFixer(node) {
node.style.cssText += "font-size:1em;";
}
/** /**
* 修复程序映射 * 修复程序映射
*/ */
const fixerMap = { const fixerMap = {
[WEBFIX_BR]: brFixer, [FIXER_BR]: brFixer,
[FIXER_FONTSIZE]: fontSizeFixer,
}; };
/** /**