only mention the path, and ternery

This commit is contained in:
Calvin Metcalf 2013-01-18 13:35:07 -05:00
parent c3cb132463
commit f26da9f9be

View File

@ -37,18 +37,15 @@ L.Icon.Default.imagePath = (function () {
var scripts = document.getElementsByTagName('script'),
leafletRe = /\/?leaflet[\-\._]?([\w\-\._]*)\.js\??/;
var i, len, src, matches;
var i, len, src, matches, path;
for (i = 0, len = scripts.length; i < len; i++) {
src = scripts[i].src;
matches = src.match(leafletRe);
if (matches) {
if (src.split(leafletRe)[0]) {
return src.split(leafletRe)[0] + '/images';
} else {
return 'images';
}
path = src.split(leafletRe)[0];
return (path ? path + '/' : '') + 'images';
}
}
}());