codesite-noreply at google.com
2009-Jun-02 11:11 UTC
[Mapstraction] [mapstraction commit] r15 - Updated script loading function to use dom script addition and changed test page to use win...
Author: robert.moran Date: Tue Jun 2 04:10:54 2009 New Revision: 15 Modified: trunk/source/mxn.js trunk/tests/index.htm Log: Updated script loading function to use dom script addition and changed test page to use window.onload() Modified: trunk/source/mxn.js =============================================================================--- trunk/source/mxn.js (original) +++ trunk/source/mxn.js Tue Jun 2 04:10:54 2009 @@ -408,14 +408,9 @@ var scriptBase; var scripts = document.getElementsByTagName(''script''); - var writeScriptTag = function(src){ - document.write(''<scr'' + ''ipt type="text/javascript" src="'' + src + ''"></scr'' + ''ipt>''); - }; - 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('',[''); @@ -428,8 +423,8 @@ providers = providers.replace(/ /g, '''').split('',''); modules = modules.replace(/ /g, '''').split('',''); for (var i = 0; i < modules.length; i++) { - writeScriptTag(scriptBase + ''mxn.'' + modules[i] + ''.js''); - for (var j = 0; j < providers.length; j++) writeScriptTag(scriptBase + ''mxn.'' + providers[j] + ''.'' + modules[i] + ''.js''); + 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''); } })(); Modified: trunk/tests/index.htm =============================================================================--- trunk/tests/index.htm (original) +++ trunk/tests/index.htm Tue Jun 2 04:10:54 2009 @@ -6,7 +6,7 @@ <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 src="domReady.js" type="text/javascript"></script> + <!--<script src="domReady.js" type="text/javascript"></script>--> <script src="../source/mxn.js?(google, yahoo, microsoft)" type="text/javascript"></script> <script type="text/javascript"> @@ -30,7 +30,8 @@ } - WhenDomReady(function(){ + //WhenDomReady(function(){ + window.onload = function() { var actionElm = document.getElementById(''actions''); var infoElm = document.getElementById(''info''); @@ -173,7 +174,7 @@ } intervalID = setInterval(doNextAction, 2000); - }); + } //); //]]> </script>