From 05f2fdb8a338adace803036914696d2a5bd7cf06 Mon Sep 17 00:00:00 2001 From: reality Date: Tue, 15 Oct 2013 06:06:16 +0000 Subject: [PATCH] fix the quote linky thingy on the web whatsit --- modules/quotes/pages.js | 4 +--- views/quotes/quotes.jade | 8 ++++---- 2 files changed, 5 insertions(+), 7 deletions(-) diff --git a/modules/quotes/pages.js b/modules/quotes/pages.js index abdd4c3..b8e5ade 100644 --- a/modules/quotes/pages.js +++ b/modules/quotes/pages.js @@ -8,9 +8,7 @@ var pages = function(dbot) { res.render('quotes', { 'name': dbot.config.name, 'quotes': category.quotes, - 'locals': { - 'url_regex': RegExp.prototype.url_regex() - } + 'url_regex': new RegExp(/(\b(https?|ftp|file):\/\/[-A-Z0-9+&@#\/%?=~_|!:,.;]*[-A-Z0-9+&@#\/%=~_|])/ig) }); } else { res.render('error', { diff --git a/views/quotes/quotes.jade b/views/quotes/quotes.jade index a40d12e..e14e88e 100644 --- a/views/quotes/quotes.jade +++ b/views/quotes/quotes.jade @@ -6,7 +6,7 @@ block content ul#quotelist -var hasYouTubeVids=false -each quote in quotes - -if(quote.match(locals.url_regex)) + -if(quote.match(url_regex)) li.quote -if(quote.match(/(jpg|png|gif|jpeg|tiff)$/)) a(href=quote) @@ -18,12 +18,12 @@ block content -else a(href=quote) =quote - -else if(quote.match(/~~([^~]+)~~/)) + -else -var res = quote.match(/~~([^~]+)~~/) -if(res != null) li.quote a(href="/quotes/#{res[1]}") #{quote} - -else - li.quote #{quote} + -else + li.quote #{quote} -if(hasYouTubeVids) script(src='/ytembed.js')