Greasy Fork

Greasy Fork is available in English.

LOL战绩

一个在网页端查询 LOL 战绩的方法

当前为 2022-11-03 提交的版本,查看 最新版本

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Greasemonkey 油猴子Violentmonkey 暴力猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Violentmonkey 暴力猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Userscripts ,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展后才能安装此脚本。

(我已经安装了用户脚本管理器,让我安装!)

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

(我已经安装了用户样式管理器,让我安装!)

// ==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();


})();