This repository has been archived by the owner on Jul 11, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 83
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adding new {grease|tamper}monkey script for the new login page. Also …
…adding the exclude pattern for the old one not to conflict with the new script. Now, both scripts can live together and the right one will be used with the corresponding RHQ version. Based on the fact that new login page uses "login" substring in the url.
- Loading branch information
Showing
2 changed files
with
49 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 <jkremser@redhat.com> | ||
// @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); | ||
}()); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 <jkremser@redhat.com> | ||
// @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); | ||
}()); |