Created
January 18, 2014 04:23
-
-
Save barisusakli/8486163 to your computer and use it in GitHub Desktop.
ping links in a topic
This file contains 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
function verifyLinks() { | |
$('.post-content a').each(function(index, element) { | |
var link = $(element); | |
var parent = link.parent(); | |
if(link.attr('class') || link.attr('done')) { | |
return; | |
} | |
link.attr('done', 1); | |
socket.emit('topics.checkLink', link.attr('href'), function(err, result) { | |
if(result) { | |
$('<i class="fa fa-chain" style="vertical-align:super; font-size:12px;"></i>').insertAfter(link); | |
} else { | |
$('<i class="fa fa-chain-broken" style="vertical-align:super; font-size:12px;"></i>').insertAfter(link); | |
} | |
}); | |
}); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment