Skip to content

Instantly share code, notes, and snippets.

@seventhsense
Forked from kawanaka2141/redmine-submit-guard.js
Last active August 29, 2015 14:20
Show Gist options
  • Save seventhsense/05f6d227221fd5c82ff3 to your computer and use it in GitHub Desktop.
Save seventhsense/05f6d227221fd5c82ff3 to your computer and use it in GitHub Desktop.
// ==UserScript==
// @name Redmine Submit Guard
// @namespace https://github.com/kawanaka2141
// @require http://ajax.googleapis.com/ajax/libs/jquery/1.6.4/jquery.min.js
// @match http://*/redmine/projects/*/issues/new
// @match http://*/redmine/issues/*
// ==/UserScript==
(function(){
$('input').keypress(function(ev){
if(ev.keyCode === 10 || ev.keyCode === 13){
if(Event.element(ev).id == 'q') return true;
if($('#issue_subject').val().trim() == ''){ $('#issue_subject').focus(); return false; }
if($('#issue_description').val().trim() == ''){ $('#issue_description').focus(); return false; }
return false;
}
return true;
});
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment