Invert submitted() login in Sort and Perpage widgets.
[mkws-moved-to-github.git] / tools / htdocs / mkws.js
index aced7e2..e15f9ea 100644 (file)
@@ -399,32 +399,29 @@ function widget($, team, type, node) {
 
 
     function promoteSort() {
-       team.queue("navi").subscribe(function() {})
-       $(node).change(onSortChange);
-
-       function onSortChange()
-       {
+       // It seems this and the Perpage widget doen't need to
+       // subscribe to anything, since they produce events rather
+       // than consuming them.
+       $(node).change(function () {
            team.set_sortOrder($(node).val());
-           if (!team.submitted()) return false;
-           team.resetPage();
-           team.reShow();
+           if (team.submitted()) {
+               team.resetPage();
+               team.reShow();
+           }
            return false;
-       }
+       });
     }
 
 
     function promotePerpage() {
-       team.queue("navi").subscribe(function() {})
-       $(node).change(onPerpageChange);
-
-       function onPerpageChange()
-       {
+       $(node).change(function() {
            team.set_perpage($(node).val());
-           if (!team.submitted()) return false;
-           team.resetPage();
-           team.reShow();
+           if (team.submitted()) {
+               team.resetPage();
+               team.reShow();
+           }
            return false;
-       }
+       });
     }
 }