Skip to content

Instantly share code, notes, and snippets.

@anevins12
Created October 7, 2015 21:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save anevins12/ab82afe8db9992dff70a to your computer and use it in GitHub Desktop.
Save anevins12/ab82afe8db9992dff70a to your computer and use it in GitHub Desktop.
Forum & BBadmin show hidden links
// Forum thread
if ($('#wordpress-org').length !== 0) {
if ($('#thread').length !== 0) {
var posts = $('.threadpost .post');
showHiddenLinks(posts);
}
}
// BBadmin
if ($('.bb-admin').length !== 0) {
var posts = $('.post p:first-child');
showHiddenLinks(posts);
}
function showHiddenLinks(posts) {
var style = 'border: 2px solid gold; display: inline-block; padding: 5px; margin-top: 5px;';
posts.each(function() {
post = $(this);
links = post.find('a');
links.each(function() {
var link = $(this);
if (link.text() == '') {
// Get the HTML of the link
link.text(link[0].outerHTML);
// Output it on the page
post.append('<pre style="' + style +'">' + link.html() + '</pre>');
// Hide the original link
link.hide();
}
});
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment