Skip to content

Commit

Permalink
even more node stuff
Browse files Browse the repository at this point in the history
  • Loading branch information
RealDekkia committed Dec 25, 2024
1 parent 3ade410 commit 413ee64
Showing 1 changed file with 20 additions and 1 deletion.
21 changes: 20 additions & 1 deletion thread/js/main.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,14 @@
var fakeIndexDom;
if (typeof module !== "undefined") {
var api = require('../../lib/mastodon.js/mastodon');
MastodonAPI = api;

var ph = require('../../thread/js/post-helper');
posthelper = ph;

const jsdom = require('../../../../_builder/node_modules/jsdom');
const { JSDOM } = jsdom;
fakeIndexDom = new JSDOM('');
}

const threadUnroll = {
Expand All @@ -27,7 +32,13 @@ const threadUnroll = {
},
initPageAsApi: function (instanceUri, statusID, title, callback) {
if (instanceUri && statusID && callback) {

if (typeof module !== "undefined") {
threadUnroll.currentServer = 'mastodon';
}

threadUnroll.initApi(instanceUri);
console.log(statusID);
threadUnroll.getAllStatuses(statusID, [], function (x) {
threadUnroll.drawstatuses(x, callback, title);
}, true, statusID, instanceUri);
Expand Down Expand Up @@ -150,6 +161,8 @@ const threadUnroll = {
var continueFindStart = findStart;
if (data.in_reply_to_id == null) continueFindStart = false;



threadUnroll.getAllStatuses(statusID, previousStatusArr, callback, continueFindStart, initStatusID, instanceUri);
});
} else if (threadUnroll.currentServer == "misskey") {
Expand Down Expand Up @@ -209,7 +222,7 @@ const threadUnroll = {
}
});

console.log(previousStatusArr);
//console.log(previousStatusArr);

var originalPoster = sortedStatusArr[0].account.id;
var failedFinds = 0;
Expand Down Expand Up @@ -260,6 +273,12 @@ const threadUnroll = {
}
},
drawstatuses: function (statusArr, callback = false, title = undefined) {

if (typeof module !== "undefined") {
document = fakeIndexDom.window.document;
//fakeIndexDom
}

var mb;
if (!callback) {
var mb = document.getElementById("mainBody");
Expand Down

0 comments on commit 413ee64

Please sign in to comment.