From 261b15ffa335018018e75ecfe0dad418f0811f38 Mon Sep 17 00:00:00 2001 From: bitWolfy Date: Sun, 30 Jul 2023 20:56:04 -0700 Subject: [PATCH] [LinkGrabber[ Add support for vote pages --- src/js/components/LinkGrabber.ts | 6 +++++- src/js/models/data/Page.ts | 5 +++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/src/js/components/LinkGrabber.ts b/src/js/components/LinkGrabber.ts index 6bf9c02..c78d668 100644 --- a/src/js/components/LinkGrabber.ts +++ b/src/js/components/LinkGrabber.ts @@ -5,7 +5,7 @@ export default class LinkGrabber extends Component { public constructor() { super({ - constraint: [PageDefinition.changes, PageDefinition.comments.list], + constraint: [PageDefinition.changes, PageDefinition.comments.list, PageDefinition.votes.comment, PageDefinition.votes.post], waitForDOM: true, }); } @@ -23,6 +23,10 @@ export default class LinkGrabber extends Component { const latest = $("article.comment").first(); if(!latest.length) return; id = parseInt(latest.data("commentId")) || null; + } else if(Page.matches(PageDefinition.votes.comment) || Page.matches(PageDefinition.votes.post)) { + const latest = $("#votes tbody tr td").first(); + if(!latest.length) return; + id = parseInt(latest.text()); } else return; if(!id) return; diff --git a/src/js/models/data/Page.ts b/src/js/models/data/Page.ts index 99a5118..708af3b 100644 --- a/src/js/models/data/Page.ts +++ b/src/js/models/data/Page.ts @@ -193,6 +193,11 @@ export const PageDefinition = { new: /^\/bans\/new/, }, + votes: { + comment: /^\/comment_votes\/?/, + post: /^\/post_votes\/?/, + }, + // Custom pluginSettings: /^\/plugins\/remt.*/, };