in webui/js/source/body-fixups.js [231:304]
function fixup_quotes(splicer) {
if (splicer[splicer.length - 1] !== "\n") splicer += "\n"; //tweak to make quotes match the last line if no newline on it.
let hideQuotes, i, m, qdiv, quote, quotes, t, textbits;
hideQuotes = true;
if (prefs.compactQuotes === false && !G_chatty_layout) {
hideQuotes = false;
}
if (!hideQuotes) return splicer; // We'll bail here for now. Dunno why not.
/* Array holding text and quotes */
textbits = [];
/* Find the first quote, if any */
i = splicer.search(PONYMAIL_QUOTE_RE);
quotes = 0;
/* While we have more quotes, ... */
while (i !== -1) {
quotes++;
/* Only parse the first 50 quotes... srsly */
if (quotes > 50) {
break;
}
/* Text preceding the quote? add it to textbits first */
if (i > 0) {
t = splicer.substring(0, i);
let diffed = fixup_diffs(cut_trailer(t));
if (isArray(diffed)) {
for (let z = 0; z < diffed.length; z++) textbits.push(fixup_urls(diffed[z]));
} else textbits.push(fixup_urls(diffed));
splicer = splicer.substring(i);
}
/* Find the quote and cut it out as a div */
m = splicer.match(PONYMAIL_QUOTE_RE);
if (m) {
quote = m[0];
i = quote.length;
t = splicer.substring(0, i);
quote = quote.replace(/\n>[>\s]*$/g, "\n");
qdiv = new HTML('div', {
"class": "email_quote_parent"
}, [
new HTML('button', {
title: "Toggle quote",
onclick: "toggle_quote(this)"
}, new HTML('span', {
class: 'glyphicon glyphicon-comment'
}, " ")), new HTML('br'), new HTML('blockquote', {
"class": "email_quote",
style: {
display: hideQuotes ? 'none' : 'block'
}
}, fixup_urls(quote))
]);
textbits.push(qdiv);
splicer = splicer.substring(i);
}
/* Find the next quotes */
i = splicer.search(PONYMAIL_QUOTE_RE);
}
/* push the remaining text into textbits */
let diffed = fixup_diffs(cut_trailer(splicer));
if (isArray(diffed)) {
for (let z = 0; z < diffed.length; z++) diffed[z] = fixup_urls(diffed[z]);
} else diffed = fixup_urls(diffed);
textbits.push(new HTML('span', {}, diffed));
return textbits;
}