html-css-js:random_imgur-patch
The following patch applies to random_imgur for Imgur's old id format (5 chars) - which is much more filled with content, but outdated.
- random_imgur.patch
--- random_imgur.html +++ random_imgur_old.html @@ -2,7 +2,7 @@ <html> <head> <meta charset="UTF-8"> -<title id="titleprogress">Random Imgur Wall</title> +<title id="titleprogress">Random Imgur Wall (old id5)</title> <style type="text/css"> body {color:white;font-family:sans-serif;background-color:black;} span#current{font-family:monospace} @@ -92,10 +92,10 @@ function loadImages() { - if (totalCounter < 10) { + if (totalCounter < 100) { scroll(0, 0); document.getElementById('p').value = totalCounter; - document.getElementById('titleprogress').innerHTML= '('+totalCounter+'/10) '+'Random Imgur Wall'; + document.getElementById('titleprogress').innerHTML= '('+totalCounter+'/100) '+'Random Imgur Wall (old id5)'; if (threads < 10) { setTimeout(function() { loadImages();},100); var imgObject = new Image(); @@ -103,10 +103,10 @@ { if (this.width == 161 && this.height == 81) { - var randStr = randomString(7); + var randStr = randomString(5); this.src = "http://i.imgur.com/" + randStr + ".jpg"; } else { - var randStr = randomString(7); + var randStr = randomString(5); var imgurl = imgObject.src.replace("http://i.", "http://"); var imgurl = imgurl.replace(".jpg", ""); var newdiv = creatediv(randStr, "<a target=\"_blank\" href=\"" + imgurl + "\"><img src=\"" + imgObject.src + "\" /></a>"); @@ -120,13 +120,13 @@ setTimeout(function() { loadImages();},100); } } - imgObject.src = "http://i.imgur.com/" + randomString(7) + ".jpg"; + imgObject.src = "http://i.imgur.com/" + randomString(5) + ".jpg"; threads++; } } else { document.getElementById("dots").innerHTML = 'Done!'; - document.getElementById('titleprogress').innerHTML= '(done) Random Imgur Wall'; + document.getElementById('titleprogress').innerHTML= '(done) Random Imgur Wall - (old id5)'; var newdiv = creatediv("reloadme", "<h1><a href=\"#\" onClick=\"window.location.reload();return false;\">→reload←</a></h1>"); for (var i = 0; i < numCols; i++) { @@ -144,9 +144,8 @@ </script> <body onLoad="loadImages();"> -<h1>Random Imgur Wall</h1> +<h1>Random Imgur Wall (old id5)</h1> <p>Warning: the script "bruteforces" Imgur for totally random pictures. May include offensive content.</p> -<div id="dots">Finding 10 images, need a few minutes. [<span id="current"></span>] <progress id='p' value='0' max="10"></progress> -</div> +<p id="dots">Loading 100 images [<span id="current"></span>] <progress id='p' value='0' max="100"></progress></p> </body> </html>
html-css-js/random_imgur-patch.txt · Dernière modification : 2014-11-11 13:41 de 127.0.0.1