Simple Machines Community Forum

SMF Support => SMF 2.0.x Support => Topic started by: LLStarks on September 09, 2008, 03:17:50 PM

Title: (Beta 4 Charter/Public) Firefox 3.1 and the WYSIWYG editor
Post by: LLStarks on September 09, 2008, 03:17:50 PM
Is there a file I can edit that will allow useragent sniffing of 3.1 so that the rich text stuff works?
Title: Re: (Beta 4 Charter/Public) Firefox 3.1 and the WYSIWYG editor
Post by: Enc0der on September 09, 2008, 05:50:53 PM
Firefox 3.1 uses a whole new javascript engine, this is why it's not working.
"faking" the browser version will do nothing.
Title: Re: (Beta 4 Charter/Public) Firefox 3.1 and the WYSIWYG editor
Post by: LLStarks on September 09, 2008, 10:04:53 PM
Firefox 3.1 uses a whole new javascript engine, this is why it's not working.
"faking" the browser version will do nothing.
Perhaps. But I found a solution.

Quite simple :)

Sources/Load.php

Find
Code: (Lines 1353-1355) [Select]
'is_firefox' => strpos($_SERVER['HTTP_USER_AGENT'], 'Firefox') !== false,
'is_firefox1' => strpos($_SERVER['HTTP_USER_AGENT'], 'Firefox/1.') !== false,
'is_firefox2' => strpos($_SERVER['HTTP_USER_AGENT'], 'Firefox/2.') !== false,

Replace
Code: [Select]
'is_firefox' => strpos($_SERVER['HTTP_USER_AGENT'], 'Firefox') !== false || strpos($_SERVER['HTTP_USER_AGENT'], 'Minefield') !== false,
'is_firefox1' => strpos($_SERVER['HTTP_USER_AGENT'], 'Firefox/1.') !== false,
'is_firefox2' => strpos($_SERVER['HTTP_USER_AGENT'], 'Firefox/2.') !== false,
'is_firefox3' => strpos($_SERVER['HTTP_USER_AGENT'], 'Minefield') !== false,

Themes/default/scripts/script.js

Find
Code: [Select]
var is_ff = ua.indexOf("firefox") != -1;
Replace
Code: [Select]
var is_ff = (ua.indexOf("firefox") != -1) || (ua.indexOf("minefield") != -1);
The last change is the only one that's really needed, but it's best to make SMF think that Minefield is Firefox in other places too just in case :)

Works.
Title: Re: (Beta 4 Charter/Public) Firefox 3.1 and the WYSIWYG editor
Post by: Enc0der on September 10, 2008, 02:12:38 AM
oh, so SMF simply doesn't even try to load the JS if it doesn't recognize the browser? weird.. why? ::)
Sorry, my bad. I believed the JS was loading but making errors because of the new (and not-yet-finished) engine..
Title: Re: (Beta 4 Charter/Public) Firefox 3.1 and the WYSIWYG editor
Post by: Fustrate on September 10, 2008, 02:20:35 AM
Code: [Select]
'is_firefox3' => strpos($_SERVER['HTTP_USER_AGENT'], 'Minefield') !== false,

I'm guessing over time it'll change to
Code: [Select]
'is_firefox3' => strpos($_SERVER['HTTP_USER_AGENT'], 'Firefox/3.') !== false,?? So for right now, as long as it's not a public release (and therefore still using minefield) it should be
Code: [Select]
'is_firefox3' => strpos($_SERVER['HTTP_USER_AGENT'], 'Firefox/3.') !== false || strpos($_SERVER['HTTP_USER_AGENT'], 'Minefield') !== false,
Title: Re: (Beta 4 Charter/Public) Firefox 3.1 and the WYSIWYG editor
Post by: LLStarks on September 10, 2008, 03:21:28 PM
That's ridiculous. If IE8 and Opera betas work with the WYSIWYG editor, Firefox 3.1 betas should as well.
Title: Re: (Beta 4 Charter/Public) Firefox 3.1 and the WYSIWYG editor
Post by: Fustrate on September 10, 2008, 05:26:50 PM
It's not SMF's fault - FF3.1 identifies itself as minefield, not firefox.