I've been playing with Floatbox 3.10 for a network information lookup tool (ie. click an IP address, and it does a host lookup, geo and whois on it). For this, I'm basically just putting content into an iframe inside a floatbox. It works very nicely indeed.
For various reasons (I'm using it in a Drupal module), my floatbox installation is way down the directory tree. However, on each page load, I see "/floatbox/languages/en.json" in my Apache error logs (as that doesn't exist).
I've poked about in the floatbox.js code, and can easily change the urlLanguages config variable to fix this - which works nicely, although means I have to edit source.
I also tried setting "fb.urlLanguages" in a setFloatboxOptions() function - this doesn't seem to work. I can change options like the theme in this way, so I know the raw mechanism works correctly, but it doesn't seem to alter the urlLanguages option.
Finally, I notice that the images in the Floatbox work fine, even though I haven't made any change to the urlGraphics option - it seems that Floatbox just works it out correctly (even though the default value is totally wrong).
So in short: urlLanguages doesn't seem to be configurable, urlGraphics doesn't seem to be necessary as Floatbox seems to work things out all by itself.
Just to show what's going on:
/node/1234 - the source page (with an FB link on it)
/_inetinfo/1.2.3.4/ajax - the page I put in a Floatbox iframe
/sites/all/modules/inetinfo/floatbox - the location of the Floatbox files
So is it possible to configure the urlLanguages config option? Better still, can we make it so that it's not necessary to configure it (like urlGraphics)?
Installation: Moving the install directory
Page: 1
Author | Post |
---|---|
coofercat
|
#1 Mon Sep 08, 2008 9:40 pm
|
Guest | |
#2 Mon Sep 08, 2008 10:03 pm
|
|
Administrator
Registered: Aug 2008
Posts: 3382
|
I understand how this can look a little confusing. Here's the poop...
First, it's intended that folks modify the source to set their default preferences in the top section of floatbox. I suppose I could consider a separate config file, but this would complicate the install instructions. The five settings down in the "configuration settings" section can be set only in that code section. They can't be picked up from the other sources of floatbox options. This is because they are used in the initialization of floatbox when the page first loads. Other option sources, like setFloatboxOptions() and the rev attribute, are parsed when floatbox is launched by a user click. If you install in a different location, you must edit urlLanguages and urlGraphics in the js file. urlGraphics does not help floatbox find the graphics used in the navigation controls. Those paths are set in floatbox.css. urlGraphics is used only so that the code can find the loading gifs to display if the source content is being slow to load, and to find the custom cursors that are used when resizing of images is available. So if urlGraphics is wrong, floatbox will still look fine but will just show a blank window on slow loads and will have just the arrow cursor rather than the magnifying glass for image resizing. |
netslider
|
#3 Tue Sep 09, 2008 1:07 pm
|
Guest |
I could take a look at it for you.. not promising I'll solve your issue but I'll certainly try. I need to know what the url is so that I may see what you are talking about.
|
coofercat
|
#4 Tue Sep 09, 2008 1:42 pm
|
Guest |
Thanks for the offer - my code is only on a dev machine at the moment, so unfortunately not easily available on the Internet.
The Drupal module knows the URL it's at, so it's possible for me to feed that into the HTML page. I was hoping to use the setFloatboxOptions() function, but I've actually solved the problem with a (*ahem*) global variable. Here's an HTML snippet: <script type="text/javascript" src="/sites/all/modules/inetinfo/floatbox/floatbox.js"></script> <script type="text/javascript">var FBUrl='/sites/all/modules/inetinfo';</script> ...and inside floatbox.js: urlGraphics: FBUrl + '/floatbox/graphics/' ,// change this if you install in another folder urlLanguages: FBUrl + '/floatbox/languages/' };// change this if you install in another folder ...This still means I have to edit the source (modestly), but it means that it doesn't matter where Drupal or my module is installed - the JS will always know where it is, and so the requests for en.json will work properly. I appreciate this isn't much use for Floatbox users in general. As I see it, the only 'generic' way this could be solved would be to allow urlGraphics and urlLanguages to be configurable in setFloatboxOptions() (or another config setting function) or else another cheesy global variable. Since Flaotbox only initialises on window.onload, I guess something is possible, if it makes sense to do it. Thanks for your help! ...Ralph PS. I know I'm not using much of Floatbox, but I still can't find any images that don't load correctly, even with slow content and an incorrect urlGraphics config. Anyway, I'm setting it correctly now, so I guess it doesn't much matter. |
#5 Wed Sep 10, 2008 2:23 pm
|
|
Administrator
Registered: Aug 2008
Posts: 3382
|
What I don't understand is the reluctance to edit the option preferences in the top section of the floatbox.js code. That's what the section is there for, that's why it's at the top, and that's why it's laid out the way it is and heavily commented. The downside is you have to re-edit your default preferences when upgrading versions, but that takes only a minute.
|
coofercat
|
#6 Wed Sep 10, 2008 2:54 pm
|
Guest |
Sorry... the only reason was that I was putting Floatbox into another product (in my case, it's a Drupal module) so I can't be sure where anyone else would install it. To overcome this, I'd have to come up with some way to rewrite the JS or some such, which is obviously nasty.
However, doing it as I have means (a) minimal changes on upgrade (which I'd perform as the module maintainer) and (b) works in all possible installation circumstances (although I realise that's not much use for Floatbox users in general). PS. The Drupal module has just been uploaded here: http://www.pre-emptive.net/doco/drupal-6-internet-information-module (just in case you fancy playing with a slightly obscure Drupal module ;-) |
gregp
|
#7 Wed Oct 01, 2008 2:32 am
|
Guest |
Having beaten my head against a brick wall trying to get Lytebox into Drupal, I was getting pretty excited having found Floatbox AND a Drupal module! But it looks like it's actually something quite different
![]() ![]() |
Page: 1