Help - Search - Members - Calendar
Full Version: Full Mozilla support for IPB
Hydrogenaudio Forums > Hydrogenaudio Forum > Site Related Discussion
Sebastian Mares
Hello Dibrom, JohnV or any IPB admin,

At this point, only IE users are able to mark text and apply formatting when creating or editing a post. If you would like to implement Mozilla support, too, replace the "doInsert" function of "/html/ibfcode.js" with this one (make a backup in case you screw it):

CODE

function doInsert(ibTag, ibClsTag, isSingle)
{
var isClose = false;
var obj_ta = document.REPLIER.Post;

if ( (myVersion >= 4) && is_ie && is_win) // Ensure it works for IE4up / Win only
{
 if(obj_ta.isTextEdit){ // this doesn't work for NS, but it works for IE 4+ and compatible browsers
  obj_ta.focus();
  var sel = document.selection;
  var rng = sel.createRange();
  rng.colapse;
  if((sel.type == "Text" || sel.type == "None") && rng != null){
   if(ibClsTag != "" && rng.text.length > 0)
    ibTag += rng.text + ibClsTag;
   else if(isSingle)
    isClose = true;

   rng.text = ibTag;
  }
 }
 else{
  if(isSingle)
   isClose = true;

  obj_ta.value += ibTag;
 }
}
else if ( obj_ta.selectionEnd )
{
 var ss = obj_ta.selectionStart;
 
 var es = obj_ta.selectionEnd;
 
 if (es <= 2)
 {
  es = obj_ta.textLength;
 }
 
 var start  = (obj_ta.value).substring(0, ss);
 var middle = (obj_ta.value).substring(ss, es);
 var end    = (obj_ta.value).substring(es, obj_ta.textLength);
 
 //-----------------------------------
 // text range?
 //-----------------------------------
 
 if (obj_ta.selectionEnd - obj_ta.selectionStart > 0)
 {
  middle = ibTag + middle + ibClsTag;
 }
 else
 {
  middle = ibTag + middle;
 
  if (isSingle)
  {
   isClose = true;
  }
 }
 
 obj_ta.value = start + middle + end;
}
else
{
 if(isSingle)
  isClose = true;

 obj_ta.value += ibTag;
}

obj_ta.focus();


return isClose;
}


Regards,
Sebastian Mares

PS: Credits for the above function go to Matt Mecham.
music_man_mpc
I am using Mozilla Firebird

edit: but your right the buttons don't work the way they are supposed to, I had to do that manually.
Sebastian Mares
I hope the moderators won't delete this topic, as it is useful to other people who are running IPB on their website.
Also, it would be cool if JohnV or Dibrom could implement this modification.
Mindstorm
Very cool indeed... Mozilla is becoming more and more widespread (ok, nothing compared to IE, but still something) and I believe it should be full supported. At leat I would be pleased smile.gif

edit: plus, it's a great browser smile.gif
Xenno
I hope they do implement your code. I'm using FireBird exclusively these days, and composing posts is where IE has it all over FB. Whenever you click outside the compose window (say on a formatting button), it ALWAYS moves the caret to the end of the post and puts the format tags there. Very irritating. Is the code used here (and elsewhere) non-standard...or is javascript (if thats what it is) not implemented completely in FireBird? Inquiring minds want to know.

xen-uno
Sebastian Mares
AFAIK, Mozilla uses a different technique for getting / setting the cursor than Internet Explorer. IPB versions prior to 2.0 do not contain code for handling the different browsers. I asked Matt (the developer of IPB) in a private message to tell me which changes he has done and gave me that code. I have changed some variables (as the code he gave me was from IPB 2.0) and patched the JS file of my forums - everything worked perfectly.

One more thing... I have tested this with IPB 1.3. I don't know if IPB 1.2 will work with the new JS, but I do think so. There aren't much changes from 1.2 to 1.3.

Opera users won't notice any changes, AFAIK, because Opera's JavaScript support is a bit crappy. However, I hope that they will improve the JS engine for the next version. Chances are good. biggrin.gif
Sebastian Mares
So, any chance the above change will find its way to the Hydrogenaudio JavaScript file? smile.gif
Daijoubu
I wonder if this works with Opera ohmy.gif
Sebastian Mares
QUOTE(Daijoubu @ Dec 21 2003, 08:33 PM)
I wonder if this works with Opera ohmy.gif

Nope, because Opera does not provide any JavaScript functions for obtaining the mouse position or the selected text length. sad.gif
Xenno
It would sure be nice to get a "Sounds good, we'll look into it" or "Get bent, we'll never implement it" from the HA Staff regarding this issue.

xen-uno
Sebastian Mares
QUOTE(Xenno @ Dec 22 2003, 05:02 PM)
It would sure be nice to get a "Sounds good, we'll look into it" or "Get bent, we'll never implement it" from the HA Staff regarding this issue.

xen-uno

Well, this is what Peter said (IRC):

QUOTE
<SebastianMares> By the way... Would be cool if Juha or Darin could modify the JavaScript file so Mozilla users (like me tongue.gif) could format text easily. biggrin.gif
<DEATH> people who use formatting in every post they write should be shot
<DEATH> people who dont probably dont care
<SebastianMares> Well, it's not only formatting, but quoting and code, too.
<SebastianMares> Anyway...
<DEATH> people who have a problem with typing [ quote ] [ /quote ] probably have bigger problems somewhere else
<SebastianMares> dry.gif
<DEATH> i get the feeling that our forum would be prettier if that feature didn't exist


So, looking at that conversation, I get a feeling that this "bug fix" will never find its way into HA. sad.gif

Regards,
Sebastian Mares
detokaal
Mozilla here, too. It is a pain. Wonder if their host keeps track of % of visits by browser type to see if it would be worth the time and hassle. I would assume that many who post on these types of techno-babble forums are open source OS users or Microsoft haters. Or maybe, like me, just think IE and Active Hex and other securty issues make it a disease best avoided while surfing... and posting.
Xenno
"<DEATH> people who use formatting in every post they write should be shot"

Sounds like something he would write. I'll give him this...he is consistent.

xen-uno
Sebastian Mares
But he is right! People who use formatting with every post should be shot. laugh.gif
Dibrom
Ok. My answer: I'm busy with finals and other stuff at the moment which is much higher priority than this (and I'll probably continue to be very busy for some time).

Second, I tend to agree with Peter's last point at least in part. I've been using Mozilla for years now and have never found the lack "support" in the dynamic formatting stuff to be a serious setback.

If JohnV wants to implement this, he's welcome, but I doubt it's a very high priority on his list either unfortunately.
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2008 Invision Power Services, Inc.