Index: trunk/extensions/UsabilityInitiative/UsabilityInitiative.hooks.php |
— | — | @@ -72,7 +72,7 @@ |
73 | 73 | array( 'src' => 'js/plugins/jquery.delayedBind.js', 'version' => 1 ), |
74 | 74 | array( 'src' => 'js/plugins/jquery.suggestions.js', 'version' => 18 ), |
75 | 75 | array( 'src' => 'js/plugins/jquery.expandableField.js', 'version' => 15 ), |
76 | | - array( 'src' => 'js/plugins/jquery.suggestions.js', 'version' => 19 ), |
| 76 | + array( 'src' => 'js/plugins/jquery.suggestions.js', 'version' => 20 ), |
77 | 77 | array( 'src' => 'js/plugins/jquery.textSelection.js', 'version' => 33 ), |
78 | 78 | array( 'src' => 'js/plugins/jquery.wikiEditor.js', 'version' => 188 ), |
79 | 79 | array( 'src' => 'js/plugins/jquery.wikiEditor.highlight.js', 'version' => 53 ), |
— | — | @@ -85,10 +85,10 @@ |
86 | 86 | array( 'src' => 'js/plugins/jquery.wikiEditor.publish.js', 'version' => 5 ), |
87 | 87 | ), |
88 | 88 | 'combined' => array( |
89 | | - array( 'src' => 'js/plugins.combined.js', 'version' => 404 ), |
| 89 | + array( 'src' => 'js/plugins.combined.js', 'version' => 405 ), |
90 | 90 | ), |
91 | 91 | 'minified' => array( |
92 | | - array( 'src' => 'js/plugins.combined.min.js', 'version' => 404 ), |
| 92 | + array( 'src' => 'js/plugins.combined.min.js', 'version' => 405 ), |
93 | 93 | ), |
94 | 94 | ), |
95 | 95 | ); |
Index: trunk/extensions/UsabilityInitiative/js/plugins/jquery.suggestions.js |
— | — | @@ -149,13 +149,6 @@ |
150 | 150 | var $autoEllipseMe = $( [] ); |
151 | 151 | for ( var i = 0; i < context.config.suggestions.length; i++ ) { |
152 | 152 | var text = context.config.suggestions[i]; |
153 | | - if( context.config.highlightInput ) { |
154 | | - var text = '<strong>' |
155 | | - + text.substr( 0, context.data.prevText.length) |
156 | | - + '</strong>' |
157 | | - + text.substr( context.data.prevText.length, text.length ); |
158 | | - } |
159 | | - |
160 | 153 | var $result = $( '<div />' ) |
161 | 154 | .addClass( 'suggestions-result' ) |
162 | 155 | .attr( 'rel', i ) |
— | — | @@ -172,14 +165,24 @@ |
173 | 166 | context.config.result.render.call( $result, text ); |
174 | 167 | } else { |
175 | 168 | // Add <span> with text |
176 | | - $result.append( $( '<div />' ) |
177 | | - .css( 'whiteSpace', 'nowrap' ) |
178 | | - .html( text ) |
179 | | - ); |
| 169 | + if( context.config.highlightInput ) { |
| 170 | + var matchedText = text.substr( 0, context.data.prevText.length ); |
| 171 | + text = text.substr( context.data.prevText.length, text.length ); |
| 172 | + $result.append( $( '<div />' ) |
| 173 | + .css( 'whiteSpace', 'nowrap' ) |
| 174 | + .text( text ) |
| 175 | + .prepend( $( '<strong />' ).text( matchedText ) ) |
| 176 | + ); |
| 177 | + } else { |
| 178 | + $result.append( $( '<div />' ) |
| 179 | + .css( 'whiteSpace', 'nowrap' ) |
| 180 | + .text( text ) |
| 181 | + ); |
| 182 | + } |
180 | 183 | |
181 | 184 | // Widen results box if needed |
182 | 185 | // New width is only calculated here, applied later |
183 | | - var $span = $result.children( 'span' ); |
| 186 | + var $span = $result.children( 'div' ); |
184 | 187 | if ( $span.outerWidth() > $result.width() && $span.outerWidth() > expWidth ) { |
185 | 188 | expWidth = $span.outerWidth(); |
186 | 189 | } |
Index: trunk/extensions/UsabilityInitiative/js/plugins.combined.js |
— | — | @@ -5906,13 +5906,6 @@ |
5907 | 5907 | var $autoEllipseMe = $( [] ); |
5908 | 5908 | for ( var i = 0; i < context.config.suggestions.length; i++ ) { |
5909 | 5909 | var text = context.config.suggestions[i]; |
5910 | | - if( context.config.highlightInput ) { |
5911 | | - var text = '<strong>' |
5912 | | - + text.substr( 0, context.data.prevText.length) |
5913 | | - + '</strong>' |
5914 | | - + text.substr( context.data.prevText.length, text.length ); |
5915 | | - } |
5916 | | - |
5917 | 5910 | var $result = $( '<div />' ) |
5918 | 5911 | .addClass( 'suggestions-result' ) |
5919 | 5912 | .attr( 'rel', i ) |
— | — | @@ -5929,14 +5922,24 @@ |
5930 | 5923 | context.config.result.render.call( $result, text ); |
5931 | 5924 | } else { |
5932 | 5925 | // Add <span> with text |
5933 | | - $result.append( $( '<div />' ) |
5934 | | - .css( 'whiteSpace', 'nowrap' ) |
5935 | | - .html( text ) |
5936 | | - ); |
| 5926 | + if( context.config.highlightInput ) { |
| 5927 | + var matchedText = text.substr( 0, context.data.prevText.length ); |
| 5928 | + text = text.substr( context.data.prevText.length, text.length ); |
| 5929 | + $result.append( $( '<div />' ) |
| 5930 | + .css( 'whiteSpace', 'nowrap' ) |
| 5931 | + .text( text ) |
| 5932 | + .prepend( $( '<strong />' ).text( matchedText ) ) |
| 5933 | + ); |
| 5934 | + } else { |
| 5935 | + $result.append( $( '<div />' ) |
| 5936 | + .css( 'whiteSpace', 'nowrap' ) |
| 5937 | + .text( text ) |
| 5938 | + ); |
| 5939 | + } |
5937 | 5940 | |
5938 | 5941 | // Widen results box if needed |
5939 | 5942 | // New width is only calculated here, applied later |
5940 | | - var $span = $result.children( 'span' ); |
| 5943 | + var $span = $result.children( 'div' ); |
5941 | 5944 | if ( $span.outerWidth() > $result.width() && $span.outerWidth() > expWidth ) { |
5942 | 5945 | expWidth = $span.outerWidth(); |
5943 | 5946 | } |
Index: trunk/extensions/UsabilityInitiative/js/plugins.combined.min.js |
— | — | @@ -397,11 +397,8 @@ |
398 | 398 | if(delayed){context.data.timerID=setTimeout(maybeFetch,context.config.delay);}else{maybeFetch();} |
399 | 399 | $.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(context.data.$textbox.val().length==0){context.data.$container.hide();}else{context.data.$container.show();var newCSS={'top':context.config.$region.offset().top+context.config.$region.outerHeight(),'bottom':'auto','width':context.config.$region.outerWidth(),'height':'auto'} |
400 | 400 | if(context.config.positionFromLeft){newCSS['left']=context.config.$region.offset().left;newCSS['right']='auto';}else{newCSS['left']='auto';newCSS['right']=$('body').width()-(context.config.$region.offset().left+context.config.$region.outerWidth());} |
401 | | -context.data.$container.css(newCSS);var $results=context.data.$container.children('.suggestions-results');$results.empty();var expWidth=-1;var $autoEllipseMe=$([]);for(var i=0;i<context.config.suggestions.length;i++){var text=context.config.suggestions[i];if(context.config.highlightInput){var text='<strong>' |
402 | | -+text.substr(0,context.data.prevText.length) |
403 | | -+'</strong>' |
404 | | -+text.substr(context.data.prevText.length,text.length);} |
405 | | -var $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,text);}else{$result.append($('<div />').css('whiteSpace','nowrap').html(text));var $span=$result.children('span');if($span.outerWidth()>$result.width()&&$span.outerWidth()>expWidth){expWidth=$span.outerWidth();} |
| 401 | +context.data.$container.css(newCSS);var $results=context.data.$container.children('.suggestions-results');$results.empty();var expWidth=-1;var $autoEllipseMe=$([]);for(var i=0;i<context.config.suggestions.length;i++){var text=context.config.suggestions[i];var $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,text);}else{if(context.config.highlightInput){var matchedText=text.substr(0,context.data.prevText.length);text=text.substr(context.data.prevText.length,text.length);$result.append($('<div />').css('whiteSpace','nowrap').text(text).prepend($('<strong />').text(matchedText)));}else{$result.append($('<div />').css('whiteSpace','nowrap').text(text));} |
| 402 | +var $span=$result.children('div');if($span.outerWidth()>$result.width()&&$span.outerWidth()>expWidth){expWidth=$span.outerWidth();} |
406 | 403 | $autoEllipseMe=$autoEllipseMe.add($result);}} |
407 | 404 | if(expWidth>context.data.$container.width()){var maxWidth=context.config.maxExpandFactor*context.data.$textbox.width();context.data.$container.width(Math.min(expWidth,maxWidth));} |
408 | 405 | $autoEllipseMe.autoEllipsis({hasSpan:true,tooltip:true});}} |