From 074bf675c4a06f5fef169b69b9707388da68bae8 Mon Sep 17 00:00:00 2001 From: Yohan Boniface Date: Thu, 8 Feb 2024 15:52:49 +0100 Subject: [PATCH] chore: replace window.L.U by window.U --- umap/static/umap/js/components/fragment.js | 2 +- umap/static/umap/js/modules/browser.js | 8 +- umap/static/umap/js/modules/global.js | 2 +- umap/static/umap/js/umap.autocomplete.js | 44 +++---- umap/static/umap/js/umap.controls.js | 108 ++++++++--------- umap/static/umap/js/umap.core.js | 6 +- .../umap/js/umap.datalayer.permissions.js | 4 +- umap/static/umap/js/umap.features.js | 94 +++++++-------- umap/static/umap/js/umap.forms.js | 20 ++-- umap/static/umap/js/umap.icon.js | 34 +++--- umap/static/umap/js/umap.importer.js | 2 +- umap/static/umap/js/umap.js | 110 +++++++++--------- umap/static/umap/js/umap.layer.js | 52 ++++----- umap/static/umap/js/umap.permissions.js | 4 +- umap/static/umap/js/umap.popup.js | 28 ++--- umap/static/umap/js/umap.share.js | 8 +- umap/static/umap/js/umap.slideshow.js | 6 +- umap/static/umap/js/umap.tableeditor.js | 4 +- umap/static/umap/js/umap.ui.js | 2 +- umap/static/umap/test/Choropleth.js | 2 +- umap/static/umap/test/DataLayer.js | 2 +- umap/static/umap/test/Feature.js | 2 +- umap/static/umap/test/Map.Export.js | 2 +- umap/static/umap/test/Map.js | 2 +- umap/static/umap/test/Marker.js | 8 +- umap/static/umap/test/Polygon.js | 54 ++++----- umap/static/umap/test/Polyline.js | 62 +++++----- umap/static/umap/test/_pre.js | 2 +- umap/templates/umap/content.html | 4 +- umap/templates/umap/map_init.html | 2 +- 30 files changed, 340 insertions(+), 340 deletions(-) diff --git a/umap/static/umap/js/components/fragment.js b/umap/static/umap/js/components/fragment.js index 652ca826..63613ca1 100644 --- a/umap/static/umap/js/components/fragment.js +++ b/umap/static/umap/js/components/fragment.js @@ -1,6 +1,6 @@ class UmapFragment extends HTMLElement { connectedCallback() { - new L.U.Map(this.firstElementChild.id, JSON.parse(this.dataset.settings)) + new U.Map(this.firstElementChild.id, JSON.parse(this.dataset.settings)) } } diff --git a/umap/static/umap/js/modules/browser.js b/umap/static/umap/js/modules/browser.js index a4e7fedb..c3370acf 100644 --- a/umap/static/umap/js/modules/browser.js +++ b/umap/static/umap/js/modules/browser.js @@ -22,7 +22,7 @@ export default class Browser { colorBox = DomUtil.create('i', 'feature-color', feature_li), title = DomUtil.create('span', 'feature-title', feature_li), symbol = feature._getIconUrl - ? L.U.Icon.prototype.formatUrl(feature._getIconUrl(), feature) + ? U.Icon.prototype.formatUrl(feature._getIconUrl(), feature) : null zoom_to.title = L._('Bring feature to center') edit.title = L._('Edit this feature') @@ -31,8 +31,8 @@ export default class Browser { const bgcolor = feature.getDynamicOption('color') colorBox.style.backgroundColor = bgcolor if (symbol && symbol !== this.map.options.default_iconUrl) { - const icon = L.U.Icon.makeIconElement(symbol, colorBox) - L.U.Icon.setIconContrast(icon, colorBox, symbol, bgcolor) + const icon = U.Icon.makeIconElement(symbol, colorBox) + U.Icon.setIconContrast(icon, colorBox, symbol, bgcolor) } DomEvent.on( zoom_to, @@ -141,7 +141,7 @@ export default class Browser { ['options.filter', { handler: 'Input', placeholder: L._('Filter') }], ['options.inBbox', { handler: 'Switch', label: L._('Current map view') }], ] - const builder = new L.U.FormBuilder(this, fields, { + const builder = new U.FormBuilder(this, fields, { makeDirty: false, callback: () => this.onFormChange(), }) diff --git a/umap/static/umap/js/modules/global.js b/umap/static/umap/js/modules/global.js index 85fff749..c7fce53f 100644 --- a/umap/static/umap/js/modules/global.js +++ b/umap/static/umap/js/modules/global.js @@ -7,4 +7,4 @@ import { Request, ServerRequest, RequestError, HTTPError, NOKError } from './req // Copy the leaflet module, it's expected by leaflet plugins to be writeable. window.L = { ...L } -window.L.U = { URLs, Request, ServerRequest, RequestError, HTTPError, NOKError, Browser } +window.U = { URLs, Request, ServerRequest, RequestError, HTTPError, NOKError, Browser } diff --git a/umap/static/umap/js/umap.autocomplete.js b/umap/static/umap/js/umap.autocomplete.js index f86c93a0..3da1bdeb 100644 --- a/umap/static/umap/js/umap.autocomplete.js +++ b/umap/static/umap/js/umap.autocomplete.js @@ -1,4 +1,4 @@ -L.U.AutoComplete = L.Class.extend({ +U.AutoComplete = L.Class.extend({ options: { placeholder: 'Start typing...', emptyMessage: 'No result', @@ -12,8 +12,8 @@ L.U.AutoComplete = L.Class.extend({ initialize: function (el, options) { this.el = el - const ui = new L.U.UI(document.querySelector('header')) - this.server = new L.U.ServerRequest(ui) + const ui = new U.UI(document.querySelector('header')) + this.server = new U.ServerRequest(ui) L.setOptions(this, options) let CURRENT = null try { @@ -69,19 +69,19 @@ L.U.AutoComplete = L.Class.extend({ onKeyDown: function (e) { switch (e.keyCode) { - case L.U.Keys.TAB: + case U.Keys.TAB: if (this.CURRENT !== null) this.setChoice() L.DomEvent.stop(e) break - case L.U.Keys.ENTER: + case U.Keys.ENTER: L.DomEvent.stop(e) this.setChoice() break - case L.U.Keys.ESC: + case U.Keys.ESC: L.DomEvent.stop(e) this.hide() break - case L.U.Keys.DOWN: + case U.Keys.DOWN: if (this.RESULTS.length > 0) { if (this.CURRENT !== null && this.CURRENT < this.RESULTS.length - 1) { // what if one result? @@ -93,7 +93,7 @@ L.U.AutoComplete = L.Class.extend({ } } break - case L.U.Keys.UP: + case U.Keys.UP: if (this.CURRENT !== null) { L.DomEvent.stop(e) } @@ -112,16 +112,16 @@ L.U.AutoComplete = L.Class.extend({ onKeyUp: function (e) { const special = [ - L.U.Keys.TAB, - L.U.Keys.ENTER, - L.U.Keys.LEFT, - L.U.Keys.RIGHT, - L.U.Keys.DOWN, - L.U.Keys.UP, - L.U.Keys.APPLE, - L.U.Keys.SHIFT, - L.U.Keys.ALT, - L.U.Keys.CTRL, + U.Keys.TAB, + U.Keys.ENTER, + U.Keys.LEFT, + U.Keys.RIGHT, + U.Keys.DOWN, + U.Keys.UP, + U.Keys.APPLE, + U.Keys.SHIFT, + U.Keys.ALT, + U.Keys.CTRL, ] if (special.indexOf(e.keyCode) === -1) { this.search() @@ -255,9 +255,9 @@ L.U.AutoComplete = L.Class.extend({ }, }) -L.U.AutoComplete.Ajax = L.U.AutoComplete.extend({ +U.AutoComplete.Ajax = U.AutoComplete.extend({ initialize: function (el, options) { - L.U.AutoComplete.prototype.initialize.call(this, el, options) + U.AutoComplete.prototype.initialize.call(this, el, options) if (!this.el) return this this.createInput() this.createContainer() @@ -272,7 +272,7 @@ L.U.AutoComplete.Ajax = L.U.AutoComplete.extend({ }, }) -L.U.AutoComplete.Ajax.SelectMultiple = L.U.AutoComplete.Ajax.extend({ +U.AutoComplete.Ajax.SelectMultiple = U.AutoComplete.Ajax.extend({ initSelectedContainer: function () { return L.DomUtil.after( this.input, @@ -298,7 +298,7 @@ L.U.AutoComplete.Ajax.SelectMultiple = L.U.AutoComplete.Ajax.extend({ }, }) -L.U.AutoComplete.Ajax.Select = L.U.AutoComplete.Ajax.extend({ +U.AutoComplete.Ajax.Select = U.AutoComplete.Ajax.extend({ initSelectedContainer: function () { return L.DomUtil.after( this.input, diff --git a/umap/static/umap/js/umap.controls.js b/umap/static/umap/js/umap.controls.js index 60c3999c..b76daccc 100644 --- a/umap/static/umap/js/umap.controls.js +++ b/umap/static/umap/js/umap.controls.js @@ -1,4 +1,4 @@ -L.U.BaseAction = L.ToolbarAction.extend({ +U.BaseAction = L.ToolbarAction.extend({ initialize: function (map) { this.map = map if (this.options.label) { @@ -17,7 +17,7 @@ L.U.BaseAction = L.ToolbarAction.extend({ }, }) -L.U.ImportAction = L.U.BaseAction.extend({ +U.ImportAction = U.BaseAction.extend({ options: { helpMenu: true, className: 'upload-data dark', @@ -29,7 +29,7 @@ L.U.ImportAction = L.U.BaseAction.extend({ }, }) -L.U.EditPropertiesAction = L.U.BaseAction.extend({ +U.EditPropertiesAction = U.BaseAction.extend({ options: { helpMenu: true, className: 'update-map-settings dark', @@ -41,7 +41,7 @@ L.U.EditPropertiesAction = L.U.BaseAction.extend({ }, }) -L.U.ChangeTileLayerAction = L.U.BaseAction.extend({ +U.ChangeTileLayerAction = U.BaseAction.extend({ options: { helpMenu: true, className: 'dark update-map-tilelayers', @@ -53,7 +53,7 @@ L.U.ChangeTileLayerAction = L.U.BaseAction.extend({ }, }) -L.U.ManageDatalayersAction = L.U.BaseAction.extend({ +U.ManageDatalayersAction = U.BaseAction.extend({ options: { className: 'dark manage-datalayers', tooltip: L._('Manage layers'), @@ -64,7 +64,7 @@ L.U.ManageDatalayersAction = L.U.BaseAction.extend({ }, }) -L.U.UpdateExtentAction = L.U.BaseAction.extend({ +U.UpdateExtentAction = U.BaseAction.extend({ options: { className: 'update-map-extent dark', tooltip: L._('Save this center and zoom'), @@ -75,7 +75,7 @@ L.U.UpdateExtentAction = L.U.BaseAction.extend({ }, }) -L.U.UpdatePermsAction = L.U.BaseAction.extend({ +U.UpdatePermsAction = U.BaseAction.extend({ options: { className: 'update-map-permissions dark', tooltip: L._('Update permissions and editors'), @@ -86,7 +86,7 @@ L.U.UpdatePermsAction = L.U.BaseAction.extend({ }, }) -L.U.DrawMarkerAction = L.U.BaseAction.extend({ +U.DrawMarkerAction = U.BaseAction.extend({ options: { helpMenu: true, className: 'umap-draw-marker dark', @@ -98,7 +98,7 @@ L.U.DrawMarkerAction = L.U.BaseAction.extend({ }, }) -L.U.DrawPolylineAction = L.U.BaseAction.extend({ +U.DrawPolylineAction = U.BaseAction.extend({ options: { helpMenu: true, className: 'umap-draw-polyline dark', @@ -110,7 +110,7 @@ L.U.DrawPolylineAction = L.U.BaseAction.extend({ }, }) -L.U.DrawPolygonAction = L.U.BaseAction.extend({ +U.DrawPolygonAction = U.BaseAction.extend({ options: { helpMenu: true, className: 'umap-draw-polygon dark', @@ -122,7 +122,7 @@ L.U.DrawPolygonAction = L.U.BaseAction.extend({ }, }) -L.U.AddPolylineShapeAction = L.U.BaseAction.extend({ +U.AddPolylineShapeAction = U.BaseAction.extend({ options: { className: 'umap-draw-polyline-multi dark', tooltip: L._('Add a line to the current multi'), @@ -133,14 +133,14 @@ L.U.AddPolylineShapeAction = L.U.BaseAction.extend({ }, }) -L.U.AddPolygonShapeAction = L.U.AddPolylineShapeAction.extend({ +U.AddPolygonShapeAction = U.AddPolylineShapeAction.extend({ options: { className: 'umap-draw-polygon-multi dark', tooltip: L._('Add a polygon to the current multi'), }, }) -L.U.BaseFeatureAction = L.ToolbarAction.extend({ +U.BaseFeatureAction = L.ToolbarAction.extend({ initialize: function (map, feature, latlng) { this.map = map this.feature = feature @@ -161,7 +161,7 @@ L.U.BaseFeatureAction = L.ToolbarAction.extend({ }, }) -L.U.CreateHoleAction = L.U.BaseFeatureAction.extend({ +U.CreateHoleAction = U.BaseFeatureAction.extend({ options: { toolbarIcon: { className: 'umap-new-hole', @@ -174,7 +174,7 @@ L.U.CreateHoleAction = L.U.BaseFeatureAction.extend({ }, }) -L.U.ToggleEditAction = L.U.BaseFeatureAction.extend({ +U.ToggleEditAction = U.BaseFeatureAction.extend({ options: { toolbarIcon: { className: 'umap-toggle-edit', @@ -188,7 +188,7 @@ L.U.ToggleEditAction = L.U.BaseFeatureAction.extend({ }, }) -L.U.DeleteFeatureAction = L.U.BaseFeatureAction.extend({ +U.DeleteFeatureAction = U.BaseFeatureAction.extend({ options: { toolbarIcon: { className: 'umap-delete-all', @@ -206,7 +206,7 @@ L.U.DeleteFeatureAction = L.U.BaseFeatureAction.extend({ }, }) -L.U.DeleteShapeAction = L.U.BaseFeatureAction.extend({ +U.DeleteShapeAction = U.BaseFeatureAction.extend({ options: { toolbarIcon: { className: 'umap-delete-one-of-multi', @@ -219,7 +219,7 @@ L.U.DeleteShapeAction = L.U.BaseFeatureAction.extend({ }, }) -L.U.ExtractShapeFromMultiAction = L.U.BaseFeatureAction.extend({ +U.ExtractShapeFromMultiAction = U.BaseFeatureAction.extend({ options: { toolbarIcon: { className: 'umap-extract-shape-from-multi', @@ -232,14 +232,14 @@ L.U.ExtractShapeFromMultiAction = L.U.BaseFeatureAction.extend({ }, }) -L.U.BaseVertexAction = L.U.BaseFeatureAction.extend({ +U.BaseVertexAction = U.BaseFeatureAction.extend({ initialize: function (map, feature, latlng, vertex) { this.vertex = vertex - L.U.BaseFeatureAction.prototype.initialize.call(this, map, feature, latlng) + U.BaseFeatureAction.prototype.initialize.call(this, map, feature, latlng) }, }) -L.U.DeleteVertexAction = L.U.BaseVertexAction.extend({ +U.DeleteVertexAction = U.BaseVertexAction.extend({ options: { toolbarIcon: { className: 'umap-delete-vertex', @@ -252,7 +252,7 @@ L.U.DeleteVertexAction = L.U.BaseVertexAction.extend({ }, }) -L.U.SplitLineAction = L.U.BaseVertexAction.extend({ +U.SplitLineAction = U.BaseVertexAction.extend({ options: { toolbarIcon: { className: 'umap-split-line', @@ -265,7 +265,7 @@ L.U.SplitLineAction = L.U.BaseVertexAction.extend({ }, }) -L.U.ContinueLineAction = L.U.BaseVertexAction.extend({ +U.ContinueLineAction = U.BaseVertexAction.extend({ options: { toolbarIcon: { className: 'umap-continue-line', @@ -279,13 +279,13 @@ L.U.ContinueLineAction = L.U.BaseVertexAction.extend({ }) // Leaflet.Toolbar doesn't allow twice same toolbar class… -L.U.SettingsToolbar = L.Toolbar.Control.extend({ +U.SettingsToolbar = L.Toolbar.Control.extend({ addTo: function (map) { if (map.options.editMode !== 'advanced') return L.Toolbar.Control.prototype.addTo.call(this, map) }, }) -L.U.DrawToolbar = L.Toolbar.Control.extend({ +U.DrawToolbar = L.Toolbar.Control.extend({ initialize: function (options) { L.Toolbar.Control.prototype.initialize.call(this, options) this.map = this.options.map @@ -295,18 +295,18 @@ L.U.DrawToolbar = L.Toolbar.Control.extend({ appendToContainer: function (container) { this.options.actions = [] if (this.map.options.enableMarkerDraw) { - this.options.actions.push(L.U.DrawMarkerAction) + this.options.actions.push(U.DrawMarkerAction) } if (this.map.options.enablePolylineDraw) { - this.options.actions.push(L.U.DrawPolylineAction) - if (this.map.editedFeature && this.map.editedFeature instanceof L.U.Polyline) { - this.options.actions.push(L.U.AddPolylineShapeAction) + this.options.actions.push(U.DrawPolylineAction) + if (this.map.editedFeature && this.map.editedFeature instanceof U.Polyline) { + this.options.actions.push(U.AddPolylineShapeAction) } } if (this.map.options.enablePolygonDraw) { - this.options.actions.push(L.U.DrawPolygonAction) - if (this.map.editedFeature && this.map.editedFeature instanceof L.U.Polygon) { - this.options.actions.push(L.U.AddPolygonShapeAction) + this.options.actions.push(U.DrawPolygonAction) + if (this.map.editedFeature && this.map.editedFeature instanceof U.Polygon) { + this.options.actions.push(U.AddPolygonShapeAction) } } L.Toolbar.Control.prototype.appendToContainer.call(this, container) @@ -319,7 +319,7 @@ L.U.DrawToolbar = L.Toolbar.Control.extend({ }, }) -L.U.DropControl = L.Class.extend({ +U.DropControl = L.Class.extend({ initialize: function (map) { this.map = map this.dropzone = map._container @@ -365,7 +365,7 @@ L.U.DropControl = L.Class.extend({ }, }) -L.U.EditControl = L.Control.extend({ +U.EditControl = L.Control.extend({ options: { position: 'topright', }, @@ -418,7 +418,7 @@ L.Control.Embed = L.Control.extend({ }, }) -L.U.MoreControls = L.Control.extend({ +U.MoreControls = L.Control.extend({ options: { position: 'topleft', }, @@ -451,7 +451,7 @@ L.U.MoreControls = L.Control.extend({ }, }) -L.U.PermanentCreditsControl = L.Control.extend({ +U.PermanentCreditsControl = L.Control.extend({ options: { position: 'bottomleft', }, @@ -488,7 +488,7 @@ L.U.PermanentCreditsControl = L.Control.extend({ }, }) -L.U.DataLayersControl = L.Control.extend({ +U.DataLayersControl = L.Control.extend({ options: { position: 'topleft', }, @@ -626,7 +626,7 @@ L.U.DataLayersControl = L.Control.extend({ this.map.eachDataLayerReverse(function (datalayer) { this.addDataLayer(container, datalayer, true) }, this) - const orderable = new L.U.Orderable(container) + const orderable = new U.Orderable(container) orderable.on( 'drop', function (e) { @@ -659,7 +659,7 @@ L.U.DataLayersControl = L.Control.extend({ }, }) -L.U.DataLayer.include({ +U.DataLayer.include({ renderLegend: function (container) { if (this.layer.renderLegend) return this.layer.renderLegend(container) const color = L.DomUtil.create('span', 'datalayer-color', container) @@ -733,7 +733,7 @@ L.U.DataLayer.include({ }, }) -L.U.DataLayer.addInitHook(function () { +U.DataLayer.addInitHook(function () { this.on('hide', this.propagateHide) this.on('show', this.propagateShow) if (this.isVisible()) this.propagateShow() @@ -794,7 +794,7 @@ const ControlsMixin = { label: this.getFacetKeys()[current], }, ]) - const builder = new L.U.FormBuilder(this, fields, { + const builder = new U.FormBuilder(this, fields, { makeDirty: false, callback: filterFeatures, callbackContext: this, @@ -1058,7 +1058,7 @@ const ControlsMixin = { } /* Used in view mode to define the current tilelayer */ -L.U.TileLayerControl = L.Control.IconLayers.extend({ +U.TileLayerControl = L.Control.IconLayers.extend({ initialize: function (map, options) { this.map = map L.Control.IconLayers.prototype.initialize.call(this, { @@ -1099,7 +1099,7 @@ L.U.TileLayerControl = L.Control.IconLayers.extend({ }) /* Used in edit mode to define the default tilelayer */ -L.U.TileLayerChooser = L.Control.extend({ +U.TileLayerChooser = L.Control.extend({ options: { position: 'topleft', }, @@ -1166,7 +1166,7 @@ L.U.TileLayerChooser = L.Control.extend({ }, }) -L.U.AttributionControl = L.Control.Attribution.extend({ +U.AttributionControl = L.Control.Attribution.extend({ options: { prefix: '', }, @@ -1214,7 +1214,7 @@ L.U.AttributionControl = L.Control.Attribution.extend({ }, }) -L.U.StarControl = L.Control.extend({ +U.StarControl = L.Control.extend({ options: { position: 'topleft', }, @@ -1237,7 +1237,7 @@ L.U.StarControl = L.Control.extend({ }, }) -L.U.Search = L.PhotonSearch.extend({ +U.Search = L.PhotonSearch.extend({ initialize: function (map, input, options) { this.options.placeholder = L._('Type a place name or coordinates') L.PhotonSearch.prototype.initialize.call(this, map, input, options) @@ -1324,7 +1324,7 @@ L.U.Search = L.PhotonSearch.extend({ }, }) -L.U.SearchControl = L.Control.extend({ +U.SearchControl = L.Control.extend({ options: { position: 'topleft', }, @@ -1357,7 +1357,7 @@ L.U.SearchControl = L.Control.extend({ title.textContent = L._('Search location') const input = L.DomUtil.create('input', 'photon-input', container) const resultsContainer = L.DomUtil.create('div', 'photon-autocomplete', container) - this.search = new L.U.Search(map, input, options) + this.search = new U.Search(map, input, options) const id = Math.random() this.search.on('ajax:send', () => { map.fire('dataloading', { id: id }) @@ -1413,7 +1413,7 @@ L.Control.Loading.include({ /* * Make it dynamic */ -L.U.ContextMenu = L.Map.ContextMenu.extend({ +U.ContextMenu = L.Map.ContextMenu.extend({ _createItems: function (e) { this._map.setContextMenuItems(e) L.Map.ContextMenu.prototype._createItems.call(this) @@ -1427,7 +1427,7 @@ L.U.ContextMenu = L.Map.ContextMenu.extend({ }, }) -L.U.Editable = L.Editable.extend({ +U.Editable = L.Editable.extend({ initialize: function (map, options) { L.Editable.prototype.initialize.call(this, map, options) this.on( @@ -1443,7 +1443,7 @@ L.U.Editable = L.Editable.extend({ }) // Layer for items added by users this.on('editable:drawing:cancel', (e) => { - if (e.layer instanceof L.U.Marker) e.layer.del() + if (e.layer instanceof U.Marker) e.layer.del() }) this.on('editable:drawing:commit', function (e) { e.layer.isDirty = true @@ -1469,15 +1469,15 @@ L.U.Editable = L.Editable.extend({ }, createPolyline: function (latlngs) { - return new L.U.Polyline(this.map, latlngs, this._getDefaultProperties()) + return new U.Polyline(this.map, latlngs, this._getDefaultProperties()) }, createPolygon: function (latlngs) { - return new L.U.Polygon(this.map, latlngs, this._getDefaultProperties()) + return new U.Polygon(this.map, latlngs, this._getDefaultProperties()) }, createMarker: function (latlng) { - return new L.U.Marker(this.map, latlng, this._getDefaultProperties()) + return new U.Marker(this.map, latlng, this._getDefaultProperties()) }, _getDefaultProperties: function () { diff --git a/umap/static/umap/js/umap.core.js b/umap/static/umap/js/umap.core.js index d7f0f859..092018d3 100644 --- a/umap/static/umap/js/umap.core.js +++ b/umap/static/umap/js/umap.core.js @@ -435,7 +435,7 @@ L.DomEvent.once = (el, types, fn, context) => { /* * Global events */ -L.U.Keys = { +U.Keys = { LEFT: 37, UP: 38, RIGHT: 39, @@ -459,7 +459,7 @@ L.U.Keys = { Z: 90, } -L.U.Help = L.Class.extend({ +U.Help = L.Class.extend({ SHORTCUTS: { DRAW_MARKER: { shortcut: 'Modifier+M', @@ -748,7 +748,7 @@ L.U.Help = L.Class.extend({ ), }) -L.U.Orderable = L.Evented.extend({ +U.Orderable = L.Evented.extend({ options: { selector: 'li', color: '#374E75', diff --git a/umap/static/umap/js/umap.datalayer.permissions.js b/umap/static/umap/js/umap.datalayer.permissions.js index 8ac2a2d7..f50706d9 100644 --- a/umap/static/umap/js/umap.datalayer.permissions.js +++ b/umap/static/umap/js/umap.datalayer.permissions.js @@ -1,4 +1,4 @@ -L.U.DataLayerPermissions = L.Class.extend({ +U.DataLayerPermissions = L.Class.extend({ options: { edit_status: null, }, @@ -38,7 +38,7 @@ L.U.DataLayerPermissions = L.Class.extend({ }, ], ], - builder = new L.U.FormBuilder(this, fields, { + builder = new U.FormBuilder(this, fields, { className: 'umap-form datalayer-permissions', }), form = builder.build() diff --git a/umap/static/umap/js/umap.features.js b/umap/static/umap/js/umap.features.js index dc98448c..fecbba57 100644 --- a/umap/static/umap/js/umap.features.js +++ b/umap/static/umap/js/umap.features.js @@ -1,4 +1,4 @@ -L.U.FeatureMixin = { +U.FeatureMixin = { staticOptions: { mainColor: 'color' }, initialize: function (map, latlng, options) { @@ -94,7 +94,7 @@ L.U.FeatureMixin = { L._('Feature properties') ) - let builder = new L.U.FormBuilder(this, ['datalayer'], { + let builder = new U.FormBuilder(this, ['datalayer'], { callback: function () { this.edit(e) }, // removeLayer step will close the edit panel, let's reopen it @@ -113,7 +113,7 @@ L.U.FeatureMixin = { // We always want name and description for now (properties management to come) properties.unshift('properties.description') properties.unshift('properties.name') - builder = new L.U.FormBuilder(this, properties, { + builder = new U.FormBuilder(this, properties, { id: 'umap-feature-properties', callback: this._redraw, // In case we have dynamic options… }) @@ -144,7 +144,7 @@ L.U.FeatureMixin = { appendEditFieldsets: function (container) { const optionsFields = this.getShapeOptions() - let builder = new L.U.FormBuilder(this, optionsFields, { + let builder = new U.FormBuilder(this, optionsFields, { id: 'umap-feature-shape-properties', callback: this._redraw, }) @@ -152,7 +152,7 @@ L.U.FeatureMixin = { shapeProperties.appendChild(builder.build()) const advancedOptions = this.getAdvancedOptions() - builder = new L.U.FormBuilder(this, advancedOptions, { + builder = new U.FormBuilder(this, advancedOptions, { id: 'umap-feature-advanced-properties', callback: this._redraw, }) @@ -163,7 +163,7 @@ L.U.FeatureMixin = { advancedProperties.appendChild(builder.build()) const interactionOptions = this.getInteractionOptions() - builder = new L.U.FormBuilder(this, interactionOptions, { + builder = new U.FormBuilder(this, interactionOptions, { callback: this._redraw, }) const popupFieldset = L.DomUtil.createFieldset( @@ -205,7 +205,7 @@ L.U.FeatureMixin = { getPopupClass: function () { const old = this.getOption('popupTemplate') // Retrocompat. - return L.U.Popup[this.getOption('popupShape') || old] || L.U.Popup + return U.Popup[this.getOption('popupShape') || old] || U.Popup }, attachPopup: function () { @@ -382,7 +382,7 @@ L.U.FeatureMixin = { }, getInplaceToolbarActions: function (e) { - return [L.U.ToggleEditAction, L.U.DeleteFeatureAction] + return [U.ToggleEditAction, U.DeleteFeatureAction] }, _showContextMenu: function (e) { @@ -502,7 +502,7 @@ L.U.FeatureMixin = { }, getVertexActions: function () { - return [L.U.DeleteVertexAction] + return [U.DeleteVertexAction] }, isMulti: function () { @@ -539,9 +539,9 @@ L.U.FeatureMixin = { }, } -L.U.Marker = L.Marker.extend({ +U.Marker = L.Marker.extend({ parentClass: L.Marker, - includes: [L.U.FeatureMixin], + includes: [U.FeatureMixin], preInit: function () { this.setIcon(this.getIcon()) @@ -556,7 +556,7 @@ L.U.Marker = L.Marker.extend({ }, addInteractions: function () { - L.U.FeatureMixin.addInteractions.call(this) + U.FeatureMixin.addInteractions.call(this) this.on( 'dragend', function (e) { @@ -639,7 +639,7 @@ L.U.Marker = L.Marker.extend({ disconnectFromDataLayer: function (datalayer) { this.options.icon.datalayer = null - L.U.FeatureMixin.disconnectFromDataLayer.call(this, datalayer) + U.FeatureMixin.disconnectFromDataLayer.call(this, datalayer) }, _getIconUrl: function (name) { @@ -652,7 +652,7 @@ L.U.Marker = L.Marker.extend({ }, getIcon: function () { - const Class = L.U.Icon[this.getIconClass()] || L.U.Icon.Default + const Class = U.Icon[this.getIconClass()] || U.Icon.Default return new Class(this.map, { feature: this }) }, @@ -678,12 +678,12 @@ L.U.Marker = L.Marker.extend({ }, appendEditFieldsets: function (container) { - L.U.FeatureMixin.appendEditFieldsets.call(this, container) + U.FeatureMixin.appendEditFieldsets.call(this, container) const coordinatesOptions = [ ['_latlng.lat', { handler: 'FloatInput', label: L._('Latitude') }], ['_latlng.lng', { handler: 'FloatInput', label: L._('Longitude') }], ] - const builder = new L.U.FormBuilder(this, coordinatesOptions, { + const builder = new U.FormBuilder(this, coordinatesOptions, { callback: function () { if (!this._latlng.isValid()) { this.map.ui.alert({ @@ -707,7 +707,7 @@ L.U.Marker = L.Marker.extend({ // callback is mandatory for zoomToShowLayer this.datalayer.layer.zoomToShowLayer(this, e.callback || (() => {})) } else { - L.U.FeatureMixin.zoomTo.call(this, e) + U.FeatureMixin.zoomTo.call(this, e) } }, @@ -721,13 +721,13 @@ L.U.Marker = L.Marker.extend({ }, }) -L.U.PathMixin = { +U.PathMixin = { hasGeom: function () { return !this.isEmpty() }, connectToDataLayer: function (datalayer) { - L.U.FeatureMixin.connectToDataLayer.call(this, datalayer) + U.FeatureMixin.connectToDataLayer.call(this, datalayer) // We keep markers on their own layer on top of the paths. this.options.pane = this.datalayer.pane }, @@ -735,7 +735,7 @@ L.U.PathMixin = { edit: function (e) { if (this.map.editEnabled) { if (!this.editEnabled()) this.enableEdit() - L.U.FeatureMixin.edit.call(this, e) + U.FeatureMixin.edit.call(this, e) } }, @@ -816,7 +816,7 @@ L.U.PathMixin = { // this.map.off('showmeasure', this.showMeasureTooltip, this); // this.map.off('hidemeasure', this.removeTooltip, this); if (this.editing && this.editing.enabled()) this.editing.removeHooks() - L.U.FeatureMixin.onRemove.call(this, map) + U.FeatureMixin.onRemove.call(this, map) }, getBestZoom: function () { @@ -825,7 +825,7 @@ L.U.PathMixin = { endEdit: function () { this.disableEdit() - L.U.FeatureMixin.endEdit.call(this) + U.FeatureMixin.endEdit.call(this) }, highlightPath: function () { @@ -845,7 +845,7 @@ L.U.PathMixin = { }, addInteractions: function () { - L.U.FeatureMixin.addInteractions.call(this) + U.FeatureMixin.addInteractions.call(this) this.on('mouseover', this._onMouseOver) this.on('edit', this.makeDirty) this.on('drag editable:drag', this._onDrag) @@ -871,7 +871,7 @@ L.U.PathMixin = { this.disableEdit() if (!shape) return const properties = this.cloneProperties() - const other = new (this instanceof L.U.Polyline ? L.U.Polyline : L.U.Polygon)( + const other = new (this instanceof U.Polyline ? U.Polyline : U.Polygon)( this.map, shape, { geojson: { properties: properties } } @@ -882,7 +882,7 @@ L.U.PathMixin = { }, getContextMenuItems: function (e) { - let items = L.U.FeatureMixin.getContextMenuItems.call(this, e) + let items = U.FeatureMixin.getContextMenuItems.call(this, e) items.push({ text: L._('Display measure'), callback: function () { @@ -922,7 +922,7 @@ L.U.PathMixin = { }, getContextMenuEditItems: function (e) { - const items = L.U.FeatureMixin.getContextMenuEditItems.call(this, e) + const items = U.FeatureMixin.getContextMenuEditItems.call(this, e) if ( this.map.editedFeature && this.isSameClass(this.map.editedFeature) && @@ -949,10 +949,10 @@ L.U.PathMixin = { }, getInplaceToolbarActions: function (e) { - const items = L.U.FeatureMixin.getInplaceToolbarActions.call(this, e) + const items = U.FeatureMixin.getInplaceToolbarActions.call(this, e) if (this.isMulti()) { - items.push(L.U.DeleteShapeAction) - items.push(L.U.ExtractShapeFromMultiAction) + items.push(U.DeleteShapeAction) + items.push(U.ExtractShapeFromMultiAction) } return items }, @@ -975,9 +975,9 @@ L.U.PathMixin = { }, } -L.U.Polyline = L.Polyline.extend({ +U.Polyline = L.Polyline.extend({ parentClass: L.Polyline, - includes: [L.U.FeatureMixin, L.U.PathMixin], + includes: [U.FeatureMixin, U.PathMixin], staticOptions: { stroke: true, @@ -986,7 +986,7 @@ L.U.Polyline = L.Polyline.extend({ }, isSameClass: function (other) { - return other instanceof L.U.Polyline + return other instanceof U.Polyline }, getClassName: function () { @@ -999,7 +999,7 @@ L.U.Polyline = L.Polyline.extend({ }, getContextMenuEditItems: function (e) { - const items = L.U.PathMixin.getContextMenuEditItems.call(this, e) + const items = U.PathMixin.getContextMenuEditItems.call(this, e) const vertexClicked = e.vertex let index if (!this.isMulti()) { @@ -1029,7 +1029,7 @@ L.U.Polyline = L.Polyline.extend({ }, getContextMenuMultiItems: function (e) { - const items = L.U.PathMixin.getContextMenuMultiItems.call(this, e) + const items = U.PathMixin.getContextMenuMultiItems.call(this, e) items.push({ text: L._('Merge lines'), callback: this.mergeShapes, @@ -1050,7 +1050,7 @@ L.U.Polyline = L.Polyline.extend({ }, getAdvancedEditActions: function (container) { - L.U.FeatureMixin.getAdvancedEditActions.call(this, container) + U.FeatureMixin.getAdvancedEditActions.call(this, container) const toPolygon = L.DomUtil.createButton( 'button umap-to-polygon', container, @@ -1110,24 +1110,24 @@ L.U.Polyline = L.Polyline.extend({ }, getVertexActions: function (e) { - const actions = L.U.FeatureMixin.getVertexActions.call(this, e), + const actions = U.FeatureMixin.getVertexActions.call(this, e), index = e.vertex.getIndex() if (index === 0 || index === e.vertex.getLastIndex()) - actions.push(L.U.ContinueLineAction) - else actions.push(L.U.SplitLineAction) + actions.push(U.ContinueLineAction) + else actions.push(U.SplitLineAction) return actions }, }) -L.U.Polygon = L.Polygon.extend({ +U.Polygon = L.Polygon.extend({ parentClass: L.Polygon, - includes: [L.U.FeatureMixin, L.U.PathMixin], + includes: [U.FeatureMixin, U.PathMixin], staticOptions: { mainColor: 'fillColor', }, isSameClass: function (other) { - return other instanceof L.U.Polygon + return other instanceof U.Polygon }, getClassName: function () { @@ -1135,7 +1135,7 @@ L.U.Polygon = L.Polygon.extend({ }, getShapeOptions: function () { - const options = L.U.PathMixin.getShapeOptions() + const options = U.PathMixin.getShapeOptions() options.push( 'properties._umap_options.stroke', 'properties._umap_options.fill', @@ -1146,7 +1146,7 @@ L.U.Polygon = L.Polygon.extend({ }, getInteractionOptions: function () { - const options = L.U.FeatureMixin.getInteractionOptions() + const options = U.FeatureMixin.getInteractionOptions() options.push('properties._umap_options.interactive') return options }, @@ -1157,7 +1157,7 @@ L.U.Polygon = L.Polygon.extend({ }, getContextMenuEditItems: function (e) { - const items = L.U.PathMixin.getContextMenuEditItems.call(this, e), + const items = U.PathMixin.getContextMenuEditItems.call(this, e), shape = this.shapeAt(e.latlng) // No multi and no holes. if (shape && !this.isMulti() && (L.LineUtil.isFlat(shape) || shape.length === 1)) { @@ -1191,7 +1191,7 @@ L.U.Polygon = L.Polygon.extend({ }, getAdvancedEditActions: function (container) { - L.U.FeatureMixin.getAdvancedEditActions.call(this, container) + U.FeatureMixin.getAdvancedEditActions.call(this, container) const toPolyline = L.DomUtil.createButton( 'button umap-to-polyline', container, @@ -1211,8 +1211,8 @@ L.U.Polygon = L.Polygon.extend({ }, getInplaceToolbarActions: function (e) { - const items = L.U.PathMixin.getInplaceToolbarActions.call(this, e) - items.push(L.U.CreateHoleAction) + const items = U.PathMixin.getInplaceToolbarActions.call(this, e) + items.push(U.CreateHoleAction) return items }, }) diff --git a/umap/static/umap/js/umap.forms.js b/umap/static/umap/js/umap.forms.js index 10e44b2c..380c8e9a 100644 --- a/umap/static/umap/js/umap.forms.js +++ b/umap/static/umap/js/umap.forms.js @@ -379,10 +379,10 @@ L.FormBuilder.PopupContent = L.FormBuilder.Select.extend({ L.FormBuilder.LayerTypeChooser = L.FormBuilder.Select.extend({ getOptions: function () { const layer_classes = [ - L.U.Layer.Default, - L.U.Layer.Cluster, - L.U.Layer.Heat, - L.U.Layer.Choropleth, + U.Layer.Default, + U.Layer.Cluster, + U.Layer.Heat, + U.Layer.Choropleth, ] return layer_classes.map((class_) => [class_.TYPE, class_.NAME]) }, @@ -607,7 +607,7 @@ L.FormBuilder.IconUrl = L.FormBuilder.BlurInput.extend({ // Do not try to render URL with variables const box = L.DomUtil.create('div', 'umap-pictogram-choice', this.buttons) L.DomEvent.on(box, 'click', this.onDefine, this) - const icon = L.U.Icon.makeIconElement(this.value(), box) + const icon = U.Icon.makeIconElement(this.value(), box) } this.button = L.DomUtil.createButton( 'button action-button', @@ -707,7 +707,7 @@ L.FormBuilder.IconUrl = L.FormBuilder.BlurInput.extend({ showCharsTab: function () { this.openTab('chars') - const value = !L.U.Icon.isImg(this.value()) ? this.value() : null + const value = !U.Icon.isImg(this.value()) ? this.value() : null const input = this.buildInput(this.body, value) input.placeholder = L._('Type char or paste emoji') input.type = 'text' @@ -960,7 +960,7 @@ L.FormBuilder.ManageOwner = L.FormBuilder.Element.extend({ className: 'edit-owner', on_select: L.bind(this.onSelect, this), } - this.autocomplete = new L.U.AutoComplete.Ajax.Select(this.parentNode, options) + this.autocomplete = new U.AutoComplete.Ajax.Select(this.parentNode, options) const owner = this.toHTML() if (owner) this.autocomplete.displaySelected({ @@ -989,7 +989,7 @@ L.FormBuilder.ManageEditors = L.FormBuilder.Element.extend({ on_select: L.bind(this.onSelect, this), on_unselect: L.bind(this.onUnselect, this), } - this.autocomplete = new L.U.AutoComplete.Ajax.SelectMultiple( + this.autocomplete = new U.AutoComplete.Ajax.SelectMultiple( this.parentNode, options ) @@ -1023,7 +1023,7 @@ L.FormBuilder.ManageEditors = L.FormBuilder.Element.extend({ }, }) -L.U.FormBuilder = L.FormBuilder.extend({ +U.FormBuilder = L.FormBuilder.extend({ options: { className: 'umap-form', }, @@ -1114,7 +1114,7 @@ L.U.FormBuilder = L.FormBuilder.extend({ handler: 'IconUrl', label: L._('Icon symbol'), inheritable: true, - helpText: L.U.Help.formatIconSymbol, + helpText: U.Help.formatIconSymbol, }, popupShape: { handler: 'PopupShape', label: L._('Popup shape'), inheritable: true }, popupTemplate: { diff --git a/umap/static/umap/js/umap.icon.js b/umap/static/umap/js/umap.icon.js index a6df88a5..6393fa8a 100644 --- a/umap/static/umap/js/umap.icon.js +++ b/umap/static/umap/js/umap.icon.js @@ -1,4 +1,4 @@ -L.U.Icon = L.DivIcon.extend({ +U.Icon = L.DivIcon.extend({ initialize: function (map, options) { this.map = map const default_options = { @@ -42,7 +42,7 @@ L.U.Icon = L.DivIcon.extend({ onAdd: function () {}, }) -L.U.Icon.Default = L.U.Icon.extend({ +U.Icon.Default = U.Icon.extend({ default_options: { iconAnchor: new L.Point(16, 40), popupAnchor: new L.Point(0, -40), @@ -52,11 +52,11 @@ L.U.Icon.Default = L.U.Icon.extend({ initialize: function (map, options) { options = L.Util.extend({}, this.default_options, options) - L.U.Icon.prototype.initialize.call(this, map, options) + U.Icon.prototype.initialize.call(this, map, options) }, _setIconStyles: function (img, name) { - L.U.Icon.prototype._setIconStyles.call(this, img, name) + U.Icon.prototype._setIconStyles.call(this, img, name) const color = this._getColor(), opacity = this._getOpacity() this.elements.container.style.backgroundColor = color @@ -68,7 +68,7 @@ L.U.Icon.Default = L.U.Icon.extend({ onAdd: function () { const src = this._getIconUrl('icon') const bgcolor = this._getColor() - L.U.Icon.setIconContrast(this.elements.icon, this.elements.container, src, bgcolor) + U.Icon.setIconContrast(this.elements.icon, this.elements.container, src, bgcolor) }, createIcon: function () { @@ -82,14 +82,14 @@ L.U.Icon.Default = L.U.Icon.extend({ this.elements.arrow = L.DomUtil.create('div', 'icon_arrow', this.elements.main) const src = this._getIconUrl('icon') if (src) { - this.elements.icon = L.U.Icon.makeIconElement(src, this.elements.container) + this.elements.icon = U.Icon.makeIconElement(src, this.elements.container) } this._setIconStyles(this.elements.main, 'icon') return this.elements.main }, }) -L.U.Icon.Circle = L.U.Icon.extend({ +U.Icon.Circle = U.Icon.extend({ initialize: function (map, options) { const default_options = { popupAnchor: new L.Point(0, -6), @@ -97,11 +97,11 @@ L.U.Icon.Circle = L.U.Icon.extend({ className: 'umap-circle-icon', } options = L.Util.extend({}, default_options, options) - L.U.Icon.prototype.initialize.call(this, map, options) + U.Icon.prototype.initialize.call(this, map, options) }, _setIconStyles: function (img, name) { - L.U.Icon.prototype._setIconStyles.call(this, img, name) + U.Icon.prototype._setIconStyles.call(this, img, name) this.elements.main.style.backgroundColor = this._getColor() this.elements.main.style.opacity = this._getOpacity() }, @@ -115,7 +115,7 @@ L.U.Icon.Circle = L.U.Icon.extend({ }, }) -L.U.Icon.Drop = L.U.Icon.Default.extend({ +U.Icon.Drop = U.Icon.Default.extend({ default_options: { iconAnchor: new L.Point(16, 42), popupAnchor: new L.Point(0, -42), @@ -124,7 +124,7 @@ L.U.Icon.Drop = L.U.Icon.Default.extend({ }, }) -L.U.Icon.Ball = L.U.Icon.Default.extend({ +U.Icon.Ball = U.Icon.Default.extend({ default_options: { iconAnchor: new L.Point(8, 30), popupAnchor: new L.Point(0, -28), @@ -146,7 +146,7 @@ L.U.Icon.Ball = L.U.Icon.Default.extend({ }, _setIconStyles: function (img, name) { - L.U.Icon.prototype._setIconStyles.call(this, img, name) + U.Icon.prototype._setIconStyles.call(this, img, name) const color = this._getColor('color') let background if (L.Browser.ielt9) { @@ -161,7 +161,7 @@ L.U.Icon.Ball = L.U.Icon.Default.extend({ }, }) -L.U.Icon.Cluster = L.DivIcon.extend({ +U.Icon.Cluster = L.DivIcon.extend({ options: { iconSize: [40, 40], }, @@ -191,13 +191,13 @@ L.U.Icon.Cluster = L.DivIcon.extend({ }, }) -L.U.Icon.isImg = function (src) { +U.Icon.isImg = function (src) { return L.Util.isPath(src) || L.Util.isRemoteUrl(src) || L.Util.isDataImage(src) } -L.U.Icon.makeIconElement = function (src, parent) { +U.Icon.makeIconElement = function (src, parent) { let icon - if (L.U.Icon.isImg(src)) { + if (U.Icon.isImg(src)) { icon = L.DomUtil.create('img') icon.src = src } else { @@ -208,7 +208,7 @@ L.U.Icon.makeIconElement = function (src, parent) { return icon } -L.U.Icon.setIconContrast = function (icon, parent, src, bgcolor) { +U.Icon.setIconContrast = function (icon, parent, src, bgcolor) { /* * icon: the element we'll adapt the style, it can be an image or text * parent: the element we'll consider to decide whether to adapt the style, diff --git a/umap/static/umap/js/umap.importer.js b/umap/static/umap/js/umap.importer.js index c9f4db9e..46193200 100644 --- a/umap/static/umap/js/umap.importer.js +++ b/umap/static/umap/js/umap.importer.js @@ -1,4 +1,4 @@ -L.U.Importer = L.Class.extend({ +U.Importer = L.Class.extend({ TYPES: ['geojson', 'csv', 'gpx', 'kml', 'osm', 'georss', 'umap'], initialize: function (map) { this.map = map diff --git a/umap/static/umap/js/umap.js b/umap/static/umap/js/umap.js index 8efca54d..a2307af6 100644 --- a/umap/static/umap/js/umap.js +++ b/umap/static/umap/js/umap.js @@ -55,7 +55,7 @@ L.Map.mergeOptions({ featuresHaveOwner: false, }) -L.U.Map = L.Map.extend({ +U.Map = L.Map.extend({ includes: [ControlsMixin], editableOptions: { 'zoom': undefined, @@ -142,13 +142,13 @@ L.U.Map = L.Map.extend({ // After calling parent initialize, as we are doing initCenter our-selves if (geojson.geometry) this.options.center = this.latLng(geojson.geometry) - this.urls = new L.U.URLs(this.options.urls) + this.urls = new U.URLs(this.options.urls) - this.ui = new L.U.UI(this._container) + this.ui = new U.UI(this._container) this.ui.on('dataloading', (e) => this.fire('dataloading', e)) this.ui.on('dataload', (e) => this.fire('dataload', e)) - this.server = new L.U.ServerRequest(this.ui) - this.request = new L.U.Request(this.ui) + this.server = new U.ServerRequest(this.ui) + this.request = new U.Request(this.ui) this.initLoader() this.name = this.options.name @@ -200,7 +200,7 @@ L.U.Map = L.Map.extend({ this.facets = {} // Needed for actions labels - this.help = new L.U.Help(this) + this.help = new U.Help(this) if (this.options.hash) this.addHash() this.initTileLayers() @@ -280,11 +280,11 @@ L.U.Map = L.Map.extend({ } } - this.slideshow = new L.U.Slideshow(this, this.options.slideshow) - this.permissions = new L.U.MapPermissions(this) + this.slideshow = new U.Slideshow(this, this.options.slideshow) + this.permissions = new U.MapPermissions(this) this.initCaptionBar() if (this.hasEditMode()) { - this.editTools = new L.U.Editable(this) + this.editTools = new U.Editable(this) this.ui.on( 'panel:closed panel:open', function () { @@ -358,25 +358,25 @@ L.U.Map = L.Map.extend({ this._controls = {} if (this.hasEditMode() && !this.options.noControl) { - new L.U.EditControl(this).addTo(this) + new U.EditControl(this).addTo(this) - new L.U.DrawToolbar({ map: this }).addTo(this) + new U.DrawToolbar({ map: this }).addTo(this) const editActions = [ - L.U.ImportAction, - L.U.EditPropertiesAction, - L.U.ManageDatalayersAction, - L.U.ChangeTileLayerAction, - L.U.UpdateExtentAction, - L.U.UpdatePermsAction, + U.ImportAction, + U.EditPropertiesAction, + U.ManageDatalayersAction, + U.ChangeTileLayerAction, + U.UpdateExtentAction, + U.UpdatePermsAction, ] - new L.U.SettingsToolbar({ actions: editActions }).addTo(this) + new U.SettingsToolbar({ actions: editActions }).addTo(this) } this._controls.zoom = new L.Control.Zoom({ zoomInTitle: L._('Zoom in'), zoomOutTitle: L._('Zoom out'), }) - this._controls.datalayers = new L.U.DataLayersControl(this) + this._controls.datalayers = new U.DataLayersControl(this) this._controls.locate = L.control.locate({ strings: { title: L._('Center map on your location'), @@ -393,10 +393,10 @@ L.U.Map = L.Map.extend({ this._controls.fullscreen = new L.Control.Fullscreen({ title: { false: L._('View Fullscreen'), true: L._('Exit Fullscreen') }, }) - this._controls.search = new L.U.SearchControl() + this._controls.search = new U.SearchControl() this._controls.embed = new L.Control.Embed(this, this.options.embedOptions) - this._controls.tilelayersChooser = new L.U.TileLayerChooser(this) - this._controls.star = new L.U.StarControl(this) + this._controls.tilelayersChooser = new U.TileLayerChooser(this) + this._controls.star = new U.StarControl(this) this._controls.editinosm = new L.Control.EditInOSM({ position: 'topleft', widgetOptions: { @@ -406,16 +406,16 @@ L.U.Map = L.Map.extend({ }, }) this._controls.measure = new L.MeasureControl().initHandler(this) - this._controls.more = new L.U.MoreControls() + this._controls.more = new U.MoreControls() this._controls.scale = L.control.scale() - this._controls.permanentCredit = new L.U.PermanentCreditsControl(this) + this._controls.permanentCredit = new U.PermanentCreditsControl(this) if (this.options.scrollWheelZoom) this.scrollWheelZoom.enable() else this.scrollWheelZoom.disable() - this.browser = new window.umap.Browser(this) - this.importer = new L.U.Importer(this) - this.drop = new L.U.DropControl(this) - this.share = new L.U.Share(this) - this._controls.tilelayers = new L.U.TileLayerControl(this) + this.browser = new U.Browser(this) + this.importer = new U.Importer(this) + this.drop = new U.DropControl(this) + this.share = new U.Share(this) + this._controls.tilelayers = new U.TileLayerControl(this) this._controls.tilelayers.setLayers() this.renderControls() @@ -438,7 +438,7 @@ L.U.Map = L.Map.extend({ } if (this.options.noControl) return - this._controls.attribution = new L.U.AttributionControl().addTo(this) + this._controls.attribution = new U.AttributionControl().addTo(this) if (this.options.miniMap && !this.options.noControl) { this.whenReady(function () { if (this.selected_tilelayer) { @@ -552,10 +552,10 @@ L.U.Map = L.Map.extend({ modifierKey = e.ctrlKey || e.metaKey /* Generic shortcuts */ - if (key === L.U.Keys.F && modifierKey) { + if (key === U.Keys.F && modifierKey) { L.DomEvent.stop(e) this.search() - } else if (e.keyCode === L.U.Keys.ESC) { + } else if (e.keyCode === U.Keys.ESC) { if (this.help.visible()) this.help.hide() else this.ui.closePanel() } @@ -563,11 +563,11 @@ L.U.Map = L.Map.extend({ if (!this.hasEditMode()) return /* Edit mode only shortcuts */ - if (key === L.U.Keys.E && modifierKey && !this.editEnabled) { + if (key === U.Keys.E && modifierKey && !this.editEnabled) { L.DomEvent.stop(e) this.enableEdit() } else if ( - key === L.U.Keys.E && + key === U.Keys.E && modifierKey && this.editEnabled && !this.isDirty @@ -576,41 +576,41 @@ L.U.Map = L.Map.extend({ this.disableEdit() this.ui.closePanel() } - if (key === L.U.Keys.S && modifierKey) { + if (key === U.Keys.S && modifierKey) { L.DomEvent.stop(e) if (this.isDirty) { this.save() } } - if (key === L.U.Keys.Z && modifierKey && this.isDirty) { + if (key === U.Keys.Z && modifierKey && this.isDirty) { L.DomEvent.stop(e) this.askForReset() } - if (key === L.U.Keys.M && modifierKey && this.editEnabled) { + if (key === U.Keys.M && modifierKey && this.editEnabled) { L.DomEvent.stop(e) this.editTools.startMarker() } - if (key === L.U.Keys.P && modifierKey && this.editEnabled) { + if (key === U.Keys.P && modifierKey && this.editEnabled) { L.DomEvent.stop(e) this.editTools.startPolygon() } - if (key === L.U.Keys.L && modifierKey && this.editEnabled) { + if (key === U.Keys.L && modifierKey && this.editEnabled) { L.DomEvent.stop(e) this.editTools.startPolyline() } - if (key === L.U.Keys.I && modifierKey && this.editEnabled) { + if (key === U.Keys.I && modifierKey && this.editEnabled) { L.DomEvent.stop(e) this.importer.open() } - if (key === L.U.Keys.O && modifierKey && this.editEnabled) { + if (key === U.Keys.O && modifierKey && this.editEnabled) { L.DomEvent.stop(e) this.importer.openFiles() } - if (key === L.U.Keys.H && modifierKey && this.editEnabled) { + if (key === U.Keys.H && modifierKey && this.editEnabled) { L.DomEvent.stop(e) this.help.show('edit') } - if (e.keyCode === L.U.Keys.ESC) { + if (e.keyCode === U.Keys.ESC) { if (this.editEnabled && this.editTools.drawing()) { this.editTools.stopDrawing() } @@ -821,7 +821,7 @@ L.U.Map = L.Map.extend({ datalayer = datalayer || { name: `${L._('Layer')} ${this.datalayers_index.length + 1}`, } - return new L.U.DataLayer(this, datalayer) + return new U.DataLayer(this, datalayer) }, getDefaultOption: function (option) { @@ -1226,7 +1226,7 @@ L.U.Map = L.Map.extend({ 'options.captionBar', 'options.captionMenus', ]) - builder = new L.U.FormBuilder(this, UIFields, { + builder = new U.FormBuilder(this, UIFields, { callback: function () { this.renderControls() this.initCaptionBar() @@ -1255,7 +1255,7 @@ L.U.Map = L.Map.extend({ 'options.dashArray', ] - builder = new L.U.FormBuilder(this, shapeOptions, { + builder = new U.FormBuilder(this, shapeOptions, { callback: function (e) { if (this._controls.miniMap) this.renderControls() this.eachVisibleDataLayer((datalayer) => { @@ -1315,7 +1315,7 @@ L.U.Map = L.Map.extend({ ], ] - builder = new L.U.FormBuilder(this, optionsFields, { + builder = new U.FormBuilder(this, optionsFields, { callback: function (e) { this.initCaptionBar() if (e.helper.field === 'options.sortKey') { @@ -1340,7 +1340,7 @@ L.U.Map = L.Map.extend({ 'options.labelInteractive', 'options.outlinkTarget', ] - builder = new L.U.FormBuilder(this, popupFields, { + builder = new U.FormBuilder(this, popupFields, { callback: function (e) { if ( e.helper.field === 'options.popupTemplate' || @@ -1407,7 +1407,7 @@ L.U.Map = L.Map.extend({ container, L._('Custom background') ) - builder = new L.U.FormBuilder(this, tilelayerFields, { + builder = new U.FormBuilder(this, tilelayerFields, { callback: this.initTileLayers, callbackContext: this, }) @@ -1458,7 +1458,7 @@ L.U.Map = L.Map.extend({ ['options.overlay.tms', { handler: 'Switch', label: L._('TMS format') }], ] const overlay = L.DomUtil.createFieldset(container, L._('Custom overlay')) - builder = new L.U.FormBuilder(this, overlayFields, { + builder = new U.FormBuilder(this, overlayFields, { callback: this.initTileLayers, callbackContext: this, }) @@ -1488,7 +1488,7 @@ L.U.Map = L.Map.extend({ { handler: 'BlurFloatInput', placeholder: L._('max East') }, ], ] - const boundsBuilder = new L.U.FormBuilder(this, boundsFields, { + const boundsBuilder = new U.FormBuilder(this, boundsFields, { callback: this.handleLimitBounds, callbackContext: this, }) @@ -1554,7 +1554,7 @@ L.U.Map = L.Map.extend({ this.slideshow.setOptions(this.options.slideshow) this.renderControls() } - const slideshowBuilder = new L.U.FormBuilder(this, slideshowFields, { + const slideshowBuilder = new U.FormBuilder(this, slideshowFields, { callback: slideshowHandler, callbackContext: this, }) @@ -1594,7 +1594,7 @@ L.U.Map = L.Map.extend({ { handler: 'Switch', label: L._('Permanent credits background') }, ], ] - const creditsBuilder = new L.U.FormBuilder(this, creditsFields, { + const creditsBuilder = new U.FormBuilder(this, creditsFields, { callback: this.renderControls, callbackContext: this, }) @@ -1650,7 +1650,7 @@ L.U.Map = L.Map.extend({ metadataFields = ['options.name', 'options.description'], title = L.DomUtil.create('h3', '', container) title.textContent = L._('Edit map properties') - const builder = new L.U.FormBuilder(this, metadataFields) + const builder = new U.FormBuilder(this, metadataFields) const form = builder.build() container.appendChild(form) this._editControls(container) @@ -1784,7 +1784,7 @@ L.U.Map = L.Map.extend({ }, initContextMenu: function () { - this.contextmenu = new L.U.ContextMenu(this) + this.contextmenu = new U.ContextMenu(this) this.contextmenu.enable() }, diff --git a/umap/static/umap/js/umap.layer.js b/umap/static/umap/js/umap.layer.js index b0ea74ec..5031479a 100644 --- a/umap/static/umap/js/umap.layer.js +++ b/umap/static/umap/js/umap.layer.js @@ -1,4 +1,4 @@ -L.U.Layer = { +U.Layer = { browsable: true, getType: function () { @@ -26,12 +26,12 @@ L.U.Layer = { }, } -L.U.Layer.Default = L.FeatureGroup.extend({ +U.Layer.Default = L.FeatureGroup.extend({ statics: { NAME: L._('Default'), TYPE: 'Default', }, - includes: [L.U.Layer], + includes: [U.Layer], initialize: function (datalayer) { this.datalayer = datalayer @@ -39,7 +39,7 @@ L.U.Layer.Default = L.FeatureGroup.extend({ }, }) -L.U.MarkerCluster = L.MarkerCluster.extend({ +U.MarkerCluster = L.MarkerCluster.extend({ // Custom class so we can call computeTextColor // when element is already on the DOM. @@ -51,12 +51,12 @@ L.U.MarkerCluster = L.MarkerCluster.extend({ }, }) -L.U.Layer.Cluster = L.MarkerClusterGroup.extend({ +U.Layer.Cluster = L.MarkerClusterGroup.extend({ statics: { NAME: L._('Clustered'), TYPE: 'Cluster', }, - includes: [L.U.Layer], + includes: [U.Layer], initialize: function (datalayer) { this.datalayer = datalayer @@ -65,14 +65,14 @@ L.U.Layer.Cluster = L.MarkerClusterGroup.extend({ color: this.datalayer.getColor(), }, iconCreateFunction: function (cluster) { - return new L.U.Icon.Cluster(datalayer, cluster) + return new U.Icon.Cluster(datalayer, cluster) }, } if (this.datalayer.options.cluster && this.datalayer.options.cluster.radius) { options.maxClusterRadius = this.datalayer.options.cluster.radius } L.MarkerClusterGroup.prototype.initialize.call(this, options) - this._markerCluster = L.U.MarkerCluster + this._markerCluster = U.MarkerCluster this._layers = [] }, @@ -132,12 +132,12 @@ L.U.Layer.Cluster = L.MarkerClusterGroup.extend({ }, }) -L.U.Layer.Choropleth = L.FeatureGroup.extend({ +U.Layer.Choropleth = L.FeatureGroup.extend({ statics: { NAME: L._('Choropleth'), TYPE: 'Choropleth', }, - includes: [L.U.Layer], + includes: [U.Layer], // Have defaults that better suit the choropleth mode. defaults: { color: 'white', @@ -338,12 +338,12 @@ L.U.Layer.Choropleth = L.FeatureGroup.extend({ }, }) -L.U.Layer.Heat = L.HeatLayer.extend({ +U.Layer.Heat = L.HeatLayer.extend({ statics: { NAME: L._('Heatmap'), TYPE: 'Heat', }, - includes: [L.U.Layer], + includes: [U.Layer], browsable: false, initialize: function (datalayer) { @@ -505,7 +505,7 @@ L.U.Layer.Heat = L.HeatLayer.extend({ }, }) -L.U.DataLayer = L.Evented.extend({ +U.DataLayer = L.Evented.extend({ options: { displayOnLoad: true, inCaption: true, @@ -579,7 +579,7 @@ L.U.DataLayer = L.Evented.extend({ } this.backupOptions() this.connectToMap() - this.permissions = new L.U.DataLayerPermissions(this) + this.permissions = new U.DataLayerPermissions(this) if (!this.umap_id) { if (this.showAtLoad()) this.show() this.isDirty = true @@ -648,7 +648,7 @@ L.U.DataLayer = L.Evented.extend({ if (this.layer) this.layer.clearLayers() // delete this.layer? if (visible) this.map.removeLayer(this.layer) - const Class = L.U.Layer[this.options.type] || L.U.Layer.Default + const Class = U.Layer[this.options.type] || U.Layer.Default this.layer = new Class(this) this.eachLayer(this.showFeature) if (visible) this.show() @@ -801,7 +801,7 @@ L.U.DataLayer = L.Evented.extend({ setOptions: function (options) { delete options.geojson - this.options = L.Util.CopyJSON(L.U.DataLayer.prototype.options) // Start from fresh. + this.options = L.Util.CopyJSON(U.DataLayer.prototype.options) // Start from fresh. this.updateOptions(options) }, @@ -1027,11 +1027,11 @@ L.U.DataLayer = L.Evented.extend({ }, _pointToLayer: function (geojson, latlng) { - return new L.U.Marker(this.map, latlng, { geojson: geojson, datalayer: this }) + return new U.Marker(this.map, latlng, { geojson: geojson, datalayer: this }) }, _lineToLayer: function (geojson, latlngs) { - return new L.U.Polyline(this.map, latlngs, { + return new U.Polyline(this.map, latlngs, { geojson: geojson, datalayer: this, color: null, @@ -1043,7 +1043,7 @@ L.U.DataLayer = L.Evented.extend({ // for (let i = latlngs.length - 1; i > 0; i--) { // if (!latlngs.slice()[i].length) latlngs.splice(i, 1); // } - return new L.U.Polygon(this.map, latlngs, { geojson: geojson, datalayer: this }) + return new U.Polygon(this.map, latlngs, { geojson: geojson, datalayer: this }) }, importRaw: function (raw, type) { @@ -1186,7 +1186,7 @@ L.U.DataLayer = L.Evented.extend({ ], ] const title = L.DomUtil.add('h3', '', container, L._('Layer properties')) - let builder = new L.U.FormBuilder(this, metadataFields, { + let builder = new U.FormBuilder(this, metadataFields, { callback: function (e) { this.map.updateDatalayersControl() if (e.helper.field === 'options.type') { @@ -1208,7 +1208,7 @@ L.U.DataLayer = L.Evented.extend({ const layerOptions = this.layer.getEditableOptions() if (layerOptions.length) { - builder = new L.U.FormBuilder(this, layerOptions, { + builder = new U.FormBuilder(this, layerOptions, { id: 'datalayer-layer-properties', callback: redrawCallback, }) @@ -1232,7 +1232,7 @@ L.U.DataLayer = L.Evented.extend({ 'options.fillOpacity', ] - builder = new L.U.FormBuilder(this, shapeOptions, { + builder = new U.FormBuilder(this, shapeOptions, { id: 'datalayer-advanced-properties', callback: redrawCallback, }) @@ -1248,7 +1248,7 @@ L.U.DataLayer = L.Evented.extend({ 'options.labelKey', ] - builder = new L.U.FormBuilder(this, optionsFields, { + builder = new U.FormBuilder(this, optionsFields, { id: 'datalayer-advanced-properties', callback: redrawCallback, }) @@ -1268,7 +1268,7 @@ L.U.DataLayer = L.Evented.extend({ 'options.outlinkTarget', 'options.interactive', ] - builder = new L.U.FormBuilder(this, popupFields, { callback: redrawCallback }) + builder = new U.FormBuilder(this, popupFields, { callback: redrawCallback }) const popupFieldset = L.DomUtil.createFieldset( container, L._('Interaction options') @@ -1314,7 +1314,7 @@ L.U.DataLayer = L.Evented.extend({ } const remoteDataContainer = L.DomUtil.createFieldset(container, L._('Remote data')) - builder = new L.U.FormBuilder(this, remoteDataFields) + builder = new U.FormBuilder(this, remoteDataFields) remoteDataContainer.appendChild(builder.build()) L.DomUtil.createButton( 'button umap-verify', @@ -1646,7 +1646,7 @@ L.U.DataLayer = L.Evented.extend({ tableEdit: function () { if (this.isRemoteLayer() || !this.isVisible()) return - const editor = new L.U.TableEditor(this) + const editor = new U.TableEditor(this) editor.edit() }, }) diff --git a/umap/static/umap/js/umap.permissions.js b/umap/static/umap/js/umap.permissions.js index de5544fe..72d601c3 100644 --- a/umap/static/umap/js/umap.permissions.js +++ b/umap/static/umap/js/umap.permissions.js @@ -1,6 +1,6 @@ // Dedicated object so we can deal with a separate dirty status, and thus // call the endpoint only when needed, saving one call at each save. -L.U.MapPermissions = L.Class.extend({ +U.MapPermissions = L.Class.extend({ options: { owner: null, editors: [], @@ -105,7 +105,7 @@ L.U.MapPermissions = L.Class.extend({ ]) } title.textContent = L._('Update permissions') - const builder = new L.U.FormBuilder(this, fields) + const builder = new U.FormBuilder(this, fields) const form = builder.build() container.appendChild(form) if (this.isAnonymousMap() && this.map.options.user) { diff --git a/umap/static/umap/js/umap.popup.js b/umap/static/umap/js/umap.popup.js index 02ce1bf8..6c85ba57 100644 --- a/umap/static/umap/js/umap.popup.js +++ b/umap/static/umap/js/umap.popup.js @@ -1,6 +1,6 @@ /* Shapes */ -L.U.Popup = L.Popup.extend({ +U.Popup = L.Popup.extend({ options: { parseTemplate: true, }, @@ -15,7 +15,7 @@ L.U.Popup = L.Popup.extend({ format: function () { const mode = this.feature.getOption('popupTemplate') || 'Default', - klass = L.U.PopupTemplate[mode] || L.U.PopupTemplate.Default + klass = U.PopupTemplate[mode] || U.PopupTemplate.Default this.content = new klass(this.feature, this.container) this.content.render() const els = this.container.querySelectorAll('img,iframe') @@ -42,14 +42,14 @@ L.U.Popup = L.Popup.extend({ }, }) -L.U.Popup.Large = L.U.Popup.extend({ +U.Popup.Large = U.Popup.extend({ options: { maxWidth: 500, className: 'umap-popup-large', }, }) -L.U.Popup.Panel = L.U.Popup.extend({ +U.Popup.Panel = U.Popup.extend({ options: { zoomAnimation: false, }, @@ -97,13 +97,13 @@ L.U.Popup.Panel = L.U.Popup.extend({ _updatePosition: function () {}, _adjustPan: function () {}, }) -L.U.Popup.SimplePanel = L.U.Popup.Panel // Retrocompat. +U.Popup.SimplePanel = U.Popup.Panel // Retrocompat. /* Content templates */ -L.U.PopupTemplate = {} +U.PopupTemplate = {} -L.U.PopupTemplate.Default = L.Class.extend({ +U.PopupTemplate.Default = L.Class.extend({ initialize: function (feature, container) { this.feature = feature this.container = container @@ -176,7 +176,7 @@ L.U.PopupTemplate.Default = L.Class.extend({ }, }) -L.U.PopupTemplate.BaseWithTitle = L.U.PopupTemplate.Default.extend({ +U.PopupTemplate.BaseWithTitle = U.PopupTemplate.Default.extend({ renderTitle: function () { let title if (this.feature.getDisplayName()) { @@ -187,7 +187,7 @@ L.U.PopupTemplate.BaseWithTitle = L.U.PopupTemplate.Default.extend({ }, }) -L.U.PopupTemplate.Table = L.U.PopupTemplate.BaseWithTitle.extend({ +U.PopupTemplate.Table = U.PopupTemplate.BaseWithTitle.extend({ formatRow: function (key, value) { if (value.indexOf('http') === 0) { value = `${value}` @@ -213,7 +213,7 @@ L.U.PopupTemplate.Table = L.U.PopupTemplate.BaseWithTitle.extend({ }, }) -L.U.PopupTemplate.GeoRSSImage = L.U.PopupTemplate.BaseWithTitle.extend({ +U.PopupTemplate.GeoRSSImage = U.PopupTemplate.BaseWithTitle.extend({ options: { minWidth: 300, maxWidth: 500, @@ -237,7 +237,7 @@ L.U.PopupTemplate.GeoRSSImage = L.U.PopupTemplate.BaseWithTitle.extend({ }, }) -L.U.PopupTemplate.GeoRSSLink = L.U.PopupTemplate.Default.extend({ +U.PopupTemplate.GeoRSSLink = U.PopupTemplate.Default.extend({ options: { className: 'umap-georss-link', }, @@ -252,7 +252,7 @@ L.U.PopupTemplate.GeoRSSLink = L.U.PopupTemplate.Default.extend({ }, }) -L.U.PopupTemplate.OSM = L.U.PopupTemplate.Default.extend({ +U.PopupTemplate.OSM = U.PopupTemplate.Default.extend({ options: { className: 'umap-openstreetmap', }, @@ -270,9 +270,9 @@ L.U.PopupTemplate.OSM = L.U.PopupTemplate.Default.extend({ const color = this.feature.getDynamicOption('color') title.style.backgroundColor = color const iconUrl = this.feature.getDynamicOption('iconUrl') - let icon = L.U.Icon.makeIconElement(iconUrl, title) + let icon = U.Icon.makeIconElement(iconUrl, title) L.DomUtil.addClass(icon, 'icon') - L.U.Icon.setIconContrast(icon, title, iconUrl, color) + U.Icon.setIconContrast(icon, title, iconUrl, color) if (L.DomUtil.contrastedColor(title, color)) title.style.color = 'white' L.DomUtil.add('span', '', title, this.getName()) const street = props['addr:street'] diff --git a/umap/static/umap/js/umap.share.js b/umap/static/umap/js/umap.share.js index a8f4e2b1..a70930b0 100644 --- a/umap/static/umap/js/umap.share.js +++ b/umap/static/umap/js/umap.share.js @@ -1,4 +1,4 @@ -L.U.Share = L.Class.extend({ +U.Share = L.Class.extend({ EXPORT_TYPES: { geojson: { formatter: function (map) { @@ -138,13 +138,13 @@ L.U.Share = L.Class.extend({ for (let i = 0; i < this.map.HIDDABLE_CONTROLS.length; i++) { UIFields.push(`queryString.${this.map.HIDDABLE_CONTROLS[i]}Control`) } - const iframeExporter = new L.U.IframeExporter(this.map) + const iframeExporter = new U.IframeExporter(this.map) const buildIframeCode = () => { iframe.innerHTML = iframeExporter.build() exportUrl.value = window.location.protocol + iframeExporter.buildUrl() } buildIframeCode() - const builder = new L.U.FormBuilder(iframeExporter, UIFields, { + const builder = new U.FormBuilder(iframeExporter, UIFields, { callback: buildIframeCode, }) const iframeOptions = L.DomUtil.createFieldset( @@ -182,7 +182,7 @@ L.U.Share = L.Class.extend({ }, }) -L.U.IframeExporter = L.Evented.extend({ +U.IframeExporter = L.Evented.extend({ options: { includeFullScreenLink: true, currentView: false, diff --git a/umap/static/umap/js/umap.slideshow.js b/umap/static/umap/js/umap.slideshow.js index 3ed05515..6b1d13a8 100644 --- a/umap/static/umap/js/umap.slideshow.js +++ b/umap/static/umap/js/umap.slideshow.js @@ -1,4 +1,4 @@ -L.U.Slideshow = L.Class.extend({ +U.Slideshow = L.Class.extend({ statics: { CLASSNAME: 'umap-slideshow-active', }, @@ -97,7 +97,7 @@ L.U.Slideshow = L.Class.extend({ play: function () { if (this._id) return if (this.map.editEnabled || !this.map.options.slideshow.active) return - L.DomUtil.addClass(document.body, L.U.Slideshow.CLASSNAME) + L.DomUtil.addClass(document.body, U.Slideshow.CLASSNAME) this._id = window.setInterval(L.bind(this.loop, this), this.options.delay) this.resetSpinners() this.loop() @@ -110,7 +110,7 @@ L.U.Slideshow = L.Class.extend({ pause: function () { if (this._id) { - L.DomUtil.removeClass(document.body, L.U.Slideshow.CLASSNAME) + L.DomUtil.removeClass(document.body, U.Slideshow.CLASSNAME) window.clearInterval(this._id) this._id = null } diff --git a/umap/static/umap/js/umap.tableeditor.js b/umap/static/umap/js/umap.tableeditor.js index 04283b49..4a664705 100644 --- a/umap/static/umap/js/umap.tableeditor.js +++ b/umap/static/umap/js/umap.tableeditor.js @@ -1,4 +1,4 @@ -L.U.TableEditor = L.Class.extend({ +U.TableEditor = L.Class.extend({ initialize: function (datalayer) { this.datalayer = datalayer this.table = L.DomUtil.create('div', 'table') @@ -54,7 +54,7 @@ L.U.TableEditor = L.Class.extend({ }, renderRow: function (feature) { - const builder = new L.U.FormBuilder(feature, this.field_properties, { + const builder = new U.FormBuilder(feature, this.field_properties, { id: `umap-feature-properties_${L.stamp(feature)}`, className: 'trow', callback: feature.resetTooltip, diff --git a/umap/static/umap/js/umap.ui.js b/umap/static/umap/js/umap.ui.js index 053b4b53..7434b38f 100644 --- a/umap/static/umap/js/umap.ui.js +++ b/umap/static/umap/js/umap.ui.js @@ -1,7 +1,7 @@ /* * Modals */ -L.U.UI = L.Evented.extend({ +U.UI = L.Evented.extend({ ALERTS: Array(), ALERT_ID: null, TOOLTIP_ID: null, diff --git a/umap/static/umap/test/Choropleth.js b/umap/static/umap/test/Choropleth.js index 1178e85b..de479af3 100644 --- a/umap/static/umap/test/Choropleth.js +++ b/umap/static/umap/test/Choropleth.js @@ -176,7 +176,7 @@ const POLYGONS = { ], } -describe('L.U.Choropleth', () => { +describe('U.Choropleth', () => { let path = '/map/99/datalayer/edit/62/', poly1, poly4, diff --git a/umap/static/umap/test/DataLayer.js b/umap/static/umap/test/DataLayer.js index 580e117f..79647c7f 100644 --- a/umap/static/umap/test/DataLayer.js +++ b/umap/static/umap/test/DataLayer.js @@ -1,4 +1,4 @@ -describe('L.U.DataLayer', () => { +describe('U.DataLayer', () => { let path = '/map/99/datalayer/update/62/', map, datalayer diff --git a/umap/static/umap/test/Feature.js b/umap/static/umap/test/Feature.js index 02261b90..d3244c38 100644 --- a/umap/static/umap/test/Feature.js +++ b/umap/static/umap/test/Feature.js @@ -1,4 +1,4 @@ -describe('L.U.FeatureMixin', function () { +describe('U.FeatureMixin', function () { let map, datalayer before(async () => { await fetchMock.mock( diff --git a/umap/static/umap/test/Map.Export.js b/umap/static/umap/test/Map.Export.js index abdbcf81..006cedef 100644 --- a/umap/static/umap/test/Map.Export.js +++ b/umap/static/umap/test/Map.Export.js @@ -1,4 +1,4 @@ -describe('L.U.Map.Export', function () { +describe('U.Map.Export', function () { let map before(async () => { await fetchMock.mock( diff --git a/umap/static/umap/test/Map.js b/umap/static/umap/test/Map.js index 5ba26ada..e6350721 100644 --- a/umap/static/umap/test/Map.js +++ b/umap/static/umap/test/Map.js @@ -1,4 +1,4 @@ -describe('L.U.Map', () => { +describe('U.Map', () => { let map, datalayer before(async () => { await fetchMock.mock( diff --git a/umap/static/umap/test/Marker.js b/umap/static/umap/test/Marker.js index fc846b4c..c7d0b0f7 100644 --- a/umap/static/umap/test/Marker.js +++ b/umap/static/umap/test/Marker.js @@ -1,4 +1,4 @@ -describe('L.U.Marker', () => { +describe('U.Marker', () => { let map, datalayer before(async () => { const datalayer_response = JSON.parse(JSON.stringify(RESPONSES.datalayer62_GET)) // Copy. @@ -86,7 +86,7 @@ describe('L.U.Marker', () => { describe('#clone', () => { it('should clone marker', () => { - var layer = new L.U.Marker(map, [10, 20], { + var layer = new U.Marker(map, [10, 20], { datalayer: datalayer, }).addTo(datalayer) assert.equal(datalayer._index.length, 4) @@ -102,7 +102,7 @@ describe('L.U.Marker', () => { describe('#edit()', function (done) { it('should allow changing coordinates manually', () => { - var layer = new L.U.Marker(map, [10, 20], { + var layer = new U.Marker(map, [10, 20], { datalayer: datalayer, }).addTo(datalayer) enableEdit() @@ -112,7 +112,7 @@ describe('L.U.Marker', () => { }) it('should not allow invalid latitude nor longitude', () => { - var layer = new L.U.Marker(map, [10, 20], { + var layer = new U.Marker(map, [10, 20], { datalayer: datalayer, }).addTo(datalayer) enableEdit() diff --git a/umap/static/umap/test/Polygon.js b/umap/static/umap/test/Polygon.js index 1f4f45bf..f0c1124c 100644 --- a/umap/static/umap/test/Polygon.js +++ b/umap/static/umap/test/Polygon.js @@ -1,4 +1,4 @@ -describe('L.U.Polygon', function () { +describe('U.Polygon', function () { var p2ll, map, datalayer before(function () { @@ -22,7 +22,7 @@ describe('L.U.Polygon', function () { describe('#isMulti()', function () { it('should return false for basic Polygon', function () { - var layer = new L.U.Polygon( + var layer = new U.Polygon( map, [ [1, 2], @@ -36,12 +36,12 @@ describe('L.U.Polygon', function () { it('should return false for nested basic Polygon', function () { var latlngs = [[[p2ll(100, 150), p2ll(150, 200), p2ll(200, 100)]]], - layer = new L.U.Polygon(map, latlngs, { datalayer: datalayer }) + layer = new U.Polygon(map, latlngs, { datalayer: datalayer }) assert.notOk(layer.isMulti()) }) it('should return false for simple Polygon with hole', function () { - var layer = new L.U.Polygon( + var layer = new U.Polygon( map, [ [ @@ -77,7 +77,7 @@ describe('L.U.Polygon', function () { ], ], ] - var layer = new L.U.Polygon(map, latLngs, { datalayer: datalayer }) + var layer = new U.Polygon(map, latLngs, { datalayer: datalayer }) assert.ok(layer.isMulti()) }) @@ -103,7 +103,7 @@ describe('L.U.Polygon', function () { ], ], ] - var layer = new L.U.Polygon(map, latLngs, { datalayer: datalayer }) + var layer = new U.Polygon(map, latLngs, { datalayer: datalayer }) assert.ok(layer.isMulti()) }) }) @@ -120,7 +120,7 @@ describe('L.U.Polygon', function () { [[p2ll(100, 150), p2ll(150, 200), p2ll(200, 100)]], [[p2ll(300, 350), p2ll(350, 400), p2ll(400, 300)]], ], - layer = new L.U.Polygon(map, latlngs, { + layer = new U.Polygon(map, latlngs, { datalayer: datalayer, }).addTo(datalayer) happen.once(layer._path, { type: 'contextmenu' }) @@ -129,7 +129,7 @@ describe('L.U.Polygon', function () { it('should not allow to remove shape when not multi', function () { var latlngs = [[[p2ll(100, 150), p2ll(150, 200), p2ll(200, 100)]]], - layer = new L.U.Polygon(map, latlngs, { + layer = new U.Polygon(map, latlngs, { datalayer: datalayer, }).addTo(datalayer) happen.once(layer._path, { type: 'contextmenu' }) @@ -138,7 +138,7 @@ describe('L.U.Polygon', function () { it('should not allow to isolate shape when not multi', function () { var latlngs = [[[p2ll(100, 150), p2ll(150, 200), p2ll(200, 100)]]], - layer = new L.U.Polygon(map, latlngs, { + layer = new U.Polygon(map, latlngs, { datalayer: datalayer, }).addTo(datalayer) happen.once(layer._path, { type: 'contextmenu' }) @@ -150,7 +150,7 @@ describe('L.U.Polygon', function () { [[p2ll(100, 150), p2ll(150, 200), p2ll(200, 100)]], [[p2ll(300, 350), p2ll(350, 400), p2ll(400, 300)]], ], - layer = new L.U.Polygon(map, latlngs, { + layer = new U.Polygon(map, latlngs, { datalayer: datalayer, }).addTo(datalayer) happen.once(layer._path, { type: 'contextmenu' }) @@ -162,7 +162,7 @@ describe('L.U.Polygon', function () { [[p2ll(100, 150), p2ll(150, 200), p2ll(200, 100)]], [[p2ll(300, 350), p2ll(350, 400), p2ll(400, 300)]], ], - layer = new L.U.Polygon(map, latlngs, { + layer = new U.Polygon(map, latlngs, { datalayer: datalayer, }).addTo(datalayer) happen.once(layer._path, { type: 'contextmenu' }) @@ -176,7 +176,7 @@ describe('L.U.Polygon', function () { [p2ll(120, 150), p2ll(150, 180), p2ll(180, 120)], ], ], - layer = new L.U.Polygon(map, latlngs, { + layer = new U.Polygon(map, latlngs, { datalayer: datalayer, }).addTo(datalayer) happen.once(layer._path, { type: 'contextmenu' }) @@ -185,7 +185,7 @@ describe('L.U.Polygon', function () { it('should allow to transform to lines when not multi', function () { var latlngs = [[[p2ll(100, 150), p2ll(150, 200), p2ll(200, 100)]]] - new L.U.Polygon(map, latlngs, { datalayer: datalayer }).addTo( + new U.Polygon(map, latlngs, { datalayer: datalayer }).addTo( datalayer ) happen.at('contextmenu', 150, 150) @@ -193,7 +193,7 @@ describe('L.U.Polygon', function () { }) it('should not allow to transfer shape when not editedFeature', function () { - new L.U.Polygon(map, [p2ll(100, 150), p2ll(100, 200), p2ll(200, 150)], { + new U.Polygon(map, [p2ll(100, 150), p2ll(100, 200), p2ll(200, 150)], { datalayer: datalayer, }).addTo(datalayer) happen.at('contextmenu', 110, 160) @@ -202,12 +202,12 @@ describe('L.U.Polygon', function () { }) it('should not allow to transfer shape when editedFeature is not a polygon', function () { - var layer = new L.U.Polygon( + var layer = new U.Polygon( map, [p2ll(100, 150), p2ll(100, 200), p2ll(200, 150)], { datalayer: datalayer } ).addTo(datalayer), - other = new L.U.Polyline(map, [p2ll(200, 250), p2ll(200, 300)], { + other = new U.Polyline(map, [p2ll(200, 250), p2ll(200, 300)], { datalayer: datalayer, }).addTo(datalayer) other.edit() @@ -218,13 +218,13 @@ describe('L.U.Polygon', function () { it('should allow to transfer shape when another polygon is edited', function () { datalayer.empty() - var layer = new L.U.Polygon( + var layer = new U.Polygon( map, [p2ll(200, 300), p2ll(300, 200), p2ll(200, 100)], { datalayer: datalayer } ).addTo(datalayer) layer.edit() // This moves the map to put "other" at the center. - var other = new L.U.Polygon( + var other = new U.Polygon( map, [p2ll(100, 150), p2ll(100, 200), p2ll(200, 150)], { datalayer: datalayer } @@ -242,7 +242,7 @@ describe('L.U.Polygon', function () { }) it('"add shape" control should be visible when editing a Polygon', function () { - var layer = new L.U.Polygon(map, [p2ll(100, 100), p2ll(100, 200)], { + var layer = new U.Polygon(map, [p2ll(100, 100), p2ll(100, 200)], { datalayer: datalayer, }).addTo(datalayer) layer.edit() @@ -250,7 +250,7 @@ describe('L.U.Polygon', function () { }) it('"add shape" control should extend the same multi', function () { - var layer = new L.U.Polygon( + var layer = new U.Polygon( map, [p2ll(100, 150), p2ll(150, 200), p2ll(200, 100)], { datalayer: datalayer } @@ -271,10 +271,10 @@ describe('L.U.Polygon', function () { describe('#transferShape', function () { it('should transfer simple polygon shape to another polygon', function () { var latlngs = [p2ll(100, 150), p2ll(100, 200), p2ll(200, 100)], - layer = new L.U.Polygon(map, latlngs, { datalayer: datalayer }).addTo( + layer = new U.Polygon(map, latlngs, { datalayer: datalayer }).addTo( datalayer ), - other = new L.U.Polygon( + other = new U.Polygon( map, [p2ll(200, 350), p2ll(200, 300), p2ll(300, 200)], { datalayer: datalayer } @@ -294,10 +294,10 @@ describe('L.U.Polygon', function () { ], [[p2ll(200, 300), p2ll(300, 200)]], ], - layer = new L.U.Polygon(map, latlngs, { datalayer: datalayer }).addTo( + layer = new U.Polygon(map, latlngs, { datalayer: datalayer }).addTo( datalayer ), - other = new L.U.Polygon( + other = new U.Polygon( map, [p2ll(200, 350), p2ll(200, 300), p2ll(300, 200)], { datalayer: datalayer } @@ -314,7 +314,7 @@ describe('L.U.Polygon', function () { describe('#isolateShape', function () { it('should not allow to isolate simple polygon', function () { var latlngs = [p2ll(100, 150), p2ll(100, 200), p2ll(200, 100)], - layer = new L.U.Polygon(map, latlngs, { datalayer: datalayer }).addTo( + layer = new U.Polygon(map, latlngs, { datalayer: datalayer }).addTo( datalayer ) assert.equal(datalayer._index.length, 1) @@ -332,7 +332,7 @@ describe('L.U.Polygon', function () { ], [[p2ll(200, 300), p2ll(300, 200)]], ], - layer = new L.U.Polygon(map, latlngs, { datalayer: datalayer }).addTo( + layer = new U.Polygon(map, latlngs, { datalayer: datalayer }).addTo( datalayer ) assert.equal(datalayer._index.length, 1) @@ -351,7 +351,7 @@ describe('L.U.Polygon', function () { describe('#clone', function () { it('should clone polygon', function () { var latlngs = [p2ll(100, 150), p2ll(100, 200), p2ll(200, 100)], - layer = new L.U.Polygon(map, latlngs, { datalayer: datalayer }).addTo( + layer = new U.Polygon(map, latlngs, { datalayer: datalayer }).addTo( datalayer ) assert.equal(datalayer._index.length, 1) diff --git a/umap/static/umap/test/Polyline.js b/umap/static/umap/test/Polyline.js index 53a1baf9..41b6e16c 100644 --- a/umap/static/umap/test/Polyline.js +++ b/umap/static/umap/test/Polyline.js @@ -1,4 +1,4 @@ -describe('L.U.Polyline', function () { +describe('U.Polyline', function () { var p2ll, map before(function () { @@ -22,7 +22,7 @@ describe('L.U.Polyline', function () { describe('#isMulti()', function () { it('should return false for basic Polyline', function () { - var layer = new L.U.Polyline( + var layer = new U.Polyline( this.map, [ [1, 2], @@ -35,7 +35,7 @@ describe('L.U.Polyline', function () { }) it('should return false for nested basic Polyline', function () { - var layer = new L.U.Polyline( + var layer = new U.Polyline( this.map, [ [ @@ -66,7 +66,7 @@ describe('L.U.Polyline', function () { ], ], ] - var layer = new L.U.Polyline(this.map, latLngs, { datalayer: this.datalayer }) + var layer = new U.Polyline(this.map, latLngs, { datalayer: this.datalayer }) assert.ok(layer.isMulti()) }) }) @@ -83,7 +83,7 @@ describe('L.U.Polyline', function () { [p2ll(100, 100), p2ll(100, 200)], [p2ll(300, 350), p2ll(350, 400), p2ll(400, 300)], ], - layer = new L.U.Polyline(this.map, latlngs, { + layer = new U.Polyline(this.map, latlngs, { datalayer: this.datalayer, }).addTo(this.datalayer) happen.once(layer._path, { type: 'contextmenu' }) @@ -92,7 +92,7 @@ describe('L.U.Polyline', function () { it('should not allow to remove shape when not multi', function () { var latlngs = [[p2ll(100, 100), p2ll(100, 200)]], - layer = new L.U.Polyline(this.map, latlngs, { + layer = new U.Polyline(this.map, latlngs, { datalayer: this.datalayer, }).addTo(this.datalayer) happen.once(layer._path, { type: 'contextmenu' }) @@ -101,7 +101,7 @@ describe('L.U.Polyline', function () { it('should not allow to isolate shape when not multi', function () { var latlngs = [[p2ll(100, 100), p2ll(100, 200)]], - layer = new L.U.Polyline(this.map, latlngs, { + layer = new U.Polyline(this.map, latlngs, { datalayer: this.datalayer, }).addTo(this.datalayer) happen.once(layer._path, { type: 'contextmenu' }) @@ -113,7 +113,7 @@ describe('L.U.Polyline', function () { [p2ll(100, 150), p2ll(100, 200)], [p2ll(300, 350), p2ll(350, 400), p2ll(400, 300)], ], - layer = new L.U.Polyline(this.map, latlngs, { + layer = new U.Polyline(this.map, latlngs, { datalayer: this.datalayer, }).addTo(this.datalayer) happen.once(layer._path, { type: 'contextmenu' }) @@ -125,7 +125,7 @@ describe('L.U.Polyline', function () { [p2ll(100, 150), p2ll(100, 200)], [p2ll(300, 350), p2ll(350, 400), p2ll(400, 300)], ], - layer = new L.U.Polyline(this.map, latlngs, { + layer = new U.Polyline(this.map, latlngs, { datalayer: this.datalayer, }).addTo(this.datalayer) happen.once(layer._path, { type: 'contextmenu' }) @@ -134,7 +134,7 @@ describe('L.U.Polyline', function () { it('should allow to transform to polygon when not multi', function () { var latlngs = [p2ll(100, 150), p2ll(100, 200), p2ll(200, 100)], - layer = new L.U.Polyline(this.map, latlngs, { + layer = new U.Polyline(this.map, latlngs, { datalayer: this.datalayer, }).addTo(this.datalayer) happen.once(layer._path, { type: 'contextmenu' }) @@ -142,7 +142,7 @@ describe('L.U.Polyline', function () { }) it('should not allow to transfer shape when not editedFeature', function () { - var layer = new L.U.Polyline(this.map, [p2ll(100, 150), p2ll(100, 200)], { + var layer = new U.Polyline(this.map, [p2ll(100, 150), p2ll(100, 200)], { datalayer: this.datalayer, }).addTo(this.datalayer) happen.once(layer._path, { type: 'contextmenu' }) @@ -150,10 +150,10 @@ describe('L.U.Polyline', function () { }) it('should not allow to transfer shape when editedFeature is not a line', function () { - var layer = new L.U.Polyline(this.map, [p2ll(100, 150), p2ll(100, 200)], { + var layer = new U.Polyline(this.map, [p2ll(100, 150), p2ll(100, 200)], { datalayer: this.datalayer, }).addTo(this.datalayer), - other = new L.U.Polygon( + other = new U.Polygon( this.map, [p2ll(200, 300), p2ll(300, 200), p2ll(200, 100)], { datalayer: this.datalayer } @@ -164,12 +164,12 @@ describe('L.U.Polyline', function () { }) it('should allow to transfer shape when another line is edited', function () { - var layer = new L.U.Polyline( + var layer = new U.Polyline( this.map, [p2ll(100, 150), p2ll(100, 200), p2ll(200, 100)], { datalayer: this.datalayer } ).addTo(this.datalayer), - other = new L.U.Polyline(this.map, [p2ll(200, 300), p2ll(300, 200)], { + other = new U.Polyline(this.map, [p2ll(200, 300), p2ll(300, 200)], { datalayer: this.datalayer, }).addTo(this.datalayer) other.edit() @@ -184,7 +184,7 @@ describe('L.U.Polyline', function () { [p2ll(100, 100), p2ll(100, 200)], [p2ll(300, 350), p2ll(350, 400), p2ll(400, 300)], ], - layer = new L.U.Polyline(this.map, latlngs, { + layer = new U.Polyline(this.map, latlngs, { datalayer: this.datalayer, }).addTo(this.datalayer) happen.once(layer._path, { type: 'contextmenu' }) @@ -193,7 +193,7 @@ describe('L.U.Polyline', function () { it('should not allow to merge lines when not multi', function () { var latlngs = [[p2ll(100, 100), p2ll(100, 200)]], - layer = new L.U.Polyline(this.map, latlngs, { + layer = new U.Polyline(this.map, latlngs, { datalayer: this.datalayer, }).addTo(this.datalayer) happen.once(layer._path, { type: 'contextmenu' }) @@ -202,7 +202,7 @@ describe('L.U.Polyline', function () { it('should allow to split lines when clicking on vertex', function () { var latlngs = [[p2ll(300, 350), p2ll(350, 400), p2ll(400, 300)]], - layer = new L.U.Polyline(this.map, latlngs, { + layer = new U.Polyline(this.map, latlngs, { datalayer: this.datalayer, }).addTo(this.datalayer) layer.enableEdit() @@ -212,7 +212,7 @@ describe('L.U.Polyline', function () { it('should not allow to split lines when clicking on first vertex', function () { var latlngs = [[p2ll(300, 350), p2ll(350, 400), p2ll(400, 300)]], - layer = new L.U.Polyline(this.map, latlngs, { + layer = new U.Polyline(this.map, latlngs, { datalayer: this.datalayer, }).addTo(this.datalayer) layer.enableEdit() @@ -223,7 +223,7 @@ describe('L.U.Polyline', function () { it('should not allow to split lines when clicking on last vertex', function () { var latlngs = [[p2ll(300, 350), p2ll(350, 400), p2ll(400, 300)]], - layer = new L.U.Polyline(this.map, latlngs, { + layer = new U.Polyline(this.map, latlngs, { datalayer: this.datalayer, }).addTo(this.datalayer) layer.enableEdit() @@ -240,7 +240,7 @@ describe('L.U.Polyline', function () { }) it('"add shape" control should be visible when editing a Polyline', function () { - var layer = new L.U.Polyline(this.map, [p2ll(100, 100), p2ll(100, 200)], { + var layer = new U.Polyline(this.map, [p2ll(100, 100), p2ll(100, 200)], { datalayer: this.datalayer, }).addTo(this.datalayer) layer.edit() @@ -248,7 +248,7 @@ describe('L.U.Polyline', function () { }) it('"add shape" control should extend the same multi', function () { - var layer = new L.U.Polyline(this.map, [p2ll(100, 100), p2ll(100, 200)], { + var layer = new U.Polyline(this.map, [p2ll(100, 100), p2ll(100, 200)], { datalayer: this.datalayer, }).addTo(this.datalayer) layer.edit() @@ -267,10 +267,10 @@ describe('L.U.Polyline', function () { describe('#transferShape', function () { it('should transfer simple line shape to another line', function () { var latlngs = [p2ll(100, 150), p2ll(100, 200), p2ll(200, 100)], - layer = new L.U.Polyline(this.map, latlngs, { + layer = new U.Polyline(this.map, latlngs, { datalayer: this.datalayer, }).addTo(this.datalayer), - other = new L.U.Polyline(this.map, [p2ll(200, 300), p2ll(300, 200)], { + other = new U.Polyline(this.map, [p2ll(200, 300), p2ll(300, 200)], { datalayer: this.datalayer, }).addTo(this.datalayer) assert.ok(this.map.hasLayer(layer)) @@ -285,10 +285,10 @@ describe('L.U.Polyline', function () { [p2ll(100, 150), p2ll(100, 200), p2ll(200, 100)], [p2ll(200, 300), p2ll(300, 200)], ], - layer = new L.U.Polyline(this.map, latlngs, { + layer = new U.Polyline(this.map, latlngs, { datalayer: this.datalayer, }).addTo(this.datalayer), - other = new L.U.Polyline(this.map, [p2ll(250, 300), p2ll(350, 200)], { + other = new U.Polyline(this.map, [p2ll(250, 300), p2ll(350, 200)], { datalayer: this.datalayer, }).addTo(this.datalayer) assert.ok(this.map.hasLayer(layer)) @@ -312,7 +312,7 @@ describe('L.U.Polyline', function () { [0, 2], ], ], - layer = new L.U.Polyline(this.map, latlngs, { + layer = new U.Polyline(this.map, latlngs, { datalayer: this.datalayer, }).addTo(this.datalayer) layer.mergeShapes() @@ -336,7 +336,7 @@ describe('L.U.Polyline', function () { [0, 1], ], ], - layer = new L.U.Polyline(this.map, latlngs, { + layer = new U.Polyline(this.map, latlngs, { datalayer: this.datalayer, }).addTo(this.datalayer) layer.mergeShapes() @@ -352,7 +352,7 @@ describe('L.U.Polyline', function () { describe('#isolateShape', function () { it('should not allow to isolate simple line', function () { var latlngs = [p2ll(100, 150), p2ll(100, 200), p2ll(200, 100)], - layer = new L.U.Polyline(this.map, latlngs, { + layer = new U.Polyline(this.map, latlngs, { datalayer: this.datalayer, }).addTo(this.datalayer) assert.equal(this.datalayer._index.length, 1) @@ -367,7 +367,7 @@ describe('L.U.Polyline', function () { [p2ll(100, 150), p2ll(100, 200), p2ll(200, 100)], [[p2ll(200, 300), p2ll(300, 200)]], ], - layer = new L.U.Polyline(this.map, latlngs, { + layer = new U.Polyline(this.map, latlngs, { datalayer: this.datalayer, }).addTo(this.datalayer) assert.equal(this.datalayer._index.length, 1) @@ -386,7 +386,7 @@ describe('L.U.Polyline', function () { describe('#clone', function () { it('should clone polyline', function () { var latlngs = [p2ll(100, 150), p2ll(100, 200), p2ll(200, 100)], - layer = new L.U.Polyline(this.map, latlngs, { + layer = new U.Polyline(this.map, latlngs, { datalayer: this.datalayer, }).addTo(this.datalayer) assert.equal(this.datalayer._index.length, 1) diff --git a/umap/static/umap/test/_pre.js b/umap/static/umap/test/_pre.js index 85a7c8ea..823cd07e 100644 --- a/umap/static/umap/test/_pre.js +++ b/umap/static/umap/test/_pre.js @@ -219,7 +219,7 @@ function initMap(options) { type: 'Point', coordinates: [5.0592041015625, 52.05924589011585], } - return new L.U.Map('map', options) + return new U.Map('map', options) } var RESPONSES = { diff --git a/umap/templates/umap/content.html b/umap/templates/umap/content.html index 8b987860..f061d8eb 100644 --- a/umap/templates/umap/content.html +++ b/umap/templates/umap/content.html @@ -38,8 +38,8 @@ {{ block.super }}