Here's the code if anyone's interested.
function hidePost(post) {
const postContainer = post;
const horizontalRule = postContainer.nextElementSibling;
const potentialLikesContainer = horizontalRule.nextElementSibling;
postContainer.style.display = 'none';
if (potentialLikesContainer.tagName === 'DIV') {
potentialLikesContainer.style.display = 'none';
}
}
async function getIgnoredList() {
const response = await fetch('http://www.thebore.com/forum/index.php?action=profile;area=lists;sa=ignore', {
credentials: 'same-origin',
});
const html = await response.text();
const parser = new window.DOMParser();
const ignoredDocument = parser.parseFromString(html, 'text/html');
const ignoredLinks = ignoredDocument.querySelectorAll('.windowbg2 > td:first-child > a');
const quotedPosts = document.querySelectorAll('.topslice_quote > a');
[...quotedPosts].forEach((quotedPost) => {
[...ignoredLinks].forEach((ignoredLink) => {
if (quotedPost.textContent.substr(ignoredLink.textContent) !== -1) {
hidePost(quotedPost.closest('.post_wrapper').parentElement);
}
});
});
}
function onGetSettings(results) {
const settings = results.settings || {};
if (settings.hideQuotedPosts) {
getIgnoredList();
}
}
const ignoredPosts = document.querySelectorAll('[id$="_ignored_prompt"]');
ignoredPosts.forEach((post) => {
const postContainer = post.parentElement.parentElement.parentElement;
hidePost(postContainer);
});
chrome.storage.sync.get(['settings'], onGetSettings);
If there's any obvious improvements to be made give me a heads up. I basically wrote this up while rewatching two RLM Re:Views.