svn: /web/php/trunk/js/ common.js

[email protected] (Hannes Magnusson)
Newsgroups php.webmaster
Message-ID <[email protected]>
bjori                                    Sat, 01 Jan 2011 15:41:43 +0000

Revision: http://svn.php.net/viewvc?view=revision&revision=306949

Log:
Optimize out useless function call in category header resolving (still commented out though)
Only display 20 results, more then that is quite useless

Changed paths:
    U   web/php/trunk/js/common.js

Modified: web/php/trunk/js/common.js
===================================================================
--- web/php/trunk/js/common.js	2011-01-01 15:27:51 UTC (rev 306948)
+++ web/php/trunk/js/common.js	2011-01-01 15:41:43 UTC (rev 306949)
@@ -40,14 +40,14 @@
         });
         $.widget("custom.catcomplete", $.ui.autocomplete, {
             /*
-             * Print out category headers rather then in () after the match
+             // Print out category headers rather then in () after the match
             _renderMenu: function(ul, items) {
                 var self = this, currentCategory = "";
                 $.each(items, function(index, item) {
-                    var cat = self._resolveIndexName(item.category);
-                    if (cat != currentCategory) {
+                    if (item.category != currentCategory) {
+                        var cat = self._resolveIndexName(item.category);
                         ul.append("<li class='ui-autocomplete-category'>" + cat + "</li>");
-                        currentCategory = cat;
+                        currentCategory = item.category;
                     }

                     self._renderItem(ul, item);
@@ -80,7 +80,7 @@
         $('#headsearch-keywords').catcomplete({
             delay:      50,
             minScore:   50,
-            maxResults: 50,
+            maxResults: 20,
             source: function(request, response){
                 var term  = request.term;
                 var minScore = this.options.minScore;
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.