Автораспознавание ссылок
Код:
<!-- Автораспознавание ссылок -->
<script>
$('div.post-content p a[rel="nofollow"]').map(function(){
var link = $(this).attr('href');
var hrfstr = link.replace(/^.+?click.php\?/i,'');$(this).attr('href',hrfstr);
if(hrfstr.indexOf($(this).html().split(' … ')[0])==0){
if( /\.(?:gif|png|jpg)$/ig.test(hrfstr)){
$(this).html('<br><center><img src="'+hrfstr+'" style="max-width: 100%"></center>');
}
if(hrfstr.indexOf(".mp3")!= -1) {
$(this).replaceWith('<br /><embed src="https://forumstatic.ru/files/000f/5f/a4/48643.swf" type="application/x-shockwave-flash" allowscriptaccess="always" wmode="transparent" flashvars="comment=track&st=https://forumstatic.ru/files/000f/5f/a4/15057.txt&file='+hrfstr+'" width="400" height="25">' );
}
if(hrfstr.indexOf("youtu")!= -1) {
var End = hrfstr.slice(hrfstr.indexOf('?v=') +3);
$(this).replaceWith('<br /><center><iframe class="youtube-player" src="http://www.youtube.com/embed/'+End+'" frameborder="0" allowfullscreen="true" width="480" height="284"></iframe></center>');
}}
});
</script>