]> git.99rst.org Git - irssi-scripts.irssi.org.git/commitdiff
sort votes first
authorAilin Nemui <redacted>
Tue, 30 Oct 2018 23:42:02 +0000 (00:42 +0100)
committerAilin Nemui <redacted>
Thu, 1 Nov 2018 09:46:35 +0000 (10:46 +0100)
assets/js/sorttable.js
assets/js/votes.js

index 38b0fc627c167adc470e8881bbaccb4096d0b990..6d54c1a1655a42cefe2703186d0e46a6f2b7e07d 100644 (file)
@@ -148,9 +148,9 @@ sorttable = {
                  row_array[row_array.length] = [sorttable.getInnerText(rows[j].cells[col]), rows[j]];
                }
                /* If you want a stable sort, uncomment the following line */
-               //sorttable.shaker_sort(row_array, this.sorttable_sortfunction);
+               sorttable.shaker_sort(row_array, this.sorttable_sortfunction);
                /* and comment out this one */
-               row_array.sort(this.sorttable_sortfunction);
+               //row_array.sort(this.sorttable_sortfunction);
 
                tb = this.sorttable_tbody;
                for (var j=0; j<row_array.length; j++) {
index dc08beccef1fa345012f1fd8964502867b9dc0c8..e0bbed56e52d56b10b5b76c9f5221eed18faa98d 100644 (file)
        if (when >= 0) {
            var empty = queue[what].length == 0;
            queue[what].push([how, arg]);
+           if (console && console.log && empty && when > 2000) {
+               console.log("GitHub rate limit on: " + arg + " time to wait: " +
+                           (when > 120 * 1000 ? Math.ceil(when / 1000 / 60) + " m" : Math.ceil(when / 1000) + " s"));
+           }
            if (empty) window.setTimeout(function(){reQueue(what);}, when);
        } else {
            ghLimits[what].remaining--;
     }
 
     function signalDone() {
-       if (!todo) $("#th-votes").html("Votes");
+       if (!todo) {
+           var myTH = $("#th-votes");
+           myTH.html("Votes");
+           var isSorted = [0];
+           Array.prototype.forEach.call(myTH[0].parentNode.children, function(e) {
+               if (e.classList.contains("sorttable_sorted") || e.classList.contains("sorttable_sorted_reverse")) {
+                   isSorted[0] = 1;
+               }
+           });
+           if (!isSorted[0]) {
+               sorttable.innerSortFunction.apply(myTH[0].parentNode.children[0], []);
+               sorttable.innerSortFunction.apply(myTH[0].parentNode.children[0], []);
+               sorttable.innerSortFunction.apply(myTH[0], []);
+               sorttable.innerSortFunction.apply(myTH[0], []);
+           }
+       }
     }
 
     function _jsonpToJson(dta, typ) {
git clone https://git.99rst.org/PROJECT