forked from GitHub/dbot
Add new "details" box to random imgur page
This commit adds a new box to the imgur page, separating the "Loading..." box with a new "details" box, which contains the information found via the API. The loading box appears on the left, and disappears when an image is loaded, to be replaced with a box on the right. API operations, such as a "report" or "submit to gallery" option, could appear below the current right-aligned box, in a smaller font. I'm undecided as to whether this commit is an improvement or not.
This commit is contained in:
parent
1a2595aaf2
commit
9b191bc89a
@ -8,20 +8,31 @@
|
||||
padding:0;
|
||||
}
|
||||
|
||||
#loading {
|
||||
#loading, #details{
|
||||
background:rgba(43,43,43,0.8);
|
||||
border-bottom-right-radius:5px;
|
||||
border-top-right-radius:5px;
|
||||
color:#85bf25;
|
||||
font-family:sans-serif;
|
||||
font-size:12px;
|
||||
font-weight:700;
|
||||
left:0;
|
||||
padding:20px;
|
||||
position:absolute;
|
||||
top:50px;
|
||||
}
|
||||
|
||||
#details {
|
||||
right:0;
|
||||
text-align:right;
|
||||
border-bottom-left-radius:5px;
|
||||
border-top-left-radius:5px
|
||||
display:none;
|
||||
}
|
||||
|
||||
#loading {
|
||||
left:0;
|
||||
border-bottom-right-radius:5px;
|
||||
border-top-right-radius:5px;
|
||||
}
|
||||
|
||||
html,body {
|
||||
background-color:#121211;
|
||||
height:100%;
|
||||
|
@ -9,13 +9,17 @@ html(lang='en')
|
||||
var count = 0;
|
||||
function getNewImage() {
|
||||
count += 1;
|
||||
$('#details').hide();
|
||||
$('#loading').text('Loading image ' + count + '...');
|
||||
$('#loading').css('font-size', ((count * 0.03) + 12));
|
||||
$('#loading').show();
|
||||
$('#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) {
|
||||
$("#loading").text(count + ': ' + info.data[0]);
|
||||
$("#details").text(count + ': ' + info.data[0]);
|
||||
$('#details').show();
|
||||
$('#loading').hide();
|
||||
}, "json");
|
||||
}, "json");
|
||||
}
|
||||
@ -23,5 +27,6 @@ html(lang='en')
|
||||
$(document).on('keydown', function(e){(e.which==32)&&(getNewImage()) });
|
||||
body
|
||||
div#loading Loading Image
|
||||
div#details Press [SPACE] to load a new image
|
||||
div#container
|
||||
img#image
|
||||
|
Loading…
Reference in New Issue
Block a user