r51670 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r51669‎ | r51670 | r51671 >
Date:00:01, 10 June 2009
Author:tparscal
Status:deferred
Tags:
Comment:
Solved some issues with how browsers were handling the onbeforeunload event
Modified paths:
  • /trunk/extensions/UsabilityInitiative/EditWarning/EditWarning.i18n.php (modified) (history)
  • /trunk/extensions/UsabilityInitiative/EditWarning/EditWarning.js (modified) (history)

Diff [purge]

Index: trunk/extensions/UsabilityInitiative/EditWarning/EditWarning.i18n.php
@@ -14,5 +14,5 @@
1515 $messages['en'] = array(
1616 'editwarning' => 'Edit warning',
1717 'editwarning-desc' => 'Show a warning when a user tries to leave the edit form without saving',
18 - 'editwarning-warning' => 'You have unsaved changes. Click OK to leave this page and abandon your changes, or Cancel to stay here and keep them.',
 18+ 'editwarning-warning' => 'Leaving this page will cause you to loose any changes you have made.',
1919 );
Index: trunk/extensions/UsabilityInitiative/EditWarning/EditWarning.js
@@ -3,18 +3,14 @@
44 $( document ).ready( function() {
55 $( 'textarea#wpTextbox1, input#wpSummary' )
66 .bind(
7 - 'change select paste cut',
 7+ 'change select paste cut keydown',
88 function () {
9 - $( window ).bind(
10 - 'beforeunload',
11 - function( event ) {
12 - if( !confirm( gM('editwarning-warning' ) ) ) {
13 - event.preventDefault();
14 - }
15 - event.stopImmediatePropagation();
 9+ if ( !( 'onbeforeunload' in window ) ) {
 10+ window.onbeforeunload = function() {
 11+ return gM('editwarning-warning' );
1612 }
17 - );
 13+ }
1814 }
1915 );
2016 }
21 -);
 17+);
\ No newline at end of file

Status & tagging log