Skip to content
Permalink
v1.3.3
Go to file
 
 
Cannot retrieve contributors at this time
35 lines (32 sloc) 1.32 KB
export default async function ({ addon }) {
await addon.tab.loadScript(addon.self.lib + "/linkify.min.js");
await addon.tab.loadScript(addon.self.lib + "/linkify-element.min.js");
const pageType = document.location.pathname.substr(1).split("/")[0];
let comments;
switch (pageType) {
case "users":
document.querySelectorAll("#user-details .read-only").forEach((element) => linkifyElement(element));
break;
case "projects":
// Need to convert #[numbers] to solve conflict between tags and external Scratch player links.
document.querySelectorAll(".project-description a").forEach((element) => {
if (/^#\d+$/.test(element.textContent) && element.previousSibling instanceof Text) {
element.previousSibling.textContent += element.textContent;
element.remove();
}
});
linkifyElement(document.querySelector(".project-description"));
break;
case "studios":
linkifyElement(document.querySelector("#description.read-only .overview"));
break;
}
while (true) {
await addon.tab.waitForElement(".comment:not(.more-links-checked)");
comments = document.querySelectorAll(".comment:not(.more-links-checked)");
comments.forEach((comment) => {
linkifyElement(comment);
comment.classList.add("more-links-checked");
});
}
}
You can’t perform that action at this time.