r62262 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r62261‎ | r62262 | r62263 >
Date:20:39, 10 February 2010
Author:catrope
Status:deferred
Tags:
Comment:
wmf-deployment: Merge UsabilityInitiative to trunk state
Modified paths:
  • /branches/wmf-deployment/extensions/UsabilityInitiative/ClickTracking/ClickTracking.i18n.php (modified) (history)
  • /branches/wmf-deployment/extensions/UsabilityInitiative/OptIn/OptIn.i18n.php (modified) (history)
  • /branches/wmf-deployment/extensions/UsabilityInitiative/OptIn/OptInLink.i18n.php (modified) (history)
  • /branches/wmf-deployment/extensions/UsabilityInitiative/UsabilityInitiative.hooks.php (modified) (history)
  • /branches/wmf-deployment/extensions/UsabilityInitiative/WikiEditor/Modules/Toc/Toc.i18n.php (modified) (history)
  • /branches/wmf-deployment/extensions/UsabilityInitiative/WikiEditor/Modules/Toolbar/Toolbar.i18n.php (modified) (history)
  • /branches/wmf-deployment/extensions/UsabilityInitiative/WikiEditor/Modules/Toolbar/Toolbar.js (modified) (history)
  • /branches/wmf-deployment/extensions/UsabilityInitiative/WikiEditor/WikiEditor.combined.js (modified) (history)
  • /branches/wmf-deployment/extensions/UsabilityInitiative/WikiEditor/WikiEditor.combined.min.js (modified) (history)
  • /branches/wmf-deployment/extensions/UsabilityInitiative/WikiEditor/WikiEditor.hooks.php (modified) (history)
  • /branches/wmf-deployment/extensions/UsabilityInitiative/WikiEditor/WikiEditor.i18n.php (modified) (history)
  • /branches/wmf-deployment/extensions/UsabilityInitiative/css/combined.css (modified) (history)
  • /branches/wmf-deployment/extensions/UsabilityInitiative/css/combined.min.css (modified) (history)
  • /branches/wmf-deployment/extensions/UsabilityInitiative/css/wikiEditor.css (modified) (history)
  • /branches/wmf-deployment/extensions/UsabilityInitiative/css/wikiEditor.toolbar.css (modified) (history)
  • /branches/wmf-deployment/extensions/UsabilityInitiative/js/plugins.combined.js (modified) (history)
  • /branches/wmf-deployment/extensions/UsabilityInitiative/js/plugins.combined.min.js (modified) (history)
  • /branches/wmf-deployment/extensions/UsabilityInitiative/js/plugins/jquery.wikiEditor.js (modified) (history)
  • /branches/wmf-deployment/extensions/UsabilityInitiative/js/plugins/jquery.wikiEditor.toc.js (modified) (history)
  • /branches/wmf-deployment/extensions/UsabilityInitiative/js/plugins/jquery.wikiEditor.toolbar.js (modified) (history)

Diff [purge]

Index: branches/wmf-deployment/extensions/UsabilityInitiative/WikiEditor/WikiEditor.i18n.php
@@ -15,6 +15,7 @@
1616 'wikieditor' => 'Advanced wikitext editing interface',
1717 'wikieditor-desc' => 'Provides an extendable wikitext editing interface and many feature-providing modules',
1818 'wikieditor-wikitext-tab' => 'Wikitext',
 19+ 'wikieditor-loading' => 'Loading',
1920 );
2021
2122 /** Message documentation (Message documentation)
@@ -26,6 +27,7 @@
2728
2829 I guess that 'feature-providing modules' means the same as 'modules providing features'.",
2930 'wikieditor-wikitext-tab' => 'Caption of the tab containing the edit box',
 31+ 'wikieditor-loading' => 'Explanatory text for the temporary cover placed over the wikiediort while it\'s being assembled',
3032 );
3133
3234 /** Afrikaans (Afrikaans)
Index: branches/wmf-deployment/extensions/UsabilityInitiative/WikiEditor/WikiEditor.hooks.php
@@ -16,18 +16,19 @@
1717 array( 'src' => 'Modules/Preview/Preview.js', 'version' => 6 ),
1818 array( 'src' => 'Modules/Publish/Publish.js', 'version' => 6 ),
1919 array( 'src' => 'Modules/Toc/Toc.js', 'version' => 7 ),
20 - array( 'src' => 'Modules/Toolbar/Toolbar.js', 'version' => 46 ),
 20+ array( 'src' => 'Modules/Toolbar/Toolbar.js', 'version' => 48 ),
2121 array( 'src' => 'Modules/TemplateEditor/TemplateEditor.js', 'version' => 4 ),
2222 ),
2323 'combined' => array(
24 - array( 'src' => 'WikiEditor.combined.js', 'version' => 48 ),
 24+ array( 'src' => 'WikiEditor.combined.js', 'version' => 50 ),
2525 ),
2626 'minified' => array(
27 - array( 'src' => 'WikiEditor.combined.min.js', 'version' => 48 ),
 27+ array( 'src' => 'WikiEditor.combined.min.js', 'version' => 50 ),
2828 ),
2929 );
3030 static $messages = array(
3131 'wikieditor-wikitext-tab',
 32+ 'wikieditor-loading',
3233 );
3334 static $modules = array(
3435 'global' => array(
Index: branches/wmf-deployment/extensions/UsabilityInitiative/WikiEditor/WikiEditor.combined.js
@@ -1032,26 +1032,30 @@
10331033 if ( $j( this ).val() == '' )
10341034 $j( this )
10351035 .addClass( 'wikieditor-toolbar-dialog-hint' )
1036 - .val( $j( this ).data( 'tooltip' ) );
 1036+ .val( $j( this ).data( 'tooltip' ) )
 1037+ .data( 'tooltip-mode', true );
10371038 } )
10381039 .focus( function() {
10391040 if( $j( this ).val() == $j( this ).data( 'tooltip' ) ) {
10401041 $j( this )
10411042 .val( '' )
1042 - .removeClass( 'wikieditor-toolbar-dialog-hint' );
 1043+ .removeClass( 'wikieditor-toolbar-dialog-hint' )
 1044+ .data( 'tooltip-mode', false );
10431045 }
10441046 })
10451047 .bind( 'change', function() {
10461048 if ( $j( this ).val() != $j( this ).data( 'tooltip' ) ) {
10471049 $j( this )
1048 - .removeClass( 'wikieditor-toolbar-dialog-hint' );
 1050+ .removeClass( 'wikieditor-toolbar-dialog-hint' )
 1051+ .data( 'tooltip-mode', false );
10491052 }
10501053 })
10511054 .bind( 'blur', function() {
10521055 if ( $j( this ).val() == '' ) {
10531056 $j( this )
10541057 .addClass( 'wikieditor-toolbar-dialog-hint' )
1055 - .val( $j( this ).data( 'tooltip' ) );
 1058+ .val( $j( this ).data( 'tooltip' ) )
 1059+ .data( 'tooltip-mode', true );
10561060 }
10571061 });
10581062
@@ -1209,9 +1213,9 @@
12101214 var target = $j( '#wikieditor-toolbar-link-int-target' ).val();
12111215 var text = $j( '#wikieditor-toolbar-link-int-text' ).val();
12121216 // check if the tooltips were passed as target or text
1213 - if ( target == $j( '#wikieditor-toolbar-link-int-target' ).data( 'tooltip' ) )
 1217+ if ( $j( '#wikieditor-toolbar-link-int-target' ).data( 'tooltip-mode' ) )
12141218 target = "";
1215 - if ( text == $j( '#wikieditor-toolbar-link-int-text' ).data( 'tooltip' ) )
 1219+ if ( $j( '#wikieditor-toolbar-link-int-text' ).data( 'tooltip-mode' ) )
12161220 text = "";
12171221 var u = mw.usability;
12181222 if ( target == '' ) {
@@ -1299,8 +1303,8 @@
13001304 // Pre-fill the text fields based on the current selection
13011305 var selection = $j(this).data( 'context' ).$textarea.textSelection( 'getSelection' );
13021306 $j( '#wikieditor-toolbar-link-int-target' ).focus();
1303 - // Hide any status indicators that may be visible
1304 - $j( '#wikieditor-toolbar-link-int-target-status > div:visible').hide();
 1307+ // Trigger the change event, so the link status indicator is up to date
 1308+ $j( '#wikieditor-toolbar-link-int-target' ).change();
13051309 $j( '#wikieditor-toolbar-link-dialog' ).data( 'whitespace', [ '', '' ] );
13061310 if ( selection != '' ) {
13071311 var target, text, type;
Index: branches/wmf-deployment/extensions/UsabilityInitiative/WikiEditor/WikiEditor.combined.min.js
@@ -42,7 +42,7 @@
4343 $j('#wikieditor-toolbar-link-type-int, #wikieditor-toolbar-link-type-ext').click(function(){if($j('#wikieditor-toolbar-link-type-ext').is(':checked'))
4444 updateWidget('external');if($j('#wikieditor-toolbar-link-type-int').is(':checked'))
4545 updateExistence();});var u=mw.usability;$j(this).find('[rel]').each(function(){$j(this).text(u.getMsg($j(this).attr('rel')));});$j('#wikieditor-toolbar-link-int-target').data('tooltip',u.getMsg('wikieditor-toolbar-tool-link-int-target-tooltip'));$j('#wikieditor-toolbar-link-int-text').data('tooltip',u.getMsg('wikieditor-toolbar-tool-link-int-text-tooltip'));$j('#wikieditor-toolbar-link-int-target, #wikieditor-toolbar-link-int-text').each(function(){var tooltip=u.getMsg($j(this).attr('id')+'-tooltip');if($j(this).val()=='')
46 -$j(this).addClass('wikieditor-toolbar-dialog-hint').val($j(this).data('tooltip'));}).focus(function(){if($j(this).val()==$j(this).data('tooltip')){$j(this).val('').removeClass('wikieditor-toolbar-dialog-hint');}}).bind('change',function(){if($j(this).val()!=$j(this).data('tooltip')){$j(this).removeClass('wikieditor-toolbar-dialog-hint');}}).bind('blur',function(){if($j(this).val()==''){$j(this).addClass('wikieditor-toolbar-dialog-hint').val($j(this).data('tooltip'));}});$j('#wikieditor-toolbar-link-int-target').bind('change keydown paste cut',function(){setTimeout(function(){if(isExternalLink($j('#wikieditor-toolbar-link-int-target').val()))
 46+$j(this).addClass('wikieditor-toolbar-dialog-hint').val($j(this).data('tooltip')).data('tooltip-mode',true);}).focus(function(){if($j(this).val()==$j(this).data('tooltip')){$j(this).val('').removeClass('wikieditor-toolbar-dialog-hint').data('tooltip-mode',false);}}).bind('change',function(){if($j(this).val()!=$j(this).data('tooltip')){$j(this).removeClass('wikieditor-toolbar-dialog-hint').data('tooltip-mode',false);}}).bind('blur',function(){if($j(this).val()==''){$j(this).addClass('wikieditor-toolbar-dialog-hint').val($j(this).data('tooltip')).data('tooltip-mode',true);}});$j('#wikieditor-toolbar-link-int-target').bind('change keydown paste cut',function(){setTimeout(function(){if(isExternalLink($j('#wikieditor-toolbar-link-int-target').val()))
4747 $j('#wikieditor-toolbar-link-type-ext').attr('checked','checked');else
4848 $j('#wikieditor-toolbar-link-type-int').attr('checked','checked');if($j('#wikieditor-toolbar-link-int-text').data('untouched'))
4949 if($j('#wikieditor-toolbar-link-int-target').val()==$j('#wikieditor-toolbar-link-int-target').data('tooltip')){$j('#wikieditor-toolbar-link-int-text').addClass('wikieditor-toolbar-dialog-hint').val($j('#wikieditor-toolbar-link-int-text').data('tooltip')).change();}else{$j('#wikieditor-toolbar-link-int-text').val($j('#wikieditor-toolbar-link-int-target').val()).change();}},0);});$j('#wikieditor-toolbar-link-int-text').bind('change keydown paste cut',function(){var oldVal=$j(this).val();var that=this;setTimeout(function(){if($j(that).val()!=oldVal)
@@ -54,8 +54,8 @@
5555 request.abort();}});},dialog:{width:500,dialogClass:'wikiEditor-toolbar-dialog',buttons:{'wikieditor-toolbar-tool-link-insert':function(){function escapeInternalText(s){return s.replace(/(]{2,})/g,'<nowiki>$1</nowiki>');}
5656 function escapeExternalTarget(s){return s.replace(/ /g,'%20').replace(/\[/g,'%5B').replace(/]/g,'%5D');}
5757 function escapeExternalText(s){return s.replace(/(]+)/g,'<nowiki>$1</nowiki>');}
58 -var insertText='';var whitespace=$j('#wikieditor-toolbar-link-dialog').data('whitespace');var target=$j('#wikieditor-toolbar-link-int-target').val();var text=$j('#wikieditor-toolbar-link-int-text').val();if(target==$j('#wikieditor-toolbar-link-int-target').data('tooltip'))
59 -target="";if(text==$j('#wikieditor-toolbar-link-int-text').data('tooltip'))
 58+var insertText='';var whitespace=$j('#wikieditor-toolbar-link-dialog').data('whitespace');var target=$j('#wikieditor-toolbar-link-int-target').val();var text=$j('#wikieditor-toolbar-link-int-text').val();if($j('#wikieditor-toolbar-link-int-target').data('tooltip-mode'))
 59+target="";if($j('#wikieditor-toolbar-link-int-text').data('tooltip-mode'))
6060 text="";var u=mw.usability;if(target==''){alert(u.getMsg('wikieditor-toolbar-tool-link-empty'));return;}
6161 if($j.trim(text)==''){text='';}
6262 if($j('#wikieditor-toolbar-link-type-int').is(':checked')){if($j('#wikieditor-toolbar-link-int-target-status-invalid').is(':visible')){alert(u.getMsg('wikieditor-toolbar-tool-link-int-invalid'));return;}
@@ -67,7 +67,7 @@
6868 insertText=escTarget;else if(text=='')
6969 insertText='['+escTarget+']';else
7070 insertText='['+escTarget+' '+escText+']';}
71 -if(whitespace)insertText=whitespace[0]+insertText+whitespace[1];$j.wikiEditor.modules.toolbar.fn.doAction($j(this).data('context'),{type:'replace',options:{pre:insertText}},$j(this));$j('#wikieditor-toolbar-link-int-target, #wikieditor-toolbar-link-int-text').val('');$j('#wikieditor-toolbar-link-type-int, #wikieditor-toolbar-link-type-ext').attr('checked','');$j(this).dialog('close');},'wikieditor-toolbar-tool-link-cancel':function(){$j(this).dialog('close');}},open:function(){$j(this).data('articlePathRegex',new RegExp('^'+RegExp.escape(wgServer+wgArticlePath).replace(/\\\$1/g,'(.*)')+'$'));var selection=$j(this).data('context').$textarea.textSelection('getSelection');$j('#wikieditor-toolbar-link-int-target').focus();$j('#wikieditor-toolbar-link-int-target-status > div:visible').hide();$j('#wikieditor-toolbar-link-dialog').data('whitespace',['','']);if(selection!=''){var target,text,type;var matches;if((matches=selection.match(/^(\s*)\[\[([^\]\|]+)(\|([^\]\|]*))?\]\](\s*)$/))){target=matches[2];text=(matches[4]?matches[4]:matches[2]);type='int';$j('#wikieditor-toolbar-link-dialog').data('whitespace',[matches[1],matches[5]]);}else if((matches=selection.match(/^(\s*)\[([^\] ]+)( ([^\]]+))?\](\s*)$/))){target=matches[2];text=(matches[4]?matches[4]:'');type='ext';$j('#wikieditor-toolbar-link-dialog').data('whitespace',[matches[1],matches[5]]);}else{target=text=selection;}
 71+if(whitespace)insertText=whitespace[0]+insertText+whitespace[1];$j.wikiEditor.modules.toolbar.fn.doAction($j(this).data('context'),{type:'replace',options:{pre:insertText}},$j(this));$j('#wikieditor-toolbar-link-int-target, #wikieditor-toolbar-link-int-text').val('');$j('#wikieditor-toolbar-link-type-int, #wikieditor-toolbar-link-type-ext').attr('checked','');$j(this).dialog('close');},'wikieditor-toolbar-tool-link-cancel':function(){$j(this).dialog('close');}},open:function(){$j(this).data('articlePathRegex',new RegExp('^'+RegExp.escape(wgServer+wgArticlePath).replace(/\\\$1/g,'(.*)')+'$'));var selection=$j(this).data('context').$textarea.textSelection('getSelection');$j('#wikieditor-toolbar-link-int-target').focus();$j('#wikieditor-toolbar-link-int-target').change();$j('#wikieditor-toolbar-link-dialog').data('whitespace',['','']);if(selection!=''){var target,text,type;var matches;if((matches=selection.match(/^(\s*)\[\[([^\]\|]+)(\|([^\]\|]*))?\]\](\s*)$/))){target=matches[2];text=(matches[4]?matches[4]:matches[2]);type='int';$j('#wikieditor-toolbar-link-dialog').data('whitespace',[matches[1],matches[5]]);}else if((matches=selection.match(/^(\s*)\[([^\] ]+)( ([^\]]+))?\](\s*)$/))){target=matches[2];text=(matches[4]?matches[4]:'');type='ext';$j('#wikieditor-toolbar-link-dialog').data('whitespace',[matches[1],matches[5]]);}else{target=text=selection;}
7272 if(typeof text!='undefined')
7373 $j('#wikieditor-toolbar-link-int-text').val(text).change();if(typeof target!='undefined')
7474 $j('#wikieditor-toolbar-link-int-target').val(target).change();if(typeof type!='undefined')
Index: branches/wmf-deployment/extensions/UsabilityInitiative/WikiEditor/Modules/Toolbar/Toolbar.i18n.php
@@ -2430,7 +2430,7 @@
24312431 'wikieditor-toolbar-tool-link-title' => 'Mewnosod cyswllt',
24322432 'wikieditor-toolbar-tool-link-int' => 'At dudalen wici',
24332433 'wikieditor-toolbar-tool-link-int-target' => 'Teitl y dudalen:',
2434 - 'wikieditor-toolbar-tool-link-int-target-tooltip' => 'Gosodwch deitl y dudalen',
 2434+ 'wikieditor-toolbar-tool-link-int-target-tooltip' => 'Teitl y dudalen neu ei URL',
24352435 'wikieditor-toolbar-tool-link-int-text' => 'Testun y cyswllt:',
24362436 'wikieditor-toolbar-tool-link-int-text-tooltip' => "Gosodwch yr ysgrifen a fydd i'w weld",
24372437 'wikieditor-toolbar-tool-link-ext' => 'At dudalen we allanol',
@@ -6319,7 +6319,7 @@
63206320 'wikieditor-toolbar-tool-link-title' => 'Ավելացնել հղում',
63216321 'wikieditor-toolbar-tool-link-int' => 'Վիքիի էջին',
63226322 'wikieditor-toolbar-tool-link-int-target' => 'Էջի վերնագիր․',
6323 - 'wikieditor-toolbar-tool-link-int-target-tooltip' => 'Ներմուծեք էջի վերնագիրը',
 6323+ 'wikieditor-toolbar-tool-link-int-target-tooltip' => 'Էջի վերնագիր կամ URL',
63246324 'wikieditor-toolbar-tool-link-int-text' => 'Հղման տեսքստ․',
63256325 'wikieditor-toolbar-tool-link-int-text-tooltip' => 'Ներմուծեք տեքստը, որ պետք է ցուցադրվի',
63266326 'wikieditor-toolbar-tool-link-ext' => 'Արտաքին վեբ էջին',
@@ -6424,6 +6424,8 @@
64256425 'wikieditor-toolbar-characters-page-arabic' => 'Արաբերեն',
64266426 'wikieditor-toolbar-characters-page-hebrew' => 'Եբրայերեն',
64276427 'wikieditor-toolbar-characters-page-telugu' => 'Տելուգու',
 6428+ 'wikieditor-toolbar-characters-page-sinhala' => 'Սինհալերեն',
 6429+ 'wikieditor-toolbar-characters-page-gujarati' => 'Գուջարատի',
64286430 'wikieditor-toolbar-section-help' => 'Օգնություն',
64296431 'wikieditor-toolbar-help-heading-description' => 'Նկարագրություն',
64306432 'wikieditor-toolbar-help-heading-syntax' => 'Ինչ եք հավաքում',
@@ -10273,7 +10275,7 @@
1027410276 'wikieditor-toolbar-tool-link-title' => 'Wstaw link',
1027510277 'wikieditor-toolbar-tool-link-int' => 'Do strony wiki',
1027610278 'wikieditor-toolbar-tool-link-int-target' => 'Tytuł strony –',
10277 - 'wikieditor-toolbar-tool-link-int-target-tooltip' => 'Wpisz tytuł strony',
 10279+ 'wikieditor-toolbar-tool-link-int-target-tooltip' => 'Tytuł lub adres URL strony',
1027810280 'wikieditor-toolbar-tool-link-int-text' => 'Tekst linku',
1027910281 'wikieditor-toolbar-tool-link-int-text-tooltip' => 'Wprowadź tekst, który powinien być wyświetlany',
1028010282 'wikieditor-toolbar-tool-link-ext' => 'Do zewnętrznej strony internetowej',
@@ -12850,6 +12852,7 @@
1285112853 */
1285212854 $messages['sw'] = array(
1285312855 'wikieditor-toolbar' => 'Mwambaa zana wa kuhariri',
 12856+ 'wikieditor-toolbar-preference' => 'Tumia mwambaa zana wa kuhariri uliozidishwa',
1285412857 'wikieditor-toolbar-loading' => 'Inapakizwa...',
1285512858 'wikieditor-toolbar-tool-bold' => 'Koze',
1285612859 'wikieditor-toolbar-tool-bold-example' => 'Maandishi ya kooze',
@@ -12863,7 +12866,7 @@
1286412867 'wikieditor-toolbar-tool-link-title' => 'Kuweka kiungo',
1286512868 'wikieditor-toolbar-tool-link-int' => 'Kwa ukurasa mwingine wa wiki',
1286612869 'wikieditor-toolbar-tool-link-int-target' => 'Jina la ukurasa:',
12867 - 'wikieditor-toolbar-tool-link-int-target-tooltip' => 'Andika jina la ukurasa',
 12870+ 'wikieditor-toolbar-tool-link-int-target-tooltip' => 'Andika jina la ukurasa au URL',
1286812871 'wikieditor-toolbar-tool-link-int-text' => 'Maandishi ya kiungo:',
1286912872 'wikieditor-toolbar-tool-link-int-text-tooltip' => 'Andika maandishi yatakayoonekana',
1287012873 'wikieditor-toolbar-tool-link-ext' => 'Kwa gombo wavu la nje',
@@ -12879,6 +12882,8 @@
1288012883 'wikieditor-toolbar-tool-link-int-invalid' => 'Jina la ukurasa uliloliandika ni batili.',
1288112884 'wikieditor-toolbar-tool-link-lookslikeinternal-int' => 'Kiungo cha ndani',
1288212885 'wikieditor-toolbar-tool-link-lookslikeinternal-ext' => 'Kiungo cha nje',
 12886+ 'wikieditor-toolbar-tool-link-empty' => 'Hukuandika kitu cha kuunganisha naye.',
 12887+ 'wikieditor-toolbar-tool-file' => 'Faili futike',
1288312888 'wikieditor-toolbar-tool-file-example' => 'Mfano.jpg',
1288412889 'wikieditor-toolbar-tool-reference' => 'Tiniwayo',
1288512890 'wikieditor-toolbar-tool-reference-example' => 'Weka maneno ya tiniwayo hapa',
@@ -12892,6 +12897,10 @@
1289312898 'wikieditor-toolbar-tool-heading-5' => 'Kiwango cha 5',
1289412899 'wikieditor-toolbar-tool-heading-example' => 'Maandishi ya kichwa',
1289512900 'wikieditor-toolbar-group-list' => 'Orodha',
 12901+ 'wikieditor-toolbar-tool-ulist' => 'Orodha zenye alama',
 12902+ 'wikieditor-toolbar-tool-ulist-example' => 'Aya ya orodha zenye alama',
 12903+ 'wikieditor-toolbar-tool-olist' => 'Orodha zenye namba',
 12904+ 'wikieditor-toolbar-tool-olist-example' => 'Aya ya orodha zenye namba',
1289612905 'wikieditor-toolbar-tool-indent' => 'Kijongezo',
1289712906 'wikieditor-toolbar-tool-indent-example' => 'Mstari uliojongezwa ndani',
1289812907 'wikieditor-toolbar-group-size' => 'Ukubwa',
@@ -12904,19 +12913,36 @@
1290512914 'wikieditor-toolbar-tool-subscript' => 'Herufi za chini',
1290612915 'wikieditor-toolbar-tool-subscript-example' => 'Maandishi ya chini',
1290712916 'wikieditor-toolbar-group-insert' => 'Kuweka',
 12917+ 'wikieditor-toolbar-tool-gallery' => 'Mkusanyiko wa picha',
1290812918 'wikieditor-toolbar-tool-newline' => 'Mstari mpya',
1290912919 'wikieditor-toolbar-tool-table' => 'Jedwali',
 12920+ 'wikieditor-toolbar-tool-table-example-old' => '-
 12921+! kichwa 1
 12922+! kichwa 2
 12923+! kichwa 3
 12924+|-
 12925+| mstari 1, kisanduku 1
 12926+| mstari 1, kisanduku 2
 12927+| mstari 1, kisanduku 3
 12928+|-
 12929+| mstari 2, kisanduku 1
 12930+| mstari 2, kisanduku 2
 12931+| mstari 2, kisanduku 3',
 12932+ 'wikieditor-toolbar-tool-table-example-cell-text' => 'Maandishi ya kisanduku jedwali',
1291012933 'wikieditor-toolbar-tool-table-example-header' => 'Maandiko ya kichwa',
1291112934 'wikieditor-toolbar-tool-table-title' => 'Weka jedwali',
1291212935 'wikieditor-toolbar-tool-table-dimensions-rows' => 'Mistari',
1291312936 'wikieditor-toolbar-tool-table-dimensions-columns' => 'Safu',
1291412937 'wikieditor-toolbar-tool-table-dimensions-header' => 'Weka mstari wa vichwa',
12915 - 'wikieditor-toolbar-tool-table-wikitable' => 'Mtindo unaochora mipaka',
12916 - 'wikieditor-toolbar-tool-table-sortable' => 'Uwezeshe jedwali ipangishwe',
 12938+ 'wikieditor-toolbar-tool-table-wikitable' => 'Mtindo wenye mipaka',
 12939+ 'wikieditor-toolbar-tool-table-sortable' => 'Tengeneza jedwali linalopangika',
1291712940 'wikieditor-toolbar-tool-table-example' => 'Mfano',
1291812941 'wikieditor-toolbar-tool-table-preview' => 'Hakiki',
1291912942 'wikieditor-toolbar-tool-table-insert' => 'Weka',
1292012943 'wikieditor-toolbar-tool-table-cancel' => 'Batilisha',
 12944+ 'wikieditor-toolbar-tool-table-toomany' => 'Huwezi kutengeneza jedwali yenye visanduku zaidi na $1 kwa kutumia zana hii.',
 12945+ 'wikieditor-toolbar-tool-table-invalidnumber' => 'You have not entered a valid number of rows or columns.
 12946+Idadi ya mistari au ya safu si halali.',
1292112947 'wikieditor-toolbar-tool-table-zero' => 'Huwezi kuweka jedwali ambalo halina mistari wala safu zozote.',
1292212948 'wikieditor-toolbar-tool-replace' => 'Kutafuta na kubadilisha maandishi',
1292312949 'wikieditor-toolbar-tool-replace-title' => 'Kutafuta na kubadilisha maandishi',
@@ -12944,6 +12970,7 @@
1294512971 'wikieditor-toolbar-help-heading-description' => 'Elezo',
1294612972 'wikieditor-toolbar-help-heading-syntax' => 'Ukiandika haya',
1294712973 'wikieditor-toolbar-help-heading-result' => 'Utapata huu',
 12974+ 'wikieditor-toolbar-help-page-format' => 'Kufomati',
1294812975 'wikieditor-toolbar-help-page-link' => 'Viungo',
1294912976 'wikieditor-toolbar-help-page-heading' => 'Vichwa',
1295012977 'wikieditor-toolbar-help-page-list' => 'Orodha',
@@ -12956,8 +12983,14 @@
1295712984 'wikieditor-toolbar-help-content-bold-description' => 'Koze',
1295812985 'wikieditor-toolbar-help-content-bold-syntax' => "'''Maandishi ya kooze'''",
1295912986 'wikieditor-toolbar-help-content-bold-result' => '<strong>Maandishi ya kooze</strong>',
 12987+ 'wikieditor-toolbar-help-content-bolditalic-description' => 'Koze na italiki',
 12988+ 'wikieditor-toolbar-help-content-bolditalic-syntax' => "'''''Maandishi ya koze na italiki'''''",
 12989+ 'wikieditor-toolbar-help-content-bolditalic-result' => '<strong><em>Maandishi ya koze na italiki</em></strong>',
1296012990 'wikieditor-toolbar-help-content-ilink-description' => 'Kiungo cha ndani ya wiki',
 12991+ 'wikieditor-toolbar-help-content-ilink-syntax' => '[[Jina la ukurasa|Maandishi ya kiungo]]<br />[[Jina la ukurasa]]',
 12992+ 'wikieditor-toolbar-help-content-ilink-result' => "<a href='#'>Maandishi ya kiungo</a><br /><a href='#'>Jina la ukurasa</a>",
1296112993 'wikieditor-toolbar-help-content-xlink-description' => 'Kiungo cha nje',
 12994+ 'wikieditor-toolbar-help-content-xlink-syntax' => '[http://www.example.org Maandishi ya kiungo]<br />[http://www.example.org]<br />http://www.example.org',
1296212995 'wikieditor-toolbar-help-content-heading1-description' => 'Kichwa cha kiwango cha 1',
1296312996 'wikieditor-toolbar-help-content-heading1-syntax' => '= Kichwa cha habari=',
1296412997 'wikieditor-toolbar-help-content-heading1-result' => '<h1>Kichwa cha habari</h1>',
@@ -12973,8 +13006,15 @@
1297413007 'wikieditor-toolbar-help-content-heading5-description' => 'Kichwa cha kiwango cha 5',
1297513008 'wikieditor-toolbar-help-content-heading5-syntax' => '===== Kichwa cha habari =====',
1297613009 'wikieditor-toolbar-help-content-heading5-result' => '<h5>Kichwa cha habari</h5>',
 13010+ 'wikieditor-toolbar-help-content-ulist-description' => 'Orodha zenye alama',
 13011+ 'wikieditor-toolbar-help-content-ulist-syntax' => '* Aya<br />* Aya',
 13012+ 'wikieditor-toolbar-help-content-ulist-result' => '<ul><li>Aya</li><li>Aya</li></ul>',
 13013+ 'wikieditor-toolbar-help-content-olist-description' => 'Orodha zenye namba',
 13014+ 'wikieditor-toolbar-help-content-olist-syntax' => '# Aya<br /># Aya',
 13015+ 'wikieditor-toolbar-help-content-olist-result' => '<ol><li>Aya</li><li>Aya</li></ol>',
1297713016 'wikieditor-toolbar-help-content-file-description' => 'Faili futike',
1297813017 'wikieditor-toolbar-help-content-reference-description' => 'Tiniwayo',
 13018+ 'wikieditor-toolbar-help-content-reference-syntax' => 'Maandishi ya ukurasa.&lt;ref name="mfano"&gt;[http://www.example.org Maandishi ya kiungo], maandishi mengine.&lt;/ref&gt;',
1297913019 'wikieditor-toolbar-help-content-reference-result' => "Maandiko.<sup><a href='#'>[1]</a></sup>",
1298013020 'wikieditor-toolbar-help-content-rereference-result' => "Maandiko.<sup><a href='#'>[1]</a></sup>",
1298113021 'wikieditor-toolbar-help-content-showreferences-description' => 'Onyesha tiniwayo',
@@ -14784,7 +14824,7 @@
1478514825 'wikieditor-toolbar-tool-link-title' => '插入链接',
1478614826 'wikieditor-toolbar-tool-link-int' => '链往wiki页面',
1478714827 'wikieditor-toolbar-tool-link-int-target' => '目标页面或网址:',
14788 - 'wikieditor-toolbar-tool-link-int-target-tooltip' => '输入页面标题',
 14828+ 'wikieditor-toolbar-tool-link-int-target-tooltip' => '页面标题或URL',
1478914829 'wikieditor-toolbar-tool-link-int-text' => '显示文本:',
1479014830 'wikieditor-toolbar-tool-link-int-text-tooltip' => '输入应该显示的文字',
1479114831 'wikieditor-toolbar-tool-link-ext' => '链往外部网页',
@@ -14942,7 +14982,7 @@
1494314983 'wikieditor-toolbar-help-content-file-syntax' => '[[{{ns:file}}:Example.png|thumb|标题文本]]',
1494414984 'wikieditor-toolbar-help-content-file-result' => "<div style='width:104px;' class='thumbinner'><a title='标题文本' class='image' href='#'><img height='50' width='100' border='0' class='thumbimage' src='extensions/UsabilityInitiative/images/wikiEditor/toolbar/example-image.png' alt=''/></a><div class='thumbcaption'><div class='magnify'><a title='放大' class='internal' href='#'><img height='11' width='15' alt='' src='$1/common/images/magnify-clip.png'/></a></div>标题文本</div></div>",
1494514985 'wikieditor-toolbar-help-content-reference-description' => '参考',
14946 - 'wikieditor-toolbar-help-content-reference-syntax' => '页面文本。&lt;ref name="test"&gt;[http://www.example.org 链接文本],附加文本。&lt;/ref&gt;',
 14986+ 'wikieditor-toolbar-help-content-reference-syntax' => '页面文本。&lt;ref name="测试"&gt;[http://www.example.org 链接文本],附加文本。&lt;/ref&gt;',
1494714987 'wikieditor-toolbar-help-content-reference-result' => "页面文本。<sup><a href='#'>[1]</a></sup>",
1494814988 'wikieditor-toolbar-help-content-rereference-description' => '同项参考',
1494914989 'wikieditor-toolbar-help-content-rereference-syntax' => '&lt;ref name="测试" /&gt;',
@@ -14982,7 +15022,7 @@
1498315023 'wikieditor-toolbar-tool-link-title' => '插入鏈接',
1498415024 'wikieditor-toolbar-tool-link-int' => '鏈往wiki頁面',
1498515025 'wikieditor-toolbar-tool-link-int-target' => '目標頁面或網址:',
14986 - 'wikieditor-toolbar-tool-link-int-target-tooltip' => '輸入頁面標題',
 15026+ 'wikieditor-toolbar-tool-link-int-target-tooltip' => '頁面標題或URL',
1498715027 'wikieditor-toolbar-tool-link-int-text' => '顯示文本:',
1498815028 'wikieditor-toolbar-tool-link-int-text-tooltip' => '輸入應該顯示的文字',
1498915029 'wikieditor-toolbar-tool-link-ext' => '鏈往外部網頁',
@@ -15162,7 +15202,7 @@
1516315203 'wikieditor-toolbar-help-content-file-syntax' => '[[{{ns:file}}:Example.png|thumb|標題文字]]',
1516415204 'wikieditor-toolbar-help-content-file-result' => "<div style='width:104px;' class='thumbinner'><a title='標題文字' class='image' href='#'><img height='50' width='100' border='0' class='thumbimage' src='extensions/UsabilityInitiative/images/wikiEditor/toolbar/example-image.png' alt=''/></a><div class='thumbcaption'><div class='magnify'><a title='放大' class='internal' href='#'><img height='11' width='15' alt='' src='$1/common/images/magnify-clip.png'/></a></div>標題文字</div></div>",
1516515205 'wikieditor-toolbar-help-content-reference-description' => '參考',
15166 - 'wikieditor-toolbar-help-content-reference-syntax' => '頁面文字。&lt;ref name="test"&gt;[http://www.example.org 連結文字],附加文字。&lt;/ref&gt;',
 15206+ 'wikieditor-toolbar-help-content-reference-syntax' => '頁面文字。&lt;ref name="測試"&gt;[http://www.example.org 連結文字],附加文字。&lt;/ref&gt;',
1516715207 'wikieditor-toolbar-help-content-reference-result' => "頁面文字。<sup><a href='#'>[1]</a></sup>",
1516815208 'wikieditor-toolbar-help-content-rereference-description' => '同參考附加用途',
1516915209 'wikieditor-toolbar-help-content-rereference-syntax' => '&lt;ref name="測試" /&gt;',
Index: branches/wmf-deployment/extensions/UsabilityInitiative/WikiEditor/Modules/Toolbar/Toolbar.js
@@ -983,26 +983,30 @@
984984 if ( $j( this ).val() == '' )
985985 $j( this )
986986 .addClass( 'wikieditor-toolbar-dialog-hint' )
987 - .val( $j( this ).data( 'tooltip' ) );
 987+ .val( $j( this ).data( 'tooltip' ) )
 988+ .data( 'tooltip-mode', true );
988989 } )
989990 .focus( function() {
990991 if( $j( this ).val() == $j( this ).data( 'tooltip' ) ) {
991992 $j( this )
992993 .val( '' )
993 - .removeClass( 'wikieditor-toolbar-dialog-hint' );
 994+ .removeClass( 'wikieditor-toolbar-dialog-hint' )
 995+ .data( 'tooltip-mode', false );
994996 }
995997 })
996998 .bind( 'change', function() {
997999 if ( $j( this ).val() != $j( this ).data( 'tooltip' ) ) {
9981000 $j( this )
999 - .removeClass( 'wikieditor-toolbar-dialog-hint' );
 1001+ .removeClass( 'wikieditor-toolbar-dialog-hint' )
 1002+ .data( 'tooltip-mode', false );
10001003 }
10011004 })
10021005 .bind( 'blur', function() {
10031006 if ( $j( this ).val() == '' ) {
10041007 $j( this )
10051008 .addClass( 'wikieditor-toolbar-dialog-hint' )
1006 - .val( $j( this ).data( 'tooltip' ) );
 1009+ .val( $j( this ).data( 'tooltip' ) )
 1010+ .data( 'tooltip-mode', true );
10071011 }
10081012 });
10091013
@@ -1160,9 +1164,9 @@
11611165 var target = $j( '#wikieditor-toolbar-link-int-target' ).val();
11621166 var text = $j( '#wikieditor-toolbar-link-int-text' ).val();
11631167 // check if the tooltips were passed as target or text
1164 - if ( target == $j( '#wikieditor-toolbar-link-int-target' ).data( 'tooltip' ) )
 1168+ if ( $j( '#wikieditor-toolbar-link-int-target' ).data( 'tooltip-mode' ) )
11651169 target = "";
1166 - if ( text == $j( '#wikieditor-toolbar-link-int-text' ).data( 'tooltip' ) )
 1170+ if ( $j( '#wikieditor-toolbar-link-int-text' ).data( 'tooltip-mode' ) )
11671171 text = "";
11681172 var u = mw.usability;
11691173 if ( target == '' ) {
@@ -1250,8 +1254,8 @@
12511255 // Pre-fill the text fields based on the current selection
12521256 var selection = $j(this).data( 'context' ).$textarea.textSelection( 'getSelection' );
12531257 $j( '#wikieditor-toolbar-link-int-target' ).focus();
1254 - // Hide any status indicators that may be visible
1255 - $j( '#wikieditor-toolbar-link-int-target-status > div:visible').hide();
 1258+ // Trigger the change event, so the link status indicator is up to date
 1259+ $j( '#wikieditor-toolbar-link-int-target' ).change();
12561260 $j( '#wikieditor-toolbar-link-dialog' ).data( 'whitespace', [ '', '' ] );
12571261 if ( selection != '' ) {
12581262 var target, text, type;
Index: branches/wmf-deployment/extensions/UsabilityInitiative/WikiEditor/Modules/Toc/Toc.i18n.php
@@ -135,8 +135,8 @@
136136 */
137137 $messages['de'] = array(
138138 'wikieditor-toc-preference' => 'Inhaltsverzeichnis im Bearbeiten-Fenster aktivieren',
139 - 'wikieditor-toc-show' => 'Inhalte anzeigen',
140 - 'wikieditor-toc-hide' => 'Inhalte verbergen',
 139+ 'wikieditor-toc-show' => 'Inhaltsverzeichnis einblenden',
 140+ 'wikieditor-toc-hide' => 'Inhaltsverzeichnis ausblenden',
141141 );
142142
143143 /** Zazaki (Zazaki)
Index: branches/wmf-deployment/extensions/UsabilityInitiative/js/plugins.combined.js
@@ -6738,7 +6738,7 @@
67396739 */
67406740 // Intercept all tab events to provide consisten behavior across browsers
67416741 // Webkit browsers insert tab characters by default into the iframe rather than changing input focus
6742 - case 9:
 6742+ case 9: //tab
67436743 // if any modifier keys are pressed, allow the browser to do it's thing
67446744 if ( event.ctrlKey || event.altKey || event.shiftKey ) {
67456745 return true;
@@ -6755,8 +6755,15 @@
67566756 return false;
67576757 }
67586758 break;
 6759+ case 86: //v
 6760+ if ( event.ctrlKey ){
 6761+ //paste, intercepted for IE
 6762+ context.evt.paste( event );
 6763+ }
 6764+ break;
67596765 }
67606766 return true;
 6767+
67616768 },
67626769 'change': function( event ) {
67636770 event.data.scope = 'division';
@@ -6794,6 +6801,29 @@
67956802 }
67966803 }
67976804 return true;
 6805+ },
 6806+ 'paste': function( event ) {
 6807+ context.$content.find( ':not(.wikiEditor)' ).addClass( 'wikiEditor' );
 6808+ setTimeout( function() {
 6809+ var $selection = context.$content.find( ':not(.wikiEditor)' );
 6810+ while ( $selection.length && $selection.length > 0 ) {
 6811+ var $currentElement = $selection.eq( 0 );
 6812+ while ( !$currentElement.parent().is( 'body' ) && !$currentElement.parent().is( '.wikiEditor' ) ) {
 6813+ $currentElement = $currentElement.parent();
 6814+ }
 6815+ if ( $currentElement.is( 'br' ) ) {
 6816+ $currentElement.addClass( 'wikiEditor' );
 6817+ } else {
 6818+ $( '<p></p>' )
 6819+ .text( $currentElement.text() )
 6820+ .addClass( 'wikiEditor' )
 6821+ .insertAfter( $currentElement );
 6822+ $currentElement.remove();
 6823+ }
 6824+ $selection = context.$content.find( ':not(.wikiEditor)' );
 6825+ }
 6826+ }, 0 );
 6827+ return true;
67986828 }
67996829 };
68006830
@@ -6858,6 +6888,10 @@
68596889 .addClass( context.view == options.name ? 'current' : null )
68606890 .append( $( '<a></a>' )
68616891 .attr( 'href', '#' )
 6892+ .mousedown( function() {
 6893+ // No dragging!
 6894+ return false;
 6895+ } )
68626896 .click( function( event ) {
68636897 context.$ui.find( '.wikiEditor-ui-view' ).hide();
68646898 context.$ui.find( '.' + $(this).parent().attr( 'rel' ) ).show();
@@ -6916,30 +6950,30 @@
69176951 // Converting <p>s is wrong if there's nothing before them, so check that.
69186952 // .find( '* + p' ) isn't good enough because textnodes aren't considered
69196953 $pre.find( 'p' ).each( function() {
6920 - var text = $( this ).text();
6921 - // If this <p> is preceded by some text, add a \n at the beginning, and if
6922 - // it's followed by a textnode, add a \n at the end
6923 - // We need the traverser because there can be other weird stuff in between
6924 -
6925 - // Check for preceding text
6926 - var t = new context.fn.rawTraverser( this.firstChild, 0, this, $pre.get( 0 ) ).prev();
6927 - while ( t && t.node.nodeName != '#text' && t.node.nodeName != 'BR' && t.node.nodeName != 'P' ) {
6928 - t = t.prev();
6929 - }
6930 - if ( t ) {
6931 - text = "\n" + text;
6932 - }
6933 -
6934 - // Check for following text
6935 - t = new context.fn.rawTraverser( this.lastChild, 0, this, $pre.get( 0 ) ).next();
6936 - while ( t && t.node.nodeName != '#text' && t.node.nodeName != 'BR' && t.node.nodeName != 'P' ) {
6937 - t = t.next();
6938 - }
6939 - if ( t && !t.inP && t.node.nodeName == '#text' && t.node.nodeValue.charAt( 0 ) != '\n'
6940 - && t.node.nodeValue.charAt( 0 ) != '\r' ) {
6941 - text += "\n";
6942 - }
6943 - $( this ).text( text );
 6954+ var text = $( this ).text();
 6955+ // If this <p> is preceded by some text, add a \n at the beginning, and if
 6956+ // it's followed by a textnode, add a \n at the end
 6957+ // We need the traverser because there can be other weird stuff in between
 6958+
 6959+ // Check for preceding text
 6960+ var t = new context.fn.rawTraverser( this.firstChild, 0, this, $pre.get( 0 ) ).prev();
 6961+ while ( t && t.node.nodeName != '#text' && t.node.nodeName != 'BR' && t.node.nodeName != 'P' ) {
 6962+ t = t.prev();
 6963+ }
 6964+ if ( t ) {
 6965+ text = "\n" + text;
 6966+ }
 6967+
 6968+ // Check for following text
 6969+ t = new context.fn.rawTraverser( this.lastChild, 0, this, $pre.get( 0 ) ).next();
 6970+ while ( t && t.node.nodeName != '#text' && t.node.nodeName != 'BR' && t.node.nodeName != 'P' ) {
 6971+ t = t.next();
 6972+ }
 6973+ if ( t && !t.inP && t.node.nodeName == '#text' && t.node.nodeValue.charAt( 0 ) != '\n'
 6974+ && t.node.nodeValue.charAt( 0 ) != '\r' ) {
 6975+ text += "\n";
 6976+ }
 6977+ $( this ).text( text );
69446978 } );
69456979 var retval;
69466980 if ( $.browser.msie ) {
@@ -7023,6 +7057,7 @@
70247058 var selText = $(this).textSelection( 'getSelection' );
70257059 var selTextArr;
70267060 var selectAfter = false;
 7061+ var setSelectionTo = null;
70277062 var pre = options.pre, post = options.post;
70287063 if ( !selText ) {
70297064 selText = options.peri;
@@ -7092,16 +7127,57 @@
70937128 range.extractContents();
70947129 // Insert the contents one line at a time - insertNode() inserts at the beginning, so this has to happen
70957130 // in reverse order
7096 - var lastNode;
 7131+ // Track the first and last inserted node, and if we need to also track where the text we need to select
 7132+ // afterwards starts and ends
 7133+ var firstNode = null, lastNode = null;
 7134+ var selSC = null, selEC = null, selSO = null, selEO = null, offset = 0;
70977135 for ( var i = insertLines.length - 1; i >= 0; i-- ) {
7098 - range.insertNode( context.$iframe[0].contentWindow.document.createTextNode( insertLines[i] ) );
 7136+ firstNode = context.$iframe[0].contentWindow.document.createTextNode( insertLines[i] );
 7137+ range.insertNode( firstNode );
 7138+ lastNode = lastNode || firstNode;
 7139+ var newOffset = offset + insertLines[i].length;
 7140+ if ( !selSC && pre.length < newOffset ) {
 7141+ selSC = firstNode;
 7142+ selSO = pre.length - offset;
 7143+ }
 7144+ if ( selSC && insertText.length - post.length < newOffset ) {
 7145+ selEC = firstNode;
 7146+ selEO = insertText.length - pre.length - offset;
 7147+ }
 7148+ offset = newOffset;
70997149 if ( i > 0 ) {
7100 - lastNode = range.insertNode( context.$iframe[0].contentWindow.document.createElement( 'br' ) );
 7150+ firstNode = context.$iframe[0].contentWindow.document.createElement( 'br' );
 7151+ range.insertNode( firstNode );
 7152+ newOffset = offset + 1;
 7153+ if ( !selSC && pre.length < newOffset ) {
 7154+ selSC = firstNode;
 7155+ selSO = pre.length - offset;
 7156+ }
 7157+ if ( selSC && insertText.length - post.length < newOffset ) {
 7158+ selEC = firstNode;
 7159+ selEO = insertText.length - pre.length - offset;
 7160+ }
 7161+ offset = newOffset;
71017162 }
71027163 }
7103 - if ( lastNode ) {
7104 - context.fn.scrollToTop( lastNode );
 7164+ if ( firstNode ) {
 7165+ context.fn.scrollToTop( $( firstNode.parentNode ) );
71057166 }
 7167+ if ( selectAfter ) {
 7168+ setSelectionTo = {
 7169+ startContainer: selSC,
 7170+ endContainer: selEC,
 7171+ start: selSO,
 7172+ end: selEO
 7173+ };
 7174+ } else if ( lastNode ) {
 7175+ setSelectionTo = {
 7176+ startContainer: lastNode,
 7177+ endContainer: lastNode,
 7178+ start: lastNode.nodeValue.length,
 7179+ end: lastNode.nodeValue.length
 7180+ };
 7181+ }
71067182 } else if ( context.$iframe[0].contentWindow.document.selection ) {
71077183 // IE
71087184 context.$iframe[0].contentWindow.focus();
@@ -7144,7 +7220,16 @@
71457221 .replace( />/g, '&gt;' )
71467222 .replace( /\r?\n/g, '<br />' )
71477223 );
 7224+ if ( selectAfter ) {
 7225+ range.moveStart( 'character', -post.length - selText.length );
 7226+ range.moveEnd( 'character', -post.length );
 7227+ range.select();
 7228+ }
71487229 }
 7230+
 7231+ if ( setSelectionTo ) {
 7232+ context.fn.setSelection( setSelectionTo );
 7233+ }
71497234 // Trigger the encapsulateSelection event (this might need to get named something else/done differently)
71507235 $( context.$iframe[0].contentWindow.document ).trigger(
71517236 'encapsulateSelection', [ pre, options.peri, post, options.ownline, options.replace ]
@@ -7573,13 +7658,20 @@
75747659 * as a response to the "resize" event.
75757660 */
75767661
 7662+ // Assemble a temporary div to place over the wikiEditor while it's being constructed
 7663+ var $loader = $( '<div></div>' )
 7664+ .addClass( 'wikiEditor-ui-loading' )
 7665+ .append( $( '<span>' + mw.usability.getMsg( 'wikieditor-loading' ) + '</span>' )
 7666+ .css( 'marginTop', context.$textarea.height() / 2 ) );
75777667 // Encapsulate the textarea with some containers for layout
75787668 context.$textarea
7579 - .wrap( $( '<div></div>' ).addClass( 'wikiEditor-ui' ) )
7580 - .wrap( $( '<div></div>' ).addClass( 'wikiEditor-ui-view wikiEditor-ui-view-wikitext' ) )
7581 - .wrap( $( '<div></div>' ).addClass( 'wikiEditor-ui-left' ) )
7582 - .wrap( $( '<div></div>' ).addClass( 'wikiEditor-ui-bottom' ) )
7583 - .wrap( $( '<div></div>' ).addClass( 'wikiEditor-ui-text' ) );
 7669+ .after( $loader )
 7670+ .add( $loader )
 7671+ .wrapAll( $( '<div></div>' ).addClass( 'wikiEditor-ui' ) )
 7672+ .wrapAll( $( '<div></div>' ).addClass( 'wikiEditor-ui-view wikiEditor-ui-view-wikitext' ) )
 7673+ .wrapAll( $( '<div></div>' ).addClass( 'wikiEditor-ui-left' ) )
 7674+ .wrapAll( $( '<div></div>' ).addClass( 'wikiEditor-ui-bottom' ) )
 7675+ .wrapAll( $( '<div></div>' ).addClass( 'wikiEditor-ui-text' ) );
75847676 // Get references to some of the newly created containers
75857677 context.$ui = context.$textarea.parent().parent().parent().parent().parent();
75867678 context.$wikitext = context.$textarea.parent().parent().parent().parent();
@@ -7667,11 +7759,11 @@
76687760 // We also need to unescape the doubly-escaped things mentioned above
76697761 html = $( '<div />' ).text( '<p>' + html.replace( /\r?\n/g, '</p><p>' ) + '</p>' ).html()
76707762 .replace( /&amp;nbsp;/g, '&nbsp;' )
7671 - // Allow p tags to survive encoding
 7763+ // Allow <p> tags to survive encoding
76727764 .replace( /&lt;p&gt;/g, '<p>' )
76737765 .replace( /&lt;\/p&gt;/g, '</p>' )
7674 - // Empty p tags should just be br tags
7675 - .replace( /<p><\/p>/g, '<br>' )
 7766+ // Empty <p> tags need <br> tags in them
 7767+ .replace( /<p><\/p>/g, '<p><br></p>' )
76767768 // Unescape &esc; stuff
76777769 .replace( /&amp;esc;&amp;amp;nbsp;/g, '&amp;nbsp;' )
76787770 .replace( /&amp;esc;&amp;lt;p&amp;gt;/g, '&lt;p&gt;' )
@@ -7693,15 +7785,22 @@
76947786 context.$iframe.show();
76957787 // Let modules know we're ready to start working with the content
76967788 context.fn.trigger( 'ready' );
 7789+ //remove our temporary loading
 7790+ $( '.wikiEditor-ui-loading' ).fadeOut( 'fast', function() {
 7791+ $( this ).remove();
 7792+ } );
76977793 // Setup event handling on the iframe
76987794 $( context.$iframe[0].contentWindow.document )
76997795 .bind( 'keydown', function( event ) {
77007796 return context.fn.trigger( 'keydown', event );
77017797 } )
7702 - .bind( 'keyup mouseup paste cut encapsulateSelection', function( event ) {
 7798+ .bind( 'paste', function( event ) {
 7799+ return context.fn.trigger( 'paste', event );
 7800+ } )
 7801+ .bind( 'keyup paste mouseup cut encapsulateSelection', function( event ) {
77037802 return context.fn.trigger( 'change', event );
77047803 } )
7705 - .delayedBind( 250, 'keyup mouseup paste cut encapsulateSelection', function( event ) {
 7804+ .delayedBind( 250, 'keyup paste mouseup cut encapsulateSelection', function( event ) {
77067805 context.fn.trigger( 'delayedChange', event );
77077806 } );
77087807 } );
@@ -9139,6 +9238,8 @@
91409239 minimumWidth: '70px',
91419240 // Minimum width of the wikiText area
91429241 textMinimumWidth: '450px',
 9242+ // The style property to be used for positioning the flexible module in regular mode
 9243+ flexProperty: 'marginRight',
91439244 // Boolean var indicating text direction
91449245 rtl: false
91459246 },
@@ -9271,7 +9372,7 @@
92729373 return;
92739374 }
92749375 $.wikiEditor.modules.toc.cfg.rtl = config.rtl;
9275 -
 9376+ $.wikiEditor.modules.toc.cfg.flexProperty = config.rtl ? 'marginLeft' : 'marginRight';
92769377 var height = context.$ui.find( '.wikiEditor-ui-left' ).height();
92779378 context.modules.toc.$toc = $( '<div />' )
92789379 .addClass( 'wikiEditor-ui-toc' )
@@ -9293,9 +9394,9 @@
92949395 context.$ui.find( '.wikiEditor-ui-right' )
92959396 .css( 'width', fixedWidth + 'px' );
92969397 context.$ui.find( '.wikiEditor-ui-left' )
9297 - .css( 'marginRight', ( -1 * fixedWidth ) + 'px' )
 9398+ .css( $.wikiEditor.modules.toc.cfg.flexProperty, ( -1 * fixedWidth ) + 'px' )
92989399 .children()
9299 - .css( 'marginRight', fixedWidth + 'px' );
 9400+ .css( $.wikiEditor.modules.toc.cfg.flexProperty, fixedWidth + 'px' );
93009401 } else if( context.modules.toc.$toc.data( 'positionMode' ) == 'goofy' ) {
93019402 context.$ui.find( '.wikiEditor-ui-left' )
93029403 .css( 'width', fixedWidth );
@@ -9317,11 +9418,12 @@
93189419 width = $.wikiEditor.modules.toc.cfg.textMinimumWidth;
93199420 // set our styles for goofy mode
93209421 context.$ui.find( '.wikiEditor-ui-left' )
9321 - .css( { 'marginRight': '', 'position': 'absolute', 'float': 'none',
 9422+ .css( $.wikiEditor.modules.toc.cfg.flexProperty, '')
 9423+ .css( { 'position': 'absolute', 'float': 'none',
93229424 'left': $.wikiEditor.modules.toc.cfg.rtl ? 'auto': 0,
93239425 'right' : $.wikiEditor.modules.toc.cfg.rtl ? 0 : 'auto' } )
93249426 .children()
9325 - .css( 'marginRight', '' );
 9427+ .css( $.wikiEditor.modules.toc.cfg.flexProperty, '' );
93269428 context.$ui.find( '.wikiEditor-ui-right' )
93279429 .css( { 'width': 'auto', 'position': 'absolute', 'float': 'none',
93289430 'right': $.wikiEditor.modules.toc.cfg.rtl ? 'auto': 0,
@@ -9340,7 +9442,8 @@
93419443 context.$wikitext
93429444 .css( { 'position': '', 'height': '' } );
93439445 context.$ui.find( '.wikiEditor-ui-right' )
9344 - .css( { 'marginRight': '', 'position': '', 'left': '', 'right': '', 'float': '', 'top': '', 'height': '' } );
 9446+ .css( $.wikiEditor.modules.toc.cfg.flexProperty, '' )
 9447+ .css( { 'position': '', 'left': '', 'right': '', 'float': '', 'top': '', 'height': '' } );
93459448 context.$ui.find( '.wikiEditor-ui-left' )
93469449 .css( { 'width': '', 'position': '', 'left': '', 'float': '', 'right': '' } );
93479450 }
@@ -9355,9 +9458,9 @@
93569459 }
93579460 context.$ui.find( '.wikiEditor-ui-right' ).hide();
93589461 context.$ui.find( '.wikiEditor-ui-left' )
9359 - .css( 'marginRight', '' )
 9462+ .css( $.wikiEditor.modules.toc.cfg.flexProperty, '' )
93609463 .children()
9361 - .css( 'marginRight', '' );
 9464+ .css( $.wikiEditor.modules.toc.cfg.flexProperty, '' );
93629465 }
93639466 context.modules.toc.$toc.data( 'positionMode', 'disabled' );
93649467 },
@@ -9424,13 +9527,16 @@
94259528 }
94269529 var pT = $this.parent().position().top - 1;
94279530 context.modules.toc.$toc.data( 'collapsed', true );
 9531+ var leftParam = {}, leftChildParam = {};
 9532+ leftParam[ $.wikiEditor.modules.toc.cfg.flexProperty ] = '-1px';
 9533+ leftChildParam[ $.wikiEditor.modules.toc.cfg.flexProperty ] = '1px';
94289534 context.$ui.find( '.wikiEditor-ui-left' )
9429 - .animate( { 'marginRight': '-1px' }, 'fast', function() {
9430 - $( this ).css( 'marginRight', 0 );
 9535+ .animate( leftParam, 'fast', function() {
 9536+ $( this ).css( $.wikiEditor.modules.toc.cfg.flexProperty, 0 );
94319537 } )
94329538 .children()
9433 - .animate( { 'marginRight': '1px' }, 'fast', function() {
9434 - $( this ).css( 'marginRight', 0 );
 9539+ .animate( leftChildParam, 'fast', function() {
 9540+ $( this ).css( $.wikiEditor.modules.toc.cfg.flexProperty, 0 );
94359541 } );
94369542 context.$ui.find( '.wikiEditor-ui-right' )
94379543 .css( {
@@ -9467,10 +9573,13 @@
94689574 // check if we've got enough room to open to our stored width
94699575 if ( availableSpace < openWidth ) openWidth = availableSpace;
94709576 context.$ui.find( '.wikiEditor-ui-toc-expandControl' ).hide();
 9577+ var leftParam = {}, leftChildParam = {};
 9578+ leftParam[ $.wikiEditor.modules.toc.cfg.flexProperty ] = parseFloat( openWidth ) * -1;
 9579+ leftChildParam[ $.wikiEditor.modules.toc.cfg.flexProperty ] = openWidth;
94719580 context.$ui.find( '.wikiEditor-ui-left' )
9472 - .animate( { 'marginRight': ( parseFloat( openWidth ) * -1 ) }, 'fast' )
 9581+ .animate( leftParam, 'fast' )
94739582 .children()
9474 - .animate( { 'marginRight': openWidth }, 'fast' );
 9583+ .animate( leftChildParam, 'fast' );
94759584 context.$ui.find( '.wikiEditor-ui-right' )
94769585 .show()
94779586 .css( 'marginTop', '1px' )
@@ -9528,6 +9637,10 @@
95299638 var div = $( '<div />' )
95309639 .addClass( 'section-' + structure[i].index )
95319640 .data( 'index', structure[i].index )
 9641+ .mousedown( function() {
 9642+ // No dragging!
 9643+ return false;
 9644+ } )
95329645 .click( function( event ) {
95339646 var wrapper = context.$content.find(
95349647 '.wikiEditor-toc-section-' + $( this ).data( 'index' ) );
@@ -9567,6 +9680,10 @@
95689681 .addClass( 'tab' )
95699682 .addClass( 'tab-toc' )
95709683 .append( '<a href="#" />' )
 9684+ .mousedown( function() {
 9685+ // No dragging!
 9686+ return false;
 9687+ } )
95719688 .bind( 'click.wikiEditor-toc', function() {
95729689 context.modules.toc.$toc.trigger( 'collapse.wikiEditor-toc' ); return false;
95739690 } )
@@ -9575,6 +9692,10 @@
95769693 $expandControl
95779694 .addClass( 'wikiEditor-ui-toc-expandControl' )
95789695 .append( '<a href="#" />' )
 9696+ .mousedown( function() {
 9697+ // No dragging!
 9698+ return false;
 9699+ } )
95799700 .bind( 'click.wikiEditor-toc', function() {
95809701 context.modules.toc.$toc.trigger( 'expand.wikiEditor-toc' ); return false;
95819702 } )
@@ -9620,8 +9741,9 @@
96219742 // for some odd reason, ui.size.width seems a step ahead of what the *actual* width of
96229743 // the resizable is
96239744 $( this ).css( { 'width': ui.size.width, 'top': 'auto', 'height': 'auto' } )
9624 - .data( 'wikiEditor-ui-left' ).css( 'marginRight', ( -1 * ui.size.width ) )
9625 - .children().css( 'marginRight', ui.size.width );
 9745+ .data( 'wikiEditor-ui-left' )
 9746+ .css( $.wikiEditor.modules.toc.cfg.flexProperty, ( -1 * ui.size.width ) )
 9747+ .children().css( $.wikiEditor.modules.toc.cfg.flexProperty, ui.size.width );
96269748 // Let the UI know things have moved around
96279749 context.fn.trigger( 'resize' );
96289750 },
@@ -10025,6 +10147,10 @@
1002610148 $button
1002710149 .data( 'action', tool.action )
1002810150 .data( 'context', context )
 10151+ .mousedown( function() {
 10152+ // No dragging!
 10153+ return false;
 10154+ } )
1002910155 .click( function() {
1003010156 $.wikiEditor.modules.toolbar.fn.doAction(
1003110157 $(this).data( 'context' ), $(this).data( 'action' ), $(this)
@@ -10044,6 +10170,10 @@
1004510171 $( '<a />' )
1004610172 .data( 'action', tool.list[option].action )
1004710173 .data( 'context', context )
 10174+ .mousedown( function() {
 10175+ // No dragging!
 10176+ return false;
 10177+ } )
1004810178 .click( function() {
1004910179 $.wikiEditor.modules.toolbar.fn.doAction(
1005010180 $(this).data( 'context' ), $(this).data( 'action' ), $(this)
@@ -10068,6 +10198,10 @@
1006910199 .text( label )
1007010200 .data( 'options', $options )
1007110201 .attr( 'href', '#' )
 10202+ .mousedown( function() {
 10203+ // No dragging!
 10204+ return false;
 10205+ } )
1007210206 .click( function() {
1007310207 $(this).data( 'options' ).animate( { 'opacity': 'toggle' }, 'fast' );
1007410208 return false;
@@ -10085,23 +10219,27 @@
1008610220 .text( label )
1008710221 .attr( 'rel', id )
1008810222 .data( 'context', context )
10089 - .bind( 'mousedown', function() {
 10223+ .mousedown( function() {
 10224+ // No dragging!
 10225+ return false;
 10226+ } )
 10227+ .click( function( event ) {
1009010228 $(this).parent().parent().find( '.page' ).hide();
1009110229 $(this).parent().parent().find( '.page-' + $(this).attr( 'rel' ) ).show();
1009210230 $(this).siblings().removeClass( 'current' );
1009310231 $(this).addClass( 'current' );
1009410232 var section = $(this).parent().parent().attr( 'rel' );
10095 -
10096 - //click tracking
10097 - if($.trackAction != undefined){
10098 - $.trackAction(section + '.' + $(this).attr('rel'));
10099 - }
10100 -
1010110233 $.cookie(
1010210234 'wikiEditor-' + $(this).data( 'context' ).instance + '-booklet-' + section + '-page',
1010310235 $(this).attr( 'rel' )
1010410236 );
10105 - } );
 10237+ // Click tracking
 10238+ if($.trackAction != undefined){
 10239+ $.trackAction(section + '.' + $(this).attr('rel'));
 10240+ }
 10241+ // No dragging!
 10242+ return false;
 10243+ } )
1010610244 },
1010710245 buildPage : function( context, id, page ) {
1010810246 var $page = $( '<div />' ).attr( {
@@ -10141,6 +10279,10 @@
1014210280 $characters
1014310281 .html( html )
1014410282 .children()
 10283+ .mousedown( function() {
 10284+ // No dragging!
 10285+ return false;
 10286+ } )
1014510287 .click( function() {
1014610288 $.wikiEditor.modules.toolbar.fn.doAction(
1014710289 $(this).parent().data( 'context' ),
@@ -10208,10 +10350,14 @@
1020910351 .attr( 'href', '#' )
1021010352 .text( $.wikiEditor.autoMsg( section, 'label' ) )
1021110353 .data( 'context', context )
10212 - .bind( 'mouseup', function( e ) {
 10354+ .mouseup( function( e ) {
1021310355 $(this).blur();
1021410356 } )
10215 - .bind( 'click', function( e ) {
 10357+ .mousedown( function() {
 10358+ // No dragging!
 10359+ return false;
 10360+ } )
 10361+ .click( function( e ) {
1021610362 var $sections = $(this).data( 'context' ).$ui.find( '.sections' );
1021710363 var $section =
1021810364 $(this).data( 'context' ).$ui.find( '.section-' + $(this).parent().attr( 'rel' ) );
Index: branches/wmf-deployment/extensions/UsabilityInitiative/js/plugins.combined.min.js
@@ -446,16 +446,19 @@
447447 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];}}}
448448 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={'keydown':function(event){switch(event.which){case 9:if(event.ctrlKey||event.altKey||event.shiftKey){return true;}else{var $tabindexList=$j('[tabindex]:visible').sort(function(a,b){return a.tabIndex-b.tabIndex;});for(var i=0;i<$tabindexList.length;i++){if($tabindexList.eq(i).attr('id')==context.$iframe.attr('id')){$tabindexList.get(i+1).focus();break;}}
449449 return false;}
 450+break;case 86:if(event.ctrlKey){context.evt.paste(event);}
450451 break;}
451452 return true;},'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';}
452453 switch(event.which){case 8:break;}
453454 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';if(newHTML!==context.history[context.history.length+context.historyPosition].html){context.historyPosition=-1;}
454455 context.history.push({'html':newHTML});while(context.history.length>10){context.history.shift();}}
455 -return true;}};context.fn={'trigger':function(name,event){if(typeof event=='undefined'){event={'type':'custom'};}
 456+return true;},'paste':function(event){context.$content.find(':not(.wikiEditor)').addClass('wikiEditor');setTimeout(function(){var $selection=context.$content.find(':not(.wikiEditor)');while($selection.length&&$selection.length>0){var $currentElement=$selection.eq(0);while(!$currentElement.parent().is('body')&&!$currentElement.parent().is('.wikiEditor')){$currentElement=$currentElement.parent();}
 457+if($currentElement.is('br')){$currentElement.addClass('wikiEditor');}else{$('<p></p>').text($currentElement.text()).addClass('wikiEditor').insertAfter($currentElement);$currentElement.remove();}
 458+$selection=context.$content.find(':not(.wikiEditor)');}},0);return true;}};context.fn={'trigger':function(name,event){if(typeof event=='undefined'){event={'type':'custom'};}
456459 if(typeof event.data=='undefined'){event.data={};}
457460 if(name in context.evt){if(!context.evt[name](event)){return false;}}
458461 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);}}
459 -return true;},'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);}
 462+return true;},'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','#').mousedown(function(){return false;}).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);}
460463 event.preventDefault();return false;}).text($.wikiEditor.autoMsg(options,'title'))).appendTo(context.$tabs);}
461464 if(!context.$tabs.children().size()){addTab({'name':'wikitext','titleMsg':'wikieditor-wikitext-tab'});}
462465 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];}
@@ -467,18 +470,24 @@
468471 return context.htmlToTextMap[origHTML]=leading+retval+trailing;},'getContents':function(){var html;if($.browser.msie){var $c=$(context.$content.get(0).cloneNode(true));$c.find('p').each(function(){if($(this).html()==''){$(this).replaceWith('<p></p>');}});html=$c.html();}else{html=context.$content.html();}
469472 return context.fn.htmlToText(html);},'getSelection':function(){var retval;if(context.$iframe[0].contentWindow.getSelection){retval=context.$iframe[0].contentWindow.getSelection();if($.browser.opera){if(retval.rangeCount>0){retval=context.fn.htmlToText($('<pre />').append(retval.getRangeAt(0).cloneContents()).html());}else{retval='';}}}else if(context.$iframe[0].contentWindow.document.selection){retval=context.$iframe[0].contentWindow.document.selection.createRange();}
470473 if(typeof retval.text!='undefined'){retval=context.fn.htmlToText(retval.htmlText);}else if(typeof retval.toString!='undefined'){retval=retval.toString();}
471 -return retval;},'encapsulateSelection':function(options){var selText=$(this).textSelection('getSelection');var selTextArr;var selectAfter=false;var pre=options.pre,post=options.post;if(!selText){selText=options.peri;selectAfter=true;}else if(options.replace){selText=options.peri;}else if(selText.charAt(selText.length-1)==' '){selText=selText.substring(0,selText.length-1);post+=' ';}
 474+return retval;},'encapsulateSelection':function(options){var selText=$(this).textSelection('getSelection');var selTextArr;var selectAfter=false;var setSelectionTo=null;var pre=options.pre,post=options.post;if(!selText){selText=options.peri;selectAfter=true;}else if(options.replace){selText=options.peri;}else if(selText.charAt(selText.length-1)==' '){selText=selText.substring(0,selText.length-1);post+=' ';}
472475 if(options.splitlines){selTextArr=selText.split(/\n/);}
473476 if(context.$iframe[0].contentWindow.getSelection){var range=context.$iframe[0].contentWindow.getSelection().getRangeAt(0);if(options.ownline){var atStart=false,atEnd=false;var body=context.$content.get(0);if(range.startOffset==0){atStart=true;}else if(range.startContainer==body){var n=body.firstChild;for(var i=0;i<range.startOffset-1&&n;i++){n=n.nextSibling;}
474477 if(n&&n.nodeName=='BR'){atStart=true;}else{atEnd=true;}}else if(range.startContainer.nodeName=='#text'&&range.startOffset==range.startContainer.nodeValue.length){atEnd=true;}
475478 if(!atStart){pre="\n"+options.pre;}
476479 if(!atEnd){post+="\n";}}
477480 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;}
478 -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'));}}
479 -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;}
 481+var insertLines=insertText.split("\n");range.extractContents();var firstNode=null,lastNode=null;var selSC=null,selEC=null,selSO=null,selEO=null,offset=0;for(var i=insertLines.length-1;i>=0;i--){firstNode=context.$iframe[0].contentWindow.document.createTextNode(insertLines[i]);range.insertNode(firstNode);lastNode=lastNode||firstNode;var newOffset=offset+insertLines[i].length;if(!selSC&&pre.length<newOffset){selSC=firstNode;selSO=pre.length-offset;}
 482+if(selSC&&insertText.length-post.length<newOffset){selEC=firstNode;selEO=insertText.length-pre.length-offset;}
 483+offset=newOffset;if(i>0){firstNode=context.$iframe[0].contentWindow.document.createElement('br');range.insertNode(firstNode);newOffset=offset+1;if(!selSC&&pre.length<newOffset){selSC=firstNode;selSO=pre.length-offset;}
 484+if(selSC&&insertText.length-post.length<newOffset){selEC=firstNode;selEO=insertText.length-pre.length-offset;}
 485+offset=newOffset;}}
 486+if(firstNode){context.fn.scrollToTop($(firstNode.parentNode));}
 487+if(selectAfter){setSelectionTo={startContainer:selSC,endContainer:selEC,start:selSO,end:selEO};}else if(lastNode){setSelectionTo={startContainer:lastNode,endContainer:lastNode,start:lastNode.nodeValue.length,end:lastNode.nodeValue.length};}}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;}
480488 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";}}
481489 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;}
482 -range.pasteHTML(insertText.replace(/\</g,'&lt;').replace(/>/g,'&gt;').replace(/\r?\n/g,'<br />'));}
 490+range.pasteHTML(insertText.replace(/\</g,'&lt;').replace(/>/g,'&gt;').replace(/\r?\n/g,'<br />'));if(selectAfter){range.moveStart('character',-post.length-selText.length);range.moveEnd('character',-post.length);range.select();}}
 491+if(setSelectionTo){context.fn.setSelection(setSelectionTo);}
483492 $(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;}
484493 if(!sc||!ec){return context.$textarea;}
485494 var sel=context.$iframe[0].contentWindow.getSelection();while(sc.firstChild&&sc.nodeName!='#text'){sc=sc.firstChild;}
@@ -522,10 +531,10 @@
523532 pos=nextPos+(leavingP?1:0);if(t.node.nodeName=='#text'){lastTextNode=t.node;lastTextNodeDepth=t.depth;}
524533 t=nextT;}},'saveSelection':function(){if(!$.browser.msie){return;}
525534 context.$iframe[0].contentWindow.focus();context.savedSelection=context.$iframe[0].contentWindow.document.selection.createRange();},'restoreSelection':function(){if(!$.browser.msie||context.savedSelection===null){return;}
526 -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;}}
 535+context.$iframe[0].contentWindow.focus();context.savedSelection.select();context.savedSelection=null;}};var $loader=$('<div></div>').addClass('wikiEditor-ui-loading').append($('<span>'+mw.usability.getMsg('wikieditor-loading')+'</span>').css('marginTop',context.$textarea.height()/2));context.$textarea.after($loader).add($loader).wrapAll($('<div></div>').addClass('wikiEditor-ui')).wrapAll($('<div></div>').addClass('wikiEditor-ui-view wikiEditor-ui-view-wikitext')).wrapAll($('<div></div>').addClass('wikiEditor-ui-left')).wrapAll($('<div></div>').addClass('wikiEditor-ui-bottom')).wrapAll($('<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;}}
527536 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;");}}
528 -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');}
529 -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();}};}
 537+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,'<p><br></p>').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');}
 538+context.$textarea.attr('disabled',true);context.$textarea.hide();context.$iframe.show();context.fn.trigger('ready');$('.wikiEditor-ui-loading').fadeOut('fast',function(){$(this).remove();});$(context.$iframe[0].contentWindow.document).bind('keydown',function(event){return context.fn.trigger('keydown',event);}).bind('paste',function(event){return context.fn.trigger('paste',event);}).bind('keyup paste mouseup cut encapsulateSelection',function(event){return context.fn.trigger('change',event);}).delayedBind(250,'keyup paste mouseup 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();}};}
530539 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]);}}
531540 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];}
532541 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)
@@ -623,7 +632,7 @@
624633 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;}
625634 valueBeginIndex=valueBegin.index+oldDivider+1;valueEnd=currentValue.match(/[^\s]\s*$/);if(valueEnd==null){continue;}
626635 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;}}
627 -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',textMinimumWidth:'450px',rtl:false},api:{},evt:{change:function(context,event){$.wikiEditor.modules.toc.fn.update(context);},ready:function(context,event){$.wikiEditor.modules.toc.fn.build(context);context.$content.parent().blur(function(){var context=event.data.context;$.wikiEditor.modules.toc.fn.unhighlight(context);});$.wikiEditor.modules.toc.evt.resize(context);},resize:function(context,event){var availableWidth=context.$wikitext.width()-parseFloat($.wikiEditor.modules.toc.cfg.textMinimumWidth),totalMinWidth=parseFloat($.wikiEditor.modules.toc.cfg.minimumWidth)+
 636+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',textMinimumWidth:'450px',flexProperty:'marginRight',rtl:false},api:{},evt:{change:function(context,event){$.wikiEditor.modules.toc.fn.update(context);},ready:function(context,event){$.wikiEditor.modules.toc.fn.build(context);context.$content.parent().blur(function(){var context=event.data.context;$.wikiEditor.modules.toc.fn.unhighlight(context);});$.wikiEditor.modules.toc.evt.resize(context);},resize:function(context,event){var availableWidth=context.$wikitext.width()-parseFloat($.wikiEditor.modules.toc.cfg.textMinimumWidth),totalMinWidth=parseFloat($.wikiEditor.modules.toc.cfg.minimumWidth)+
628637 parseFloat($.wikiEditor.modules.toc.cfg.textMinimumWidth);context.$ui.find('.wikiEditor-ui-right').resizable('option','maxWidth',availableWidth);if(context.modules.toc.$toc.data('positionMode')!='disabled'&&context.$wikitext.width()<totalMinWidth){$.wikiEditor.modules.toc.fn.disable(context);}else if(context.modules.toc.$toc.data('positionMode')=='disabled'&&context.$wikitext.width()>totalMinWidth){$.wikiEditor.modules.toc.fn.enable(context);}else if(context.modules.toc.$toc.data('positionMode')=='regular'&&context.$ui.find('.wikiEditor-ui-right').width()>availableWidth){$.wikiEditor.modules.toc.fn.switchLayout(context);}else if(context.modules.toc.$toc.data('positionMode')=='goofy'&&context.modules.toc.$toc.data('previousWidth')<context.$wikitext.width()){$.wikiEditor.modules.toc.fn.switchLayout(context);}
629638 if(context.modules.toc.$toc.data('positionMode')=='goofy'){context.modules.toc.$toc.find('div').autoEllipsis({'position':'right','tooltip':true,'restoreText':true});}
630639 if(!context.modules.toc.$toc.data('collapsed')){context.modules.toc.$toc.height(context.$ui.find('.wikiEditor-ui-left').height()-
@@ -631,26 +640,26 @@
632641 context.modules.toc.$toc.data('previousWidth',context.$wikitext.width());},mark:function(context,event){var hash='';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;}
633642 h++;markers.push({index:h,start:tokenArray[i].tokenStart,end:tokenArray[i].offset,type:'toc',anchor:'before',afterWrap:function(node){var marker=$(node).data('marker');$(node).addClass('wikiEditor-toc-header').addClass('wikiEditor-toc-section-'+marker.index).data('section',marker.index);},onSkip:function(node){var marker=$(node).data('marker');if($(node).data('section')!=marker.index){$(node).removeClass('wikiEditor-toc-section-'+$(node).data('section')).addClass('wikiEditor-toc-section-'+marker.index).data('section',marker.index);}},getAnchor:function(ca1,ca2){return $(ca1.parentNode.previousSibling).is('div.wikiEditor-toc-header')?ca1.parentNode.previousSibling:null;}});hash+=tokenArray[i].match[2]+'\n';outline.push({'text':tokenArray[i].match[2],'level':tokenArray[i].match[1].length,'index':h});}
634643 if(typeof context.modules.toc.lastHash=='undefined'||context.modules.toc.lastHash!==hash){$.wikiEditor.modules.toc.fn.build(context);$.wikiEditor.modules.toc.fn.update(context);context.modules.toc.lastHash=hash;}}},exp:[{'regex':/^(={1,6})([^\r\n]+?)\1\s*$/m,'label':'TOC_HEADER','markAfter':true}],fn:{create:function(context,config){if('$toc'in context.modules.toc){return;}
635 -$.wikiEditor.modules.toc.cfg.rtl=config.rtl;var height=context.$ui.find('.wikiEditor-ui-left').height();context.modules.toc.$toc=$('<div />').addClass('wikiEditor-ui-toc').data('context',context).data('positionMode','regular').data('collapsed',false);context.$ui.find('.wikiEditor-ui-right').append(context.modules.toc.$toc);context.modules.toc.$toc.height(context.$ui.find('.wikiEditor-ui-left').height());$.wikiEditor.modules.toc.fn.redraw(context,$.wikiEditor.modules.toc.cfg.defaultWidth);},redraw:function(context,fixedWidth){var fixedWidth=parseFloat(fixedWidth);if(context.modules.toc.$toc.data('positionMode')=='regular'){context.$ui.find('.wikiEditor-ui-right').css('width',fixedWidth+'px');context.$ui.find('.wikiEditor-ui-left').css('marginRight',(-1*fixedWidth)+'px').children().css('marginRight',fixedWidth+'px');}else if(context.modules.toc.$toc.data('positionMode')=='goofy'){context.$ui.find('.wikiEditor-ui-left').css('width',fixedWidth);context.$ui.find('.wikiEditor-ui-right').css($.wikiEditor.modules.toc.cfg.rtl?'right':'left',fixedWidth);context.$wikitext.css('height',context.$ui.find('.wikiEditor-ui-right').height());}},switchLayout:function(context){var width,height=context.$ui.find('.wikiEditor-ui-right').height();if(context.modules.toc.$toc.data('positionMode')=='regular'&&!context.modules.toc.$toc.data('collapsed')){context.modules.toc.$toc.data('positionMode','goofy');context.modules.toc.$toc.data('positionModeChangeAt',context.$ui.find('.wikiEditor-ui-right').width());width=$.wikiEditor.modules.toc.cfg.textMinimumWidth;context.$ui.find('.wikiEditor-ui-left').css({'marginRight':'','position':'absolute','float':'none','left':$.wikiEditor.modules.toc.cfg.rtl?'auto':0,'right':$.wikiEditor.modules.toc.cfg.rtl?0:'auto'}).children().css('marginRight','');context.$ui.find('.wikiEditor-ui-right').css({'width':'auto','position':'absolute','float':'none','right':$.wikiEditor.modules.toc.cfg.rtl?'auto':0,'left':$.wikiEditor.modules.toc.cfg.rtl?0:'auto'});context.$wikitext.css('position','relative');}else if(context.modules.toc.$toc.data('positionMode')=='goofy'){context.modules.toc.$toc.data('positionMode','regular');width=context.$wikitext.width()-context.$ui.find('.wikiEditor-ui-left').width();if(width>context.modules.toc.$toc.data('positionModeChangeAt')){width=context.modules.toc.$toc.data('positionModeChangeAt');}
636 -context.$wikitext.css({'position':'','height':''});context.$ui.find('.wikiEditor-ui-right').css({'marginRight':'','position':'','left':'','right':'','float':'','top':'','height':''});context.$ui.find('.wikiEditor-ui-left').css({'width':'','position':'','left':'','float':'','right':''});}
 644+$.wikiEditor.modules.toc.cfg.rtl=config.rtl;$.wikiEditor.modules.toc.cfg.flexProperty=config.rtl?'marginLeft':'marginRight';var height=context.$ui.find('.wikiEditor-ui-left').height();context.modules.toc.$toc=$('<div />').addClass('wikiEditor-ui-toc').data('context',context).data('positionMode','regular').data('collapsed',false);context.$ui.find('.wikiEditor-ui-right').append(context.modules.toc.$toc);context.modules.toc.$toc.height(context.$ui.find('.wikiEditor-ui-left').height());$.wikiEditor.modules.toc.fn.redraw(context,$.wikiEditor.modules.toc.cfg.defaultWidth);},redraw:function(context,fixedWidth){var fixedWidth=parseFloat(fixedWidth);if(context.modules.toc.$toc.data('positionMode')=='regular'){context.$ui.find('.wikiEditor-ui-right').css('width',fixedWidth+'px');context.$ui.find('.wikiEditor-ui-left').css($.wikiEditor.modules.toc.cfg.flexProperty,(-1*fixedWidth)+'px').children().css($.wikiEditor.modules.toc.cfg.flexProperty,fixedWidth+'px');}else if(context.modules.toc.$toc.data('positionMode')=='goofy'){context.$ui.find('.wikiEditor-ui-left').css('width',fixedWidth);context.$ui.find('.wikiEditor-ui-right').css($.wikiEditor.modules.toc.cfg.rtl?'right':'left',fixedWidth);context.$wikitext.css('height',context.$ui.find('.wikiEditor-ui-right').height());}},switchLayout:function(context){var width,height=context.$ui.find('.wikiEditor-ui-right').height();if(context.modules.toc.$toc.data('positionMode')=='regular'&&!context.modules.toc.$toc.data('collapsed')){context.modules.toc.$toc.data('positionMode','goofy');context.modules.toc.$toc.data('positionModeChangeAt',context.$ui.find('.wikiEditor-ui-right').width());width=$.wikiEditor.modules.toc.cfg.textMinimumWidth;context.$ui.find('.wikiEditor-ui-left').css($.wikiEditor.modules.toc.cfg.flexProperty,'').css({'position':'absolute','float':'none','left':$.wikiEditor.modules.toc.cfg.rtl?'auto':0,'right':$.wikiEditor.modules.toc.cfg.rtl?0:'auto'}).children().css($.wikiEditor.modules.toc.cfg.flexProperty,'');context.$ui.find('.wikiEditor-ui-right').css({'width':'auto','position':'absolute','float':'none','right':$.wikiEditor.modules.toc.cfg.rtl?'auto':0,'left':$.wikiEditor.modules.toc.cfg.rtl?0:'auto'});context.$wikitext.css('position','relative');}else if(context.modules.toc.$toc.data('positionMode')=='goofy'){context.modules.toc.$toc.data('positionMode','regular');width=context.$wikitext.width()-context.$ui.find('.wikiEditor-ui-left').width();if(width>context.modules.toc.$toc.data('positionModeChangeAt')){width=context.modules.toc.$toc.data('positionModeChangeAt');}
 645+context.$wikitext.css({'position':'','height':''});context.$ui.find('.wikiEditor-ui-right').css($.wikiEditor.modules.toc.cfg.flexProperty,'').css({'position':'','left':'','right':'','float':'','top':'','height':''});context.$ui.find('.wikiEditor-ui-left').css({'width':'','position':'','left':'','float':'','right':''});}
637646 $.wikiEditor.modules.toc.fn.redraw(context,width);},disable:function(context){if(context.modules.toc.$toc.data('collapsed')){context.$ui.find('.wikiEditor-ui-toc-expandControl').hide();}else{if(context.modules.toc.$toc.data('positionMode')=='goofy'){$.wikiEditor.modules.toc.fn.switchLayout(context);}
638 -context.$ui.find('.wikiEditor-ui-right').hide();context.$ui.find('.wikiEditor-ui-left').css('marginRight','').children().css('marginRight','');}
 647+context.$ui.find('.wikiEditor-ui-right').hide();context.$ui.find('.wikiEditor-ui-left').css($.wikiEditor.modules.toc.cfg.flexProperty,'').children().css($.wikiEditor.modules.toc.cfg.flexProperty,'');}
639648 context.modules.toc.$toc.data('positionMode','disabled');},enable:function(context){context.modules.toc.$toc.data('positionMode','regular');if(context.modules.toc.$toc.data('collapsed')){context.$ui.find('.wikiEditor-ui-toc-expandControl').show();}else{context.$ui.find('.wikiEditor-ui-right').show();$.wikiEditor.modules.toc.fn.redraw(context,$.wikiEditor.modules.toc.cfg.minimumWidth);context.modules.toc.$toc.find('div').autoEllipsis({'position':'right','tooltip':true,'restoreText':true});}},unhighlight:function(context){if(context){context.modules.toc.$toc.find('div').removeClass('current');}},update:function(context){var div=context.fn.beforeSelection('wikiEditor-toc-header');if(div===null){return;}
640649 $.wikiEditor.modules.toc.fn.unhighlight(context);var section=div.data('section')||0;if(context.data.outline.length>0){var sectionLink=context.modules.toc.$toc.find('div.section-'+section);sectionLink.addClass('current');var relTop=sectionLink.offset().top-context.modules.toc.$toc.offset().top;var scrollTop=context.modules.toc.$toc.scrollTop();var divHeight=context.modules.toc.$toc.height();var sectionHeight=sectionLink.height();if(relTop<0)
641650 context.modules.toc.$toc.scrollTop(scrollTop+relTop);else if(relTop+sectionHeight>divHeight)
642651 context.modules.toc.$toc.scrollTop(scrollTop+relTop+sectionHeight-divHeight);}},collapse:function(event){var $this=$(this),context=$this.data('context');if(context.modules.toc.$toc.data('positionMode')=='goofy'){$.wikiEditor.modules.toc.fn.switchLayout(context);}
643 -var pT=$this.parent().position().top-1;context.modules.toc.$toc.data('collapsed',true);context.$ui.find('.wikiEditor-ui-left').animate({'marginRight':'-1px'},'fast',function(){$(this).css('marginRight',0);}).children().animate({'marginRight':'1px'},'fast',function(){$(this).css('marginRight',0);});context.$ui.find('.wikiEditor-ui-right').css({'marginTop':'1px','position':'absolute','left':$.wikiEditor.modules.toc.cfg.rtl?0:'auto','right':$.wikiEditor.modules.toc.cfg.rtl?'auto':0,'top':pT}).fadeOut('fast',function(){$(this).hide().css({'marginTop':'0','width':'1px'});context.$ui.find('.wikiEditor-ui-toc-expandControl').fadeIn('fast');context.fn.trigger('tocCollapse');context.fn.trigger('resize');});$.cookie('wikiEditor-'+context.instance+'-toc-width',0);return false;},expand:function(event){var $this=$(this),context=$this.data('context'),openWidth=parseFloat(context.modules.toc.$toc.data('openWidth')),availableSpace=context.$wikitext.width()-parseFloat($.wikiEditor.modules.toc.cfg.textMinimumWidth);if(availableSpace<$.wikiEditor.modules.toc.cfg.textMinmumWidth)return false;context.modules.toc.$toc.data('collapsed',false);if(availableSpace<openWidth)openWidth=availableSpace;context.$ui.find('.wikiEditor-ui-toc-expandControl').hide();context.$ui.find('.wikiEditor-ui-left').animate({'marginRight':(parseFloat(openWidth)*-1)},'fast').children().animate({'marginRight':openWidth},'fast');context.$ui.find('.wikiEditor-ui-right').show().css('marginTop','1px').animate({'width':openWidth},'fast',function(){context.$content.trigger('mouseup');$(this).css({'marginTop':'0','position':'relative','right':'auto','left':'auto','top':'auto'});context.fn.trigger('tocExpand');context.fn.trigger('resize');});$.cookie('wikiEditor-'+context.instance+'-toc-width',context.modules.toc.$toc.data('openWidth'));return false;},build:function(context){function buildStructure(outline,offset,level){if(offset==undefined)offset=0;if(level==undefined)level=1;var sections=[];for(var i=offset;i<outline.length;i++){if(outline[i].nLevel==level){var sub=buildStructure(outline,i+1,level+1);if(sub.length){outline[i].sections=sub;}
 652+var pT=$this.parent().position().top-1;context.modules.toc.$toc.data('collapsed',true);var leftParam={},leftChildParam={};leftParam[$.wikiEditor.modules.toc.cfg.flexProperty]='-1px';leftChildParam[$.wikiEditor.modules.toc.cfg.flexProperty]='1px';context.$ui.find('.wikiEditor-ui-left').animate(leftParam,'fast',function(){$(this).css($.wikiEditor.modules.toc.cfg.flexProperty,0);}).children().animate(leftChildParam,'fast',function(){$(this).css($.wikiEditor.modules.toc.cfg.flexProperty,0);});context.$ui.find('.wikiEditor-ui-right').css({'marginTop':'1px','position':'absolute','left':$.wikiEditor.modules.toc.cfg.rtl?0:'auto','right':$.wikiEditor.modules.toc.cfg.rtl?'auto':0,'top':pT}).fadeOut('fast',function(){$(this).hide().css({'marginTop':'0','width':'1px'});context.$ui.find('.wikiEditor-ui-toc-expandControl').fadeIn('fast');context.fn.trigger('tocCollapse');context.fn.trigger('resize');});$.cookie('wikiEditor-'+context.instance+'-toc-width',0);return false;},expand:function(event){var $this=$(this),context=$this.data('context'),openWidth=parseFloat(context.modules.toc.$toc.data('openWidth')),availableSpace=context.$wikitext.width()-parseFloat($.wikiEditor.modules.toc.cfg.textMinimumWidth);if(availableSpace<$.wikiEditor.modules.toc.cfg.textMinmumWidth)return false;context.modules.toc.$toc.data('collapsed',false);if(availableSpace<openWidth)openWidth=availableSpace;context.$ui.find('.wikiEditor-ui-toc-expandControl').hide();var leftParam={},leftChildParam={};leftParam[$.wikiEditor.modules.toc.cfg.flexProperty]=parseFloat(openWidth)*-1;leftChildParam[$.wikiEditor.modules.toc.cfg.flexProperty]=openWidth;context.$ui.find('.wikiEditor-ui-left').animate(leftParam,'fast').children().animate(leftChildParam,'fast');context.$ui.find('.wikiEditor-ui-right').show().css('marginTop','1px').animate({'width':openWidth},'fast',function(){context.$content.trigger('mouseup');$(this).css({'marginTop':'0','position':'relative','right':'auto','left':'auto','top':'auto'});context.fn.trigger('tocExpand');context.fn.trigger('resize');});$.cookie('wikiEditor-'+context.instance+'-toc-width',context.modules.toc.$toc.data('openWidth'));return false;},build:function(context){function buildStructure(outline,offset,level){if(offset==undefined)offset=0;if(level==undefined)level=1;var sections=[];for(var i=offset;i<outline.length;i++){if(outline[i].nLevel==level){var sub=buildStructure(outline,i+1,level+1);if(sub.length){outline[i].sections=sub;}
644653 sections[sections.length]=outline[i];}else if(outline[i].nLevel<level){break;}}
645654 return sections;}
646 -function buildList(structure){var list=$('<ul />');for(i in structure){var div=$('<div />').addClass('section-'+structure[i].index).data('index',structure[i].index).click(function(event){var wrapper=context.$content.find('.wikiEditor-toc-section-'+$(this).data('index'));if(wrapper.size()==0)
 655+function buildList(structure){var list=$('<ul />');for(i in structure){var div=$('<div />').addClass('section-'+structure[i].index).data('index',structure[i].index).mousedown(function(){return false;}).click(function(event){var wrapper=context.$content.find('.wikiEditor-toc-section-'+$(this).data('index'));if(wrapper.size()==0)
647656 wrapper=context.$content;context.fn.scrollToTop(wrapper,true);context.$textarea.textSelection('setSelection',{'start':0,'startContainer':wrapper});$.wikiEditor.modules.toc.fn.unhighlight(context);$(this).addClass('current');if(typeof $.trackAction!='undefined')
648657 $.trackAction('ntoc.heading');event.preventDefault();}).text(structure[i].text);if(structure[i].text=='')
649658 div.html('&nbsp;');var item=$('<li />').append(div);if(structure[i].sections!==undefined){item.append(buildList(structure[i].sections));}
650659 list.append(item);}
651660 return list;}
652 -function buildCollapseControls(){var $collapseControl=$('<div />'),$expandControl=$('<div />');$collapseControl.addClass('tab').addClass('tab-toc').append('<a href="#" />').bind('click.wikiEditor-toc',function(){context.modules.toc.$toc.trigger('collapse.wikiEditor-toc');return false;}).find('a').text(mw.usability.getMsg('wikieditor-toc-hide'));$expandControl.addClass('wikiEditor-ui-toc-expandControl').append('<a href="#" />').bind('click.wikiEditor-toc',function(){context.modules.toc.$toc.trigger('expand.wikiEditor-toc');return false;}).hide().find('a').text(mw.usability.getMsg('wikieditor-toc-show'));$collapseControl.insertBefore(context.modules.toc.$toc);context.$ui.find('.wikiEditor-ui-left .wikiEditor-ui-top').append($expandControl);}
 661+function buildCollapseControls(){var $collapseControl=$('<div />'),$expandControl=$('<div />');$collapseControl.addClass('tab').addClass('tab-toc').append('<a href="#" />').mousedown(function(){return false;}).bind('click.wikiEditor-toc',function(){context.modules.toc.$toc.trigger('collapse.wikiEditor-toc');return false;}).find('a').text(mw.usability.getMsg('wikieditor-toc-hide'));$expandControl.addClass('wikiEditor-ui-toc-expandControl').append('<a href="#" />').mousedown(function(){return false;}).bind('click.wikiEditor-toc',function(){context.modules.toc.$toc.trigger('expand.wikiEditor-toc');return false;}).hide().find('a').text(mw.usability.getMsg('wikieditor-toc-show'));$collapseControl.insertBefore(context.modules.toc.$toc);context.$ui.find('.wikiEditor-ui-left .wikiEditor-ui-top').append($expandControl);}
653662 function buildResizeControls(){context.$ui.data('resizableDone',true).find('.wikiEditor-ui-right').data('wikiEditor-ui-left',context.$ui.find('.wikiEditor-ui-left')).resizable({handles:'w,e',preventPositionLeftChange:true,minWidth:parseFloat($.wikiEditor.modules.toc.cfg.minimumWidth),start:function(e,ui){var $this=$(this);$('<div />').addClass('wikiEditor-ui-resize-mask').css({'position':'absolute','z-index':2,'left':0,'top':0,'bottom':0,'right':0}).appendTo(context.$ui.find('.wikiEditor-ui-left'));$this.resizable('option','maxWidth',$this.parent().width()-
654 -parseFloat($.wikiEditor.modules.toc.cfg.textMinimumWidth));if(context.modules.toc.$toc.data('positionMode')=='goofy'){$.wikiEditor.modules.toc.fn.switchLayout(context);}},resize:function(e,ui){$(this).css({'width':ui.size.width,'top':'auto','height':'auto'}).data('wikiEditor-ui-left').css('marginRight',(-1*ui.size.width)).children().css('marginRight',ui.size.width);context.fn.trigger('resize');},stop:function(e,ui){context.$ui.find('.wikiEditor-ui-resize-mask').remove();context.$content.trigger('mouseup');if(ui.size.width<=parseFloat($.wikiEditor.modules.toc.cfg.minimumWidth)){context.modules.toc.$toc.trigger('collapse.wikiEditor-toc');}else{context.modules.toc.$toc.find('div').autoEllipsis({'position':'right','tooltip':true,'restoreText':true});context.modules.toc.$toc.data('openWidth',ui.size.width);$.cookie('wikiEditor-'+context.instance+'-toc-width',ui.size.width);}
 663+parseFloat($.wikiEditor.modules.toc.cfg.textMinimumWidth));if(context.modules.toc.$toc.data('positionMode')=='goofy'){$.wikiEditor.modules.toc.fn.switchLayout(context);}},resize:function(e,ui){$(this).css({'width':ui.size.width,'top':'auto','height':'auto'}).data('wikiEditor-ui-left').css($.wikiEditor.modules.toc.cfg.flexProperty,(-1*ui.size.width)).children().css($.wikiEditor.modules.toc.cfg.flexProperty,ui.size.width);context.fn.trigger('resize');},stop:function(e,ui){context.$ui.find('.wikiEditor-ui-resize-mask').remove();context.$content.trigger('mouseup');if(ui.size.width<=parseFloat($.wikiEditor.modules.toc.cfg.minimumWidth)){context.modules.toc.$toc.trigger('collapse.wikiEditor-toc');}else{context.modules.toc.$toc.find('div').autoEllipsis({'position':'right','tooltip':true,'restoreText':true});context.modules.toc.$toc.data('openWidth',ui.size.width);$.cookie('wikiEditor-'+context.instance+'-toc-width',ui.size.width);}
655664 context.fn.trigger('resize');}});var handle=$.wikiEditor.modules.toc.cfg.rtl?'w':'e';context.$ui.find('.ui-resizable-'+handle).removeClass('ui-resizable-'+handle).addClass('ui-resizable-'+(handle=='w'?'e':'w')).addClass('wikiEditor-ui-toc-resize-grip');context.modules.toc.$toc.bind('collapse.wikiEditor-toc',$.wikiEditor.modules.toc.fn.collapse).bind('expand.wikiEditor-toc',$.wikiEditor.modules.toc.fn.expand);context.modules.toc.$toc.data('openWidth',$.wikiEditor.modules.toc.cfg.defaultWidth);if($.cookie('wikiEditor-'+context.instance+'-toc-width')==0){context.modules.toc.$toc.trigger('collapse.wikiEditor-toc',{data:context});}else if($.cookie('wikiEditor-'+context.instance+'-toc-width')>0){var initialWidth=$.cookie('wikiEditor-'+context.instance+'-toc-width');if(initialWidth<parseFloat($.wikiEditor.modules.toc.cfg.minimumWidth))
656665 initialWidth=parseFloat($.wikiEditor.modules.toc.cfg.minimumWidth)+1;context.modules.toc.$toc.data('openWidth',initialWidth+'px');$.wikiEditor.modules.toc.fn.redraw(context,initialWidth);}}
657666 if(context.data.outline){var outline=context.data.outline;var lastLevel=0;var nLevel=0;for(var i=0;i<outline.length;i++){if(outline[i].level>lastLevel){nLevel++;}
@@ -683,22 +692,22 @@
684693 break;case'dialog':context.fn.saveSelection();context.$textarea.wikiEditor('openDialog',action.module);break;default:break;}},buildGroup:function(context,id,group){var $group=$('<div />').attr({'class':'group group-'+id,'rel':id});var label=$.wikiEditor.autoMsg(group,'label');if(label){$group.append('<div class="label">'+label+'</div>')}
685694 var empty=true;if('tools'in group){for(tool in group.tools){var tool=$.wikiEditor.modules.toolbar.fn.buildTool(context,tool,group.tools[tool]);if(tool){empty=false;$group.append(tool);}}}
686695 return empty?null:$group;},buildTool:function(context,id,tool){if('filters'in tool){for(filter in tool.filters){if($(tool.filters[filter]).size()==0){return null;}}}
687 -var label=$.wikiEditor.autoMsg(tool,'label');switch(tool.type){case'button':var src=$.wikiEditor.autoIcon(tool.icon,$.wikiEditor.imgPath+'toolbar/');$button=$('<img />').attr({'src':src,'width':22,'height':22,'alt':label,'title':label,'rel':id,'class':'tool tool-button'});if('action'in tool){$button.data('action',tool.action).data('context',context).click(function(){$.wikiEditor.modules.toolbar.fn.doAction($(this).data('context'),$(this).data('action'),$(this));return false;});}
688 -return $button;case'select':var $select=$('<div />').attr({'rel':id,'class':'tool tool-select'});$options=$('<div />').addClass('options');if('list'in tool){for(option in tool.list){var optionLabel=$.wikiEditor.autoMsg(tool.list[option],'label');$options.append($('<a />').data('action',tool.list[option].action).data('context',context).click(function(){$.wikiEditor.modules.toolbar.fn.doAction($(this).data('context'),$(this).data('action'),$(this));if($(this).parent().is(':visible')){$(this).parent().animate({'opacity':'toggle'},'fast');}
 696+var label=$.wikiEditor.autoMsg(tool,'label');switch(tool.type){case'button':var src=$.wikiEditor.autoIcon(tool.icon,$.wikiEditor.imgPath+'toolbar/');$button=$('<img />').attr({'src':src,'width':22,'height':22,'alt':label,'title':label,'rel':id,'class':'tool tool-button'});if('action'in tool){$button.data('action',tool.action).data('context',context).mousedown(function(){return false;}).click(function(){$.wikiEditor.modules.toolbar.fn.doAction($(this).data('context'),$(this).data('action'),$(this));return false;});}
 697+return $button;case'select':var $select=$('<div />').attr({'rel':id,'class':'tool tool-select'});$options=$('<div />').addClass('options');if('list'in tool){for(option in tool.list){var optionLabel=$.wikiEditor.autoMsg(tool.list[option],'label');$options.append($('<a />').data('action',tool.list[option].action).data('context',context).mousedown(function(){return false;}).click(function(){$.wikiEditor.modules.toolbar.fn.doAction($(this).data('context'),$(this).data('action'),$(this));if($(this).parent().is(':visible')){$(this).parent().animate({'opacity':'toggle'},'fast');}
689698 return false;}).text(optionLabel).addClass('option').attr({'rel':option,'href':'#'}));}}
690 -$select.append($('<div />').addClass('menu').append($options));$select.append($('<a />').addClass('label').text(label).data('options',$options).attr('href','#').click(function(){$(this).data('options').animate({'opacity':'toggle'},'fast');return false;}));return $select;default:return null;}},buildBookmark:function(context,id,page){var label=$.wikiEditor.autoMsg(page,'label');return $('<div />').text(label).attr('rel',id).data('context',context).bind('mousedown',function(){$(this).parent().parent().find('.page').hide();$(this).parent().parent().find('.page-'+$(this).attr('rel')).show();$(this).siblings().removeClass('current');$(this).addClass('current');var section=$(this).parent().parent().attr('rel');if($.trackAction!=undefined){$.trackAction(section+'.'+$(this).attr('rel'));}
691 -$.cookie('wikiEditor-'+$(this).data('context').instance+'-booklet-'+section+'-page',$(this).attr('rel'));});},buildPage:function(context,id,page){var $page=$('<div />').attr({'class':'page page-'+id,'rel':id});switch(page.layout){case'table':$page.addClass('page-table');var html='<table cellpadding=0 cellspacing=0 '+'border=0 width="100%" class="table table-"'+id+'">';if('headings'in page){html+=$.wikiEditor.modules.toolbar.fn.buildHeading(context,page.headings)}
 699+$select.append($('<div />').addClass('menu').append($options));$select.append($('<a />').addClass('label').text(label).data('options',$options).attr('href','#').mousedown(function(){return false;}).click(function(){$(this).data('options').animate({'opacity':'toggle'},'fast');return false;}));return $select;default:return null;}},buildBookmark:function(context,id,page){var label=$.wikiEditor.autoMsg(page,'label');return $('<div />').text(label).attr('rel',id).data('context',context).mousedown(function(){return false;}).click(function(event){$(this).parent().parent().find('.page').hide();$(this).parent().parent().find('.page-'+$(this).attr('rel')).show();$(this).siblings().removeClass('current');$(this).addClass('current');var section=$(this).parent().parent().attr('rel');$.cookie('wikiEditor-'+$(this).data('context').instance+'-booklet-'+section+'-page',$(this).attr('rel'));if($.trackAction!=undefined){$.trackAction(section+'.'+$(this).attr('rel'));}
 700+return false;})},buildPage:function(context,id,page){var $page=$('<div />').attr({'class':'page page-'+id,'rel':id});switch(page.layout){case'table':$page.addClass('page-table');var html='<table cellpadding=0 cellspacing=0 '+'border=0 width="100%" class="table table-"'+id+'">';if('headings'in page){html+=$.wikiEditor.modules.toolbar.fn.buildHeading(context,page.headings)}
692701 if('rows'in page){for(row in page.rows){html+=$.wikiEditor.modules.toolbar.fn.buildRow(context,page.rows[row])}}
693702 $page.html(html);break;case'characters':$page.addClass('page-characters');$characters=$('<div />').data('context',context).data('actions',{});var actions=$characters.data('actions');if('language'in page){$characters.attr('lang',page.language);}
694703 if('direction'in page){$characters.attr('dir',page.direction);}
695704 if('characters'in page){var html='';for(character in page.characters){html+=$.wikiEditor.modules.toolbar.fn.buildCharacter(page.characters[character],actions);}
696 -$characters.html(html).children().click(function(){$.wikiEditor.modules.toolbar.fn.doAction($(this).parent().data('context'),$(this).parent().data('actions')[$(this).attr('rel')],$(this));return false;});}
 705+$characters.html(html).children().mousedown(function(){return false;}).click(function(){$.wikiEditor.modules.toolbar.fn.doAction($(this).parent().data('context'),$(this).parent().data('actions')[$(this).attr('rel')],$(this));return false;});}
697706 $page.append($characters);break;}
698707 return $page;},buildHeading:function(context,headings){var html='<tr>';for(heading in headings){html+='<th>'+$.wikiEditor.autoMsg(headings[heading],['html','text'])+'</th>';}
699708 return html;},buildRow:function(context,row){var html='<tr>';for(cell in row){html+='<td class="cell cell-'+cell+'" valign="top"><span>'+
700709 $.wikiEditor.autoMsg(row[cell],['html','text'])+'</span></td>';}
701710 html+='</tr>';return html;},buildCharacter:function(character,actions){if(typeof character=='string'){character={'label':character,'action':{'type':'encapsulate','options':{'pre':character}}};}else if(0 in character&&1 in character){character={'label':character[0],'action':{'type':'encapsulate','options':{'pre':character[1]}}};}
702 -if('action'in character&&'label'in character){actions[character.label]=character.action;return'<a rel="'+character.label+'" href="#">'+character.label+'</a>';}},buildTab:function(context,id,section){var selected=$.cookie('wikiEditor-'+context.instance+'-toolbar-section');return $('<span />').attr({'class':'tab tab-'+id,'rel':id}).append($('<a />').addClass(selected==id?'current':null).attr('href','#').text($.wikiEditor.autoMsg(section,'label')).data('context',context).bind('mouseup',function(e){$(this).blur();}).bind('click',function(e){var $sections=$(this).data('context').$ui.find('.sections');var $section=$(this).data('context').$ui.find('.section-'+$(this).parent().attr('rel'));var show=$section.css('display')=='none';$previousSections=$section.parent().find('.section:visible');$previousSections.css('position','absolute');$previousSections.fadeOut('fast',function(){$(this).css('position','relative');});$(this).parent().parent().find('a').removeClass('current');$sections.css('overflow','hidden');if(show){$section.fadeIn('fast');$sections.css('display','block').animate({'height':$section.outerHeight()},$section.outerHeight()*2,function(){$(this).css('overflow','visible').css('height','auto');context.fn.trigger('resize');});$(this).addClass('current');}else{$sections.css('height',$section.outerHeight()).animate({'height':'hide'},$section.outerHeight()*2,function(){$(this).css({'overflow':'visible','height':0});context.fn.trigger('resize');});}
 711+if('action'in character&&'label'in character){actions[character.label]=character.action;return'<a rel="'+character.label+'" href="#">'+character.label+'</a>';}},buildTab:function(context,id,section){var selected=$.cookie('wikiEditor-'+context.instance+'-toolbar-section');return $('<span />').attr({'class':'tab tab-'+id,'rel':id}).append($('<a />').addClass(selected==id?'current':null).attr('href','#').text($.wikiEditor.autoMsg(section,'label')).data('context',context).mouseup(function(e){$(this).blur();}).mousedown(function(){return false;}).click(function(e){var $sections=$(this).data('context').$ui.find('.sections');var $section=$(this).data('context').$ui.find('.section-'+$(this).parent().attr('rel'));var show=$section.css('display')=='none';$previousSections=$section.parent().find('.section:visible');$previousSections.css('position','absolute');$previousSections.fadeOut('fast',function(){$(this).css('position','relative');});$(this).parent().parent().find('a').removeClass('current');$sections.css('overflow','hidden');if(show){$section.fadeIn('fast');$sections.css('display','block').animate({'height':$section.outerHeight()},$section.outerHeight()*2,function(){$(this).css('overflow','visible').css('height','auto');context.fn.trigger('resize');});$(this).addClass('current');}else{$sections.css('height',$section.outerHeight()).animate({'height':'hide'},$section.outerHeight()*2,function(){$(this).css({'overflow':'visible','height':0});context.fn.trigger('resize');});}
703712 if($.trackAction!=undefined){$.trackAction($section.attr('rel')+'.'+(show?'show':'hide'));}
704713 $.cookie('wikiEditor-'+$(this).data('context').instance+'-toolbar-section',show?$section.attr('rel'):null);return false;}));},buildSection:function(context,id,section){context.$textarea.trigger('wikiEditor-toolbar-buildSection-'+id,[section]);var selected=$.cookie('wikiEditor-'+context.instance+'-toolbar-section');var $section;switch(section.type){case'toolbar':var $section=$('<div />').attr({'class':'toolbar section section-'+id,'rel':id});if('groups'in section){for(group in section.groups){$section.append($.wikiEditor.modules.toolbar.fn.buildGroup(context,group,section.groups[group]));}}
705714 break;case'booklet':var $pages=$('<div />').addClass('pages');var $index=$('<div />').addClass('index');if('pages'in section){for(page in section.pages){$pages.append($.wikiEditor.modules.toolbar.fn.buildPage(context,page,section.pages[page]));$index.append($.wikiEditor.modules.toolbar.fn.buildBookmark(context,page,section.pages[page]));}}
Index: branches/wmf-deployment/extensions/UsabilityInitiative/js/plugins/jquery.wikiEditor.js
@@ -305,7 +305,7 @@
306306 */
307307 // Intercept all tab events to provide consisten behavior across browsers
308308 // Webkit browsers insert tab characters by default into the iframe rather than changing input focus
309 - case 9:
 309+ case 9: //tab
310310 // if any modifier keys are pressed, allow the browser to do it's thing
311311 if ( event.ctrlKey || event.altKey || event.shiftKey ) {
312312 return true;
@@ -322,8 +322,15 @@
323323 return false;
324324 }
325325 break;
 326+ case 86: //v
 327+ if ( event.ctrlKey ){
 328+ //paste, intercepted for IE
 329+ context.evt.paste( event );
 330+ }
 331+ break;
326332 }
327333 return true;
 334+
328335 },
329336 'change': function( event ) {
330337 event.data.scope = 'division';
@@ -361,6 +368,29 @@
362369 }
363370 }
364371 return true;
 372+ },
 373+ 'paste': function( event ) {
 374+ context.$content.find( ':not(.wikiEditor)' ).addClass( 'wikiEditor' );
 375+ setTimeout( function() {
 376+ var $selection = context.$content.find( ':not(.wikiEditor)' );
 377+ while ( $selection.length && $selection.length > 0 ) {
 378+ var $currentElement = $selection.eq( 0 );
 379+ while ( !$currentElement.parent().is( 'body' ) && !$currentElement.parent().is( '.wikiEditor' ) ) {
 380+ $currentElement = $currentElement.parent();
 381+ }
 382+ if ( $currentElement.is( 'br' ) ) {
 383+ $currentElement.addClass( 'wikiEditor' );
 384+ } else {
 385+ $( '<p></p>' )
 386+ .text( $currentElement.text() )
 387+ .addClass( 'wikiEditor' )
 388+ .insertAfter( $currentElement );
 389+ $currentElement.remove();
 390+ }
 391+ $selection = context.$content.find( ':not(.wikiEditor)' );
 392+ }
 393+ }, 0 );
 394+ return true;
365395 }
366396 };
367397
@@ -425,6 +455,10 @@
426456 .addClass( context.view == options.name ? 'current' : null )
427457 .append( $( '<a></a>' )
428458 .attr( 'href', '#' )
 459+ .mousedown( function() {
 460+ // No dragging!
 461+ return false;
 462+ } )
429463 .click( function( event ) {
430464 context.$ui.find( '.wikiEditor-ui-view' ).hide();
431465 context.$ui.find( '.' + $(this).parent().attr( 'rel' ) ).show();
@@ -483,30 +517,30 @@
484518 // Converting <p>s is wrong if there's nothing before them, so check that.
485519 // .find( '* + p' ) isn't good enough because textnodes aren't considered
486520 $pre.find( 'p' ).each( function() {
487 - var text = $( this ).text();
488 - // If this <p> is preceded by some text, add a \n at the beginning, and if
489 - // it's followed by a textnode, add a \n at the end
490 - // We need the traverser because there can be other weird stuff in between
491 -
492 - // Check for preceding text
493 - var t = new context.fn.rawTraverser( this.firstChild, 0, this, $pre.get( 0 ) ).prev();
494 - while ( t && t.node.nodeName != '#text' && t.node.nodeName != 'BR' && t.node.nodeName != 'P' ) {
495 - t = t.prev();
496 - }
497 - if ( t ) {
498 - text = "\n" + text;
499 - }
500 -
501 - // Check for following text
502 - t = new context.fn.rawTraverser( this.lastChild, 0, this, $pre.get( 0 ) ).next();
503 - while ( t && t.node.nodeName != '#text' && t.node.nodeName != 'BR' && t.node.nodeName != 'P' ) {
504 - t = t.next();
505 - }
506 - if ( t && !t.inP && t.node.nodeName == '#text' && t.node.nodeValue.charAt( 0 ) != '\n'
507 - && t.node.nodeValue.charAt( 0 ) != '\r' ) {
508 - text += "\n";
509 - }
510 - $( this ).text( text );
 521+ var text = $( this ).text();
 522+ // If this <p> is preceded by some text, add a \n at the beginning, and if
 523+ // it's followed by a textnode, add a \n at the end
 524+ // We need the traverser because there can be other weird stuff in between
 525+
 526+ // Check for preceding text
 527+ var t = new context.fn.rawTraverser( this.firstChild, 0, this, $pre.get( 0 ) ).prev();
 528+ while ( t && t.node.nodeName != '#text' && t.node.nodeName != 'BR' && t.node.nodeName != 'P' ) {
 529+ t = t.prev();
 530+ }
 531+ if ( t ) {
 532+ text = "\n" + text;
 533+ }
 534+
 535+ // Check for following text
 536+ t = new context.fn.rawTraverser( this.lastChild, 0, this, $pre.get( 0 ) ).next();
 537+ while ( t && t.node.nodeName != '#text' && t.node.nodeName != 'BR' && t.node.nodeName != 'P' ) {
 538+ t = t.next();
 539+ }
 540+ if ( t && !t.inP && t.node.nodeName == '#text' && t.node.nodeValue.charAt( 0 ) != '\n'
 541+ && t.node.nodeValue.charAt( 0 ) != '\r' ) {
 542+ text += "\n";
 543+ }
 544+ $( this ).text( text );
511545 } );
512546 var retval;
513547 if ( $.browser.msie ) {
@@ -590,6 +624,7 @@
591625 var selText = $(this).textSelection( 'getSelection' );
592626 var selTextArr;
593627 var selectAfter = false;
 628+ var setSelectionTo = null;
594629 var pre = options.pre, post = options.post;
595630 if ( !selText ) {
596631 selText = options.peri;
@@ -659,16 +694,57 @@
660695 range.extractContents();
661696 // Insert the contents one line at a time - insertNode() inserts at the beginning, so this has to happen
662697 // in reverse order
663 - var lastNode;
 698+ // Track the first and last inserted node, and if we need to also track where the text we need to select
 699+ // afterwards starts and ends
 700+ var firstNode = null, lastNode = null;
 701+ var selSC = null, selEC = null, selSO = null, selEO = null, offset = 0;
664702 for ( var i = insertLines.length - 1; i >= 0; i-- ) {
665 - range.insertNode( context.$iframe[0].contentWindow.document.createTextNode( insertLines[i] ) );
 703+ firstNode = context.$iframe[0].contentWindow.document.createTextNode( insertLines[i] );
 704+ range.insertNode( firstNode );
 705+ lastNode = lastNode || firstNode;
 706+ var newOffset = offset + insertLines[i].length;
 707+ if ( !selSC && pre.length < newOffset ) {
 708+ selSC = firstNode;
 709+ selSO = pre.length - offset;
 710+ }
 711+ if ( selSC && insertText.length - post.length < newOffset ) {
 712+ selEC = firstNode;
 713+ selEO = insertText.length - pre.length - offset;
 714+ }
 715+ offset = newOffset;
666716 if ( i > 0 ) {
667 - lastNode = range.insertNode( context.$iframe[0].contentWindow.document.createElement( 'br' ) );
 717+ firstNode = context.$iframe[0].contentWindow.document.createElement( 'br' );
 718+ range.insertNode( firstNode );
 719+ newOffset = offset + 1;
 720+ if ( !selSC && pre.length < newOffset ) {
 721+ selSC = firstNode;
 722+ selSO = pre.length - offset;
 723+ }
 724+ if ( selSC && insertText.length - post.length < newOffset ) {
 725+ selEC = firstNode;
 726+ selEO = insertText.length - pre.length - offset;
 727+ }
 728+ offset = newOffset;
668729 }
669730 }
670 - if ( lastNode ) {
671 - context.fn.scrollToTop( lastNode );
 731+ if ( firstNode ) {
 732+ context.fn.scrollToTop( $( firstNode.parentNode ) );
672733 }
 734+ if ( selectAfter ) {
 735+ setSelectionTo = {
 736+ startContainer: selSC,
 737+ endContainer: selEC,
 738+ start: selSO,
 739+ end: selEO
 740+ };
 741+ } else if ( lastNode ) {
 742+ setSelectionTo = {
 743+ startContainer: lastNode,
 744+ endContainer: lastNode,
 745+ start: lastNode.nodeValue.length,
 746+ end: lastNode.nodeValue.length
 747+ };
 748+ }
673749 } else if ( context.$iframe[0].contentWindow.document.selection ) {
674750 // IE
675751 context.$iframe[0].contentWindow.focus();
@@ -711,7 +787,16 @@
712788 .replace( />/g, '&gt;' )
713789 .replace( /\r?\n/g, '<br />' )
714790 );
 791+ if ( selectAfter ) {
 792+ range.moveStart( 'character', -post.length - selText.length );
 793+ range.moveEnd( 'character', -post.length );
 794+ range.select();
 795+ }
715796 }
 797+
 798+ if ( setSelectionTo ) {
 799+ context.fn.setSelection( setSelectionTo );
 800+ }
716801 // Trigger the encapsulateSelection event (this might need to get named something else/done differently)
717802 $( context.$iframe[0].contentWindow.document ).trigger(
718803 'encapsulateSelection', [ pre, options.peri, post, options.ownline, options.replace ]
@@ -1140,13 +1225,20 @@
11411226 * as a response to the "resize" event.
11421227 */
11431228
 1229+ // Assemble a temporary div to place over the wikiEditor while it's being constructed
 1230+ var $loader = $( '<div></div>' )
 1231+ .addClass( 'wikiEditor-ui-loading' )
 1232+ .append( $( '<span>' + mw.usability.getMsg( 'wikieditor-loading' ) + '</span>' )
 1233+ .css( 'marginTop', context.$textarea.height() / 2 ) );
11441234 // Encapsulate the textarea with some containers for layout
11451235 context.$textarea
1146 - .wrap( $( '<div></div>' ).addClass( 'wikiEditor-ui' ) )
1147 - .wrap( $( '<div></div>' ).addClass( 'wikiEditor-ui-view wikiEditor-ui-view-wikitext' ) )
1148 - .wrap( $( '<div></div>' ).addClass( 'wikiEditor-ui-left' ) )
1149 - .wrap( $( '<div></div>' ).addClass( 'wikiEditor-ui-bottom' ) )
1150 - .wrap( $( '<div></div>' ).addClass( 'wikiEditor-ui-text' ) );
 1236+ .after( $loader )
 1237+ .add( $loader )
 1238+ .wrapAll( $( '<div></div>' ).addClass( 'wikiEditor-ui' ) )
 1239+ .wrapAll( $( '<div></div>' ).addClass( 'wikiEditor-ui-view wikiEditor-ui-view-wikitext' ) )
 1240+ .wrapAll( $( '<div></div>' ).addClass( 'wikiEditor-ui-left' ) )
 1241+ .wrapAll( $( '<div></div>' ).addClass( 'wikiEditor-ui-bottom' ) )
 1242+ .wrapAll( $( '<div></div>' ).addClass( 'wikiEditor-ui-text' ) );
11511243 // Get references to some of the newly created containers
11521244 context.$ui = context.$textarea.parent().parent().parent().parent().parent();
11531245 context.$wikitext = context.$textarea.parent().parent().parent().parent();
@@ -1234,11 +1326,11 @@
12351327 // We also need to unescape the doubly-escaped things mentioned above
12361328 html = $( '<div />' ).text( '<p>' + html.replace( /\r?\n/g, '</p><p>' ) + '</p>' ).html()
12371329 .replace( /&amp;nbsp;/g, '&nbsp;' )
1238 - // Allow p tags to survive encoding
 1330+ // Allow <p> tags to survive encoding
12391331 .replace( /&lt;p&gt;/g, '<p>' )
12401332 .replace( /&lt;\/p&gt;/g, '</p>' )
1241 - // Empty p tags should just be br tags
1242 - .replace( /<p><\/p>/g, '<br>' )
 1333+ // Empty <p> tags need <br> tags in them
 1334+ .replace( /<p><\/p>/g, '<p><br></p>' )
12431335 // Unescape &esc; stuff
12441336 .replace( /&amp;esc;&amp;amp;nbsp;/g, '&amp;nbsp;' )
12451337 .replace( /&amp;esc;&amp;lt;p&amp;gt;/g, '&lt;p&gt;' )
@@ -1260,15 +1352,22 @@
12611353 context.$iframe.show();
12621354 // Let modules know we're ready to start working with the content
12631355 context.fn.trigger( 'ready' );
 1356+ //remove our temporary loading
 1357+ $( '.wikiEditor-ui-loading' ).fadeOut( 'fast', function() {
 1358+ $( this ).remove();
 1359+ } );
12641360 // Setup event handling on the iframe
12651361 $( context.$iframe[0].contentWindow.document )
12661362 .bind( 'keydown', function( event ) {
12671363 return context.fn.trigger( 'keydown', event );
12681364 } )
1269 - .bind( 'keyup mouseup paste cut encapsulateSelection', function( event ) {
 1365+ .bind( 'paste', function( event ) {
 1366+ return context.fn.trigger( 'paste', event );
 1367+ } )
 1368+ .bind( 'keyup paste mouseup cut encapsulateSelection', function( event ) {
12701369 return context.fn.trigger( 'change', event );
12711370 } )
1272 - .delayedBind( 250, 'keyup mouseup paste cut encapsulateSelection', function( event ) {
 1371+ .delayedBind( 250, 'keyup paste mouseup cut encapsulateSelection', function( event ) {
12731372 context.fn.trigger( 'delayedChange', event );
12741373 } );
12751374 } );
Index: branches/wmf-deployment/extensions/UsabilityInitiative/js/plugins/jquery.wikiEditor.toolbar.js
@@ -307,6 +307,10 @@
308308 $button
309309 .data( 'action', tool.action )
310310 .data( 'context', context )
 311+ .mousedown( function() {
 312+ // No dragging!
 313+ return false;
 314+ } )
311315 .click( function() {
312316 $.wikiEditor.modules.toolbar.fn.doAction(
313317 $(this).data( 'context' ), $(this).data( 'action' ), $(this)
@@ -326,6 +330,10 @@
327331 $( '<a />' )
328332 .data( 'action', tool.list[option].action )
329333 .data( 'context', context )
 334+ .mousedown( function() {
 335+ // No dragging!
 336+ return false;
 337+ } )
330338 .click( function() {
331339 $.wikiEditor.modules.toolbar.fn.doAction(
332340 $(this).data( 'context' ), $(this).data( 'action' ), $(this)
@@ -350,6 +358,10 @@
351359 .text( label )
352360 .data( 'options', $options )
353361 .attr( 'href', '#' )
 362+ .mousedown( function() {
 363+ // No dragging!
 364+ return false;
 365+ } )
354366 .click( function() {
355367 $(this).data( 'options' ).animate( { 'opacity': 'toggle' }, 'fast' );
356368 return false;
@@ -367,23 +379,27 @@
368380 .text( label )
369381 .attr( 'rel', id )
370382 .data( 'context', context )
371 - .bind( 'mousedown', function() {
 383+ .mousedown( function() {
 384+ // No dragging!
 385+ return false;
 386+ } )
 387+ .click( function( event ) {
372388 $(this).parent().parent().find( '.page' ).hide();
373389 $(this).parent().parent().find( '.page-' + $(this).attr( 'rel' ) ).show();
374390 $(this).siblings().removeClass( 'current' );
375391 $(this).addClass( 'current' );
376392 var section = $(this).parent().parent().attr( 'rel' );
377 -
378 - //click tracking
379 - if($.trackAction != undefined){
380 - $.trackAction(section + '.' + $(this).attr('rel'));
381 - }
382 -
383393 $.cookie(
384394 'wikiEditor-' + $(this).data( 'context' ).instance + '-booklet-' + section + '-page',
385395 $(this).attr( 'rel' )
386396 );
387 - } );
 397+ // Click tracking
 398+ if($.trackAction != undefined){
 399+ $.trackAction(section + '.' + $(this).attr('rel'));
 400+ }
 401+ // No dragging!
 402+ return false;
 403+ } )
388404 },
389405 buildPage : function( context, id, page ) {
390406 var $page = $( '<div />' ).attr( {
@@ -423,6 +439,10 @@
424440 $characters
425441 .html( html )
426442 .children()
 443+ .mousedown( function() {
 444+ // No dragging!
 445+ return false;
 446+ } )
427447 .click( function() {
428448 $.wikiEditor.modules.toolbar.fn.doAction(
429449 $(this).parent().data( 'context' ),
@@ -490,10 +510,14 @@
491511 .attr( 'href', '#' )
492512 .text( $.wikiEditor.autoMsg( section, 'label' ) )
493513 .data( 'context', context )
494 - .bind( 'mouseup', function( e ) {
 514+ .mouseup( function( e ) {
495515 $(this).blur();
496516 } )
497 - .bind( 'click', function( e ) {
 517+ .mousedown( function() {
 518+ // No dragging!
 519+ return false;
 520+ } )
 521+ .click( function( e ) {
498522 var $sections = $(this).data( 'context' ).$ui.find( '.sections' );
499523 var $section =
500524 $(this).data( 'context' ).$ui.find( '.section-' + $(this).parent().attr( 'rel' ) );
Index: branches/wmf-deployment/extensions/UsabilityInitiative/js/plugins/jquery.wikiEditor.toc.js
@@ -11,6 +11,8 @@
1212 minimumWidth: '70px',
1313 // Minimum width of the wikiText area
1414 textMinimumWidth: '450px',
 15+ // The style property to be used for positioning the flexible module in regular mode
 16+ flexProperty: 'marginRight',
1517 // Boolean var indicating text direction
1618 rtl: false
1719 },
@@ -143,7 +145,7 @@
144146 return;
145147 }
146148 $.wikiEditor.modules.toc.cfg.rtl = config.rtl;
147 -
 149+ $.wikiEditor.modules.toc.cfg.flexProperty = config.rtl ? 'marginLeft' : 'marginRight';
148150 var height = context.$ui.find( '.wikiEditor-ui-left' ).height();
149151 context.modules.toc.$toc = $( '<div />' )
150152 .addClass( 'wikiEditor-ui-toc' )
@@ -165,9 +167,9 @@
166168 context.$ui.find( '.wikiEditor-ui-right' )
167169 .css( 'width', fixedWidth + 'px' );
168170 context.$ui.find( '.wikiEditor-ui-left' )
169 - .css( 'marginRight', ( -1 * fixedWidth ) + 'px' )
 171+ .css( $.wikiEditor.modules.toc.cfg.flexProperty, ( -1 * fixedWidth ) + 'px' )
170172 .children()
171 - .css( 'marginRight', fixedWidth + 'px' );
 173+ .css( $.wikiEditor.modules.toc.cfg.flexProperty, fixedWidth + 'px' );
172174 } else if( context.modules.toc.$toc.data( 'positionMode' ) == 'goofy' ) {
173175 context.$ui.find( '.wikiEditor-ui-left' )
174176 .css( 'width', fixedWidth );
@@ -189,11 +191,12 @@
190192 width = $.wikiEditor.modules.toc.cfg.textMinimumWidth;
191193 // set our styles for goofy mode
192194 context.$ui.find( '.wikiEditor-ui-left' )
193 - .css( { 'marginRight': '', 'position': 'absolute', 'float': 'none',
 195+ .css( $.wikiEditor.modules.toc.cfg.flexProperty, '')
 196+ .css( { 'position': 'absolute', 'float': 'none',
194197 'left': $.wikiEditor.modules.toc.cfg.rtl ? 'auto': 0,
195198 'right' : $.wikiEditor.modules.toc.cfg.rtl ? 0 : 'auto' } )
196199 .children()
197 - .css( 'marginRight', '' );
 200+ .css( $.wikiEditor.modules.toc.cfg.flexProperty, '' );
198201 context.$ui.find( '.wikiEditor-ui-right' )
199202 .css( { 'width': 'auto', 'position': 'absolute', 'float': 'none',
200203 'right': $.wikiEditor.modules.toc.cfg.rtl ? 'auto': 0,
@@ -212,7 +215,8 @@
213216 context.$wikitext
214217 .css( { 'position': '', 'height': '' } );
215218 context.$ui.find( '.wikiEditor-ui-right' )
216 - .css( { 'marginRight': '', 'position': '', 'left': '', 'right': '', 'float': '', 'top': '', 'height': '' } );
 219+ .css( $.wikiEditor.modules.toc.cfg.flexProperty, '' )
 220+ .css( { 'position': '', 'left': '', 'right': '', 'float': '', 'top': '', 'height': '' } );
217221 context.$ui.find( '.wikiEditor-ui-left' )
218222 .css( { 'width': '', 'position': '', 'left': '', 'float': '', 'right': '' } );
219223 }
@@ -227,9 +231,9 @@
228232 }
229233 context.$ui.find( '.wikiEditor-ui-right' ).hide();
230234 context.$ui.find( '.wikiEditor-ui-left' )
231 - .css( 'marginRight', '' )
 235+ .css( $.wikiEditor.modules.toc.cfg.flexProperty, '' )
232236 .children()
233 - .css( 'marginRight', '' );
 237+ .css( $.wikiEditor.modules.toc.cfg.flexProperty, '' );
234238 }
235239 context.modules.toc.$toc.data( 'positionMode', 'disabled' );
236240 },
@@ -296,13 +300,16 @@
297301 }
298302 var pT = $this.parent().position().top - 1;
299303 context.modules.toc.$toc.data( 'collapsed', true );
 304+ var leftParam = {}, leftChildParam = {};
 305+ leftParam[ $.wikiEditor.modules.toc.cfg.flexProperty ] = '-1px';
 306+ leftChildParam[ $.wikiEditor.modules.toc.cfg.flexProperty ] = '1px';
300307 context.$ui.find( '.wikiEditor-ui-left' )
301 - .animate( { 'marginRight': '-1px' }, 'fast', function() {
302 - $( this ).css( 'marginRight', 0 );
 308+ .animate( leftParam, 'fast', function() {
 309+ $( this ).css( $.wikiEditor.modules.toc.cfg.flexProperty, 0 );
303310 } )
304311 .children()
305 - .animate( { 'marginRight': '1px' }, 'fast', function() {
306 - $( this ).css( 'marginRight', 0 );
 312+ .animate( leftChildParam, 'fast', function() {
 313+ $( this ).css( $.wikiEditor.modules.toc.cfg.flexProperty, 0 );
307314 } );
308315 context.$ui.find( '.wikiEditor-ui-right' )
309316 .css( {
@@ -339,10 +346,13 @@
340347 // check if we've got enough room to open to our stored width
341348 if ( availableSpace < openWidth ) openWidth = availableSpace;
342349 context.$ui.find( '.wikiEditor-ui-toc-expandControl' ).hide();
 350+ var leftParam = {}, leftChildParam = {};
 351+ leftParam[ $.wikiEditor.modules.toc.cfg.flexProperty ] = parseFloat( openWidth ) * -1;
 352+ leftChildParam[ $.wikiEditor.modules.toc.cfg.flexProperty ] = openWidth;
343353 context.$ui.find( '.wikiEditor-ui-left' )
344 - .animate( { 'marginRight': ( parseFloat( openWidth ) * -1 ) }, 'fast' )
 354+ .animate( leftParam, 'fast' )
345355 .children()
346 - .animate( { 'marginRight': openWidth }, 'fast' );
 356+ .animate( leftChildParam, 'fast' );
347357 context.$ui.find( '.wikiEditor-ui-right' )
348358 .show()
349359 .css( 'marginTop', '1px' )
@@ -400,6 +410,10 @@
401411 var div = $( '<div />' )
402412 .addClass( 'section-' + structure[i].index )
403413 .data( 'index', structure[i].index )
 414+ .mousedown( function() {
 415+ // No dragging!
 416+ return false;
 417+ } )
404418 .click( function( event ) {
405419 var wrapper = context.$content.find(
406420 '.wikiEditor-toc-section-' + $( this ).data( 'index' ) );
@@ -439,6 +453,10 @@
440454 .addClass( 'tab' )
441455 .addClass( 'tab-toc' )
442456 .append( '<a href="#" />' )
 457+ .mousedown( function() {
 458+ // No dragging!
 459+ return false;
 460+ } )
443461 .bind( 'click.wikiEditor-toc', function() {
444462 context.modules.toc.$toc.trigger( 'collapse.wikiEditor-toc' ); return false;
445463 } )
@@ -447,6 +465,10 @@
448466 $expandControl
449467 .addClass( 'wikiEditor-ui-toc-expandControl' )
450468 .append( '<a href="#" />' )
 469+ .mousedown( function() {
 470+ // No dragging!
 471+ return false;
 472+ } )
451473 .bind( 'click.wikiEditor-toc', function() {
452474 context.modules.toc.$toc.trigger( 'expand.wikiEditor-toc' ); return false;
453475 } )
@@ -492,8 +514,9 @@
493515 // for some odd reason, ui.size.width seems a step ahead of what the *actual* width of
494516 // the resizable is
495517 $( this ).css( { 'width': ui.size.width, 'top': 'auto', 'height': 'auto' } )
496 - .data( 'wikiEditor-ui-left' ).css( 'marginRight', ( -1 * ui.size.width ) )
497 - .children().css( 'marginRight', ui.size.width );
 518+ .data( 'wikiEditor-ui-left' )
 519+ .css( $.wikiEditor.modules.toc.cfg.flexProperty, ( -1 * ui.size.width ) )
 520+ .children().css( $.wikiEditor.modules.toc.cfg.flexProperty, ui.size.width );
498521 // Let the UI know things have moved around
499522 context.fn.trigger( 'resize' );
500523 },
Index: branches/wmf-deployment/extensions/UsabilityInitiative/UsabilityInitiative.hooks.php
@@ -21,19 +21,19 @@
2222 array( 'src' => 'css/suggestions.css', 'version' => 6 ),
2323 array( 'src' => 'css/vector.collapsibleNav.css', 'version' => 7 ),
2424 array( 'src' => 'css/vector.footerCleanup.css', 'version' => 1 ),
25 - array( 'src' => 'css/wikiEditor.css', 'version' => 9 ),
 25+ array( 'src' => 'css/wikiEditor.css', 'version' => 11 ),
2626 array( 'src' => 'css/wikiEditor.dialogs.css', 'version' => 19 ),
2727 array( 'src' => 'css/wikiEditor.preview.css', 'version' => 1 ),
2828 array( 'src' => 'css/wikiEditor.toc.css', 'version' => 28 ),
29 - array( 'src' => 'css/wikiEditor.toolbar.css', 'version' => 10 ),
 29+ array( 'src' => 'css/wikiEditor.toolbar.css', 'version' => 11 ),
3030 array( 'src' => 'css/vector/jquery-ui-1.7.2.css', 'version' => '1.7.2y' ),
3131 ),
3232 'combined' => array(
33 - array( 'src' => 'css/combined.css', 'version' => 63 ),
 33+ array( 'src' => 'css/combined.css', 'version' => 66 ),
3434 array( 'src' => 'css/vector/jquery-ui-1.7.2.css', 'version' => '1.7.2y' ),
3535 ),
3636 'minified' => array(
37 - array( 'src' => 'css/combined.min.css', 'version' => 63 ),
 37+ array( 'src' => 'css/combined.min.css', 'version' => 66 ),
3838 array( 'src' => 'css/vector/jquery-ui-1.7.2.css', 'version' => '1.7.2y' ),
3939 ),
4040 )
@@ -72,20 +72,20 @@
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' => 27 ),
76 - array( 'src' => 'js/plugins/jquery.wikiEditor.js', 'version' => 112 ),
 76+ array( 'src' => 'js/plugins/jquery.wikiEditor.js', 'version' => 118 ),
7777 array( 'src' => 'js/plugins/jquery.wikiEditor.highlight.js', 'version' => 29 ),
78 - array( 'src' => 'js/plugins/jquery.wikiEditor.toolbar.js', 'version' => 47 ),
 78+ array( 'src' => 'js/plugins/jquery.wikiEditor.toolbar.js', 'version' => 48 ),
7979 array( 'src' => 'js/plugins/jquery.wikiEditor.dialogs.js', 'version' => 12 ),
80 - array( 'src' => 'js/plugins/jquery.wikiEditor.toc.js', 'version' => 80 ),
 80+ array( 'src' => 'js/plugins/jquery.wikiEditor.toc.js', 'version' => 81 ),
8181 array( 'src' => 'js/plugins/jquery.wikiEditor.preview.js', 'version' => 10 ),
8282 array( 'src' => 'js/plugins/jquery.wikiEditor.templateEditor.js', 'version' => 17 ),
8383 array( 'src' => 'js/plugins/jquery.wikiEditor.publish.js', 'version' => 2 ),
8484 ),
8585 'combined' => array(
86 - array( 'src' => 'js/plugins.combined.js', 'version' => 230 ),
 86+ array( 'src' => 'js/plugins.combined.js', 'version' => 238 ),
8787 ),
8888 'minified' => array(
89 - array( 'src' => 'js/plugins.combined.min.js', 'version' => 230 ),
 89+ array( 'src' => 'js/plugins.combined.min.js', 'version' => 238 ),
9090 ),
9191 ),
9292 );
Index: branches/wmf-deployment/extensions/UsabilityInitiative/ClickTracking/ClickTracking.i18n.php
@@ -1111,7 +1111,16 @@
11121112 'clicktracking-desc' => 'Pengesanan klik, bertujuan untuk mengesan peristiwa-peristiwa yang tidak menyebabkan penyegaran semula sebuah laman.',
11131113 'ct-title' => 'Klik pengguna teragregat',
11141114 'ct-event-name' => 'Nama peristiwa',
 1115+ 'ct-expert-header' => 'Klik "pakar"',
 1116+ 'ct-intermediate-header' => 'Klik "pertengahan"',
 1117+ 'ct-beginner-header' => 'Klik "pemula"',
11151118 'ct-total-header' => 'Jumlah klik',
 1119+ 'ct-change-graph' => 'Tukar graf',
 1120+ 'ct-beginner' => 'Pemula',
 1121+ 'ct-intermediate' => 'Pertengahan',
 1122+ 'ct-expert' => 'Pakar',
 1123+ 'ct-date-range' => 'Julat tarikh',
 1124+ 'ct-editing' => 'Sedang menyunting:',
11161125 'ct-anon-users' => 'Pengguna tanpa nama',
11171126 );
11181127
Index: branches/wmf-deployment/extensions/UsabilityInitiative/css/combined.css
@@ -225,7 +225,26 @@
226226 .wikiEditor-view-wikitext {
227227 line-height: 1em;
228228 }
229 -/* wikiEditor dialogs module */
 229+.wikiEditor-ui-loading {
 230+ background: #f3f3f3;
 231+ z-index: 10;
 232+ position: absolute;
 233+ top: 0;
 234+ left: 0;
 235+ text-align: center;
 236+ height: 100%;
 237+ width: 100%;
 238+ border: 1px solid silver;
 239+ margin: -1px;
 240+}
 241+.wikiEditor-ui-loading span {
 242+ display: block;
 243+ height: 24px;
 244+ width: 24px;
 245+ background: url( ../images/wikiEditor/toolbar/loading.gif ) 0 0 no-repeat;
 246+ text-indent: -9999px;
 247+ margin: 0 auto;
 248+}/* wikiEditor dialogs module */
230249
231250 .wikiEditor-toolbar-dialog table {
232251 margin-top: 0.75em;
@@ -921,7 +940,7 @@
922941 white-space: nowrap;
923942 }
924943 .wikiEditor-ui-toolbar .group .tool-select .options .option:hover {
925 - background-color: #f3f3f3;
 944+ background-color: #E0EEf7;
926945 }
927946 .wikiEditor-ui-toolbar .group .tool-select .options .option[rel=heading-2] {
928947 font-size: 150%;
Index: branches/wmf-deployment/extensions/UsabilityInitiative/css/combined.min.css
@@ -215,6 +215,26 @@
216216 .wikiEditor-view-wikitext{
217217 line-height:1em;
218218 }
 219+.wikiEditor-ui-loading{
 220+background:#f3f3f3;
 221+z-index:10;
 222+position:absolute;
 223+top:0;
 224+left:0;
 225+text-align:center;
 226+height:100%;
 227+width:100%;
 228+border:1px solid silver;
 229+margin:-1px;
 230+}
 231+.wikiEditor-ui-loading span{
 232+display:block;
 233+height:24px;
 234+width:24px;
 235+background:url( ../images/wikiEditor/toolbar/loading.gif ) 0 0 no-repeat;
 236+text-indent:-9999px;
 237+margin:0 auto;
 238+}
219239 .wikiEditor-toolbar-dialog table{
220240 margin-top:0.75em;
221241 }
@@ -866,7 +886,7 @@
867887 white-space:nowrap;
868888 }
869889 .wikiEditor-ui-toolbar .group .tool-select .options .option:hover{
870 -background-color:#f3f3f3;
 890+background-color:#E0EEf7;
871891 }
872892 .wikiEditor-ui-toolbar .group .tool-select .options .option[rel=heading-2]{
873893 font-size:150%;
Index: branches/wmf-deployment/extensions/UsabilityInitiative/css/wikiEditor.css
@@ -112,3 +112,23 @@
113113 .wikiEditor-view-wikitext {
114114 line-height: 1em;
115115 }
 116+.wikiEditor-ui-loading {
 117+ background: #f3f3f3;
 118+ z-index: 10;
 119+ position: absolute;
 120+ top: 0;
 121+ left: 0;
 122+ text-align: center;
 123+ height: 100%;
 124+ width: 100%;
 125+ border: 1px solid silver;
 126+ margin: -1px;
 127+}
 128+.wikiEditor-ui-loading span {
 129+ display: block;
 130+ height: 24px;
 131+ width: 24px;
 132+ background: url( ../images/wikiEditor/toolbar/loading.gif ) 0 0 no-repeat;
 133+ text-indent: -9999px;
 134+ margin: 0 auto;
 135+}
\ No newline at end of file
Index: branches/wmf-deployment/extensions/UsabilityInitiative/css/wikiEditor.toolbar.css
@@ -234,7 +234,7 @@
235235 white-space: nowrap;
236236 }
237237 .wikiEditor-ui-toolbar .group .tool-select .options .option:hover {
238 - background-color: #f3f3f3;
 238+ background-color: #E0EEf7;
239239 }
240240 .wikiEditor-ui-toolbar .group .tool-select .options .option[rel=heading-2] {
241241 font-size: 150%;
Index: branches/wmf-deployment/extensions/UsabilityInitiative/OptIn/OptIn.i18n.php
@@ -1017,6 +1017,7 @@
10181018 * @author Lloffiwr
10191019 */
10201020 $messages['cy'] = array(
 1021+ 'optin' => "Ymuno â'r Cynllun Defnyddioldeb",
10211022 'optin-desc' => "Yn gadael i ddefnyddwyr arbrofi gyda'r fersiwn Beta, sy'n cynnwys gwelliannau diweddaraf y Cynllun Defnyddioldeb.",
10221023 'optin-title-optedout' => 'Rhowch gynnig ar Beta',
10231024 'optin-title-optedin' => 'Gadael Beta',
@@ -1047,6 +1048,7 @@
10481049 'optin-survey-question-whyoptout' => "Pam ydych chi'n gadael Beta? (Dewiswch pob rheswm perthnasol.)",
10491050 'optin-survey-answer-whyoptout-hard' => "Roedd yn rhy annodd i'w ddefnyddio.",
10501051 'optin-survey-answer-whyoptout-didntwork' => "Doedd e ddim yn gweithio'n iawn.",
 1052+ 'optin-survey-answer-whyoptout-notpredictable' => "Roedd yn gweithredu'n fympwyol.",
10511053 'optin-survey-answer-whyoptout-didntlike-look' => 'Doeddwn i ddim yn hoffi golwg Beta.',
10521054 'optin-survey-answer-whyoptout-didntlike-layout' => "Doeddwn i ddim yn hoffi'r tabiau a'r gosodiad newydd.",
10531055 'optin-survey-answer-whyoptout-didntlike-toolbar' => "Doeddwn i ddim yn hoffi'r bar offer newydd.",
@@ -1062,6 +1064,7 @@
10631065 'optin-survey-answer-changes-nav' => "Gwneud yr offer llywio ar y wefan yn haws i'w defnyddio.",
10641066 'optin-survey-answer-changes-edittools' => "Cynyddu a gwella'r offer golygu.",
10651067 'optin-survey-answer-changes-upload' => 'Gwella uwchlwytho ffeiliau lluniau ag ati.',
 1068+ 'optin-survey-answer-changes-predictability' => 'Gwneud iddo weithredu yn y modd mwyaf dibynadwy posib.',
10661069 'optin-survey-answer-changes-custom' => "Ehangu'r nifer o ddewisiadau y gall defnyddiwr eu gosod fel ag a myn.",
10671070 'optin-improvements' => "== Beth sydd wedi ei wella? ==
10681071 [[File:UsabilityNavigation.png|left|link=|Llun o'r tabiau llywio newydd]]
@@ -5230,6 +5233,7 @@
52315234 'optin-survey-answer-whyoptout-didntlike-layout' => 'නව ටැබ හා වින්‍යාස සැලැස්ම මා සිත් ගත්තේ නැත.',
52325235 'optin-survey-answer-whyoptout-didntlike-toolbar' => 'නව මෙවලම්-පටිය මා සිත් ගත්තේ නැත.',
52335236 'optin-survey-answer-whyoptout-other' => 'වෙනත් හේතුවක්:',
 5237+ 'optin-survey-answer-changes-other' => 'වෙනත්:',
52345238 );
52355239
52365240 /** Slovak (Slovenčina)
Index: branches/wmf-deployment/extensions/UsabilityInitiative/OptIn/OptInLink.i18n.php
@@ -186,6 +186,7 @@
187187 'tooltip-pt-optin-try' => 'Rhoi cynnig ar y nodweddion newydd',
188188 'optin-leave' => 'Gadael Beta',
189189 'tooltip-pt-optin-leave' => "Gadael llonydd i'r nodweddion newydd",
 190+ 'optin-feedback' => 'Adborth Beta',
190191 'tooltip-pt-optin-feedback' => "Cynnig adborth ynghylch eich profiad o ddefnyddio'r nodweddion newydd",
191192 );
192193

Status & tagging log