forked from GitHub/dbot
Merge branch 'master' of https://github.com/reality/depressionbot into gitstatus
This commit is contained in:
commit
b4fdfb5104
11
.gitignore
vendored
11
.gitignore
vendored
@ -1,5 +1,10 @@
|
|||||||
# Ignore the user config files
|
# Ignore the user config files
|
||||||
./config.json
|
config.json
|
||||||
|
|
||||||
# Ignore the user database
|
|
||||||
db.json
|
db.json
|
||||||
|
|
||||||
|
# ignore npm
|
||||||
|
node_modules/
|
||||||
|
|
||||||
|
# ignore assets
|
||||||
|
public/bootstrap/
|
||||||
|
public/d3/
|
||||||
|
@ -1,4 +1,3 @@
|
|||||||
{
|
{
|
||||||
"quotecat":"depressionbot",
|
|
||||||
"dependencies": ["web", "quotes", "github"]
|
"dependencies": ["web", "quotes", "github"]
|
||||||
}
|
}
|
||||||
|
@ -2,12 +2,15 @@ var exec = require('child_process').exec,
|
|||||||
request = require('request');
|
request = require('request');
|
||||||
|
|
||||||
var pages = function(dbot) {
|
var pages = function(dbot) {
|
||||||
var depression = dbot.db.quoteArrs[dbot.config.project.quotecat];
|
var quoteCat = dbot.db.quoteArrs[dbot.config.name],
|
||||||
|
rev, diff;
|
||||||
|
|
||||||
var rev;
|
exec("git rev-list --all | wc -l", function(a, b, c) {
|
||||||
exec("git rev-list --all | wc -l", function(a,b,c){rev = b});
|
rev = b
|
||||||
var diff;
|
});
|
||||||
exec("git log -1", function(a, b, c){diff = b});
|
exec("git log -1", function(a, b, c) {
|
||||||
|
diff = b
|
||||||
|
});
|
||||||
|
|
||||||
/* TODO: merge back into github module */
|
/* TODO: merge back into github module */
|
||||||
var milestones;
|
var milestones;
|
||||||
@ -18,6 +21,11 @@ var pages = function(dbot) {
|
|||||||
|
|
||||||
return {
|
return {
|
||||||
'/project': function(req, res) {
|
'/project': function(req, res) {
|
||||||
|
var quote = dbot.config.name;
|
||||||
|
if(quoteCat) {
|
||||||
|
quote = quoteCat[Math.floor(Math.random()*quoteCat.length)];
|
||||||
|
}
|
||||||
|
|
||||||
res.render('project', {
|
res.render('project', {
|
||||||
"name": dbot.config.name,
|
"name": dbot.config.name,
|
||||||
"intro": dbot.t("dbotintro", {
|
"intro": dbot.t("dbotintro", {
|
||||||
@ -47,7 +55,7 @@ var pages = function(dbot) {
|
|||||||
"openmilestone": dbot.t("openmilestone"),
|
"openmilestone": dbot.t("openmilestone"),
|
||||||
"closedmilestone": dbot.t("closedmilestone"),
|
"closedmilestone": dbot.t("closedmilestone"),
|
||||||
"development": dbot.t("development"),
|
"development": dbot.t("development"),
|
||||||
"dquote": depression[Math.floor(Math.random()*depression.length)],
|
"dquote": quote,
|
||||||
"diff": diff,
|
"diff": diff,
|
||||||
"pagetitle": dbot.t("pagetitle", {
|
"pagetitle": dbot.t("pagetitle", {
|
||||||
"botname": dbot.config.name
|
"botname": dbot.config.name
|
||||||
|
@ -1,14 +1,13 @@
|
|||||||
/**
|
/**
|
||||||
* Module Name: imgur
|
* Module Name: Project
|
||||||
* Description: Various imgur functionality
|
* Description: Web page which shows git status and other various stats about
|
||||||
|
* the dbot.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
var _ = require('underscore')._,
|
|
||||||
request = require('request');
|
|
||||||
|
|
||||||
var project = function(dbot) {
|
var project = function(dbot) {
|
||||||
// nothing to see here go away love zuzak
|
// Nothing to see here go away love zuzak
|
||||||
}
|
}
|
||||||
|
|
||||||
exports.fetch = function(dbot) {
|
exports.fetch = function(dbot) {
|
||||||
return new project(dbot);
|
return new project(dbot);
|
||||||
}
|
}
|
||||||
|
@ -10,8 +10,10 @@ html(lang='en')
|
|||||||
function giveMessage(msg) {
|
function giveMessage(msg) {
|
||||||
$('<li>'+msg+'</li>').prependTo('#history').hide().slideDown();
|
$('<li>'+msg+'</li>').prependTo('#history').hide().slideDown();
|
||||||
}
|
}
|
||||||
|
var lock = false
|
||||||
function getNewImage() {
|
function getNewImage() {
|
||||||
count += 1;
|
count += 1;
|
||||||
|
lock = true;
|
||||||
$('#loading').fadeIn();
|
$('#loading').fadeIn();
|
||||||
$('#loading').text('Loading image ' + count + '...');
|
$('#loading').text('Loading image ' + count + '...');
|
||||||
document.title = 'random imgur (' + count + ')';
|
document.title = 'random imgur (' + count + ')';
|
||||||
@ -19,6 +21,7 @@ html(lang='en')
|
|||||||
$('#image').load(function(){});
|
$('#image').load(function(){});
|
||||||
$.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;
|
||||||
$('#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) {
|
||||||
@ -37,7 +40,13 @@ html(lang='en')
|
|||||||
switch(e.which){
|
switch(e.which){
|
||||||
case 13: // enter
|
case 13: // enter
|
||||||
case 32: // space
|
case 32: // space
|
||||||
|
if (lock) {
|
||||||
|
$('#loading').text(function(index, text){
|
||||||
|
return text.replace(/\.(?=[^.]*$)/, "!");
|
||||||
|
});
|
||||||
|
} else {
|
||||||
getNewImage();
|
getNewImage();
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case 83: // s
|
case 83: // s
|
||||||
$('body').toggleClass('crop');
|
$('body').toggleClass('crop');
|
||||||
|
Loading…
Reference in New Issue
Block a user