Greasy Fork is available in English.
一个在网页端查询 LOL 战绩的方法
当前为
// ==UserScript==
// @name LOL战绩
// @namespace mscststs
// @version 0.1
// @description 一个在网页端查询 LOL 战绩的方法
// @author mscststs
// @match https://www.wegame.com.cn/ioi
// @icon https://www.google.com/s2/favicons?sz=64&domain=wegame.com.cn
// @license ISC
// @grant none
// ==/UserScript==
(function() {
'use strict';
function addElement(tag = "script", options = {}, parent = document.body){
let ele = document.createElement(tag);
Object.entries(options).forEach(([key,val])=>{
ele[key] = val;
});
parent.appendChild(ele);
return new Promise((resolve,reject)=>{
ele.onload = (...args)=>{resolve(...args); options.onload && options.onload(...args)};
ele.onerror = (...args)=>{reject(...args); options.onerror && options.onerror(...args)};;
});
}
async function init(){
document.title = "LOL 战绩查询"
document.querySelector("#content").innerText = "加载中";
await addElement("script", {src:"https://wegame.gtimg.com/g.55555-r.c4663/lib/vue/2.6.10/vue.min.js"});
await addElement("script", {src:"https://www.wegame.com.cn/middle/login/login.sdk.js"});
console.log("loginSDK 加载完毕")
if(!localStorage["tgp_userinfo"]){
document.querySelector("#content").innerText = "拉起登录中...";
WegameLogin.default.popup()
WegameLogin.default.onLogin(()=>{
location.reload();
})
}else{
document.querySelector("#content").innerText = "正在初始化";
// TODO: 加载主界面
}
}
init();
})();