[extensions-web] js: Fix the site resetting to page 1 on page load



commit 65e70dcd70519d8b9f85cd9a2a9cfaa24c3bf0cb
Author: Jasper St. Pierre <jstpierre mecheye net>
Date:   Sat Jun 2 05:03:45 2012 -0400

    js: Fix the site resetting to page 1 on page load

 sweettooth/static/js/main.js |    9 +++++----
 1 files changed, 5 insertions(+), 4 deletions(-)
---
diff --git a/sweettooth/static/js/main.js b/sweettooth/static/js/main.js
index 7db21e2..76a76f8 100644
--- a/sweettooth/static/js/main.js
+++ b/sweettooth/static/js/main.js
@@ -119,18 +119,19 @@ function($, messages, modal, hashParamUtils) {
 
                 // Scroll the page back up to the top.
                 document.documentElement.scrollTop = 0;
-            });
+            }).trigger('load-page');
 
-        var term = null;
-        $('#search_input').on('keyup', function() {
+        var term = "";
+        $('#search_input').on('input', function() {
             var newTerm = $.trim($(this).val());
 
             if (newTerm != term) {
                 term = newTerm;
+                // On a new search parameter, reset page to 0.
                 hashParamUtils.setHashParam('page', undefined);
                 $extensionsList.trigger('load-page');
             }
-        }).trigger('keyup');
+        });
 
         $('#error_report').fillInErrors();
 



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]