r60813 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r60812‎ | r60813 | r60814 >
Date:22:54, 7 January 2010
Author:catrope
Status:deferred
Tags:
Comment:
* UsabilityInitiative: Add context.fn.setSelection() implementation for IE. Barely tested and known to be broken, but it's a start
* IE fixes
** Patched jQuery inherit plugin to disable a conditional that breaks on IE7 and that we don't need anyway
** Fix r60812 per CR comment
** Remove trailing commas all over the place
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.inherit.js (modified) (history)
  • /trunk/extensions/UsabilityInitiative/js/plugins/jquery.textSelection.js (modified) (history)
  • /trunk/extensions/UsabilityInitiative/js/plugins/jquery.wikiEditor.js (modified) (history)
  • /trunk/extensions/UsabilityInitiative/js/plugins/jquery.wikiEditor.toc.js (modified) (history)

Diff [purge]

Index: trunk/extensions/UsabilityInitiative/UsabilityInitiative.hooks.php
@@ -68,24 +68,24 @@
6969 array( 'src' => 'js/plugins/jquery.collapsibleTabs.js', 'version' => 5 ),
7070 array( 'src' => 'js/plugins/jquery.cookie.js', 'version' => 3 ),
7171 array( 'src' => 'js/plugins/jquery.delayedBind.js', 'version' => 1 ),
72 - array( 'src' => 'js/plugins/jquery.inherit.js', 'version' => 1 ),
 72+ array( 'src' => 'js/plugins/jquery.inherit.js', 'version' => 2 ),
7373 array( 'src' => 'js/plugins/jquery.namespaceSelect.js', 'version' => 1 ),
7474 array( 'src' => 'js/plugins/jquery.suggestions.js', 'version' => 7 ),
75 - array( 'src' => 'js/plugins/jquery.textSelection.js', 'version' => 21 ),
76 - array( 'src' => 'js/plugins/jquery.wikiEditor.js', 'version' => 42 ),
 75+ array( 'src' => 'js/plugins/jquery.textSelection.js', 'version' => 22 ),
 76+ array( 'src' => 'js/plugins/jquery.wikiEditor.js', 'version' => 43 ),
7777 array( 'src' => 'js/plugins/jquery.wikiEditor.highlight.js', 'version' => 12 ),
7878 array( 'src' => 'js/plugins/jquery.wikiEditor.toolbar.js', 'version' => 40 ),
7979 array( 'src' => 'js/plugins/jquery.wikiEditor.dialogs.js', 'version' => 10 ),
80 - array( 'src' => 'js/plugins/jquery.wikiEditor.toc.js', 'version' => 56 ),
 80+ array( 'src' => 'js/plugins/jquery.wikiEditor.toc.js', 'version' => 57 ),
8181 array( 'src' => 'js/plugins/jquery.wikiEditor.preview.js', 'version' => 9 ),
8282 array( 'src' => 'js/plugins/jquery.wikiEditor.templateEditor.js', 'version' => 14 ),
8383 array( 'src' => 'js/plugins/jquery.wikiEditor.publish.js', 'version' => 1 ),
8484 ),
8585 'combined' => array(
86 - array( 'src' => 'js/plugins.combined.js', 'version' => 134 ),
 86+ array( 'src' => 'js/plugins.combined.js', 'version' => 135 ),
8787 ),
8888 'minified' => array(
89 - array( 'src' => 'js/plugins.combined.min.js', 'version' => 134 ),
 89+ array( 'src' => 'js/plugins.combined.min.js', 'version' => 135 ),
9090 ),
9191 ),
9292 );
Index: trunk/extensions/UsabilityInitiative/js/plugins/jquery.textSelection.js
@@ -348,7 +348,7 @@
349349 break;
350350 case 'getCaretPosition':
351351 options = $.extend( {
352 - 'startAndEnd': false, // Return [start, end] instead of just start
 352+ 'startAndEnd': false // Return [start, end] instead of just start
353353 }, options );
354354 // FIXME: We may not need character position-based functions if we insert markers in the right places
355355 break;
@@ -357,7 +357,7 @@
358358 'start': undefined, // Position to start selection at
359359 'end': undefined, // Position to end selection at. Defaults to start
360360 'startContainer': undefined, // Element to start selection in (iframe only)
361 - 'endContainer': undefined, // Element to end selection in (iframe only). Defaults to startContainer
 361+ 'endContainer': undefined // Element to end selection in (iframe only). Defaults to startContainer
362362 }, options );
363363 if ( options.end === undefined )
364364 options.end = options.start;
Index: trunk/extensions/UsabilityInitiative/js/plugins/jquery.wikiEditor.toc.js
@@ -10,7 +10,7 @@
1111 // Minimum width to allow resizing to before collapsing the table of contents - used when resizing and collapsing
1212 minimumWidth: '70px',
1313 // Boolean var indicating text direction
14 - rtl: false,
 14+ rtl: false
1515 },
1616 /**
1717 * API accessible functions
Index: trunk/extensions/UsabilityInitiative/js/plugins/jquery.inherit.js
@@ -105,7 +105,8 @@
106106 // Test and see if we're handling a shortcut bind for the document.ready function. This occurs when the selector
107107 // is a function. Because firefox throws xpconnect objects around in iFrames, the standard
108108 // jQuery.isFunction test returns false negatives.
109 - if ( selector.constructor.toString().match( /Function/ ) != null ) {
 109+ // PATCHED: Disable this check because it breaks subtly on IE7 and we don't use $j( function() { ... } ) anyway
 110+ if ( false && selector.constructor.toString().match( /Function/ ) != null ) {
110111 return child.jQueryInherit.fn.ready( selector );
111112 }
112113 // Otherwise, just let the jQuery init function handle the rest. Be sure we pass in proper context of the
Index: trunk/extensions/UsabilityInitiative/js/plugins/jquery.wikiEditor.js
@@ -506,12 +506,12 @@
507507 * @param endContainer Element in iframe to end selection in
508508 */
509509 'setSelection': function( options ) {
 510+ var sc = options.startContainer, ec = options.endContainer;
 511+ sc = sc.jquery ? sc[0] : sc;
 512+ ec = ec.jquery ? ec[0] : ec;
510513 if ( context.$iframe[0].contentWindow.getSelection ) {
511514 // Firefox and Opera
512515 var sel = context.$iframe[0].contentWindow.getSelection();
513 - var sc = options.startContainer, ec = options.endContainer;
514 - sc = sc.jquery ? sc[0] : sc;
515 - ec = ec.jquery ? ec[0] : ec;
516516 while ( sc.firstChild && sc.nodeName != '#text' ) {
517517 sc = sc.firstChild;
518518 }
@@ -527,7 +527,15 @@
528528 context.$iframe[0].contentWindow.focus();
529529 } else if ( context.$iframe[0].contentWindow.document.selection ) {
530530 // IE
531 - // TODO
 531+ // FIXME still broken for when sc or ec is the <body>, needs more tweaking
 532+ var range = document.selection.createRange();
 533+ range.moveToElementText( sc );
 534+ range.moveStart( 'character', options.start );
 535+ var range2 = document.selection.createRange();
 536+ range2.moveToElementText( ec );
 537+ range2.moveEnd( 'character', options.end );
 538+ range.setEndPoint( EndToEnd, range2 );
 539+ range.select();
532540 }
533541 },
534542 /**
@@ -669,7 +677,7 @@
670678 } )
671679 .insertAfter( context.$textarea )
672680 .load( function() {
673 - if(!$( context.$iframe[0].contentWindow.document.body )){
 681+ if ( !context.$iframe[0].contentWindow.document.body ) {
674682 return;
675683 }
676684 // Turn the document's design mode on
Index: trunk/extensions/UsabilityInitiative/js/plugins.combined.js
@@ -1278,7 +1278,7 @@
12791279 break;
12801280 case 'getCaretPosition':
12811281 options = $.extend( {
1282 - 'startAndEnd': false, // Return [start, end] instead of just start
 1282+ 'startAndEnd': false // Return [start, end] instead of just start
12831283 }, options );
12841284 // FIXME: We may not need character position-based functions if we insert markers in the right places
12851285 break;
@@ -1287,7 +1287,7 @@
12881288 'start': undefined, // Position to start selection at
12891289 'end': undefined, // Position to end selection at. Defaults to start
12901290 'startContainer': undefined, // Element to start selection in (iframe only)
1291 - 'endContainer': undefined, // Element to end selection in (iframe only). Defaults to startContainer
 1291+ 'endContainer': undefined // Element to end selection in (iframe only). Defaults to startContainer
12921292 }, options );
12931293 if ( options.end === undefined )
12941294 options.end = options.start;
@@ -1816,12 +1816,12 @@
18171817 * @param endContainer Element in iframe to end selection in
18181818 */
18191819 'setSelection': function( options ) {
 1820+ var sc = options.startContainer, ec = options.endContainer;
 1821+ sc = sc.jquery ? sc[0] : sc;
 1822+ ec = ec.jquery ? ec[0] : ec;
18201823 if ( context.$iframe[0].contentWindow.getSelection ) {
18211824 // Firefox and Opera
18221825 var sel = context.$iframe[0].contentWindow.getSelection();
1823 - var sc = options.startContainer, ec = options.endContainer;
1824 - sc = sc.jquery ? sc[0] : sc;
1825 - ec = ec.jquery ? ec[0] : ec;
18261826 while ( sc.firstChild && sc.nodeName != '#text' ) {
18271827 sc = sc.firstChild;
18281828 }
@@ -1837,7 +1837,15 @@
18381838 context.$iframe[0].contentWindow.focus();
18391839 } else if ( context.$iframe[0].contentWindow.document.selection ) {
18401840 // IE
1841 - // TODO
 1841+ // FIXME still broken for when sc or ec is the <body>, needs more tweaking
 1842+ var range = document.selection.createRange();
 1843+ range.moveToElementText( sc );
 1844+ range.moveStart( 'character', options.start );
 1845+ var range2 = document.selection.createRange();
 1846+ range2.moveToElementText( ec );
 1847+ range2.moveEnd( 'character', options.end );
 1848+ range.setEndPoint( EndToEnd, range2 );
 1849+ range.select();
18421850 }
18431851 },
18441852 /**
@@ -1979,6 +1987,9 @@
19801988 } )
19811989 .insertAfter( context.$textarea )
19821990 .load( function() {
 1991+ if ( !context.$iframe[0].contentWindow.document.body ) {
 1992+ return;
 1993+ }
19831994 // Turn the document's design mode on
19841995 context.$iframe[0].contentWindow.document.designMode = 'on';
19851996 // Get a reference to the content area of the iframe
@@ -3147,8 +3158,14 @@
31483159 if ( currentField.indexOf( '=' ) == -1 ) {
31493160 // anonymous field, gets a number
31503161 valueBegin = currentField.match( /\S+/ ); //first nonwhitespace character
 3162+ if( valueBegin == null ){ //ie
 3163+ continue;
 3164+ }
31513165 valueBeginIndex = valueBegin.index + oldDivider+1;
31523166 valueEnd = currentField.match( /[^\s]\s*$/ ); //last nonwhitespace character
 3167+ if( valueEnd == null ){ //ie
 3168+ continue;
 3169+ }
31533170 valueEndIndex = valueEnd.index + oldDivider + 2;
31543171 ranges.push( new Range( ranges[ranges.length-1].end,
31553172 valueBeginIndex ) ); //all the chars upto now
@@ -3177,6 +3194,9 @@
31783195 nameBeginIndex = nameBegin.index + oldDivider + 1;
31793196 // Last nonwhitespace and non } character
31803197 nameEnd = currentName.match( /[^\s]\s*$/ );
 3198+ if( nameEnd == null ){ //ie
 3199+ continue;
 3200+ }
31813201 nameEndIndex = nameEnd.index + oldDivider + 2;
31823202 // All the chars upto now
31833203 ranges.push( new Range( ranges[ranges.length-1].end, nameBeginIndex ) );
@@ -3185,9 +3205,15 @@
31863206 oldDivider += currentField.indexOf( '=' ) + 1;
31873207 // First nonwhitespace character
31883208 valueBegin = currentValue.match( /\S+/ );
 3209+ if( valueBegin == null ){ //ie
 3210+ continue;
 3211+ }
31893212 valueBeginIndex = valueBegin.index + oldDivider + 1;
31903213 // Last nonwhitespace and non } character
31913214 valueEnd = currentValue.match( /[^\s]\s*$/ );
 3215+ if( valueEnd == null ){ //ie
 3216+ continue;
 3217+ }
31923218 valueEndIndex = valueEnd.index + oldDivider + 2;
31933219 // All the chars upto now
31943220 equalsIndex = ranges.push( new Range( ranges[ranges.length-1].end, valueBeginIndex) ) - 1;
@@ -3228,7 +3254,7 @@
32293255 // Minimum width to allow resizing to before collapsing the table of contents - used when resizing and collapsing
32303256 minimumWidth: '70px',
32313257 // Boolean var indicating text direction
3232 - rtl: false,
 3258+ rtl: false
32333259 },
32343260 /**
32353261 * API accessible functions
Index: trunk/extensions/UsabilityInitiative/js/plugins.combined.min.js
@@ -79,7 +79,7 @@
8080 return this.each(function(){if($(this).is(':hidden')){}else if(this.selectionStart||this.selectionStart=='0'){var scroll=getCaretScrollPosition(this);if(options.force||scroll<$(this).scrollTop()||scroll>$(this).scrollTop()+$(this).height())
8181 $(this).scrollTop(scroll);}else if(document.selection&&document.selection.createRange){var range=document.selection.createRange();var pos=$(this).textSelection('getCaretPosition');var oldScrollTop=this.scrollTop;range.moveToElementText(this);range.collapse();range.move('character',pos+1);range.select();if(this.scrollTop!=oldScrollTop)
8282 this.scrollTop+=range.offsetTop;else if(options.force){range.move('character',-1);range.select();}}
83 -$(this).trigger('scrollToPosition');});}};switch(command){case'encapsulateSelection':options=$.extend({'pre':'','peri':'','post':'','ownline':false,'replace':false},options);break;case'getCaretPosition':options=$.extend({'startAndEnd':false,},options);break;case'setSelection':options=$.extend({'start':undefined,'end':undefined,'startContainer':undefined,'endContainer':undefined,},options);if(options.end===undefined)
 83+$(this).trigger('scrollToPosition');});}};switch(command){case'encapsulateSelection':options=$.extend({'pre':'','peri':'','post':'','ownline':false,'replace':false},options);break;case'getCaretPosition':options=$.extend({'startAndEnd':false},options);break;case'setSelection':options=$.extend({'start':undefined,'end':undefined,'startContainer':undefined,'endContainer':undefined},options);if(options.end===undefined)
8484 options.end=options.start;if(options.endContainer==undefined)
8585 options.endContainer=options.startContainer;break;case'scrollToCaretPosition':options=$.extend({'force':false},options);break;}
8686 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;}
@@ -107,9 +107,9 @@
108108 if(range.endContainer==range.commonAncestorContainer){post+="\n";}}
109109 var insertText=pre+selText+post;var insertLines=insertText.split("\n");range.extractContents();var lastNode;for(var i=insertLines.length-1;i>=0;i--){range.insertNode(document.createTextNode(insertLines[i]));if(i>0){lastNode=range.insertNode(document.createElement('br'));}}
110110 if(lastNode){context.fn.scrollToTop(lastNode);}}else if(context.$iframe[0].contentWindow.document.selection){}
111 -context.$content.trigger('encapsulateSelection',[pre,options.peri,post,options.ownline,options.replace]);return context.$textarea;},'getCaretPosition':function(options){},'setSelection':function(options){if(context.$iframe[0].contentWindow.getSelection){var sel=context.$iframe[0].contentWindow.getSelection();var sc=options.startContainer,ec=options.endContainer;sc=sc.jquery?sc[0]:sc;ec=ec.jquery?ec[0]:ec;while(sc.firstChild&&sc.nodeName!='#text'){sc=sc.firstChild;}
 111+context.$content.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.jquery?sc[0]:sc;ec=ec.jquery?ec[0]:ec;if(context.$iframe[0].contentWindow.getSelection){var sel=context.$iframe[0].contentWindow.getSelection();while(sc.firstChild&&sc.nodeName!='#text'){sc=sc.firstChild;}
112112 while(ec.firstChild&&ec.nodeName!='#text'){ec=ec.firstChild;}
113 -var range=document.createRange();range.setStart(sc,options.start);range.setEnd(ec,options.end);sel.removeAllRanges();sel.addRange(range);context.$iframe[0].contentWindow.focus();}else if(context.$iframe[0].contentWindow.document.selection){}},'scrollToCaretPosition':function(options){},'scrollToTop':function($element,force){var html=context.$content.closest('html'),body=context.$content.closest('body');var y=$element.offset().top-context.$content.offset().top;if(force||y<html.scrollTop()||y<body.scrollTop()||y>html.scrollTop()+context.$iframe.height()||y>body.scrollTop()+context.$iframe.height()){html.scrollTop(y);body.scrollTop(y);}
 113+var range=document.createRange();range.setStart(sc,options.start);range.setEnd(ec,options.end);sel.removeAllRanges();sel.addRange(range);context.$iframe[0].contentWindow.focus();}else if(context.$iframe[0].contentWindow.document.selection){var range=document.selection.createRange();range.moveToElementText(sc);range.moveStart('character',options.start);var range2=document.selection.createRange();range2.moveToElementText(ec);range2.moveEnd('character',options.end);range.setEndPoint(EndToEnd,range2);range.select();}},'scrollToCaretPosition':function(options){},'scrollToTop':function($element,force){var html=context.$content.closest('html'),body=context.$content.closest('body');var y=$element.offset().top-context.$content.offset().top;if(force||y<html.scrollTop()||y<body.scrollTop()||y>html.scrollTop()+context.$iframe.height()||y>body.scrollTop()+context.$iframe.height()){html.scrollTop(y);body.scrollTop(y);}
114114 $element.trigger('scrollToTop');},'beforeSelection':function(selector,strict){if(typeof selector=='undefined')
115115 selector='*';var e;if(context.$iframe[0].contentWindow.getSelection){var range=context.$iframe[0].contentWindow.getSelection().getRangeAt(0);e=range.startContainer;}else if(context.$iframe[0].contentWindow.document.selection){return $([]);}
116116 if(e.nodeName!='#text'){var newE=e.firstChild;for(var i=0;i<range.startOffset-1&&newE;i++){newE=newE.nextSibling;}
@@ -118,7 +118,8 @@
119119 while(e){if($(e).is(selector)&&!strict)
120120 return $(e);var next=e.previousSibling;while(next&&next.lastChild){next=next.lastChild;}
121121 e=next||e.parentNode;strict=false;}
122 -return $([]);}};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,'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(){context.$iframe[0].contentWindow.document.designMode='on';context.$content=$(context.$iframe[0].contentWindow.document.body);context.$content.append(context.$textarea.val().replace(/</g,'&lt;').replace(/>/g,'&gt;'));if($('body').is('.rtl')){context.$content.addClass('rtl').attr('dir','rtl');}
 122+return $([]);}};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,'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(!context.$iframe[0].contentWindow.document.body){return;}
 123+context.$iframe[0].contentWindow.document.designMode='on';context.$content=$(context.$iframe[0].contentWindow.document.body);context.$content.append(context.$textarea.val().replace(/</g,'&lt;').replace(/>/g,'&gt;'));if($('body').is('.rtl')){context.$content.addClass('rtl').attr('dir','rtl');}
123124 context.$textarea.attr('disabled',true);context.$textarea.hide();context.$iframe.show();context.fn.trigger('ready');});context.$textarea.closest('form').submit(function(){context.$textarea.attr('disabled',false);context.$textarea.val(context.$textarea.textSelection('getContents'));});}
124125 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]);}}
125126 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];}
@@ -200,9 +201,14 @@
201202 var ranges=[];var params=[];var templateNameIndex=0;var doneParsing=false;oldDivider=0;divider=sanatizedStr.indexOf('|',oldDivider);if(divider==-1){divider=sanatizedStr.length;doneParsing=true;}
202203 nameMatch=wikitext.substring(0,divider).match(/[^{\s]+/);if(nameMatch!=undefined){ranges.push(new Range(0,nameMatch.index));nameEndMatch=sanatizedStr.substring(0,divider).match(/[^\s]\s*$/);templateNameIndex=ranges.push(new Range(nameMatch.index,nameEndMatch.index+1));templateNameIndex--;ranges[templateNameIndex].old=wikitext.substring(ranges[templateNameIndex].begin,ranges[templateNameIndex].end);}
203204 params.push(ranges[templateNameIndex].old);var currentParamNumber=0;var valueEndIndex;var paramsByName=[];while(!doneParsing){currentParamNumber++;oldDivider=divider;divider=sanatizedStr.indexOf('|',oldDivider+1);if(divider==-1){divider=sanatizedStr.length;doneParsing=true;}
204 -currentField=sanatizedStr.substring(oldDivider+1,divider);if(currentField.indexOf('=')==-1){valueBegin=currentField.match(/\S+/);valueBeginIndex=valueBegin.index+oldDivider+1;valueEnd=currentField.match(/[^\s]\s*$/);valueEndIndex=valueEnd.index+oldDivider+2;ranges.push(new Range(ranges[ranges.length-1].end,valueBeginIndex));nameIndex=ranges.push(new Range(valueBeginIndex,valueBeginIndex))-1;equalsIndex=ranges.push(new Range(valueBeginIndex,valueBeginIndex))-1;valueIndex=ranges.push(new Range(valueBeginIndex,valueEndIndex))-1;params.push(new Param(currentParamNumber,wikitext.substring(ranges[valueIndex].begin,ranges[valueIndex].end),currentParamNumber,nameIndex,equalsIndex,valueIndex));paramsByName[currentParamNumber]=currentParamNumber;}else{currentName=currentField.substring(0,currentField.indexOf('='));nameBegin=currentName.match(/\S+/);if(nameBegin==null){currentParamNumber--;continue;}
205 -nameBeginIndex=nameBegin.index+oldDivider+1;nameEnd=currentName.match(/[^\s]\s*$/);nameEndIndex=nameEnd.index+oldDivider+2;ranges.push(new Range(ranges[ranges.length-1].end,nameBeginIndex));nameIndex=ranges.push(new Range(nameBeginIndex,nameEndIndex))-1;currentValue=currentField.substring(currentField.indexOf('=')+1);oldDivider+=currentField.indexOf('=')+1;valueBegin=currentValue.match(/\S+/);valueBeginIndex=valueBegin.index+oldDivider+1;valueEnd=currentValue.match(/[^\s]\s*$/);valueEndIndex=valueEnd.index+oldDivider+2;equalsIndex=ranges.push(new Range(ranges[ranges.length-1].end,valueBeginIndex))-1;valueIndex=ranges.push(new Range(valueBeginIndex,valueEndIndex))-1;params.push(new Param(wikitext.substring(nameBeginIndex,nameEndIndex),wikitext.substring(valueBeginIndex,valueEndIndex),currentParamNumber,nameIndex,equalsIndex,valueIndex));paramsByName[wikitext.substring(nameBeginIndex,nameEndIndex)]=currentParamNumber;}}
206 -ranges.push(new Range(valueEndIndex,wikitext.length));this.ranges=ranges;this.wikitext=wikitext;this.params=params;this.paramsByName=paramsByName;this.templateNameIndex=templateNameIndex;}}};})(jQuery);(function($){$.wikiEditor.modules.toc={cfg:{defaultWidth:'166px',minimumWidth:'70px',rtl:false,},api:{},evt:{ready:function(context,event){$.wikiEditor.modules.toc.fn.build(context);context.$content.parent().blur(function(event){var context=event.data.context;$.wikiEditor.modules.toc.fn.unhighlight(context);});},resize:function(context,event){context.modules.toc.$toc.height(context.$ui.find('.wikiEditor-ui-left').height()-
 205+currentField=sanatizedStr.substring(oldDivider+1,divider);if(currentField.indexOf('=')==-1){valueBegin=currentField.match(/\S+/);if(valueBegin==null){continue;}
 206+valueBeginIndex=valueBegin.index+oldDivider+1;valueEnd=currentField.match(/[^\s]\s*$/);if(valueEnd==null){continue;}
 207+valueEndIndex=valueEnd.index+oldDivider+2;ranges.push(new Range(ranges[ranges.length-1].end,valueBeginIndex));nameIndex=ranges.push(new Range(valueBeginIndex,valueBeginIndex))-1;equalsIndex=ranges.push(new Range(valueBeginIndex,valueBeginIndex))-1;valueIndex=ranges.push(new Range(valueBeginIndex,valueEndIndex))-1;params.push(new Param(currentParamNumber,wikitext.substring(ranges[valueIndex].begin,ranges[valueIndex].end),currentParamNumber,nameIndex,equalsIndex,valueIndex));paramsByName[currentParamNumber]=currentParamNumber;}else{currentName=currentField.substring(0,currentField.indexOf('='));nameBegin=currentName.match(/\S+/);if(nameBegin==null){currentParamNumber--;continue;}
 208+nameBeginIndex=nameBegin.index+oldDivider+1;nameEnd=currentName.match(/[^\s]\s*$/);if(nameEnd==null){continue;}
 209+nameEndIndex=nameEnd.index+oldDivider+2;ranges.push(new Range(ranges[ranges.length-1].end,nameBeginIndex));nameIndex=ranges.push(new Range(nameBeginIndex,nameEndIndex))-1;currentValue=currentField.substring(currentField.indexOf('=')+1);oldDivider+=currentField.indexOf('=')+1;valueBegin=currentValue.match(/\S+/);if(valueBegin==null){continue;}
 210+valueBeginIndex=valueBegin.index+oldDivider+1;valueEnd=currentValue.match(/[^\s]\s*$/);if(valueEnd==null){continue;}
 211+valueEndIndex=valueEnd.index+oldDivider+2;equalsIndex=ranges.push(new Range(ranges[ranges.length-1].end,valueBeginIndex))-1;valueIndex=ranges.push(new Range(valueBeginIndex,valueEndIndex))-1;params.push(new Param(wikitext.substring(nameBeginIndex,nameEndIndex),wikitext.substring(valueBeginIndex,valueEndIndex),currentParamNumber,nameIndex,equalsIndex,valueIndex));paramsByName[wikitext.substring(nameBeginIndex,nameEndIndex)]=currentParamNumber;}}
 212+ranges.push(new Range(valueEndIndex,wikitext.length));this.ranges=ranges;this.wikitext=wikitext;this.params=params;this.paramsByName=paramsByName;this.templateNameIndex=templateNameIndex;}}};})(jQuery);(function($){$.wikiEditor.modules.toc={cfg:{defaultWidth:'166px',minimumWidth:'70px',rtl:false},api:{},evt:{ready:function(context,event){$.wikiEditor.modules.toc.fn.build(context);context.$content.parent().blur(function(event){var context=event.data.context;$.wikiEditor.modules.toc.fn.unhighlight(context);});},resize:function(context,event){context.modules.toc.$toc.height(context.$ui.find('.wikiEditor-ui-left').height()-
207213 context.$ui.find('.tab-toc').outerHeight());},mark:function(context,event){var markers=context.modules.highlight.markers;var tokenArray=context.modules.highlight.tokenArray;var outline=context.data.outline=[];var h=0;for(var i=0;i<tokenArray.length;i++){if(tokenArray[i].label!='TOC_HEADER'){continue;}
208214 h++;markers.push({index:h,start:tokenArray[i].tokenStart,end:tokenArray[i].offset,afterWrap:function(node){var marker=$(node).data('marker');$(node).addClass('wikiEditor-toc-header').addClass('wikiEditor-toc-section-'+marker.index).data('section',marker.index);},getWrapper:function(ca1,ca2){return $(ca1.parentNode).is('div.wikiEditor-toc-header')&&ca1.previousSibling==null&&ca1.nextSibling==null?ca1.parentNode:null;}});outline.push({'text':tokenArray[i].match[2],'level':tokenArray[i].match[1].length,'index':h});}
209215 $.wikiEditor.modules.toc.fn.build(context);$.wikiEditor.modules.toc.fn.update(context);}},exp:[{'regex':/^(={1,6})(.+?)\1\s*$/m,'label':'TOC_HEADER','markAfter':true}],fn:{create:function(context,config){if('$toc'in context.modules.toc){return;}

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r60812IE fixnimishg22:08, 7 January 2010

Status & tagging log