forked from GitHub/dbot
fix the quote linky thingy on the web whatsit
This commit is contained in:
parent
3df467e35e
commit
05f2fdb8a3
@ -8,9 +8,7 @@ var pages = function(dbot) {
|
|||||||
res.render('quotes', {
|
res.render('quotes', {
|
||||||
'name': dbot.config.name,
|
'name': dbot.config.name,
|
||||||
'quotes': category.quotes,
|
'quotes': category.quotes,
|
||||||
'locals': {
|
'url_regex': new RegExp(/(\b(https?|ftp|file):\/\/[-A-Z0-9+&@#\/%?=~_|!:,.;]*[-A-Z0-9+&@#\/%=~_|])/ig)
|
||||||
'url_regex': RegExp.prototype.url_regex()
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
res.render('error', {
|
res.render('error', {
|
||||||
|
@ -6,7 +6,7 @@ block content
|
|||||||
ul#quotelist
|
ul#quotelist
|
||||||
-var hasYouTubeVids=false
|
-var hasYouTubeVids=false
|
||||||
-each quote in quotes
|
-each quote in quotes
|
||||||
-if(quote.match(locals.url_regex))
|
-if(quote.match(url_regex))
|
||||||
li.quote
|
li.quote
|
||||||
-if(quote.match(/(jpg|png|gif|jpeg|tiff)$/))
|
-if(quote.match(/(jpg|png|gif|jpeg|tiff)$/))
|
||||||
a(href=quote)
|
a(href=quote)
|
||||||
@ -18,12 +18,12 @@ block content
|
|||||||
-else
|
-else
|
||||||
a(href=quote)
|
a(href=quote)
|
||||||
=quote
|
=quote
|
||||||
-else if(quote.match(/~~([^~]+)~~/))
|
-else
|
||||||
-var res = quote.match(/~~([^~]+)~~/)
|
-var res = quote.match(/~~([^~]+)~~/)
|
||||||
-if(res != null)
|
-if(res != null)
|
||||||
li.quote
|
li.quote
|
||||||
a(href="/quotes/#{res[1]}") #{quote}
|
a(href="/quotes/#{res[1]}") #{quote}
|
||||||
-else
|
-else
|
||||||
li.quote #{quote}
|
li.quote #{quote}
|
||||||
-if(hasYouTubeVids)
|
-if(hasYouTubeVids)
|
||||||
script(src='/ytembed.js')
|
script(src='/ytembed.js')
|
||||||
|
Loading…
Reference in New Issue
Block a user