fix: use slide captcha for iphone

This commit is contained in:
RockYang
2024-03-28 15:00:53 +08:00
parent c8ab209426
commit e6a18445c3
12 changed files with 456 additions and 34 deletions

View File

@@ -220,23 +220,7 @@ export function escapeHTML(html) {
.replace(/>/g, ">");
}
// 处理数学公式
export function processMathFormula(input) {
const arr = []
const lines = input.split("\n")
if (lines.length <= 1) {
return input
}
// 定义匹配数学公式的正则表达式
const mathFormulaRegex = /[+\-*/^()\d.]/;
for (let i = 0; i < lines.length; i++) {
if (i > 0 && mathFormulaRegex.test(lines) && lines[i - 1].indexOf("$$") === -1) {
arr.push("$$")
arr.push(lines[i])
arr.push("$$")
} else {
arr.push(lines[i])
}
}
return arr.join("\n")
// 判断是否为 iphone 设备
export function isIphone() {
return /iPhone/i.test(navigator.userAgent) && !/iPad/i.test(navigator.userAgent);
}