From f910c6ebd98c855ebb432718f815f65fd1ebc060 Mon Sep 17 00:00:00 2001 From: Tipx-L <138244655+Tipx-L@users.noreply.github.com> Date: Sun, 19 Nov 2023 00:58:16 -0800 Subject: [PATCH] Change from function declaration to function expression. --- mode/connect.js | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/mode/connect.js b/mode/connect.js index dc709ecd0..6772b11dc 100644 --- a/mode/connect.js +++ b/mode/connect.js @@ -42,17 +42,20 @@ game.import('mode',function(lib,game,ui,get,ai,_status){ node.style.overflow='hidden'; var connect=function(e){ - const info=lib.config.reconnect_info; - if(info&&info[0]==node.textContent){ - game.onlineID=info[1]; - if(typeof (game.roomId=info[2])=='string') game.roomIdServer=true; - } event.textnode.textContent='正在连接...'; clearTimeout(event.timeout); if(e) e.preventDefault(); game.saveConfig('last_ip',node.textContent); game.connect(node.textContent,function(success){ - if(!success&&event.textnode){ + if(success){ + var info=lib.config.reconnect_info; + if(info&&info[0]==_status.ip){ + game.onlineID=info[1]; + if(typeof (game.roomId=info[2])=='string') game.roomIdServer=true; + } + return; + } + if(event.textnode){ alert('连接失败'); event.textnode.textContent='输入联机地址'; } @@ -121,7 +124,7 @@ game.import('mode',function(lib,game,ui,get,ai,_status){ },220); if (get.config('read_clipboard','connect')){ var ced=false; - function read(text){ + var read=text=>{ try{ var text2=text.split('\n')[2]; var ip=text2.slice(5);