BlueCat Address Manager Direct Actions (Server Actions)

Add direct buttons for Server Actions in BlueCat Address Manager

当前为 2018-06-05 提交的版本,查看 最新版本

您需要先安装一个扩展,例如 篡改猴Greasemonkey暴力猴,之后才能安装此脚本。

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

您需要先安装一个扩展,例如 篡改猴暴力猴,之后才能安装此脚本。

您需要先安装一个扩展,例如 篡改猴Userscripts ,之后才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。

您需要先安装用户脚本管理器扩展后才能安装此脚本。

(我已经安装了用户脚本管理器,让我安装!)

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

(我已经安装了用户样式管理器,让我安装!)

// ==UserScript==
// @name        BlueCat Address Manager Direct Actions (Server Actions)
// @namespace   *
// @description Add direct buttons for Server Actions in BlueCat Address Manager
// @include     */app*
// @license		MIT
// @version     1
// @grant       none
// @copyright   2018, Marius Galm
// @license		MIT
// @icon        https://www.bluecatnetworks.com/wp-content/themes/bluecat/assets/img/icons/favicon.ico
// ==/UserScript==

if (document.readyState === "interactive" ) {
    var page = document.childNodes[2].nodeValue;
	if (/ Page: ServerPage /.test(page)) {
        // go through the 
        var table = document.getElementById("outerTable");
        for (var i = 0, row; row = table.rows[i]; i++) {
            // ignore header
            if (i == 0) { continue; }
            //iterate through rows
            //rows would be accessed using the "row" variable assigned in the for loop
            for (var j = 0, col; col = row.cells[j]; j++) {
                //iterate through columns
                //columns would be accessed using the "col" variable assigned in the for loop
                var image = col.getElementsByTagName('img');
                if (image[0].src.indexOf("cluster") > -1) {
                    // this should be a cluster
                } else {
                    // everything else is a server
                }
            }
        }
        //var subtab = document.getElementsByClassName("TabPanelLabelActive")[0];
        //if (! /Details/.test(subtab.innerHTML.trim())) {
        //    var actions = document.getElementsByClassName('action-items')[0];
        //    var tBody = actions.getElementsByTagName('tbody')[0];
        //    var w = tBody.insertRow(-1);
        //    w.innerHTML='<tr id="For_Deploy"><td class="action-item"><div id="action-item" class="with-description-with-icon"><a href="javascript:remoteSubmitLink( document.getElementById( \'form\' ), \'SDeploy\' );"><div class="selection " onmouseover="onActionItemOver(this, event);" onmouseout="onActionItemOut(this, event);" onclick="onActionItemClick(this, event);"><table class="action-item-selection" cellspacing="0" cellpadding="0"><tbody><tr><td class="icon"><div class="active"><img src="/images/icons/small/flash.gif" border="0"></div></td><td class="action"><div class="active"><div class="action-title">Deploy</div><div class="action-description">Deploy this server</div></div></td></tr></tbody></table></div></a></div></td></tr>';
        //}
    }
}