-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
f555b0b
commit f2175a7
Showing
2 changed files
with
73 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
JSON.stringify( | ||
x.filter(({ source_type: type }) => type === 'post_comment') | ||
.map(( | ||
{ | ||
post_comment_id: id, | ||
post_comments: { | ||
posts: { | ||
description: post, | ||
slug, | ||
}, | ||
body: comment, | ||
post_comments: replies, | ||
}, | ||
receiver_profile: { username }, | ||
}, | ||
) => ( | ||
{ | ||
username, | ||
post, | ||
comment, | ||
reply: replies[0]?.body, | ||
link: `https://www.butterflies.ai/users/${username}/p/${slug}?comment_id=${id}`, | ||
} | ||
)), | ||
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
// ==UserScript== | ||
// @name filter by viewers | ||
// @namespace http://tampermonkey.net/ | ||
// @version 2024-02-29 | ||
// @description hide the channels that have more viewers than a certain amount | ||
// @author Josh Parker | ||
// @match https://www.twitch.tv/directory/all | ||
// @icon https://www.google.com/s2/favicons?sz=64&domain=twitch.tv | ||
// @grant none | ||
// ==/UserScript== | ||
|
||
(function filterByViewers() { | ||
const moOptions = { | ||
subtree: true, | ||
childList: true, | ||
}; | ||
|
||
const bodyMoCallback = function bodyMoCallback(_, mutationObserver) { | ||
const directoryContainer = document.querySelector('[data-target="directory-container"]'); | ||
console.log(directoryContainer); | ||
if (!directoryContainer) { | ||
console.log('will retry'); | ||
return; | ||
} | ||
|
||
const moCallback = function moCallback() { | ||
const dataTargets = directoryContainer | ||
.querySelectorAll('.tw-tower > [data-target]'); | ||
dataTargets.forEach((dataTarget) => { | ||
const twMediaCardStat = dataTarget.querySelector('.tw-media-card-stat'); | ||
if ( | ||
twMediaCardStat.textContent.match(/\dK/i) | ||
|| twMediaCardStat.textContent.match(/\d{3}/) | ||
|| twMediaCardStat.textContent.match(/[4-9]\d/) | ||
|| twMediaCardStat.textContent.match(/39/) | ||
) dataTarget.style.setProperty('display', 'none'); | ||
}); | ||
}; | ||
|
||
const mo = new MutationObserver(moCallback); | ||
mo.observe(directoryContainer, moOptions); | ||
|
||
mutationObserver.disconnect(); | ||
}; | ||
|
||
const bodyMo = new MutationObserver(bodyMoCallback); | ||
bodyMo.observe(document.body, moOptions); | ||
}()); |