r59923 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r59922‎ | r59923 | r59924 >
Date:01:56, 10 December 2009
Author:adam
Status:deferred
Tags:
Comment:
WikiEditor TOC - RTL fixes and adding a handler for wikiEditor ui resize events
Modified paths:
  • /trunk/extensions/UsabilityInitiative/UsabilityInitiative.hooks.php (modified) (history)
  • /trunk/extensions/UsabilityInitiative/WikiEditor/WikiEditor.combined.js (modified) (history)
  • /trunk/extensions/UsabilityInitiative/css/combined.css (modified) (history)
  • /trunk/extensions/UsabilityInitiative/css/combined.min.css (modified) (history)
  • /trunk/extensions/UsabilityInitiative/css/wikiEditor.toc.css (modified) (history)
  • /trunk/extensions/UsabilityInitiative/js/plugins.combined.js (modified) (history)
  • /trunk/extensions/UsabilityInitiative/js/plugins.combined.min.js (modified) (history)
  • /trunk/extensions/UsabilityInitiative/js/plugins/jquery.wikiEditor.toc.js (modified) (history)

Diff [purge]

Index: trunk/extensions/UsabilityInitiative/UsabilityInitiative.hooks.php
@@ -22,16 +22,16 @@
2323 array( 'src' => 'css/wikiEditor.css', 'version' => 7 ),
2424 array( 'src' => 'css/wikiEditor.toolbar.css', 'version' => 8 ),
2525 array( 'src' => 'css/wikiEditor.dialogs.css', 'version' => 6 ),
26 - array( 'src' => 'css/wikiEditor.toc.css', 'version' => 24 ),
 26+ array( 'src' => 'css/wikiEditor.toc.css', 'version' => 25 ),
2727 array( 'src' => 'css/wikiEditor.preview.css', 'version' => 1 ),
2828 array( 'src' => 'css/vector/jquery-ui-1.7.2.css', 'version' => '1.7.2y' ),
2929 ),
3030 'combined' => array(
31 - array( 'src' => 'css/combined.css', 'version' => 36 ),
 31+ array( 'src' => 'css/combined.css', 'version' => 37 ),
3232 array( 'src' => 'css/vector/jquery-ui-1.7.2.css', 'version' => '1.7.2y' ),
3333 ),
3434 'minified' => array(
35 - array( 'src' => 'css/combined.min.css', 'version' => 36 ),
 35+ array( 'src' => 'css/combined.min.css', 'version' => 37 ),
3636 array( 'src' => 'css/vector/jquery-ui-1.7.2.css', 'version' => '1.7.2y' ),
3737 ),
3838 )
@@ -74,16 +74,16 @@
7575 array( 'src' => 'js/plugins/jquery.wikiEditor.highlight.js', 'version' => 1 ),
7676 array( 'src' => 'js/plugins/jquery.wikiEditor.toolbar.js', 'version' => 36 ),
7777 array( 'src' => 'js/plugins/jquery.wikiEditor.dialogs.js', 'version' => 9 ),
78 - array( 'src' => 'js/plugins/jquery.wikiEditor.toc.js', 'version' => 48 ),
 78+ array( 'src' => 'js/plugins/jquery.wikiEditor.toc.js', 'version' => 49 ),
7979 array( 'src' => 'js/plugins/jquery.wikiEditor.preview.js', 'version' => 7 ),
8080 array( 'src' => 'js/plugins/jquery.wikiEditor.templateEditor.js', 'version' => 1 ),
8181 array( 'src' => 'js/plugins/jquery.wikiEditor.publish.js', 'version' => 0 ),
8282 ),
8383 'combined' => array(
84 - array( 'src' => 'js/plugins.combined.js', 'version' => 102 ),
 84+ array( 'src' => 'js/plugins.combined.js', 'version' => 103 ),
8585 ),
8686 'minified' => array(
87 - array( 'src' => 'js/plugins.combined.min.js', 'version' => 102 ),
 87+ array( 'src' => 'js/plugins.combined.min.js', 'version' => 103 ),
8888 ),
8989 ),
9090 );
Index: trunk/extensions/UsabilityInitiative/css/wikiEditor.toc.css
@@ -1,8 +1,4 @@
22 /* wikiEditor toc module */
3 -body.rtl .wikiEditor-ui-text {
4 - border-right: none;
5 - border-left: solid silver 1px;
6 -}
73 .wikiEditor-ui-toc {
84 /* height and width are set dynamically */
95 /*float: right;*/
@@ -10,17 +6,13 @@
117 overflow: auto;
128 overflow-x: hidden;
139 }
14 -body.rtl .wikiEditor-ui-toc {
15 - /*
16 - float: left;
17 - right: auto;
18 - left: -1px;
19 - border-left: none;
20 - */
21 -}
2210 .wikiEditor-ui-toc {
2311 border-left: solid silver 1px;
2412 }
 13+body.rtl .wikiEditor-ui-toc {
 14+ border-right: solid silver 1px;
 15+ border-left: none;
 16+}
2517 .wikiEditor-ui-toc ul {
2618 padding: 0;
2719 margin: 0;
@@ -31,10 +23,6 @@
3224 list-style-type: none;
3325 width: 100%;
3426 }
35 -body.rtl .wikiEditor-ui-toc ul {
36 - border-left: none;
37 - border-right: solid silver 1px;
38 -}
3927 .tab-toc {
4028 /* Should match the toolbar */
4129 background-image: url(../images/wikiEditor/toolbar/base.png);
@@ -50,7 +38,7 @@
5139 }
5240 body.rtl .tab-toc {
5341 background-position: right top;
54 - padding-right: 1em;
 42+ padding-right: 2em;
5543 }
5644 .tab-toc a {
5745 outline: none;
@@ -182,6 +170,9 @@
183171 background: url(../images/wikiEditor/toc/grip.png) 50% 50% no-repeat;
184172 z-index: 0;
185173 }
 174+body.rtl .wikiEditor-ui-right .wikiEditor-ui-toc-resize-grip {
 175+ right: 2px !important;
 176+}
186177 .wikiEditor-ui-toolbar .tab-toc {
187178 float: right;
188179 margin: 3px 16px 3px 3px;
Index: trunk/extensions/UsabilityInitiative/css/combined.css
@@ -193,10 +193,6 @@
194194 body.rtl .ui-dialog .ui-dialog-buttonpane button {
195195 float: left;
196196 }/* wikiEditor toc module */
197 -body.rtl .wikiEditor-ui-text {
198 - border-right: none;
199 - border-left: solid silver 1px;
200 -}
201197 .wikiEditor-ui-toc {
202198 /* height and width are set dynamically */
203199 /*float: right;*/
@@ -204,17 +200,13 @@
205201 overflow: auto;
206202 overflow-x: hidden;
207203 }
208 -body.rtl .wikiEditor-ui-toc {
209 - /*
210 - float: left;
211 - right: auto;
212 - left: -1px;
213 - border-left: none;
214 - */
215 -}
216204 .wikiEditor-ui-toc {
217205 border-left: solid silver 1px;
218206 }
 207+body.rtl .wikiEditor-ui-toc {
 208+ border-right: solid silver 1px;
 209+ border-left: none;
 210+}
219211 .wikiEditor-ui-toc ul {
220212 padding: 0;
221213 margin: 0;
@@ -225,10 +217,6 @@
226218 list-style-type: none;
227219 width: 100%;
228220 }
229 -body.rtl .wikiEditor-ui-toc ul {
230 - border-left: none;
231 - border-right: solid silver 1px;
232 -}
233221 .tab-toc {
234222 /* Should match the toolbar */
235223 background-image: url(../images/wikiEditor/toolbar/base.png);
@@ -244,7 +232,7 @@
245233 }
246234 body.rtl .tab-toc {
247235 background-position: right top;
248 - padding-right: 1em;
 236+ padding-right: 2em;
249237 }
250238 .tab-toc a {
251239 outline: none;
@@ -376,6 +364,9 @@
377365 background: url(../images/wikiEditor/toc/grip.png) 50% 50% no-repeat;
378366 z-index: 0;
379367 }
 368+body.rtl .wikiEditor-ui-right .wikiEditor-ui-toc-resize-grip {
 369+ right: 2px !important;
 370+}
380371 .wikiEditor-ui-toolbar .tab-toc {
381372 float: right;
382373 margin: 3px 16px 3px 3px;
Index: trunk/extensions/UsabilityInitiative/css/combined.min.css
@@ -181,26 +181,18 @@
182182 body.rtl .ui-dialog .ui-dialog-buttonpane button{
183183 float:left;
184184 }
185 -body.rtl .wikiEditor-ui-text{
186 -border-right:none;
187 -border-left:solid silver 1px;
188 -}
189185 .wikiEditor-ui-toc{
190186 padding:0;
191187 overflow:auto;
192188 overflow-x:hidden;
193189 }
194 -body.rtl .wikiEditor-ui-toc{
195 -/*
196 -float:left;
197 -right:auto;
198 -left:-1px;
199 -border-left:none;
200 -*/
201 -}
202190 .wikiEditor-ui-toc{
203191 border-left:solid silver 1px;
204192 }
 193+body.rtl .wikiEditor-ui-toc{
 194+border-right:solid silver 1px;
 195+border-left:none;
 196+}
205197 .wikiEditor-ui-toc ul{
206198 padding:0;
207199 margin:0;
@@ -210,10 +202,6 @@
211203 list-style-type:none;
212204 width:100%;
213205 }
214 -body.rtl .wikiEditor-ui-toc ul{
215 -border-left:none;
216 -border-right:solid silver 1px;
217 -}
218206 .tab-toc{
219207 background-image:url(../images/wikiEditor/toolbar/base.png);
220208 background-position:left top;
@@ -228,7 +216,7 @@
229217 }
230218 body.rtl .tab-toc{
231219 background-position:right top;
232 -padding-right:1em;
 220+padding-right:2em;
233221 }
234222 .tab-toc a{
235223 outline:none;
@@ -352,6 +340,9 @@
353341 background:url(../images/wikiEditor/toc/grip.png) 50% 50% no-repeat;
354342 z-index:0;
355343 }
 344+body.rtl .wikiEditor-ui-right .wikiEditor-ui-toc-resize-grip{
 345+right:2px !important;
 346+}
356347 .wikiEditor-ui-toolbar .tab-toc{
357348 float:right;
358349 margin:3px 16px 3px 3px;
Index: trunk/extensions/UsabilityInitiative/WikiEditor/WikiEditor.combined.js
@@ -1704,7 +1704,7 @@
17051705 if ( !wgWikiEditorPreferences || !( wgWikiEditorPreferences.templateEditor && wgWikiEditorPreferences.templateEditor.enable ) ) {
17061706 return true;
17071707 }
1708 - // Add the highlight module
 1708+ // Add the templateEditor module
17091709 if ( $j.wikiEditor ) {
17101710 $j( 'textarea#wpTextbox1' ).wikiEditor( 'addModule', 'templateEditor' );
17111711 }
Index: trunk/extensions/UsabilityInitiative/js/plugins/jquery.wikiEditor.toc.js
@@ -1,6 +1,6 @@
22 /* TOC Module for wikiEditor */
33 ( function( $ ) { $.wikiEditor.modules.toc = {
4 -
 4+
55 /**
66 * Default width of table of contents
77 */
@@ -40,6 +40,12 @@
4141 context.$textarea.delayedBindCancel( 250, 'mouseup scrollToTop keyup change' );
4242 $.wikiEditor.modules.toc.fn.unhighlight( context );
4343 });
 44+ },
 45+ resize: function( context, event ) {
 46+ context.modules.toc.$toc.height(
 47+ context.$ui.find( '.wikiEditor-ui-left' ).height() -
 48+ context.$ui.find( '.tab-toc' ).outerHeight()
 49+ );
4450 }
4551 },
4652 /**
@@ -255,6 +261,7 @@
256262 .text( gM( 'wikieditor-toc-show' ) );
257263 $collapseControl.insertBefore( context.modules.toc.$toc );
258264 context.$ui.find( '.wikiEditor-ui-left .wikiEditor-ui-top' ).append( $expandControl );
 265+ context.fn.trigger( 'resize' );
259266 }
260267 /**
261268 * Initializes resizing controls on the TOC and sets the width of
@@ -299,9 +306,10 @@
300307 }
301308 });
302309 // Convert our east resize handle into a secondary west resize handle
303 - context.$ui.find( '.ui-resizable-e' )
304 - .removeClass( 'ui-resizable-e' )
305 - .addClass( 'ui-resizable-w' )
 310+ var handle = $j( 'body' ).is( '.rtl' ) ? 'w' : 'e'
 311+ context.$ui.find( '.ui-resizable-' + handle )
 312+ .removeClass( 'ui-resizable-' + handle )
 313+ .addClass( 'ui-resizable-' + ( handle == 'w' ? 'e' : 'w' ) )
306314 .addClass( 'wikiEditor-ui-toc-resize-grip' );
307315 // Bind collapse and expand event handlers to the TOC
308316 context.modules.toc.$toc
Index: trunk/extensions/UsabilityInitiative/js/plugins.combined.js
@@ -1515,6 +1515,7 @@
15161516 }
15171517 };
15181518 // Allow modules to extend the API
 1519+ if($.wikiEditor.modules){
15191520 for ( module in $.wikiEditor.modules ) {
15201521 if ( 'api' in $.wikiEditor.modules[module] ) {
15211522 for ( call in $.wikiEditor.modules[module].api ) {
@@ -1525,7 +1526,7 @@
15261527 }
15271528 }
15281529 }
1529 - }
 1530+ }}
15301531
15311532 /*
15321533 * Event Handlers
@@ -1562,6 +1563,7 @@
15631564
15641565 /* Internal Functions */
15651566
 1567+ //$(this).data( 'wikiEditor-context', context );
15661568 context.fn = {
15671569 'trigger': function( name, event ) {
15681570 // Event is an optional argument, but from here on out, at least the type field should be dependable
@@ -1648,7 +1650,11 @@
16491651 context.$content = $( context.$iframe[0].contentWindow.document.body );
16501652 // We need to properly escape any HTML entities like &, < and > so they end up as visible
16511653 // characters rather than actual HTML tags in the code editor container.
1652 - context.$content.append( $( '<div />' ).text( context.$textarea.val() ).html() );
 1654+
 1655+ context.$content.append(
 1656+ context.$textarea.val().replace( /</g, '&lt;' ).replace( />/g, '&gt;' )
 1657+ );
 1658+
16531659 // Reflect direction of parent frame into child
16541660 if ( $( 'body' ).is( '.rtl' ) ) {
16551661 context.$content.addClass( 'rtl' ).attr( 'dir', 'rtl' );
@@ -1673,12 +1679,13 @@
16741680 * Gets the complete contents of the iframe
16751681 */
16761682 'getContents': function() {
 1683+ // FIXME: Evil ua-sniffing action!
 1684+ if ( $.browser.name == 'msie' ) {
 1685+ return context.$content.text();
 1686+ }
16771687 // We use .html() instead of .text() so HTML entities are handled right
16781688 // Setting the HTML of the textarea doesn't work on all browsers, use a dummy <div> instead
1679 -
1680 - return $( '<div />' )
1681 - .html( context.$content.html().replace( /\<br\>/g, "\n" ) )
1682 - .text();
 1689+ return $( '<div />' ).html( context.$content.html().replace( /\<br\>/g, "\n" ) ).text();
16831690 },
16841691 'setContents': function( options ) {
16851692 context.$content.text( options.contents );
@@ -2106,7 +2113,7 @@
21072114 * Internally used event handlers
21082115 */
21092116 evt: {
2110 - change: function( event ) {
 2117+ change: function( context, event ) {
21112118 /*
21122119 * Triggered on any of the following events, with the intent on detecting if something was added, deleted or
21132120 * replaced due to user action.
@@ -2129,8 +2136,13 @@
21302137 * ; Definition
21312138 * : Definition
21322139 */
 2140+ if(event.data.scope == 'do_not_trigger'){
 2141+ $.wikiEditor.modules.highlight.fn.scan(context, "");
 2142+ $.wikiEditor.modules.highlight.fn.mark(context, "", "");
 2143+ }
21332144 }
21342145 },
 2146+
21352147 /**
21362148 * Internally used functions
21372149 */
@@ -2157,17 +2169,75 @@
21582170 strip: function( context, division ) {
21592171 return $( '<div />' ).html( division.html().replace( /\<br[^\>]*\>/g, "\n" ) ).text();
21602172 },
 2173+ tokenArray : [],
21612174 scan: function( context, division ) {
21622175 /*
21632176 * We need to look over some text and find interesting areas, then return the positions of those areas as tokens
21642177 */
2165 - return []; // array of tokens?
 2178+ token = function(offset, label){
 2179+ this.offset = offset;
 2180+ this.label = label;
 2181+ }
 2182+
 2183+ this.tokenArray = new Array();
 2184+ var text = context.fn.getContents();
 2185+ for ( module in $.wikiEditor.modules ) {
 2186+ if ( 'exp' in $.wikiEditor.modules[module] ) {
 2187+ for(var i = 0; i < $.wikiEditor.modules[module].exp.length; i++){
 2188+ var regex = $.wikiEditor.modules[module].exp[i].regex;
 2189+ var label = $.wikiEditor.modules[module].exp[i].label;
 2190+ var markAfter = false;
 2191+ if(typeof($.wikiEditor.modules[module].exp[i].markAfter) != 'undefined'){
 2192+ markAfter = true;
 2193+ }
 2194+ match = text.match(regex);
 2195+ var oldOffset = 0;
 2196+ while(match != null){
 2197+ var markOffset = 0;
 2198+ if(markAfter){
 2199+ markOffset += match[0].length;
 2200+ }
 2201+ this.tokenArray.push(new token(match.index + oldOffset + markOffset, label));
 2202+ oldOffset += (match.index + match[0].length);
 2203+ newSubstring = text.substring(oldOffset);
 2204+ match = newSubstring.match(regex);
 2205+ }
 2206+ }
 2207+ }
 2208+ }
 2209+
 2210+ return this.tokenArray; // array of tokens
21662211 },
 2212+ markers: [],
21672213 mark: function( context, division, tokens ) {
21682214 /*
21692215 * We need to markup some text based on some tokens
21702216 */
2171 - }
 2217+ var rawText = context.fn.getContents();
 2218+
 2219+
 2220+ //get all markers
 2221+ for ( module in $.wikiEditor.modules ) {
 2222+ if ( 'evt' in $.wikiEditor.modules[module] && 'mark' in $.wikiEditor.modules[module].evt) {
 2223+ $.wikiEditor.modules[module].evt.mark();
 2224+ }
 2225+ }
 2226+ markedText = "";
 2227+ var previousIndex = 0;
 2228+ for(var currentIndex in this.markers){
 2229+ markedText+= rawText.substring(previousIndex, currentIndex);
 2230+
 2231+ for(var i = 0 ; i < this.markers[currentIndex].length; i++){
 2232+ markedText += this.markers[currentIndex][i];
 2233+ }
 2234+
 2235+ previousIndex = currentIndex;
 2236+ }
 2237+ if(markedText != ""){
 2238+ markedText.replace(/\n/g, '<br\>');
 2239+ context.fn.setContents({contents:markedText});
 2240+ }
 2241+ }//endmark
21722242 }
21732243
21742244 }; })( jQuery );/* Preview module for wikiEditor */
@@ -2429,7 +2499,7 @@
24302500
24312501 }; } )( jQuery );/* TOC Module for wikiEditor */
24322502 ( function( $ ) { $.wikiEditor.modules.toc = {
2433 -
 2503+
24342504 /**
24352505 * Default width of table of contents
24362506 */
@@ -2469,6 +2539,12 @@
24702540 context.$textarea.delayedBindCancel( 250, 'mouseup scrollToTop keyup change' );
24712541 $.wikiEditor.modules.toc.fn.unhighlight( context );
24722542 });
 2543+ },
 2544+ resize: function( context, event ) {
 2545+ context.modules.toc.$toc.height(
 2546+ context.$ui.find( '.wikiEditor-ui-left' ).height() -
 2547+ context.$ui.find( '.tab-toc' ).outerHeight()
 2548+ );
24732549 }
24742550 },
24752551 /**
@@ -2684,6 +2760,7 @@
26852761 .text( gM( 'wikieditor-toc-show' ) );
26862762 $collapseControl.insertBefore( context.modules.toc.$toc );
26872763 context.$ui.find( '.wikiEditor-ui-left .wikiEditor-ui-top' ).append( $expandControl );
 2764+ context.fn.trigger( 'resize' );
26882765 }
26892766 /**
26902767 * Initializes resizing controls on the TOC and sets the width of
@@ -2728,9 +2805,10 @@
27292806 }
27302807 });
27312808 // Convert our east resize handle into a secondary west resize handle
2732 - context.$ui.find( '.ui-resizable-e' )
2733 - .removeClass( 'ui-resizable-e' )
2734 - .addClass( 'ui-resizable-w' )
 2809+ var handle = $j( 'body' ).is( '.rtl' ) ? 'w' : 'e'
 2810+ context.$ui.find( '.ui-resizable-' + handle )
 2811+ .removeClass( 'ui-resizable-' + handle )
 2812+ .addClass( 'ui-resizable-' + ( handle == 'w' ? 'e' : 'w' ) )
27352813 .addClass( 'wikiEditor-ui-toc-resize-grip' );
27362814 // Bind collapse and expand event handlers to the TOC
27372815 context.modules.toc.$toc
Index: trunk/extensions/UsabilityInitiative/js/plugins.combined.min.js
@@ -89,7 +89,7 @@
9090 if(property in object){return object[property];}else if(property+'Msg'in object){return gM(object[property+'Msg']);}else{return'';}},'getIcon':function(icon,path,lang){lang=lang||wgUserLanguage;path=path||$.wikiEditor.imgPath;var src=icon[lang]||icon['default']||icon;if(src.substr(0,7)!='http://'&&src.substr(0,8)!='https://'&&src[0]!='/')
9191 src=path+src;return src+'?'+wgWikiEditorIconVersion;},'fixOperaBrokenness':function(s){return s;}};$.fn.wikiEditor=function(){if($j.wikiEditor.isSupportKnown()&&!$j.wikiEditor.isSupported()){return $(this);}
9292 var context=$(this).data('wikiEditor-context');if(typeof context=='undefined'){var instance=$.wikiEditor.instances.length;context={'$textarea':$(this),'views':{},'modules':{},'data':{},'instance':instance};$.wikiEditor.instances[instance]=$(this);context.api={'addModule':function(context,data){function callModuleApi(module,call,data){if(module in $.wikiEditor.modules&&'fn'in $.wikiEditor.modules[module]&&call in $.wikiEditor.modules[module].fn){context.modules[module]={};$.wikiEditor.modules[module].fn[call](context,data);}}
93 -if(typeof data=='string'){callModuleApi(data,'create',{});}else if(typeof data=='object'){for(module in data){if(typeof module=='string'){callModuleApi(module,'create',data[module]);}}}}};for(module in $.wikiEditor.modules){if('api'in $.wikiEditor.modules[module]){for(call in $.wikiEditor.modules[module].api){if(!(call in context.api)){context.api[call]=$.wikiEditor.modules[module].api[call];}}}}
 93+if(typeof data=='string'){callModuleApi(data,'create',{});}else if(typeof data=='object'){for(module in data){if(typeof module=='string'){callModuleApi(module,'create',data[module]);}}}}};if($.wikiEditor.modules){for(module in $.wikiEditor.modules){if('api'in $.wikiEditor.modules[module]){for(call in $.wikiEditor.modules[module].api){if(!(call in context.api)){context.api[call]=$.wikiEditor.modules[module].api[call];}}}}}
9494 context.evt={'change':function(event){switch(event.type){case'keypress':if(true){event.data.scope='division';}else{event.data.scope='character';}
9595 break;case'mousedown':if(true){event.data.scope='division';}else{return false;}
9696 break;default:event.data.scope='division';break;}
@@ -99,8 +99,9 @@
100100 for(module in context.modules){if(module in $.wikiEditor.modules&&'evt'in $.wikiEditor.modules[module]&&name in $.wikiEditor.modules[module].evt){$.wikiEditor.modules[module].evt[name](context,event);}}},'addButton':function(options){context.$controls.show();context.$buttons.show();return $('<button />').text($.wikiEditor.autoMsg(options,'caption')).click(options.action).appendTo(context.$buttons);},'addView':function(options){function addTab(options){context.$controls.show();context.$tabs.show();return $('<div></div>').attr('rel','wikiEditor-ui-view-'+options.name).addClass(context.view==options.name?'current':null).append($('<a></a>').attr('href','#').click(function(event){context.$ui.find('.wikiEditor-ui-view').hide();context.$ui.find('.'+$(this).parent().attr('rel')).show();context.$tabs.find('div').removeClass('current');$(this).parent().addClass('current');$(this).blur();if('init'in options&&typeof options.init=='function'){options.init(context);}
101101 event.preventDefault();return false;}).text($.wikiEditor.autoMsg(options,'title'))).appendTo(context.$tabs);}
102102 if(!context.$tabs.children().size()){addTab({'name':'wikitext','titleMsg':'wikieditor-wikitext-tab'});}
103 -addTab(options);return $('<div></div>').addClass('wikiEditor-ui-view wikiEditor-ui-view-'+options.name).hide().appendTo(context.$ui);},'setup':function(){context.$iframe[0].contentWindow.document.designMode='on';context.$content=$(context.$iframe[0].contentWindow.document.body);context.$content.append($('<div />').text(context.$textarea.val()).html());if($('body').is('.rtl')){context.$content.addClass('rtl').attr('dir','rtl');}
104 -context.$textarea.attr('disabled',true);context.$textarea.hide();context.$iframe.show();context.fn.trigger('ready');},'isSetup':function(){return context.$content!=undefined&&context.$content[0].innerHTML!=undefined;},'getContents':function(){return $('<div />').html(context.$content.html().replace(/\<br\>/g,"\n")).text();},'setContents':function(options){context.$content.text(options.contents);return context.$textarea;},'getSelection':function(){var retval;if(context.$iframe[0].contentWindow.getSelection){retval=context.$iframe[0].contentWindow.getSelection();}else if(context.$iframe[0].contentWindow.document.selection){retval=context.$iframe[0].contentWindow.document.selection.createRange();}
 103+addTab(options);return $('<div></div>').addClass('wikiEditor-ui-view wikiEditor-ui-view-'+options.name).hide().appendTo(context.$ui);},'setup':function(){context.$iframe[0].contentWindow.document.designMode='on';context.$content=$(context.$iframe[0].contentWindow.document.body);context.$content.append(context.$textarea.val().replace(/</g,'&lt;').replace(/>/g,'&gt;'));if($('body').is('.rtl')){context.$content.addClass('rtl').attr('dir','rtl');}
 104+context.$textarea.attr('disabled',true);context.$textarea.hide();context.$iframe.show();context.fn.trigger('ready');},'isSetup':function(){return context.$content!=undefined&&context.$content[0].innerHTML!=undefined;},'getContents':function(){if($.browser.name=='msie'){return context.$content.text();}
 105+return $('<div />').html(context.$content.html().replace(/\<br\>/g,"\n")).text();},'setContents':function(options){context.$content.text(options.contents);return context.$textarea;},'getSelection':function(){var retval;if(context.$iframe[0].contentWindow.getSelection){retval=context.$iframe[0].contentWindow.getSelection();}else if(context.$iframe[0].contentWindow.document.selection){retval=context.$iframe[0].contentWindow.document.selection.createRange();}
105106 if(retval.text){retval=retval.text;}else if(retval.toString){retval=retval.toString();}
106107 return retval;},'encapsulateSelection':function(options){var selText=$(this).textSelection('getSelection');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+=' ';}
107108 var range=context.$iframe[0].contentWindow.getSelection().getRangeAt(0);if(options.ownline){if(range.startOffset!=0)
@@ -123,7 +124,14 @@
124125 dialogDiv.bind('dialogopen',$.wikiEditor.modules.dialogs.fn.resize).find('.ui-tabs').bind('tabsshow',function(){$(this).closest('.ui-dialog-content').each($.wikiEditor.modules.dialogs.fn.resize);});var maxTI=0;$j('[tabindex]').each(function(){var ti=parseInt($j(this).attr('tabindex'));if(ti>maxTI)
125126 maxTI=ti;});var tabIndex=maxTI+1;$j('.ui-dialog input, .ui-dialog button').not('[tabindex]').each(function(){$j(this).attr('tabindex',tabIndex++);});}}});},resize:function(){var wrapper=$(this).closest('.ui-dialog');var oldWidth=wrapper.width();var oldHidden=$(this).find('*').not(':visible');oldHidden.each(function(){$(this).data('oldstyle',$(this).attr('style'));});oldHidden.show();var oldWS=$(this).css('white-space');$(this).css('white-space','nowrap');if(wrapper.width()<=$(this).get(0).scrollWidth){var thisWidth=$(this).data('thisWidth')?$(this).data('thisWidth'):0;thisWidth=Math.max($(this).get(0).scrollWidth,thisWidth);$(this).width(thisWidth);$(this).data('thisWidth',thisWidth);var wrapperWidth=$(this).data('wrapperWidth')?$(this).data('wrapperWidth'):0;wrapperWidth=Math.max(wrapper.get(0).scrollWidth,wrapperWidth);wrapper.width(wrapperWidth);$(this).data('wrapperWidth',wrapperWidth);$(this).dialog({'width':wrapper.width()});wrapper.css('left',parseInt(wrapper.css('left'))-
126127 (wrapper.width()-oldWidth)/2);}
127 -$(this).css('white-space',oldWS);oldHidden.each(function(){$(this).attr('style',$(this).data('oldstyle'));});}},modules:{},quickDialog:function(body,settings){$('<div />').text(body).appendTo($('body')).dialog($.extend({bgiframe:true,modal:true},settings)).dialog('open');}};})(jQuery);(function($){$.wikiEditor.modules.highlight={api:{},evt:{change:function(event){}},fn:{create:function(context,config){},divide:function(context){},isolate:function(context){return[];},strip:function(context,division){return $('<div />').html(division.html().replace(/\<br[^\>]*\>/g,"\n")).text();},scan:function(context,division){return[];},mark:function(context,division,tokens){}}};})(jQuery);(function($){$.wikiEditor.modules.preview={api:{},fn:{create:function(context,config){if('initialized'in context.modules.preview){return;}
 128+$(this).css('white-space',oldWS);oldHidden.each(function(){$(this).attr('style',$(this).data('oldstyle'));});}},modules:{},quickDialog:function(body,settings){$('<div />').text(body).appendTo($('body')).dialog($.extend({bgiframe:true,modal:true},settings)).dialog('open');}};})(jQuery);(function($){$.wikiEditor.modules.highlight={api:{},evt:{change:function(context,event){if(event.data.scope=='do_not_trigger'){$.wikiEditor.modules.highlight.fn.scan(context,"");$.wikiEditor.modules.highlight.fn.mark(context,"","");}}},fn:{create:function(context,config){},divide:function(context){},isolate:function(context){return[];},strip:function(context,division){return $('<div />').html(division.html().replace(/\<br[^\>]*\>/g,"\n")).text();},tokenArray:[],scan:function(context,division){token=function(offset,label){this.offset=offset;this.label=label;}
 129+this.tokenArray=new Array();var text=context.fn.getContents();for(module in $.wikiEditor.modules){if('exp'in $.wikiEditor.modules[module]){for(var i=0;i<$.wikiEditor.modules[module].exp.length;i++){var regex=$.wikiEditor.modules[module].exp[i].regex;var label=$.wikiEditor.modules[module].exp[i].label;var markAfter=false;if(typeof($.wikiEditor.modules[module].exp[i].markAfter)!='undefined'){markAfter=true;}
 130+match=text.match(regex);var oldOffset=0;while(match!=null){var markOffset=0;if(markAfter){markOffset+=match[0].length;}
 131+this.tokenArray.push(new token(match.index+oldOffset+markOffset,label));oldOffset+=(match.index+match[0].length);newSubstring=text.substring(oldOffset);match=newSubstring.match(regex);}}}}
 132+return this.tokenArray;},markers:[],mark:function(context,division,tokens){var rawText=context.fn.getContents();for(module in $.wikiEditor.modules){if('evt'in $.wikiEditor.modules[module]&&'mark'in $.wikiEditor.modules[module].evt){$.wikiEditor.modules[module].evt.mark();}}
 133+markedText="";var previousIndex=0;for(var currentIndex in this.markers){markedText+=rawText.substring(previousIndex,currentIndex);for(var i=0;i<this.markers[currentIndex].length;i++){markedText+=this.markers[currentIndex][i];}
 134+previousIndex=currentIndex;}
 135+if(markedText!=""){markedText.replace(/\n/g,'<br\>');context.fn.setContents({contents:markedText});}}}};})(jQuery);(function($){$.wikiEditor.modules.preview={api:{},fn:{create:function(context,config){if('initialized'in context.modules.preview){return;}
128136 context.modules.preview={'initialized':true,'previewText':null,'changesText':null};context.modules.preview.$preview=context.fn.addView({'name':'preview','titleMsg':'wikieditor-preview-tab','init':function(context){var wikitext=context.fn.getContents();if(context.modules.preview.previewText==wikitext){return;}
129137 context.modules.preview.$preview.find('.wikiEditor-preview-contents').empty();context.modules.preview.$preview.find('.wikiEditor-preview-loading').show();$.post(wgScriptPath+'/api.php',{'action':'parse','title':wgPageName,'text':wikitext,'prop':'text','pst':'','format':'json'},function(data){if(typeof data.parse=='undefined'||typeof data.parse.text=='undefined'||typeof data.parse.text['*']=='undefined'){return;}
130138 context.modules.preview.previewText=wikitext;context.modules.preview.$preview.find('.wikiEditor-preview-loading').hide();context.modules.preview.$preview.find('.wikiEditor-preview-contents').html(data.parse.text['*']).find('a:not([href^=#])').click(function(){return false;});},'json');}});context.$changesTab=context.fn.addView({'name':'changes','titleMsg':'wikieditor-preview-changes-tab','init':function(context){var wikitext=context.fn.getContents();if(context.modules.preview.changesText==wikitext){return;}
@@ -153,7 +161,8 @@
154162 $('#wikiEditor-'+context.instance+'-dialog-minor').hide();else if($('#wpMinoredit').is(':checked'))
155163 $('#wikiEditor-'+context.instance+'-dialog-minor').attr('checked','checked');if($('#wpWatchthis').size()==0)
156164 $('#wikiEditor-'+context.instance+'-dialog-watch').hide();else if($('#wpWatchthis').is(':checked'))
157 -$('#wikiEditor-'+context.instance+'-dialog-watch').attr('checked','checked');$(this).find('form').submit(function(e){$(this).closest('.ui-dialog').find('button:first').click();e.preventDefault();});},dialog:{buttons:{'wikieditor-publish-dialog-publish':function(){var minorChecked=$('#wikiEditor-'+context.instance+'-dialog-minor').is(':checked')?'checked':'';var watchChecked=$('#wikiEditor-'+context.instance+'-dialog-watch').is(':checked')?'checked':'';$('#wpMinoredit').attr('checked',minorChecked);$('#wpWatchthis').attr('checked',watchChecked);$('#wpSummary').val($j('#wikiEditor-'+context.instance+'-dialog-summary').val());$('#editform').submit();},'wikieditor-publish-dialog-goback':function(){$(this).dialog('close');}},open:function(){$('#wikiEditor-'+context.instance+'-dialog-summary').focus();},width:500},resizeme:false}});context.fn.addButton({'captionMsg':'wikieditor-publish-button-publish','action':function(){$('#'+dialogID).dialog('open');return false;}});context.fn.addButton({'captionMsg':'wikieditor-publish-button-cancel','action':function(){}});}}};})(jQuery);(function($){$.wikiEditor.modules.toc={defaultWidth:'166px',minimumWidth:'70px',api:{},evt:{ready:function(context,event){$.wikiEditor.modules.toc.fn.build(context);context.$content.parent().delayedBind(250,'mouseup scrollToTop keyup change',function(){$(this).eachAsync({bulk:0,loop:function(){$.wikiEditor.modules.toc.fn.build(context);$.wikiEditor.modules.toc.fn.update(context);}});}).blur(function(event){var context=event.data.context;context.$textarea.delayedBindCancel(250,'mouseup scrollToTop keyup change');$.wikiEditor.modules.toc.fn.unhighlight(context);});}},fn:{create:function(context,config){if('$toc'in context.modules.toc){return;}
 165+$('#wikiEditor-'+context.instance+'-dialog-watch').attr('checked','checked');$(this).find('form').submit(function(e){$(this).closest('.ui-dialog').find('button:first').click();e.preventDefault();});},dialog:{buttons:{'wikieditor-publish-dialog-publish':function(){var minorChecked=$('#wikiEditor-'+context.instance+'-dialog-minor').is(':checked')?'checked':'';var watchChecked=$('#wikiEditor-'+context.instance+'-dialog-watch').is(':checked')?'checked':'';$('#wpMinoredit').attr('checked',minorChecked);$('#wpWatchthis').attr('checked',watchChecked);$('#wpSummary').val($j('#wikiEditor-'+context.instance+'-dialog-summary').val());$('#editform').submit();},'wikieditor-publish-dialog-goback':function(){$(this).dialog('close');}},open:function(){$('#wikiEditor-'+context.instance+'-dialog-summary').focus();},width:500},resizeme:false}});context.fn.addButton({'captionMsg':'wikieditor-publish-button-publish','action':function(){$('#'+dialogID).dialog('open');return false;}});context.fn.addButton({'captionMsg':'wikieditor-publish-button-cancel','action':function(){}});}}};})(jQuery);(function($){$.wikiEditor.modules.toc={defaultWidth:'166px',minimumWidth:'70px',api:{},evt:{ready:function(context,event){$.wikiEditor.modules.toc.fn.build(context);context.$content.parent().delayedBind(250,'mouseup scrollToTop keyup change',function(){$(this).eachAsync({bulk:0,loop:function(){$.wikiEditor.modules.toc.fn.build(context);$.wikiEditor.modules.toc.fn.update(context);}});}).blur(function(event){var context=event.data.context;context.$textarea.delayedBindCancel(250,'mouseup scrollToTop keyup change');$.wikiEditor.modules.toc.fn.unhighlight(context);});},resize:function(context,event){context.modules.toc.$toc.height(context.$ui.find('.wikiEditor-ui-left').height()-
 166+context.$ui.find('.tab-toc').outerHeight());}},fn:{create:function(context,config){if('$toc'in context.modules.toc){return;}
158167 var height=context.$ui.find('.wikiEditor-ui-left').height();context.modules.toc.$toc=$('<div />').addClass('wikiEditor-ui-toc').data('context',context);context.$ui.find('.wikiEditor-ui-right').css('width',$.wikiEditor.modules.toc.defaultWidth).append(context.modules.toc.$toc);context.modules.toc.$toc.height(context.$ui.find('.wikiEditor-ui-left').height());context.$ui.find('.wikiEditor-ui-left').css('marginRight',"-"+$.wikiEditor.modules.toc.defaultWidth).children().css('marginRight',$.wikiEditor.modules.toc.defaultWidth);},unhighlight:function(context){context.modules.toc.$toc.find('div').removeClass('current');},update:function(context){$.wikiEditor.modules.toc.fn.unhighlight(context);var position=context.$textarea.textSelection('getCaretPosition');var section=0;if(context.data.outline.length>0){if(!(position<context.data.outline[0].position-1)){while(section<context.data.outline.length&&context.data.outline[section].position-1<position){section++;}
159168 section=Math.max(0,section);}
160169 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)
@@ -166,9 +175,10 @@
167176 div.html('&nbsp;');var item=$('<li />').append(div);if(structure[i].sections!==undefined){item.append(buildList(structure[i].sections));}
168177 list.append(item);}
169178 return list;}
170 -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(gM('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(gM('wikieditor-toc-show'));$collapseControl.insertBefore(context.modules.toc.$toc);context.$ui.find('.wikiEditor-ui-left .wikiEditor-ui-top').append($expandControl);}
 179+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(gM('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(gM('wikieditor-toc-show'));$collapseControl.insertBefore(context.modules.toc.$toc);context.$ui.find('.wikiEditor-ui-left .wikiEditor-ui-top').append($expandControl);context.fn.trigger('resize');}
171180 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:50,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()-450);},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.minimumWidth)){context.modules.toc.$toc.trigger('collapse');}else{context.modules.toc.$toc.data('openWidth',ui.size.width);$.cookie('wikiEditor-'+context.instance+'-toc-width',ui.size.width);}
172 -context.fn.trigger('resize');}});context.$ui.find('.ui-resizable-e').removeClass('ui-resizable-e').addClass('ui-resizable-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.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.minimumWidth))
 181+context.fn.trigger('resize');}});var handle=$j('body').is('.rtl')?'w':'e'
 182+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.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.minimumWidth))
173183 initialWidth=parseFloat($.wikiEditor.modules.toc.minimumWidth)+1;context.modules.toc.$toc.data('openWidth',initialWidth+'px');context.$ui.find('.wikiEditor-ui-right').css('width',initialWidth+'px');context.$ui.find('.wikiEditor-ui-left').css('marginRight',(parseFloat(initialWidth)*-1)+'px').children().css('marginRight',initialWidth+'px');}}
174184 var outline=[],h=0;function traverseTextNodes(){if(this.nodeName!='#text'){$(this.childNodes).each(traverseTextNodes);return;}
175185 var text=this.nodeValue;var p=this;while(!p.previousSibling)

Status & tagging log