|
|
@ -13584,6 +13584,8 @@ var AddLocationComponent = /*#__PURE__*/function (_Component) { |
|
|
|
}; |
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
_proto.onupdate = function onupdate(vnode) { |
|
|
|
_proto.onupdate = function onupdate(vnode) { |
|
|
|
|
|
|
|
var _this2 = this; |
|
|
|
|
|
|
|
|
|
|
|
var dom = vnode.dom; |
|
|
|
var dom = vnode.dom; |
|
|
|
var mapElements = dom.getElementsByClassName('location-map'); |
|
|
|
var mapElements = dom.getElementsByClassName('location-map'); |
|
|
|
|
|
|
|
|
|
|
@ -13605,11 +13607,15 @@ var AddLocationComponent = /*#__PURE__*/function (_Component) { |
|
|
|
var layer = L.tileLayer('https://api.mapbox.com/styles/v1/{id}/tiles/{z}/{x}/{y}?access_token={accessToken}', { |
|
|
|
var layer = L.tileLayer('https://api.mapbox.com/styles/v1/{id}/tiles/{z}/{x}/{y}?access_token={accessToken}', { |
|
|
|
attribution: 'Map data © <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a> ' + 'contributors, Imagery © <a href="https://www.mapbox.com/">Mapbox</a>, ' + 'Developed by <a href="https://flarum.it/">Marco Colia</a>', |
|
|
|
attribution: 'Map data © <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a> ' + 'contributors, Imagery © <a href="https://www.mapbox.com/">Mapbox</a>, ' + 'Developed by <a href="https://flarum.it/">Marco Colia</a>', |
|
|
|
maxZoom: 18, |
|
|
|
maxZoom: 18, |
|
|
|
|
|
|
|
edgeBufferTiles: 1, |
|
|
|
id: 'mapbox/streets-v11', |
|
|
|
id: 'mapbox/streets-v11', |
|
|
|
tileSize: 512, |
|
|
|
tileSize: 512, |
|
|
|
zoomOffset: -1, |
|
|
|
zoomOffset: -1, |
|
|
|
accessToken: publicToken |
|
|
|
accessToken: publicToken |
|
|
|
}).addTo(this.map); |
|
|
|
}).addTo(this.map); |
|
|
|
|
|
|
|
setTimeout(function () { |
|
|
|
|
|
|
|
_this2.map.invalidateSize(); |
|
|
|
|
|
|
|
}, 1000); |
|
|
|
this.updateMap(); |
|
|
|
this.updateMap(); |
|
|
|
} |
|
|
|
} |
|
|
|
} else { |
|
|
|
} else { |
|
|
@ -13636,7 +13642,7 @@ var AddLocationComponent = /*#__PURE__*/function (_Component) { |
|
|
|
}; |
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
_proto.save = function save() { |
|
|
|
_proto.save = function save() { |
|
|
|
var _this2 = this; |
|
|
|
var _this3 = this; |
|
|
|
|
|
|
|
|
|
|
|
if (this.search_country == '' || this.search_city == '') { |
|
|
|
if (this.search_country == '' || this.search_city == '') { |
|
|
|
if (this.location) { |
|
|
|
if (this.location) { |
|
|
@ -13650,14 +13656,14 @@ var AddLocationComponent = /*#__PURE__*/function (_Component) { |
|
|
|
location_longitude: null |
|
|
|
location_longitude: null |
|
|
|
}; |
|
|
|
}; |
|
|
|
user.save(attributes).then(function () { |
|
|
|
user.save(attributes).then(function () { |
|
|
|
_this2.search_country = 'France'; |
|
|
|
_this3.search_country = 'France'; |
|
|
|
_this2.search_city = ''; |
|
|
|
_this3.search_city = ''; |
|
|
|
_this2.location = null; |
|
|
|
_this3.location = null; |
|
|
|
flarum_forum_app__WEBPACK_IMPORTED_MODULE_1___default.a.alerts.show({ |
|
|
|
flarum_forum_app__WEBPACK_IMPORTED_MODULE_1___default.a.alerts.show({ |
|
|
|
type: 'success' |
|
|
|
type: 'success' |
|
|
|
}, flarum_forum_app__WEBPACK_IMPORTED_MODULE_1___default.a.translator.trans('justoverclock-users-map-location.forum.locationCleared')); |
|
|
|
}, flarum_forum_app__WEBPACK_IMPORTED_MODULE_1___default.a.translator.trans('justoverclock-users-map-location.forum.locationCleared')); |
|
|
|
|
|
|
|
|
|
|
|
_this2.updateMap(); |
|
|
|
_this3.updateMap(); |
|
|
|
}); |
|
|
|
}); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -13730,9 +13736,9 @@ var AddLocationComponent = /*#__PURE__*/function (_Component) { |
|
|
|
location_longitude: result.lon |
|
|
|
location_longitude: result.lon |
|
|
|
}; |
|
|
|
}; |
|
|
|
user.save(attributes).then(function () { |
|
|
|
user.save(attributes).then(function () { |
|
|
|
_this2.search_country = attributes.location_country || 'France'; |
|
|
|
_this3.search_country = attributes.location_country || 'France'; |
|
|
|
_this2.search_city = ((attributes.location_postcode || '') + ' ' + (attributes.location_city || '')).trim(); |
|
|
|
_this3.search_city = ((attributes.location_postcode || '') + ' ' + (attributes.location_city || '')).trim(); |
|
|
|
_this2.location = { |
|
|
|
_this3.location = { |
|
|
|
lat: attributes.location_latitude, |
|
|
|
lat: attributes.location_latitude, |
|
|
|
lon: attributes.location_longitude |
|
|
|
lon: attributes.location_longitude |
|
|
|
}; |
|
|
|
}; |
|
|
@ -13740,7 +13746,7 @@ var AddLocationComponent = /*#__PURE__*/function (_Component) { |
|
|
|
type: 'success' |
|
|
|
type: 'success' |
|
|
|
}, flarum_forum_app__WEBPACK_IMPORTED_MODULE_1___default.a.translator.trans('justoverclock-users-map-location.forum.locationSaved')); |
|
|
|
}, flarum_forum_app__WEBPACK_IMPORTED_MODULE_1___default.a.translator.trans('justoverclock-users-map-location.forum.locationSaved')); |
|
|
|
|
|
|
|
|
|
|
|
_this2.updateMap(); |
|
|
|
_this3.updateMap(); |
|
|
|
}); |
|
|
|
}); |
|
|
|
return "break"; |
|
|
|
return "break"; |
|
|
|
}(); |
|
|
|
}(); |
|
|
@ -13880,6 +13886,10 @@ flarum_forum_app__WEBPACK_IMPORTED_MODULE_0___default.a.initializers.add('justov |
|
|
|
} |
|
|
|
} |
|
|
|
}); |
|
|
|
}); |
|
|
|
Object(flarum_common_extend__WEBPACK_IMPORTED_MODULE_1__["extend"])(flarum_forum_components_UserCard__WEBPACK_IMPORTED_MODULE_6___default.a.prototype, 'oncreate', function (originalResult, vnode) { |
|
|
|
Object(flarum_common_extend__WEBPACK_IMPORTED_MODULE_1__["extend"])(flarum_forum_components_UserCard__WEBPACK_IMPORTED_MODULE_6___default.a.prototype, 'oncreate', function (originalResult, vnode) { |
|
|
|
|
|
|
|
var script = document.createElement('script'); |
|
|
|
|
|
|
|
script.type = 'text/javascript'; |
|
|
|
|
|
|
|
script.src = app.forum.attribute('baseUrl') + '/assets/extensions/justoverclock-users-map-location/leaflet.edgebuffer.js'; |
|
|
|
|
|
|
|
document.head.appendChild(script); |
|
|
|
var user = this.attrs.user; |
|
|
|
var user = this.attrs.user; |
|
|
|
var location = user.location_latitude() ? { |
|
|
|
var location = user.location_latitude() ? { |
|
|
|
lat: user.location_latitude(), |
|
|
|
lat: user.location_latitude(), |
|
|
@ -13896,14 +13906,21 @@ flarum_forum_app__WEBPACK_IMPORTED_MODULE_0___default.a.initializers.add('justov |
|
|
|
iconAnchor: [13, 40] |
|
|
|
iconAnchor: [13, 40] |
|
|
|
}); |
|
|
|
}); |
|
|
|
var map = L.map(mapElement).setView([location.lat, location.lon], 13); |
|
|
|
var map = L.map(mapElement).setView([location.lat, location.lon], 13); |
|
|
|
|
|
|
|
var marker = L.marker([location.lat, location.lon], { |
|
|
|
|
|
|
|
icon: markerIcon |
|
|
|
|
|
|
|
}).addTo(map); |
|
|
|
var layerUserCard = L.tileLayer('https://api.mapbox.com/styles/v1/{id}/tiles/{z}/{x}/{y}?access_token={accessToken}', { |
|
|
|
var layerUserCard = L.tileLayer('https://api.mapbox.com/styles/v1/{id}/tiles/{z}/{x}/{y}?access_token={accessToken}', { |
|
|
|
attribution: 'Map data © <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors, Imagery © <a href="https://www.mapbox.com/">Mapbox</a>, Developed by <a href="https://flarum.it/">Marco Colia</a>', |
|
|
|
attribution: 'Map data © <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors, Imagery © <a href="https://www.mapbox.com/">Mapbox</a>, Developed by <a href="https://flarum.it/">Marco Colia</a>', |
|
|
|
maxZoom: 18, |
|
|
|
maxZoom: 18, |
|
|
|
|
|
|
|
edgeBufferTiles: 1, |
|
|
|
id: 'mapbox/streets-v11', |
|
|
|
id: 'mapbox/streets-v11', |
|
|
|
tileSize: 512, |
|
|
|
tileSize: 512, |
|
|
|
zoomOffset: -1, |
|
|
|
zoomOffset: -1, |
|
|
|
accessToken: publicToken |
|
|
|
accessToken: publicToken |
|
|
|
}).addTo(map); |
|
|
|
}).addTo(map); |
|
|
|
|
|
|
|
setTimeout(function () { |
|
|
|
|
|
|
|
map.invalidateSize(); |
|
|
|
|
|
|
|
}, 100); |
|
|
|
}); |
|
|
|
}); |
|
|
|
Object(flarum_common_extend__WEBPACK_IMPORTED_MODULE_1__["extend"])(flarum_forum_components_SettingsPage__WEBPACK_IMPORTED_MODULE_2___default.a.prototype, 'settingsItems', function (items) { |
|
|
|
Object(flarum_common_extend__WEBPACK_IMPORTED_MODULE_1__["extend"])(flarum_forum_components_SettingsPage__WEBPACK_IMPORTED_MODULE_2___default.a.prototype, 'settingsItems', function (items) { |
|
|
|
items.add('location', m(_components_AddLocationComponent__WEBPACK_IMPORTED_MODULE_5__["default"], null)); |
|
|
|
items.add('location', m(_components_AddLocationComponent__WEBPACK_IMPORTED_MODULE_5__["default"], null)); |
|
|
|