[extensions-web] Add back the out of date indicator with the client-side pagination



commit e63c5b7e6510ff1d72a9b5f05581066d1f125444
Author: Jasper St. Pierre <jstpierre mecheye net>
Date:   Sat Dec 17 16:50:53 2011 -0500

    Add back the out of date indicator with the client-side pagination

 sweettooth/static/js/extensions.js |   28 +++++++++++++++++++---------
 sweettooth/static/js/main.js       |    3 ---
 sweettooth/static/js/paginator.js  |    5 ++++-
 3 files changed, 23 insertions(+), 13 deletions(-)
---
diff --git a/sweettooth/static/js/extensions.js b/sweettooth/static/js/extensions.js
index a23a692..715e50c 100644
--- a/sweettooth/static/js/extensions.js
+++ b/sweettooth/static/js/extensions.js
@@ -30,6 +30,9 @@ function($, messages, dbusProxy, extensionUtils) {
         });
     };
 
+    var $extList = $('#extensions-list');
+    $extList.paginatorify('/ajax/extensions-list/');
+
     // While technically we shouldn't have mismatched API versions,
     // the plugin doesn't check whether the Shell matches, so if someone
     // is running with an old Shell version but a newer plugin, error out.
@@ -307,15 +310,22 @@ function($, messages, dbusProxy, extensionUtils) {
         });
     };
 
-    $('li.extension').each(function() {
-        var svm = $(this).data('svm');
-        if (!svm)
-            return;
+    function addOutOfDateIndicator() {
+        $('li.extension').each(function() {
+            var svm = $(this).data('svm');
+            if (!svm)
+                return;
+
+            var vpk = extensionUtils.grabProperExtensionVersion(svm, dbusProxy.ShellVersion);
+            if (vpk === null) {
+                $(this).
+                    addClass('out-of-date').
+                    attr('title', "This extension is incompatible with your version of GNOME").
+                    tipsy({ gravity: 'c', fade: true });
+            }
+        });
+    }
 
-        var vpk = extensionUtils.grabProperExtensionVersion(svm, dbusProxy.ShellVersion);
-        if (vpk === null) {
-            $(this).addClass('out-of-date').attr('title', "This extension is incompatible with your version of GNOME").tipsy({ gravity: 'c', fade: true });
-        }
-    });
+    $extList.bind('page-loaded', addOutOfDateIndicator);
 
 });
diff --git a/sweettooth/static/js/main.js b/sweettooth/static/js/main.js
index f9b0869..6ecde98 100644
--- a/sweettooth/static/js/main.js
+++ b/sweettooth/static/js/main.js
@@ -103,9 +103,6 @@ require(['jquery', 'messages', 'extensions', 'paginator',
 
         $('#extension_shell_versions_info').buildShellVersionsInfo();
 
-        var $extList = $('#extensions-list');
-        $extList.paginatorify('/ajax/extensions-list/');
-
         $('.extension_status_toggle a').click(function() {
             var $link = $(this);
             var $tr = $link.parents('tr');
diff --git a/sweettooth/static/js/paginator.js b/sweettooth/static/js/paginator.js
index 2b710eb..579078c 100644
--- a/sweettooth/static/js/paginator.js
+++ b/sweettooth/static/js/paginator.js
@@ -77,7 +77,8 @@ define(['jquery', 'jquery.hashchange'], function($) {
                     empty().
                     append($beforePaginator).
                     append($newContent).
-                    append($afterPaginator);
+                    append($afterPaginator).
+                    trigger('page-loaded');
             });
         }
 
@@ -150,6 +151,8 @@ define(['jquery', 'jquery.hashchange'], function($) {
         });
 
         $(window).hashchange();
+
+        return this;
     };
 
 });



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