Created
December 24, 2014 16:15
-
-
Save whylom/7443a62029462892f7e4 to your computer and use it in GitHub Desktop.
dot.js spider checking a site for broken images
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 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