1
0
mirror of https://github.com/moparisthebest/kaiwa synced 2024-11-14 21:45:08 -05:00

Enable embeds in muc

This commit is contained in:
Lance Stout 2014-01-02 01:13:57 -08:00
parent 9f0162f088
commit 56242011c2
5 changed files with 118 additions and 7 deletions

View File

@ -233,7 +233,56 @@ exports.includes.mucBareMessage = function anonymous(locals) {
}, { }, {
"class": true, "class": true,
id: true id: true
}) + '><span class="timestamp">' + jade.escape(null == (jade.interp = message.formattedTime) ? "" : jade.interp) + '</span><p class="body">' + ((jade.interp = message.processedBody) == null ? "" : jade.interp) + "</p></div>"); }) + '><span class="timestamp">' + jade.escape(null == (jade.interp = message.formattedTime) ? "" : jade.interp) + '</span><p class="body">' + ((jade.interp = message.processedBody) == null ? "" : jade.interp) + "</p>");
var urls = message.urls;
buf.push('<section class="embeds">');
(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('<section class="embed hidden"><a' + jade.attrs({
href: item.href,
"class": "source"
}, {
href: true
}) + ">" + jade.escape(null == (jade.interp = item.desc) ? "" : jade.interp) + "</a></section>");
} else {
buf.push('<section class="embed"><a' + jade.attrs({
href: item.href,
"class": "source"
}, {
href: true
}) + ">" + jade.escape(null == (jade.interp = item.desc) ? "" : jade.interp) + "</a></section>");
}
}
} else {
var $$l = 0;
for (var $index in $$obj) {
$$l++;
if ($$obj.hasOwnProperty($index)) {
var item = $$obj[$index];
if (item.source == "body") {
buf.push('<section class="embed hidden"><a' + jade.attrs({
href: item.href,
"class": "source"
}, {
href: true
}) + ">" + jade.escape(null == (jade.interp = item.desc) ? "" : jade.interp) + "</a></section>");
} else {
buf.push('<section class="embed"><a' + jade.attrs({
href: item.href,
"class": "source"
}, {
href: true
}) + ">" + jade.escape(null == (jade.interp = item.desc) ? "" : jade.interp) + "</a></section>");
}
}
}
}
}).call(this);
buf.push("</section></div>");
} }
return buf.join(""); return buf.join("");
}; };
@ -266,7 +315,56 @@ exports.includes.mucWrappedMessage = function anonymous(locals) {
}, { }, {
"class": true, "class": true,
id: true id: true
}) + '><span class="timestamp">' + jade.escape(null == (jade.interp = message.formattedTime) ? "" : jade.interp) + '</span><p class="body">' + ((jade.interp = message.processedBody) == null ? "" : jade.interp) + "</p></div></div></li>"); }) + '><span class="timestamp">' + jade.escape(null == (jade.interp = message.formattedTime) ? "" : jade.interp) + '</span><p class="body">' + ((jade.interp = message.processedBody) == null ? "" : jade.interp) + "</p>");
var urls = message.urls;
buf.push('<section class="embeds">');
(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('<section class="embed hidden"><a' + jade.attrs({
href: item.href,
"class": "source"
}, {
href: true
}) + ">" + jade.escape(null == (jade.interp = item.desc) ? "" : jade.interp) + "</a></section>");
} else {
buf.push('<section class="embed"><a' + jade.attrs({
href: item.href,
"class": "source"
}, {
href: true
}) + ">" + jade.escape(null == (jade.interp = item.desc) ? "" : jade.interp) + "</a></section>");
}
}
} else {
var $$l = 0;
for (var $index in $$obj) {
$$l++;
if ($$obj.hasOwnProperty($index)) {
var item = $$obj[$index];
if (item.source == "body") {
buf.push('<section class="embed hidden"><a' + jade.attrs({
href: item.href,
"class": "source"
}, {
href: true
}) + ">" + jade.escape(null == (jade.interp = item.desc) ? "" : jade.interp) + "</a></section>");
} else {
buf.push('<section class="embed"><a' + jade.attrs({
href: item.href,
"class": "source"
}, {
href: true
}) + ">" + jade.escape(null == (jade.interp = item.desc) ? "" : jade.interp) + "</a></section>");
}
}
}
}
}).call(this);
buf.push("</section></div></div></li>");
} }
return buf.join(""); return buf.join("");
}; };

View File

@ -1,3 +1,12 @@
.message(id='chat'+message.cid, class=message.classList) .message(id='chat'+message.cid, class=message.classList)
span.timestamp=message.formattedTime span.timestamp=message.formattedTime
p.body !{message.processedBody} 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

View File

@ -1331,11 +1331,13 @@ button.secondary:hover:not(:disabled) {
background-color: #f7f7f7; background-color: #f7f7f7;
text-align: center; text-align: center;
} }
.embed.active img {
margin-bottom: 5px;
}
.embed.active .description { .embed.active .description {
border: 1px solid #eee; border: 1px solid #eee;
background-color: #fff; background-color: #fff;
margin: 0px; margin: 0px;
margin-top: 5px;
padding: 10px; padding: 10px;
text-align: left; text-align: left;
font-size: 11px; font-size: 11px;
@ -1343,7 +1345,7 @@ button.secondary:hover:not(:disabled) {
} }
.embed.active .description h3 { .embed.active .description h3 {
font-size: 12px; font-size: 12px;
margin: 3px; margin: 0px;
padding: 2px; padding: 2px;
border-bottom: 1px solid #eee; border-bottom: 1px solid #eee;
} }

View File

@ -432,11 +432,13 @@
background-color: lighten($gray-lighter, 50%) background-color: lighten($gray-lighter, 50%)
text-align: center text-align: center
img
margin-bottom: 5px
.description .description
border: 1px solid #eee border: 1px solid #eee
background-color: #fff background-color: #fff
margin: 0px margin: 0px
margin-top: 5px
padding: 10px padding: 10px
text-align: left text-align: left
font-size: 11px font-size: 11px
@ -444,7 +446,7 @@
h3 h3
font-size: 12px font-size: 12px
margin: 3px margin: 0px
padding: 2px padding: 2px
border-bottom: 1px solid #eee border-bottom: 1px solid #eee

View File

@ -1,5 +1,5 @@
CACHE MANIFEST CACHE MANIFEST
# 0.0.1 1388652517251 # 0.0.1 1388653959496
CACHE: CACHE:
/app.js /app.js