Last active
August 29, 2015 14:15
-
-
Save SoftCreatR/8a81e03c31e207d0a895 to your computer and use it in GitHub Desktop.
Hide posts of ignored users at woltlab.com
This file contains hidden or 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== | |
| // @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