docker-ui(fast os docker)调整

自动登录、去除页头页尾

目前為 2020-12-20 提交的版本,檢視 最新版本

您需要先安裝使用者腳本管理器擴展,如 TampermonkeyGreasemonkeyViolentmonkey 之後才能安裝該腳本。

You will need to install an extension such as Tampermonkey to install this script.

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyViolentmonkey 後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyUserscripts 後才能安裝該腳本。

你需要先安裝一款使用者腳本管理器擴展,比如 Tampermonkey,才能安裝此腳本

您需要先安裝使用者腳本管理器擴充功能後才能安裝該腳本。

(我已經安裝了使用者腳本管理器,讓我安裝!)

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

(我已經安裝了使用者樣式管理器,讓我安裝!)

// ==UserScript==
// @name         docker-ui(fast os docker)调整
// @namespace    http://tampermonkey.net/
// @version      0.1
// @description  自动登录、去除页头页尾
// @author       hlmio
// @match        http://127.0.0.1:8081/pc/
// @grant        none
// ==/UserScript==

(function() {
    'use strict';

    // Your code here...
    // 配置变量
    var 用户名 = "admin"
    var 密码 = "888888"

    // 删除主界面的页头和页尾
    document.querySelector("#app > section > section > header").remove()
    document.querySelector("#app > section > section > main > div.footer > p").remove()

    // 如果是登录页,就尝试自动登录
    setTimeout(function(){
        let name = document.querySelector("#app > section > section > main > div.main.clearfix > div > div > div > p:nth-child(3) > input[type=text]")
        let pass = document.querySelector("#app > section > section > main > div.main.clearfix > div > div > div > p:nth-child(5) > input[type=password]")
        let login = document.querySelector("#app > section > section > main > div.main.clearfix > div > div > div > p.submit > button")
        if(name && pass){
            name.value = 用户名
            name.dispatchEvent(new Event('input'))
            pass.value = 密码
            pass.dispatchEvent(new Event('input'))
            login.click()
        }
    }, 1000);

})();