Skip to content

Embed URL

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
// ==UserScript==
// @name Attachment forgetter preventer
// @namespace attachment-forgetter-preventer
// @description Prevent forgetting attachments
// @match http://code.google.com/p/chromium/issues/*
// @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 = Array.prototype.every.call(
document.querySelectorAll('input[type="file"]'),
function(el) { return !el.value; });
if (allBlank && !confirm('It looks like you meant to attach something. Continue submitting?'))
e.preventDefault();
}
});
}(unsafeWindow.document));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.