Skip to content

Instantly share code, notes, and snippets.

@kawanaka2141
Last active August 29, 2015 14:02
Show Gist options
  • Save kawanaka2141/b814e0be3cd0f72d3021 to your computer and use it in GitHub Desktop.
Save kawanaka2141/b814e0be3cd0f72d3021 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