[ DISC ] Wrap Messages Mod - Prevents streched messages

A place for MOD Authors to post and receive feedback on MODs still in development. No MODs within this forum should be used within a live environment! No new topics are allowed in this forum.
Forum rules
READ: phpBB.com Board-Wide Rules and Regulations

IMPORTANT: MOD Development Forum rules

On February 1, 2009 this forum will be set to read only as part of retiring of phpBB2.
ElbertF
Registered User
Posts: 527
Joined: Thu Mar 11, 2004 9:41 pm
Location: Australia
Contact:

[ DISC ] Wrap Messages Mod - Prevents streched messages

Post 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
Last edited by ElbertF on Fri Oct 27, 2006 10:51 am, edited 8 times in total.
ElbertF
Registered User
Posts: 527
Joined: Thu Mar 11, 2004 9:41 pm
Location: Australia
Contact:

Post 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)
ElbertF
Registered User
Posts: 527
Joined: Thu Mar 11, 2004 9:41 pm
Location: Australia
Contact:

Post 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).
Cross_+_Flame
Registered User
Posts: 295
Joined: Wed Oct 30, 2002 3:37 pm
Location: Okie-homa!
Contact:

Post by Cross_+_Flame »

won't javascript slow the page loading time?
ElbertF
Registered User
Posts: 527
Joined: Thu Mar 11, 2004 9:41 pm
Location: Australia
Contact:

Post 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.
User avatar
onigumo
Registered User
Posts: 1755
Joined: Fri Oct 31, 2003 2:32 am
Contact:

Post by onigumo »

Included in the wrapping are images? Do scrollbars (horrizontal and/or vertical) appear in the wrap?
I write articles on community building
@ The Infinity Program.
ElbertF
Registered User
Posts: 527
Joined: Thu Mar 11, 2004 9:41 pm
Location: Australia
Contact:

Post 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. :)
ElbertF
Registered User
Posts: 527
Joined: Thu Mar 11, 2004 9:41 pm
Location: Australia
Contact:

Post 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.
php_user
Registered User
Posts: 138
Joined: Wed Nov 06, 2002 7:23 am
Location: Sweden, Gothenbourg

Post by php_user »

Script is not ok.

Image
ElbertF
Registered User
Posts: 527
Joined: Thu Mar 11, 2004 9:41 pm
Location: Australia
Contact:

Post by ElbertF »

Did you use the latest version (1.0.4)?
php_user
Registered User
Posts: 138
Joined: Wed Nov 06, 2002 7:23 am
Location: Sweden, Gothenbourg

Post by php_user »

Yes sir. I use script above.

Regards
Mathias
Göteborg
php_user
Registered User
Posts: 138
Joined: Wed Nov 06, 2002 7:23 am
Location: Sweden, Gothenbourg

Post by php_user »

Example! no mods phpBB v2.0.10

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

/T-4
ElbertF
Registered User
Posts: 527
Joined: Thu Mar 11, 2004 9:41 pm
Location: Australia
Contact:

Post 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">
php_user
Registered User
Posts: 138
Joined: Wed Nov 06, 2002 7:23 am
Location: Sweden, Gothenbourg

Post 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
ElbertF
Registered User
Posts: 527
Joined: Thu Mar 11, 2004 9:41 pm
Location: Australia
Contact:

Post by ElbertF »

You're right, you can change that value (and I'll change it in the mod) :wink:
Post Reply

Return to “[2.0.x] MODs in Development”