<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html; charset=ISO-8859-1"
http-equiv="Content-Type">
</head>
<body bgcolor="#ffffff" text="#000000">
Le 2010-03-29 16:00, James McGrath a écrit :
<blockquote cite="mid:004901cacf7a$8a1a4e60$9e4eeb20$@ca" type="cite">
<meta http-equiv="Content-Type"
content="text/html; charset=ISO-8859-1">
<meta name="Generator" content="Microsoft Word 12 (filtered medium)">
<style>
<!--
/* Font Definitions */
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
        {font-family:Georgia;
        panose-1:2 4 5 2 5 4 5 2 3 3;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0cm;
        margin-bottom:.0001pt;
        font-size:11.0pt;
        font-family:"Calibri","sans-serif";}
a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:blue;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {mso-style-priority:99;
        color:purple;
        text-decoration:underline;}
span.EmailStyle17
        {mso-style-type:personal-compose;
        font-family:"Calibri","sans-serif";
        color:windowtext;}
.MsoChpDefault
        {mso-style-type:export-only;}
@page Section1
        {size:612.0pt 792.0pt;
        margin:72.0pt 90.0pt 72.0pt 90.0pt;}
div.Section1
        {page:Section1;}
-->
</style>
<!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]-->
<div class="Section1">
<p class="MsoNormal">Hi list,<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">I just got an idea that I’m just throwing like
that
that could help reduce the quantity of JS loaded on startup of
geoprisma. Some
widgets are loaded in stand-by to be used (And probably won’t be used
in
a typical session), we could change heavy widgets so it loads only when
first
called by including the JS dynamically using this :<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">---------------------------------<o:p></o:p></p>
<p class="MsoNormal">var script = document.createElement('script');<o:p></o:p></p>
<p class="MsoNormal">script.src = "widget/foobar/dynaJS.js";<o:p></o:p></p>
<p class="MsoNormal">script.type = 'text/javascript';<o:p></o:p></p>
<p class="MsoNormal">script.defer = true;<o:p></o:p></p>
<p class="MsoNormal">var head =
document.getElementsByTagName('head').item(0);<o:p></o:p></p>
<p class="MsoNormal">head.appendChild(script);<o:p></o:p></p>
<p class="MsoNormal">---------------------------------<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">I’m using this sort of dynamic script inclusion
for
another project and so far it works with every browser we used. I
think it
could help a little for a js hungry implementation.</p>
</div>
</blockquote>
Hi James,<br>
<br>
Do you have any comparison as to the time it helps save ? I think most
of the juice comes from the minified OL-MF-GeoEXT JS file but that's
only in one file and when used in conjunction with mod_deflate it boils
down to just under 200 KB. Each GP widget includes a separate JS file
so maybe just minifying those together in one file for all GP widgets
would help both save bandwidth and we wouldn't have to fiddle with
conditional JS inclusion. All in all, we'd have 1 JS download for
OL-MF-GeoEXT and another for GP.<br>
<br>
What do others think ?<br>
<br>
Yves<br>
<br>
</body>
</html>