yapiTots

yapi to ts

目前為 2024-09-24 提交的版本,檢視 最新版本

// ==UserScript==
// @name         yapiTots
// @namespace    yapiTots
// @version      0.0.2
// @description  yapi to ts
// @license      MIT
// @author       hjl
// @match        http://*/*
// @icon         https://img2.baidu.com/it/u=3318407772,3634490264&fm=253&fmt=auto?w=1200&h=767
// @grant        none
// ==/UserScript==

window.whiteList = ['http://192.168.140.245:3000']

if(!window.whiteList.includes(window.location.origin)){
    return
}

const dayJsUrl = 'https://unpkg.com/[email protected]/dayjs.min.js'
const vueUrl ='https://xyfali.postar.cn/risk-message/vue.js'
const axiosUrl = 'https://xyfali.postar.cn/risk-message/axios.js'



const elementCss='https://xyfali.postar.cn/risk-message/element-ui.css'
const elementJs ='https://xyfali.postar.cn/risk-message/element-ui.js'
document.querySelector('head').appendChild(createLink(elementCss))
document.querySelector('head').appendChild(createScript(axiosUrl));
document.querySelector('head').appendChild(createScript(elementJs));
document.querySelector('head').appendChild(createScript(dayJsUrl));
document.querySelector('head').appendChild(createScript(vueUrl));

function createScript (url,onLoad){
    var script = document.createElement('script');
    script.src = url;
    if(onLoad){
        script.onload=onLoad
    }
    return script
}


function createLink (url,onLoad){
    var link = document.createElement('link');
    link.href = url;
    link.setAttribute('rel','stylesheet');

    link.setAttribute('type','text/css');
    if(onLoad){
        link.onload=onLoad
    }
    return link
}

const app = document.createElement('div');

app.id='app'
document.body.appendChild(app);
(function() {
    'use strict';

    window.addEventListener('load', function(e) {
        document.body.appendChild(createScript(`https://xyfali.postar.cn/risk-message/createTs.js?time=${new Date().getTime()}`))
    }, false);
})();