r64371 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r64370‎ | r64371 | r64372 >
Date:00:08, 30 March 2010
Author:tparscal
Status:resolved (Comments)
Tags:
Comment:
Made some minor UI tweaks to the search suggestion interface.
Modified paths:
  • /trunk/extensions/UsabilityInitiative/UsabilityInitiative.hooks.php (modified) (history)
  • /trunk/extensions/UsabilityInitiative/Vector/Modules/SimpleSearch/SimpleSearch.js (modified) (history)
  • /trunk/extensions/UsabilityInitiative/Vector/Vector.combined.js (modified) (history)
  • /trunk/extensions/UsabilityInitiative/Vector/Vector.combined.min.js (modified) (history)
  • /trunk/extensions/UsabilityInitiative/Vector/Vector.hooks.php (modified) (history)
  • /trunk/extensions/UsabilityInitiative/css/combined.css (modified) (history)
  • /trunk/extensions/UsabilityInitiative/css/combined.min.css (modified) (history)
  • /trunk/extensions/UsabilityInitiative/css/suggestions.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.suggestions.js (modified) (history)

Diff [purge]

Index: trunk/extensions/UsabilityInitiative/Vector/Modules/SimpleSearch/SimpleSearch.js
@@ -84,33 +84,22 @@
8585 },
8686 special: {
8787 render: function( query ) {
88 - var perfectMatch = false;
89 - $j(this).closest( '.suggestions' ).find( '.suggestions-results div' ).each( function() {
90 - if ( $j(this).data( 'text' ) == query ) {
91 - perfectMatch = true;
92 - }
93 - } );
94 - if ( perfectMatch ) {
95 - if ( $j(this).children().size() == 0 ) {
96 - $j(this).show();
97 - $label = $j( '<div />' )
98 - .addClass( 'special-label' )
99 - .text( mw.usability.getMsg( 'vector-simplesearch-containing' ) )
100 - .appendTo( $j(this) );
101 - $query = $j( '<div />' )
102 - .addClass( 'special-query' )
103 - .text( query )
104 - .appendTo( $j(this) );
105 - $query.autoEllipsis();
106 - } else {
107 - $j(this).find( '.special-query' )
108 - .empty()
109 - .text( query )
110 - .autoEllipsis();
111 - }
 88+ if ( $j(this).children().size() == 0 ) {
 89+ $j(this).show()
 90+ $label = $j( '<div />' )
 91+ .addClass( 'special-label' )
 92+ .text( mw.usability.getMsg( 'vector-simplesearch-containing' ) )
 93+ .appendTo( $j(this) );
 94+ $query = $j( '<div />' )
 95+ .addClass( 'special-query' )
 96+ .text( query )
 97+ .appendTo( $j(this) );
 98+ $query.autoEllipsis();
11299 } else {
113 - $j(this).hide();
114 - $j(this).empty();
 100+ $j(this).find( '.special-query' )
 101+ .empty()
 102+ .text( query )
 103+ .autoEllipsis();
115104 }
116105 },
117106 select: function( $textbox ) {
Index: trunk/extensions/UsabilityInitiative/Vector/Vector.hooks.php
@@ -16,13 +16,13 @@
1717 array( 'src' => 'Modules/CollapsibleTabs/CollapsibleTabs.js', 'version' => 7 ),
1818 array( 'src' => 'Modules/EditWarning/EditWarning.js', 'version' => 8 ),
1919 array( 'src' => 'Modules/FooterCleanup/FooterCleanup.js', 'version' => 5 ),
20 - array( 'src' => 'Modules/SimpleSearch/SimpleSearch.js', 'version' => 7 ),
 20+ array( 'src' => 'Modules/SimpleSearch/SimpleSearch.js', 'version' => 8 ),
2121 ),
2222 'combined' => array(
23 - array( 'src' => 'Vector.combined.js', 'version' => 22 ),
 23+ array( 'src' => 'Vector.combined.js', 'version' => 23 ),
2424 ),
2525 'minified' => array(
26 - array( 'src' => 'Vector.combined.min.js', 'version' => 22 ),
 26+ array( 'src' => 'Vector.combined.min.js', 'version' => 23 ),
2727 ),
2828 );
2929 static $modules = array(
Index: trunk/extensions/UsabilityInitiative/Vector/Vector.combined.js
@@ -318,33 +318,22 @@
319319 },
320320 special: {
321321 render: function( query ) {
322 - var perfectMatch = false;
323 - $j(this).closest( '.suggestions' ).find( '.suggestions-results div' ).each( function() {
324 - if ( $j(this).data( 'text' ) == query ) {
325 - perfectMatch = true;
326 - }
327 - } );
328 - if ( perfectMatch ) {
329 - if ( $j(this).children().size() == 0 ) {
330 - $j(this).show();
331 - $label = $j( '<div />' )
332 - .addClass( 'special-label' )
333 - .text( mw.usability.getMsg( 'vector-simplesearch-containing' ) )
334 - .appendTo( $j(this) );
335 - $query = $j( '<div />' )
336 - .addClass( 'special-query' )
337 - .text( query )
338 - .appendTo( $j(this) );
339 - $query.autoEllipsis();
340 - } else {
341 - $j(this).find( '.special-query' )
342 - .empty()
343 - .text( query )
344 - .autoEllipsis();
345 - }
 322+ if ( $j(this).children().size() == 0 ) {
 323+ $j(this).show()
 324+ $label = $j( '<div />' )
 325+ .addClass( 'special-label' )
 326+ .text( mw.usability.getMsg( 'vector-simplesearch-containing' ) )
 327+ .appendTo( $j(this) );
 328+ $query = $j( '<div />' )
 329+ .addClass( 'special-query' )
 330+ .text( query )
 331+ .appendTo( $j(this) );
 332+ $query.autoEllipsis();
346333 } else {
347 - $j(this).hide();
348 - $j(this).empty();
 334+ $j(this).find( '.special-query' )
 335+ .empty()
 336+ .text( query )
 337+ .autoEllipsis();
349338 }
350339 },
351340 select: function( $textbox ) {
Index: trunk/extensions/UsabilityInitiative/Vector/Vector.combined.min.js
@@ -12,4 +12,5 @@
1313 +transclusionCount
1414 +'</strong> other pages.</label>');$j('.mw-templatesUsedExplanation').remove();$j('.collapsible-list label').click(function(){$j(this).parent().toggleClass('expanded').toggleClass('collapsed').find('ul').slideToggle('fast');return false;}).trigger('click');$j('#wpPreview, #wpDiff, .editHelp, #editpage-specialchars').remove();$j('#mw-editform-cancel').remove().appendTo('.editButtons');});if(wgVectorEnabledModules.simplesearch&&skin=='vector'&&typeof os_autoload_inputs!=='undefined'&&os_autoload_forms!=='undefined'){os_autoload_inputs=[];os_autoload_forms=[];}
1515 $j(document).ready(function(){if(!wgVectorEnabledModules.simplesearch||skin!='vector'){return true;}
16 -$j('div#simpleSearch > input#searchInput').each(function(){$j('<label />').text(mw.usability.getMsg('vector-simplesearch-search')).css({'display':'none','position':'absolute','bottom':0,'padding':'0.25em','color':'#999999','cursor':'text'}).css(($j('body').is('.rtl')?'right':'left'),0).click(function(){$j(this).parent().find('input#searchInput').focus();}).appendTo($j(this).parent());if($j(this).val()==''){$j(this).parent().find('label').show();}}).focus(function(){$j(this).parent().find('label').hide();}).blur(function(){if($j(this).val()==''){$j(this).parent().find('label').show();}});$j('#searchInput, #searchInput2, #powerSearchText, #searchText').suggestions({fetch:function(query){var $this=$j(this);var request=$j.ajax({url:wgScriptPath+'/api.php',data:{'action':'opensearch','search':query,'namespace':0,'suggest':''},dataType:'json',success:function(data){$this.suggestions('suggestions',data[1]);}});$j(this).data('request',request);},cancel:function(){var request=$j(this).data('request');if(request&&typeof request.abort=='function'){request.abort();$j(this).removeData('request');}},result:{select:function($textbox){$textbox.closest('form').submit();}},delay:120});$j('#searchInput').suggestions({result:{select:function($textbox){$textbox.closest('form').submit();}},special:{render:function(query){var perfectMatch=false;$j(this).closest('.suggestions').find('.suggestions-results div').each(function(){if($j(this).data('text')==query){perfectMatch=true;}});if(perfectMatch){if($j(this).children().size()==0){$j(this).show();$label=$j('<div />').addClass('special-label').text(mw.usability.getMsg('vector-simplesearch-containing')).appendTo($j(this));$query=$j('<div />').addClass('special-query').text(query).appendTo($j(this));$query.autoEllipsis();}else{$j(this).find('.special-query').empty().text(query).autoEllipsis();}}else{$j(this).hide();$j(this).empty();}},select:function($textbox){$textbox.closest('form').append($j('<input />').attr({'type':'hidden','name':'fulltext','value':1}));$textbox.closest('form').submit();}},$region:$j('#simpleSearch')});});
\ No newline at end of file
 16+$j('div#simpleSearch > input#searchInput').each(function(){$j('<label />').text(mw.usability.getMsg('vector-simplesearch-search')).css({'display':'none','position':'absolute','bottom':0,'padding':'0.25em','color':'#999999','cursor':'text'}).css(($j('body').is('.rtl')?'right':'left'),0).click(function(){$j(this).parent().find('input#searchInput').focus();}).appendTo($j(this).parent());if($j(this).val()==''){$j(this).parent().find('label').show();}}).focus(function(){$j(this).parent().find('label').hide();}).blur(function(){if($j(this).val()==''){$j(this).parent().find('label').show();}});$j('#searchInput, #searchInput2, #powerSearchText, #searchText').suggestions({fetch:function(query){var $this=$j(this);var request=$j.ajax({url:wgScriptPath+'/api.php',data:{'action':'opensearch','search':query,'namespace':0,'suggest':''},dataType:'json',success:function(data){$this.suggestions('suggestions',data[1]);}});$j(this).data('request',request);},cancel:function(){var request=$j(this).data('request');if(request&&typeof request.abort=='function'){request.abort();$j(this).removeData('request');}},result:{select:function($textbox){$textbox.closest('form').submit();}},delay:120});$j('#searchInput').suggestions({result:{select:function($textbox){$textbox.closest('form').submit();}},special:{render:function(query){if($j(this).children().size()==0){$j(this).show()
 17+$label=$j('<div />').addClass('special-label').text(mw.usability.getMsg('vector-simplesearch-containing')).appendTo($j(this));$query=$j('<div />').addClass('special-query').text(query).appendTo($j(this));$query.autoEllipsis();}else{$j(this).find('.special-query').empty().text(query).autoEllipsis();}},select:function($textbox){$textbox.closest('form').append($j('<input />').attr({'type':'hidden','name':'fulltext','value':1}));$textbox.closest('form').submit();}},$region:$j('#simpleSearch')});});
\ No newline at end of file
Index: trunk/extensions/UsabilityInitiative/UsabilityInitiative.hooks.php
@@ -18,7 +18,7 @@
1919 private static $styleFiles = array(
2020 'base_sets' => array(
2121 'raw' => array(
22 - array( 'src' => 'css/suggestions.css', 'version' => 6 ),
 22+ array( 'src' => 'css/suggestions.css', 'version' => 7 ),
2323 array( 'src' => 'css/vector.collapsibleNav.css', 'version' => 7 ),
2424 array( 'src' => 'css/vector.footerCleanup.css', 'version' => 1 ),
2525 array( 'src' => 'css/wikiEditor.css', 'version' => 12 ),
@@ -29,11 +29,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' => 80 ),
 33+ array( 'src' => 'css/combined.css', 'version' => 81 ),
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' => 80 ),
 37+ array( 'src' => 'css/combined.min.css', 'version' => 81 ),
3838 array( 'src' => 'css/vector/jquery-ui-1.7.2.css', 'version' => '1.7.2y' ),
3939 ),
4040 )
@@ -70,7 +70,7 @@
7171 array( 'src' => 'js/plugins/jquery.color.js', 'version' => 1 ),
7272 array( 'src' => 'js/plugins/jquery.cookie.js', 'version' => 4 ),
7373 array( 'src' => 'js/plugins/jquery.delayedBind.js', 'version' => 1 ),
74 - array( 'src' => 'js/plugins/jquery.suggestions.js', 'version' => 7 ),
 74+ array( 'src' => 'js/plugins/jquery.suggestions.js', 'version' => 8 ),
7575 array( 'src' => 'js/plugins/jquery.textSelection.js', 'version' => 27 ),
7676 array( 'src' => 'js/plugins/jquery.wikiEditor.js', 'version' => 179 ),
7777 array( 'src' => 'js/plugins/jquery.wikiEditor.highlight.js', 'version' => 52 ),
@@ -82,10 +82,10 @@
8383 array( 'src' => 'js/plugins/jquery.wikiEditor.publish.js', 'version' => 5 ),
8484 ),
8585 'combined' => array(
86 - array( 'src' => 'js/plugins.combined.js', 'version' => 367 ),
 86+ array( 'src' => 'js/plugins.combined.js', 'version' => 368 ),
8787 ),
8888 'minified' => array(
89 - array( 'src' => 'js/plugins.combined.min.js', 'version' => 367 ),
 89+ array( 'src' => 'js/plugins.combined.min.js', 'version' => 368 ),
9090 ),
9191 ),
9292 );
Index: trunk/extensions/UsabilityInitiative/css/suggestions.css
@@ -24,6 +24,18 @@
2525 padding: 0.25em 0.25em;
2626 line-height: 1.25em;
2727 }
 28+.suggestions-special:hover {
 29+ background-color: #4C59A6;
 30+ background-color: Highlight;
 31+}
 32+.suggestions-special:hover .special-label {
 33+ color: white;
 34+ color: HighlightText;
 35+}
 36+.suggestions-special:hover .special-query {
 37+ color: white;
 38+ color: HighlightText;
 39+}
2840 .suggestions-results {
2941 background-color: white;
3042 background-color: Window;
Index: trunk/extensions/UsabilityInitiative/css/combined.css
@@ -24,6 +24,18 @@
2525 padding: 0.25em 0.25em;
2626 line-height: 1.25em;
2727 }
 28+.suggestions-special:hover {
 29+ background-color: #4C59A6;
 30+ background-color: Highlight;
 31+}
 32+.suggestions-special:hover .special-label {
 33+ color: white;
 34+ color: HighlightText;
 35+}
 36+.suggestions-special:hover .special-query {
 37+ color: white;
 38+ color: HighlightText;
 39+}
2840 .suggestions-results {
2941 background-color: white;
3042 background-color: Window;
Index: trunk/extensions/UsabilityInitiative/css/combined.min.css
@@ -22,6 +22,18 @@
2323 padding:0.25em 0.25em;
2424 line-height:1.25em;
2525 }
 26+.suggestions-special:hover{
 27+background-color:#4C59A6;
 28+background-color:Highlight;
 29+}
 30+.suggestions-special:hover .special-label{
 31+color:white;
 32+color:HighlightText;
 33+}
 34+.suggestions-special:hover .special-query{
 35+color:white;
 36+color:HighlightText;
 37+}
2638 .suggestions-results{
2739 background-color:white;
2840 background-color:Window;
Index: trunk/extensions/UsabilityInitiative/js/plugins/jquery.suggestions.js
@@ -90,6 +90,12 @@
9191 setTimeout( function() {
9292 // Render special
9393 $special = context.data.$container.find( '.suggestions-special' );
 94+ // Only hook this up the first time
 95+ if ( $special.children().length == 0 ) {
 96+ $special.mousemove( function() {
 97+ $.suggestions.highlight( context, $(), false );
 98+ } );
 99+ }
94100 context.config.special.render.call( $special, context.data.$textbox.val() );
95101 }, 1 );
96102 }
@@ -113,8 +119,7 @@
114120 context.config[property] = value;
115121 // Update suggestions
116122 if ( typeof context.data !== 'undefined' ) {
117 - if ( typeof context.config.suggestions == 'undefined' ||
118 - context.config.suggestions.length == 0 ) {
 123+ if ( context.data.$textbox.val().length == 0 ) {
119124 // Hide the div when no suggestion exist
120125 context.data.$container.hide();
121126 } else {
@@ -136,6 +141,11 @@
137142 .addClass( 'suggestions-result' )
138143 .attr( 'rel', i )
139144 .data( 'text', context.config.suggestions[i] )
 145+ .mouseover( function( e ) {
 146+ $.suggestions.highlight(
 147+ context, $(this).closest( '.suggestions-results div' ), false
 148+ );
 149+ } )
140150 .appendTo( $results );
141151 // Allow custom rendering
142152 if ( typeof context.config.result.render == 'function' ) {
@@ -187,7 +197,6 @@
188198 $.suggestions.restore( context );
189199 } else {
190200 context.data.$textbox.val( result.data( 'text' ) );
191 -
192201 // .val() doesn't call any event handlers, so
193202 // let the world know what happened
194203 context.data.$textbox.change();
@@ -311,6 +320,9 @@
312321 'mouseDownOn': $( [] ),
313322 '$textbox': $(this)
314323 };
 324+ context.data.$textbox.mousemove( function() {
 325+ $.suggestions.highlight( context, $(), false );
 326+ } );
315327 context.data.$container = $( '<div />' )
316328 .css( {
317329 'top': Math.round( context.data.$textbox.offset().top + context.data.$textbox.outerHeight() ),
@@ -318,9 +330,6 @@
319331 'width': context.data.$textbox.outerWidth(),
320332 'display': 'none'
321333 } )
322 - .mouseover( function( e ) {
323 - $.suggestions.highlight( context, $( e.target ).closest( '.suggestions-results div' ), false );
324 - } )
325334 .addClass( 'suggestions' )
326335 .append(
327336 $( '<div />' ).addClass( 'suggestions-results' )
Index: trunk/extensions/UsabilityInitiative/js/plugins.combined.js
@@ -5828,6 +5828,12 @@
58295829 setTimeout( function() {
58305830 // Render special
58315831 $special = context.data.$container.find( '.suggestions-special' );
 5832+ // Only hook this up the first time
 5833+ if ( $special.children().length == 0 ) {
 5834+ $special.mousemove( function() {
 5835+ $.suggestions.highlight( context, $(), false );
 5836+ } );
 5837+ }
58325838 context.config.special.render.call( $special, context.data.$textbox.val() );
58335839 }, 1 );
58345840 }
@@ -5851,8 +5857,7 @@
58525858 context.config[property] = value;
58535859 // Update suggestions
58545860 if ( typeof context.data !== 'undefined' ) {
5855 - if ( typeof context.config.suggestions == 'undefined' ||
5856 - context.config.suggestions.length == 0 ) {
 5861+ if ( context.data.$textbox.val().length == 0 ) {
58575862 // Hide the div when no suggestion exist
58585863 context.data.$container.hide();
58595864 } else {
@@ -5874,6 +5879,11 @@
58755880 .addClass( 'suggestions-result' )
58765881 .attr( 'rel', i )
58775882 .data( 'text', context.config.suggestions[i] )
 5883+ .mouseover( function( e ) {
 5884+ $.suggestions.highlight(
 5885+ context, $(this).closest( '.suggestions-results div' ), false
 5886+ );
 5887+ } )
58785888 .appendTo( $results );
58795889 // Allow custom rendering
58805890 if ( typeof context.config.result.render == 'function' ) {
@@ -5925,7 +5935,6 @@
59265936 $.suggestions.restore( context );
59275937 } else {
59285938 context.data.$textbox.val( result.data( 'text' ) );
5929 -
59305939 // .val() doesn't call any event handlers, so
59315940 // let the world know what happened
59325941 context.data.$textbox.change();
@@ -6049,6 +6058,9 @@
60506059 'mouseDownOn': $( [] ),
60516060 '$textbox': $(this)
60526061 };
 6062+ context.data.$textbox.mousemove( function() {
 6063+ $.suggestions.highlight( context, $(), false );
 6064+ } );
60536065 context.data.$container = $( '<div />' )
60546066 .css( {
60556067 'top': Math.round( context.data.$textbox.offset().top + context.data.$textbox.outerHeight() ),
@@ -6056,9 +6068,6 @@
60576069 'width': context.data.$textbox.outerWidth(),
60586070 'display': 'none'
60596071 } )
6060 - .mouseover( function( e ) {
6061 - $.suggestions.highlight( context, $( e.target ).closest( '.suggestions-results div' ), false );
6062 - } )
60636072 .addClass( 'suggestions' )
60646073 .append(
60656074 $( '<div />' ).addClass( 'suggestions-results' )
@@ -6908,7 +6917,7 @@
69096918 }
69106919 break;
69116920 case 86: //v
6912 - if ( event.ctrlKey && $.browser.msie ) {
 6921+ if ( event.ctrlKey ){
69136922 //paste, intercepted for IE
69146923 context.evt.paste( event );
69156924 }
@@ -6962,6 +6971,7 @@
69636972 // Save the cursor position to restore it after all this voodoo
69646973 var cursorPos = context.fn.getCaretPosition();
69656974 var oldLength = context.fn.getContents().length;
 6975+
69666976 context.$content.find( ':not(.wikiEditor)' ).addClass( 'wikiEditor' );
69676977 if ( $.layout.name !== 'webkit' ) {
69686978 context.$content.addClass( 'pasting' );
@@ -8975,7 +8985,7 @@
89768986
89778987 // Remove this marker
89788988 var marker = $(this).data( 'marker' );
8979 - if ( marker && typeof marker.skipDivision != 'undefined' && ( division == marker.skipDivision ) ) {
 8989+ if ( typeof marker.skipDivision != 'undefined' && ( division == marker.skipDivision ) ) {
89808990 // Don't remove these either
89818991 return true;
89828992 }
Index: trunk/extensions/UsabilityInitiative/js/plugins.combined.min.js
@@ -393,7 +393,8 @@
394394 if(typeof context.config.cancel=='function'){context.config.cancel.call(context.data.$textbox);}},restore:function(context){context.data.$textbox.val(context.data.prevText);},update:function(context,delayed){function maybeFetch(){if(context.data.$textbox.val()!==context.data.prevText){context.data.prevText=context.data.$textbox.val();if(typeof context.config.fetch=='function'){context.config.fetch.call(context.data.$textbox,context.data.$textbox.val());}}}
395395 if(context.data.timerID!=null){clearTimeout(context.data.timerID);}
396396 if(delayed){context.data.timerID=setTimeout(maybeFetch,context.config.delay);}else{maybeFetch();}
397 -$.suggestions.special(context);},special:function(context){if(typeof context.config.special.render=='function'){setTimeout(function(){$special=context.data.$container.find('.suggestions-special');context.config.special.render.call($special,context.data.$textbox.val());},1);}},configure:function(context,property,value){switch(property){case'fetch':case'cancel':case'special':case'result':case'$region':context.config[property]=value;break;case'suggestions':context.config[property]=value;if(typeof context.data!=='undefined'){if(typeof context.config.suggestions=='undefined'||context.config.suggestions.length==0){context.data.$container.hide();}else{context.data.$container.show();context.data.$container.css({'top':context.config.$region.offset().top+context.config.$region.outerHeight(),'bottom':'auto','width':context.config.$region.outerWidth(),'height':'auto','left':context.config.$region.offset().left,'right':'auto'});var $results=context.data.$container.children('.suggestions-results');$results.empty();for(var i=0;i<context.config.suggestions.length;i++){$result=$('<div />').addClass('suggestions-result').attr('rel',i).data('text',context.config.suggestions[i]).appendTo($results);if(typeof context.config.result.render=='function'){context.config.result.render.call($result,context.config.suggestions[i]);}else{$result.text(context.config.suggestions[i]).autoEllipsis();}}}}
 397+$.suggestions.special(context);},special:function(context){if(typeof context.config.special.render=='function'){setTimeout(function(){$special=context.data.$container.find('.suggestions-special');if($special.children().length==0){$special.mousemove(function(){$.suggestions.highlight(context,$(),false);});}
 398+context.config.special.render.call($special,context.data.$textbox.val());},1);}},configure:function(context,property,value){switch(property){case'fetch':case'cancel':case'special':case'result':case'$region':context.config[property]=value;break;case'suggestions':context.config[property]=value;if(typeof context.data!=='undefined'){if(context.data.$textbox.val().length==0){context.data.$container.hide();}else{context.data.$container.show();context.data.$container.css({'top':context.config.$region.offset().top+context.config.$region.outerHeight(),'bottom':'auto','width':context.config.$region.outerWidth(),'height':'auto','left':context.config.$region.offset().left,'right':'auto'});var $results=context.data.$container.children('.suggestions-results');$results.empty();for(var i=0;i<context.config.suggestions.length;i++){$result=$('<div />').addClass('suggestions-result').attr('rel',i).data('text',context.config.suggestions[i]).mouseover(function(e){$.suggestions.highlight(context,$(this).closest('.suggestions-results div'),false);}).appendTo($results);if(typeof context.config.result.render=='function'){context.config.result.render.call($result,context.config.suggestions[i]);}else{$result.text(context.config.suggestions[i]).autoEllipsis();}}}}
398399 break;case'maxRows':context.config[property]=Math.max(1,Math.min(100,value));break;case'delay':context.config[property]=Math.max(0,Math.min(1200,value));break;case'submitOnClick':context.config[property]=value?true:false;break;}},highlight:function(context,result,updateTextbox){var selected=context.data.$container.find('.suggestions-result-current');if(!result.get||selected.get(0)!=result.get(0)){if(result=='prev'){result=selected.prev();}else if(result=='next'){if(selected.size()==0)
399400 result=context.data.$container.find('.suggestions-results div:first');else{result=selected.next();if(result.size()==0)
400401 result=selected;}}
@@ -405,7 +406,7 @@
406407 break;default:$.suggestions.update(context,true);break;}
407408 if(preventDefault){e.preventDefault();e.stopImmediatePropagation();}}};$.fn.suggestions=function(){var returnValue=null;var args=arguments;$(this).each(function(){var context=$(this).data('suggestions-context');if(typeof context=='undefined'){context={config:{'fetch':function(){},'cancel':function(){},'special':{},'result':{},'$region':$(this),'suggestions':[],'maxRows':7,'delay':120,'submitOnClick':false}};}
408409 if(args.length>0){if(typeof args[0]=='object'){for(var key in args[0]){$.suggestions.configure(context,key,args[0][key]);}}else if(typeof args[0]=='string'){if(args.length>1){$.suggestions.configure(context,args[0],args[1]);}else if(returnValue==null){returnValue=(args[0]in context.config?undefined:context.config[args[0]]);}}}
409 -if(typeof context.data=='undefined'){context.data={'timerID':null,'prevText':null,'visibleResults':0,'mouseDownOn':$([]),'$textbox':$(this)};context.data.$container=$('<div />').css({'top':Math.round(context.data.$textbox.offset().top+context.data.$textbox.outerHeight()),'left':Math.round(context.data.$textbox.offset().left),'width':context.data.$textbox.outerWidth(),'display':'none'}).mouseover(function(e){$.suggestions.highlight(context,$(e.target).closest('.suggestions-results div'),false);}).addClass('suggestions').append($('<div />').addClass('suggestions-results').mousedown(function(e){context.data.mouseDownOn=$(e.target).closest('.suggestions-results div');}).mouseup(function(e){var $result=$(e.target).closest('.suggestions-results div');var $other=context.data.mouseDownOn;context.data.mouseDownOn=$([]);if($result.get(0)!=$other.get(0)){return;}
 410+if(typeof context.data=='undefined'){context.data={'timerID':null,'prevText':null,'visibleResults':0,'mouseDownOn':$([]),'$textbox':$(this)};context.data.$textbox.mousemove(function(){$.suggestions.highlight(context,$(),false);});context.data.$container=$('<div />').css({'top':Math.round(context.data.$textbox.offset().top+context.data.$textbox.outerHeight()),'left':Math.round(context.data.$textbox.offset().left),'width':context.data.$textbox.outerWidth(),'display':'none'}).addClass('suggestions').append($('<div />').addClass('suggestions-results').mousedown(function(e){context.data.mouseDownOn=$(e.target).closest('.suggestions-results div');}).mouseup(function(e){var $result=$(e.target).closest('.suggestions-results div');var $other=context.data.mouseDownOn;context.data.mouseDownOn=$([]);if($result.get(0)!=$other.get(0)){return;}
410411 $.suggestions.highlight(context,$result,true);context.data.$container.hide();if(typeof context.config.result.select=='function'){context.config.result.select.call($result,context.data.$textbox);}
411412 context.data.$textbox.focus();})).append($('<div />').addClass('suggestions-special').mousedown(function(e){context.data.mouseDownOn=$(e.target).closest('.suggestions-special');}).mouseup(function(e){var $special=$(e.target).closest('.suggestions-special');var $other=context.data.mouseDownOn;context.data.mouseDownOn=$([]);if($special.get(0)!=$other.get(0)){return;}
412413 context.data.$container.hide();if(typeof context.config.special.select=='function'){context.config.special.select.call($special,context.data.$textbox);}
@@ -458,7 +459,7 @@
459460 return false;}
460461 break;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;}}
461462 return false;}
462 -break;case 86:if(event.ctrlKey&&$.browser.msie){context.evt.paste(event);}
 463+break;case 86:if(event.ctrlKey){context.evt.paste(event);}
463464 break;}
464465 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';}
465466 if(context.$content.children().length==0){context.$content.append('<p></p>');}
@@ -613,7 +614,7 @@
614615 $(anchor).data('marker',markers[i]).addClass('wikiEditor-highlight');markers[i].afterWrap(anchor,markers[i]);}else{$(anchor).data('marker',markers[i]);markers[i].onSkip(anchor);}
615616 visited[v++]=anchor;}}
616617 var j=0;context.$content.find('.wikiEditor-highlight').each(function(){if(visited[j]==this){j++;return true;}
617 -var marker=$(this).data('marker');if(marker&&typeof marker.skipDivision!='undefined'&&(division==marker.skipDivision)){return true;}
 618+var marker=$(this).data('marker');if(typeof marker.skipDivision!='undefined'&&(division==marker.skipDivision)){return true;}
618619 if(marker&&typeof marker.beforeUnwrap=='function')
619620 marker.beforeUnwrap(this);if((marker&&marker.anchor=='tag')||$(this).is('p')){$(this).removeAttr('class');}else{$(this).replaceWith(this.childNodes);}
620621 context.fn.purgeOffsets();});}}};})(jQuery);(function($){$.wikiEditor.modules.preview={'browsers':{'ltr':{'msie':[['>=',7]],'firefox':[['>=',3]],'opera':[['>=',9.6]],'safari':[['>=',4]]},'rtl':{'msie':[['>=',8]],'firefox':[['>=',3]],'opera':[['>=',9.6]],'safari':[['>=',4]]}},fn:{create:function(context,config){if('initialized'in context.modules.preview){return;}

Follow-up revisions

RevisionCommit summaryAuthorDate
r64392Cleans up some things in r64371 such as merging some CSS rules with identical...tparscal15:56, 30 March 2010

Comments

#Comment by Catrope (talk | contribs)   15:36, 30 March 2010
+.suggestions-special:hover .special-label {
+	color: white;
+	color: HighlightText;
+}
+.suggestions-special:hover .special-query {
+	color: white;
+	color: HighlightText;
+}

Might as well merge these rules into a comma rule.

+				if ( $special.children().length == 0 ) {
+					$special.mousemove( function() {
+						$.suggestions.highlight( context, $(), false );
+					} );
...
+			context.data.$textbox.mousemove( function() {
+				$.suggestions.highlight( context, $(), false );
+			} );

Any reason you're using mousemove rather than e.g. mouseover? Also, $() is equivalent to $( document ), you probably meant to use $( [] ) instead.

-					 if ( event.ctrlKey && $.browser.msie ) {
+					 if ( event.ctrlKey ){
...
-			if ( marker && typeof marker.skipDivision != 'undefined' && ( division == marker.skipDivision ) ) {
+			if ( typeof marker.skipDivision != 'undefined' && ( division == marker.skipDivision ) ) {

You're undoing r64354 in the combined/minified files, probably because you forgot to run make -B after svn up.

#Comment by Trevor Parscal (WMF) (talk | contribs)   15:57, 30 March 2010

To the first point, sure, that's a good idea. On the second point, that is on purpose because some browsers miss the boundary when the mouse moves quickly but mousemove works every time. The the 3rd point - yeah, my fault. 1 and 3 are solved in r64392.

Status & tagging log