Permalink
Browse files

Fixed sorting bug by zero-padding id

  • Loading branch information...
Chris Hager
Chris Hager committed Dec 16, 2010
1 parent da6fdb1 commit abd0857ca476bd477406ff357069e9784929138a
Showing with 14 additions and 6 deletions.
  1. +10 −5 background.html
  2. +4 −1 options.html
View
@@ -14,13 +14,18 @@
id = parseInt(id);
}
- localStorage[request.remove] = "1";
-
+ // Save current id for next removal
+ localStorage["current_id"] = id + 1;
+
+ // Zero-pad id to enable correct sort order
+ id = id.toString(10);
+ while (id.length < 8) {
+ id = "0" + id;
+ }
+
date = d.getFullYear() + "-" + (parseInt(d.getMonth())+1) + "-" + d.getDate();
localStorage["_removed_" + id] = id + "," + date + "," + request.remove;
-
- id += 1;
- localStorage["current_id"] = id;
+ localStorage[request.remove] = "1";
}
);
View
@@ -122,7 +122,10 @@ <h2>HN Reduce Options</h2>
<br><br><br><br>
-<small><a style="text-decoration:none;" href="http://metachris.com/hn-reduce">http://metachris.com/hn-reduce</a></small>
+<small>
+ <p><a style="text-decoration:none;" href="http://metachris.com/hn-reduce">http://metachris.com/hn-reduce</a></p>
+ <p><a style="text-decoration:none;" href="https://github.com/metachris/HN-Reduce">https://github.com/metachris/HN-Reduce</a></p>
+</small>
<!-- <script type="text/javascript">document.getElementById("search").focus();</script> -->
</body>

0 comments on commit abd0857

Please sign in to comment.