Skip to content

Instantly share code, notes, and snippets.

@jojoob
Created January 22, 2015 10:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jojoob/1f8f35b95d075b82c4e4 to your computer and use it in GitHub Desktop.
Save jojoob/1f8f35b95d075b82c4e4 to your computer and use it in GitHub Desktop.
M.block_geolocation = M.block_geolocation || {};
M.block_geolocation.leaflet = {
load: function(fn) {
if (!this.inited) {
this.inited = true;
var leafletpath = M.cfg.wwwroot + '/lib/leaflet-0.7.3/';
Y.Get.css(leafletpath + '/leaflet.css', function (err) {
if(!err) {
Y.Get.js([leafletpath + '/leaflet.js'], function (err) {
if (!err) {
console.log("leaflet-for-yui Info: leaflet loaded");
L.Icon.Default.imagePath = leafletpath + '/images';
if (typeof(fn) === 'function') {
fn();
}
} else {
Y.Array.each(err, function (error) {
Y.log(error, 'error', 'leaflet-for-yui');
});
}
});
} else {
Y.log(err, 'error', 'leaflet-for-yui');
}
});
} else {
if (typeof(fn) === 'function') {
fn();
}
}
}
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment