Commits

jacobmason committed 3482889

fix sorting

Comments (0)

Files changed (1)

sphinx/themes/basic/static/websupport.js

 })(jQuery);
 
 (function($) {
-  var comp;
+  var comp, by;
 
   function init() {
     initEvents();
    Set comp, which is a comparator function used for sorting and
    inserting comments into the list.
   */
-  function setComparator(by) {
+  function setComparator() {
     // If the first three letters are "asc", sort in ascending order
     // and remove the prefix.
     if (by.substring(0,3) == 'asc') {
 
     // Reset link styles and format the selected sort option.
     $('a.sel').attr('href', '#').removeClass('sel');
-    $('#' + by).removeAttr('href').addClass('sel');
+    $('a.' + by).removeAttr('href').addClass('sel');
   }
 
   /*
    the sortBy cookie, use those, otherwise use the default.
   */
   function initComparator() {
-    var by = 'rating'; // Default to sort by rating.
+    by = 'rating'; // Default to sort by rating.
     // If the sortBy cookie is set, use that instead.
     if (document.cookie.length > 0) {
       var start = document.cookie.indexOf('sortBy=');
         }
       }
     }
-    setComparator(by);
+    setComparator();
   }
 
   /*
     var context = $.extend({id: id}, opts);
     var popup = $(renderTemplate(popupTemplate, context)).hide();
     popup.find('textarea[name="proposal"]').hide();
+    popup.find('a.' + by).addClass('sel');
     var form = popup.find('#cf' + id);
     form.submit(function(event) {
       event.preventDefault();
   */
   function handleReSort(link) {
     var classes = link.attr('class').split(/\s+/);
-    var by = '';
     for (var i=0; i<classes.length; i++) {
       if (classes[i] != 'sort_option') {
 	by = classes[i];
       }
     }
-    setComparator(by);
+    setComparator();
     // Save/update the sortBy cookie.
     var expiration = new Date();
     expiration.setDate(expiration.getDate() + 365);
         </p>\
       </form>\
       <h3 id="cn<%id%>">loading comments... <img src="<%loadingImage%>" alt="" /></h3>\
-      <ul id="cl<%id%>"></ul>\
+      <ul id="cl<%id%>" class="comment_ul"></ul>\
     </div>';
 
   $(document).ready(function() {
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.