From 56242011c24a2b0a8b04d763a09bba83f37a4d1f Mon Sep 17 00:00:00 2001 From: Lance Stout Date: Thu, 2 Jan 2014 01:13:57 -0800 Subject: [PATCH] Enable embeds in muc --- clientapp/templates.js | 102 +++++++++++++++++- .../templates/includes/mucBareMessage.jade | 9 ++ public/css/otalk.css | 6 +- public/css/pages/chat.styl | 6 +- public/x-manifest.cache | 2 +- 5 files changed, 118 insertions(+), 7 deletions(-) diff --git a/clientapp/templates.js b/clientapp/templates.js index b0150c5..69e48b1 100644 --- a/clientapp/templates.js +++ b/clientapp/templates.js @@ -233,7 +233,56 @@ exports.includes.mucBareMessage = function anonymous(locals) { }, { "class": true, id: true - }) + '>' + jade.escape(null == (jade.interp = message.formattedTime) ? "" : jade.interp) + '

' + ((jade.interp = message.processedBody) == null ? "" : jade.interp) + "

"); + }) + '>' + jade.escape(null == (jade.interp = message.formattedTime) ? "" : jade.interp) + '

' + ((jade.interp = message.processedBody) == null ? "" : jade.interp) + "

"); + var urls = message.urls; + buf.push('
'); + (function() { + var $$obj = urls; + if ("number" == typeof $$obj.length) { + for (var $index = 0, $$l = $$obj.length; $index < $$l; $index++) { + var item = $$obj[$index]; + if (item.source == "body") { + buf.push('"); + } else { + buf.push('
" + jade.escape(null == (jade.interp = item.desc) ? "" : jade.interp) + "
"); + } + } + } else { + var $$l = 0; + for (var $index in $$obj) { + $$l++; + if ($$obj.hasOwnProperty($index)) { + var item = $$obj[$index]; + if (item.source == "body") { + buf.push('"); + } else { + buf.push('
" + jade.escape(null == (jade.interp = item.desc) ? "" : jade.interp) + "
"); + } + } + } + } + }).call(this); + buf.push("
"); } return buf.join(""); }; @@ -266,7 +315,56 @@ exports.includes.mucWrappedMessage = function anonymous(locals) { }, { "class": true, id: true - }) + '>' + jade.escape(null == (jade.interp = message.formattedTime) ? "" : jade.interp) + '

' + ((jade.interp = message.processedBody) == null ? "" : jade.interp) + "

"); + }) + '>' + jade.escape(null == (jade.interp = message.formattedTime) ? "" : jade.interp) + '

' + ((jade.interp = message.processedBody) == null ? "" : jade.interp) + "

"); + var urls = message.urls; + buf.push('
'); + (function() { + var $$obj = urls; + if ("number" == typeof $$obj.length) { + for (var $index = 0, $$l = $$obj.length; $index < $$l; $index++) { + var item = $$obj[$index]; + if (item.source == "body") { + buf.push('"); + } else { + buf.push('
" + jade.escape(null == (jade.interp = item.desc) ? "" : jade.interp) + "
"); + } + } + } else { + var $$l = 0; + for (var $index in $$obj) { + $$l++; + if ($$obj.hasOwnProperty($index)) { + var item = $$obj[$index]; + if (item.source == "body") { + buf.push('"); + } else { + buf.push('
" + jade.escape(null == (jade.interp = item.desc) ? "" : jade.interp) + "
"); + } + } + } + } + }).call(this); + buf.push("
"); } return buf.join(""); }; diff --git a/clientapp/templates/includes/mucBareMessage.jade b/clientapp/templates/includes/mucBareMessage.jade index 35d1a31..e2062ae 100644 --- a/clientapp/templates/includes/mucBareMessage.jade +++ b/clientapp/templates/includes/mucBareMessage.jade @@ -1,3 +1,12 @@ .message(id='chat'+message.cid, class=message.classList) span.timestamp=message.formattedTime p.body !{message.processedBody} + - var urls = message.urls + section.embeds + each item in urls + if item.source == 'body' + section.embed.hidden + a.source(href=item.href)= item.desc + else + section.embed + a.source(href=item.href)= item.desc diff --git a/public/css/otalk.css b/public/css/otalk.css index 388e78e..7ec85e9 100644 --- a/public/css/otalk.css +++ b/public/css/otalk.css @@ -1331,11 +1331,13 @@ button.secondary:hover:not(:disabled) { background-color: #f7f7f7; text-align: center; } +.embed.active img { + margin-bottom: 5px; +} .embed.active .description { border: 1px solid #eee; background-color: #fff; margin: 0px; - margin-top: 5px; padding: 10px; text-align: left; font-size: 11px; @@ -1343,7 +1345,7 @@ button.secondary:hover:not(:disabled) { } .embed.active .description h3 { font-size: 12px; - margin: 3px; + margin: 0px; padding: 2px; border-bottom: 1px solid #eee; } diff --git a/public/css/pages/chat.styl b/public/css/pages/chat.styl index 1b30e12..63cd673 100644 --- a/public/css/pages/chat.styl +++ b/public/css/pages/chat.styl @@ -432,11 +432,13 @@ background-color: lighten($gray-lighter, 50%) text-align: center + img + margin-bottom: 5px + .description border: 1px solid #eee background-color: #fff margin: 0px - margin-top: 5px padding: 10px text-align: left font-size: 11px @@ -444,7 +446,7 @@ h3 font-size: 12px - margin: 3px + margin: 0px padding: 2px border-bottom: 1px solid #eee diff --git a/public/x-manifest.cache b/public/x-manifest.cache index 9d37900..b3c1cdf 100644 --- a/public/x-manifest.cache +++ b/public/x-manifest.cache @@ -1,5 +1,5 @@ CACHE MANIFEST -# 0.0.1 1388652517251 +# 0.0.1 1388653959496 CACHE: /app.js