mirror of
https://github.com/reality/dbot.git
synced 2024-11-27 14:29:29 +01:00
32 lines
1.0 KiB
Plaintext
32 lines
1.0 KiB
Plaintext
!!! 5
|
|
html(lang='en')
|
|
head
|
|
meta(charset='utf-8')
|
|
script(type="text/javascript", src="//ajax.googleapis.com/ajax/libs/jquery/1.9.0/jquery.min.js")
|
|
link(rel="stylesheet", href="/imgurr.css")
|
|
title random imgur
|
|
script
|
|
var count = 0;
|
|
function getNewImage() {
|
|
count += 1;
|
|
$('#loading').show();
|
|
$('#loading').text('Loading image ' + count + '...');
|
|
$('#image').load(function(){});
|
|
$.get("/api/imgur/getRandomImage", function(d) {
|
|
$('#image').attr('src', d.data[0]);
|
|
$.get("/api/imgur/getImageInfoString", { 'slug': d.data[1] }, function(info) {
|
|
if(info.data[0].indexOf('undefined') == -1) {
|
|
$("#loading").text(count + ': ' + info.data[0]);
|
|
} else {
|
|
$("#loading").hide();
|
|
}
|
|
}, "json");
|
|
}, "json");
|
|
}
|
|
$(getNewImage());
|
|
$(document).on('keydown', function(e){(e.which==32)&&(getNewImage()) });
|
|
body
|
|
div#loading Loading Image
|
|
div#container
|
|
img#image
|