// ==UserScript== // @name Steve's Blocker Script // @version 2.3.3 // @require http://code.jquery.com/jquery-2.0.3.min.js // @include *forum.blockland.us* // @include *blockland.us/smf* // @description Block users and topics. // @author Steve5451 // ==/UserScript== //Known bugs: // none?????? // You can set these variables before deploying the script, but it's not nessisary as you can change the settings in Look and Layout Preferences. var defaultUsersToBlock = "Emo Freak"; //The user(s) you want to be blocked, seperated with a comma without a space. Eg. "Emo Freak,Nal,Steve-senpai" without quotes. var defaultImgMode = false; //True to block JUST their images, false to block their entire post. This can be changed in your Look and Layout Preferences. //-------Other variables that aren't in Look and Layout Preferences.--------\\ var blockTopics = true; //Should a blocked user's topic be blocked? Note: This doesn't apply if you have it set to only block images. var revealText = 'Show garbage'; //The text on the button to show the post / blocked topic. var hideText = 'Hide garbage'; //The text on the button to hide the revealed post / blocked topic. var removeIconURL = 'http://i.imgur.com/txG3bgo.png'; // -------- You should probably leave the below alone ---------\\\ function blockstuffs(item) { if(imgMode == true) { item.find('img').each(function() { if($(this).parent().attr('class') != 'quote') { $(this).before(''); $(this).wrap('
'); } }); } else { item.before(''); item.wrap(''); } } function blockQuote(item) { if(imgMode == true ) { item.find('img').each(function() { $(this).before(''); $(this).wrap(''); }); } else { item.wrapInner(''); item.prepend(''); } } function blockTopic(item) { item.before('' + revealText + ''); item.wrap(''); } function createRemoveButtons() { $('.windowbg2').each(function() { if($(this).children().first().is('img') && $(this).children().first().attr('src') != removeIconURL) { $(this).prepend(''); } }); $('.removeTopic').click(function() { if(localStorage['blockURL'] == undefined) { var newArray = new Array(); localStorage['blockURL'] = JSON.stringify(newArray); } var curURLS = localStorage['blockURL']; var curArray = JSON.parse(curURLS); curArray.push($(this).parent().parent().children().eq(1).children().first().attr('href')); localStorage['blockURL'] = JSON.stringify(curArray); checkTopics(); }); } if(localStorage.blockedUsers2 != undefined) { var blockedUsers = localStorage.blockedUsers2; if(localStorage.imgMode == 'true') { imgMode = true; } else { imgMode = false; } var curName = blockedUsers.split(','); curName.forEach(function(thisName) { if(document.URL.indexOf('?topic=') != -1) { $('.windowbg, .windowbg2').each(function() { var name = $(this).children().children().first().children().first().children().first().children().first().children().first().html(); if(name == thisName) { blockstuffs($(this).find('.post')); } }); $('.quoteheader').each(function() { var name = $(this).children().first().html().split('Quote from: ')[1].split(' on ')[0]; if(name == thisName) { blockQuote($(this).next('.quote')); } }); } else if(document.URL.indexOf('?action=post') != -1) { $('.catbg').each(function() { if($(this).children().first().html() == '\n Posted by: ' + thisName + '\n ') { blockstuffs($(this).next().next().find('.post')); } }); $('.quoteheader').each(function() { var name = $(this).children().first().html().split('Quote from: ')[1].split(' on ')[0]; if(name == thisName) { blockQuote($(this).next('.quote')); } }); } if(document.URL.indexOf('?board=') != -1) { $('.windowbg2').each(function() { var topicCreator = $(this).children().first().html(); if(topicCreator == thisName && imgMode == false && blockTopics == true) { blockTopic($(this).prev().children().first()); } }); } }); $('.togglePost').click(function() { if($(this).attr('revealed') == 'false') { $(this) .attr('revealed', 'true') .val(hideText) .next().css('height', 'auto') .css('width', 'auto'); } else { $(this) .attr('revealed', 'false') .val(revealText) .next().css('height', '0px') .css('width', '0px'); } }); $('.toggleTopic').click(function() { $(this) .next().css('height', 'auto') .css('width', 'auto') $(this).remove(); }); } else { showFirstAlert(); } function showFirstAlert() { if(localStorage.imgMode == false) { var whatsBlocked = "their entire posts"; } else { var whatsBlocked = "just their images"; } $('body').first().append('