forked from GitHub/dbot
2b9dbea855
* Added config.json to the party * Moved API key (client ID) to the configuration file * Added image link to random imgur image page * Minimised loading message * Added fade to loading message * Added count to title attribute of webpage * Removed font-size increase * Added placeholders
36 lines
1.2 KiB
Plaintext
36 lines
1.2 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').text('Loading image ' + count + '...');
|
|
document.title = 'random imgur (' + count + ')';
|
|
$('#loading').fadeIn();
|
|
$('#image').load(function(){});
|
|
$.get("/api/imgur/getRandomImage", function(d) {
|
|
$('#image').attr('src', d.data[0]);
|
|
$('#details').text("Fetching info...");
|
|
$('#link').text(d.data[0]);
|
|
$('#link').attr('href',d.data[0]);
|
|
$.get("/api/imgur/getImageInfoString", { 'slug': d.data[1] }, function(info) {
|
|
$("#details").text(count + ': ' + info.data[0]);
|
|
$('#details').show();
|
|
$('#loading').fadeOut();
|
|
}, "json");
|
|
}, "json");
|
|
}
|
|
$(getNewImage());
|
|
$(document).on('keydown', function(e){(e.which==32)&&(getNewImage()) });
|
|
body
|
|
div#loading Loading image 1...
|
|
div#details Press [SPACE] to load a new image
|
|
a#link [SPACE] for next
|
|
div#container
|
|
img#image
|