Skip to content

Instantly share code, notes, and snippets.

@SoftCreatR
Last active August 29, 2015 14:15
Show Gist options
  • Save SoftCreatR/8a81e03c31e207d0a895 to your computer and use it in GitHub Desktop.
Save SoftCreatR/8a81e03c31e207d0a895 to your computer and use it in GitHub Desktop.
Hide posts of ignored users at woltlab.com
// ==UserScript==
// @name Get off me!
// @namespace https://www.softcreatr.de
// @include /^https?://(community|www)\.woltlab\.com/.*$/
// @version 1.0.0
// @grant none
// ==/UserScript==
var $ignoredUsersSelectors = [];
$.when($.get("/index.php/IgnoredUsers/", function(data) {
var $response = $('<html />').html(data);
$response.find('.jsIgnoredUser .activityPointsDisplay').each(function() {
$ignoredUsersSelectors.push('article.wbbPost[data-user-id="' + $(this).attr('data-user-id') + '"]:not(.messageCollapsed)');
});
})).then(function() {
$($ignoredUsersSelectors.join(', ')).removeClass('messageSidebarOrientationLeft').addClass('messageCollapsed').find('div:first').each(function () {
var $that = $(this);
var $author = $that.find('h2.username').html();
var $avatar = $that.find('img[itemprop="photo"]');
var $smallAvatar = $avatar.attr('src').replace('-128', '-32');
var $time = $that.find('.messageHeadline time').html();
$that.replaceWith('<div class="messageHeader"><ul class="messageQuickOptions" /><div class="box24"><a class="framed userLink"><img src="' + $smallAvatar + '" srcset="' + $smallAvatar + ' 2x" style="width: 24px; height: 24px" alt="Benutzer-Avatarbild" class="userAvatarImage"></a><div><h1>Beitrag von ' + $author + ' (' + $time + ')</h1><small>Dieser Beitrag wurde automatisch ausgeblendet, da dieser Benutzer von Ihnen ignoriert wird.</small></div></div>');
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment