yapiTots

yapi to ts

当前为 2024-09-24 提交的版本,查看 最新版本

  1. // ==UserScript==
  2. // @name yapiTots
  3. // @namespace yapiTots
  4. // @version 0.0.2
  5. // @description yapi to ts
  6. // @license MIT
  7. // @author hjl
  8. // @match http://*/*
  9. // @icon https://img2.baidu.com/it/u=3318407772,3634490264&fm=253&fmt=auto?w=1200&h=767
  10. // @grant none
  11. // ==/UserScript==
  12.  
  13. window.whiteList = ['http://192.168.140.245:3000']
  14.  
  15. if(!window.whiteList.includes(window.location.origin)){
  16. return
  17. }
  18.  
  19. const dayJsUrl = 'https://unpkg.com/dayjs@1.11.7/dayjs.min.js'
  20. const vueUrl ='https://xyfali.postar.cn/risk-message/vue.js'
  21. const axiosUrl = 'https://xyfali.postar.cn/risk-message/axios.js'
  22.  
  23.  
  24.  
  25. const elementCss='https://xyfali.postar.cn/risk-message/element-ui.css'
  26. const elementJs ='https://xyfali.postar.cn/risk-message/element-ui.js'
  27. document.querySelector('head').appendChild(createLink(elementCss))
  28. document.querySelector('head').appendChild(createScript(axiosUrl));
  29. document.querySelector('head').appendChild(createScript(elementJs));
  30. document.querySelector('head').appendChild(createScript(dayJsUrl));
  31. document.querySelector('head').appendChild(createScript(vueUrl));
  32.  
  33. function createScript (url,onLoad){
  34. var script = document.createElement('script');
  35. script.src = url;
  36. if(onLoad){
  37. script.onload=onLoad
  38. }
  39. return script
  40. }
  41.  
  42.  
  43. function createLink (url,onLoad){
  44. var link = document.createElement('link');
  45. link.href = url;
  46. link.setAttribute('rel','stylesheet');
  47.  
  48. link.setAttribute('type','text/css');
  49. if(onLoad){
  50. link.onload=onLoad
  51. }
  52. return link
  53. }
  54.  
  55. const app = document.createElement('div');
  56.  
  57. app.id='app'
  58. document.body.appendChild(app);
  59. (function() {
  60. 'use strict';
  61.  
  62. window.addEventListener('load', function(e) {
  63. document.body.appendChild(createScript(`https://xyfali.postar.cn/risk-message/createTs.js?time=${new Date().getTime()}`))
  64. }, false);
  65. })();
  66.