r61824 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r61823‎ | r61824 | r61825 >
Date:21:56, 1 February 2010
Author:catrope
Status:deferred
Tags:
Comment:
UsabilityInitiative: Fix some stuff pointed out by JSLint. This should unbreak IE/Opera
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
@@ -72,7 +72,7 @@
7373 array( 'src' => 'js/plugins/jquery.namespaceSelect.js', 'version' => 1 ),
7474 array( 'src' => 'js/plugins/jquery.suggestions.js', 'version' => 7 ),
7575 array( 'src' => 'js/plugins/jquery.textSelection.js', 'version' => 26 ),
76 - array( 'src' => 'js/plugins/jquery.wikiEditor.js', 'version' => 92 ),
 76+ array( 'src' => 'js/plugins/jquery.wikiEditor.js', 'version' => 93 ),
7777 array( 'src' => 'js/plugins/jquery.wikiEditor.highlight.js', 'version' => 29 ),
7878 array( 'src' => 'js/plugins/jquery.wikiEditor.toolbar.js', 'version' => 46 ),
7979 array( 'src' => 'js/plugins/jquery.wikiEditor.dialogs.js', 'version' => 11 ),
@@ -82,10 +82,10 @@
8383 array( 'src' => 'js/plugins/jquery.wikiEditor.publish.js', 'version' => 2 ),
8484 ),
8585 'combined' => array(
86 - array( 'src' => 'js/plugins.combined.js', 'version' => 209 ),
 86+ array( 'src' => 'js/plugins.combined.js', 'version' => 210 ),
8787 ),
8888 'minified' => array(
89 - array( 'src' => 'js/plugins.combined.min.js', 'version' => 209 ),
 89+ array( 'src' => 'js/plugins.combined.min.js', 'version' => 210 ),
9090 ),
9191 ),
9292 );
Index: trunk/extensions/UsabilityInitiative/js/plugins/jquery.wikiEditor.js
@@ -89,7 +89,7 @@
9090 }
9191 // Check over each browser condition to determine if we are running in a compatible client
9292 var browser = $.wikiEditor.browsers[$( 'body' ).is( '.rtl' ) ? 'rtl' : 'ltr'][$.browser.name];
93 - for ( condition in browser ) {
 93+ for ( var condition in browser ) {
9494 var op = browser[condition][0];
9595 var val = browser[condition][1];
9696 if ( typeof val == 'string' ) {
@@ -118,7 +118,7 @@
119119 'autoMsg': function( object, property ) {
120120 // Accept array of possible properties, of which the first one found will be used
121121 if ( typeof property == 'object' ) {
122 - for ( i in property ) {
 122+ for ( var i in property ) {
123123 if ( property[i] in object || property[i] + 'Msg' in object ) {
124124 property = property[i];
125125 break;
@@ -229,12 +229,12 @@
230230 } else if ( typeof data == 'object' ) {
231231 modules = data;
232232 }
233 - for ( module in modules ) {
 233+ for ( var module in modules ) {
234234 // Check for the existance of an available module with a matching name and a create function
235235 if ( typeof module == 'string' && module in $.wikiEditor.modules ) {
236236 // Extend the context's core API with this module's own API calls
237237 if ( 'api' in $.wikiEditor.modules[module] ) {
238 - for ( call in $.wikiEditor.modules[module].api ) {
 238+ for ( var call in $.wikiEditor.modules[module].api ) {
239239 // Modules may not overwrite existing API functions - first come, first serve
240240 if ( !( call in context.api ) ) {
241241 context.api[call] = $.wikiEditor.modules[module].api[call];
@@ -310,7 +310,7 @@
311311 }
312312 }
313313 // Pass the event around to all modules activated on this context
314 - for ( module in context.modules ) {
 314+ for ( var module in context.modules ) {
315315 if (
316316 module in $.wikiEditor.modules &&
317317 'evt' in $.wikiEditor.modules[module] &&
@@ -400,7 +400,7 @@
401401 var $pre = $( '<pre>' + html + '</pre>' );
402402 $pre.find( '.wikiEditor-noinclude' ).each( function() { $( this ).remove(); } );
403403 // Convert tabs, <p>s and <br>s back
404 - $pre.find( '.wikiEditor-tab' ).each( function() { $( this ).text( "\t" ) } );
 404+ $pre.find( '.wikiEditor-tab' ).each( function() { $( this ).text( "\t" ); } );
405405 $pre.find( 'br' ).each( function() { $( this ).replaceWith( "\n" ); } );
406406 // Converting <p>s is wrong if there's nothing before them, so check that.
407407 // .find( '* + p' ) isn't good enough because textnodes aren't considered
@@ -545,9 +545,11 @@
546546 }
547547 var insertText = "";
548548 if ( options.splitlines ) {
549 - for( var i = 0; i < selTextArr.length; i++ ) {
550 - insertText = insertText + pre + selTextArr[i] + post;
551 - if( i != selTextArr.length - 1 ) insertText += "\n";
 549+ for( var j = 0; j < selTextArr.length; j++ ) {
 550+ insertText = insertText + pre + selTextArr[j] + post;
 551+ if( j != selTextArr.length - 1 ) {
 552+ insertText += "\n";
 553+ }
552554 }
553555 } else {
554556 insertText = pre + selText + post;
@@ -593,9 +595,9 @@
594596 // TODO: Clean this up. Duplicate code due to the pre-existing browser specific structure of this function
595597 var insertText = "";
596598 if ( options.splitlines ) {
597 - for( var i = 0; i < selTextArr.length; i++ ) {
598 - insertText = insertText + pre + selTextArr[i] + post;
599 - if( i != selTextArr.length - 1 ) {
 599+ for( var j = 0; j < selTextArr.length; j++ ) {
 600+ insertText = insertText + pre + selTextArr[j] + post;
 601+ if( j != selTextArr.length - 1 ) {
600602 insertText += "\n";
601603 }
602604 }
@@ -721,13 +723,13 @@
722724
723725 /**
724726 * Get the first element before the selection that's in a certain class
725 - * @param class Class to match. Defaults to '', meaning any class
 727+ * @param classname Class to match. Defaults to '', meaning any class
726728 * @param strict If true, the element the selection starts in cannot match (default: false)
727729 * @return jQuery object
728730 */
729 - 'beforeSelection': function( class, strict ) {
730 - if ( typeof class == 'undefined' ) {
731 - class = '';
 731+ 'beforeSelection': function( classname, strict ) {
 732+ if ( typeof classname == 'undefined' ) {
 733+ classname = '';
732734 }
733735 var e, offset;
734736 if ( context.$iframe[0].contentWindow.getSelection ) {
@@ -753,7 +755,7 @@
754756 // not in the iframe
755757 try {
756758 range2.setEndPoint( 'EndToStart', range );
757 - } catch ( e ) {
 759+ } catch ( ex ) {
758760 return $( [] );
759761 }
760762 var seekPos = context.fn.htmlToText( range2.htmlText ).length;
@@ -780,9 +782,9 @@
781783
782784 // We'd normally use if( $( e ).hasClass( class ) in the while loop, but running the jQuery
783785 // constructor thousands of times is very inefficient
784 - var classStr = ' ' + class + ' ';
 786+ var classStr = ' ' + classname + ' ';
785787 while ( e ) {
786 - if ( !strict && ( !class || ( ' ' + e.className + ' ' ).indexOf( classStr ) != -1 ) ) {
 788+ if ( !strict && ( !classname || ( ' ' + e.className + ' ' ).indexOf( classStr ) != -1 ) ) {
787789 return $( e );
788790 }
789791 var next = e.previousSibling;
@@ -1020,7 +1022,7 @@
10211023 // Setup the intial view
10221024 context.view = 'wikitext';
10231025 // Trigger the "resize" event anytime the window is resized
1024 - $( window ).resize( function( event ) { context.fn.trigger( 'resize', event ) } );
 1026+ $( window ).resize( function( event ) { context.fn.trigger( 'resize', event ); } );
10251027 // Create an iframe in place of the text area
10261028 context.$iframe = $( '<iframe></iframe>' )
10271029 .attr( {
@@ -1124,19 +1126,19 @@
11251127 window.onbeforeunload = function() {
11261128 context.$textarea.val( context.$textarea.textSelection( 'getContents' ) );
11271129 return context.fallbackWindowOnBeforeUnload ? context.fallbackWindowOnBeforeUnload() : null;
1128 - }
 1130+ };
11291131 }
11301132
11311133 /* API Execution */
11321134
11331135 // Since javascript gives arguments as an object, we need to convert them so they can be used more easily
1134 -arguments = $.makeArray( arguments );
 1136+var args = $.makeArray( arguments );
11351137 // There would need to be some arguments if the API is being called
1136 -if ( arguments.length > 0 ) {
 1138+if ( args.length > 0 ) {
11371139 // Handle API calls
1138 - var call = arguments.shift();
 1140+ var call = args.shift();
11391141 if ( call in context.api ) {
1140 - context.api[call]( context, typeof arguments[0] == 'undefined' ? {} : arguments[0] );
 1142+ context.api[call]( context, typeof args[0] == 'undefined' ? {} : args[0] );
11411143 }
11421144 }
11431145
Index: trunk/extensions/UsabilityInitiative/js/plugins.combined.js
@@ -6513,7 +6513,7 @@
65146514 }
65156515 // Check over each browser condition to determine if we are running in a compatible client
65166516 var browser = $.wikiEditor.browsers[$( 'body' ).is( '.rtl' ) ? 'rtl' : 'ltr'][$.browser.name];
6517 - for ( condition in browser ) {
 6517+ for ( var condition in browser ) {
65186518 var op = browser[condition][0];
65196519 var val = browser[condition][1];
65206520 if ( typeof val == 'string' ) {
@@ -6542,7 +6542,7 @@
65436543 'autoMsg': function( object, property ) {
65446544 // Accept array of possible properties, of which the first one found will be used
65456545 if ( typeof property == 'object' ) {
6546 - for ( i in property ) {
 6546+ for ( var i in property ) {
65476547 if ( property[i] in object || property[i] + 'Msg' in object ) {
65486548 property = property[i];
65496549 break;
@@ -6653,12 +6653,12 @@
66546654 } else if ( typeof data == 'object' ) {
66556655 modules = data;
66566656 }
6657 - for ( module in modules ) {
 6657+ for ( var module in modules ) {
66586658 // Check for the existance of an available module with a matching name and a create function
66596659 if ( typeof module == 'string' && module in $.wikiEditor.modules ) {
66606660 // Extend the context's core API with this module's own API calls
66616661 if ( 'api' in $.wikiEditor.modules[module] ) {
6662 - for ( call in $.wikiEditor.modules[module].api ) {
 6662+ for ( var call in $.wikiEditor.modules[module].api ) {
66636663 // Modules may not overwrite existing API functions - first come, first serve
66646664 if ( !( call in context.api ) ) {
66656665 context.api[call] = $.wikiEditor.modules[module].api[call];
@@ -6734,7 +6734,7 @@
67356735 }
67366736 }
67376737 // Pass the event around to all modules activated on this context
6738 - for ( module in context.modules ) {
 6738+ for ( var module in context.modules ) {
67396739 if (
67406740 module in $.wikiEditor.modules &&
67416741 'evt' in $.wikiEditor.modules[module] &&
@@ -6824,7 +6824,7 @@
68256825 var $pre = $( '<pre>' + html + '</pre>' );
68266826 $pre.find( '.wikiEditor-noinclude' ).each( function() { $( this ).remove(); } );
68276827 // Convert tabs, <p>s and <br>s back
6828 - $pre.find( '.wikiEditor-tab' ).each( function() { $( this ).text( "\t" ) } );
 6828+ $pre.find( '.wikiEditor-tab' ).each( function() { $( this ).text( "\t" ); } );
68296829 $pre.find( 'br' ).each( function() { $( this ).replaceWith( "\n" ); } );
68306830 // Converting <p>s is wrong if there's nothing before them, so check that.
68316831 // .find( '* + p' ) isn't good enough because textnodes aren't considered
@@ -6969,9 +6969,11 @@
69706970 }
69716971 var insertText = "";
69726972 if ( options.splitlines ) {
6973 - for( var i = 0; i < selTextArr.length; i++ ) {
6974 - insertText = insertText + pre + selTextArr[i] + post;
6975 - if( i != selTextArr.length - 1 ) insertText += "\n";
 6973+ for( var j = 0; j < selTextArr.length; j++ ) {
 6974+ insertText = insertText + pre + selTextArr[j] + post;
 6975+ if( j != selTextArr.length - 1 ) {
 6976+ insertText += "\n";
 6977+ }
69766978 }
69776979 } else {
69786980 insertText = pre + selText + post;
@@ -7017,9 +7019,9 @@
70187020 // TODO: Clean this up. Duplicate code due to the pre-existing browser specific structure of this function
70197021 var insertText = "";
70207022 if ( options.splitlines ) {
7021 - for( var i = 0; i < selTextArr.length; i++ ) {
7022 - insertText = insertText + pre + selTextArr[i] + post;
7023 - if( i != selTextArr.length - 1 ) {
 7023+ for( var j = 0; j < selTextArr.length; j++ ) {
 7024+ insertText = insertText + pre + selTextArr[j] + post;
 7025+ if( j != selTextArr.length - 1 ) {
70247026 insertText += "\n";
70257027 }
70267028 }
@@ -7145,13 +7147,13 @@
71467148
71477149 /**
71487150 * Get the first element before the selection that's in a certain class
7149 - * @param class Class to match. Defaults to '', meaning any class
 7151+ * @param classname Class to match. Defaults to '', meaning any class
71507152 * @param strict If true, the element the selection starts in cannot match (default: false)
71517153 * @return jQuery object
71527154 */
7153 - 'beforeSelection': function( class, strict ) {
7154 - if ( typeof class == 'undefined' ) {
7155 - class = '';
 7155+ 'beforeSelection': function( classname, strict ) {
 7156+ if ( typeof classname == 'undefined' ) {
 7157+ classname = '';
71567158 }
71577159 var e, offset;
71587160 if ( context.$iframe[0].contentWindow.getSelection ) {
@@ -7177,7 +7179,7 @@
71787180 // not in the iframe
71797181 try {
71807182 range2.setEndPoint( 'EndToStart', range );
7181 - } catch ( e ) {
 7183+ } catch ( ex ) {
71827184 return $( [] );
71837185 }
71847186 var seekPos = context.fn.htmlToText( range2.htmlText ).length;
@@ -7204,9 +7206,9 @@
72057207
72067208 // We'd normally use if( $( e ).hasClass( class ) in the while loop, but running the jQuery
72077209 // constructor thousands of times is very inefficient
7208 - var classStr = ' ' + class + ' ';
 7210+ var classStr = ' ' + classname + ' ';
72097211 while ( e ) {
7210 - if ( !strict && ( !class || ( ' ' + e.className + ' ' ).indexOf( classStr ) != -1 ) ) {
 7212+ if ( !strict && ( !classname || ( ' ' + e.className + ' ' ).indexOf( classStr ) != -1 ) ) {
72117213 return $( e );
72127214 }
72137215 var next = e.previousSibling;
@@ -7444,7 +7446,7 @@
74457447 // Setup the intial view
74467448 context.view = 'wikitext';
74477449 // Trigger the "resize" event anytime the window is resized
7448 - $( window ).resize( function( event ) { context.fn.trigger( 'resize', event ) } );
 7450+ $( window ).resize( function( event ) { context.fn.trigger( 'resize', event ); } );
74497451 // Create an iframe in place of the text area
74507452 context.$iframe = $( '<iframe></iframe>' )
74517453 .attr( {
@@ -7548,19 +7550,19 @@
75497551 window.onbeforeunload = function() {
75507552 context.$textarea.val( context.$textarea.textSelection( 'getContents' ) );
75517553 return context.fallbackWindowOnBeforeUnload ? context.fallbackWindowOnBeforeUnload() : null;
7552 - }
 7554+ };
75537555 }
75547556
75557557 /* API Execution */
75567558
75577559 // Since javascript gives arguments as an object, we need to convert them so they can be used more easily
7558 -arguments = $.makeArray( arguments );
 7560+var args = $.makeArray( arguments );
75597561 // There would need to be some arguments if the API is being called
7560 -if ( arguments.length > 0 ) {
 7562+if ( args.length > 0 ) {
75617563 // Handle API calls
7562 - var call = arguments.shift();
 7564+ var call = args.shift();
75637565 if ( call in context.api ) {
7564 - context.api[call]( context, typeof arguments[0] == 'undefined' ? {} : arguments[0] );
 7566+ context.api[call]( context, typeof args[0] == 'undefined' ? {} : args[0] );
75657567 }
75667568 }
75677569
Index: trunk/extensions/UsabilityInitiative/js/plugins.combined.min.js
@@ -436,22 +436,22 @@
437437 options.endContainer=options.startContainer;break;case'scrollToCaretPosition':options=$.extend({'force':false},options);break;}
438438 var context=$(this).data('wikiEditor-context');var hasIframe=context!==undefined&&context.$iframe!==undefined;return(hasIframe?context.fn:fn)[command].call(this,options);};})(jQuery);(function($){$.wikiEditor={'modules':{},'instances':[],'browsers':{'ltr':{'msie':[['>=',7]],'firefox':[['>=',2],['!=','2.0'],['!=','2.0.0.1'],['!=','2.0.0.2'],['!=','2.0.0.3'],['!=','2.0.0.4']],'opera':[['>=',9.6]],'safari':[['>=',3.1]]},'rtl':{'msie':[['>=',8]],'firefox':[['>=',2],['!=','2.0'],['!=','2.0.0.1'],['!=','2.0.0.2'],['!=','2.0.0.3'],['!=','2.0.0.4']],'opera':[['>=',9.6]],'safari':[['>=',3.1]]}},'imgPath':wgScriptPath+'/extensions/UsabilityInitiative/images/wikiEditor/','isSupported':function(){if(typeof $.wikiEditor.supported!='undefined'){return $.wikiEditor.supported;}
439439 if(!($.browser.name in $.wikiEditor.browsers[$('body').is('.rtl')?'rtl':'ltr'])){return $.wikiEditor.supported=true;}
440 -var browser=$.wikiEditor.browsers[$('body').is('.rtl')?'rtl':'ltr'][$.browser.name];for(condition in browser){var op=browser[condition][0];var val=browser[condition][1];if(typeof val=='string'){if(!(eval('$.browser.version'+op+'"'+val+'"'))){return $.wikiEditor.supported=false;}}else if(typeof val=='number'){if(!(eval('$.browser.versionNumber'+op+val))){return $.wikiEditor.supported=false;}}}
441 -return $.wikiEditor.supported=true;},'autoMsg':function(object,property){if(typeof property=='object'){for(i in property){if(property[i]in object||property[i]+'Msg'in object){property=property[i];break;}}}
 440+var browser=$.wikiEditor.browsers[$('body').is('.rtl')?'rtl':'ltr'][$.browser.name];for(var condition in browser){var op=browser[condition][0];var val=browser[condition][1];if(typeof val=='string'){if(!(eval('$.browser.version'+op+'"'+val+'"'))){return $.wikiEditor.supported=false;}}else if(typeof val=='number'){if(!(eval('$.browser.versionNumber'+op+val))){return $.wikiEditor.supported=false;}}}
 441+return $.wikiEditor.supported=true;},'autoMsg':function(object,property){if(typeof property=='object'){for(var i in property){if(property[i]in object||property[i]+'Msg'in object){property=property[i];break;}}}
442442 if(property in object){return object[property];}else if(property+'Msg'in object){if(typeof object[property+'Msg']=='object'){return mw.usability.getMsg.apply(mw.usability,object[property+'Msg']);}else{return mw.usability.getMsg(object[property+'Msg']);}}else{return'';}},'autoLang':function(object,lang){return object[lang||wgUserLanguage]||object['default']||object;},'autoIcon':function(icon,path,lang){var src=$.wikiEditor.autoLang(icon,lang);path=path||$.wikiEditor.imgPath;if(src.substr(0,7)!='http://'&&src.substr(0,8)!='https://'&&src[0]!='/'){src=path+src;}
443443 return src+'?'+wgWikiEditorIconVersion;}};$.fn.wikiEditor=function(){if(!$j.wikiEditor.isSupported()){return $(this);}
444444 var context=$(this).data('wikiEditor-context');if(typeof context=='undefined'){context={'$textarea':$(this),'views':{},'modules':{},'data':{},'instance':$.wikiEditor.instances.push($(this))-1,'offsets':null,'htmlToTextMap':{},'oldHTML':null,'oldDelayedHTML':null};context.api={'addModule':function(context,data){var modules={};if(typeof data=='string'){modules[data]={};}else if(typeof data=='object'){modules=data;}
445 -for(module in modules){if(typeof module=='string'&&module in $.wikiEditor.modules){if('api'in $.wikiEditor.modules[module]){for(call in $.wikiEditor.modules[module].api){if(!(call in context.api)){context.api[call]=$.wikiEditor.modules[module].api[call];}}}
 445+for(var module in modules){if(typeof module=='string'&&module in $.wikiEditor.modules){if('api'in $.wikiEditor.modules[module]){for(var call in $.wikiEditor.modules[module].api){if(!(call in context.api)){context.api[call]=$.wikiEditor.modules[module].api[call];}}}
446446 if('fn'in $.wikiEditor.modules[module]&&'create'in $.wikiEditor.modules[module].fn){context.modules[module]={};$.wikiEditor.modules[module].fn.create(context,modules[module]);}}}}};context.evt={'change':function(event){event.data.scope='division';var newHTML=context.$content.html();if(context.oldHTML!=newHTML){context.fn.purgeOffsets();context.oldHTML=newHTML;event.data.scope='realchange';}
447447 return true;},'delayedChange':function(event){event.data.scope='division';var newHTML=context.$content.html();if(context.oldDelayedHTML!=newHTML){context.fn.purgeOffsets();context.oldDelayedHTML=newHTML;event.data.scope='realchange';}
448448 return true;}};context.fn={'trigger':function(name,event){if(typeof event=='undefined'){event={'type':'custom'};}
449449 if(typeof event.data=='undefined'){event.data={};}
450450 if(name in context.evt){if(!context.evt[name](event)){return false;}}
451 -for(module in context.modules){if(module in $.wikiEditor.modules&&'evt'in $.wikiEditor.modules[module]&&name in $.wikiEditor.modules[module].evt){$.wikiEditor.modules[module].evt[name](context,event);}}},'addButton':function(options){context.$controls.show();context.$buttons.show();return $('<button />').text($.wikiEditor.autoMsg(options,'caption')).click(options.action).appendTo(context.$buttons);},'addView':function(options){function addTab(options){context.$controls.show();context.$tabs.show();return $('<div></div>').attr('rel','wikiEditor-ui-view-'+options.name).addClass(context.view==options.name?'current':null).append($('<a></a>').attr('href','#').click(function(event){context.$ui.find('.wikiEditor-ui-view').hide();context.$ui.find('.'+$(this).parent().attr('rel')).show();context.$tabs.find('div').removeClass('current');$(this).parent().addClass('current');$(this).blur();if('init'in options&&typeof options.init=='function'){options.init(context);}
 451+for(var module in context.modules){if(module in $.wikiEditor.modules&&'evt'in $.wikiEditor.modules[module]&&name in $.wikiEditor.modules[module].evt){$.wikiEditor.modules[module].evt[name](context,event);}}},'addButton':function(options){context.$controls.show();context.$buttons.show();return $('<button />').text($.wikiEditor.autoMsg(options,'caption')).click(options.action).appendTo(context.$buttons);},'addView':function(options){function addTab(options){context.$controls.show();context.$tabs.show();return $('<div></div>').attr('rel','wikiEditor-ui-view-'+options.name).addClass(context.view==options.name?'current':null).append($('<a></a>').attr('href','#').click(function(event){context.$ui.find('.wikiEditor-ui-view').hide();context.$ui.find('.'+$(this).parent().attr('rel')).show();context.$tabs.find('div').removeClass('current');$(this).parent().addClass('current');$(this).blur();if('init'in options&&typeof options.init=='function'){options.init(context);}
452452 event.preventDefault();return false;}).text($.wikiEditor.autoMsg(options,'title'))).appendTo(context.$tabs);}
453453 if(!context.$tabs.children().size()){addTab({'name':'wikitext','titleMsg':'wikieditor-wikitext-tab'});}
454454 addTab(options);return $('<div></div>').addClass('wikiEditor-ui-view wikiEditor-ui-view-'+options.name).hide().appendTo(context.$ui);},'htmlToText':function(html){if(html in context.htmlToTextMap){return context.htmlToTextMap[html];}
455 -var origHTML=html;html=html.replace(/\r?\n/g,"").replace(/&nbsp;/g," ").replace(/\<br[^\>]*\>/gi,"\n").replace(/\<\/p\>\<p\>/gi,"\n").replace(/\<\/p\>(\n*)\<p\>/gi,"$1\n");var leading=html.match(/^\s*/)[0];var trailing=html.match(/\s*$/)[0];html=html.substr(leading.length,html.length-leading.length-trailing.length);var $pre=$('<pre>'+html+'</pre>');$pre.find('.wikiEditor-noinclude').each(function(){$(this).remove();});$pre.find('.wikiEditor-tab').each(function(){$(this).text("\t")});$pre.find('br').each(function(){$(this).replaceWith("\n");});$pre.find('p').each(function(){if(this.previousSibling||this.parentNode!=$pre.get(0)){var text=$(this).text();var t=new context.fn.rawTraverser(this.firstChild,-10,this).prev();while(t&&t.node.nodeName!='#text'&&t.node.nodeName!='BR'&&t.node.nodeName!='P'){t=t.prev();}
 455+var origHTML=html;html=html.replace(/\r?\n/g,"").replace(/&nbsp;/g," ").replace(/\<br[^\>]*\>/gi,"\n").replace(/\<\/p\>\<p\>/gi,"\n").replace(/\<\/p\>(\n*)\<p\>/gi,"$1\n");var leading=html.match(/^\s*/)[0];var trailing=html.match(/\s*$/)[0];html=html.substr(leading.length,html.length-leading.length-trailing.length);var $pre=$('<pre>'+html+'</pre>');$pre.find('.wikiEditor-noinclude').each(function(){$(this).remove();});$pre.find('.wikiEditor-tab').each(function(){$(this).text("\t");});$pre.find('br').each(function(){$(this).replaceWith("\n");});$pre.find('p').each(function(){if(this.previousSibling||this.parentNode!=$pre.get(0)){var text=$(this).text();var t=new context.fn.rawTraverser(this.firstChild,-10,this).prev();while(t&&t.node.nodeName!='#text'&&t.node.nodeName!='BR'&&t.node.nodeName!='P'){t=t.prev();}
456456 if(t){text="\n"+text;}
457457 t=new context.fn.rawTraverser(this.lastChild,-10,this).next();while(t&&t.node.nodeName!='#text'&&t.node.nodeName!='BR'&&t.node.nodeName!='P'){t=t.next();}
458458 if(t&&!t.inP&&t.node.nodeName=='#text'&&t.node.nodeValue.charAt(0)!='\n'&&t.node.nodeValue.charAt(0)!='\r'){text+="\n";}
@@ -464,11 +464,11 @@
465465 if(n&&n.nodeName=='BR'){atStart=true;}else{atEnd=true;}}else if(range.startContainer.nodeName=='#text'&&range.startOffset==range.startContainer.nodeValue.length){atEnd=true;}
466466 if(!atStart){pre="\n"+options.pre;}
467467 if(!atEnd){post+="\n";}}
468 -var insertText="";if(options.splitlines){for(var i=0;i<selTextArr.length;i++){insertText=insertText+pre+selTextArr[i]+post;if(i!=selTextArr.length-1)insertText+="\n";}}else{insertText=pre+selText+post;}
 468+var insertText="";if(options.splitlines){for(var j=0;j<selTextArr.length;j++){insertText=insertText+pre+selTextArr[j]+post;if(j!=selTextArr.length-1){insertText+="\n";}}}else{insertText=pre+selText+post;}
469469 var insertLines=insertText.split("\n");range.extractContents();var lastNode;for(var i=insertLines.length-1;i>=0;i--){range.insertNode(context.$iframe[0].contentWindow.document.createTextNode(insertLines[i]));if(i>0){lastNode=range.insertNode(context.$iframe[0].contentWindow.document.createElement('br'));}}
470470 if(lastNode){context.fn.scrollToTop(lastNode);}}else if(context.$iframe[0].contentWindow.document.selection){context.$iframe[0].contentWindow.focus();var range=context.$iframe[0].contentWindow.document.selection.createRange();if(options.ownline&&range.moveStart){var range2=context.$iframe[0].contentWindow.document.selection.createRange();range2.collapse();range2.moveStart('character',-1);if(range2.text!="\r"&&range2.text!="\n"&&range2.text!=""){pre="\n"+pre;}
471471 var range3=context.$iframe[0].contentWindow.document.selection.createRange();range3.collapse(false);range3.moveEnd('character',1);if(range3.text!="\r"&&range3.text!="\n"&&range3.text!=""){post+="\n";}}
472 -var insertText="";if(options.splitlines){for(var i=0;i<selTextArr.length;i++){insertText=insertText+pre+selTextArr[i]+post;if(i!=selTextArr.length-1){insertText+="\n";}}}else{insertText=pre+selText+post;}
 472+var insertText="";if(options.splitlines){for(var j=0;j<selTextArr.length;j++){insertText=insertText+pre+selTextArr[j]+post;if(j!=selTextArr.length-1){insertText+="\n";}}}else{insertText=pre+selText+post;}
473473 range.pasteHTML(insertText.replace(/\</g,'&lt;').replace(/>/g,'&gt;').replace(/\r?\n/g,'<br />'));}
474474 $(context.$iframe[0].contentWindow.document).trigger('encapsulateSelection',[pre,options.peri,post,options.ownline,options.replace]);return context.$textarea;},'getCaretPosition':function(options){},'setSelection':function(options){var sc=options.startContainer,ec=options.endContainer;sc=sc&&sc.jquery?sc[0]:sc;ec=ec&&ec.jquery?ec[0]:ec;if(context.$iframe[0].contentWindow.getSelection){var start=options.start,end=options.end;if(!sc||!ec){var s=context.fn.getOffset(start);var e=context.fn.getOffset(end);sc=s?s.node:null;ec=e?e.node:null;start=s?s.offset:null;end=e?e.offset:null;}
475475 if(!sc||!ec){return context.$textarea;}
@@ -479,13 +479,13 @@
480480 range2.collapse();range2.moveEnd('character',options.end);range.setEndPoint('EndToEnd',range2);range.select();}
481481 return context.$textarea;},'scrollToCaretPosition':function(options){},'scrollToTop':function($element,force){var html=context.$content.closest('html'),body=context.$content.closest('body'),parentHtml=$('html'),parentBody=$('body');var y=$element.offset().top;if(!$.browser.msie&&!$element.is('body')){y=parentHtml.scrollTop()>0?y+html.scrollTop()-parentHtml.scrollTop():y;y=parentBody.scrollTop()>0?y+body.scrollTop()-parentBody.scrollTop():y;}
482482 var topBound=html.scrollTop()>body.scrollTop()?html.scrollTop():body.scrollTop(),bottomBound=topBound+context.$iframe.height();if(force||y<topBound||y>bottomBound){html.scrollTop(y);body.scrollTop(y);}
483 -$element.trigger('scrollToTop');},'beforeSelection':function(class,strict){if(typeof class=='undefined'){class='';}
484 -var e,offset;if(context.$iframe[0].contentWindow.getSelection){var selection=context.$iframe[0].contentWindow.getSelection();if(selection.baseNode!==null){e=selection.getRangeAt(0).startContainer;offset=selection.getRangeAt(0).startOffset;}else{return $([]);}}else if(context.$iframe[0].contentWindow.document.selection){var range=context.$iframe[0].contentWindow.document.selection.createRange();var range2=context.$iframe[0].contentWindow.document.body.createTextRange();try{range2.setEndPoint('EndToStart',range);}catch(e){return $([]);}
 483+$element.trigger('scrollToTop');},'beforeSelection':function(classname,strict){if(typeof classname=='undefined'){classname='';}
 484+var e,offset;if(context.$iframe[0].contentWindow.getSelection){var selection=context.$iframe[0].contentWindow.getSelection();if(selection.baseNode!==null){e=selection.getRangeAt(0).startContainer;offset=selection.getRangeAt(0).startOffset;}else{return $([]);}}else if(context.$iframe[0].contentWindow.document.selection){var range=context.$iframe[0].contentWindow.document.selection.createRange();var range2=context.$iframe[0].contentWindow.document.body.createTextRange();try{range2.setEndPoint('EndToStart',range);}catch(ex){return $([]);}
485485 var seekPos=context.fn.htmlToText(range2.htmlText).length;var offset=context.fn.getOffset(seekPos);e=offset?offset.node:null;offset=offset?offset.offset:null;if(!e){return $([]);}}
486486 if(e.nodeName!='#text'){var newE=e.firstChild;for(var i=0;i<offset-1&&newE;i++){newE=newE.nextSibling;}
487487 while(newE&&newE.lastChild){newE=newE.lastChild;}
488488 e=newE||e;}
489 -var classStr=' '+class+' ';while(e){if(!strict&&(!class||(' '+e.className+' ').indexOf(classStr)!=-1)){return $(e);}
 489+var classStr=' '+classname+' ';while(e){if(!strict&&(!classname||(' '+e.className+' ').indexOf(classStr)!=-1)){return $(e);}
490490 var next=e.previousSibling;while(next&&next.lastChild){next=next.lastChild;}
491491 e=next||e.parentNode;strict=false;}
492492 return $([]);},'rawTraverser':function(node,depth,inP){this.node=node;this.depth=depth;this.inP=inP;this.next=function(){var p=this.node;var nextDepth=this.depth;var nextInP=this.inP;while(p&&!p.nextSibling){p=p.parentNode;nextDepth--;if(nextDepth==0){p=null;}
@@ -505,12 +505,12 @@
506506 var base=context.offsets[lowerBound];return context.offsets[offset]={'node':base.node,'offset':base.offset+offset-lowerBound,'length':base.length,'depth':base.depth,'lastTextNode':base.lastTextNode,'lastTextNodeDepth':base.lastTextNodeDepth};},'purgeOffsets':function(){context.offsets=null;},'refreshOffsets':function(){context.offsets=[];var t=context.fn.traverser(context.$content);var pos=0,lastTextNode=null,lastTextNodeDepth=null;while(t){if(t.node.nodeName!='#text'&&t.node.nodeName!='BR'&&t.node.nodeName!='P'){t=t.next();continue;}
507507 var nextPos=t.node.nodeName=='#text'?pos+t.node.nodeValue.length:pos+1;var nextT=t.next();var leavingP=t.node.nodeName!='P'&&t.inP&&nextT&&(!nextT.inP||nextT.inP!=t.inP);context.offsets[pos]={'node':t.node,'offset':0,'length':nextPos-pos+(leavingP?1:0),'depth':t.depth,'lastTextNode':lastTextNode,'lastTextNodeDepth':lastTextNodeDepth};if(leavingP){context.offsets[nextPos]={'node':t.node,'offset':nextPos-pos,'length':nextPos-pos+1,'depth':t.depth,'lastTextNode':lastTextNode,'lastTextNodeDepth':lastTextNodeDepth};}
508508 pos=nextPos+(leavingP?1:0);if(t.node.nodeName=='#text'){lastTextNode=t.node;lastTextNodeDepth=t.depth;}
509 -t=nextT;}}};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,'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;}}
 509+t=nextT;}}};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,'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;}}
510510 context.$content=$(context.$iframe[0].contentWindow.document.body);var html=context.$textarea.val().replace(/&nbsp;/g,'&amp;nbsp;').replace(/\<br\>/g,'&lt;br&gt;').replace(/\<span class="wikiEditor-tab"\>\<\/span\>/g,'&lt;span class=&quot;wikiEditor-tab&quot;&gt;&lt;/span&gt;');if($.browser.msie){if($.browser.versionNumber<=7){html=html.replace(/ /g,"&nbsp;");}else{html=html.replace(/(^|\n) /g,"$1&nbsp;");}
511511 html=html.replace(/\t/g,'<span class="wikiEditor-tab"></span>');}
512512 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(/&lt;span class=&quot;wikiEditor-tab&quot;&gt;&lt;\/span&gt;/g,'<span class="wikiEditor-tab"></span>').replace(/&amp;amp;nbsp;/g,'&amp;nbsp;').replace(/&amp;lt;br&amp;gt;/g,'&lt;br&gt;').replace(/&amp;lt;span class=&amp;quot;wikiEditor-tab&amp;quot;&amp;gt;&amp;lt;\/span&amp;gt;/g,'&lt;span class=&quot;wikiEditor-tab&quot;&gt;&lt;/span&gt;');context.$content.html(html);context.oldHTML=html;if($('body').is('.rtl')){context.$content.addClass('rtl').attr('dir','rtl');}
513 -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;}}
514 -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]);}}
 513+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;};}
 514+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]);}}
515515 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];}
516516 mw.usability.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)
517517 configuration.newButtons[mw.usability.getMsg(msg)]=configuration.buttons[msg];configuration.buttons=configuration.newButtons;var dialogDiv=$('<div /> ').attr('id',module.id).html(module.html).data('context',context).appendTo($('body')).each(module.init).dialog(configuration);if(!('resizeme'in module)||module.resizeme){dialogDiv.bind('dialogopen',$.wikiEditor.modules.dialogs.fn.resize).find('.ui-tabs').bind('tabsshow',function(){$(this).closest('.ui-dialog-content').each($.wikiEditor.modules.dialogs.fn.resize);});}

Status & tagging log