Make `core-js` always available.

This commit is contained in:
Tipx-L 2023-11-14 22:49:32 -08:00
parent 2b2e8885dc
commit c42c184d28
2 changed files with 50 additions and 36 deletions

View File

@ -1,20 +1,31 @@
{ {
"extends": "eslint:recommended", "extends": "eslint:recommended",
"env": { "env": {
"browser": true, "browser": true,
"node": true, "node": true,
"es6": true, "es6": true,
"worker": true "worker": true
}, },
"rules": { "rules": {
"no-console": 0, "no-console": 0,
"no-unused-vars": 0, "no-unused-vars": 0,
"no-undef": 0, "no-undef": 0,
"no-redeclare": 0, "no-redeclare": 0,
"require-yield": 0, "require-yield": 0,
"no-irregular-whitespace": ["error", { "skipStrings": true, "skipTemplates": true }], "no-irregular-whitespace": [
"no-constant-condition": ["error", { "checkLoops": false }]/* , "error",
"comma-dangle": ["error", "only-multiline"], {
"complexity": ["error",100] */ "skipStrings": true,
} "skipTemplates": true
}
],
"no-constant-condition": [
"error",
{
"checkLoops": false
}
] /* ,
"comma-dangle": ["error", "only-multiline"],
"complexity": ["error",100] */
}
} }

View File

@ -1,5 +1,15 @@
"use strict"; "use strict";
{ const nonameInitialized=localStorage.getItem('noname_inited');
const assetURL=typeof nonameInitialized!='string'||nonameInitialized=='nodejs'?'':nonameInitialized;
new Promise(resolve=>{
if('__core-js_shared__' in window) resolve();
else{
const coreJSBundle=document.createElement('script');
coreJSBundle.onerror=coreJSBundle.onload=resolve;
coreJSBundle.src=`${assetURL}game/core-js-bundle.js`;
document.head.appendChild(coreJSBundle);
}
}).then(()=>{
/** /**
* @typedef {InstanceType<typeof lib.element.Player>} Player * @typedef {InstanceType<typeof lib.element.Player>} Player
* @typedef {InstanceType<typeof lib.element.Card>} Card * @typedef {InstanceType<typeof lib.element.Card>} Card
@ -36,7 +46,6 @@
} }
} }
} }
const nonameInitialized=localStorage.getItem('noname_inited');
const GeneratorFunction=(function*(){}).constructor; const GeneratorFunction=(function*(){}).constructor;
// gnc: GeNCoroutine // gnc: GeNCoroutine
const gnc={ const gnc={
@ -122,7 +131,7 @@
updateURL:'https://raw.githubusercontent.com/libccy/noname', updateURL:'https://raw.githubusercontent.com/libccy/noname',
mirrorURL:'https://raw.fgit.cf/libccy/noname', mirrorURL:'https://raw.fgit.cf/libccy/noname',
hallURL:'47.99.105.222', hallURL:'47.99.105.222',
assetURL:typeof nonameInitialized!='string'||nonameInitialized=='nodejs'?'':nonameInitialized, assetURL:assetURL,
userAgent:userAgent, userAgent:userAgent,
compatibleEdition:Boolean(typeof nonameInitialized=='string'&&nonameInitialized.match(/\/(?:com\.widget|yuri\.nakamura)\.noname\//)), compatibleEdition:Boolean(typeof nonameInitialized=='string'&&nonameInitialized.match(/\/(?:com\.widget|yuri\.nakamura)\.noname\//)),
changeLog:[], changeLog:[],
@ -32533,7 +32542,7 @@
} }
if(game.online||game.onlineroom){ if(game.online||game.onlineroom){
if((game.servermode||game.onlinehall)&&_status.over){ if((game.servermode||game.onlinehall)&&_status.over){
void 0;
} }
else{ else{
localStorage.setItem(lib.configprefix+'directstart',true); localStorage.setItem(lib.configprefix+'directstart',true);
@ -35147,9 +35156,7 @@
} }
} }
if(!_status.requestReadClipboard&&get.config('read_clipboard','connect')){ if(!_status.requestReadClipboard&&get.config('read_clipboard','connect')){
//每次启动只请求一次 const read=text=>{
_status.requestReadClipboard=true;
function read(text){
try{ try{
var roomId=text.split('\n')[1].match(/\d+/); var roomId=text.split('\n')[1].match(/\d+/);
var caption=ui.rooms.find(caption=>caption.key==roomId); var caption=ui.rooms.find(caption=>caption.key==roomId);
@ -35159,6 +35166,8 @@
} }
}catch(e){console.log(e)} }catch(e){console.log(e)}
} }
//每次启动只请求一次
_status.requestReadClipboard=true;
if(_status.read_clipboard_text){ if(_status.read_clipboard_text){
read(_status.read_clipboard_text); read(_status.read_clipboard_text);
}else{ }else{
@ -37423,7 +37432,7 @@
ui.create.chat(); ui.create.chat();
if(game.onlineroom){ if(game.onlineroom){
void 0;
} }
else{ else{
var WebSocketServer=require('ws').Server; var WebSocketServer=require('ws').Server;
@ -44904,7 +44913,7 @@
config.item=config.item(); config.item=config.item();
} }
if(Array.isArray(config.init)){ if(Array.isArray(config.init)){
void 0;
} }
else{ else{
node.classList.add('switcher'); node.classList.add('switcher');
@ -44982,7 +44991,7 @@
} }
} }
else if(config.range){ else if(config.range){
void 0;
} }
else if(config.clear){ else if(config.clear){
if(node.innerHTML.length>=15) node.style.height='auto'; if(node.innerHTML.length>=15) node.style.height='auto';
@ -63444,11 +63453,5 @@
setAllPropertiesEnumerable(lib.element.Control.prototype); setAllPropertiesEnumerable(lib.element.Control.prototype);
setAllPropertiesEnumerable(lib.element.Client.prototype); setAllPropertiesEnumerable(lib.element.Client.prototype);
setAllPropertiesEnumerable(lib.element.NodeWS.prototype); setAllPropertiesEnumerable(lib.element.NodeWS.prototype);
if('__core-js_shared__' in window) lib.init.init(); lib.init.init();
else{ });
const coreJSBundle=document.createElement('script');
coreJSBundle.onerror=coreJSBundle.onload=lib.init.init;
coreJSBundle.src=`${lib.assetURL}game/core-js-bundle.js`;
document.head.appendChild(coreJSBundle);
}
}