From 28ec9674075b06d1b31ef24259583a5777727fe8 Mon Sep 17 00:00:00 2001 From: James Campos Date: Mon, 5 Sep 2011 17:21:01 -0700 Subject: [PATCH] check if submit is disabled if all buttons are disabled, hitting enter in an input field won't submit the form, but calling form.submit() will still submit --- 4chan_x.user.js | 2 +- script.coffee | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/4chan_x.user.js b/4chan_x.user.js index 1ab4b8c73..a727c4712 100644 --- a/4chan_x.user.js +++ b/4chan_x.user.js @@ -1553,7 +1553,7 @@ if (input = $('#files input', qr)) { input.setAttribute('form', 'qr_form'); } - if (!e) { + if (!(e || $('form button', qr).disabled)) { $('#qr_form', qr).submit(); } QR.sage = /sage/i.test($('[name=email]', qr).value); diff --git a/script.coffee b/script.coffee index 130ccfbb8..9ad931f59 100644 --- a/script.coffee +++ b/script.coffee @@ -1196,7 +1196,8 @@ QR = $('#autohide', qr).checked = true if conf['Auto Hide QR'] if input = $ '#files input', qr input.setAttribute 'form', 'qr_form' - $('#qr_form', qr).submit() if not e + if not (e or $('form button', qr).disabled) + $('#qr_form', qr).submit() QR.sage = /sage/i.test $('[name=email]', qr).value if conf['Thread Watcher'] and conf['Auto Watch Reply'] id = $('input[name=resto]', qr.el).value