更新 'jumpserver/luna.user.js'

This commit is contained in:
502647092 2021-07-19 08:18:10 +00:00
parent 9ebc0a63e5
commit b0d882e3d3

View File

@ -1,18 +1,21 @@
// ==UserScript== // ==UserScript==
// @name LUNA辅助扩展 // @name LUNA辅助扩展
// @namespace https://miaowoo.cc/ // @namespace https://miaowoo.cc/
// @version 0.1.5 // @version 0.1.6
// @description Jumpserver Web终端 扩展 // @description Jumpserver Web终端 扩展
// @author MiaoWoo // @author MiaoWoo
// @match https://jump.miaowoo.cc/luna/* // @match https://jump.miaowoo.cc/luna/*
// @grant none // @grant none
// ==/UserScript== // ==/UserScript==
(function () { (async function () {
'use strict' 'use strict'
async function sleep(ms) {
return new Promise(resolve => setTimeout(resolve, ms))
}
var version = document.querySelector('.footer-version') var version = document.querySelector('.footer-version')
version.innerHTML = version.innerHTML.replace('Version', '') version.innerHTML = version.innerHTML.replace('Version', '')
function adjust() { async function adjust() {
var left_side = document.querySelector('.left-side') var left_side = document.querySelector('.left-side')
left_side.style.maxWidth = '11.5%' left_side.style.maxWidth = '11.5%'
left_side.style.flex = '0 0 calc(11.5% - 0px)' left_side.style.flex = '0 0 calc(11.5% - 0px)'
@ -21,17 +24,13 @@
content.style.flex = '0 0 calc(88.5% - 0px)' content.style.flex = '0 0 calc(88.5% - 0px)'
} }
window.onresize = adjust window.onresize = adjust
setTimeout(function () {
document.querySelector('#myAssets_3_span').click()
setTimeout(function () {
document.querySelector('#myAssets_5_span').click()
setTimeout(function () {
document.querySelector('#myAssets_7_span').click()
setTimeout(function () {
document.querySelector('#myAssets_10_span').click()
}, 300)
}, 300)
}, 300)
}, 300)
adjust() adjust()
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()
}
})() })()