From e8b23ff4cb30ca22b8ffe5475454740f82cf0077 Mon Sep 17 00:00:00 2001 From: oc Date: Tue, 19 Feb 2019 22:43:46 +0800 Subject: [PATCH] compress route --- libs/utils.js | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/libs/utils.js b/libs/utils.js index cd2bfa8f..f1910e4e 100644 --- a/libs/utils.js +++ b/libs/utils.js @@ -462,7 +462,9 @@ utils.prototype.encodeRoute = function (route) { ans+=lastMove.substring(0,1).toUpperCase(); if (cnt>1) ans+=cnt; } - return ans; + // return ans; + // 压缩 + return LZString.compressToBase64(ans); } ////// 解密路线 ////// @@ -470,6 +472,14 @@ utils.prototype.decodeRoute = function (route) { if (!core.isset(route)) return route; + // 解压缩 + try { + var v = LZString.decompressFromBase64(route); + if (core.isset(v) && /^[a-zA-Z0-9:]+$/.test(v)) { + route = v; + } + } catch (e) {} + var ans=[], index=0; var getNumber = function (noparse) {