Skip to content

Instantly share code, notes, and snippets.

@NaokiStark
Created February 7, 2015 22:53
Show Gist options
  • Save NaokiStark/d3d3d2b62ced315b353b to your computer and use it in GitHub Desktop.
Save NaokiStark/d3d3d2b62ced315b353b to your computer and use it in GitHub Desktop.
// ==UserScript==
// @name Coso que esconde actividad de reshouts
// @namespace http://www.taringa.net/XQ
// @version 0.1
// @description Coso que esconde reshouts de usuarios que no queres
// @author Fabi
// @match http://www.taringa.net/*
// @grant none
// ==/UserScript==
$.fn.addOnResizeEvent = function(custom_options) {
var options = {
timeInterval : 100,
forceIE : false
};
$.extend( custom_options, options );
// Soporte nativo IE
if ($.browser.ie && !options.forceIE) return;
return this.each( function() {
var target = $(this);
var lw, lh;
var interval = setInterval( function() {
var w = target.width(),
h = target.height();
if (!lw == undefined) lw = w;
if (!lh == undefined) lh = h;
if ( lw != w || lh != h )
{
lw = w;
lh = h;
target.trigger( "resize" );
}
}, options.timeInterval );
} );
};
var woieuiyeoughieughiweghwiguhewi=[];
var ydusakygfsaukdfguekywgfkgufywfueygfakueygfakuyfgdsuygfaueyg=false;
//var BlackList=[21926680,26136332,26236552];
$(document).ready(function(){
//Using localStorage for storage users id's
var getBlList=function(){
var de="";
prefix='<div class="list-element"><b><a href="/%%user%%" target="_blank">%%user%%</a></b><span class="value delBl" data-nuser="%%user%%" data-buser="%%id%%">Eliminar</span></div>';
BL= localStorage.BlackList.split(',');
BL.forEach(function(e){
reres = getUserDataById(e);
rerer= $.parseJSON(reres.responseText);
if(typeof rerer.nick !=="undefined"){
de+=prefix.replace(/%%user%%/g,rerer.nick).replace("%%id%%",e);
woieuiyeoughieughiweghwiguhewi.push(e);
}
});
return de;
};
var updateBlList= function(Arr){
};
var getUserDataById=function(id){
return $.ajax({
url:"http://api.taringa.net/user/view/"+id,
async: !1,
});
};
var getUserDataByNickName=function(NickName){
return $.ajax({
url:"http://api.taringa.net/user/nick/view/"+NickName,
async: !1,
});
};
if (localStorage.BlackList == null){
localStorage.setItem('BlackList', ["dummy"]);
}
var str=/^http:\/\/www\.taringa\.net\/cuenta[#]{0,1}[a-zA-Z]*[-]*[a-zA-Z]*$/g;
var txt= str.test(document.location.href);
if(txt){
var BlList= getBlList();
$('.menu-tab').append('<style>.delBl{color: #006595!important;text-decoration: none;font-weight: bold;cursor: pointer;}.delBl:hover{color: #067cb4!important;text-decoration: underline;}</style><li><a id="blA" tab="black-list" onclick="cuenta.setActiveTab(this)" rel="account-tab-black-list">Shouts BL</a></li>');
$('#blA').on('click', function(){
console.log('Loading users');
if(!ydusakygfsaukdfguekywgfkgufywfueygfakueygfakuyfgdsuygfaueyg){
$('form[name="editarcuenta"]').append('<div id="account-tab-black-list" class="content-tabs black-list"><div class="alert-cuenta"></div><fieldset><div class="field clearfix"><label for="Nick"></label><input type="text" class="text ui-corner-all form-input-text box-shadow-soft" id="Nick" name="Nick" maxlength="32" value="" placeholder="Usuario"><button class="btn v" id="AddUserToBlock">Agregar</button></div><div class="list pija-list">'+BlList+'</div></fieldset></div>');
ydusakygfsaukdfguekywgfkgufywfueygfakueygfakuyfgdsuygfaueyg=true;
$(document).on('click', '.delBl',function(e){
var uuuid= $(this).data('buser');
var guuuid=$(this).data('nuser');
var theElemnet=$(this);
//Nice Mensaje
mydialog.confirm("¿Deseas eliminar a "+guuuid+" de la lista?",'Black List',function(){
var pos = woieuiyeoughieughiweghwiguhewi.indexOf( uuuid.toString() );
pos > -1 && woieuiyeoughieughiweghwiguhewi.splice( pos, 1 );
localStorage.setItem('BlackList',woieuiyeoughieughiweghwiguhewi);
mydialog.alert('Ahora vas a ver los shouts y reshouts de '+guuuid,'Usuario eliminado');
$(theElemnet).parent().slideToggle(200);
$(theElemnet).parent().remove();
});
});
$('#AddUserToBlock').on('click', function(e){
e.preventDefault();
e.stopPropagation();
gNick=$('#Nick').val();
$('#Nick').attr('disabled','1');
$(this).hide();
var UserDa = getUserDataByNickName(gNick);
rerer= $.parseJSON(UserDa.responseText);
if(typeof rerer.nick !=="undefined"){
woieuiyeoughieughiweghwiguhewi.push(rerer.id);
localStorage.setItem('BlackList',woieuiyeoughieughiweghwiguhewi);
prefix='<div class="list-element"><b>%%user%%</b><span class="value delBl" data-nuser="%%user%%" data-buser="%%id%%">Eliminar</span></div>';
$('.pija-list').append(prefix.replace(/%%user%%/g,rerer.nick).replace("%%id%%",rerer.id));
mydialog.alert(rerer.nick+' se agregó a la Black List', 'Yeah m8');
}
else{
mydialog.alert('Ocurrio un error al procesar lo solicitado.');
}
$('#Nick').removeAttr('disabled');
$(this).show();
});
}
});
}
$("#Feed-list").addOnResizeEvent();
$('.s-action-list').each(function(i){
var rerere = $(this);
BL= localStorage.BlackList.split(',');
BL.forEach(function(e) {
if($(rerere).data('owner')==e){
//$(rerere).parent('.feed-hide').click();
$(rerere).parent('.shout-footer').parent('.activity-element').children('.activity-content').children('.activity-header').children('.s-action-list').children('.s-delete').children('ul.hide.select-list').children('li').children('.feed-hide').first().click();
console.log(e);
}
});
});
$("#Feed-list").resize(function(){
$('.s-action-list').each(function(i){
var rerere = $(this);
BL= localStorage.BlackList.split(',');
BL.forEach(function(e) {
if($(rerere).data('owner')==e){
$(rerere).parent('.shout-footer').parent('.activity-element').children('.activity-content').children('.activity-header').children('.s-action-list').children('.s-delete').children('ul.hide.select-list').children('li').children('.feed-hide').first().click();
console.log(e);
}
});
});
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment