Last active
September 17, 2020 15:05
-
-
Save okj579/9cf15e87e63022bb3e5ee2e6119040ef to your computer and use it in GitHub Desktop.
Submits forms on Ctrl+S instead of trying to save as HTML
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 Submit on Ctrl+S | |
// @description Submits forms on Ctrl+S instead of trying to save as HTML | |
// @version 0.3.1 | |
// @downloadURL https://raw.githubusercontent.com/imosnet/userscripts/master/submit-on-ctrl-s.user.js | |
// @author okj579 | |
// @match *://*/* | |
// @grant none | |
// ==/UserScript== | |
(function() { | |
'use strict'; | |
window.addEventListener('keydown', function(e){ | |
if (!(e.ctrlKey && !e.altKey && !e.metaKey && !e.shiftKey && e.key.toLowerCase() === 's')) return; | |
e.preventDefault(); | |
for(var elem = e.target; elem; elem = elem.parentElement) { | |
if (elem.tagName === 'FORM') return elem.submit(); | |
} | |
}); | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment