[2.0.11] Accurate BBCode Insertion Mod

The cleanup is complete. This forum is now read only.

Rating:

Excellent!
18
64%
Very Good
1
4%
Good
4
14%
Fair
2
7%
Poor
3
11%
 
Total votes: 28

User avatar
Lord Z
Registered User
Posts: 3
Joined: Thu Dec 16, 2004 5:50 pm

Post by Lord Z » Mon Dec 27, 2004 11:35 am

NightriderXP, I don't think it is possible to make a mod wich does Accurate BBCode insertion in Gecko/Mozilla/Firefox, or any other browser except IE. The required javascript is not supported. When most of your members don't use IE, it is still OK install this mod, since it will resume the normal method of inserting BBCode if the new method isn't supported. (your few IE users will still benefit from the mod) But you're right to say will be mostly useless in a case where almost nobody uses IE. Maybe the required javascript will be adopted into the other browsers some day... I hope it will, since I don't use IE myself either. :wink:

Darakhshan, you have used another mod that relocates (and probably modifies) the code which this mod needs to alter in order to function. It is not in posting_body.tpl anymore. (possibly in bbcode_box/add_bbcode.js) Could you give me a link to the mod you've installed already?
I speak in shadows,
a shadow over truth.

NightriderXP
Registered User
Posts: 1418
Joined: Sat Oct 09, 2004 8:17 am
Location: Florida, US
Contact:

Post by NightriderXP » Tue Dec 28, 2004 5:24 am

Lord Z wrote: NightriderXP, I don't think it is possible to make a mod wich does Accurate BBCode insertion in Gecko/Mozilla/Firefox, or any other browser except IE. The required javascript is not supported.

Opera seems to be able to display most of the same pages as IE. Web sites and pages that are specifically designed only to support IE are not pages that I will support or frequent...

Opera is designed around the International standards that M$ has chosen to bastardize. I will not install code that is IE specific because I don't feel that M$ needs more help in locking out its competition. I only support and promote products that promote fair competition...

What is the Javascript that is used in php for bbcode insertion that is supposedly IE specific? As a programmer myself, I have found long ago that there is almost always a workaround to every coding problem and I bet the same applies to this problem as well if there is a will to find it. I wish I understood php better myself so I could better help with this issue...


:?:

User avatar
slackiller
Registered User
Posts: 36
Joined: Sat Aug 23, 2003 1:06 am
Contact:

Post by slackiller » Sun Jan 02, 2005 3:53 am


User avatar
Joe Dalton
Registered User
Posts: 3
Joined: Thu Nov 25, 2004 3:53 pm
Location: Vienna
Contact:

Post by Joe Dalton » Sun Jan 02, 2005 8:35 am

I'v modified it a bit so it works in Mozilla too:

Code: Select all

function bbplace(text) {
    var txtarea = document.post.message;
    if (txtarea.createTextRange && txtarea.caretPos) {
        var caretPos = txtarea.caretPos;
        caretPos.text = caretPos.text.charAt(caretPos.text.length - 1) == ' ' ? caretPos.text + text + ' ' : caretPos.text + text;
        txtarea.focus();
    } else if (txtarea.selectionStart || txtarea.selectionStart == '0') {
        var startPos = txtarea.selectionStart;
        var endPos = txtarea.selectionEnd;
        txtarea.value = txtarea.value.substring(0, startPos)
                      + text 
                      + txtarea.value.substring(endPos, txtarea.value.length);
        txtarea.focus();
        txtarea.selectionStart = startPos + text.length;
        txtarea.selectionEnd = startPos + text.length;
    } else {
        txtarea.value  += text;
        txtarea.focus();
    }
}
(borrowed that from Alex King's Quicktags)

User avatar
niksa
Registered User
Posts: 612
Joined: Mon Sep 08, 2003 7:20 pm
Location: Future birthplace of James T. Kirk
Contact:

Post by niksa » Mon Jan 03, 2005 6:32 pm

Joe Dalton wrote: I'v modified it a bit so it works in Mozilla too:


This works well now, thanks! :D I haven't tried it in Opera yet, but it works in Mozilla for sure. I believe most things that work in Mozilla also work in Opera anyway.

Now I need to figure out how to modify it for emoticons. Shouldn't be too hard.. in theory. ;)

Thanks for sharing the modifications for it, Joe. :)

NightriderXP
Registered User
Posts: 1418
Joined: Sat Oct 09, 2004 8:17 am
Location: Florida, US
Contact:

Post by NightriderXP » Mon Jan 03, 2005 9:17 pm

Nope, even with the second modification above, this still doesn't work in Opera. Hopefully someday soon, someone will figure out a work-around for this...

:cry:

unimatrixzer0
Registered User
Posts: 95
Joined: Mon Oct 25, 2004 5:59 pm

Post by unimatrixzer0 » Thu Jan 06, 2005 6:11 pm

I replaced
function bbplace(text) {
var txtarea = document.post.message;
if (txtarea.createTextRange && txtarea.caretPos) {
var caretPos = txtarea.caretPos;
caretPos.text = caretPos.text.charAt(caretPos.text.length - 1) == ' ' ? caretPos.text + text + ' ' : caretPos.text + text;
txtarea.focus();
} else {
txtarea.value += text;
txtarea.focus();
}
}


with the modified code on the previous page and it still won't work in Firefox 1.0

sph
Registered User
Posts: 6
Joined: Fri Sep 24, 2004 12:04 pm

Post by sph » Fri Jan 07, 2005 11:14 pm

Joe Dalton wrote: I'v modified it a bit so it works in Mozilla too:


I tried it in an very old Phoenix (now Firefox) and it worked. In Safari 1.2.4 it does not work :(
niksa wrote: Now I need to figure out how to modify it for emoticons. Shouldn't be too hard.. in theory. ;)


However here are the changes, so that the emoticon is inserted in the correct place:

Code: Select all

#
#-----[ FIND ]------------------------------------------
#
# This is in the function emoticon(text)
        } else {
                txtarea.value  += text;
                txtarea.focus();

#
#-----[ REPLACE WITH ]------------------------------------------
#
        } else {
                bbplace(text);
                txtarea.focus();

Thanks for your mod, Joe!

Stephan

User avatar
Doctor Love
Registered User
Posts: 117
Joined: Sat Jul 24, 2004 12:20 am
Location: USA
Contact:

Mod to the MOD

Post by Doctor Love » Sat Jan 15, 2005 3:37 pm

Your right! It not only does not work with Safari 1.2.4 (newest), but it rendered Safari incapable of inserting anywhere, even at the end of the line.

I had such high hopes too!
Aleichem Shalom,

Doctor Love

User avatar
Cryomenace
Registered User
Posts: 22
Joined: Wed Jan 19, 2005 11:33 am
Location: Taastrup, Denmark

Post by Cryomenace » Tue Feb 15, 2005 11:31 pm

Joe Dalton wrote: I'v modified it a bit so it works in Mozilla too

Thanks Joe Dalton, regular BBCodes are now inserted correctly in Firefox. :D

Anyway of altering or adding code, so that it also fixes the caret problem with the smilies under Firefox?

EDIT: Nevermind, forgot to replace some code. ;)
Last edited by Cryomenace on Wed Feb 23, 2005 3:14 pm, edited 1 time in total.
/Cryomenace

Apache/2.2.2 (Win32) mod_ssl/2.2.2 OpenSSL/0.9.8b PHP/5.1.4 MySQL/5.0.20 phpBB/2.0.21 Server at Port 443
Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.0.4) Gecko/20060508 Firefox/1.5.0.4

pappa
Registered User
Posts: 115
Joined: Fri Jan 23, 2004 2:42 am

Post by pappa » Wed Feb 16, 2005 6:38 am

could some one give me a hand moding my custom template/skin ?

pappa
Registered User
Posts: 115
Joined: Fri Jan 23, 2004 2:42 am

Post by pappa » Tue Mar 08, 2005 5:04 am

bump

FLAGBALL The Home of the
Renegades a multinational online gaming clan all coming together play under one name
the *R*enegades

User avatar
breadcrust
Registered User
Posts: 9
Joined: Sun Feb 20, 2005 7:50 am
Location: Australia
Contact:

Post by breadcrust » Sun Mar 27, 2005 4:11 am

Excuse the language but, I'm extermly pissed off at this mod. Nowhere does it say it only works on IE.

I loaded this mod into my forum, and tested it out. Same thing as before. wtf? then i tryed a different theme, still the same thing? :?

then i had a closer look at the mod and found
## If the client's browser doesn't support the technology to insert BBCode accuratly, it will
## be placed the old-fashioned way.


does support the "technology" huh? ffs, mozilla's whole interface is written in XUL and javascript. if theres somekind of javascript "technology" it could support, its this. :evil:

I dont think Opera, Gecko browsers (mozilla/firefox/etc) or khtml browsers (konqueror/safiri) are to blame for not having this "technology", the author is to blame for not supporting anything other than IE, because other browsers could be well capable of this sort of mod, its just the author as decided to write code that only works for m$ apps. :x

i think the author should try to fix this straight away, or if anything, release a new revision version, with no code changed, but some more notes about this problem and actually saying only Internet Explorer works with it.

this could of been one of my favorite mods ever, but because of this IE only support, im rating this MOD as poor.
/* breadcrust */

t3h Auslanner Forums
http://forum.auslanner.com

Riddick247
Registered User
Posts: 1
Joined: Tue Mar 22, 2005 8:42 pm

Post by Riddick247 » Fri Apr 08, 2005 9:19 am

I tried it and it works in Firefox for me, but not in IE... ah well I like Firefox more anyway, gr8 mod!

User avatar
MarneusCalgarXP
Registered User
Posts: 1
Joined: Sun Oct 03, 2004 11:01 am
Location: France
Contact:

Post by MarneusCalgarXP » Thu May 05, 2005 11:47 am

I've managed to have it work with IE and Mozilla Firefox. First I've used the code of Joe Dalton:

Code: Select all

function bbplace(text) {
    var txtarea = document.post.message;
    if (txtarea.createTextRange && txtarea.caretPos) {
        var caretPos = txtarea.caretPos;
        caretPos.text = caretPos.text.charAt(caretPos.text.length - 1) == ' ' ? caretPos.text + text + ' ' : caretPos.text + text;
        txtarea.focus();
    } else if (txtarea.selectionStart || txtarea.selectionStart == '0') {
        var startPos = txtarea.selectionStart;
        var endPos = txtarea.selectionEnd;
        txtarea.value = txtarea.value.substring(0, startPos)
                      + text
                      + txtarea.value.substring(endPos, txtarea.value.length);
        txtarea.focus();
        txtarea.selectionStart = startPos + text.length;
        txtarea.selectionEnd = startPos + text.length;
    } else {
        txtarea.value  += text;
        txtarea.focus();
    }
} 
Then I've modified the emoticon function:

Code: Select all

function emoticon(text) {
	bbplace(text);
}
And eventually I've modifed something further in the closing tags:

Code: Select all

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

if (donotinsert) {		// Close all open tags up to the one just clicked & default button names
		while (bbcode[bblast]) {
				butnumber = arraypop(bbcode) - 1;
				txtarea.value += bbtags[butnumber + 1];

#
#----[ REPLACE BY ]------------------------------------------ 
#

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]);
And now it works !
Dark Skull Software
http://www.darkskull.net

Post Reply

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

Who is online

Users browsing this forum: No registered users and 9 guests