[2.0.17] BBCodes & smilies enhancement

All new MODs released in our MOD Database will be announced in here. All support for released MODs needs to take place in here. No new MODs will be accepted into the MOD Database for phpBB2
Forum rules
READ: phpBB.com Board-Wide Rules and Regulations

On February 1, 2009 this forum will be set to read only as part of retiring of phpBB2.

Rating:

Excellent!
15
71%
Very Good
5
24%
Good
1
5%
Fair
0
No votes
Poor
0
No votes
 
Total votes: 21

asinshesq
Registered User
Posts: 6266
Joined: Sun Feb 22, 2004 9:34 pm
Location: NYC
Name: Alan

Post by asinshesq »

-=ET=- wrote: Hum... :roll:

You post...
asinshesq wrote:Thanks, it does help.

...the 15th of september.

And in the Caret Bug fix topic I've found nothing interresting to fix this issue before this date....


Now it's my turn to :roll: at myself :oops:

The fix I chased down in September is in fact something you effectively already have in your mod. That's your fix that allows moz and firefox users to insert smilies in the right place. I do NOT have a fix for the fact that after your mod insert the smilies in the right place the curser jumps up to the top if you can't already see the top in the post window..

My apologies :oops: :oops:
markus_petrux
Former Team Member
Posts: 1887
Joined: Wed Apr 23, 2003 7:11 am
Location: Girona, Catalunya (Spain)
Contact:

Post by markus_petrux »

Hi!

I believe I've found a solution to a "pending" fix.
-=ET=- wrote:
asinshesq wrote:And here's another issue:

In firefox (and presumably mozilla) the posting screen jumps up to the top if you insert a smilie in a post that is long enough so that you have scroll bars and are inserting a smilie or bbcode towards the bottom. That does not happen with IE.

Any easy fix for that?

Unfortunately, not yet :(


OPEN: posting_body.tpl and posting_smilies.tpl

FIND:

Code: Select all

function mozInsert(txtarea, openTag, closeTag)
{
AFTER ADD:

Code: Select all

var scrollTop = ( typeof(txtarea.scrollTop) == 'number' ? txtarea.scrollTop : -1 );
FIND (at the end of the mozInsert function):

Code: Select all

txtarea.focus();
AFTER ADD:

Code: Select all

if( scrollTop >= 0 ) { txtarea.scrollTop = scrollTop; }
So, the whole mozInsert function looks like this:

Code: Select all

function mozInsert(txtarea, openTag, closeTag)
{
	var scrollTop = ( typeof(txtarea.scrollTop) == 'number' ? txtarea.scrollTop : -1 );

	if (txtarea.selectionEnd > txtarea.value.length) { txtarea.selectionEnd = txtarea.value.length; } 
       
	var startPos = txtarea.selectionStart; 
	var endPos = txtarea.selectionEnd+openTag.length; 
	txtarea.value=txtarea.value.slice(0,startPos)+openTag+txtarea.value.slice(startPos); 
	txtarea.value=txtarea.value.slice(0,endPos)+closeTag+txtarea.value.slice(endPos); 
         
	txtarea.selectionStart = startPos+openTag.length; 
	txtarea.selectionEnd = endPos; 
	txtarea.focus();

	if( scrollTop >= 0 ) { txtarea.scrollTop = scrollTop; }
}
Tested on Firefox 1.0.4 and seems to work. :)
EasyMOD Standards | MOD Template Actions | MODs in Development Rules
Useful information for MOD Authors | MOD Queue Stats | Search MODs
Write SQL/DDL portable to all SQL servers supported by phpBB!
Get EasyMOD 0.3.0! | Suport al phpBB en Català!
8)
asinshesq
Registered User
Posts: 6266
Joined: Sun Feb 22, 2004 9:34 pm
Location: NYC
Name: Alan

Post by asinshesq »

Thanks, Markus! I'll try that tonight and report back.
KI
Registered User
Posts: 32
Joined: Sat Nov 20, 2004 11:46 pm

Post by KI »

@markus_petrux
It works perfectly for me! Big Thanks for this bugfix. :)

p.s. I have mozilla firefox 1.0.4, too
But besides I tested it on IE 6 SP1 (so many abbreviations ;) )
asinshesq
Registered User
Posts: 6266
Joined: Sun Feb 22, 2004 9:34 pm
Location: NYC
Name: Alan

Post by asinshesq »

The new fix does work...thanks!!
markus_petrux
Former Team Member
Posts: 1887
Joined: Wed Apr 23, 2003 7:11 am
Location: Girona, Catalunya (Spain)
Contact:

Post by markus_petrux »

Ah, good to know. :)


.
EasyMOD Standards | MOD Template Actions | MODs in Development Rules
Useful information for MOD Authors | MOD Queue Stats | Search MODs
Write SQL/DDL portable to all SQL servers supported by phpBB!
Get EasyMOD 0.3.0! | Suport al phpBB en Català!
8)
User avatar
-=ET=-
Registered User
Posts: 799
Joined: Sun May 25, 2003 5:32 pm

Post by -=ET=- »

markus_petrux wrote: I believe I've found a solution to a "pending" fix.

I'll test it, add it and credit you in a 1.2.2 future release.
Thanks markus_petrux! :)
Eternal newbie
markus_petrux
Former Team Member
Posts: 1887
Joined: Wed Apr 23, 2003 7:11 am
Location: Girona, Catalunya (Spain)
Contact:

Post by markus_petrux »

You're welcome :)

You might want to check a little fix I did for the Fix Caret Bug MOD by TerraFrost:
http://www.phpbb.com/phpBB/viewtopic.ph ... 77#1628777

I believe it also affects your MOD and it will avoid problems if other javascripts in need of the window.onload event handler are present on the posting/privmsg pages.
EasyMOD Standards | MOD Template Actions | MODs in Development Rules
Useful information for MOD Authors | MOD Queue Stats | Search MODs
Write SQL/DDL portable to all SQL servers supported by phpBB!
Get EasyMOD 0.3.0! | Suport al phpBB en Català!
8)
markus_petrux
Former Team Member
Posts: 1887
Joined: Wed Apr 23, 2003 7:11 am
Location: Girona, Catalunya (Spain)
Contact:

Post by markus_petrux »

BTW, I believe the changes made to posting_smilies.tpl could be simplified a bit.

Instead of duplicating code for the mozInsert() function, it could invoke the emoticon() function of the "opener" window.

The code in posting_smilies.tpl would look like:

Code: Select all

<!-- Start replacement - BBCodes & smilies enhancement MOD -->
<td><img src="{smilies_row.smilies_col.SMILEY_IMG}" border="0" style="cursor:pointer;" onclick="opener.emoticon('{smilies_row.smilies_col.SMILEY_CODE}');" alt="{smilies_row.smilies_col.SMILEY_DESC}" title="{smilies_row.smilies_col.SMILEY_DESC}" /></td>
<!-- End replacement - BBCodes & smilies enhancement MOD -->
Note I also replaced onmouseover="this.style.cursor='hand';" with style="cursor:pointer;".

By calling opener.emoticon() in the onclick event one can also remove the whole emoticon function from posting_smilies.tpl, which is very good if someone wants to isolate all javascript required by the BBCode editor in a separate .js file. I've been doing this for another project I'm working on. :)
EasyMOD Standards | MOD Template Actions | MODs in Development Rules
Useful information for MOD Authors | MOD Queue Stats | Search MODs
Write SQL/DDL portable to all SQL servers supported by phpBB!
Get EasyMOD 0.3.0! | Suport al phpBB en Català!
8)
Rockduo
Registered User
Posts: 3
Joined: Fri Jun 03, 2005 7:47 pm

Netscape 7.2 problem

Post by Rockduo »

I installed this MOD after installing Accurate BBCode Insertion Mod, but in Netscape 7.2 and Mozilla Firefox 1.0.4 the smilies get placed at the bottom of the textarea box. (This occurred even before I applied markus's subMOD.)

Here's my posting_body.tpl file.

Should bbplace(bbtags[#]) come before the B&SE Mod additions? E.g., instead of--

Code: Select all

	if (donotinsert) {		// Close all open tags up to the one just clicked & default button names
		while (bbcode[bblast]) {
				butnumber = arraypop(bbcode) - 1;
// Start add - BBCodes & smilies enhancement MOD
				if (txtarea.createTextRange && txtarea.caretPos) {
.
.
.
				} else
// End add - BBCodes & smilies enhancement MOD
				bbplace(bbtags[butnumber + 1]);  // *****
should it be--

Code: Select all

	if (donotinsert) {		// Close all open tags up to the one just clicked & default button names
		while (bbcode[bblast]) {
				butnumber = arraypop(bbcode) - 1;
				bbplace(bbtags[butnumber + 1]);  // *****
// Start add - BBCodes & smilies enhancement MOD
				if (txtarea.createTextRange && txtarea.caretPos) {
.
.
.
				} else
// End add - BBCodes & smilies enhancement MOD
:?:
Dan
Olorin83
Registered User
Posts: 17
Joined: Mon Jun 27, 2005 7:14 am

Post by Olorin83 »

So, when shall the updated version be released?
User avatar
-=ET=-
Registered User
Posts: 799
Joined: Sun May 25, 2003 5:32 pm

Post by -=ET=- »

Perhaps this WE if I have time.
I've not only phpBB in my life and this week I'm not at home.
Eternal newbie
User avatar
-=ET=-
Registered User
Posts: 799
Joined: Sun May 25, 2003 5:32 pm

Re: Netscape 7.2 problem

Post by -=ET=- »

Rockduo wrote: I installed this MOD after installing Accurate BBCode Insertion Mod, but...

Unfortunately it must be because of an incompatibility between the 2 MODs.
I've tested mine again and everything works fine.

Moreover FYI my MOD includes the same kind of fix than the one of the Accurate BBCode Insertion MOD.
In fact, my MOD is a king of all-in-one :)

markus_petrux> Your 2 fix seem to work fine. If you want to test the 1.2.2 before I submit it...
http://www.golfexpert.net/phpbb/mods/BB ... .2.2em.zip
Thanks!
Eternal newbie
markus_petrux
Former Team Member
Posts: 1887
Joined: Wed Apr 23, 2003 7:11 am
Location: Girona, Catalunya (Spain)
Contact:

Post by markus_petrux »

hmmm... food for testing! ...I'll give it a try this evenning.


:)
EasyMOD Standards | MOD Template Actions | MODs in Development Rules
Useful information for MOD Authors | MOD Queue Stats | Search MODs
Write SQL/DDL portable to all SQL servers supported by phpBB!
Get EasyMOD 0.3.0! | Suport al phpBB en Català!
8)
markus_petrux
Former Team Member
Posts: 1887
Joined: Wed Apr 23, 2003 7:11 am
Location: Girona, Catalunya (Spain)
Contact:

Post by markus_petrux »

The installation script worked like a charm. :)

The upgrade from 1.2.1 to 1.2.2 contains an error in the first steps, though.

Code: Select all

# 
#-----[ OPEN ]------------------------------------------------ 
#
templates/subSilver/posting_body.tpl

#
#-----[ FIND ]------------------------------------------------
#
// Start add - BBCodes & smilies enhancement MOD
var baseHeight;
window.onload = initInsertions;

function initInsertions() {
	document.post.message.focus();
	if (is_ie && typeof(baseHeight) != 'number') baseHeight = document.selection.createRange().duplicate().boundingHeight;
}
// End add - BBCodes & smilies enhancement MOD

#
#-----[ BEFORE, ADD ]-----------------------------------------
#
# This instruction and this code is copyright (C) TerraFrost
# http://www.frostjedi.com
#
// Start add - BBCodes & smilies enhancement MOD
var baseHeight;
function initInsertions() {
	if (is_ie && typeof(baseHeight) != 'number') baseHeight = document.selection.createRange().duplicate().boundingHeight;
}
// End add - BBCodes & smilies enhancement MOD
Once I changed the "BEFORE, ADD" action with "REPLACE WITH" it worked like a charm as well. :)
EasyMOD Standards | MOD Template Actions | MODs in Development Rules
Useful information for MOD Authors | MOD Queue Stats | Search MODs
Write SQL/DDL portable to all SQL servers supported by phpBB!
Get EasyMOD 0.3.0! | Suport al phpBB en Català!
8)
Post Reply

Return to “[2.0.x] MOD Database Releases”