diff --git a/modules/dent/dent.js b/modules/dent/dent.js index 311d9d0..fcbb8a4 100644 --- a/modules/dent/dent.js +++ b/modules/dent/dent.js @@ -59,7 +59,9 @@ var dent = function(dbot) { this.onLoad = function() { if(dbot.config.dent.dentQuotes === true && _.has(dbot.modules, 'quotes')) { dbot.api.command.addHook('~qadd', function(key, text) { - this.api.post(key + ': ' + text); + if(text.indexOf('~~') == -1) { + this.api.post(key + ': ' + text); + } }.bind(this)); } }.bind(this); diff --git a/modules/flashy/flashy.js b/modules/flashy/flashy.js new file mode 100644 index 0000000..3122dcb --- /dev/null +++ b/modules/flashy/flashy.js @@ -0,0 +1,42 @@ +/** + * Module Name: Flashy + * Description: Makes pages with flashing text and that innit. + */ + +var _ = require('underscore')._; + +var flashy = function(dbot) { + this.colourMap = { + 'white': 'FFFFFF', + 'red': 'FF0000', + 'green': '00FF00', + 'blue': '0000FF', + 'yellow': 'FFFF00', + 'magenta': 'FF00FF', + 'cyan': '00FFFF' + }; + + this.commands = { + '~flashy': function(event) { + var colour = event.input[1]; + var text = event.input[2].trim().toUpperCase(); + + if(_.has(this.colourMap, colour)) { + event.reply(dbot.t('url', { + 'host': dbot.config.web.webHost, + 'port': dbot.config.web.webPort, + 'path': 'flashy/' + colour + '/' + encodeURIComponent(text) + })); + } else { + var possibleColours = _.keys(this.colourMap).join(', ') + '.'; + event.reply('No such colour, brah. Available colours are: ' + possibleColours); + } + } + }; + + this.commands['~flashy'].regex = [/^~flashy ([^ ]+) (.+)$/, 3]; +}; + +exports.fetch = function(dbot) { + return new flashy(dbot); +}; diff --git a/modules/flashy/pages.js b/modules/flashy/pages.js new file mode 100644 index 0000000..6b46ba5 --- /dev/null +++ b/modules/flashy/pages.js @@ -0,0 +1,21 @@ +var _ = require('underscore')._; + +var pages = function(dbot) { + return { + '/flashy/:colour/:text': function(req, res) { + if(!_.has(this.colourMap, req.params.colour)) { + req.params.colour = 'red'; + } + var colour = this.colourMap[req.params.colour]; + res.render('flashy', { + 'name': dbot.config.name, + 'colour': colour, + 'text': req.params.text + }); + } + }; +}; + +exports.fetch = function(dbot) { + return pages(dbot); +}; diff --git a/modules/link/link.js b/modules/link/link.js index fe19117..12adf09 100644 --- a/modules/link/link.js +++ b/modules/link/link.js @@ -11,7 +11,7 @@ var link = function(dbot) { this.urlRegex = /(\b(https?|ftp|file):\/\/[-A-Z0-9+&@#\/%?=~_|!:,.;]*[-A-Z0-9+&@#\/%=~_|])/ig; this.links = {}; this.fetchTitle = function(event, link) { - var limit = 250 * 1000, + var limit = 1000000, size = 0, page = request(link, function(error, response, body) { if(!error && response.statusCode == 200) { diff --git a/public/flash.css b/public/flash.css new file mode 100644 index 0000000..c632405 --- /dev/null +++ b/public/flash.css @@ -0,0 +1,23 @@ +body { background: #000; font-family: sans-serif } + +.stamp { + text-align: center; + color: #FFF; + font-size: 12em; +} + +.flash { + text-decoration: blink; +} + +@-webkit-keyframes blink { + from { opacity: 1.0; } + to { opacity: 0.0; } +} + +.flash { + -webkit-animation-name: blink; + -webkit-animation-iteration-count: infinite; + -webkit-animation-timing-function: cubic-bezier(1.0,0,0,1.0); + -webkit-animation-duration: 1s; +} diff --git a/views/flashy/flashy.jade b/views/flashy/flashy.jade new file mode 100644 index 0000000..f05641f --- /dev/null +++ b/views/flashy/flashy.jade @@ -0,0 +1,11 @@ +!!! 5 +html(lang='en') + head + meta(charset='utf-8') + link(rel='stylesheet', type='text/css', href='/flash.css') + title #{name} web interface + body + div.container + div.stamp [ + span.flash(style='color: #'+colour+';') #{text} + ]