diff --git a/js/mastodon/mastopinner.js b/js/mastodon/mastopinner.js index e544566..c353a63 100644 --- a/js/mastodon/mastopinner.js +++ b/js/mastodon/mastopinner.js @@ -1,4 +1,7 @@ -const STATUS_SELECTOR = '.item-list .status'; +const STATUS_SELECTORS = [ + '.item-list .status', + '.scrollable .status' +]; class MastoPinner { constructor() { @@ -17,7 +20,12 @@ class MastoPinner { } // inject the initially visible statuses - let statuses = document.querySelectorAll(STATUS_SELECTOR); + let statuses = []; + STATUS_SELECTORS.forEach((selector) => { + document.querySelectorAll(selector).forEach((s) => { + statuses.push(s); + }); + }); if (statuses.length > 0) { this._inject(); } @@ -30,7 +38,12 @@ class MastoPinner { } async _inject() { - let statuses = document.querySelectorAll(STATUS_SELECTOR); + let statuses = []; + STATUS_SELECTORS.forEach((selector) => { + document.querySelectorAll(selector).forEach((s) => { + statuses.push(s); + }); + }); if (statuses.length == 0) { console.warn(`MastoPinner: couldn't inject the UI: no statuses found.`); return; diff --git a/js/mastodon/mastopinner_ui.js b/js/mastodon/mastopinner_ui.js index a82b87b..d2aa9d7 100644 --- a/js/mastodon/mastopinner_ui.js +++ b/js/mastodon/mastopinner_ui.js @@ -1,3 +1,7 @@ +const ACTION_BAR_SELECTORS = [ + 'div.status__action-bar' +]; + class MastoPinnerUI { constructor(status, { send }) { this.status = status; @@ -6,7 +10,7 @@ class MastoPinnerUI { } render() { - this.actionBar = this.status.querySelector('div.status__action-bar'); + this.actionBar = this.status.querySelector(ACTION_BAR_SELECTORS); // define node to insert let nodeHtml = `