codesite-noreply at google.com
2009-Nov-14 19:33 UTC
[Mapstraction] [mapstraction] r56 committed - #27 status:fixed Moved script laoding to top of mxn script and changed...
Revision: 56 Author: robert.moran Date: Sat Nov 14 11:32:58 2009 Log: #27 status:fixed Moved script laoding to top of mxn script and changed it to use document.write. Tested on chrome, firefox and IE http://code.google.com/p/mapstraction/source/detail?r=56 Deleted: /trunk/tests/domReady.js Modified: /trunk/source/mxn.js /trunk/tests/index.htm ======================================--- /trunk/tests/domReady.js Mon Jun 1 15:33:00 2009 +++ /dev/null @@ -1,25 +0,0 @@ -// DomReady event - Thom Shannon, http://ts0.com -// Public Domain - -var WhenDomReady = function(callBack,scope){ - var scope = scope || window; - var args = []; - for (var i=2, len = arguments.length; i < len; ++i) { - args.push(arguments[i]); - }; - if (document.addEventListener) { - document.addEventListener("DOMContentLoaded", function(){ - callBack.apply(scope, args); - }, false); - } - else if (document.attachEvent) - { - var done = false; - document.attachEvent("onreadystatechange",function(){ - if ( !done && document.readyState === "complete" ) { - done = true; - callBack.apply(scope, args); - } - }); - } -} ======================================--- /trunk/source/mxn.js Thu Sep 3 05:06:14 2009 +++ /trunk/source/mxn.js Sat Nov 14 11:32:58 2009 @@ -1,3 +1,46 @@ +// Auto-load scripts +// +// specify which map providers to load by using +// <script src="mxn.js?(provider1,provider2,[module1,module2])" ... +// in your HTML +// +// for each provider mxn.provider.module.js and mxn.module.js will be loaded +// module ''core'' is always loaded +// +// NOTE: if you call without providers +// <script src="mxn.js" ... +// no scripts will be loaded at all and it is then up to you to load the scripts independently +(function() { + var providers = null; + var modules = ''core''; + var scriptBase; + var scripts = document.getElementsByTagName(''script''); + + // Determine which scripts we need to load + for (var i = 0; i < scripts.length; i++) { + var match = scripts[i].src.replace(/%20/g , '''').match(/^(.*?)mxn\.js(\?\(\[?(.*?)\]?\))?$/); + if (match != null) { + scriptBase = match[1]; + if (match[3]) { + var settings = match[3].split('',[''); + providers = settings[0].replace('']'' , ''''); + if (settings[1]) modules += '','' + settings[1]; + } + break; + } + } + + if (providers == null || providers == ''none'') return; // Bail out if no auto-load has been found + providers = providers.replace(/ /g, '''').split('',''); + modules = modules.replace(/ /g, '''').split('',''); + + // Actually load the scripts + for (i = 0; i < modules.length; i++) { + document.write("<script type=''text/javascript'' src=''" + scriptBase + ''mxn.'' + modules[i] + ''.js'' + "''></script>"); + for (var j = 0; j < providers.length; j++) document.write("<script type=''text/javascript'' src=''" + scriptBase + ''mxn.'' + providers[j] + ''.'' + modules[i] + ''.js'' + "''></script>"); + } +})(); + (function(){ // holds all our implementing functions @@ -460,54 +503,3 @@ }; })(); - -// Auto-load scripts -// -// specify which map providers to load by using -// <script src="mxn.js?(provider1,[module1],provider2,[module2],provider3)" ... -// in your HTML -// -// for each provider mxn.provider.module.js and mxn.module.js will be loaded -// by default module is ''core'' -// -// NOTE: if you specify ''none'' as the provider no scripts will be loaded at all. -// it is then up to you to load the scripts independently -// -(function() { - - // Defaults - var providers = ''google,yahoo,microsoft''; - var modules = ''core''; - var scriptBase; - var scripts = document.getElementsByTagName(''script''); - - // determine which scripts we need to load - for (var i = 0; i < scripts.length; i++) { - var match = scripts[i].src.replace(/%20/g , '''').match(/^(.*?)mxn\.js(\?\(\[?(.*?)\]?\))?$/); - if (match !== null) { - scriptBase = match[1]; - if (match[3]) { - var settings = match[3].split('',[''); - providers = settings[0].replace('']'' , ''''); - if (settings[1]){ - modules = settings[1]; - } - } - break; - } - } - if (providers == ''none''){ // bail out if we don''t want to load anything - return; - } - providers = providers.replace(/ /g, '''').split('',''); - modules = modules.replace(/ /g, '''').split('',''); - - // actually load the scripts - for (i = 0; i < modules.length; i++) { - mxn.util.loadScript(scriptBase + ''mxn.'' + modules[i] + ''.js''); - for (var j = 0; j < providers.length; j++){ - mxn.util.loadScript(scriptBase + ''mxn.'' + providers[j] + ''.'' + modules[i] + ''.js''); - } - } - -})(); ======================================--- /trunk/tests/index.htm Sat Oct 3 09:29:54 2009 +++ /trunk/tests/index.htm Sat Nov 14 11:32:58 2009 @@ -3,12 +3,13 @@ <head> <meta http-equiv="content-type" content="text/html; charset=utf-8"/> <title>Mapstraction V2 demo</title> + <script type="text/javascript" src="http://maps.google.com/maps?file=api&v=2&key=ABQIAAAAY70wuSo0zF3ZtJVp5bDm1BS1Y2ErAqCHV5rDhHSzgjy23KqwdRRaoSBuZk72oDzzAYxVBjtsLqSmTw"></script> <script type="text/javascript" src="http://api.maps.yahoo.com/ajaxymap?v=3.8&appid=5wTxDW_V34GQjK.7glLG6OnJSRxCvfLj7ktMsuOoR42Gkm16vDVEjjw6FGWJ1Gky"></script> - <script charset="UTF-8" type="text/javascript" src="http://ecn.dev.virtualearth.net/mapcontrol/mapcontrol.ashx?v=6.2"></script> + <script charset="UTF-8" type="text/javascript" src="http://ecn.dev.virtualearth.net/mapcontrol/mapcontrol.ashx?v=6.2"></script> <script src="http://openlayers.org/api/OpenLayers.js"></script> - <!--<script src="domReady.js" type="text/javascript"></script>--> - <script src="../source/mxn.js?(google, yahoo, microsoft, openlayers)" type="text/javascript"></script> + + <script src="../source/mxn.js?(google,yahoo,microsoft,openlayers)" type="text/javascript"></script> <script type="text/javascript"> //<![CDATA[ @@ -30,10 +31,7 @@ } } - - //WhenDomReady(function(){ window.onload = function() { - var actionElm = document.getElementById(''actions''); var infoElm = document.getElementById(''info''); var eventsElm = document.getElementById(''events''); @@ -205,8 +203,7 @@ } } intervalID = setInterval(doNextAction, 2000); - - } //); + } //]]> </script> @@ -226,7 +223,7 @@ } .box div { - overflow-y: scroll; + overflow-y: scroll; height:300px; } </style>
Rob
2009-Nov-14 19:48 UTC
[Mapstraction] [mapstraction] r56 committed - #27 status:fixed Moved script laoding to top of mxn script and changed...
I think I''ve fixed this issue, but seeing as it behaved differently on different PCs and browsers, I would appreciate any feedback from users who were seeing this issue as to whether its fixed. Running the tests/index.htm file in different browsers should do the trick :) Cheers, Rob 2009/11/14 <codesite-noreply at google.com>> Revision: 56 > Author: robert.moran > Date: Sat Nov 14 11:32:58 2009 > Log: #27 status:fixed Moved script laoding to top of mxn script and changed > it to use document.write. Tested on chrome, firefox and IE > http://code.google.com/p/mapstraction/source/detail?r=56 > > Deleted: > /trunk/tests/domReady.js > Modified: > /trunk/source/mxn.js > /trunk/tests/index.htm > > ======================================> --- /trunk/tests/domReady.js Mon Jun 1 15:33:00 2009 > +++ /dev/null > @@ -1,25 +0,0 @@ > -// DomReady event - Thom Shannon, http://ts0.com > -// Public Domain > - > -var WhenDomReady = function(callBack,scope){ > - var scope = scope || window; > - var args = []; > - for (var i=2, len = arguments.length; i < len; ++i) { > - args.push(arguments[i]); > - }; > - if (document.addEventListener) { > - document.addEventListener("DOMContentLoaded", function(){ > - callBack.apply(scope, args); > - }, false); > - } > - else if (document.attachEvent) > - { > - var done = false; > - document.attachEvent("onreadystatechange",function(){ > - if ( !done && document.readyState === "complete" ) > { > - done = true; > - callBack.apply(scope, args); > - } > - }); > - } > -} > ======================================> --- /trunk/source/mxn.js Thu Sep 3 05:06:14 2009 > +++ /trunk/source/mxn.js Sat Nov 14 11:32:58 2009 > @@ -1,3 +1,46 @@ > +// Auto-load scripts > +// > +// specify which map providers to load by using > +// <script src="mxn.js?(provider1,provider2,[module1,module2])" ... > +// in your HTML > +// > +// for each provider mxn.provider.module.js and mxn.module.js will be > loaded > +// module ''core'' is always loaded > +// > +// NOTE: if you call without providers > +// <script src="mxn.js" ... > +// no scripts will be loaded at all and it is then up to you to load the > scripts independently > +(function() { > + var providers = null; > + var modules = ''core''; > + var scriptBase; > + var scripts = document.getElementsByTagName(''script''); > + > + // Determine which scripts we need to load > + for (var i = 0; i < scripts.length; i++) { > + var match = scripts[i].src.replace(/%20/g , > '''').match(/^(.*?)mxn\.js(\?\(\[?(.*?)\]?\))?$/); > + if (match != null) { > + scriptBase = match[1]; > + if (match[3]) { > + var settings = match[3].split('',[''); > + providers = settings[0].replace('']'' , ''''); > + if (settings[1]) modules += '','' + > settings[1]; > + } > + break; > + } > + } > + > + if (providers == null || providers == ''none'') return; // Bail out if > no auto-load has been found > + providers = providers.replace(/ /g, '''').split('',''); > + modules = modules.replace(/ /g, '''').split('',''); > + > + // Actually load the scripts > + for (i = 0; i < modules.length; i++) { > + document.write("<script type=''text/javascript'' src=''" + > scriptBase + ''mxn.'' + modules[i] + ''.js'' + "''></script>"); > + for (var j = 0; j < providers.length; j++) > document.write("<script type=''text/javascript'' src=''" + scriptBase + ''mxn.'' > + providers[j] + ''.'' + modules[i] + ''.js'' + "''></script>"); > + } > +})(); > + > (function(){ > > // holds all our implementing functions > @@ -460,54 +503,3 @@ > }; > > })(); > - > -// Auto-load scripts > -// > -// specify which map providers to load by using > -// <script > src="mxn.js?(provider1,[module1],provider2,[module2],provider3)" ... > -// in your HTML > -// > -// for each provider mxn.provider.module.js and mxn.module.js will be > loaded > -// by default module is ''core'' > -// > -// NOTE: if you specify ''none'' as the provider no scripts will be loaded > at all. > -// it is then up to you to load the scripts independently > -// > -(function() { > - > - // Defaults > - var providers = ''google,yahoo,microsoft''; > - var modules = ''core''; > - var scriptBase; > - var scripts = document.getElementsByTagName(''script''); > - > - // determine which scripts we need to load > - for (var i = 0; i < scripts.length; i++) { > - var match = scripts[i].src.replace(/%20/g , > '''').match(/^(.*?)mxn\.js(\?\(\[?(.*?)\]?\))?$/); > - if (match !== null) { > - scriptBase = match[1]; > - if (match[3]) { > - var settings = match[3].split('',[''); > - providers = settings[0].replace('']'' , ''''); > - if (settings[1]){ > - modules = settings[1]; > - } > - } > - break; > - } > - } > - if (providers == ''none''){ // bail out if we don''t want to load > anything > - return; > - } > - providers = providers.replace(/ /g, '''').split('',''); > - modules = modules.replace(/ /g, '''').split('',''); > - > - // actually load the scripts > - for (i = 0; i < modules.length; i++) { > - mxn.util.loadScript(scriptBase + ''mxn.'' + modules[i] + > ''.js''); > - for (var j = 0; j < providers.length; j++){ > - mxn.util.loadScript(scriptBase + ''mxn.'' + > providers[j] + ''.'' + modules[i] + ''.js''); > - } > - } > - > -})(); > ======================================> --- /trunk/tests/index.htm Sat Oct 3 09:29:54 2009 > +++ /trunk/tests/index.htm Sat Nov 14 11:32:58 2009 > @@ -3,12 +3,13 @@ > <head> > <meta http-equiv="content-type" content="text/html; charset=utf-8"/> > <title>Mapstraction V2 demo</title> > + > <script type="text/javascript" src=" > http://maps.google.com/maps?file=api&v=2&key=ABQIAAAAY70wuSo0zF3ZtJVp5bDm1BS1Y2ErAqCHV5rDhHSzgjy23KqwdRRaoSBuZk72oDzzAYxVBjtsLqSmTw<http://maps.google.com/maps?file=api&v=2&key=ABQIAAAAY70wuSo0zF3ZtJVp5bDm1BS1Y2ErAqCHV5rDhHSzgjy23KqwdRRaoSBuZk72oDzzAYxVBjtsLqSmTw> > "></script> > <script type="text/javascript" src=" > http://api.maps.yahoo.com/ajaxymap?v=3.8&appid=5wTxDW_V34GQjK.7glLG6OnJSRxCvfLj7ktMsuOoR42Gkm16vDVEjjw6FGWJ1Gky > "></script> > - <script charset="UTF-8" type="text/javascript" src=" > http://ecn.dev.virtualearth.net/mapcontrol/mapcontrol.ashx?v=6.2 > "></script> > + <script charset="UTF-8" type="text/javascript" src=" > http://ecn.dev.virtualearth.net/mapcontrol/mapcontrol.ashx?v=6.2 > "></script> > <script src="http://openlayers.org/api/OpenLayers.js"></script> > - <!--<script src="domReady.js" type="text/javascript"></script>--> > - <script src="../source/mxn.js?(google, yahoo, microsoft, > openlayers)" type="text/javascript"></script> > + > + <script src="../source/mxn.js?(google,yahoo,microsoft,openlayers)" > type="text/javascript"></script> > > <script type="text/javascript"> > //<![CDATA[ > @@ -30,10 +31,7 @@ > } > } > > - > - //WhenDomReady(function(){ > window.onload = function() { > - > var actionElm = document.getElementById(''actions''); > var infoElm = document.getElementById(''info''); > var eventsElm = document.getElementById(''events''); > @@ -205,8 +203,7 @@ > } > } > intervalID = setInterval(doNextAction, 2000); > - > - } //); > + } > > //]]> > </script> > @@ -226,7 +223,7 @@ > } > > .box div { > - overflow-y: scroll; > + overflow-y: scroll; > height:300px; > } > </style> > _______________________________________________ > Mapstraction mailing list > Mapstraction at lists.mapstraction.com > http://lists.mapstraction.com/listinfo.cgi/mapstraction-mapstraction.com >-------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.mapstraction.com/pipermail/mapstraction-mapstraction.com/attachments/20091114/489024b9/attachment-0001.htm>