火狐v129才支持重复正则表达式匹配组,所以只能这样兼容旧版本

This commit is contained in:
枫谷剑仙 2024-07-29 16:55:57 +08:00
parent 4c41eaead8
commit f61851e3e5
3 changed files with 11 additions and 6 deletions

View File

@ -23,6 +23,7 @@
//{name: "Class static initialization blocks / 静态初始化块", version:{firefox:93,chrome:94,safari:16.4}, url: "https://caniuse.com/mdn-javascript_classes_static_initialization_blocks", test: ()=>Boolean(runCodeWithFunction("class test { static { this.staticProperty = true;};}, true"))},
{name: "Array.prototype.toSorted()", version:{firefox:115,chrome:110,safari:16.0}, url: "https://caniuse.com/mdn-javascript_builtins_array_tosorted", test: ()=>Boolean(Array.prototype.toSorted)},
{name: "Set.prototype.isDisjointFrom()", version:{firefox:127,chrome:122,safari:17.0}, url: "https://caniuse.com/mdn-javascript_builtins_set_isdisjointfrom", test: ()=>Boolean(Set.prototype.isDisjointFrom)},
//{name: "Duplicate named capture group / 重复的正则表达式匹配命名组", version:{firefox:129,chrome:125,safari:17.0}, url: "https://caniuse.com/mdn-javascript_regular_expressions_named_capturing_group_duplicate_named_capturing_groups", test: ()=>Boolean(runCodeWithFunction("/(?<year>\\d{4})-\\d{2}|\\d{2}-(?<year>\\d{4})/"))},
];
const unsupportFeatures = features.filter(feature=>{
@ -76,7 +77,10 @@ Please update your browser core to Firefox ≥ ${needBrowserVersion.firefox} or
}
//alert(alertStr);
document.write(alertStr);
const event = window.addEventListener("load", ()=>{
document.body.insertAdjacentHTML("afterbegin", alertStr);
window.removeEventListener("load", event);
});
}
if (/\b(?:MicroMessenger|WeChat|Weixin|QQ|AliApp)\b/.test(navigator.userAgent)) {
@ -112,7 +116,7 @@ Please update your browser core to Firefox ≥ ${needBrowserVersion.firefox} or
const event = window.addEventListener("load", ()=>{
document.body.appendChild(mask);
window.removeEventListener(event);
window.removeEventListener("load", event);
});
}
})();

View File

@ -4200,8 +4200,9 @@ function initialize() {
const stringSearchDialog = document.getElementById("dialog-search-string");
//将输入的字符串变为参数数组
function parseArgumentsString(str) {
const matches = [...str.matchAll(/\"(?<arg>[^\"]*)\"|(?<arg>\S+)/ig)];
return matches.map(match=>match?.groups?.arg);
//火狐v129才支持重复正则表达式匹配组所以只能这样兼容旧版本
const matches = [...str.matchAll(new RegExp('\\"(?<arg1>[^\\"]*)\\"|(?<arg2>\\S+)', "ig"))];
return matches.map(match=>match?.groups?.arg1 ?? match?.groups?.arg2);
}
function searchByString(str, onlyInTag = false)
{ // 考虑了一下onlyInTag被废弃了因为和游戏内搜索不符

View File

@ -32307,7 +32307,7 @@ const cachesMap = new Map([
],
[
"browser-compatibility.js",
"1c78506fba7e3de6130cdd35438f2244"
"3f645b199181d26bdf7e0234c509de6a"
],
[
"index.html",
@ -32335,7 +32335,7 @@ const cachesMap = new Map([
],
[
"script.js",
"c7c5a6235bf493adc74b6ba2e07e7281"
"68c72517201706ab1b7c2fe1874e1250"
],
[
"solo.html",