From 72e6f7e076f06d5ba079388af51f2618adecc52d Mon Sep 17 00:00:00 2001 From: Rintim Date: Wed, 15 Nov 2023 22:22:23 +0800 Subject: [PATCH] feat: add method to get core info. --- game/game.js | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/game/game.js b/game/game.js index 2e298f74a..dcb700c56 100644 --- a/game/game.js +++ b/game/game.js @@ -58445,6 +58445,23 @@ }, }; const get={ + /** + * 获取当前内核版本信息 + * + * 目前仅考虑`chrome`, `firefox`和`safari`三种浏览器的信息,其余均归于其他范畴 + * + * > 其他后续或许会增加,但`IE`永无可能 + * + * @returns {["firefox" | "chrome" | "safari" | "other", number]} + */ + coreInfo(){ + const regex=/(firefox|chrome|safari)\/([\d.]+)/; + let result; + if (!(result=userAgent.match(regex))) return ["other",NaN]; + if (result[1]!="safari") return [result[1],parseInt(result[2])]; + result=userAgent.match(/version\/([\d.]+).*safari/); + return ["safari",parseInt(result[1])]; + }, /** * 返回 VCard[] 形式的所有牌,用于印卡将遍历 * @param {Function} filter