Skip to content

Commit 1032e81

Browse files
authored
feat: create link to pushshift info if failed twice (#97)
1 parent 54ddfe3 commit 1032e81

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

script.js

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// ==UserScript==
22
// @name Unedit and Undelete for Reddit
33
// @namespace http://tampermonkey.net/
4-
// @version 3.16.3
4+
// @version 3.16.4
55
// @description Creates the option next to edited and deleted Reddit comments/posts to show the original comment from before it was edited
66
// @author Jonah Lawrence (DenverCoder1)
77
// @grant none
@@ -590,8 +590,18 @@
590590
logging.warn("No matching post:", out);
591591
} else {
592592
// other issue occurred with displaying comment
593+
if (loading.innerText === "fetch failed" && loading.parentElement.querySelector(".pushshift-link") === null) {
594+
const linkToPushshift = document.createElement("a");
595+
linkToPushshift.target = "_blank";
596+
linkToPushshift.style = "text-decoration: underline; cursor: pointer; margin-left: 6px; font-style: normal; font-weight: bold; color: #e5766e;";
597+
linkToPushshift.className = loading.className;
598+
linkToPushshift.classList.add("pushshift-link");
599+
linkToPushshift.href = "https://www.reddit.com/r/pushshift/comments/13508r9/pushshift_no_longer_has_access_to_the_reddit_api/";
600+
linkToPushshift.innerText = "CHECK r/PUSHSHIFT FOR MORE INFO";
601+
loading.parentElement.appendChild(linkToPushshift);
602+
}
593603
loading.innerText = "fetch failed";
594-
loading.title = "This is likely due to a Pushshift API issue. Please try again later.";
604+
loading.title = "This is likely due to a Pushshift API issue. Please check r/pushshift for updates.";
595605
logging.error("Fetch failed:", out);
596606
}
597607
});

0 commit comments

Comments
 (0)