JavaScript File Includes
Please be advised that pages that load our standard Javascript files individually should be converted to using FileIncluderJS.aspx (present since v4.4).
This has two benefits:
- for the customer; this means that you will be able to make use of the concatenated and compressed files that FileIncluderJS.aspx loads, thus improving your page load times
- for Astun; it means that we can change the code around and alter the way it is loaded without having to ask you to change your pages.
Â
The only two script elements needed to include our JS should be:
Syntax
<script type="text/javascript" src="js/lib/prototype-1.6.0.3.js"></script> <script type="text/javascript" src="FileIncluderJS.aspx"></script>
Â
To then load the appropriate scripts for a page use something like:
Syntax
<script type="text/javascript"> Event.observe(window, 'load', function() { Astun.JS.IncludeJS(NAME, CALLBACKFUNCTION); }); </script>
Logger Example
<script type="text/javascript"> Event.observe( window, 'load', function(){ Astun.JS.IncludeJS('logger',pageLoad); });
Â
Where CALLBACKFUNCTION is the name of a function to call once the scripts have finished loading and NAME is a string must be one of the following:
"logger" - Logger
"gis" - iShare GIS pages v5.0+
"intranet" - iShare GIS pages pre-v5.0
"isharemaps.simple" - My House/My Nearest pages
"isharemaps.mymaps" - My Maps pages