• Javascript Include

    From Mindless Automaton@VERT/ELDRITCH to DOVE-Net.Sync_Programming on Tuesday, September 18, 2007 00:09:00
    Digital Man wrote:
    Re: Javascript Include with H
    By: Mindless Automaton to DOVE-Net.Programming_(Jav on Mon Sep 17
    2007 06:10 pm

    Is there any way to include a javascript from a javascript?

    In Synchronet, use load().

    I'm looking for something similar to Synchronet's js load function
    or like a C #include.

    I've been gogglin' but a lot of them tend to be embedded in html.

    So... are you asking about JavaScript for a web browser or something?
    That question should go in "Programming". This sub is for Synchronet-specific JS questions.


    Alrighty, I am asking about Javascript used for scripting like in
    Synchronet. So if you didn't have a spiffy load() function, is there
    anything else besides SOL?

    Thanks,

    Mindless Automaton
    ---
    þ Synchronet þ Eldritch Clockwork BBS - eldritch.darktech.org
  • From Digital Man@VERT to Mindless Automaton on Tuesday, September 18, 2007 00:19:08
    Re: Javascript Include
    By: Mindless Automaton to DOVE-Net.Sync_Programming on Tue Sep 18 2007 12:09 am

    Digital Man wrote:
    Re: Javascript Include with H
    By: Mindless Automaton to DOVE-Net.Programming_(Jav on Mon Sep 17
    2007 06:10 pm

    Is there any way to include a javascript from a javascript?

    In Synchronet, use load().

    I'm looking for something similar to Synchronet's js load function
    or like a C #include.

    I've been gogglin' but a lot of them tend to be embedded in html.

    So... are you asking about JavaScript for a web browser or something? That question should go in "Programming". This sub is for Synchronet-specific JS questions.


    Alrighty, I am asking about Javascript used for scripting like in Synchronet. So if you didn't have a spiffy load() function, is there anything else besides SOL?

    There's no facility in "core Javascript", no. In Synchronet, you have load().

    digital man (xbox-live: digitlman)

    Snapple "Real Fact" #51:
    There are 63,360 inches in a mile.
    Norco, CA WX: 62.2øF, 64% humidity, 0 mph SSE wind, 0.00 inches rain/24hrs

    ---
    þ Synchronet þ Vertrauen þ Home of Synchronet þ telnet://vert.synchro.net
  • From Tracker1@VERT/TRN to Mindless Automaton on Tuesday, September 18, 2007 11:55:00
    Mindless Automaton wrote:
    Is there any way to include a javascript from a javascript?

    If you are wanting to do this in a javascript file included from HTML, it is doable...

    you can insert via DOM... but this doesn't work in safari (as of 2.0) ...
    your best bet is to use document.write...

    document.write('<script type="text/javascript" src="..."></script>');

    note: for some browsers, if your output type is text/xhtml or similar, as opposed to html then including javascript via document.write won't work either....

    Usually I have a script that adds necessary css, and script tags into the page's <head> tag... this way it will add based on browser, and os specifics..

    site.css
    site.(win|non-win).css
    site.browser.css
    site.browser.maj.css
    site.browser.maj.minor.css

    pagename.css
    ...

    same for javascript.. this way I can do very fine grained css fixes, say for site.IE.6.css or site.IE.7.0.css etc... I can also change the font sizes in the site.non-win.css, since windows renders fonts larger than other OSes do (for some kind of funky reasons)... in any case, try the document.write to generate your script tag, as that should work best... it's how scriptaculous does it...

    --
    Michael J. Ryan - tracker1(at)theroughnecks(dot)net - www.theroughnecks.net icq: 4935386 - AIM/AOL: azTracker1 - Y!: azTracker1 - MSN/Win: (email)

    ... Ferengi Rule of Acquisition #45: profit has limits. Loss has none

    ---
    þ Synchronet þ theroughnecks.net - you know you want it
  • From Mindless Automaton@VERT/ELDRITCH to Tracker1 on Tuesday, September 18, 2007 21:15:00
    Tracker1 wrote:
    Mindless Automaton wrote:
    Is there any way to include a javascript from a javascript?

    If you are wanting to do this in a javascript file included from HTML, it is doable...

    Unfortunately, its not included from HTML or it'd be easy. :) Its a
    program that uses javascript for the scripting language like Synchronet
    does, but without the nifty load() function. :(

    -Mindless Automaton
    ---
    þ Synchronet þ Eldritch Clockwork BBS - eldritch.darktech.org
  • From Angus McLeod@VERT/ANJO to Mindless Automaton on Tuesday, September 18, 2007 22:27:00
    Re: Javascript Include
    By: Mindless Automaton to DOVE-Net.Sync_Programming on Tue Sep 18 2007 00:09:00

    Alrighty, I am asking about Javascript used for scripting like in Synchronet. So if you didn't have a spiffy load() function, is there anything else besides SOL?

    Open the disk file, read the contents into a variable, and eval() the variable.



    ---
    Playing: "Amen" by "Jewel" from the "Pieces Of You" album.
    þ Synchronet þ Programatically generated on The ANJO BBS
  • From Tracker1@VERT/TRN to Mindless Automaton on Wednesday, September 19, 2007 12:21:00
    Mindless Automaton wrote:
    Unfortunately, its not included from HTML or it'd be easy. :) Its a
    program that uses javascript for the scripting language like Synchronet does, but without the nifty load() function. :(

    Do you have filesystem access? if so, you can read in the file, then eval() on it... note: sometimes the scope of an eval statement can get weird, so write all your encludes so they are encapsulated, and only do the load/eval from the root of your main script..

    --
    Michael J. Ryan - tracker1(at)theroughnecks(dot)net - www.theroughnecks.net icq: 4935386 - AIM/AOL: azTracker1 - Y!: azTracker1 - MSN/Win: (email)

    ... Jack Bauer can get McDonald's breakfast after 10:30.

    ---
    þ Synchronet þ theroughnecks.net - you know you want it