r61546 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r61545‎ | r61546 | r61547 >
Date:00:23, 27 January 2010
Author:tparscal
Status:ok
Tags:
Comment:
Added an onbeforeunload hook that executes existing hook after syncing the iframe and textarea - which helps keep form value cache as well as gets the edit warning working again. Oh yeah, and nimish helped, kinda...
Modified paths:
  • /trunk/extensions/UsabilityInitiative/UsabilityInitiative.hooks.php (modified) (history)
  • /trunk/extensions/UsabilityInitiative/js/plugins.combined.js (modified) (history)
  • /trunk/extensions/UsabilityInitiative/js/plugins.combined.min.js (modified) (history)
  • /trunk/extensions/UsabilityInitiative/js/plugins/jquery.wikiEditor.js (modified) (history)

Diff [purge]

Index: trunk/extensions/UsabilityInitiative/UsabilityInitiative.hooks.php
@@ -135,7 +135,7 @@
136136 array(
137137 'src' => 'js/plugins/jquery.wikiEditor.js',
138138 'class' => 'j.wikiEditor',
139 - 'version' => 68
 139+ 'version' => 69
140140 ),
141141 array(
142142 'src' => 'js/plugins/jquery.wikiEditor.highlight.js',
@@ -173,10 +173,10 @@
174174 'version' => 1 ),
175175 ),
176176 'combined' => array(
177 - array( 'src' => 'js/plugins.combined.js', 'version' => 179 ),
 177+ array( 'src' => 'js/plugins.combined.js', 'version' => 180 ),
178178 ),
179179 'minified' => array(
180 - array( 'src' => 'js/plugins.combined.min.js', 'version' => 179 ),
 180+ array( 'src' => 'js/plugins.combined.min.js', 'version' => 180 ),
181181 ),
182182 ),
183183 );
Index: trunk/extensions/UsabilityInitiative/js/plugins/jquery.wikiEditor.js
@@ -938,6 +938,13 @@
939939 context.$textarea.attr( 'disabled', false );
940940 context.$textarea.val( context.$textarea.textSelection( 'getContents' ) );
941941 } );
 942+ /* FIXME: This was taken from EditWarning.js - maybe we could do a jquery plugin for this? */
 943+ // Attach our own handler for onbeforeunload which respects the current one
 944+ context.fallbackWindowOnBeforeUnload = window.onbeforeunload;
 945+ window.onbeforeunload = function() {
 946+ context.$textarea.val( context.$textarea.textSelection( 'getContents' ) );
 947+ return context.fallbackWindowOnBeforeUnload ? context.fallbackWindowOnBeforeUnload() : null;
 948+ }
942949 }
943950
944951 /* API Execution */
Index: trunk/extensions/UsabilityInitiative/js/plugins.combined.js
@@ -7300,6 +7300,13 @@
73017301 context.$textarea.attr( 'disabled', false );
73027302 context.$textarea.val( context.$textarea.textSelection( 'getContents' ) );
73037303 } );
 7304+ /* FIXME: This was taken from EditWarning.js - maybe we could do a jquery plugin for this? */
 7305+ // Attach our own handler for onbeforeunload which respects the current one
 7306+ context.fallbackWindowOnBeforeUnload = window.onbeforeunload;
 7307+ window.onbeforeunload = function() {
 7308+ context.$textarea.val( context.$textarea.textSelection( 'getContents' ) );
 7309+ return context.fallbackWindowOnBeforeUnload ? context.fallbackWindowOnBeforeUnload() : null;
 7310+ }
73047311 }
73057312
73067313 /* API Execution */
Index: trunk/extensions/UsabilityInitiative/js/plugins.combined.min.js
@@ -486,7 +486,7 @@
487487 context.$content=$(context.$iframe[0].contentWindow.document.body);var html=context.$textarea.val().replace(/\</g,'&lt;').replace(/\>/g,'&gt;');if($.browser.msie){if($.browser.versionNumber<=7){html=html.replace(/ /g,"&nbsp;");}else{html=html.replace(/(^|\n) /g,"$1&nbsp;");}
488488 html=html.replace(/\t/g,'<span class="wikiEditor-tab"></span>');}
489489 context.$content.html(html.replace(/\r?\n/g,'<br />'));if($('body').is('.rtl')){context.$content.addClass('rtl').attr('dir','rtl');}
490 -context.$textarea.attr('disabled',true);context.$textarea.hide();context.$iframe.show();context.fn.trigger('ready');$(context.$iframe[0].contentWindow.document).bind('keyup mouseup paste cut encapsulateSelection',function(event){context.fn.trigger('change',event);}).delayedBind(250,'keyup mouseup paste cut encapsulateSelection',function(event){context.fn.trigger('delayedChange',event);});});context.$textarea.closest('form').submit(function(){context.$textarea.attr('disabled',false);context.$textarea.val(context.$textarea.textSelection('getContents'));});}
 490+context.$textarea.attr('disabled',true);context.$textarea.hide();context.$iframe.show();context.fn.trigger('ready');$(context.$iframe[0].contentWindow.document).bind('keyup mouseup paste cut encapsulateSelection',function(event){context.fn.trigger('change',event);}).delayedBind(250,'keyup mouseup paste cut encapsulateSelection',function(event){context.fn.trigger('delayedChange',event);});});context.$textarea.closest('form').submit(function(){context.$textarea.attr('disabled',false);context.$textarea.val(context.$textarea.textSelection('getContents'));});context.fallbackWindowOnBeforeUnload=window.onbeforeunload;window.onbeforeunload=function(){context.$textarea.val(context.$textarea.textSelection('getContents'));return context.fallbackWindowOnBeforeUnload?context.fallbackWindowOnBeforeUnload():null;}}
491491 arguments=$.makeArray(arguments);if(arguments.length>0){var call=arguments.shift();if(call in context.api){context.api[call](context,typeof arguments[0]=='undefined'?{}:arguments[0]);}}
492492 return $(this).data('wikiEditor-context',context);};})(jQuery);RegExp.escape=function(s){return s.replace(/([.*+?^${}()|\/\\[\]])/g,'\\$1');};(function($){$.wikiEditor.modules.dialogs={api:{addDialog:function(context,data){$.wikiEditor.modules.dialogs.fn.create(context,data)},openDialog:function(context,module){if(module in $.wikiEditor.modules.dialogs.modules){$('#'+$.wikiEditor.modules.dialogs.modules[module].id).dialog('open');}},closeDialog:function(context,data){if(module in $.wikiEditor.modules.dialogs.modules){$('#'+$.wikiEditor.modules.dialogs.modules[module].id).dialog('close');}}},fn:{create:function(context,config){for(module in config){$.wikiEditor.modules.dialogs.modules[module]=config[module];}
493493 mw.load(['$j.ui','$j.ui.dialog','$j.ui.draggable','$j.ui.resizable'],function(){for(module in $.wikiEditor.modules.dialogs.modules){var module=$.wikiEditor.modules.dialogs.modules[module];if($('#'+module.id).size()==0){var configuration=module.dialog;configuration.bgiframe=true;configuration.autoOpen=false;configuration.modal=true;configuration.title=$.wikiEditor.autoMsg(module,'title');configuration.newButtons={};for(msg in configuration.buttons)

Status & tagging log