|
|
|
@ -16486,10 +16486,17 @@ var GlobalMapPage = /*#__PURE__*/function (_Page) {
|
|
|
|
|
this.userMarkers = L.markerClusterGroup({ |
|
|
|
|
maxClusterRadius: 40 |
|
|
|
|
}); |
|
|
|
|
this.map.addLayer(this.userMarkers); // begin fetching users
|
|
|
|
|
this.map.addLayer(this.userMarkers); |
|
|
|
|
var usersExpirationDelay = 10 * 60; // in seconds
|
|
|
|
|
|
|
|
|
|
if ((flarum_forum_app__WEBPACK_IMPORTED_MODULE_1___default().store).lastFetchedUserLocations && Date.now() - (flarum_forum_app__WEBPACK_IMPORTED_MODULE_1___default().store).lastFetchedUserLocations < usersExpirationDelay * 1000) { |
|
|
|
|
// reuse data from the store
|
|
|
|
|
this.displayUsers(flarum_forum_app__WEBPACK_IMPORTED_MODULE_1___default().store.all('users')); |
|
|
|
|
} else { |
|
|
|
|
// begin fetching users
|
|
|
|
|
this.fetchUsers(0); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} else { |
|
|
|
|
this.map = null; |
|
|
|
|
} |
|
|
|
@ -16499,29 +16506,37 @@ var GlobalMapPage = /*#__PURE__*/function (_Page) {
|
|
|
|
|
var _this = this; |
|
|
|
|
|
|
|
|
|
var maxLocationsPerRequest = 50; |
|
|
|
|
flarum_forum_app__WEBPACK_IMPORTED_MODULE_1___default().store.find('user-locations', { |
|
|
|
|
flarum_forum_app__WEBPACK_IMPORTED_MODULE_1___default().store.find('userlocations', { |
|
|
|
|
page: { |
|
|
|
|
limit: maxLocationsPerRequest, |
|
|
|
|
offset: offset |
|
|
|
|
} |
|
|
|
|
}).then(function (response) { |
|
|
|
|
for (var _iterator = _createForOfIteratorHelperLoose(response), _step; !(_step = _iterator()).done;) { |
|
|
|
|
_this.displayUsers(response); |
|
|
|
|
|
|
|
|
|
if (response.length == maxLocationsPerRequest) { |
|
|
|
|
// we need to fetch more users
|
|
|
|
|
_this.fetchUsers(offset + response.length); |
|
|
|
|
} else { |
|
|
|
|
// finished fetching all users
|
|
|
|
|
(flarum_forum_app__WEBPACK_IMPORTED_MODULE_1___default().store).lastFetchedUserLocations = Date.now(); |
|
|
|
|
} |
|
|
|
|
}); |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
_proto.displayUsers = function displayUsers(users) { |
|
|
|
|
for (var _iterator = _createForOfIteratorHelperLoose(users), _step; !(_step = _iterator()).done;) { |
|
|
|
|
var item = _step.value; |
|
|
|
|
var user = item.data.attributes; |
|
|
|
|
|
|
|
|
|
if (user.location_latitude) { |
|
|
|
|
var marker = L.marker([parseFloat(user.location_latitude), parseFloat(user.location_longitude)], { |
|
|
|
|
icon: _this.userMarkerIcon |
|
|
|
|
icon: this.userMarkerIcon |
|
|
|
|
}); |
|
|
|
|
marker.bindPopup('<a href="/u/' + escapeHtml(user.username) + '">' + escapeHtml(user.displayName) + '</a>'); |
|
|
|
|
|
|
|
|
|
_this.userMarkers.addLayer(marker); |
|
|
|
|
this.userMarkers.addLayer(marker); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if (response.length == maxLocationsPerRequest) { |
|
|
|
|
// we need to fetch more users
|
|
|
|
|
_this.fetchUsers(offset + response.length); |
|
|
|
|
} else {// finished fetching all users
|
|
|
|
|
} |
|
|
|
|
}); |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
return GlobalMapPage; |
|
|
|
@ -16553,21 +16568,23 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
|
|
/* harmony import */ var flarum_common_Model__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! flarum/common/Model */ "flarum/common/Model"); |
|
|
|
|
/* harmony import */ var flarum_common_Model__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(flarum_common_Model__WEBPACK_IMPORTED_MODULE_4__); |
|
|
|
|
/* harmony import */ var _components_AddLocationComponent__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./components/AddLocationComponent */ "./src/forum/components/AddLocationComponent.js"); |
|
|
|
|
/* harmony import */ var flarum_forum_components_UserCard__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! flarum/forum/components/UserCard */ "flarum/forum/components/UserCard"); |
|
|
|
|
/* harmony import */ var flarum_forum_components_UserCard__WEBPACK_IMPORTED_MODULE_6___default = /*#__PURE__*/__webpack_require__.n(flarum_forum_components_UserCard__WEBPACK_IMPORTED_MODULE_6__); |
|
|
|
|
/* harmony import */ var flarum_forum_components_HeaderPrimary__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! flarum/forum/components/HeaderPrimary */ "flarum/forum/components/HeaderPrimary"); |
|
|
|
|
/* harmony import */ var flarum_forum_components_HeaderPrimary__WEBPACK_IMPORTED_MODULE_7___default = /*#__PURE__*/__webpack_require__.n(flarum_forum_components_HeaderPrimary__WEBPACK_IMPORTED_MODULE_7__); |
|
|
|
|
/* harmony import */ var flarum_common_components_Link__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! flarum/common/components/Link */ "flarum/common/components/Link"); |
|
|
|
|
/* harmony import */ var flarum_common_components_Link__WEBPACK_IMPORTED_MODULE_8___default = /*#__PURE__*/__webpack_require__.n(flarum_common_components_Link__WEBPACK_IMPORTED_MODULE_8__); |
|
|
|
|
/* harmony import */ var leaflet__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! leaflet */ "./node_modules/leaflet/dist/leaflet-src.js"); |
|
|
|
|
/* harmony import */ var leaflet__WEBPACK_IMPORTED_MODULE_9___default = /*#__PURE__*/__webpack_require__.n(leaflet__WEBPACK_IMPORTED_MODULE_9__); |
|
|
|
|
/* harmony import */ var leaflet_markercluster__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! leaflet.markercluster */ "./node_modules/leaflet.markercluster/dist/leaflet.markercluster-src.js"); |
|
|
|
|
/* harmony import */ var leaflet_markercluster__WEBPACK_IMPORTED_MODULE_10___default = /*#__PURE__*/__webpack_require__.n(leaflet_markercluster__WEBPACK_IMPORTED_MODULE_10__); |
|
|
|
|
/* harmony import */ var _components_GlobalMapPage__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! ./components/GlobalMapPage */ "./src/forum/components/GlobalMapPage.tsx"); |
|
|
|
|
/* harmony import */ var _less_forum_less__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! ./../../../less/forum.less */ "../less/forum.less"); |
|
|
|
|
/* harmony import */ var _node_modules_leaflet_dist_leaflet_css__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(/*! ./../../node_modules/leaflet/dist/leaflet.css */ "./node_modules/leaflet/dist/leaflet.css"); |
|
|
|
|
/* harmony import */ var _node_modules_leaflet_markercluster_dist_MarkerCluster_css__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(/*! ./../../node_modules/leaflet.markercluster/dist/MarkerCluster.css */ "./node_modules/leaflet.markercluster/dist/MarkerCluster.css"); |
|
|
|
|
/* harmony import */ var _node_modules_leaflet_markercluster_dist_MarkerCluster_Default_css__WEBPACK_IMPORTED_MODULE_15__ = __webpack_require__(/*! ./../../node_modules/leaflet.markercluster/dist/MarkerCluster.Default.css */ "./node_modules/leaflet.markercluster/dist/MarkerCluster.Default.css"); |
|
|
|
|
/* harmony import */ var _models_UserLocation__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./models/UserLocation */ "./src/forum/models/UserLocation.ts"); |
|
|
|
|
/* harmony import */ var flarum_forum_components_UserCard__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! flarum/forum/components/UserCard */ "flarum/forum/components/UserCard"); |
|
|
|
|
/* harmony import */ var flarum_forum_components_UserCard__WEBPACK_IMPORTED_MODULE_7___default = /*#__PURE__*/__webpack_require__.n(flarum_forum_components_UserCard__WEBPACK_IMPORTED_MODULE_7__); |
|
|
|
|
/* harmony import */ var flarum_forum_components_HeaderPrimary__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! flarum/forum/components/HeaderPrimary */ "flarum/forum/components/HeaderPrimary"); |
|
|
|
|
/* harmony import */ var flarum_forum_components_HeaderPrimary__WEBPACK_IMPORTED_MODULE_8___default = /*#__PURE__*/__webpack_require__.n(flarum_forum_components_HeaderPrimary__WEBPACK_IMPORTED_MODULE_8__); |
|
|
|
|
/* harmony import */ var flarum_common_components_Link__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! flarum/common/components/Link */ "flarum/common/components/Link"); |
|
|
|
|
/* harmony import */ var flarum_common_components_Link__WEBPACK_IMPORTED_MODULE_9___default = /*#__PURE__*/__webpack_require__.n(flarum_common_components_Link__WEBPACK_IMPORTED_MODULE_9__); |
|
|
|
|
/* harmony import */ var leaflet__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! leaflet */ "./node_modules/leaflet/dist/leaflet-src.js"); |
|
|
|
|
/* harmony import */ var leaflet__WEBPACK_IMPORTED_MODULE_10___default = /*#__PURE__*/__webpack_require__.n(leaflet__WEBPACK_IMPORTED_MODULE_10__); |
|
|
|
|
/* harmony import */ var leaflet_markercluster__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! leaflet.markercluster */ "./node_modules/leaflet.markercluster/dist/leaflet.markercluster-src.js"); |
|
|
|
|
/* harmony import */ var leaflet_markercluster__WEBPACK_IMPORTED_MODULE_11___default = /*#__PURE__*/__webpack_require__.n(leaflet_markercluster__WEBPACK_IMPORTED_MODULE_11__); |
|
|
|
|
/* harmony import */ var _components_GlobalMapPage__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! ./components/GlobalMapPage */ "./src/forum/components/GlobalMapPage.tsx"); |
|
|
|
|
/* harmony import */ var _less_forum_less__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(/*! ./../../../less/forum.less */ "../less/forum.less"); |
|
|
|
|
/* harmony import */ var _node_modules_leaflet_dist_leaflet_css__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(/*! ./../../node_modules/leaflet/dist/leaflet.css */ "./node_modules/leaflet/dist/leaflet.css"); |
|
|
|
|
/* harmony import */ var _node_modules_leaflet_markercluster_dist_MarkerCluster_css__WEBPACK_IMPORTED_MODULE_15__ = __webpack_require__(/*! ./../../node_modules/leaflet.markercluster/dist/MarkerCluster.css */ "./node_modules/leaflet.markercluster/dist/MarkerCluster.css"); |
|
|
|
|
/* harmony import */ var _node_modules_leaflet_markercluster_dist_MarkerCluster_Default_css__WEBPACK_IMPORTED_MODULE_16__ = __webpack_require__(/*! ./../../node_modules/leaflet.markercluster/dist/MarkerCluster.Default.css */ "./node_modules/leaflet.markercluster/dist/MarkerCluster.Default.css"); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -16591,11 +16608,12 @@ flarum_forum_app__WEBPACK_IMPORTED_MODULE_0___default().initializers.add('justov
|
|
|
|
|
(flarum_common_models_User__WEBPACK_IMPORTED_MODULE_3___default().prototype).location_city = flarum_common_Model__WEBPACK_IMPORTED_MODULE_4___default().attribute('location_city'); |
|
|
|
|
(flarum_common_models_User__WEBPACK_IMPORTED_MODULE_3___default().prototype).location_latitude = flarum_common_Model__WEBPACK_IMPORTED_MODULE_4___default().attribute('location_latitude'); |
|
|
|
|
(flarum_common_models_User__WEBPACK_IMPORTED_MODULE_3___default().prototype).location_longitude = flarum_common_Model__WEBPACK_IMPORTED_MODULE_4___default().attribute('location_longitude'); |
|
|
|
|
app.store.models.userlocations = _models_UserLocation__WEBPACK_IMPORTED_MODULE_6__["default"]; |
|
|
|
|
app.routes['justoverclock.global-map'] = { |
|
|
|
|
path: '/global-map', |
|
|
|
|
component: _components_GlobalMapPage__WEBPACK_IMPORTED_MODULE_11__["default"] |
|
|
|
|
component: _components_GlobalMapPage__WEBPACK_IMPORTED_MODULE_12__["default"] |
|
|
|
|
}; |
|
|
|
|
(0,flarum_common_extend__WEBPACK_IMPORTED_MODULE_1__.extend)((flarum_forum_components_UserCard__WEBPACK_IMPORTED_MODULE_6___default().prototype), 'infoItems', function (items) { |
|
|
|
|
(0,flarum_common_extend__WEBPACK_IMPORTED_MODULE_1__.extend)((flarum_forum_components_UserCard__WEBPACK_IMPORTED_MODULE_7___default().prototype), 'infoItems', function (items) { |
|
|
|
|
var user = this.attrs.user; |
|
|
|
|
|
|
|
|
|
if (user.location_latitude()) { |
|
|
|
@ -16604,7 +16622,7 @@ flarum_forum_app__WEBPACK_IMPORTED_MODULE_0___default().initializers.add('justov
|
|
|
|
|
}), -100); |
|
|
|
|
} |
|
|
|
|
}); |
|
|
|
|
(0,flarum_common_extend__WEBPACK_IMPORTED_MODULE_1__.extend)((flarum_forum_components_UserCard__WEBPACK_IMPORTED_MODULE_6___default().prototype), 'oncreate', function (originalResult, vnode) { |
|
|
|
|
(0,flarum_common_extend__WEBPACK_IMPORTED_MODULE_1__.extend)((flarum_forum_components_UserCard__WEBPACK_IMPORTED_MODULE_7___default().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'; |
|
|
|
@ -16652,7 +16670,7 @@ flarum_forum_app__WEBPACK_IMPORTED_MODULE_0___default().initializers.add('justov
|
|
|
|
|
items.add('location', m(_components_AddLocationComponent__WEBPACK_IMPORTED_MODULE_5__["default"], null)); |
|
|
|
|
}); |
|
|
|
|
}); |
|
|
|
|
(0,flarum_common_extend__WEBPACK_IMPORTED_MODULE_1__.extend)((flarum_forum_components_HeaderPrimary__WEBPACK_IMPORTED_MODULE_7___default().prototype), 'onupdate', function () { |
|
|
|
|
(0,flarum_common_extend__WEBPACK_IMPORTED_MODULE_1__.extend)((flarum_forum_components_HeaderPrimary__WEBPACK_IMPORTED_MODULE_8___default().prototype), 'onupdate', function () { |
|
|
|
|
var homeLink = document.getElementById('home-link'); |
|
|
|
|
|
|
|
|
|
if (homeLink) { |
|
|
|
@ -16664,7 +16682,7 @@ flarum_forum_app__WEBPACK_IMPORTED_MODULE_0___default().initializers.add('justov
|
|
|
|
|
globalMapLink = document.createElement('span'); |
|
|
|
|
globalMapLink.setAttribute('id', 'global-map-link'); |
|
|
|
|
(_homeLink$parentEleme = homeLink.parentElement) == null ? void 0 : _homeLink$parentEleme.append(globalMapLink); |
|
|
|
|
m.render(globalMapLink, m((flarum_common_components_Link__WEBPACK_IMPORTED_MODULE_8___default()), { |
|
|
|
|
m.render(globalMapLink, m((flarum_common_components_Link__WEBPACK_IMPORTED_MODULE_9___default()), { |
|
|
|
|
href: "/global-map", |
|
|
|
|
id: "map-link", |
|
|
|
|
"class": "Button Button--primary" |
|
|
|
@ -16674,6 +16692,48 @@ flarum_forum_app__WEBPACK_IMPORTED_MODULE_0___default().initializers.add('justov
|
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/***/ }), |
|
|
|
|
|
|
|
|
|
/***/ "./src/forum/models/UserLocation.ts": |
|
|
|
|
/*!******************************************!*\ |
|
|
|
|
!*** ./src/forum/models/UserLocation.ts ***! |
|
|
|
|
\******************************************/ |
|
|
|
|
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { |
|
|
|
|
|
|
|
|
|
"use strict"; |
|
|
|
|
__webpack_require__.r(__webpack_exports__); |
|
|
|
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, { |
|
|
|
|
/* harmony export */ "default": () => (/* binding */ UserLocation) |
|
|
|
|
/* harmony export */ }); |
|
|
|
|
/* harmony import */ var _babel_runtime_helpers_esm_inheritsLoose__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @babel/runtime/helpers/esm/inheritsLoose */ "./node_modules/@babel/runtime/helpers/esm/inheritsLoose.js"); |
|
|
|
|
/* harmony import */ var flarum_common_Model__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! flarum/common/Model */ "flarum/common/Model"); |
|
|
|
|
/* harmony import */ var flarum_common_Model__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(flarum_common_Model__WEBPACK_IMPORTED_MODULE_1__); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var UserLocation = /*#__PURE__*/function (_Model) { |
|
|
|
|
(0,_babel_runtime_helpers_esm_inheritsLoose__WEBPACK_IMPORTED_MODULE_0__["default"])(UserLocation, _Model); |
|
|
|
|
|
|
|
|
|
function UserLocation() { |
|
|
|
|
var _this; |
|
|
|
|
|
|
|
|
|
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) { |
|
|
|
|
args[_key] = arguments[_key]; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
_this = _Model.call.apply(_Model, [this].concat(args)) || this; |
|
|
|
|
_this.username = flarum_common_Model__WEBPACK_IMPORTED_MODULE_1___default().attribute('username'); |
|
|
|
|
_this.displayName = flarum_common_Model__WEBPACK_IMPORTED_MODULE_1___default().attribute('displayName'); |
|
|
|
|
_this.location_latitude = flarum_common_Model__WEBPACK_IMPORTED_MODULE_1___default().attribute('location_latitude'); |
|
|
|
|
_this.location_longitude = flarum_common_Model__WEBPACK_IMPORTED_MODULE_1___default().attribute('location_longitude'); |
|
|
|
|
return _this; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
return UserLocation; |
|
|
|
|
}((flarum_common_Model__WEBPACK_IMPORTED_MODULE_1___default())); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/***/ }), |
|
|
|
|
|
|
|
|
|
/***/ "./node_modules/leaflet.markercluster/dist/MarkerCluster.Default.css": |
|
|
|
|