http://www.mediawiki.org/wiki/Special:Code/MediaWiki/62146

Revision: 62146
Author:   catrope
Date:     2010-02-08 23:34:09 +0000 (Mon, 08 Feb 2010)

Log Message:
-----------
UsabilityInitiative: Fix for r62143: make stuff work in IE7

Modified Paths:
--------------
    trunk/extensions/UsabilityInitiative/js/plugins/jquery.wikiEditor.js
    trunk/extensions/UsabilityInitiative/js/plugins.combined.js
    trunk/extensions/UsabilityInitiative/js/plugins.combined.min.js

Modified: trunk/extensions/UsabilityInitiative/js/plugins/jquery.wikiEditor.js
===================================================================
--- trunk/extensions/UsabilityInitiative/js/plugins/jquery.wikiEditor.js        
2010-02-08 23:18:09 UTC (rev 62145)
+++ trunk/extensions/UsabilityInitiative/js/plugins/jquery.wikiEditor.js        
2010-02-08 23:34:09 UTC (rev 62146)
@@ -1208,11 +1208,11 @@
                        // TODO: Refactor this into a textToHtml() function
                        var html = context.$textarea.val()
                                // We're gonna use &esc; as an escape sequence
-                               .replace( /&esc;/g, '&esc;&esc;' )
+                               .replace( /&esc;/g, '&esc;esc;' )
                                // Escape existing uses of <p>, </p>, &nbsp; 
and <span class="wikiEditor-tab"></span>
                                .replace( /\<p\>/g, '&esc;&lt;p&gt;' )
                                .replace (/\<\/p\>/g, '&esc;&lt;/p&gt;' )
-                               .replace( /\<span 
class="wikiEditor-tab"\>\<\/span\>/g, '&esc;&lt;span 
class="wikiEditor-tab"&gt;&lt;/span&gt;' )
+                               .replace( /\<span 
class="wikiEditor-tab"\>\<\/span\>/g, 
'&esc;&lt;span&nbsp;class=&quot;wikiEditor-tab&quot;&gt;&lt;/span&gt;' )
                                .replace( /&nbsp;/g, '&esc;&amp;nbsp;' );
                        // We must do some extra processing on IE to avoid 
dirty diffs, specifically IE will collapse leading spaces
                        // Browser sniffing is not ideal, but executing this 
code on a non-broken browser doesn't cause harm
@@ -1241,8 +1241,8 @@
                                .replace( /&amp;esc;&amp;amp;nbsp;/g, 
'&amp;nbsp;' )
                                .replace( /&amp;esc;&amp;lt;p&amp;gt;/g, 
'&lt;p&gt;' )
                                .replace( /&amp;esc;&amp;lt;\/p&amp;gt;/g, 
'&lt;/p&gt;' )
-                               .replace( /&amp;esc;&amp;lt;span 
class="wikiEditor-tab"&amp;gt;&amp;lt;\/span&amp;gt;/g, '&lt;span 
class="wikiEditor-tab"&gt;&lt;\/span&gt;' )
-                               .replace( /&amp;esc;&amp;esc;/g, '&amp;esc;' );
+                               .replace( 
/&amp;esc;&amp;lt;span&amp;nbsp;class=&amp;quot;wikiEditor-tab&amp;quot;&amp;gt;&amp;lt;\/span&amp;gt;/g,
 '&lt;span class="wikiEditor-tab"&gt;&lt;\/span&gt;' )
+                               .replace( /&amp;esc;esc;/g, '&amp;esc;' );
                        context.$content.html( html );
                        context.oldHTML = html;
                        // FIXME: This needs to be merged somehow with the 
oldHTML thing

Modified: trunk/extensions/UsabilityInitiative/js/plugins.combined.js
===================================================================
--- trunk/extensions/UsabilityInitiative/js/plugins.combined.js 2010-02-08 
23:18:09 UTC (rev 62145)
+++ trunk/extensions/UsabilityInitiative/js/plugins.combined.js 2010-02-08 
23:34:09 UTC (rev 62146)
@@ -7641,11 +7641,11 @@
                        // TODO: Refactor this into a textToHtml() function
                        var html = context.$textarea.val()
                                // We're gonna use &esc; as an escape sequence
-                               .replace( /&esc;/g, '&esc;&esc;' )
+                               .replace( /&esc;/g, '&esc;esc;' )
                                // Escape existing uses of <p>, </p>, &nbsp; 
and <span class="wikiEditor-tab"></span>
                                .replace( /\<p\>/g, '&esc;&lt;p&gt;' )
                                .replace (/\<\/p\>/g, '&esc;&lt;/p&gt;' )
-                               .replace( /\<span 
class="wikiEditor-tab"\>\<\/span\>/g, '&esc;&lt;span 
class="wikiEditor-tab"&gt;&lt;/span&gt;' )
+                               .replace( /\<span 
class="wikiEditor-tab"\>\<\/span\>/g, 
'&esc;&lt;span&nbsp;class=&quot;wikiEditor-tab&quot;&gt;&lt;/span&gt;' )
                                .replace( /&nbsp;/g, '&esc;&amp;nbsp;' );
                        // We must do some extra processing on IE to avoid 
dirty diffs, specifically IE will collapse leading spaces
                        // Browser sniffing is not ideal, but executing this 
code on a non-broken browser doesn't cause harm
@@ -7674,8 +7674,8 @@
                                .replace( /&amp;esc;&amp;amp;nbsp;/g, 
'&amp;nbsp;' )
                                .replace( /&amp;esc;&amp;lt;p&amp;gt;/g, 
'&lt;p&gt;' )
                                .replace( /&amp;esc;&amp;lt;\/p&amp;gt;/g, 
'&lt;/p&gt;' )
-                               .replace( /&amp;esc;&amp;lt;span 
class="wikiEditor-tab"&amp;gt;&amp;lt;\/span&amp;gt;/g, '&lt;span 
class="wikiEditor-tab"&gt;&lt;\/span&gt;' )
-                               .replace( /&amp;esc;&amp;esc;/g, '&amp;esc;' );
+                               .replace( 
/&amp;esc;&amp;lt;span&amp;nbsp;class=&amp;quot;wikiEditor-tab&amp;quot;&amp;gt;&amp;lt;\/span&amp;gt;/g,
 '&lt;span class="wikiEditor-tab"&gt;&lt;\/span&gt;' )
+                               .replace( /&amp;esc;esc;/g, '&amp;esc;' );
                        context.$content.html( html );
                        context.oldHTML = html;
                        // FIXME: This needs to be merged somehow with the 
oldHTML thing

Modified: trunk/extensions/UsabilityInitiative/js/plugins.combined.min.js
===================================================================
--- trunk/extensions/UsabilityInitiative/js/plugins.combined.min.js     
2010-02-08 23:18:09 UTC (rev 62145)
+++ trunk/extensions/UsabilityInitiative/js/plugins.combined.min.js     
2010-02-08 23:34:09 UTC (rev 62146)
@@ -526,8 +526,8 @@
 t=nextT;}},'saveSelection':function(){if(!$.browser.msie){return;}
 
context.$iframe[0].contentWindow.focus();context.savedSelection=context.$iframe[0].contentWindow.document.selection.createRange();},'restoreSelection':function(){if(!$.browser.msie||context.savedSelection===null){return;}
 
context.$iframe[0].contentWindow.focus();context.savedSelection.select();context.savedSelection=null;}};context.$textarea.wrap($('<div></div>').addClass('wikiEditor-ui')).wrap($('<div></div>').addClass('wikiEditor-ui-view
 
wikiEditor-ui-view-wikitext')).wrap($('<div></div>').addClass('wikiEditor-ui-left')).wrap($('<div></div>').addClass('wikiEditor-ui-bottom')).wrap($('<div></div>').addClass('wikiEditor-ui-text'));context.$ui=context.$textarea.parent().parent().parent().parent().parent();context.$wikitext=context.$textarea.parent().parent().parent().parent();context.$wikitext.before($('<div></div>').addClass('wikiEditor-ui-controls').append($('<div></div>').addClass('wikiEditor-ui-tabs').hide()).append($('<div></div>').addClass('wikiEditor-ui-buttons'))).before($('<div
 
style="clear:both;"></div>'));context.$controls=context.$ui.find('.wikiEditor-ui-buttons').hide();context.$buttons=context.$ui.find('.wikiEditor-ui-buttons');context.$tabs=context.$ui.find('.wikiEditor-ui-tabs');context.$ui.after($('<div
 
style="clear:both;"></div>'));context.$wikitext.append($('<div></div>').addClass('wikiEditor-ui-right'));context.$wikitext.find('.wikiEditor-ui-left').prepend($('<div></div>').addClass('wikiEditor-ui-top'));context.view='wikitext';$(window).resize(function(event){context.fn.trigger('resize',event);});context.$iframe=$('<iframe></iframe>').attr({'frameBorder':0,'border':0,'tabindex':1,'src':wgScriptPath+'/extensions/UsabilityInitiative/js/plugins/jquery.wikiEditor.html?'+'instance='+context.instance+'&ts='+(new
 
Date()).getTime(),'id':'wikiEditor-iframe-'+context.instance}).css({'backgroundColor':'white','width':'100%','height':context.$textarea.height(),'display':'none','overflow-y':'scroll','overflow-x':'hidden'}).insertAfter(context.$textarea).load(function(){if(!this.isSecondRun){context.$iframe[0].contentWindow.document.designMode='on';if($.browser.msie){this.isSecondRun=true;return;}}
-context.$content=$(context.$iframe[0].contentWindow.document.body);var 
html=context.$textarea.val().replace(/&esc;/g,'&esc;&esc;').replace(/\<p\>/g,'&esc;&lt;p&gt;').replace(/\<\/p\>/g,'&esc;&lt;/p&gt;').replace(/\<span
 class="wikiEditor-tab"\>\<\/span\>/g,'&esc;&lt;span 
class="wikiEditor-tab"&gt;&lt;/span&gt;').replace(/&nbsp;/g,'&esc;&amp;nbsp;');if($.browser.msie){html=html.replace(/\t/g,'<span
 
class="wikiEditor-tab"></span>');if($.browser.versionNumber<=7){html=html.replace(/
 /g,"&nbsp;");}else{html=html.replace(/(^|\n) /g,"$1&nbsp;");}}
-html=$('<div 
/>').text('<p>'+html.replace(/\r?\n/g,'</p><p>')+'</p>').html().replace(/&amp;nbsp;/g,'&nbsp;').replace(/&lt;p&gt;/g,'<p>').replace(/&lt;\/p&gt;/g,'</p>').replace(/<p><\/p>/g,'<br>').replace(/&amp;esc;&amp;amp;nbsp;/g,'&amp;nbsp;').replace(/&amp;esc;&amp;lt;p&amp;gt;/g,'&lt;p&gt;').replace(/&amp;esc;&amp;lt;\/p&amp;gt;/g,'&lt;/p&gt;').replace(/&amp;esc;&amp;lt;span
 class="wikiEditor-tab"&amp;gt;&amp;lt;\/span&amp;gt;/g,'&lt;span 
class="wikiEditor-tab"&gt;&lt;\/span&gt;').replace(/&amp;esc;&amp;esc;/g,'&amp;esc;');context.$content.html(html);context.oldHTML=html;context.history.push({'html':html});if($('body').is('.rtl')){context.$content.addClass('rtl').attr('dir','rtl');}
+context.$content=$(context.$iframe[0].contentWindow.document.body);var 
html=context.$textarea.val().replace(/&esc;/g,'&esc;esc;').replace(/\<p\>/g,'&esc;&lt;p&gt;').replace(/\<\/p\>/g,'&esc;&lt;/p&gt;').replace(/\<span
 
class="wikiEditor-tab"\>\<\/span\>/g,'&esc;&lt;span&nbsp;class=&quot;wikiEditor-tab&quot;&gt;&lt;/span&gt;').replace(/&nbsp;/g,'&esc;&amp;nbsp;');if($.browser.msie){html=html.replace(/\t/g,'<span
 
class="wikiEditor-tab"></span>');if($.browser.versionNumber<=7){html=html.replace(/
 /g,"&nbsp;");}else{html=html.replace(/(^|\n) /g,"$1&nbsp;");}}
+html=$('<div 
/>').text('<p>'+html.replace(/\r?\n/g,'</p><p>')+'</p>').html().replace(/&amp;nbsp;/g,'&nbsp;').replace(/&lt;p&gt;/g,'<p>').replace(/&lt;\/p&gt;/g,'</p>').replace(/<p><\/p>/g,'<br>').replace(/&amp;esc;&amp;amp;nbsp;/g,'&amp;nbsp;').replace(/&amp;esc;&amp;lt;p&amp;gt;/g,'&lt;p&gt;').replace(/&amp;esc;&amp;lt;\/p&amp;gt;/g,'&lt;/p&gt;').replace(/&amp;esc;&amp;lt;span&amp;nbsp;class=&amp;quot;wikiEditor-tab&amp;quot;&amp;gt;&amp;lt;\/span&amp;gt;/g,'&lt;span
 
class="wikiEditor-tab"&gt;&lt;\/span&gt;').replace(/&amp;esc;esc;/g,'&amp;esc;');context.$content.html(html);context.oldHTML=html;context.history.push({'html':html});if($('body').is('.rtl')){context.$content.addClass('rtl').attr('dir','rtl');}
 
context.$textarea.attr('disabled',true);context.$textarea.hide();context.$iframe.show();context.fn.trigger('ready');$(context.$iframe[0].contentWindow.document).bind('keydown',function(event){return
 context.fn.trigger('keydown',event);}).bind('keyup mouseup paste cut 
encapsulateSelection',function(event){return 
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'));if(context.fallbackWindowOnBeforeUnload){return
 context.fallbackWindowOnBeforeUnload();}};}
 var args=$.makeArray(arguments);if(args.length>0){var 
call=args.shift();if(call in context.api){context.api[call](context,typeof 
args[0]=='undefined'?{}:args[0]);}}
 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];}



_______________________________________________
MediaWiki-CVS mailing list
MediaWiki-CVS@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs

Reply via email to