Created
November 2, 2013 00:22
-
-
Save mildmojo/7273987 to your computer and use it in GitHub Desktop.
Saves your bacon when you're using jsbin.com with OS X and try to Cmd+Left to go to the beginning of the line.
This file contains hidden or 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 Permission to Leave | |
// @namespace permission.to.leave | |
// @description Prompts before leaving the page. Good for OS X users who press Cmd+Left while editing text to go to the start of the line, only to find the browser goes back a page instead. | |
// @version 1.0 | |
// @grant none | |
// @include http://edit.script.and | |
// @include https://add.target.sites.here | |
// @include https://twitter.com | |
// ==/UserScript== | |
window.addEventListener('beforeunload', function(e) { | |
var confirmationMessage = "Brought to you by the Permission to Leave user script."; | |
(e || window.event).returnValue = confirmationMessage; | |
return confirmationMessage; | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment