Skip to content

Instantly share code, notes, and snippets.

Created April 24, 2017 04:58
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save anonymous/7c82d6d4c8962ca58c5e3af79ef63d68 to your computer and use it in GitHub Desktop.
Save anonymous/7c82d6d4c8962ca58c5e3af79ef63d68 to your computer and use it in GitHub Desktop.
// ==UserScript==
// @require https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js
// @name Instance mute for Mastodon
// @namespace https://mastodon.social/web/*
// @version 0.2
// @description
// @author https://mastodon.social/@yatchi
// @match https://mastodon.social/web/*
// @grant unsafeWindow
// @run-at document-end
// ==/UserScript==
$(document).ready(function () {
// Label of the federated timeline. Change to match your locale.
var ftlLabel = 'Federated timeline';
// List the domains to mute here.
var mutedDomains = ['domain1.com', 'domain2.com'];
if (mutedDomains.length > 0) {
var escapedDomains = mutedDomains.map(function (str) {
return '@' + str.replace(/[.?*+^$[\]\\(){}|-]/g, "\\$&") + '$';
})
var re = new RegExp(escapedDomains.join('|'), 'i');
$(document).on('DOMSubtreeModified', function () {
$('div.columns-area > div:last-child[aria-label="' + ftlLabel + '"] div.status span.display-name').each(function (index) {
if(re.exec($(this).text()) !== null) {
$(this).parent().parent().parent().hide();
}
});
});
}
});
@yiskah
Copy link

yiskah commented Apr 24, 2017

ah!!! <3 <3 <3 <3

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment