完善联机模式(应用外)邀请功能-2
This commit is contained in:
parent
fd9972f6f3
commit
70852b815f
|
@ -34867,12 +34867,14 @@
|
|||
ui.rooms.push(player);
|
||||
}
|
||||
}
|
||||
if(get.config('read_clipboard','connect')){
|
||||
if(!_status.requestReadClipboard&&get.config('read_clipboard','connect')){
|
||||
//每次启动只请求一次
|
||||
_status.requestReadClipboard=true;
|
||||
function read(text){
|
||||
try{
|
||||
var roomId=text.split('\n')[1].match(/\d+/);
|
||||
var caption=ui.rooms.find(caption=>caption.key==roomId);
|
||||
if (caption&&(confirm(`是否通过复制的内容加入${roomId}房间?`)||_status.read_clipboard_text)){
|
||||
if (caption&&(_status.read_clipboard_text||confirm(`是否通过复制的内容加入${roomId}房间?`))){
|
||||
ui.click.connectroom.call(caption);
|
||||
delete _status.read_clipboard_text;
|
||||
}
|
||||
|
@ -34891,7 +34893,6 @@
|
|||
input.blur();
|
||||
ui.window.removeChild(input);
|
||||
if(result||input.value.length>0) read(input.value);
|
||||
//也就小b兼容版不支持直接读取了
|
||||
else if(confirm('是否输入邀请链接以加入房间?')){
|
||||
var text=prompt('请输入邀请链接');
|
||||
if(typeof text=='string'&&text.length>0) read(text);
|
||||
|
|
|
@ -141,7 +141,7 @@ game.import('mode',function(lib,game,ui,get,ai,_status){
|
|||
}catch(e){console.log(e);}
|
||||
}
|
||||
window.focus();
|
||||
if (navigator.clipboard){
|
||||
if (navigator.clipboard&&lib.node){
|
||||
navigator.clipboard.readText().then(read).catch(_=>{});
|
||||
}else{
|
||||
var input=ui.create.node('textarea',ui.window,{opacity:'0'});
|
||||
|
@ -149,8 +149,7 @@ game.import('mode',function(lib,game,ui,get,ai,_status){
|
|||
var result=document.execCommand('paste');
|
||||
input.blur();
|
||||
ui.window.removeChild(input);
|
||||
if(result) read(input.value);
|
||||
//也就小b兼容版不支持直接读取了
|
||||
if(result||input.value.length>0) read(input.value);
|
||||
else if(confirm('是否输入邀请链接以进入联机地址和房间?')){
|
||||
ced=true;
|
||||
var text=prompt('请输入邀请链接');
|
||||
|
|
Loading…
Reference in New Issue