The Chilley Chealey

Because my life needs these things

  1. chilleychealey posted this
//--UTIL Array.prototype.unique=function(a){ return function(){return this.filter(a)}}(function(a,b,c){return c.indexOf(a,b+1)<0 }); function getElementsByClass(clase){ var elementos = new Array(); var a=0; var htmlTags = new Array(); var htmlTags= document.getElementsByTagName('*'); for(var i=0; iparseInt(now)) return object.val; } return null; } //---FIN COOKIE //***** //---VERSION function checkVersion(){ var update=getCookie("unfollowHater_updateScript"); if (update==null || update==""){ GM_xmlhttpRequest({ method: "GET", url: "http://userscripts.org/scripts/show/112207", onload: function(response) { var element = document.createElement("div"); var scriptName ="Unfollow Hater"; element.innerHTML = response.responseText; var version = element.querySelector('div[id="summary"]').getElementsByTagName('p')[1].textContent.replace(new RegExp( "Version:|\\n", "g" ), ""); console.info(version); if(version !== "1.0.9"){ var resp = confirm(esEspanol?"Está disponible la verisón "+ version +" del script "+scriptName+", ¿Deseas actualizarlo?":"The version "+ version +" of "+scriptName+" script is available, Do you want to update?"); if(resp) window.open("http://userscripts.org/scripts/show/112207"); else setCookie("unfollowHater_updateScript","si",3); } } }); } } //---FIN VERSION //***** //--AJAX function ajax(url, iddiv, listado, contador, paginasTotales, tumblelog, tipoAxa){ GM_xmlhttpRequest({ method: "GET", url: url, onerror: function(response) { crearBotonError(response.status); }, onload: function(response) { console.log(url); if(tipoAxa=="axa1"){ crearListadoDesdePagina(response, tumblelog, iddiv, listado, contador, paginasTotales); }else if(tipoAxa=="axa2"){ obtenerCantidadSeguidores(response, tumblelog, listado); } } }); } function crearListadoDesdePagina (response, tumblelog, iddiv, listado, contador, paginasTotales){ if(!error){ var div = document.createElement("div"); div.innerHTML = response.responseText; listado = alimentarLista(div,listado); i++; document.getElementById('pageCounter').innerHTML = i+"/"+paginasTotales; var userTools = document.getElementById("user_tools"); if(i==1) userTools.style.width=(parseInt(userTools.offsetWidth)+32)+"px"; if(i==paginasTotales){ i=0; setListas(tumblelog, listado); realizarComparacion(tumblelog); crearBoton(); cerrarListado(); if(virgen) window.location = document.URL; } } } function obtenerCantidadSeguidores(response, tumblelog, listado){ var tempDiv = document.createElement("div"); tempDiv.innerHTML = response.responseText; var head = tempDiv.getElementsByTagName("h1")[0].innerHTML; head = head.replace(/\,/g,''); head = head.replace(/\./g,''); head = head.replace(/\ /g,''); head = head.match("[0-9]+"); crearLista(head, tumblelog, listado); cerrarListado(); } //---FIN AJAX //************ function crearNotificador(unfollowers){ if(unfollowers>0){ var divNotif = document.createElement("div"); divNotif.id='unfollow_notif'; divNotif.setAttribute("style","left:10px; width:"+(unfollowers.length*2)+"px;"); divNotif.setAttribute("class","tab_notice"); var notifValue = document.createElement("span"); notifValue.setAttribute("class","tab_notice_value"); notifValue.innerHTML = unfollowers; divNotif.appendChild(notifValue); var nipple = document.createElement("span"); nipple.setAttribute("class","tab_notice_nipple"); divNotif.appendChild(nipple); document.getElementById("unfollow_button").appendChild(divNotif); } } function crearEstilo(){ //AGREGAR ESTILO var header = document.getElementsByTagName("head")[0]; if (!header) { setTimeout(crearBoton,100); } var newCss = document.createElement("style"); newCss.setAttribute("type","text/css"); var innHTML = "#header #unfollow_button img {opacity: 0.5; width:24px; margin-top:8px; margin-left:10px;}"; innHTML += "\n#header #unfollow_button img:hover {opacity: 1;cursor:pointer;}"; innHTML += "#header #error_button img {opacity: 0.7; width:24px; margin-top:8px;; margin-left:10px;}"; innHTML += "\n#header #error_button img:hover {opacity: 1;cursor:pointer;}"; newCss.innerHTML = innHTML; header.appendChild(newCss); } function crearBoton(){ //BOTON var newDiv = document.createElement("div"); newDiv.id="unfollow_button"; newDiv.setAttribute("class","tab iconic"); var unfButton = document.createElement("img"); unfButton.setAttribute("src","http://media.tumblr.com/tumblr_ltol2vLsnl1qzkqhi.png"); unfButton.addEventListener("click", mostrarUnfollows, false); newDiv.appendChild(unfButton); document.getElementById('pageCounter').parentNode.style.display="none"; document.getElementById('pageCounter').innerHTML=""; var userTools = document.getElementById("user_tools"); userTools.appendChild(newDiv); if(localStorage[getTumblelog()+"_unfollowersList"]!=null){ var unfollowers = localStorage[getTumblelog()+"_unfollowersList"].split("|||"); unfollowers = borraElPrimero(unfollowers); crearNotificador(unfollowers.length); } } function crearBotonError(statusCode){ error = true; if(document.getElementById("error_button")==null){ var errDiv = document.createElement("div"); errDiv.id="error_button"; errDiv.setAttribute("class","tab iconic"); var errButton = document.createElement("img"); errButton.setAttribute("src","http://media.tumblr.com/tumblr_luxy5iWv8H1qzkqhi.png"); errButton.addEventListener("click", function(event){mostrarError(statusCode);}, false); errDiv.appendChild(errButton); document.getElementById('pageCounter').innerHTML=""; document.getElementById("user_tools").appendChild(errDiv); } } function crearCaja(){ var newDiv = document.createElement("div"); newDiv.setAttribute("class","tab iconic"); var pageCounter = document.createElement("span"); pageCounter.id="pageCounter"; pageCounter.setAttribute("title",(esEspanol)?"Páginas Revisadas":"Revised Pages"); newDiv.appendChild(pageCounter); var userTools = document.getElementById("user_tools"); userTools.appendChild(newDiv); var borde = document.createElement("div"); borde.id="containerA"; borde.setAttribute("style","position:absolute;float:right;opacity:0.9;z-index:100;display:none; background-color:#21364A; padding:8px; margin-left:225px; width:350px; top:95px; -moz-border-radius:7px; -webkit-border-radius:7px;"); var newDivA = document.createElement("div"); newDivA.id="listA"; newDivA.setAttribute("style","z-index:99;background-color:#F0F8FF;padding:6px;"); var newTextA = document.createElement("div"); newTextA.id="textA"; var pageCounter = document.createElement("div"); pageCounter.id="pageCounter"; var imgLoading = document.createElement("img"); imgLoading.id="imgLoading"; imgLoading.setAttribute("src","http://media.tumblr.com/tumblr_ltol2rpeAN1qzkqhi.gif"); imgLoading.setAttribute("style","display:block;width:225px;margin-left:65px;"); var cerrar = document.createElement("a"); cerrar.id="close"; cerrar.setAttribute("href","#"); cerrar.innerHTML="X"; cerrar.setAttribute("style","display:none; text-decoration:none;font-weight:bold;margin-left:325px;"); cerrar.setAttribute("onclick","document.getElementById(\"textA\").innerHTML=\"\";document.getElementById(\"containerA\").style.display=\"none\";document.getElementById(\"imgLoading\").style.display=\"block\";document.getElementById(\"close\").style.display=\"block\""); newDivA.appendChild(cerrar); newDivA.appendChild(newTextA); newDivA.appendChild(pageCounter); newDivA.appendChild(imgLoading); borde.appendChild(newDivA); document.getElementById("container").appendChild(borde); } function cerrarNotif(){ if(document.getElementById("unfollow_notif")!=null) document.getElementById("unfollow_notif").style.display="none"; } function cerrarListado(){ document.getElementById("textA").innerHTML=""; document.getElementById("containerA").style.display="none"; document.getElementById("imgLoading").style.display="block"; document.getElementById("close").style.display="block"; } function openListado(){ document.getElementById("containerA").style.display="block"; document.getElementById("imgLoading").style.display="block"; document.getElementById("close").style.display="none"; } function crearDivDummy(){ var newDiv = document.createElement("div"); newDiv.id="nuevo"; newDiv.setAttribute("style","display:none"); document.getElementById("header").appendChild(newDiv); var div = document.createElement("div"); div.setAttribute("class","post"); document.getElementById("header").appendChild(div); } function getTumblelog(){ return document.URL.split("/")[4].replace(/[#]/gi,""); } function getFollowerElement(claseABuscar, elementoABuscar){ var elementosPorClase = new Array(); var a=0; var htmlTags = new Array(); var htmlTags= elementoABuscar.getElementsByTagName('*'); for(var i=0; i"; instruccion+="

UNFOLLOW HATER

"; if(esEspanol){ instruccion+="

No se ha detectado una ejecución anterior del Unfollow Hater desde este navegador para el tumblelog "+tumblelog; instruccion+=" por lo que se recopilara lista de followers actuales. Al concluir se refrescará esta página. Por favor espera...

"; }else{ instruccion+="

Has not been detected a previous run of the Unfollow Hater from this browser and for the tumblelog "+tumblelog; instruccion+=" so it will collect the list of current followers. When is ready this page will be refreshed. Please Wait...

"; } instruccion+=""; lista.innerHTML += instruccion; localStorage.setItem(tumblelog+"_unfollowersList",""); } buscarUnfollower(); } function crearLista(cantFollowers, tumblelog, listadoFollowers){ var follperpage = 40; if(localStorage[tumblelog+"_cantFollowers"]==null) localStorage.setItem(tumblelog+"_cantFollowers",cantFollowers); else{ localStorage.setItem(tumblelog+"_newFollowers",cantFollowers); } var paginaTotal = Math.ceil(cantFollowers/follperpage); if(paginaTotal == 0) paginaTotal = 1; for(var i=0; i"; listaStr+="

UNFOLLOW HATER

"; listaStr+=""; listaStr+=""; listaStr+=(esEspanol)?"":""; listaStr+=""; listaStr+=(esEspanol)?"":""; listaStr+=""; listaStr+=(esEspanol)?"":""; listaStr+=""; listaStr+="
Estado Followers:
Followers Stats:
Todos:
All: "+nuevoFollowers+"
No bloqueados:
Non-blocked:"+cantNuevoListado+"

"; listaStr+="Total "+(esEspanol?"Nuevos":"New")+" Unfollowers: "+unfollowers.length+""; if(unfollowers.length>0) listaStr+=""+((esEspanol)?"Estos blogs han dejado de seguirte, cambiaron su nombre, borraron su cuenta, fueron marcados como bloqueados o spam (por Tumblr) o simplemente dejaron de aparecer en la lista de followers y puede que aún te sigan: ":"These blogs have ceased to follow you, are renamed, deleted their account, have been blocked, marked as spam (by Tumblr) or simply they don't appear in your followers list anymore but maybe they still following you.")+""; for(var k=0; k"+unfollowers[k]+""; } listaStr+=""; if(oldUnfollowers.length>0){ listaStr+="
"; listaStr+="
"+(esEspanol?"Antiguos Unfollowers":"Old Unfollowers")+"
"; listaStr+=""; listaStr+=""; for(var k=0; k"+oldUnfollowers[k]+""; } } listaStr+="
Total: "+oldUnfollowers.length+"
"; document.getElementById("imgLoading").style.display="none"; lista.innerHTML += listaStr; document.getElementById("close").style.display="block"; guardarTotalUnfollowers(tumblelog); localStorage.setItem(tumblelog+"_unfollowersList",""); } function mostrarError(statusCode){ openListado(); document.getElementById("imgLoading").style.display="none"; var cuadro = document.getElementById("textA"); cuadro.innerHTML=""; var instruccion=""; instruccion += ""; instruccion+=""; var intStatusCode = parseInt(statusCode); if(esEspanol){ if(intStatusCode>=400 && intStatusCode<500){ instruccion+=""; }else if(intStatusCode>=500 && intStatusCode<600){ instruccion+=""; }else if(intStatusCode==999 || !intStatusCode){ instruccion+=""; } }else{ if(intStatusCode>=400 && intStatusCode<500){ instruccion+=""; }else if(intStatusCode>=500 && intStatusCode<600){ instruccion+=""; }else if(intStatusCode==999 || !intStatusCode){ instruccion+=""; } } instruccion+="

UNFOLLOW HATER

Error "+statusCode+".
Error del script al intentar realizar la búsqueda, por favor envíame un submit con un screenshot de esta pantalla.

Error "+statusCode+".
Error del servidor de tumblr al intentar realizar la búsqueda, el servidor no está aceptando las peticiones del script. Por favor intenta más tarde cuando el servicio de Tumblr funcione con normalidad.

Error.
Tiempo agotado para la solicitud (conexión muy lenta), no se pudo obtener el listado de followers, refresca e intenta nuevamente.

Error "+statusCode+".
Script error while sending request to tumblr, please send me a screenshot with this message to my Submit

Error "+statusCode+".
Tumblr's server error while sending request to Tumblr, the server is not accepting the script'ss requests. Please try again later when the Tumblr service will operate normally.

Error.
Timeout for the request (too slow connection), failed to get the list of followers, refresh and try again.

"; cuadro.innerHTML += instruccion; document.getElementById("close").style.display="block"; } function alimentarLista(divHTML,listadoGuardar){ var index = listadoGuardar.length; var paginaFollowers = getFollowerElement("follower_",divHTML); for(var i=0; i","").replace("",""); listadoGuardar[index] = url; index++; } return listadoGuardar; } function buscarUnfollower(){ i=0; setTimeout(function(){ var tumblelog = getTumblelog(); ajax(blogUrl+tumblelog+"/followers/", null, new Array(), null, null, tumblelog, "axa2"); },2000); } var error = false; var virgen = (localStorage[getTumblelog()+"_followersList"]==null); var blogUrl = "http://www.tumblr.com/blog/"; var i=0; var esEspanol = (navigator.language.indexOf("es")!=-1); checkVersion(); if(document.URL.indexOf(blogUrl)!=-1){ obtenerListadoFollowers(); }