Merge pull request #286 from marcjansen/imgpath
Declare ImgPath property of OpenLayers in OpenLayers.js (r=@elemoine,@ahocevar)
This commit is contained in:
@@ -79,7 +79,42 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
return (function() { return l; });
|
return (function() { return l; });
|
||||||
})()
|
})(),
|
||||||
|
|
||||||
|
/**
|
||||||
|
* APIProperty: ImgPath
|
||||||
|
* {String} Set this to the path where control images are stored, a path
|
||||||
|
* given here must end with a slash. If set to '' (which is the default)
|
||||||
|
* OpenLayers will use its script location + "img/".
|
||||||
|
*
|
||||||
|
* You will need to set this property when you have a singlefile build of
|
||||||
|
* OpenLayers that either is not named "OpenLayers.js" or if you move
|
||||||
|
* the file in a way such that the image directory cannot be derived from
|
||||||
|
* the script location.
|
||||||
|
*
|
||||||
|
* If your custom OpenLayers build is named "my-custom-ol.js" and the images
|
||||||
|
* of OpenLayers are in a folder "/resources/external/images/ol" a correct
|
||||||
|
* way of including OpenLayers in your HTML would be:
|
||||||
|
*
|
||||||
|
* (code)
|
||||||
|
* <script src="/path/to/my-custom-ol.js" type="text/javascript"></script>
|
||||||
|
* <script type="text/javascript">
|
||||||
|
* // tell OpenLayers where the control images are
|
||||||
|
* // remember the trailing slash
|
||||||
|
* OpenLayers.ImgPath = "/resources/external/images/ol/";
|
||||||
|
* </script>
|
||||||
|
* (end code)
|
||||||
|
*
|
||||||
|
* Please remember that when your OpenLayers script is not named
|
||||||
|
* "OpenLayers.js" you will have to make sure that the default theme is
|
||||||
|
* loaded into the page by including an appropriate <link>-tag,
|
||||||
|
* e.g.:
|
||||||
|
*
|
||||||
|
* (code)
|
||||||
|
* <link rel="stylesheet" href="/path/to/default/style.css" type="text/css">
|
||||||
|
* (end code)
|
||||||
|
*/
|
||||||
|
ImgPath : ''
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -39,5 +39,40 @@ var OpenLayers = {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
return (function() { return l; });
|
return (function() { return l; });
|
||||||
})()
|
})(),
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Property: ImgPath
|
||||||
|
* {String} Set this to the path where control images are stored, a path
|
||||||
|
* given here must end with a slash. If set to '' (which is the default)
|
||||||
|
* OpenLayers will use its script location + "img/".
|
||||||
|
*
|
||||||
|
* You will need to set this property when you have a singlefile build of
|
||||||
|
* OpenLayers that either is not named "OpenLayers.js" or if you move
|
||||||
|
* the file in a way such that the image directory cannot be derived from
|
||||||
|
* the script location.
|
||||||
|
*
|
||||||
|
* If your custom OpenLayers build is named "my-custom-ol.js" and the images
|
||||||
|
* of OpenLayers are in a folder "/resources/external/images/ol" a correct
|
||||||
|
* way of including OpenLayers in your HTML would be:
|
||||||
|
*
|
||||||
|
* (code)
|
||||||
|
* <script src="/path/to/my-custom-ol.js" type="text/javascript"></script>
|
||||||
|
* <script type="text/javascript">
|
||||||
|
* // tell OpenLayers where the control images are
|
||||||
|
* // remember the trailing slash
|
||||||
|
* OpenLayers.ImgPath = "/resources/external/images/ol/";
|
||||||
|
* </script>
|
||||||
|
* (end code)
|
||||||
|
*
|
||||||
|
* Please remember that when your OpenLayers script is not named
|
||||||
|
* "OpenLayers.js" you will have to make sure that the default theme is
|
||||||
|
* loaded into the page by including an appropriate <link>-tag,
|
||||||
|
* e.g.:
|
||||||
|
*
|
||||||
|
* (code)
|
||||||
|
* <link rel="stylesheet" href="/path/to/default/style.css" type="text/css">
|
||||||
|
* (end code)
|
||||||
|
*/
|
||||||
|
ImgPath : ''
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -559,14 +559,6 @@ OpenLayers.Util.urlAppend = function(url, paramStr) {
|
|||||||
return newUrl;
|
return newUrl;
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
|
||||||
* APIProperty: ImgPath
|
|
||||||
* {String} Set this to the path where control images are stored.
|
|
||||||
* If set to '' OpenLayers will use script location + "img/"
|
|
||||||
* Default is ''.
|
|
||||||
*/
|
|
||||||
OpenLayers.ImgPath = '';
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Function: getImagesLocation
|
* Function: getImagesLocation
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -3,11 +3,13 @@
|
|||||||
<script src="../lib/OpenLayers.js"></script>
|
<script src="../lib/OpenLayers.js"></script>
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
function test_OpenLayers(t) {
|
function test_OpenLayers(t) {
|
||||||
t.plan(1);
|
t.plan(3);
|
||||||
|
|
||||||
var script = document.getElementById("script");
|
|
||||||
|
|
||||||
t.eq(OpenLayers._getScriptLocation(), "../", "Script location correctly detected.");
|
t.eq(OpenLayers._getScriptLocation(), "../", "Script location correctly detected.");
|
||||||
|
|
||||||
|
t.ok(OpenLayers.ImgPath !== undefined, "An ImgPath property exists.");
|
||||||
|
|
||||||
|
t.eq(OpenLayers.ImgPath, '', "The default for OpenLayers.ImgPath is the empty string.");
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
</head>
|
</head>
|
||||||
|
|||||||
Reference in New Issue
Block a user