/attachment-reminder.user.js Secret
Created
February 26, 2013 00:48
Star
You must be signed in to star a gist
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 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)); |
abrahamseed
commented
Jun 28, 2019
<script src="https://gist.github.com/danbeam/55c45021e1ce268edfaf.js"></script>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment