Update Tildes with "Newest reply" to 1.0.1
- Fix newest reply sorting algorithm (see ad00abe067
)
This commit is contained in:
parent
fab80b9266
commit
909dc69dc0
|
@ -2,7 +2,7 @@
|
|||
// @name Tildes with "Newest reply"
|
||||
// @namespace blankie-scripts
|
||||
// @match https://tildes.net/*
|
||||
// @version 1.0.0
|
||||
// @version 1.0.1
|
||||
// @author blankie
|
||||
// @description A userscript that adds a "newest reply" to topics on Tildes
|
||||
// @inject-into content
|
||||
|
@ -12,8 +12,14 @@
|
|||
"use strict";
|
||||
|
||||
function commentSortKey(li) {
|
||||
// Set `li` to the first reply if possible
|
||||
li = li.querySelector(".comment-tree-item") || li;
|
||||
// Set `li` to the most nested reply
|
||||
while (true) {
|
||||
let reply = li.querySelector(".comment-tree-item");
|
||||
if (!reply) {
|
||||
break;
|
||||
}
|
||||
li = reply;
|
||||
}
|
||||
return new Date(li.querySelector(".comment-header .comment-posted-time").dateTime);
|
||||
}
|
||||
|
||||
|
@ -87,4 +93,4 @@ function addNewestReply() {
|
|||
addNewestReply();
|
||||
if ((new URLSearchParams(location.search)).get("b_comment_order") === "newest_reply") {
|
||||
sortCommentsByNewestReply();
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue