diff --git a/etc/greasemonkey/RHQ_login_monkey-before-4.11.user.js b/etc/greasemonkey/RHQ_login_monkey-before-4.11.user.js new file mode 100644 index 00000000000..ea253077b50 --- /dev/null +++ b/etc/greasemonkey/RHQ_login_monkey-before-4.11.user.js @@ -0,0 +1,33 @@ +// ==UserScript== +// @name RHQ login monkey old +// @namespace org.rhq.coregui +// @description Types in the credentials when pressing ALT+C on the login page. This script works also for Chrome/Chromium with the extension called Tampermonkey. This version works well with the RHQ 4.10 and lower. +// @include *:7080/coregui/* +// @include *:7080/coregui/#LogOut +// @exclude *:7080/coregui/login* +// @grant none +// @author Jiri Kremser +// @version 1.1 +// ==/UserScript== + +function fillTheCredentials() { + document.getElementsByName("user")[0].value="rhqadmin"; + document.getElementsByName("password")[0].value="rhqadmin"; + //document.forms[0].submit() doesn't work, SmartGWT uses internal logic + document.getElementsByName("password")[0].focus(); +} + +// register the function and the hot key +//GM_registerMenuCommand("Fill the credentials", function(e) { +// fillTheCredentials(); +//}, "c", "alt", "c" ); + +// fallback solution, because the function above doesn't work in all browsers +(function(){ +document.addEventListener('keydown', function(e) { + // pressed alt+c + if (e.keyCode == 67 && !e.shiftKey && !e.ctrlKey && e.altKey && !e.metaKey) { + fillTheCredentials(); + } +}, false); +}()); diff --git a/etc/greasemonkey/RHQ_login_monkey.user.js b/etc/greasemonkey/RHQ_login_monkey.user.js index 922cb3269a8..b2376056bd4 100644 --- a/etc/greasemonkey/RHQ_login_monkey.user.js +++ b/etc/greasemonkey/RHQ_login_monkey.user.js @@ -1,32 +1,31 @@ // ==UserScript== // @name RHQ login monkey // @namespace org.rhq.coregui -// @description Types in the credentials when pressing ALT+C on the login page. This script works also for Chrome/Chromium with the extension called Tampermonkey. -// @include *:7080/coregui/* -// @include *:7080/coregui/#LogOut +// @description Types in the credentials when pressing ALT+C on the login page. This script works also for Chrome/Chromium with the extension called Tampermonkey. This script works with the new login screen that was added to RHQ 4.11 +// @include *:7080/coregui/login* // @grant none // @author Jiri Kremser -// @version 1.1 +// @version 1.2 // ==/UserScript== function fillTheCredentials() { - document.getElementsByName("user")[0].value="rhqadmin"; - document.getElementsByName("password")[0].value="rhqadmin"; - //document.forms[0].submit() doesn't work, SmartGWT uses internal logic - document.getElementsByName("password")[0].focus(); + // new UI + document.getElementById('inputUsername').value="rhqadmin"; + document.getElementById('inputPassword').value="rhqadmin"; + document.getElementById('loginForm').submit(); } // register the function and the hot key -GM_registerMenuCommand("Fill the credentials", function(e) { - fillTheCredentials(); -}, "c", "alt", "c" ); +//GM_registerMenuCommand("Fill the credentials", function(e) { +// fillTheCredentials(); +//}, "c", "alt", "c" ); // fallback solution, because the function above doesn't work in all browsers (function(){ -document.addEventListener('keydown', function(e) { - // pressed alt+c - if (e.keyCode == 67 && !e.shiftKey && !e.ctrlKey && e.altKey && !e.metaKey) { - fillTheCredentials(); - } -}, false); + document.addEventListener('keydown', function(e) { + // pressed alt+c + if (e.keyCode == 67 && !e.shiftKey && !e.ctrlKey && e.altKey && !e.metaKey) { + fillTheCredentials(); + } + }, false); }());