Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save lucasbrigida/84f707cc982919ad0e9e to your computer and use it in GitHub Desktop.
Save lucasbrigida/84f707cc982919ad0e9e to your computer and use it in GitHub Desktop.
<!-- Adicionar ao final da página dentro do body -->
<!-- Versão para leitura -->
<script type="text/javascript" defer>
(function(document, $) {
var re = [/^http:\/\/meiobit.com\/$/, /http:\/\/meiobit.com\/page\/.*\//], allowed = false;
for (var i in re) { if (re[i].test(document.location.href)) { allowed = true; break; } }
if (allowed === false) return;
$('#posts > div > .title').each(function(i, e) {
var parent = $(e).parent('div'),imgLink = parent.find('.content a').first(), url = $(e).find('a').attr('href');
if (imgLink.children('img').is('img')) imgLink.attr('href', url);
else {
var img = parent.find('.content img').first();
if ($(img).is('img')) {
var elem = $('<a href="' + url + '">' + '<img class="' + $(img).attr('class') + '" src="' + $(img).attr('src') + '">' + '</a>');
img.before(elem).remove();
}
}
});
})(document, jQuery);
</script>
<!-- //Versão para leitura -->
<!-- Versão para produção (compressed) -->
<script type="text/javascript" defer>(function(g,a){var f=[/^http:\/\/meiobit.com\/$/,/http:\/\/meiobit.com\/page\/.*\//],c=!1,d;for(d in f)if(f[d].test(g.location.href)){c=!0;break}!1!==c&&a("#posts > div > .title").each(function(f,c){var b=a(c).parent("div"),d=b.find(".content a").first(),e=a(c).find("a").attr("href");d.children("img").is("img")?d.attr("href",e):(b=b.find(".content img").first(),a(b).is("img")&&(e=a('<a href="'+e+'"><img class="'+a(b).attr("class")+'" src="'+a(b).attr("src")+'"></a>'),b.before(e).remove()))})})(document,
jQuery);</script>
<!-- //Versão para produção (compressed) -->
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment