From 485ebaa3161cdc7a770a49784987c618cad69e0e Mon Sep 17 00:00:00 2001 From: ahocevar Date: Wed, 13 Oct 2010 13:02:08 +0000 Subject: [PATCH] Made _getScriptLocation smarter, and added it to SingleFile.js also. This means that single file builds no longer need to contain OpenLayers.js. r=eleomine (closes #2873) git-svn-id: http://svn.openlayers.org/trunk/openlayers@10822 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf --- build/full.cfg | 2 +- build/library.cfg | 2 +- build/lite.cfg | 1 - lib/OpenLayers.js | 41 +++++++++--------------------------- lib/OpenLayers/SingleFile.js | 7 +++++- tests/OpenLayers.html | 31 --------------------------- tests/OpenLayers1.html | 32 ++++++++++++++++++++++++++++ tests/OpenLayers2.html | 38 +++++++++++++++++++++++++++++++++ tests/OpenLayers3.html | 38 +++++++++++++++++++++++++++++++++ tests/list-tests.html | 4 +++- 10 files changed, 129 insertions(+), 67 deletions(-) delete mode 100644 tests/OpenLayers.html create mode 100644 tests/OpenLayers1.html create mode 100644 tests/OpenLayers2.html create mode 100644 tests/OpenLayers3.html diff --git a/build/full.cfg b/build/full.cfg index 0a40f1b563..b947fc5c0a 100644 --- a/build/full.cfg +++ b/build/full.cfg @@ -3,7 +3,6 @@ [first] OpenLayers/SingleFile.js -OpenLayers.js OpenLayers/BaseTypes.js OpenLayers/BaseTypes/Class.js OpenLayers/Util.js @@ -15,4 +14,5 @@ Rico/Corner.js [exclude] Firebug +OpenLayers.js OpenLayers/Lang diff --git a/build/library.cfg b/build/library.cfg index 209ccbcdfd..c28c1bb69f 100644 --- a/build/library.cfg +++ b/build/library.cfg @@ -4,7 +4,6 @@ [first] OpenLayers/SingleFile.js -OpenLayers.js OpenLayers/BaseTypes.js OpenLayers/BaseTypes/Class.js OpenLayers/Util.js @@ -16,6 +15,7 @@ Rico/Corner.js [exclude] Firebug +OpenLayers.js OpenLayers/Format/GeoRSS.js OpenLayers/Format/GML.js OpenLayers/Format/WKT.js diff --git a/build/lite.cfg b/build/lite.cfg index 48454dc20c..44eaabb9dc 100644 --- a/build/lite.cfg +++ b/build/lite.cfg @@ -6,7 +6,6 @@ [first] OpenLayers/SingleFile.js -OpenLayers.js OpenLayers/BaseTypes.js OpenLayers/BaseTypes/Class.js OpenLayers/Util.js diff --git a/lib/OpenLayers.js b/lib/OpenLayers.js index 880e653de3..054f718e38 100644 --- a/lib/OpenLayers.js +++ b/lib/OpenLayers.js @@ -14,28 +14,21 @@ * Before creating the OpenLayers namespace, check to see if * OpenLayers.singleFile is true. This occurs if the * OpenLayers/SingleFile.js script is included before this one - as is the - * case with single file builds. + * case with old single file build profiles that included both + * OpenLayers.js and OpenLayers/SingleFile.js. */ var singleFile = (typeof OpenLayers == "object" && OpenLayers.singleFile); /** - * Cache for the script location returned from - * OpenLayers._getScriptLocation + * Relative path of this script. */ - var scriptLocation; + var scriptName = (!singleFile) ? "lib/OpenLayers.js" : "OpenLayers.js"; /** * Namespace: OpenLayers * The OpenLayers object provides a namespace for all things OpenLayers */ window.OpenLayers = { - - /** - * Property: _scriptName - * {String} Relative path of this script. - */ - _scriptName: (!singleFile) ? "lib/OpenLayers.js" : "OpenLayers.js", - /** * Function: _getScriptLocation * Return the path to this script. @@ -43,26 +36,12 @@ * Returns: * {String} Path to this script */ - _getScriptLocation: function () { - if (scriptLocation != undefined) { - return scriptLocation; - } - scriptLocation = ""; - var isOL = new RegExp("(^|(.*?\\/))(" + OpenLayers._scriptName + ")(\\?|$)"); - - var scripts = document.getElementsByTagName('script'); - for (var i=0, len=scripts.length; i - - - - - - - - - diff --git a/tests/OpenLayers1.html b/tests/OpenLayers1.html new file mode 100644 index 0000000000..c8776fa68d --- /dev/null +++ b/tests/OpenLayers1.html @@ -0,0 +1,32 @@ + + + + + + + + + + + + + + + + diff --git a/tests/OpenLayers2.html b/tests/OpenLayers2.html new file mode 100644 index 0000000000..7de7b81512 --- /dev/null +++ b/tests/OpenLayers2.html @@ -0,0 +1,38 @@ + + + + + + + + + + + + + + + + + + + + + + diff --git a/tests/OpenLayers3.html b/tests/OpenLayers3.html new file mode 100644 index 0000000000..ba91bb24f9 --- /dev/null +++ b/tests/OpenLayers3.html @@ -0,0 +1,38 @@ + + + + + + + + + + + + + + + + + + diff --git a/tests/list-tests.html b/tests/list-tests.html index bd94fbf7f9..c990ed0a5c 100644 --- a/tests/list-tests.html +++ b/tests/list-tests.html @@ -156,7 +156,9 @@
  • Map.html
  • Marker.html
  • Marker/Box.html
  • -
  • OpenLayers.html
  • +
  • OpenLayers1.html
  • +
  • OpenLayers2.html
  • +
  • OpenLayers3.html
  • Popup.html
  • Popup/Anchored.html
  • Popup/AnchoredBubble.html