Besttoolbars Development network

Back to Besttoolbars main site

 

 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 
A bunch of Mozilla/FF incompatibilities (with workarounds)

 
Post new topic   Reply to topic    BestToolbars.Net Forum Index -> Mozilla/Firefox conversion
Author Message
flexo



Joined: 15 Jan 2008
Posts: 2

PostPosted: Thu Jan 17, 2008 9:54 pm    Post subject: A bunch of Mozilla/FF incompatibilities (with workarounds) Reply with quote

I thought I'd list a few things tb.js doesn't properly wrap for Mozilla / FF, so Softomate can either fix it or other users know how to work around the shortcomings:

In MSIE you can change the image of a button using:

tool.SetPropertyById("foo", "img", "23");

This currently doesn't work in Firefox. Instead you can do:

tool.SetPropertyById("foo", "image", "chrome://toolbar/content/23.png");

Note that the first command in Firefox is silently ignored (so to be upwards compatible I suggest you just issue both). Fixing this should be easy for Softomate.

Second, tool.Var(1) = 23; doesn't work in Firefox - Instead you have to do tool.Var[42] = 23;

Note that the first command throws an Exception so to be portable you should do something like

try { tool.Var(1) = 23; } catch(e) { tool.Var[42] = 23; }

As for Softomate - also easy to fix, the Mozilla JavaScript engine supports getters / setters using the methods __defineSetter__ / __defineGetter__. Just make Var a method returning an object with a getter & setter function.

Third, context menus don't work in Mozilla. No easy fix here as the XML format differs too much (I'm no XSLT wiz). A workaround is to add your own <menuitem> to tb.xul after converting your toolbar - I wrote a bunch of batch scripts + a ruby script which extract the jar, modify the XUL & JS file and compress it again.

Just add this in the <popup>

<menuitem id="some_id" label="The Label"
oncommand="some_function(gContextMenu);"/>

And to tb.js you add:

function some_function(contmenu)
{
try {
var term = "";
try {
term = contmenu.searchSelected();
} catch(k) {
term = getBrowserSelection();
}
// do something with "term" now...
} catch(e) { }
}

Fourth "BeforeNavigate" scripts don't seem to work in FF. I hacked around this by adding this to tb.js:

var old_fn = toolbar_refresh_banner;

toolbar_refresh_banner = function(str) {
old_fn(str);
if(str == "BeforeNavigate") {
// Your code...
}
}

Okay. This got ugly enough for now. HTH & Cheers

Felix
Back to top
Display posts from previous:   
Post new topic   Reply to topic    BestToolbars.Net Forum Index -> Mozilla/Firefox conversion All times are GMT
Page 1 of 1

 


Powered by phpBB © 2001, 2005 phpBB Group

Copyright c Softomate, 2010. All Rights Reserved
Terms of Service | Privacy Policy