Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
// ==UserScript==
// @name Attachment forgetter preventer
// @namespace attachment-forgetter-preventer
// @description Prevent forgetting attachments
// @match*
// @version 0.2
// ==/UserScript==
(function(document) {
document.addEventListener('submit', function(e) {
var comment = document.querySelector('textarea[name="comment"]');
if (comment && /attach/i.test(comment.value)) {
var allBlank =
function(el) { return !el.value; });
if (allBlank && !confirm('It looks like you meant to attach something. Continue submitting?'))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment