Skip to content

Commit

Permalink
Merge branch '34' into 34-scratch
Browse files Browse the repository at this point in the history
  • Loading branch information
rwaldron committed Mar 31, 2011
2 parents 8f99a7b + ca5d433 commit 7bbcf43
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions js/butter.application.js
Original file line number Diff line number Diff line change
Expand Up @@ -442,6 +442,22 @@
}
});

// Handle beforeload events to prevent leaving accidentally
$win.bind("beforeunload", function( event ) {
return "Are you sure you want to leave Butter?";
});

// Prevent Backspace and Delete keys from doing anything
// when the target is not an <input> or a <textarea> to
// prevent leaving accidentally.
$win.keypress( function( event ) {
var elem = event.srcElement || event.target;
if ( (event.which === 46 || event.which === 8) &&
(elem.nodeName !== "INPUT" && elem.nodeName !== "TEXTAREA") ) {
event.preventDefault();
}
});

// Start with overlay scenes hidden
$loadready.hide();

Expand Down

0 comments on commit 7bbcf43

Please sign in to comment.