Revert "Revert "update mod tracker""

This reverts commit 8af25ed088.
This commit is contained in:
Your New SJW Waifu 2020-05-28 16:54:37 -05:00
parent 0ab47f33c3
commit 2229e52778
1 changed files with 16 additions and 1 deletions

View File

@ -192,7 +192,7 @@ PleromaModTracker = function () {
function handlePost (postElement) {
if (
postElement.querySelectorAll &&
postElement.querySelectorAll(".attachments").length > 0
postElement.querySelectorAll(".attachments .non-gallery").length > 0
) {
const attachments = this.getModuleAttachments(postElement);
for (const attachment of attachments) {
@ -226,6 +226,21 @@ PleromaModTracker = function () {
this.toUpdate = [];
},
function onDestroy () {
const scripts = document.querySelectorAll("script");
for (const script of scripts) {
if (script.src && script.src.includes("pleroma-mod-tracker") && !script.src.endsWith("mod.js")) {
script.remove();
}
}
const stylesheets = document.querySelectorAll("link[rel=\"stylesheet\"]");
for (const style of stylesheets) {
if (style.href.endsWith("pleroma-mod-tracker/" + this.config.stylesheet)) {
style.remove();
}
}
},
function run () {
PleromaModLoader.includeModCss("pleroma-mod-tracker/" + this.config.stylesheet);
PleromaModTracker.chars = {