mirror of
https://github.com/farmOS/farmOS.git
synced 2024-02-23 11:37:38 +01:00
27 lines
774 B
JavaScript
27 lines
774 B
JavaScript
(function ($) {
|
|
Drupal.behaviors.farm_map = {
|
|
attach: function (context, settings) {
|
|
var options = {
|
|
units: Drupal.settings.farm_map.units,
|
|
interactions: {
|
|
onFocusOnly: true
|
|
},
|
|
};
|
|
$('.farm-map', context).each(function (index, element) {
|
|
$(element).once('farm-map', function () {
|
|
$(element).attr('tabIndex', 0);
|
|
farmOS.map.create($(element).attr('id'), options);
|
|
$('.ol-popup-closer', context).click(function () {
|
|
$(element).focus();
|
|
});
|
|
});
|
|
});
|
|
},
|
|
detach: function (context, settings) {
|
|
$('.farm-map', context).each(function (index, element) {
|
|
farmOS.map.destroy($(element).attr('id'));
|
|
});
|
|
}
|
|
};
|
|
}(jQuery));
|