diff options
Diffstat (limited to 'misc/openlayers/tests/OLLoader.js')
-rw-r--r-- | misc/openlayers/tests/OLLoader.js | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/misc/openlayers/tests/OLLoader.js b/misc/openlayers/tests/OLLoader.js new file mode 100644 index 0000000..a2311c7 --- /dev/null +++ b/misc/openlayers/tests/OLLoader.js @@ -0,0 +1,26 @@ +// Adding a mode parameter with "build" as value in the run-tests.html will +// make usage of the build version of the library. +// get the OLLoader.js script location +(function() { + var r = new RegExp("(^|(.*?\\/))(" + "OLLoader.js" + ")(\\?|$)"), + s = document.getElementsByTagName('script'), + src, m, l = ""; + for(var i=0, len=s.length; i<len; i++) { + src = s[i].getAttribute('src'); + if(src) { + var m = src.match(r); + if(m) { + l = m[1]; + break; + } + } + } + + var regex = new RegExp( "[\\?&]mode=([^&#]*)" ); + var href = window.parent.location.href; + var results = regex.exec( href ); + l += (results && results[1] == 'build') ? + "../build/OpenLayers.js" : "../lib/OpenLayers.js"; + scriptTag = "<script src='" + l + "'></script>"; + document.write(scriptTag); +})(); |