Skip to content

Commit

Permalink
Support new reddit posts
Browse files Browse the repository at this point in the history
  • Loading branch information
qsniyg committed Jun 18, 2021
1 parent bebeac0 commit 6a1cba9
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions userscript.user.js
Original file line number Diff line number Diff line change
Expand Up @@ -51758,10 +51758,11 @@ var $$IMU_EXPORT$$;
do {
if (current.tagName === "DIV") {
// data-testid: new reddit, subreddit page
// id: new reddit, post page (with a <div data-test-id="post-content"> element below)
// data-fullname: old reddit, subreddit page
var testid = current.getAttribute("data-testid") || current.getAttribute("data-fullname");
var testid = current.getAttribute("data-testid") || current.getAttribute("data-fullname") || current.getAttribute("id");
if (testid) {
match = testid.match(/^t3_([a-z0-9]+)$/);
match = testid.match(/^t3_([a-z0-9]{2,8})$/);
if (match) {
return get_reddit_link(match[1]);
}
Expand Down

0 comments on commit 6a1cba9

Please sign in to comment.