random imgur

This commit is contained in:
Thomas Menari 2013-04-15 02:10:29 +01:00
parent 2c03cbbbf3
commit b7dad66a26
2 changed files with 29 additions and 0 deletions

14
modules/imgur/pages.js Normal file
View File

@ -0,0 +1,14 @@
var _ = require('underscore')._;
var pages = function(dbot) {
return {
'/imgur/random': function(req, res) {
res.render('imgurr', {
});
}
};
};
exports.fetch = function(dbot) {
return pages(dbot);
};

15
views/imgur/imgurr.jade Normal file
View File

@ -0,0 +1,15 @@
!!! 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")
title random imgur
script
function wat() {
$.get("/api/imgur/getRandomImage", function(d) {$('#image').attr('src', d.data[0])}, "json");
};
$(wat());
$(document).keypress(wat);
body
div#container
img#image(style='width: 100%')