Skip to content

Instantly share code, notes, and snippets.

@whylom
Created December 24, 2014 16:15
Show Gist options
  • Save whylom/7443a62029462892f7e4 to your computer and use it in GitHub Desktop.
Save whylom/7443a62029462892f7e4 to your computer and use it in GitHub Desktop.
dot.js spider checking a site for broken images
function advance() {
var url = document.location.href;
var parts = url.split('/');
var id = parts[parts.length-1];
var nextID = parseInt(id) + 1;
document.location = "https://site.com/resources/" + nextID;
}
var image = $('img.should-be-here');
if (!image.length) advance();
image.load(function() {
setTimeout(advance, 1000);
});
$(document).click(advance);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment