Last active
April 5, 2017 18:28
-
-
Save Aryoam/4c94d8b03b57e097c8aa 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== | |
// @name Bloqueador Shouts y Post | |
// @version 0.1 | |
// @description Oculta Shouts de Destacados Y Post del la Home | |
// @author AryoamGames and N3HL and OverJT | |
// @match https://www.taringa.net/* | |
// @match http://www.taringa.net/* | |
// @grant none | |
// ==/UserScript== | |
/* jshint -W097 */ | |
//'use strict'; | |
//Agradecimiento a OverJT y ByStrike Que aportaron a la creacion de este codigo. | |
(function() { | |
function getBlacklistedUsers() { | |
if (localStorage.BlacklistedUsers == undefined) { | |
localStorage.setItem('BlacklistedUsers', '[]'); | |
return []; | |
} | |
var de = JSON.parse(localStorage.BlacklistedUsers); | |
return de; | |
} | |
function addUser(user) { | |
var de = JSON.parse(localStorage.BlacklistedUsers); | |
de.push(user); | |
localStorage.BlacklistedUsers = JSON.stringify(de); | |
} | |
function removeUser(user) { | |
var de = JSON.parse(localStorage.BlacklistedUsers); | |
var indx = de.indexOf(user); | |
if (indx > -1) { | |
de.splice(indx, 1); | |
localStorage.BlacklistedUsers = JSON.stringify(de); | |
} | |
} | |
var box = `<div class="box" id="blockedShouts"> | |
<hr /> | |
<div class="title clearfix"> | |
<h2>Bloquear cancer de Destacados</h2> | |
</div> | |
<div style="margin-top: 8px; width: 95%"> | |
<input type="text" class="input" style="width: 100%;" id="userToBlock" autocomplete="off" placeholder="Escribe el nombre del cancerigeno"> | |
<button class="btn r" style="width: 100%; margin-top: 5px;">Bloquear</button> | |
</div> | |
<div class="list"> | |
</div> | |
</div>`; | |
var list_element = '<div class="list-element"><b>%username%</b><span style="cursor:pointer" class="value delUser" data-user="%username%">Desbloquear</span></div>'; | |
$(".section-perfil #sidebar").prepend(box); | |
$("body").on("click", "#blockedShouts button", function(e) { | |
var userToBlock = $("#userToBlock").val(); | |
if ($.inArray(userToBlock, getBlacklistedUsers()) == -1) { | |
addUser(userToBlock); | |
$("#blockedShouts > div.list").append(list_element.replace(/%username%/g, userToBlock)); | |
} | |
}); | |
$("body").on("click", ".delUser", function(e) { | |
removeUser($(this).data("user")); | |
$(this).closest("div.list-element").remove(); | |
}); | |
function main() { | |
var userlist = getBlacklistedUsers(); | |
var $list = $("#blockedShouts div.list"); | |
userlist.forEach(function(item) { | |
$list.append(list_element.replace(/%username%/g, item)); | |
var selector = 'a.hovercard.shout-user_name[href="http://www.taringa.net/' + item + '"]'; | |
var usuario = document.querySelectorAll(selector); | |
for (i = 0; i < usuario.length; i++) { | |
usuario[i].parentNode.parentNode.parentNode.parentNode.style.display = 'none'; | |
} | |
for (j = 0; j < item.length; j++) { | |
(item[j]); | |
} | |
}); | |
} | |
$(document).ready(function(e) { | |
main(); | |
}); | |
//Gracias Overjt | |
$(document).ajaxSuccess(function(event, jqXHR, settings) { | |
if (settings.url.indexOf('ajax/feed/fetch') > -1 || settings.url.indexOf('serv/more/trend') > -1) { | |
main(); | |
} | |
}); | |
})(); | |
(function() { | |
function getcraperos() { | |
if (localStorage.craperos == undefined) { | |
localStorage.setItem('craperos', '[]'); | |
return []; | |
} | |
var dee = JSON.parse(localStorage.craperos); | |
return dee; | |
} | |
function addUsers(users) { | |
var dee = JSON.parse(localStorage.craperos); | |
dee.push(users); | |
localStorage.craperos = JSON.stringify(dee); | |
} | |
function removeUsers(users) { | |
var dee = JSON.parse(localStorage.craperos); | |
var indx = dee.indexOf(users); | |
if (indx > -1) { | |
dee.splice(indx, 1); | |
localStorage.craperos = JSON.stringify(dee); | |
} | |
} | |
var box = `<div class="box" id="blockedcrap"> | |
<div class="title clearfix"> | |
<h2>Bloquear Craperos</h2> | |
</div> | |
<div style="margin-top: 8px; width: 95%"> | |
<input type="text" class="input" style="width: 100%;" id="usersBlock" autocomplete="off" placeholder="Escribe el nombre del Crapero"> | |
<button class="btn r" style="width: 100%; margin-top: 5px;">Bloquear</button> | |
</div> | |
<div class="list"> | |
</div> | |
</div>`; | |
var list_elements = '<div class="list-element"><b>%username%</b><span style="cursor:pointer" class="value delUser" data-users="%username%">Desbloquear</span></div>'; | |
$(".section-perfil #sidebar").prepend(box); | |
$("body").on("click", "#blockedcrap button", function(e) { | |
var usersBlock = $("#usersBlock").val(); | |
if ($.inArray(usersBlock, getcraperos()) == -1) { | |
addUsers(usersBlock); | |
$("#blockedcrap > div.list").append(list_elements.replace(/%username%/g, usersBlock)); | |
} | |
}); | |
$("body").on("click", ".delUser", function(e){ | |
removeUsers($(this).data("users")); | |
$(this).closest("div.list-element").remove(); | |
}); | |
function main() { | |
var userslist = getcraperos(); | |
var $list = $("#blockedcrap div.list"); | |
userslist.forEach(function (items){ | |
$list.append(list_elements.replace(/%username%/g, items)); | |
var selector = 'a[title="' + items + '"]'; | |
var usuario = document.querySelectorAll(selector); | |
for (i = 0; i < usuario.length; i++) { | |
usuario[i].parentNode.parentNode.style.display = 'none'; | |
} | |
for (j = 0; j < items.length; j++) { | |
(items[j]); | |
} | |
}); | |
} | |
$(document).ready(function(e) { | |
main(); | |
}); | |
})(); |
Hola, es posible que pongas las listas una al lado de la otra, o una de cada lado de la pantalla, y no una debajo de la otra?
Muchas gracias, muy bueno este script!
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
exelente