'wip'
This commit is contained in:
5
resources/js/utils/helper.js
vendored
Normal file
5
resources/js/utils/helper.js
vendored
Normal file
@@ -0,0 +1,5 @@
|
||||
export const isDefined = object => typeof object !== 'undefined';
|
||||
|
||||
export const fadeElementIn = element => element.closest('.fade').classList.add('in');
|
||||
|
||||
export const openLink = url => window.open(url, '_blank');
|
||||
29
resources/js/utils/parser.js
vendored
Normal file
29
resources/js/utils/parser.js
vendored
Normal file
@@ -0,0 +1,29 @@
|
||||
const parseMarker = marker => {
|
||||
const lat = parseFloat(marker.lat);
|
||||
const lng = parseFloat(marker.lng);
|
||||
const url = marker.url;
|
||||
|
||||
return {
|
||||
lat,
|
||||
lng,
|
||||
url,
|
||||
};
|
||||
};
|
||||
|
||||
export default {
|
||||
map(element) {
|
||||
const lat = parseFloat(element.dataset.mapLat);
|
||||
const lng = parseFloat(element.dataset.mapLng);
|
||||
const zoom = parseInt(element.dataset.mapZoom);
|
||||
const key = element.dataset.mapKey;
|
||||
const markers = (JSON.parse(element.dataset.mapMarkers) || []).map(parseMarker);
|
||||
|
||||
return {
|
||||
lat,
|
||||
lng,
|
||||
zoom,
|
||||
key,
|
||||
markers,
|
||||
};
|
||||
},
|
||||
}
|
||||
Reference in New Issue
Block a user