mirror of
https://github.com/gurnec/removeddit.git
synced 2026-03-11 08:54:27 +00:00
Bug fix for permalinks
This commit is contained in:
parent
1696d3c2ad
commit
92aad75ec7
3 changed files with 15 additions and 9 deletions
|
|
@ -36,6 +36,7 @@ return {
|
|||
init: init,
|
||||
subreddit: window.location.pathname.split("/")[2],
|
||||
threadID: window.location.pathname.split("/")[4],
|
||||
permalink: window.location.pathname.split("/")[6],
|
||||
fetchToken: function() {
|
||||
return fetch("https://www.reddit.com/api/v1/access_token", {
|
||||
headers: {
|
||||
|
|
|
|||
|
|
@ -1,3 +1,3 @@
|
|||
// Change this to your own client ID: https://www.reddit.com/prefs/apps
|
||||
// The app NEEDS TO BE an installed app and NOT a web apps
|
||||
var clientID = "YSidAws9twqCZg"
|
||||
var clientID = "";
|
||||
|
|
@ -130,13 +130,18 @@ return {
|
|||
setTotalComments: function(total) { totalComments = total; },
|
||||
|
||||
getRoot: function() {
|
||||
if(window.location.pathname.split("/").length >= 7) {
|
||||
if(window.location.pathname.split("/")[6] !== "") {
|
||||
return window.location.pathname.split("/")[6];
|
||||
}
|
||||
}
|
||||
|
||||
return Reddit.threadID;
|
||||
if(Reddit.permalink !== undefined && Reddit.permalink === "") {
|
||||
return Reddit.threadID;
|
||||
}
|
||||
|
||||
if(Reddit.permalink === undefined) {
|
||||
return Reddit.threadID;
|
||||
}
|
||||
|
||||
if(_.has(Comments.lookup, Reddit.permalink)) {
|
||||
return Comments.lookup[Reddit.permalink].parent_id.split("_")[1];
|
||||
}
|
||||
return "";
|
||||
},
|
||||
generate: function(removedComments) {
|
||||
removedComments.forEach(function(comment){
|
||||
|
|
@ -320,7 +325,7 @@ var ThreadHTML = (function(){
|
|||
return Comments.lookup[id].score;
|
||||
});
|
||||
|
||||
var createdComments = [Reddit.threadID];
|
||||
var createdComments = [Comments.getRoot()];
|
||||
var didSomething = false;
|
||||
|
||||
while(commentsToCreate.length > 0) {
|
||||
|
|
|
|||
Loading…
Reference in a new issue