Merge pull request #215 from thelounge/xpaw/wrap

Fix message and topic text wrapping
This commit is contained in:
Jérémie Astori 2016-03-24 00:43:12 -04:00
commit 541d16bc61
2 changed files with 3 additions and 25 deletions

View File

@ -607,6 +607,7 @@ button,
#windows .header .topic {
color: #777;
margin-left: 8px;
word-break: break-all;
}
#windows .window .header {
@ -699,6 +700,7 @@ button,
#chat .messages {
display: table;
table-layout: fixed;
width: 100%;
padding: 10px 0;
}
@ -754,14 +756,6 @@ button,
padding-right: 6px;
}
#chat .wrap,
#chat .text a {
font-style: normal;
word-break: break-all;
word-wrap: break-word;
display: inline-block;
}
#chat .self .text {
color: #999;
}

View File

@ -1,29 +1,13 @@
Handlebars.registerHelper(
"parse", function(text) {
var wrap = wraplong(text);
text = Handlebars.Utils.escapeExpression(text);
text = colors(text);
text = channels(text);
text = uri(text);
if (wrap) {
return "<i class='wrap'>" + text + "</i>";
} else {
return text;
}
return text;
}
);
function wraplong(text) {
var wrap = false;
var split = text.split(" ");
for (var i in split) {
if (split[i].length > 40) {
wrap = true;
}
}
return wrap;
}
function uri(text) {
return URI.withinString(text, function(url, start, end, source) {
if (url.indexOf("javascript:") === 0) {