Created
April 24, 2017 04:58
-
-
Save anonymous/7c82d6d4c8962ca58c5e3af79ef63d68 to your computer and use it in GitHub Desktop.
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
// ==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(); | |
} | |
}); | |
}); | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
ah!!! <3 <3 <3 <3