Redmine Submit Guard

Avoid submit by enter key.

You will need to install an extension such as Tampermonkey, Greasemonkey or Violentmonkey to install this script.

You will need to install an extension such as Tampermonkey to install this script.

You will need to install an extension such as Tampermonkey or Violentmonkey to install this script.

You will need to install an extension such as Tampermonkey or Userscripts to install this script.

You will need to install an extension such as Tampermonkey to install this script.

You will need to install a user script manager extension to install this script.

(I already have a user script manager, let me install it!)

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

ستحتاج إلى تثبيت إضافة مثل Stylus لتثبيت هذا النمط.

ستحتاج إلى تثبيت إضافة لإدارة أنماط المستخدم لتتمكن من تثبيت هذا النمط.

ستحتاج إلى تثبيت إضافة لإدارة أنماط المستخدم لتثبيت هذا النمط.

ستحتاج إلى تثبيت إضافة لإدارة أنماط المستخدم لتثبيت هذا النمط.

(لدي بالفعل مثبت أنماط للمستخدم، دعني أقم بتثبيته!)

// ==UserScript==
// @name Redmine Submit Guard
// @description:en Avoid submit by enter key.
// @version 0.1
// @namespace http://twitter.com/foldrr/
// @require   http://ajax.googleapis.com/ajax/libs/jquery/1.6.4/jquery.min.js
// @match     http://*/redmine/projects/*/issues/new
// @match     http://*/redmine/issues/*
// @description Avoid submit by enter key.
// ==/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;
    });
})();