Only initialize the various elements if they are in the dom.

This commit is contained in:
Tim Schumacher 2014-07-10 11:48:00 +02:00
parent d64f78dc5e
commit 509a4f501b

View file

@ -9,9 +9,15 @@ function addGeoCoordinates(ev) {
}
var map = null;
$(document).ready(function () {
if ($('.icon.link').length > 0) {
$('.icon.link').popup();
jQuery('input[type=datetime]').datetimepicker({lang: 'de', format: 'Y-m-d H:i'});
}
if (jQuery('input[type=datetime]').length > 0) {
jQuery('input[type=datetime]').datetimepicker({lang: 'de', format: 'Y-m-d H:i'});
}
if (jQuery('#map').length == 1) {
$('.add_geo').click(addGeoCoordinates);
map = L.map('map');
@ -62,4 +68,5 @@ $(document).ready(function () {
}
}
}).modal('attach events', '.add_geo', 'show');
}
});