update mod tracker

This commit is contained in:
Your New SJW Waifu 2020-05-26 16:44:20 -05:00
parent d5b1e7cd94
commit 83743d0b15
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 = {