Page 1 of 2

[ DISC ] Wrap Messages Mod - Prevents streched messages

Posted: Thu Nov 04, 2004 3:21 pm
by ElbertF
A simple mod that prevents all other post from stretching (they will stay within the users' current window size!) when a large image or text is posted. Quote and edit button will never bu out of sight.

There may already be mods like this, but it was so very easy to make.. :)

Here's a screenshot to show what it does, demo on my board (sig):

Image

Code: Select all

##############################################################
## MOD Title: Wrap Messages Mod
## MOD Author: etncrew < spambots@hotmail.com > (Oker) http://www.etncrew.com/forum
## MOD Description: Long images or strings will stretch the board, this mod wraps all the
## other messages to the current window width. It also prevents the quote and edit buttons to
## move out of sight. This mod will even work with wide signatures.
## Screenshot: http://img110.exs.cx/img110/310/Untitled-3.gif
## MOD Version: 1.0.5
##
## Installation Level: Easy
## Installation Time: 3 Minutes
## Files To Edit: viewtopic_body.tpl
## Included Files: n/a
##############################################################
## For Security Purposes, Please Check: http://www.phpbb.com/mods/ for the
## latest version of this MOD. Downloading this MOD from other sites could cause malicious code
## to enter into your phpBB Forum. As such, phpBB will not offer support for MOD's not offered
## in our MOD-Database, located at: http://www.phpbb.com/mods/
##############################################################
## Author Notes: Thanks to Mosymuis (http://www.phpBB.nl) for ideas.
##
##############################################################
## MOD History:
##
##   2004-10-20 - Version 1.0.5
##      - Bugfix
##
##   2004-10-20 - Version 1.0.4
##      - Added multiple browser support
##
##   2004-10-20 - Version 1.0.3
##      - Quote and edit boxes will never be out of sight
##      - Mod is now a little bit faster
##
##   2004-10-20 - Version 1.0.1
##      - Max width is automaticly set to the current window width with JavaScript.
##
##   2004-10-20 - Version 1.0.0
##      - Creation
##
##############################################################
## Before Adding This MOD To Your Forum, You Should Back Up All Files Related To This MOD
##############################################################


#
#-----[ OPEN ]------------------------------------------
#

templates/subSilver/viewtopic_body.tpl

#
#-----[ FIND ]------------------------------------------
#

<table class="forumline" width="100%" cellspacing="1" cellpadding="3" border="0">

#
#-----[ BEFORE, ADD ]------------------------------------------
#

<!-- Start Wrap Posts Mod
ADD -->
<script language="javascript" type="text/javascript">
	var getSize = document.body.offsetWidth - 205;
	
	function writeTable() {
		document.write('<table width="' + getSize + '" style="border:0px dotted #444444" cellpadding="0" cellspacing="0">');
	}
</script>
<!-- End Wrap Posts Mod -->


#
#-----[ FIND ]------------------------------------------
#

		<td class="{postrow.ROW_CLASS}" width="100%" height="28" valign="top"><table width="100%" border="0" cellspacing="0" cellpadding="0">
			<tr>

#
#-----[ AFTER, ADD ]------------------------------------------
#

	<!-- Start Wrap Posts Mod
	ADD -->
				<td>
					<script language="javascript" type="text/javascript">writeTable();</script>
						<tr>
	<!-- End Wrap Posts Mod -->


#
#-----[ FIND ]------------------------------------------
#

				<td width="100%"><a href="{postrow.U_MINI_POST}"><img src="{postrow.MINI_POST_IMG}" width="12" height="9" alt="{postrow.L_MINI_POST_ALT}" title="{postrow.L_MINI_POST_ALT}" border="0" /></a><span class="postdetails">{L_POSTED}: {postrow.POST_DATE}<span class="gen">&nbsp;</span>&nbsp; &nbsp;{L_POST_SUBJECT}: {postrow.POST_SUBJECT}</span></td>
				<td valign="top" nowrap="nowrap">{postrow.QUOTE_IMG} {postrow.EDIT_IMG} {postrow.DELETE_IMG} {postrow.IP_IMG}</td>
			</tr>

#
#-----[ AFTER, ADD ]------------------------------------------
#

	<!-- Start Wrap Posts Mod
	ADD -->			
			</tr>
		</table>
	</td>
	<!-- End Wrap Posts Mod -->

#
#-----[ FIND ]------------------------------------------
#

			</tr>
			<tr>
				<td colspan="2"><span class="postbody">{postrow.MESSAGE}{postrow.SIGNATURE}</span><span class="gensmall">{postrow.EDITED_MESSAGE}</span></td>

#
#-----[ REPLACE WITH ]------------------------------------------
#

	<!-- Start Wrap Posts Mod
	REMOVE
			</tr>
			<tr>
				<td colspan="2"><span class="postbody">{postrow.MESSAGE}{postrow.SIGNATURE}</span><span class="gensmall">{postrow.EDITED_MESSAGE}</span></td>
	ADD -->
			</tr>
			<tr>
				<td colspan="2">
					<script language="javascript" type="text/javascript">writeTable();</script>
						<tr>
							<td><span class="postbody">{postrow.MESSAGE}{postrow.SIGNATURE}</span><span class="gensmall"><font style="color: #333333">{postrow.EDITED_MESSAGE}</font></span></td>
						</tr>
					</table>
				</td>
	<!-- End Wrap Posts Mod -->

#
#-----[ SAVE/CLOSE ALL FILES ]------------------------------------------
#
# EoM
Upgrade to 1.0.1
Upgrade to 1.0.3
Upgrade to 1.0.4
Upgrade to 1.0.5

Posted: Thu Nov 04, 2004 5:08 pm
by ElbertF
Upgrade to 1.0.1

The max width is now automaticly set to the users' current window size. It's very practical 8)

Posted: Thu Nov 04, 2004 7:01 pm
by ElbertF
Upgrade to 1.0.3

The mod is now even a little bit faster, and the quote and edit buttons will never be out sight, even with wide messages (screenshot updated).

Posted: Fri Nov 05, 2004 12:59 am
by Cross_+_Flame
won't javascript slow the page loading time?

Posted: Fri Nov 05, 2004 9:28 am
by ElbertF
Not really, because I put the JavaScript outside the postrow. It's called only once per page, and works for all the messages. There is a demo on my board.

Posted: Fri Nov 05, 2004 11:49 pm
by onigumo
Included in the wrapping are images? Do scrollbars (horrizontal and/or vertical) appear in the wrap?

Posted: Sat Nov 06, 2004 12:05 am
by ElbertF
This mod wont get rid of scrollbars. Messages with long strings or images will still stretch the board, but this mod prevents all the other messages from stretching aswell. It also prevents the quote and edit buttons to go out of sight, as you can see at the screenshot in the first post and the demo at my forum. :)

Posted: Sun Nov 14, 2004 4:21 pm
by ElbertF
Upgrade to 1.0.4

Appearently, the mod didn't work in all browsers, now it does. I think it's ready for validation.

Posted: Sun Nov 14, 2004 8:17 pm
by php_user
Script is not ok.

Image

Posted: Sun Nov 14, 2004 8:31 pm
by ElbertF
Did you use the latest version (1.0.4)?

Posted: Sun Nov 14, 2004 8:34 pm
by php_user
Yes sir. I use script above.

Regards
Mathias
Göteborg

Posted: Sun Nov 14, 2004 8:47 pm
by php_user
Example! no mods phpBB v2.0.10

http://medlem.spray.se/mathiasv721/viewtopic.php?p=2#2

/T-4

Posted: Sun Nov 14, 2004 8:52 pm
by ElbertF
Upgrade to 1.0.5

Thanks for reporting that! Apply this to fix it (1.0.4 to 1.0.5):

After:

Code: Select all

	REMOVE
			</tr>
			<tr>
				<td colspan="2"><span class="postbody">{postrow.MESSAGE}{postrow.SIGNATURE}</span><span class="gensmall">{postrow.EDITED_MESSAGE}</span></td>
	ADD -->
Add:

Code: Select all

			</tr>
			<tr>
				<td colspan="2">

Posted: Sun Nov 14, 2004 9:16 pm
by php_user
Little stretch. Perhaps change this code to var getSize = document.body.offsetWidth - 295 (195);

http://medlem.spray.se/mathiasv721/viewtopic.php?p=4#4

/Mathias

Posted: Sun Nov 14, 2004 9:23 pm
by ElbertF
You're right, you can change that value (and I'll change it in the mod) :wink: