Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Multi lines in tweets #74

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 35 additions & 3 deletions chrome/Echofon/content/utility.js
Original file line number Diff line number Diff line change
Expand Up @@ -314,6 +314,10 @@ var EchofonCommon = {
textelem.className = "echofon-message-body echofon-conversation-body";

if (msg.entities) {
var style = this.pref().getIntPref("displayStyle");
if (style != 0) {
elem.appendChild(document.createTextNode('\n'));
}
this.convertLinksWithEntities(uid, msg, textelem, elem);
}
else {
Expand Down Expand Up @@ -365,6 +369,9 @@ var EchofonCommon = {
}

if (msg.entities) {
if (style != 0) {
elem.appendChild(document.createTextNode('\n'));
}
return this.convertLinksWithEntities(uid, msg, elem, parent_elem);
}
else {
Expand Down Expand Up @@ -459,7 +466,16 @@ var EchofonCommon = {

var left = text.substring(index, start);
if (left) {
elem.appendChild(document.createTextNode(unescape(left)));
var split_left = left.split('\n');
if(split_left.length) {
for(var j = 0; j < split_left.length - 1; j++) {
elem.appendChild(document.createTextNode(unescape(split_left[j])+"\n"));
}
elem.appendChild(document.createTextNode(unescape(split_left[split_left.length - 1])));
}
else {
elem.appendChild(document.createTextNode(unescape(left)));
}
}
var linked_text = unescape(text.substring(start, end));
var a;
Expand Down Expand Up @@ -509,7 +525,17 @@ var EchofonCommon = {
index = entity['indices'][1];
}
if (text && index < text.length) {
elem.appendChild(document.createTextNode(unescape(text.substring(index, text.length))));
var rest_text = text.substring(index, text.length);
var split_rest_text = rest_text.split('\n');
if(split_rest_text.length) {
for(var i = 0; i < split_rest_text.length - 1; i++) {
elem.appendChild(document.createTextNode(unescape(split_rest_text[i])+"\n"));
}
elem.appendChild(document.createTextNode(unescape(split_rest_text[split_rest_text.length - 1])));
}
else {
elem.appendChild(document.createTextNode(unescape(text.substring(index, text.length))));
}
}
return elem;
},
Expand Down Expand Up @@ -559,7 +585,13 @@ var EchofonCommon = {
pat.lastIndex = 0;
}
if (text) {
elem.appendChild(document.createTextNode(text));
var split_text = text.split('\n');
if(split_text.length) {
for(var i = 0; i < split_text.length - 1; i++) {
elem.appendChild(document.createTextNode(unescape(split_text[i])+"\n"));
}
elem.appendChild(document.createTextNode(unescape(split_text[split_text.length - 1])));
}
}
},

Expand Down