From b7dad66a2649650038aea5711b34d5e30fe35624 Mon Sep 17 00:00:00 2001 From: Thomas Menari Date: Mon, 15 Apr 2013 02:10:29 +0100 Subject: [PATCH] random imgur --- modules/imgur/pages.js | 14 ++++++++++++++ views/imgur/imgurr.jade | 15 +++++++++++++++ 2 files changed, 29 insertions(+) create mode 100644 modules/imgur/pages.js create mode 100644 views/imgur/imgurr.jade diff --git a/modules/imgur/pages.js b/modules/imgur/pages.js new file mode 100644 index 0000000..e257b40 --- /dev/null +++ b/modules/imgur/pages.js @@ -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); +}; diff --git a/views/imgur/imgurr.jade b/views/imgur/imgurr.jade new file mode 100644 index 0000000..cf84303 --- /dev/null +++ b/views/imgur/imgurr.jade @@ -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%')