Skip to content

Instantly share code, notes, and snippets.

@rvllvd
Last active September 28, 2024 09:09
Show Gist options
  • Select an option

  • Save rvllvd/3b4a0e433a397148539cfa447b34e49f to your computer and use it in GitHub Desktop.

Select an option

Save rvllvd/3b4a0e433a397148539cfa447b34e49f to your computer and use it in GitHub Desktop.
// ==UserScript==
// @name BlueSky Filtred
// @namespace http://tampermonkey.net/
// @version 2024-09-28
// @description try to take over the world!
// @author Ruslan D. Revellved (https://revellved.github.io)
// @match https://bsky.app/*
// @icon https://www.google.com/s2/favicons?sz=64&domain=bsky.app/*
// @grant none
// ==/UserScript==
(function() {
'use strict';
const filtersChunks = ["тест"];
const secondsUpdate = 5;
// Любое вхождение из списка будет фильтроваться (можно использовать RegExp)
// Работает по части слова. Например "тест", отфильтрует как "тест", так и "тестовое сообщение"
const isFiltring = text => text.toLowerCase().match(filtersChunks.join("|").toLowerCase())?.length >= 1;
const isPostText = el => el.attributes["data-testid"]?.value === "postText";
function removePostsByFilters() {
for (let elPost of document.getElementsByClassName("css-175oi2r")) {
if (elPost.attributes["data-testid"]?.value?.startsWith("feedItem")) {
for (let elText of elPost.getElementsByClassName("css-146c3p1")) {
if (isPostText(elText) && isFiltring(elText.innerText)) elPost.remove(); // Remove post
}
}
}
};
window.addEventListener("load", () => setInterval(removePostsByFilters, secondsUpdate * 1000));
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment