Skip to content

Instantly share code, notes, and snippets.

@gartnera
Last active August 29, 2015 14:06
Show Gist options
  • Save gartnera/a0e6351cfdd4859c4f6e to your computer and use it in GitHub Desktop.
Save gartnera/a0e6351cfdd4859c4f6e to your computer and use it in GitHub Desktop.
VMware vCloud 5.5 Scripts
// ==UserScript==
// @name vmware console hacks
// @namespace http://agartner.com
// @version 0.1
// @description Changes fit to guest to fit guest
// @match https://vcloud.ialab.us/cloud/VMRCConsole.html
// @copyright 2014, Alex Gartner
// @grant none
// ==/UserScript==
window.addEventListener('load', main, false);
function main(){
var body = document.getElementsByTagName("body")[0];
body.style.overflow = "hidden";
body.style.position = "fixed";
var a = document.getElementById("plugin-buttons").children[2],
b = $(a);
b.unbind();
a.onclick = function fitConsole(){
var a = document.getElementById("vmrcObject");
var b = window.getComputedStyle(a);
var c = parseInt(b.height);
var d = parseInt(b.width);
vmrc.setScreenSize(d,c);
}
}
// ==UserScript==
// @name vmware open console in new tab
// @namespace http://agartner.com
// @version 0.1
// @description opens vmrc console in new tab rather than window. also forces html5 console if html5 = true
// @match https://vcloud.ialab.us/cloud/org/*
// @copyright 2014, Alex Gartner
// ==/UserScript==
function openPopoutConsole(vmName, vmId, vAppName, vmDevicesAvailable, buttonLabels, miscLabels, confirmationLabels, isVmrc) {
if (windowHandles[vmId] != null && !windowHandles[vmId].closed) {
windowHandles[vmId].focus();
return;
}
var defaultConsoleWidth = 720;
var defaultConsoleHeight = 400;
var cssWidth = 0;
var cssHeight = 40;
var totalWidth = defaultConsoleWidth + cssWidth;
var totalHeight = defaultConsoleHeight + cssHeight;
var consoleUrl = html5 ? '/cloud/WebMKSConsole.html': '/cloud/VMRCConsole.html';
var winHandle = window.open(consoleUrl, '', "");
windowData.set(winHandle, {"vmName" : vmName, "vmId" : vmId, "vAppName" : vAppName, "vmDevicesAvailable" : vmDevicesAvailable, "buttonLabels" : buttonLabels, "miscLabels" : miscLabels, "confirmationLabels" : confirmationLabels});
windowHandles[vmId] = winHandle;
}
var script = document.createElement("script");
script.textContent = openPopoutConsole.toString();
script.textContent += "html5 = false";
document.body.appendChild(script);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment