Created
October 11, 2018 17:41
-
-
Save kevee/c4d079fb87f020bed60b29b4b795f49a to your computer and use it in GitHub Desktop.
A simple console dump of all links, highlights undefined links and turns them into annoying big red boxes.
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
//Requires jQuery (I KNOW!) | |
(($) => { | |
$('a[href]:not([aria-hidden])').each(function() { | |
const $link = $(this) | |
let text = $link.text() | |
if($link.find('img').length) { | |
text = $link.find('img').attr('alt') | |
} | |
if(text.trim().length == 0) { | |
console.log(`UNDEFINED LINK: ${$link.attr('href')}`) | |
$link.css('background', 'red') | |
.css('display', 'inline-block') | |
.width(100) | |
.height(100) | |
return | |
} | |
console.log(text) | |
}) | |
})(jQuery) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment