From 684919ccb54449fb4e263dc08e211594bb4b0ef7 Mon Sep 17 00:00:00 2001 From: deuce <> Date: Fri, 14 Nov 2008 09:05:58 +0000 Subject: [PATCH] Attempt to pad last line out to 80 columns rather than adding an 80 col line --- web/root/sajax-forum/body.xjs | 23 +++++++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) diff --git a/web/root/sajax-forum/body.xjs b/web/root/sajax-forum/body.xjs index 7c59914d38..474d68a221 100644 --- a/web/root/sajax-forum/body.xjs +++ b/web/root/sajax-forum/body.xjs @@ -16,6 +16,7 @@ if(http_request.header['If-Modified-Since'] != undefined) { http_reply.header['Last-Modified']=strftime("%a, %d %b %Y %H:%M:%S GMT",last_mod.getTime()/1000); var body; + if((!msg_area.sub[sub_code.toLowerCase()].ismoderated) || (hdr.attr & MSG_VALIDATED)!=0) { if((hdr.attr & (MSG_PRIVATE|MSG_DELETE))==0) { body=msgbase.get_msg_body(true,hdr.offset); @@ -24,5 +25,23 @@ if((!msg_area.sub[sub_code.toLowerCase()].ismoderated) || (hdr.attr & MSG_VALIDA } ?><pre><?xjs msgbase.close(); -writeln(body); -?> </pre> + +body=body.replace(/\r?\n+(<\/span>)?$/,'$1'); + +// Get the last line +var body_m=body.match(/\n([^\n]*)$/); +if(body_m != null) { + write(body); + body_m[1]=body_m[1].replace(/&[^;]*;/g,"."); + body_m[1]=body_m[1].replace(/<[^>]*>/g,""); + var lenremain=80-body_m[1].length; + while(lenremain > 0) { + write(" "); + lenremain--; + } +} +else { + /* If we couldn't get the last line, add a line of 80 columns */ + writeln(body+":-("); + ?> </pre><?xjs +}?> -- GitLab