SingleFile.js 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. /* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
  2. * full list of contributors). Published under the 2-clause BSD license.
  3. * See license.txt in the OpenLayers distribution or repository for the
  4. * full text of the license. */
  5. var OpenLayers = {
  6. /**
  7. * Constant: VERSION_NUMBER
  8. */
  9. VERSION_NUMBER: "Release 2.13.1",
  10. /**
  11. * Constant: singleFile
  12. * TODO: remove this in 3.0 when we stop supporting build profiles that
  13. * include OpenLayers.js
  14. */
  15. singleFile: true,
  16. /**
  17. * Method: _getScriptLocation
  18. * Return the path to this script. This is also implemented in
  19. * OpenLayers.js
  20. *
  21. * Returns:
  22. * {String} Path to this script
  23. */
  24. _getScriptLocation: (function() {
  25. var r = new RegExp("(^|(.*?\\/))(OpenLayers[^\\/]*?\\.js)(\\?|$)"),
  26. s = document.getElementsByTagName('script'),
  27. src, m, l = "";
  28. for(var i=0, len=s.length; i<len; i++) {
  29. src = s[i].getAttribute('src');
  30. if(src) {
  31. m = src.match(r);
  32. if(m) {
  33. l = m[1];
  34. break;
  35. }
  36. }
  37. }
  38. return (function() { return l; });
  39. })(),
  40. /**
  41. * Property: ImgPath
  42. * {String} Set this to the path where control images are stored, a path
  43. * given here must end with a slash. If set to '' (which is the default)
  44. * OpenLayers will use its script location + "img/".
  45. *
  46. * You will need to set this property when you have a singlefile build of
  47. * OpenLayers that either is not named "OpenLayers.js" or if you move
  48. * the file in a way such that the image directory cannot be derived from
  49. * the script location.
  50. *
  51. * If your custom OpenLayers build is named "my-custom-ol.js" and the images
  52. * of OpenLayers are in a folder "/resources/external/images/ol" a correct
  53. * way of including OpenLayers in your HTML would be:
  54. *
  55. * (code)
  56. * <script src="/path/to/my-custom-ol.js" type="text/javascript"></script>
  57. * <script type="text/javascript">
  58. * // tell OpenLayers where the control images are
  59. * // remember the trailing slash
  60. * OpenLayers.ImgPath = "/resources/external/images/ol/";
  61. * </script>
  62. * (end code)
  63. *
  64. * Please remember that when your OpenLayers script is not named
  65. * "OpenLayers.js" you will have to make sure that the default theme is
  66. * loaded into the page by including an appropriate <link>-tag,
  67. * e.g.:
  68. *
  69. * (code)
  70. * <link rel="stylesheet" href="/path/to/default/style.css" type="text/css">
  71. * (end code)
  72. */
  73. ImgPath : ''
  74. };