Skip to content

Instantly share code, notes, and snippets.

@kxc0re
Last active August 29, 2015 14:27
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kxc0re/98f5a923a971e3299b9f to your computer and use it in GitHub Desktop.
Save kxc0re/98f5a923a971e3299b9f to your computer and use it in GitHub Desktop.
// ==UserScript==
// @name betterDBTraining
// @namespace kxc0re.net
// @author kxc0re
// @description Submit with Ctrl+Enter
// @include http://hsg2u.spdns.org:8085/dbtraining/dbtraining_pwd.jsp
// @version 1.11
// @grant none
// ==/UserScript==
function ctrlEnter(event) {
if (event.which == 13 && event.ctrlKey) {
document.anfrageformular.getElementsByTagName('input')[1].click();
}
}
function clearArea() {
var textArea = document.anfrageformular.getElementsByTagName('textarea')[0].innerHTML;
if (textArea == 'Hier kommt die Anfrage hin.')
document.anfrageformular.getElementsByTagName('textarea')[0].innerHTML = '';
}
//Add EventListeners
document.addEventListener('keypress', ctrlEnter);
document.anfrageformular.addEventListener('click', clearArea);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment