UserScript/jumpserver/luna.user.js

39 lines
1.4 KiB
JavaScript
Raw Normal View History

2020-03-29 06:56:55 +00:00
// ==UserScript==
// @name LUNA辅助扩展
// @namespace https://miaowoo.cc/
2023-04-11 14:28:37 +00:00
// @version 0.1.8
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)'
2022-07-01 01:49:57 +00:00
document.getElementById('batchCommandDiv').remove()
document.getElementById('winContainer').style.height = "calc(100% - 30px)"
2020-11-16 01:49:37 +00:00
}
window.onresize = adjust
adjust()
2023-04-11 14:28:37 +00:00
for (const element of ['#assetsTree_2_span', '#assetsTree_4_span', '#assetsTree_5_span', '#assetsTree_7_span']) {
2021-07-19 08:18:10 +00:00
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
})()