BlueCat Address Manager Direct Actions (Server Actions)

Add direct buttons for Server Actions in BlueCat Address Manager

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

  1. // ==UserScript==
  2. // @name BlueCat Address Manager Direct Actions (Server Actions)
  3. // @namespace *
  4. // @description Add direct buttons for Server Actions in BlueCat Address Manager
  5. // @include */app*
  6. // @license MIT
  7. // @version 1
  8. // @grant none
  9. // @copyright 2018, Marius Galm
  10. // @license MIT
  11. // @icon https://www.bluecatnetworks.com/wp-content/themes/bluecat/assets/img/icons/favicon.ico
  12. // ==/UserScript==
  13.  
  14. if (document.readyState === "interactive" ) {
  15. var page = document.childNodes[2].nodeValue;
  16. if (/ Page: ServerPage /.test(page)) {
  17. // go through the
  18. var table = document.getElementById("outerTable");
  19. for (var i = 0, row; row = table.rows[i]; i++) {
  20. // ignore header
  21. if (i == 0) { continue; }
  22. //iterate through rows
  23. //rows would be accessed using the "row" variable assigned in the for loop
  24. for (var j = 0, col; col = row.cells[j]; j++) {
  25. //iterate through columns
  26. //columns would be accessed using the "col" variable assigned in the for loop
  27. var image = col.getElementsByTagName('img');
  28. if (image[0].src.indexOf("cluster") > -1) {
  29. // this should be a cluster
  30. } else {
  31. // everything else is a server
  32. }
  33. }
  34. }
  35. //var subtab = document.getElementsByClassName("TabPanelLabelActive")[0];
  36. //if (! /Details/.test(subtab.innerHTML.trim())) {
  37. // var actions = document.getElementsByClassName('action-items')[0];
  38. // var tBody = actions.getElementsByTagName('tbody')[0];
  39. // var w = tBody.insertRow(-1);
  40. // 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>';
  41. //}
  42. }
  43. }