UserScript/jumpserver/luna.user.js

37 lines
1.2 KiB
JavaScript
Raw Normal View History

2020-03-29 06:56:55 +00:00
// ==UserScript==
// @name LUNA辅助扩展
// @namespace https://miaowoo.cc/
2021-07-19 08:18:10 +00:00
// @version 0.1.6
2020-03-29 06:56:55 +00:00
// @description Jumpserver Web终端 扩展
// @author MiaoWoo
// @match https://jump.miaowoo.cc/luna/*
// @grant none
// ==/UserScript==
2021-07-19 08:18:10 +00:00
(async function () {
2020-11-16 01:49:37 +00:00
'use strict'
2021-07-19 08:18:10 +00:00
async function sleep(ms) {
return new Promise(resolve => setTimeout(resolve, ms))
}
2020-07-17 04:11:45 +00:00
var version = document.querySelector('.footer-version')
2020-11-16 01:49:37 +00:00
version.innerHTML = version.innerHTML.replace('Version', '')
2021-07-19 08:18:10 +00:00
async function adjust() {
2020-11-25 04:31:43 +00:00
var left_side = document.querySelector('.left-side')
left_side.style.maxWidth = '11.5%'
left_side.style.flex = '0 0 calc(11.5% - 0px)'
var content = document.querySelector('.content')
content.style.maxWidth = '88.5%'
content.style.flex = '0 0 calc(88.5% - 0px)'
2020-11-16 01:49:37 +00:00
}
window.onresize = adjust
adjust()
2021-07-19 08:18:10 +00:00
for (const element of ['#myAssets_3_span', '#myAssets_5_span', '#myAssets_7_span', '#myAssets_10_span']) {
let target = undefined
while ((target = document.querySelector(element)) == undefined) {
await sleep(50)
}
await sleep(300)
target.click()
}
2020-11-16 01:49:37 +00:00
})()