UserScript/jumpserver/luna.user.js

39 lines
1.4 KiB
JavaScript

// ==UserScript==
// @name LUNA辅助扩展
// @namespace https://miaowoo.cc/
// @version 0.1.8
// @description Jumpserver Web终端 扩展
// @author MiaoWoo
// @match https://jump.miaowoo.cc/luna/*
// @grant none
// ==/UserScript==
(async function () {
'use strict'
async function sleep(ms) {
return new Promise(resolve => setTimeout(resolve, ms))
}
var version = document.querySelector('.footer-version')
version.innerHTML = version.innerHTML.replace('Version', '')
async function adjust() {
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)'
document.getElementById('batchCommandDiv').remove()
document.getElementById('winContainer').style.height = "calc(100% - 30px)"
}
window.onresize = adjust
adjust()
for (const element of ['#assetsTree_2_span', '#assetsTree_4_span', '#assetsTree_5_span', '#assetsTree_7_span']) {
let target = undefined
while ((target = document.querySelector(element)) == undefined) {
await sleep(50)
}
await sleep(300)
target.click()
}
})()