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