diff --git a/web/root/blogs/blog_item.xjs b/web/root/blogs/blog_item.xjs index 5ac6cb91f6a044a66193596c6715901c3ccdb97f..9969e79f2fc94222415868d9177492fd50b822e1 100644 --- a/web/root/blogs/blog_item.xjs +++ b/web/root/blogs/blog_item.xjs @@ -7,24 +7,39 @@ load(cwd+"/blog_config.js"); <title>The Blogifier!</title> <script> <!-- -function toggle_display(itemID, buttonID) + +function expand_item(itemID, buttonID) { var item = document.getElementById(itemID); var button = document.getElementById(buttonID); - if (item.style.display != "none") { - item.style.display = "none"; - button.src="<?xjs write(http_request.virtual_path)?>plus.gif"; - } - else { - item.style.display = "block"; - button.src="<?xjs write(http_request.virtual_path)?>minus.gif"; - } + item.style.display = "block"; + button.src="<?xjs write(http_request.virtual_path)?>minus.gif"; +} + +function collapse_item(itemID, buttonID) +{ + var item = document.getElementById(itemID); + var button = document.getElementById(buttonID); + + item.style.display = "none"; + button.src="<?xjs write(http_request.virtual_path)?>plus.gif"; } + +function toggle_display(itemID, buttonID) +{ + var item = document.getElementById(itemID); + + if (item.style.display != "none") + collapse_item(itemID, buttonID); + else + expand_item(itemID, buttonID); +} + //--> </script> </head> -<body> +<body onLoad="document.getElementById('ToggleAll').style.visibility = 'visible';"> <p> Welcome to the <?xjs write(msgbase.cfg.name); ?> Blogifier for <?xjs write(poster); ?> @@ -32,6 +47,9 @@ function toggle_display(itemID, buttonID) <?xjs +var expand_all_source=''; +var collapse_all_source=''; + function not_found_error(reason) { http_reply.status="404 Not Found"; @@ -76,6 +94,7 @@ body=body.split(" ").join("<br>"); <p><?xjs write(body); ?></p> <hr> +<p><div id="ToggleAll" style="visibility: hidden"><a name="collapse" href="#collapse" onClick="collapse_all()">Collapse All</a> / <a name="expand" href="#expand" onClick="expand_all()">Expand All</a></div></p> <?xjs // "Comments" @@ -112,10 +131,13 @@ while(1) { //body=body.split(" ").join("</p><p>"); //body=body.split(" ").join(" "); body=body.split(" ").join("<br>"); + + expand_all_source += "expand_item('msg-"+msgid+"','button-"+msgid+"');"; + collapse_all_source += "collapse_item('msg-"+msgid+"','button-"+msgid+"');"; ?> <div style="padding-left: <?xjs write(thread_depth*indent_pixels) ?>px"> -<a onClick="toggle_display('msg-<?xjs write(msgid)?>','button-<?xjs write(msgid) ?>');"><img src="<?xjs write(http_request.virtual_path) ?>plus.gif" id="button-<?xjs write(msgid); ?>"></a> <b><?xjs write(hdr.subject); ?></b> (<?xjs write(date); ?>)<br> +<a name="lnk-<?xjs write(msgid) ?>" href="#lnk-<?xjs write(msgid)?>" onClick="toggle_display('msg-<?xjs write(msgid)?>','button-<?xjs write(msgid) ?>');"><img border="0" src="<?xjs write(http_request.virtual_path) ?>plus.gif" id="button-<?xjs write(msgid); ?>"></a> <b><?xjs write(hdr.subject); ?></b> (<?xjs write(date); ?>)<br> By: <i><?xjs write(hdr.from); ?></i><br> <div id="msg-<?xjs write(msgid) ?>" style="display: none"><?xjs write(body); ?> <hr> @@ -126,5 +148,16 @@ By: <i><?xjs write(hdr.from); ?></i><br> } ?> +<script> +function collapse_all() +{ +<?xjs write(collapse_all_source)?> +} + +function expand_all() +{ +<?xjs write(expand_all_source)?> +} +</script> </body> </html>