Add support for an externally provided asset map

This allows an embedding site to provide a map from individual
asset names to the URLs to use, thus allowing them to be served
through (for example) the rails asset pipeline.
This commit is contained in:
Tom Hughes
2013-08-17 00:20:05 +01:00
parent f2821dd9f2
commit a528267f18

View File

@@ -212,8 +212,16 @@ window.iD = function () {
return context;
};
var assetMap = {};
context.assetMap = function(_) {
if (!arguments.length) return assetMap;
assetMap = _;
return context;
};
context.imagePath = function(_) {
return assetPath + 'img/' + _;
var asset = 'img/' + _;
return assetMap[asset] || assetPath + asset;
};
context.toggleFullscreen = function() {