Discussion for Invasion of the Body Switchers

Before you ask specific technical questions, please read or search through the existing comments, and any available documentation, to see if your question has already been answered.

You can also subscribe to this discussion (RSS 2.0)

  1. # RE: Invasion of the Body Switchers

    Posted by Cecil Ward on 2006-03-03 at 17:07:28 (GMT)

    A suggestion.

    Software is often made more localisation-friendly by keeping human-language text strings well separated from the core software. When IOTBS is used with a multilingual website, it would be better to take all the English-language text right out of the .js files. This includes the text used to create the controls, the alternate stylesheet titles (which are human-readable), and so on.

    Of course one way to do this would be to simply partition the javascript files, and move this text out into a number of separate alternative .js files, but this would be messy and would degrade performance because of the additional http requests.

    A better way, and one compatible with the spirit of the "integration" IOTBs variant, might be for the js to optionally read the human readable text from some elements in the HTML of the particular page. In fact, reading the text of alternate stylesheet titles from the js would be a very good thing, getting rid of the redundancy of defining this in the .js too.

    What do you think?

    Cecil Ward.

  2. # RE: Invasion of the Body Switchers

    Posted by brothercake on 2006-03-03 at 19:22:02 (GMT)

    Yeah I agree, you're quite right. What I've done with other scripts (like Docking Boxes) is to define language as part of the object constructors, passing a sentence like "Select stylesheet %name" where the %name token is replaced by its actual value, and then the appropriate grammar can be acheived by moving the token around with the defined sentence.

    I'll look into it, and if it proves feasible (which I think it probably will) look at an update to add this functionality.

    Thanks for the tip  (thumbs-up)

  3. # RE: Invasion of the Body Switchers

    Posted by Rachel on 2006-03-04 at 20:55:12 (GMT)

    Hi, i am getting this error on all of my pages...

    Line: 175
    Char: 2
    Error: 'document.getElementById(...)' is null or not an object
    Code: 0

    Line 175 points to the following code, what could be wrong with it do you think? (its the original, ive not edited anything)

        //outer form
        this.attrs = { 'action' : '' };
        this.form = this.createElement('form', this.attrs);
        document.getElementById(divid).appendChild(this.form);

    Thanks in advance for helping!

    xxx

  4. # RE: Invasion of the Body Switchers

    Posted by anon on 2006-03-05 at 11:53:58 (GMT)

    i am getting this error on all of my pages...

    Okay, well it's looking for the container element defined by the first argument in the new bodySwitcher constructor:

    new bodySwitcher('screen-switcher', 'Screen styles', 'no', '');

    In that example, it would a div or other element with the ID "screen-switcher". So does the element defined in your case actually exist?

  5. # RE: Invasion of the Body Switchers

    Posted by Rachel on 2006-03-05 at 22:48:18 (GMT)

    Thanks for the reply!

    Yes, i am using (once)...

    <td id="screen-switcher"></td>

    The error appears here (the switcher is on all pages)...

    oaserv.co.uk

    Ive double checked the code and it all appears fine.

  6. # RE: Invasion of the Body Switchers

    Posted by brothercake on 2006-03-06 at 14:21:59 (GMT)

    Yeah that's there, but the second call to "print-switcher" is not there, and that's where the error's coming from.

    Do you have a print switcher? If you're just using a single switcher you can just take it out.

  7. # RE: Invasion of the Body Switchers

    Posted by Rachel on 2006-03-07 at 01:51:38 (GMT)

    That worked, thanks  (smile)

  8. # RE: Invasion of the Body Switchers

    Posted by jon on 2006-03-08 at 12:44:27 (GMT)

    Hi
    I'd just like to say, what a cool script.

    But (there's always a but) I'm having problems in opera 8.53 (the only opera version I've tested)
    I first noticed when using print options the background of whatever current screen option is being inherited, !important doesn't help. I thought this might be my coding but when i tested your examples on this site the same thing is happening, and sometimes it doesn't load/display the switching options at all.
    It completely crashed on my site so no switching options where available.

    Thanks for any help
    Jon

  9. # RE: Invasion of the Body Switchers

    Posted by brothercake on 2006-03-17 at 21:46:26 (GMT)

    I've never seen that happening - do you have a demo online that you can show us, that illustrates this problem as it happens?

  10. # RE: Invasion of the Body Switchers

    Posted by jon on 2006-03-20 at 10:21:12 (GMT)

    Developing offline at the moment, but it still happens on this site, I just checked all interfaces & modes (high vis) with op8.53 (newly downloaded). It's printing a black page.
    Running on xp pro service pack2 if it helps.

    Thought it might be Nortons pop up blocker interfering but it looks fine onscreen & still having the same probs offline.

    Thanks
    Jon

  11. # RE: Subdomain cookies

    Posted by Gemma on 2006-05-04 at 19:12:44 (GMT)

    I would like this to work accross subdomains, is this even possible?

    Currently the cookie stores as www.mysite.com, id like it to store as just mysite.com

    Any geniuses around to get that working?!?!

    Thanks for any help with this!

    XXX

  12. # RE: Invasion of the Body Switchers

    Posted by brothercake on 2006-05-08 at 17:29:37 (GMT)

    As far as I know that's not possible. A cookie is only valid within a single domain, and a sub-domain is a different domain in those terms, so unless you manually send that information from one domain to another, you would not be able to access it.

  13. # RE: Invasion of the Body Switchers

    Posted by Gemma on 2006-05-09 at 17:51:45 (GMT)

    Hi, thanks for the reply!

    Not great news  (sad)

    Do you have any idea how i could manually send the information accross two sub-domains, perhaps use php to check for an existing cookie and then set another?

    If so, do you have an example of what it might take to work.

    Thanks once again for the reply, really appreciate your help!

    xxx

  14. # RE: Invasion of the Body Switchers

    Posted by brothercake on 2006-05-12 at 08:38:44 (GMT)

    Well even when it comes to PHP, or AJAX, you still have domain-specific security restrictions in place that prevent the manipulation of data across domains.

    What you could look at is JSON, which does allow cross-domain scripting I believe via some detail of its implementation (that's as much as I know - info at http://www.json.org/js.html)

    But it's not simple by any means! I would suggest you might be better off re-assesing your original situation - if you want to unify accesses through http://www.domain.com/ and http://domain.com it would be easier just to setup a redirection on the server (or maybe use mod_rewrite) to silently redirect both addresses to one - whichever you prefer.

  15. # RE: Invasion of the Body Switchers

    Posted by Maurizio on 2006-06-16 at 23:17:12 (GMT)

    I have a problem using directors cut in standard mode. If I put the default option by second (and not by first, as in the examples), everything is working fine until I reload the page. At that point the selected attribute is messed up. Just try to have, say, 3 opts: big text, normal text, small text (in that order) and default = normal text.

    Then use the options and reload the page when selected is big or small, and tell me if it is correct. Thank you!

  16. # RE: Invasion of the Body Switchers

    Posted by Alex on 2006-06-27 at 14:51:16 (GMT)

    Hi
    Hope someone can help - the code works fine in all guises until I try adding more linked html pages in sub folders which reference the scripts and css like this, eg:

    <style type="text/css" media="screen, projection">@import url(../etc.css);</style>
    <script type="text/javascript" src="../iotbs2-key-directors-load.js"></script>
    <script type="text/javascript" src="../iotbs2-directors.js"></script>
    <script type="text/javascript" src="../iotbs2-core.js"></script>
    <link rel="stylesheet" type="text/css" id="screen-switcher-stylesheet" href="../stylesheets/screen-switcher-default.css" media="screen" />

    etc etc.

    If I try the switcher on any of these pages I get a Javascript error 'The system cannot locate the resource specified'.
    Do I need to change something in the scripts themselves?
    Cheers, thanks in anticipation!

  17. # RE: Invasion of the Body Switchers

    Posted by brothercake on 2006-07-11 at 15:34:11 (GMT)

    @Alex Which browser is the problem in? Do you have a demo online?

  18. # RE: Invasion of the Body Switchers

    Posted by Alex on 2006-07-24 at 15:01:09 (GMT)

    Hi
    Thanks for the reply. I've sorted it now; I wasn't changing the "var switcher = new switchManager('body', 'stylesheets/');" line to change the path. Works fine now.
    Cheers

  19. # RE: Invasion of the Body Switchers

    Posted by Maurizio on 2006-08-04 at 00:27:53 (GMT)

    No hints for my problem? Maybe I was unable to speak myself.

    The problem is that the default css MUST be the first to work properly. This is a limitation.

    There is any way to put the default css as the second or the third in the list? (I used the director's cut and standard mode)

    Bye

  20. # RE: Invasion of the Body Switchers

    Posted by brothercake on 2006-08-16 at 19:27:04 (GMT)

    @Maurizo Oh I see what you mean, well yes at the moment that is a limitation; I had a go at a quick hack to fix that, but it's not gonna be that simple unfortunately!

    I'll look into that again, and schedule it for the next version update.

This discussion is now closed

Discussions are usually kept open until they start getting spammed, which in practice seems to be about 2-3 weeks  (eek!)

Get the script

The latest version is 2.1 and recommended for most users:

The previous branch is at 1.3 and available for compatibility with earlier versions:

BSD License → Terms of use

IOTBS Manual

Categories...

Website gadgets

Bits of site functionality:

Usability widgets

For enhancing usability:

Local network apps

Web-applications for your home or office network:

Game and novelties

Our internal search engine is currently offline, undergoing some configuration changes in preparation for a major site overhaul. In the meantime, you can still search this site using Google Custom Search.


In this area

Main areas


[brothercake] a round peg in a square hole, that still fits