r57580 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r57579‎ | r57580 | r57581 >
Date:19:08, 9 October 2009
Author:catrope
Status:ok
Tags:
Comment:
NavigableTOC: (bug 21049) Cursor positioned wrongly when a header is a substring of the header before it (e.g. "===== Foo =====" followed by "== Foo =="). Also clean up the Makefile a little bit
Modified paths:
  • /trunk/extensions/UsabilityInitiative/Makefile (modified) (history)
  • /trunk/extensions/UsabilityInitiative/UsabilityInitiative.hooks.php (modified) (history)
  • /trunk/extensions/UsabilityInitiative/js/plugins.combined.js (modified) (history)
  • /trunk/extensions/UsabilityInitiative/js/plugins.combined.min.js (modified) (history)
  • /trunk/extensions/UsabilityInitiative/js/plugins/jquery.wikiEditor.toc.js (modified) (history)

Diff [purge]

Index: trunk/extensions/UsabilityInitiative/UsabilityInitiative.hooks.php
@@ -67,16 +67,16 @@
6868 array( 'src' => 'js/plugins/jquery.wikiEditor.js', 'version' => 12 ),
6969 array( 'src' => 'js/plugins/jquery.wikiEditor.toolbar.js', 'version' => 12 ),
7070 array( 'src' => 'js/plugins/jquery.wikiEditor.dialogs.js', 'version' => 4 ),
71 - array( 'src' => 'js/plugins/jquery.wikiEditor.toc.js', 'version' => 18 ),
 71+ array( 'src' => 'js/plugins/jquery.wikiEditor.toc.js', 'version' => 19 ),
7272 // FIXME: jQuery UI doesn't belong here, should move to no_js2
7373 // once we figure out how to do jQuery UI properly in JS2
7474 array( 'src' => 'js/js2/jquery-ui-1.7.2.js', 'version' => '1.7.2y' ),
7575 ),
7676 'combined' => array(
77 - array( 'src' => 'js/plugins.combined.js', 'version' => 41 ),
 77+ array( 'src' => 'js/plugins.combined.js', 'version' => 42 ),
7878 ),
7979 'minified' => array(
80 - array( 'src' => 'js/plugins.combined.min.js', 'version' => 41 ),
 80+ array( 'src' => 'js/plugins.combined.min.js', 'version' => 42 ),
8181 ),
8282 ),
8383 );
Index: trunk/extensions/UsabilityInitiative/js/plugins/jquery.wikiEditor.toc.js
@@ -182,7 +182,7 @@
183183 var position = wikitext.indexOf( text, offset );
184184 // Update offset to avoid stumbling on duplicate headings
185185 if ( position >= offset ) {
186 - offset = position + 1;
 186+ offset = position + text.length;
187187 } else if ( position == -1 ) {
188188 // Not sure this is possible, or what should happen
189189 continue;
Index: trunk/extensions/UsabilityInitiative/js/plugins.combined.js
@@ -2279,7 +2279,7 @@
22802280 var position = wikitext.indexOf( text, offset );
22812281 // Update offset to avoid stumbling on duplicate headings
22822282 if ( position >= offset ) {
2283 - offset = position + 1;
 2283+ offset = position + text.length;
22842284 } else if ( position == -1 ) {
22852285 // Not sure this is possible, or what should happen
22862286 continue;
Index: trunk/extensions/UsabilityInitiative/js/plugins.combined.min.js
@@ -152,7 +152,7 @@
153153 function buildList(structure){var list=$('<ul />');for(i in structure){var item=$('<li />').append($('<a />').attr('href','#').addClass('section-'+structure[i].index).data('textbox',context.$textarea).data('position',structure[i].position).click(function(event){$(this).data('textbox').focus().setSelection($(this).data('position')).scrollToCaretPosition(true);event.preventDefault();}).text(structure[i].text));if(structure[i].sections!==undefined){item.append(buildList(structure[i].sections));}
154154 list.append(item);}
155155 return list;}
156 -var outline=[];var wikitext=$.wikiEditor.fixOperaBrokenness(context.$textarea.val());var headings=wikitext.match(/^={1,6}.+={1,6}\s*$/gm);var offset=0;headings=$.makeArray(headings);for(var h=0;h<headings.length;h++){text=$.trim(headings[h]);var position=wikitext.indexOf(text,offset);if(position>=offset){offset=position+1;}else if(position==-1){continue;}
 156+var outline=[];var wikitext=$.wikiEditor.fixOperaBrokenness(context.$textarea.val());var headings=wikitext.match(/^={1,6}.+={1,6}\s*$/gm);var offset=0;headings=$.makeArray(headings);for(var h=0;h<headings.length;h++){text=$.trim(headings[h]);var position=wikitext.indexOf(text,offset);if(position>=offset){offset=position+text.length;}else if(position==-1){continue;}
157157 var startLevel=0;for(var c=0;c<text.length;c++){if(text.charAt(c)=='='){startLevel++;}else{break;}}
158158 var endLevel=0;for(var c=text.length-1;c>=0;c--){if(text.charAt(c)=='='){endLevel++;}else{break;}}
159159 var level=Math.min(startLevel,endLevel);text=$.trim(text.substr(level,text.length-(level*2)));outline[h]={'text':text,'position':position,'level':level,'index':h+1};}
Index: trunk/extensions/UsabilityInitiative/Makefile
@@ -4,26 +4,17 @@
55 # For more info on JSMin, see: http://www.crockford.com/javascript/jsmin.html
66 #
77
8 -all: css/combined.css\
9 - css/combined.min.css\
10 - js/js2.combined.js\
11 - js/js2.combined.min.js\
12 - js/plugins.combined.js\
13 - js/plugins.combined.min.js
 8+CSS := css/suggestions.css\
 9+ css/wikiEditor.css\
 10+ css/wikiEditor.dialogs.css\
 11+ css/wikiEditor.toc.css\
 12+ css/wikiEditor.toolbar.css
1413
15 -css/combined.css:
16 - cat css/*.css > css/combined.css
17 -
18 -js/js2.combined.js:
19 - cat\
20 - js/js2/jquery-1.3.2.js\
 14+JS2 := js/js2/jquery-1.3.2.js\
2115 js/js2/jquery-ui-1.7.2.js\
22 - js/js2/js2.js\
23 - > js/js2.combined.js
 16+ js/js2/js2.js
2417
25 -js/plugins.combined.js:
26 - cat\
27 - js/plugins/jquery.async.js\
 18+PLUGINS := js/plugins/jquery.async.js\
2819 js/plugins/jquery.autoEllipse.js\
2920 js/plugins/jquery.browser.js\
3021 js/plugins/jquery.cookie.js\
@@ -34,9 +25,24 @@
3526 js/plugins/jquery.wikiEditor.js\
3627 js/plugins/jquery.wikiEditor.dialogs.js\
3728 js/plugins/jquery.wikiEditor.toolbar.js\
38 - js/plugins/jquery.wikiEditor.toc.js\
39 - > js/plugins.combined.js
 29+ js/plugins/jquery.wikiEditor.toc.js
4030
 31+all: css/combined.css\
 32+ css/combined.min.css\
 33+ js/js2.combined.js\
 34+ js/js2.combined.min.js\
 35+ js/plugins.combined.js\
 36+ js/plugins.combined.min.js
 37+
 38+css/combined.css: $(CSS)
 39+ cat $(CSS) > css/combined.css
 40+
 41+js/js2.combined.js: $(JS2)
 42+ cat $(JS2) > js/js2.combined.js
 43+
 44+js/plugins.combined.js: $(PLUGINS)
 45+ cat $(PLUGINS) > js/plugins.combined.js
 46+
4147 js/js2.combined.min.js : js/js2.combined.js
4248 jsmin < js/js2.combined.js > js/js2.combined.min.js
4349

Status & tagging log