Stories
Slash Boxes
Comments
NOTE: use Perl; is on undef hiatus. You can read content, but you can't post it. More info will be forthcoming forthcomingly.

All the Perl that's Practical to Extract and Report

use Perl Log In

Log In

[ Create a new account ]

schwern (1528)

schwern
  (email not shown publicly)
http://schwern.net/
AOL IM: MichaelSchwern (Add Buddy, Send Message)
Jabber: schwern@gmail.com

Schwern can destroy CPAN at his whim.

Journal of schwern (1528)

Sunday April 10, 2005
03:55 AM

An include() for Javascript

[ #24105 ]

TorgoX is a genius. A maaaaaad genius who will soon DESTROY US ALL!!!! Meanwhile, he produces stuff like this.

What is it? Its an include() routine for JavaScript! It reduces the duplicated code in the HTML down to...

<script type="text/javascript"    src="js/bootstrap.js">   </script>
<script type="text/javascript"    src="js/the_real_code.js"></script>

the_real_code.js now has bootstrap() (or in my version, include()) available and can include other Javascript files right in its own code... JUST LIKE A REAL LANGUAGE! Golly!

The Fine Print: The following comments are owned by whoever posted them. We are not responsible for them in any way.
 Full
 Abbreviated
 Hidden
More | Login | Reply
Loading... please wait.
  • Since 1998 I've been using Javascript for exactly this, curtesy of DynAPI [sourceforge.net] (originally a Dan Steinman project [jalix.org]). You can do simple things such as:

    <script language="Javascript" src="../src/dynapi.js"></script>
    <script language="Javascript">
    DynAPI.setLibraryPath('../src/lib/');
    DynAPI.include('d ynapi.api.*');
    </script>

    To load all your dynapi.api.* library files. Or you can simply include a single file.

    PS: There is no space between 'd' and 'ynapi' in the above example. use.perl code h

    • PS: There is no space between 'd' and 'ynapi' in the above example. use.perl code has inserted it for some strange reason.

      One way in which people can abuse sites is by posting comments that contain ridiculously long strings of characters with no spaces in it them: web-browsers don't have anywhere to split the line, so the box they are in gets massively extended sideways, pushing out other columns, and generally messing up the page.

      Slash avoids this by inserting spaces into long 'words', with the unfort