Last active
August 29, 2015 14:12
-
-
Save NaokiStark/23186dd04794bf5055e4 to your computer and use it in GitHub Desktop.
Coso para mostrar imágenes
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 Coso para mostrar imágenes | |
// @namespace http://taringa.net/Nikumi | |
// @version 0.3 | |
// @description escriba algo sobre el script | |
// @match http://www.taringa.net/* | |
// @copyright 2115+, Fabi | |
// ==/UserScript== | |
var MostrarImgs = function(){ | |
//Acá chupate una pija xddxdxdxxdddx | |
//Recorremos cada shout | |
$('.activity-element').each(function(){ | |
//Fijamos si hay links de imágenes | |
var content= $(this).children('.activity-content').children('p').html(); | |
var MainContainer=$(this).children('.activity-content'); | |
if(content!=null) | |
{ | |
var patt=/(https?:\/\/(?:[a-z0-9\-]+\.)+[a-z]{2,6}(?:\/[^\/#?]+)+\.(?:jpg|gif|png))/ig; | |
var results=content.match(patt); | |
var ok=patt.test(content); | |
//Si hay imagen :P | |
if(ok){ | |
//Agregamos al shout | |
//ToDo: Filtrar para evitar XSS | |
//Nota: Taringa filtra, no necesario. | |
for(a=0;a<results.length;a++){ | |
if(a%2==0){ | |
var emo= /o1\.t26\.net/ig; | |
var isEmo= emo.test(results[a]); | |
if(!isEmo){ | |
if(!$(MainContainer).hasClass('pija')){ | |
$(MainContainer).append('<img src="'+results[a]+'" style="max-width:100%"><br><br>'); | |
$(MainContainer).addClass('pija'); | |
} | |
} | |
} | |
} | |
} | |
} | |
}); | |
}; | |
$(document).ready(function(){ | |
//Acá chupate otra pija xddxdxdxxdddx | |
MostrarImgs(); | |
}); | |
$( document ).ajaxSuccess(function(event,jqxhr,settings) { | |
if (settings.url == "/ajax/feed/fetch" || settings.url == "/ajax/shout/add"){ | |
MostrarImgs(/*Ajajasjdjskdjsadkjsaodj pija paosjdpasodjpasojd*/); | |
} | |
}); | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment