forked from GitHub/dbot
Merge branch 'master' of https://github.com/reality/depressionbot into gitstatus
This commit is contained in:
commit
7106d4dd8b
@ -3,5 +3,6 @@
|
|||||||
"dependencies": [ "web", "api" ],
|
"dependencies": [ "web", "api" ],
|
||||||
"imagelength": 5,
|
"imagelength": 5,
|
||||||
"nsfwwarn": true,
|
"nsfwwarn": true,
|
||||||
"apikey": "86fd3a8da348b65"
|
"apikey": "86fd3a8da348b65",
|
||||||
|
"highscore": "ricount"
|
||||||
}
|
}
|
||||||
|
@ -3,7 +3,14 @@ var _ = require('underscore')._;
|
|||||||
var pages = function(dbot) {
|
var pages = function(dbot) {
|
||||||
return {
|
return {
|
||||||
'/imgur/random': function(req, res) {
|
'/imgur/random': function(req, res) {
|
||||||
res.render('imgurr', { });
|
var quoteCat = dbot.db.quoteArrs[dbot.config.imgur.highscore],
|
||||||
|
highScore = 0;
|
||||||
|
|
||||||
|
if(quoteCat) {
|
||||||
|
highScore = _.last(quoteCat);
|
||||||
|
}
|
||||||
|
|
||||||
|
res.render('imgurr', { "highscore" : highScore });
|
||||||
},
|
},
|
||||||
|
|
||||||
'/imgur/stats': function(req, res) {
|
'/imgur/stats': function(req, res) {
|
||||||
|
@ -38,7 +38,7 @@
|
|||||||
width:168px;
|
width:168px;
|
||||||
}
|
}
|
||||||
|
|
||||||
#history li,#loading {
|
#history li,#loading,#count {
|
||||||
display:block;
|
display:block;
|
||||||
font-family:monospace;
|
font-family:monospace;
|
||||||
font-size:10px;
|
font-size:10px;
|
||||||
@ -65,18 +65,26 @@
|
|||||||
opacity:0.2;
|
opacity:0.2;
|
||||||
}
|
}
|
||||||
|
|
||||||
#history,#loading,#details {
|
#history,#loading,#details,#count {
|
||||||
position:absolute;
|
position:absolute;
|
||||||
}
|
}
|
||||||
|
|
||||||
#loading {
|
#loading, #count {
|
||||||
font-weight:500;
|
font-weight:500;
|
||||||
|
}
|
||||||
|
#loading {
|
||||||
|
top:95px;
|
||||||
left:220px;
|
left:220px;
|
||||||
min-width:95px;
|
min-width:95px;
|
||||||
top:95px;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#loading,#details,#history li {
|
#count {
|
||||||
|
bottom:25px;
|
||||||
|
left:25px;
|
||||||
|
display:none;
|
||||||
|
}
|
||||||
|
|
||||||
|
#loading,#details,#history li,#count {
|
||||||
background:rgba(43,43,43,0.8);
|
background:rgba(43,43,43,0.8);
|
||||||
border-radius:5px;
|
border-radius:5px;
|
||||||
color:#85bf25;
|
color:#85bf25;
|
||||||
|
@ -11,6 +11,9 @@ html(lang='en')
|
|||||||
$('<li>'+msg+'</li>').prependTo('#history').hide().slideDown();
|
$('<li>'+msg+'</li>').prependTo('#history').hide().slideDown();
|
||||||
}
|
}
|
||||||
var lock = false
|
var lock = false
|
||||||
|
var highscore = #{highscore} + 1;
|
||||||
|
var score = highscore;
|
||||||
|
$('#count').text(score);
|
||||||
function getNewImage() {
|
function getNewImage() {
|
||||||
count += 1;
|
count += 1;
|
||||||
lock = true;
|
lock = true;
|
||||||
@ -22,6 +25,8 @@ html(lang='en')
|
|||||||
$.get("/api/imgur/getRandomImage", function(d) {
|
$.get("/api/imgur/getRandomImage", function(d) {
|
||||||
$('#image').attr('src', d.data[0]);
|
$('#image').attr('src', d.data[0]);
|
||||||
lock = false;
|
lock = false;
|
||||||
|
score -= 1;
|
||||||
|
$('#count').text(score);
|
||||||
$('#details').text("Fetching info...");
|
$('#details').text("Fetching info...");
|
||||||
giveMessage('<a href="' + d.data[0] + '">' + d.data[0] + '</a>');
|
giveMessage('<a href="' + d.data[0] + '">' + d.data[0] + '</a>');
|
||||||
$.get("/api/imgur/getImageInfoString", { 'slug': d.data[1] }, function(info) {
|
$.get("/api/imgur/getImageInfoString", { 'slug': d.data[1] }, function(info) {
|
||||||
@ -38,6 +43,10 @@ html(lang='en')
|
|||||||
$(getNewImage());
|
$(getNewImage());
|
||||||
$(document).on('keydown', function(e){
|
$(document).on('keydown', function(e){
|
||||||
switch(e.which){
|
switch(e.which){
|
||||||
|
case 82: // r
|
||||||
|
score = highscore;
|
||||||
|
$('#count').text(highscore);
|
||||||
|
giveMessage("Score reset.");
|
||||||
case 13: // enter
|
case 13: // enter
|
||||||
case 32: // space
|
case 32: // space
|
||||||
if (lock) {
|
if (lock) {
|
||||||
@ -48,6 +57,9 @@ html(lang='en')
|
|||||||
getNewImage();
|
getNewImage();
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
case 67:
|
||||||
|
$('#count').fadeToggle();
|
||||||
|
break;
|
||||||
case 83: // s
|
case 83: // s
|
||||||
$('body').toggleClass('crop');
|
$('body').toggleClass('crop');
|
||||||
giveMessage("Toggled scrollbars.")
|
giveMessage("Toggled scrollbars.")
|
||||||
@ -56,6 +68,8 @@ html(lang='en')
|
|||||||
body
|
body
|
||||||
div#loading Loading image 1...
|
div#loading Loading image 1...
|
||||||
div#details Press [SPACE] to load a new image
|
div#details Press [SPACE] to load a new image
|
||||||
|
div#count
|
||||||
|
#{highscore}
|
||||||
ul#history
|
ul#history
|
||||||
li Press [SPACE] for next
|
li Press [SPACE] for next
|
||||||
div#container
|
div#container
|
||||||
|
Loading…
Reference in New Issue
Block a user