Index: trunk/extensions/SemanticMediaWiki/specials/AskSpecial/SMW_QueryUIHelper.php |
— | — | @@ -181,13 +181,13 @@ |
182 | 182 | } |
183 | 183 | $javascript_autocomplete_text = <<<END |
184 | 184 | <script type="text/javascript"> |
185 | | -function split(val) { |
| 185 | +function smw_split(val) { |
186 | 186 | return val.split('\\n'); |
187 | 187 | } |
188 | | -function extractLast(term) { |
189 | | - return split(term).pop(); |
| 188 | +function smw_extractLast(term) { |
| 189 | + return smw_split(term).pop(); |
190 | 190 | } |
191 | | -function escapeQuestion(term){ |
| 191 | +function smw_escapeQuestion(term){ |
192 | 192 | if (term.substring(0, 1) == "?") { |
193 | 193 | return term.substring(1); |
194 | 194 | } else { |
— | — | @@ -198,7 +198,7 @@ |
199 | 199 | jQuery.noConflict(); |
200 | 200 | /* extending jQuery functions for custom highligting */ |
201 | 201 | jQuery.ui.autocomplete.prototype._renderItem = function( ul, item) { |
202 | | - var term_without_q = escapeQuestion(extractLast(this.term)); |
| 202 | + var term_without_q = smw_escapeQuestion(smw_extractLast(this.term)); |
203 | 203 | var re = new RegExp("(?![^&;]+;)(?!<[^<>]*)(" + term_without_q.replace("/([\^\$\(\)\[\]\{\}\*\.\+\?\|\\])/gi", "\\$1") + ")(?![^<>]*>)(?![^&;]+;)", "gi"); |
204 | 204 | var loc = item.label.search(re); |
205 | 205 | if (loc >= 0) { |
— | — | @@ -331,7 +331,9 @@ |
332 | 332 | */ |
333 | 333 | protected function getQueryFormBox( $errors = '' ) { |
334 | 334 | $result = ''; |
335 | | - $result = Html::element( 'textarea', array( 'name' => 'q', 'id' => 'querybox', 'rows' => '6' ), $this->uiCore->getQueryString() ); |
| 335 | + $result = Html::element( 'textarea', array( 'name' => 'q', 'id' => 'querybox', |
| 336 | + 'rows' => '1'), |
| 337 | + $this->uiCore->getQueryString() ); |
336 | 338 | // TODO:enable/disable on checking for errors; perhaps show error messages right below the box |
337 | 339 | return $result; |
338 | 340 | } |
— | — | @@ -745,7 +747,7 @@ |
746 | 748 | jQuery.getJSON(url, 'search='+request.term, function(data){ |
747 | 749 | //remove the namespace prefix 'Property:' from returned data and add prefix '?' |
748 | 750 | for(i=0;i<data[1].length;i++) data[1][i]="?"+data[1][i].substr(data[1][i].indexOf(':')+1); |
749 | | - response(jQuery.ui.autocomplete.filter(data[1], escapeQuestion(extractLast(request.term)))); |
| 751 | + response(jQuery.ui.autocomplete.filter(data[1], smw_escapeQuestion(smw_extractLast(request.term)))); |
750 | 752 | }); |
751 | 753 | }, |
752 | 754 | focus: function() { |
— | — | @@ -753,7 +755,7 @@ |
754 | 756 | return false; |
755 | 757 | }, |
756 | 758 | select: function(event, ui) { |
757 | | - var terms = split( this.value ); |
| 759 | + var terms = smw_split( this.value ); |
758 | 760 | // remove the current input |
759 | 761 | terms.pop(); |
760 | 762 | // add the selected item |