Skip to content
Snippets Groups Projects
Commit 4a211fb5 authored by deuce's avatar deuce
Browse files

Make quotes in HTML view collapsible and default to collapsed.

parent b7b2eddb
No related branches found
No related tags found
No related merge requests found
...@@ -52,6 +52,9 @@ if(ANSI_formatted) { ...@@ -52,6 +52,9 @@ if(ANSI_formatted) {
} }
} }
else { else {
var blockquote_start='<div class="quote"><a href="#" onclick="toggle_quote(this);return false">Show quote</a><blockquote style="display: none">';
var blockquote_end='</blockquote></div>';
writeln("<div class=\"ansi_toggle\"><a href=\"#\" onclick=\"load_ansi(this.parentNode.parentNode, "+html_sub_code_string+");return false\">ANSI Mode</a></div>"); writeln("<div class=\"ansi_toggle\"><a href=\"#\" onclick=\"load_ansi(this.parentNode.parentNode, "+html_sub_code_string+");return false\">ANSI Mode</a></div>");
// Strip CTRL-A // Strip CTRL-A
body=body.replace(/\1./g,''); body=body.replace(/\1./g,'');
...@@ -87,7 +90,7 @@ else { ...@@ -87,7 +90,7 @@ else {
// If the new length is smaller than the old one, close the extras // If the new length is smaller than the old one, close the extras
for(p=new_prefixes.length; p<prefixes.length; p++) { for(p=new_prefixes.length; p<prefixes.length; p++) {
if(quote_depth > 0) { if(quote_depth > 0) {
line_prefix = line_prefix + '</blockquote>'; line_prefix = line_prefix + blockquote_end;
quote_depth--; quote_depth--;
} }
else { else {
...@@ -100,11 +103,11 @@ else { ...@@ -100,11 +103,11 @@ else {
if(prefixes[p]==undefined) { if(prefixes[p]==undefined) {
/* New depth */ /* New depth */
line_prefix = line_prefix + '<blockquote>'; line_prefix = line_prefix + blockquote_start;
quote_depth++; quote_depth++;
} }
else if(broken) { else if(broken) {
line_prefix = line_prefix + '<blockquote>'; line_prefix = line_prefix + blockquote_start;
quote_depth++; quote_depth++;
} }
else if(prefixes[p].replace(/^\s*(.*?)\s*$/,"$1") != new_prefixes[p].replace(/^\s*(.*?)\s*$/,"$1")) { else if(prefixes[p].replace(/^\s*(.*?)\s*$/,"$1") != new_prefixes[p].replace(/^\s*(.*?)\s*$/,"$1")) {
...@@ -112,14 +115,14 @@ else { ...@@ -112,14 +115,14 @@ else {
var o; var o;
for(o=p; o<prefixes.length && o<new_prefixes.length; o++) { for(o=p; o<prefixes.length && o<new_prefixes.length; o++) {
if(quote_depth > 0) { if(quote_depth > 0) {
line_prefix = '</blockquote>'+line_prefix; line_prefix = blockquote_end+line_prefix;
quote_depth--; quote_depth--;
} }
else { else {
log("BODY: Depth problem 2"); log("BODY: Depth problem 2");
} }
} }
line_prefix = '<blockquote>'+line_prefix; line_prefix = blockquote_start+line_prefix;
quote_depth++; quote_depth++;
broken=true; broken=true;
} }
...@@ -130,7 +133,7 @@ else { ...@@ -130,7 +133,7 @@ else {
else { else {
for(p=0; p<prefixes.length; p++) { for(p=0; p<prefixes.length; p++) {
if(quote_depth > 0) { if(quote_depth > 0) {
line_prefix = line_prefix + '</blockquote>'; line_prefix = line_prefix + blockquote_end;
quote_depth--; quote_depth--;
} }
else { else {
...@@ -145,7 +148,7 @@ else { ...@@ -145,7 +148,7 @@ else {
if(quote_depth != 0) { if(quote_depth != 0) {
log("BODY: Depth problem 4"); log("BODY: Depth problem 4");
for(;quote_depth > 0; quote_depth--) { for(;quote_depth > 0; quote_depth--) {
body += "</blockquote>"; body += blockquote_end;
} }
} }
......
...@@ -91,6 +91,25 @@ function toggle_replies(sub_code, message_number) ...@@ -91,6 +91,25 @@ function toggle_replies(sub_code, message_number)
} }
} }
function toggle_quote(container)
{
for(child in container.parentNode.childNodes) {
if(container.parentNode.childNodes[child].nodeName=='BLOCKQUOTE') {
switch(container.parentNode.childNodes[child].style.display) {
case 'none':
container.parentNode.childNodes[child].style.display='block';
container.innerHTML="Hide quote";
break;
default:
container.parentNode.childNodes[child].style.display='none';
container.innerHTML="Show quote";
break;
}
break;
}
}
}
function load_ansi(container, sub_code) function load_ansi(container, sub_code)
{ {
var message=container.parentNode.parentNode; var message=container.parentNode.parentNode;
......
...@@ -93,8 +93,23 @@ body { ...@@ -93,8 +93,23 @@ body {
background-color: #999; background-color: #999;
} }
blockquote { .ansi_toggle {
}
.quote {
}
.quote a {
font-size: 25%;
margin: 0px;
margin-left: 20px;
}
.quote blockquote {
border-width: 1px; border-width: 1px;
border-color: black; border-color: black;
border-style: dashed; border-style: dashed;
margin: 5px;
margin-left: 20px;
margin-top: 0px;
} }
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment