PDA

View Full Version : [vbhacker] Mozilla Text Area Fix


sidhighwind
06-03-2002, 10:00 PM
This hack fixes the problem with Mozilla and the text area on the forum. Mozilla reads the width attribute different than netscape and causes the text area's to be narrow and very fustrating to use when you are typing in a lot of code or just a long message.

Description of what was changed:

I changed the function gettextareawidth to have mozilla use the width specified for IE instead of the width specified for Netscape.

I hope you all like my first hack.

SiD

sidhighwind
06-04-2002, 02:20 PM
here is a screen shot of the before and after...

Tungsten
06-04-2002, 03:13 PM
Installed it and am no worse for the wear. :) I don't get many Netscape users on my site but this will at least make it "friendlier" for them. Thanks.

snyx
06-04-2002, 03:19 PM
I donno anyone who uses mozilla?!?

sidhighwind
06-04-2002, 03:25 PM
Originally posted by snyx
I donno anyone who uses mozilla?!?

I know a bunch of people that do. That is the only browser I use.

Floris
06-04-2002, 05:36 PM
Besides IE6 I use Mozilla 1.0 rcX (nightly builds every weekend)
As soon as it goes gold, I will drop IE6 :)

Smoothie
06-04-2002, 05:59 PM
Excuse please! Can't this be done by going to admin cp, styles, modify, text width areas? I changed mine to 70 for NS 6.0 to 70 and the text area looks the same as IE now. I'm using Mozilla ver 1 RC3 and the text area looks the same on both IE and Moz.

sidhighwind
06-04-2002, 06:04 PM
Yes it can be done that way but if you get people that come to your forum with netscape 4.x it will look very wierd. That is why I did this hack.

Smoothie
06-04-2002, 06:08 PM
But you can set the text width separately for Nutscrape 4.xx

MarkG
06-04-2002, 06:36 PM
works, thanks!

Webmasta XT
06-05-2002, 01:10 AM
what the heck is mozilla?

sidhighwind
06-05-2002, 01:58 AM
Originally posted by Webmasta XT
what the heck is mozilla?

It is the browser that Netscape is based off it. It is the most standards complient browser out on the market today. go check it out at http://www.mozilla.org

Smoothie
06-05-2002, 02:06 AM
It is extremely fast. Blows the doors off Internet Exploiter.

Boofo
06-05-2002, 06:18 AM
What would you recommend for the setting for Netscape 6 and 7 and Netscape 4? Set them all to 70 like IE is?

Originally posted by Smoothie
Excuse please! Can't this be done by going to admin cp, styles, modify, text width areas? I changed mine to 70 for NS 6.0 to 70 and the text area looks the same as IE now. I'm using Mozilla ver 1 RC3 and the text area looks the same on both IE and Moz.

Smoothie
06-05-2002, 07:42 AM
Originally posted by Boofo
What would you recommend for the setting for Netscape 6 and 7 and Netscape 4? Set them all to 70 like IE is?

That's how I have mine set.

Boofo
06-05-2002, 07:48 AM
Done, thanks! :)

Boofo
06-05-2002, 08:00 AM
If you can change these settings in the Styles > Modify, why would you need to install this hack? I have them all set to 70 (Thanks goes out to Smoothie for this one). Isn't that basically what your hack does? :)

Internet Explorer 4+
Netscape Navigator 4.x
Netscape Navigator 6.0



Originally posted by sidhighwind
Yes it can be done that way but if you get people that come to your forum with netscape 4.x it will look very wierd. That is why I did this hack.

Smoothie
06-05-2002, 08:15 AM
I didn't add the hack because the changes in the admin cp/styles/text input area took care of the width problems.

Boofo
06-05-2002, 08:18 AM
Anytime I can change a setting that will do what installing a hack does, then I'm with you on this one. :)

Originally posted by Smoothie
I didn't add the hack because the changes in the admin cp/styles/text input area took care of the width problems.

Thomas P
06-06-2002, 01:14 PM
Thanks, great mod - especially now when Mozilla went Gold,
10x,
-Tom

eiSecure
06-06-2002, 01:17 PM
Originally posted by Smoothie
I didn't add the hack because the changes in the admin cp/styles/text input area took care of the width problems. That won't work, because Mozilla is not Netscape, so what you're doing is changing the widths for Netscape, and not Mozilla.

The default settings for all the browsers in the admin cp is correct. If you look at the code changes for this hack, you'll see that there is extra code that detects if the browser is indeed Mozilla, not Netscape or MSIE.

Then, it changes the text widths accordingly.

Smoothie
06-06-2002, 04:57 PM
A screen shot of the Mozilla text window, after adjusting the text width in the style section, without the hack added. Actually, Mozilla is Netscape.

eiSecure
06-06-2002, 05:13 PM
Originally posted by Smoothie
A screen shot of the Mozilla text window, after adjusting the text width in the style section, without the hack added. Actually, Mozilla is Netscape. Is that 1.0 Final? It doesn't work on mine...

Smoothie
06-06-2002, 05:17 PM
It is. But it worked like that with all of the Mozilla releases, prior to the full release of ver 1.0, including the nightly builds.

eiSecure
06-06-2002, 05:19 PM
Hmm....just be my browser settings that messed it up...

Replaced the useragent with AIM/30. ^_^

irc
09-16-2002, 06:18 PM
I downloaded this hack, but I'm not exactly sure how to install it.

Do I replace the first version of the function with the second? Do I put it in my main folder and just run the php file?

Me stoopid, but me love mozilla.

irc
09-16-2002, 08:41 PM
I manually made the hack. Thanks!

Thomas P
11-14-2002, 10:17 PM
Recently upgraded to 2.2.8 and had to rehack.

Works great (I did it manually(!)).

cu,
-Tom

neocorteqz
01-05-2003, 10:52 AM
Thanks. Great Idea, I'm surprised I didn't see this earlier. I was starting to get annoyed with the short text box area.

mjames
01-05-2003, 02:36 PM
I'm looking to install this. So all you do is replace the gettextareawidth template with the file above?

Sketch
01-07-2003, 01:08 AM
ergh....can someone please paste the instructions here. I don't know what's wrong with my PC, but I think I'm getting random screwy characters in downloaded text files. I keep getting T-String errors.... :(

Aaron

Smoothie
01-07-2003, 01:59 AM
yea, login to your admin cp, styles, modify, click [fonts/colors/etc], scroll down to the bottom. Textarea Widths, change Netscape Navigator 6.0 to 70, click save changes. Works for me.

Erwin
02-10-2003, 09:55 AM
Originally posted by Smoothie
yea, login to your admin cp, styles, modify, click [fonts/colors/etc], scroll down to the bottom. Textarea Widths, change Netscape Navigator 6.0 to 70, click save changes. Works for me.

Yes, but the textarea in Netscape 6.0 may then be too big.

Without this hack, by default, vB 2.2.9 Mozilla uses Netscape 6.0 width, which is by default 40.

With this hack, vB 2.2.9 Mozilla uses the IE textarea width instead which is set at 70.

That's the difference.

Smoothie
02-10-2003, 04:13 PM
They both (Mozilla, Netscape) appear the same (text area) to me, without this hack

Mr. X
04-05-2003, 05:47 AM
Is there ever going to be .txt instructions posted or what? I could use this hack for some of my Moz users. The textarea in IE6 is fine, but in Moz its simply too small, and changing the values in the styles section does nothing.

Erwin
04-05-2003, 09:32 AM
EDIT: Updated the instructions to make it clearer...

In functions.php, replace this section:


// ###################### Start gettextareawidth #######################
function gettextareawidth() {
// attempts to fix idiotic Nutscrape textarea width problems
global $HTTP_USER_AGENT;

if (eregi("MSIE",$HTTP_USER_AGENT)) { // browser is IE
return "{textareacols_IE}";

} elseif (eregi("Mozilla/5.0",$HTTP_USER_AGENT)) { // browser is NS 6
return "{textareacols_NS6}";

} elseif (eregi("Mozilla/4.",$HTTP_USER_AGENT)) { // browser is NS4
return "{textareacols_NS4}";

} else { // unknown browser - stick in a sensible value
return 60;

}

}


with this:


// ###################### Start gettextareawidth #######################
function gettextareawidth() {
// attempts to fix idiotic Nutscrape textarea width problems
global $HTTP_USER_AGENT;

if (eregi("MSIE",$HTTP_USER_AGENT) || (eregi("Mozilla/5",$HTTP_USER_AGENT) && !eregi("Netscape6/",$HTTP_USER_AGENT))) { // browser is IE
return "{textareacols_IE}";

} elseif (eregi("Netscape6/",$HTTP_USER_AGENT)) { // browser is NS 6
return "{textareacols_NS6}";

} elseif (eregi("Mozilla/4.",$HTTP_USER_AGENT)) { // browser is NS4
return "{textareacols_NS4}";


} else { // unknown browser - stick in a sensible value
return 60;

}

}

attroll
04-05-2003, 02:42 PM
Erwin

I did what you said above and I get the foolowing error:

Parse error: parse error, unexpected ',' in /home/attroll/public_html/forum/admin/functions.php on line 334

Fatal error: Call to undefined function: getuserinfo() in /home/attroll/public_html/forum/admin/sessions.php on line 366

Mr. X
04-05-2003, 07:49 PM
Hmm, Im getting the same thing.

Erwin
04-05-2003, 11:24 PM
When I cut and paste, I only left one / instead of the normal // for commenting out text. Sorry - try it again now. Btw, this is probably different to the code being used by the thread starter - this is code from vB.com developers (from memory).

attroll
04-05-2003, 11:40 PM
Nope I get this error now which is pretty much the same one I got before.

Parse error: parse error, unexpected ',' in /home/attroll/public_html/forum/admin/functions.php on line 335

Fatal error: Call to undefined function: getuserinfo() in /home/attroll/public_html/forum/admin/sessions.php on line 366

Erwin
04-05-2003, 11:44 PM
Okay, I've made the instructions very clear in case people were replacing only the commented out line (but surely not) - find that code and REPLACE the WHOLE SECTION.

It should work.

Boofo
04-06-2003, 01:29 AM
It won't work. You got way too many brackets with the eregi stuff now.

Erwin
04-06-2003, 01:35 AM
Uh... count the brackets carefully. :) It does work. Because it's the same code running on my forums for the past 6 months.

Boofo
04-06-2003, 01:39 AM
Then you muist have a magic site. ;)

One on the left and 2 on the right and it still works?

("Netscape6/",$HTTP_USER_AGENT))

Erwin
04-06-2003, 02:24 AM
Boofo... look at that line of code carefully. COUNT the number of brackets.

Don't confuse the OR bits with the AND bits... :) The Netscape is joined with the Mozilla variables...

If you can't count, I can't help you.

P.S - vB.org is definitely not magical, but it has this code installed... ;)

Erwin
04-06-2003, 02:27 AM
Let me break it down for you, since you obviously can't count, yet insist on trying to be smart.

if (eregi("MSIE",$HTTP_USER_AGENT)

this first part - opens a new bracket, the IE one is open and closed, 1 bracket still needs to be closed...

|| (eregi("Mozilla/5",$HTTP_USER_AGENT) &&

Opens another bracket, the Mozilla is open and closed, so we have 2 brackets to be closed now.

!eregi("Netscape6/",$HTTP_USER_AGENT))) {

The Netscape variables are open and closed, so then we close the 2 brackets.

See?

Next time, count, before trying to criticize code released by others.

Boofo
04-06-2003, 02:39 AM
Erwin, I was counting before you were even born. ;)

This is the line I was referring to.

} elseif ("Netscape6/",$HTTP_USER_AGENT)) { // browser is NS 6
return "40";


And I have looked over at vb.com for this fix and I didn't see it anywhere.

Edit: You're not even using eregi in your new code, by the way.

attroll
04-06-2003, 03:19 AM
Yes you must have a magic site because I have done this three time and still get the same error even after you changed your directions. Are you sure you did not change something somewhere else maybe? I don't think I am that bad I have installed mods before.

Boofo
04-06-2003, 03:29 AM
attroll, try this. I'm not very good at counting so it may not work. ;) Let me know.

// ###################### Start gettextareawidth #######################
function gettextareawidth() {
// attempts to fix idiotic Nutscrape textarea width problems
global $HTTP_USER_AGENT;

if ((eregi("MSIE",$HTTP_USER_AGENT) || (eregi("Mozilla/5",$HTTP_USER_AGENT) && !(eregi("Netscape6/",$HTTP_USER_AGENT))))) { // browser is IE
return "{textareacols_IE}";

} elseif (eregi("Netscape6/",$HTTP_USER_AGENT)) { // browser is NS 6
return "{textareacols_NS6}";

} elseif (eregi("Mozilla/4.",$HTTP_USER_AGENT)) { // browser is NS4
return "{textareacols_NS4}";

} else { // unknown browser - stick in a sensible value
return 60;

}

}

attroll
04-06-2003, 03:48 AM
Yup that did it with yours Boofo. I don't know if it actiually works with Mozilla though. I will have to wait until one of my users comes online to find out. But at least I am not getting any errors now.

THanks Boofo

Boofo
04-06-2003, 03:52 AM
No problem. Let me know when you get any Mozilla users if it works ok. ;)

attroll
04-06-2003, 07:25 AM
Wow when I view my web pages with IE 6 after getting this hack to work it makes it really hard to read. Should I or can I change this a little to get my IE to view better. Which one would I change teh 70 and if so what can I change it to?

Wow. I just noticed something. Every web site I visit with Internet Explorer has changed to a smaller pixel or something and when I go into my computer properties it is set right but something is wrong here. I thin I will change it back maybe. What has this mod done?

Boofo
04-06-2003, 07:30 AM
I am attaching the updated text file I made since vbulletin wants to parse everything.

It works great on my site. You must have changed something else along with it. Look at the file I have attached and make the necessary changes there.

attroll
04-06-2003, 03:30 PM
I got my problem fixed thanks to help from Boofo. It was not the hack that caused the problem. It was a case of staying up longer then I should have working on hacks. I was getting lame brained and did something without realizing I even did it.

Boofo
04-06-2003, 03:54 PM
You probably didn't touch anything to do it. It has happened to me before. I think there must be some sites that do that for whatever reason. Glad you got it working. ;)

Mr. X
04-06-2003, 09:49 PM
That code worked for me as well. I figured the missing / in Erwins post after mine was the prob, but I was getting the same parse errors, but all seems good now both in IE and Moz.

diettalk
12-22-2003, 02:35 AM
Looks like Firebird is having the same issue as Netscape.. :(