first commit
This commit is contained in:
BIN
libraries/ckeditor/plugins/leaflet/.DS_Store
vendored
Normal file
BIN
libraries/ckeditor/plugins/leaflet/.DS_Store
vendored
Normal file
Binary file not shown.
43
libraries/ckeditor/plugins/leaflet/css/contents.css
Normal file
43
libraries/ckeditor/plugins/leaflet/css/contents.css
Normal file
@@ -0,0 +1,43 @@
|
||||
.leaflet_div {
|
||||
background: #eee;
|
||||
border: 1px solid #ddd;
|
||||
border-radius: 4px;
|
||||
box-shadow: 0 1px 1px #fff inset, 0 -1px 0px #ccc inset;
|
||||
line-height: 0;
|
||||
margin-right: 1em;
|
||||
margin-bottom: 1em;
|
||||
}
|
||||
|
||||
.leaflet_div.align-left {
|
||||
float: left;
|
||||
}
|
||||
|
||||
.leaflet_div.align-right {
|
||||
float: right;
|
||||
}
|
||||
|
||||
.leaflet_div.align-center {
|
||||
display: table;
|
||||
margin-left: auto;
|
||||
margin-right: auto;
|
||||
}
|
||||
|
||||
.cke_widget_wrapper:hover>.cke_widget_element {
|
||||
outline: 3px solid yellow !important;
|
||||
}
|
||||
|
||||
.responsive-map {
|
||||
height: 0;
|
||||
padding-bottom: 56.25%;
|
||||
padding-top: 25px;
|
||||
position: relative;
|
||||
width:100%;
|
||||
}
|
||||
|
||||
.responsive-map-iframe {
|
||||
height: 100%;
|
||||
left: 0;
|
||||
position: absolute;
|
||||
top: 0;
|
||||
width: 100%;
|
||||
}
|
||||
518
libraries/ckeditor/plugins/leaflet/dialogs/leaflet.js
Normal file
518
libraries/ckeditor/plugins/leaflet/dialogs/leaflet.js
Normal file
@@ -0,0 +1,518 @@
|
||||
CKEDITOR.dialog.add('leaflet', function(editor) {
|
||||
var autocomplete;
|
||||
var mapContainer = '';
|
||||
|
||||
// Access the current translation file.
|
||||
var pluginTranslation = editor.lang.leaflet;
|
||||
|
||||
// Use the core translation file. Used mainly for the `Alignment` values.
|
||||
var commonTranslation = editor.lang.common;
|
||||
|
||||
// Dialog's function callback for the Leaflet Map Widget.
|
||||
return {
|
||||
title: pluginTranslation.dialogTitle,
|
||||
minWidth: 320,
|
||||
minHeight: 125,
|
||||
|
||||
contents: [{
|
||||
// Create a Location tab.
|
||||
id: 'location_tab',
|
||||
label: pluginTranslation.locationTabLabel,
|
||||
elements: [
|
||||
// {
|
||||
// id: 'map_geocode',
|
||||
// className: 'geocode',
|
||||
// type: 'text',
|
||||
// label: pluginTranslation.googleSearchFieldLabel,
|
||||
// style: 'margin-top: -7px;',
|
||||
//
|
||||
// setup: function(widget) {
|
||||
// this.setValue('');
|
||||
// },
|
||||
//
|
||||
// onLoad: function (widget) {
|
||||
// // Get the DOM reference for the Search field.
|
||||
// var input = this.getInputElement().$;
|
||||
//
|
||||
// // Set a diffused/default text for better user experience.
|
||||
// // This will override the Google's default placeholder text:
|
||||
// // 'Enter a location'.
|
||||
// jQuery('.geocode input').attr('placeholder', pluginTranslation.googleSearchFieldHint);
|
||||
//
|
||||
// var config = editor.config;
|
||||
//
|
||||
// // Default value, but eventually will reach its quota if many users
|
||||
// // will just utilize this key instead of creating their own.
|
||||
// var googleApiKey = 'AIzaSyA9ySM6msnGm0qQB1L1cLTMBdKEUKPySmQ';
|
||||
//
|
||||
// if (typeof config.leaflet_maps_google_api_key != 'undefined' && config.leaflet_maps_google_api_key != '') {
|
||||
// googleApiKey = config.leaflet_maps_google_api_key;
|
||||
// }
|
||||
//
|
||||
// // Execute only once, and not every dialog pop-up.
|
||||
// if (typeof google == 'undefined') {
|
||||
// // Load other needed external library.
|
||||
// // Wait for the script to finish loading before binding
|
||||
// // the autocomplete mechanism to prevent rendering issue.
|
||||
// CKEDITOR.scriptLoader.load('//maps.googleapis.com/maps/api/js?libraries=places&callback=dummy&key=' + googleApiKey, function() {
|
||||
// // Bind the Search field to the Autocomplete widget.
|
||||
// autocomplete = new google.maps.places.Autocomplete(input);
|
||||
// });
|
||||
// } else {
|
||||
// autocomplete = new google.maps.places.Autocomplete(input);
|
||||
// }
|
||||
//
|
||||
// // Fix for the Google's type-ahead search displaying behind
|
||||
// // the widgets dialog window.
|
||||
// // Basically, we want to override the z-index of the
|
||||
// // Seach Autocomplete list, in which the styling is being set
|
||||
// // in real-time by Google.
|
||||
// // Make a new DOM element.
|
||||
// var stylesheet = jQuery('<style type="text/css" />');
|
||||
//
|
||||
// // Set the inner HTML. Include also the vertical alignment
|
||||
// // adjustment for the MiniMap checkbox.
|
||||
// stylesheet.html('.pac-container { z-index: 100000 !important;} input.minimap { margin-top: 18px !important; }');
|
||||
//
|
||||
// // Append to the main document's Head section.
|
||||
// jQuery('head').append(stylesheet);
|
||||
// },
|
||||
// },
|
||||
|
||||
{ // Dummy element serving as label/text container only.
|
||||
type: 'html',
|
||||
id: 'map_label',
|
||||
className: 'label',
|
||||
style: 'margin-bottom: -10px;',
|
||||
html: '<p>' + pluginTranslation.manualCoordinatesFieldLabel + '</p>'
|
||||
},
|
||||
|
||||
{
|
||||
// Create a new horizontal group.
|
||||
type: 'hbox',
|
||||
// Set the relative widths of Latitude, Longitude and Zoom fields.
|
||||
widths: [ '50%', '50%' ],
|
||||
children: [
|
||||
{
|
||||
id: 'map_latitude',
|
||||
className: 'latitude',
|
||||
type: 'text',
|
||||
label: pluginTranslation.manualLatitudeFieldLabel,
|
||||
|
||||
setup: function(widget) {
|
||||
// Set the Lat values if widget has previous value.
|
||||
if (widget.element.data('lat') !== '') {
|
||||
// Update the data-lat based on the map lat in iframe.
|
||||
// Make sure that mapContainer is set.
|
||||
// Also avoids setting it again since zoom/longitude
|
||||
// might already computed/set this object.
|
||||
if (mapContainer === '') {
|
||||
mapContainer = widget.element.getChild(0).$.contentDocument.getElementById('map_container');
|
||||
}
|
||||
|
||||
var currentLat = mapContainer.getAttribute('data-lat');
|
||||
|
||||
this.setValue(currentLat);
|
||||
}
|
||||
},
|
||||
},
|
||||
|
||||
{
|
||||
id: 'map_longitude',
|
||||
className: 'longitude',
|
||||
type: 'text',
|
||||
label: pluginTranslation.manualLongitudeFieldLabel,
|
||||
|
||||
setup: function(widget) {
|
||||
// Set the Lon values if widget has previous value.
|
||||
if (widget.element.data('lat') !== '') {
|
||||
// Update the data-lon based on the map lon in iframe.
|
||||
// Make sure that mapContainer is set.
|
||||
// Also avoids setting it again since zoom/latitude
|
||||
// might already computed/set this object.
|
||||
if (mapContainer === '') {
|
||||
mapContainer = widget.element.getChild(0).$.contentDocument.getElementById('map_container');
|
||||
}
|
||||
|
||||
var currentLon = mapContainer.getAttribute('data-lon');
|
||||
|
||||
this.setValue(currentLon);
|
||||
}
|
||||
},
|
||||
},
|
||||
]
|
||||
},
|
||||
|
||||
{
|
||||
id: 'popup_text',
|
||||
className: 'popup-text',
|
||||
type: 'text',
|
||||
label: pluginTranslation.popupTextFieldLabel,
|
||||
style: 'margin-bottom: 8px;',
|
||||
|
||||
setup: function(widget) {
|
||||
// Set the Lat values if widget has previous value.
|
||||
if (widget.element.data('popup-text') != '') {
|
||||
this.setValue(widget.element.data('popup-text'));
|
||||
}
|
||||
|
||||
else {
|
||||
// Set a diffused/default text for better user experience.
|
||||
this.getInputElement().setAttribute('placeholder', pluginTranslation.popupTextFieldHint)
|
||||
}
|
||||
},
|
||||
},
|
||||
]
|
||||
},
|
||||
|
||||
{
|
||||
// Create an Options tab.
|
||||
id: 'options_tab',
|
||||
label: pluginTranslation.optionsTabLabel,
|
||||
elements: [
|
||||
{
|
||||
// Create a new horizontal group.
|
||||
type: 'hbox',
|
||||
style: 'margin-top: -7px;',
|
||||
// Set the relative widths of Latitude, Longitude and Zoom fields.
|
||||
widths: [ '38%', '38%', '24%' ],
|
||||
children: [
|
||||
{
|
||||
id: 'width',
|
||||
className: 'map_width',
|
||||
type: 'text',
|
||||
label: pluginTranslation.mapWidthFieldLabel,
|
||||
|
||||
setup: function(widget) {
|
||||
// Set a diffused/default text for better user experience.
|
||||
this.getInputElement().setAttribute('placeholder', '400')
|
||||
|
||||
// Set the map width value if widget has a previous value.
|
||||
if (widget.element.data('width') != '') {
|
||||
this.setValue(widget.element.data('width'));
|
||||
}
|
||||
},
|
||||
},
|
||||
|
||||
{
|
||||
id: 'height',
|
||||
className: 'map_height',
|
||||
type: 'text',
|
||||
label: pluginTranslation.mapHeightFieldLabel,
|
||||
|
||||
setup: function(widget) {
|
||||
// Set a diffused/default text for better user experience.
|
||||
this.getInputElement().setAttribute('placeholder', '400');
|
||||
|
||||
// Set the map height value if widget has a previous value.
|
||||
if (widget.element.data('height') != '') {
|
||||
this.setValue(widget.element.data('height'));
|
||||
}
|
||||
},
|
||||
},
|
||||
|
||||
{
|
||||
// Create a select list for Zoom Levels.
|
||||
// 'className' attribute is used for targeting this element in jQuery.
|
||||
id: 'map_zoom',
|
||||
className: 'zoom',
|
||||
type: 'select',
|
||||
label: pluginTranslation.mapZoomLevelFieldLabel,
|
||||
width: '70px',
|
||||
items: [['1'], ['2'], ['3'], ['4'],['5'], ['6'], ['7'], ['8'], ['9'], ['10'], ['11'], ['12'], ['13'], ['14'], ['15'], ['16'], ['17'], ['18'], ['19'], ['20']],
|
||||
|
||||
// This will execute also every time you edit/double-click the widget.
|
||||
setup: function(widget) {
|
||||
// Set this Zoom Level's select list when
|
||||
// the current location has been initialized and set previously.
|
||||
if (widget.element.data('zoom') != '') {
|
||||
// Update the data-zoom based on the map zoom level in iframe.
|
||||
// Make sure that mapContainer is set.
|
||||
// Also avoids setting it again since latitude/longitude
|
||||
// might already computed/set this object.
|
||||
if (mapContainer === '') {
|
||||
mapContainer = widget.element.getChild(0).$.contentDocument.getElementById('map_container');
|
||||
}
|
||||
|
||||
var currentZoom = mapContainer.getAttribute('data-zoom');
|
||||
|
||||
this.setValue(currentZoom);
|
||||
}
|
||||
|
||||
// Set the Default Zoom Level value.
|
||||
else {
|
||||
this.setValue('10');
|
||||
}
|
||||
},
|
||||
}
|
||||
]
|
||||
},
|
||||
|
||||
{
|
||||
// Create a new horizontal group.
|
||||
type: 'hbox',
|
||||
// Set the relative widths for the tile and overview map fields.
|
||||
widths: [ '50%', '50%' ],
|
||||
children: [
|
||||
{
|
||||
// Create a select list for map tiles.
|
||||
// 'className' attribute is used for targeting this element in jQuery.
|
||||
type: 'select',
|
||||
id: 'map_tile',
|
||||
className: 'tile',
|
||||
label: pluginTranslation.baseMapTileLabel,
|
||||
items: [['OpenStreetMap.Mapnik'], ['OpenStreetMap.DE'], ['OpenStreetMap.HOT'], ['Esri.DeLorme'], ['Esri.NatGeoWorldMap'], ['Esri.WorldPhysical'], ['Esri.WorldTopoMap'], ['Thunderforest.OpenCycleMap'], ['Thunderforest.Landscape'], ['Stamen.Watercolor']],
|
||||
|
||||
// This will execute also every time you edit/double-click the widget.
|
||||
setup: function(widget) {
|
||||
var restrictedTiles = ['MapQuestOpen.Aerial', 'MapQuestOpen.OSM'];
|
||||
|
||||
var tile = widget.element.data('tile');
|
||||
|
||||
// Set the Tile data attribute.
|
||||
// Must not be the restricted, MapQuest tiles.
|
||||
if ( tile != '' && restrictedTiles.indexOf(tile) == -1 ) {
|
||||
this.setValue(tile);
|
||||
}
|
||||
|
||||
else {
|
||||
// Set the default value.
|
||||
// Includes the case for existing MapQuest tiles.
|
||||
this.setValue('OpenStreetMap.Mapnik');
|
||||
}
|
||||
},
|
||||
|
||||
// This will execute every time you click the Dialog's OK button.
|
||||
// It will inject a map iframe in the CKEditor page.
|
||||
commit: function(widget) {
|
||||
var dialog = this.getDialog();
|
||||
|
||||
// Remove the iframe if it has one.
|
||||
widget.element.setHtml('');
|
||||
|
||||
// Retrieve the value in the Search field.
|
||||
var geocode = ''; //dialog.getContentElement('location_tab','map_geocode').getValue();
|
||||
var latitude, longitude;
|
||||
|
||||
if (geocode != '') {
|
||||
// No need to call the encodeURIComponent().
|
||||
var geocodingRequest = '//maps.googleapis.com/maps/api/geocode/json?address=' + geocode + '&sensor=false';
|
||||
|
||||
// Disable the asynchoronous behavior temporarily so that
|
||||
// waiting for results will happen before proceeding
|
||||
// to the next statements.
|
||||
jQuery.ajaxSetup({
|
||||
async: false
|
||||
});
|
||||
|
||||
// Geocode the retrieved place name.
|
||||
jQuery.getJSON(geocodingRequest, function(data) {
|
||||
if (data['status'] != 'ZERO_RESULTS') {
|
||||
// Get the Latitude and Longitude object in the
|
||||
// returned JSON object.
|
||||
latitude = data.results[0].geometry.location.lat;
|
||||
longitude = data.results[0].geometry.location.lng;
|
||||
}
|
||||
|
||||
// Handle queries with no results or have some
|
||||
// malformed parameters.
|
||||
else {
|
||||
alert('The Place could not be Geocoded properly. Kindly choose another one.')
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
// Get the Lat/Lon values from the corresponding fields.
|
||||
var latInput = dialog.getContentElement('location_tab','map_latitude').getValue();
|
||||
var lonInput = dialog.getContentElement('location_tab','map_longitude').getValue();
|
||||
|
||||
// Get the data-lat and data-lon values.
|
||||
// It is empty for yet to be created widgets.
|
||||
var latSaved = widget.element.data('lat');
|
||||
var lonSaved = widget.element.data('lon');
|
||||
|
||||
// Used the inputted values if it's not empty or
|
||||
// not equal to the previously saved values.
|
||||
// latSaved and lonSaved are initially empty also
|
||||
// for widgets that are yet to be created.
|
||||
// Or if the user edited an existing map, and did not edit
|
||||
// the lat/lon fields, and the Search field is empty.
|
||||
if ((latInput != '' && lonInput != '') && ((latInput != latSaved && lonInput != lonSaved) || geocode == '')) {
|
||||
latitude = latInput;
|
||||
longitude = lonInput;
|
||||
}
|
||||
|
||||
var width = dialog.getContentElement('options_tab','width').getValue() || '400';
|
||||
var height = dialog.getContentElement('options_tab','height').getValue() || '400';
|
||||
var zoom = dialog.getContentElement('options_tab','map_zoom').getValue();
|
||||
var popUpText = dialog.getContentElement('location_tab','popup_text').getValue();
|
||||
var tile = dialog.getContentElement('options_tab','map_tile').getValue();
|
||||
var alignment = dialog.getContentElement('options_tab','map_alignment').getValue();
|
||||
|
||||
// Returns 'on' or 'off'.
|
||||
var minimap = dialog.getContentElement('options_tab','map_mini').getValue()?'on':'off';
|
||||
|
||||
// Get a unique timestamp:
|
||||
var milliseconds = new Date().getTime();
|
||||
|
||||
// Set/Update the widget's data attributes.
|
||||
widget.element.setAttribute('id', 'leaflet_div-' + milliseconds);
|
||||
|
||||
widget.element.data('lat', latitude);
|
||||
widget.element.data('lon', longitude);
|
||||
widget.element.data('width', width);
|
||||
widget.element.data('height', height);
|
||||
widget.element.data('zoom', zoom);
|
||||
widget.element.data('popup-text', popUpText);
|
||||
widget.element.data('tile', tile);
|
||||
widget.element.data('minimap', minimap);
|
||||
widget.element.data('alignment', alignment);
|
||||
|
||||
// Remove the previously set alignment class.
|
||||
// Only one alignment class is set per map.
|
||||
widget.element.removeClass('align-left');
|
||||
widget.element.removeClass('align-right');
|
||||
widget.element.removeClass('align-center');
|
||||
|
||||
// Set the alignment for this map.
|
||||
widget.element.addClass('align-' + alignment);
|
||||
|
||||
// Returns 'on' or 'off'.
|
||||
var responsive = dialog.getContentElement('options_tab','map_responsive').getValue()?'on':'off';
|
||||
|
||||
// Use 'off' if the Responsive checkbox is unchecked.
|
||||
if (responsive === 'off') {
|
||||
// Remove the previously set responsive map class,
|
||||
// if there's any.
|
||||
widget.element.removeClass('responsive-map');
|
||||
}
|
||||
|
||||
else {
|
||||
// Add a class for styling.
|
||||
widget.element.addClass('responsive-map');
|
||||
}
|
||||
|
||||
// Set the 'responsive' data attribute.
|
||||
widget.element.data('responsive', responsive);
|
||||
|
||||
// Build the full path to the map renderer.
|
||||
mapParserPathFull = mapParserPath + '?lat=' + latitude + '&lon=' + longitude + '&width=' + width + '&height=' + height + '&zoom=' + zoom + '&text=' + popUpText + '&tile=' + tile + '&minimap=' + minimap + '&responsive=' + responsive;
|
||||
|
||||
// Create a new CKEditor DOM's iFrame.
|
||||
var iframe = new CKEDITOR.dom.element('iframe');
|
||||
|
||||
// Setup the iframe characteristics.
|
||||
iframe.setAttributes({
|
||||
'scrolling': 'no',
|
||||
'id': 'leaflet_iframe-' + milliseconds,
|
||||
'class': 'leaflet_iframe',
|
||||
'width': width + 'px',
|
||||
'height': height + 'px',
|
||||
'frameborder': 0,
|
||||
'allowTransparency': true,
|
||||
'src': mapParserPathFull,
|
||||
'data-cke-saved-src': mapParserPathFull
|
||||
});
|
||||
|
||||
// If map is responsive.
|
||||
if (responsive == 'on') {
|
||||
// Add a class for styling.
|
||||
iframe.setAttribute('class', 'leaflet_iframe responsive-map-iframe');
|
||||
}
|
||||
|
||||
// Insert the iframe to the widget's DIV element.
|
||||
widget.element.append(iframe);
|
||||
},
|
||||
},
|
||||
|
||||
{
|
||||
type: 'checkbox',
|
||||
id: 'map_mini',
|
||||
className: 'minimap',
|
||||
label: pluginTranslation.minimapCheckboxLabel,
|
||||
|
||||
// This will execute also every time you edit/double-click the widget.
|
||||
setup: function(widget) {
|
||||
// Set the MiniMap check button.
|
||||
if (widget.element.data('minimap') != '' && widget.element.data('minimap') != 'on') {
|
||||
this.setValue('');
|
||||
}
|
||||
|
||||
else {
|
||||
// Set the default value.
|
||||
this.setValue('true');
|
||||
}
|
||||
},
|
||||
}
|
||||
]
|
||||
},
|
||||
|
||||
{
|
||||
// Create a new horizontal group.
|
||||
type: 'hbox',
|
||||
// Set the relative widths for alignment and responsive options.
|
||||
widths: [ '50%', '50%' ],
|
||||
children: [
|
||||
{
|
||||
// Create a select list for Map Alignment.
|
||||
// 'className' attribute is used for targeting this element in jQuery.
|
||||
id: 'map_alignment',
|
||||
className: 'alignment',
|
||||
type: 'select',
|
||||
label: commonTranslation.align,
|
||||
items: [[commonTranslation.alignLeft, 'left'], [commonTranslation.alignRight, 'right'], [commonTranslation.alignCenter, 'center']],
|
||||
style: 'margin-bottom: 4px;',
|
||||
|
||||
// This will execute also every time you edit/double-click the widget.
|
||||
setup: function(widget) {
|
||||
// Set this map alignment's select list when
|
||||
// the current map has been initialized and set previously.
|
||||
if (widget.element.data('alignment') != '') {
|
||||
// Set the alignment.
|
||||
this.setValue(widget.element.data('alignment'));
|
||||
}
|
||||
|
||||
// Set the Default alignment value.
|
||||
else {
|
||||
this.setValue('left');
|
||||
}
|
||||
},
|
||||
},
|
||||
|
||||
{
|
||||
type: 'checkbox',
|
||||
id: 'map_responsive',
|
||||
className: 'responsive',
|
||||
label: pluginTranslation.responsiveMapCheckboxLabel,
|
||||
// style: 'margin-top: 18px;',
|
||||
|
||||
// This will execute also every time you edit/double-click the widget.
|
||||
setup: function(widget) {
|
||||
// Set the Responsive check button, when editing widget.
|
||||
if (widget.element.data('responsive') != '') {
|
||||
if (widget.element.data('responsive') == 'on') {
|
||||
this.setValue('true');
|
||||
}
|
||||
|
||||
else {
|
||||
this.setValue('');
|
||||
}
|
||||
}
|
||||
|
||||
// Set the default value for new ones.
|
||||
else {
|
||||
this.setValue('');
|
||||
}
|
||||
},
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}],
|
||||
onHide: function(){
|
||||
// Reset/clear the map iframe/DOM object reference.
|
||||
// Fixes bug with lon/lat/zoom artifact values when closing dialog by pressing anything except ok.
|
||||
mapContainer = '';
|
||||
}
|
||||
};
|
||||
});
|
||||
BIN
libraries/ckeditor/plugins/leaflet/icons/leaflet.png
Normal file
BIN
libraries/ckeditor/plugins/leaflet/icons/leaflet.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 269 B |
19
libraries/ckeditor/plugins/leaflet/lang/de.js
Normal file
19
libraries/ckeditor/plugins/leaflet/lang/de.js
Normal file
@@ -0,0 +1,19 @@
|
||||
CKEDITOR.plugins.setLang('leaflet', 'de', {
|
||||
buttonLabel: 'Karte einfügen/bearbeiten',
|
||||
dialogTitle: 'Eigenschaften',
|
||||
locationTabLabel: 'Karte',
|
||||
googleSearchFieldLabel: 'Ort suchen',
|
||||
googleSearchFieldHint: 'Geben Sie einen Standort ein',
|
||||
manualCoordinatesFieldLabel: 'oder Koordinaten',
|
||||
manualLatitudeFieldLabel: 'Breitengrad',
|
||||
manualLongitudeFieldLabel: 'Längengrad',
|
||||
popupTextFieldLabel: 'Marker',
|
||||
popupTextFieldHint: 'Pop-up Text (Optional)',
|
||||
optionsTabLabel: 'Optionen',
|
||||
mapWidthFieldLabel: 'Breite',
|
||||
mapHeightFieldLabel: 'Höhe',
|
||||
mapZoomLevelFieldLabel: 'Zoom',
|
||||
baseMapTileLabel: 'Quelle Kartenmaterial',
|
||||
minimapCheckboxLabel: 'Übersichtskarte',
|
||||
responsiveMapCheckboxLabel: 'Responsive',
|
||||
});
|
||||
20
libraries/ckeditor/plugins/leaflet/lang/en.js
Normal file
20
libraries/ckeditor/plugins/leaflet/lang/en.js
Normal file
@@ -0,0 +1,20 @@
|
||||
// Declare the plugin's English translation.
|
||||
CKEDITOR.plugins.setLang('leaflet', 'en', {
|
||||
buttonLabel: 'Wstaw mapę',
|
||||
dialogTitle: 'Stwórz/Edytuj mapę',
|
||||
locationTabLabel: 'Location',
|
||||
googleSearchFieldLabel: 'Auto-Complete Search Using Google',
|
||||
googleSearchFieldHint: 'Enter a place name here',
|
||||
manualCoordinatesFieldLabel: 'Podaj współrzędne',
|
||||
manualLatitudeFieldLabel: 'Szerokość',
|
||||
manualLongitudeFieldLabel: 'Długość',
|
||||
popupTextFieldLabel: 'Pop-up (opcjonalnie)',
|
||||
popupTextFieldHint: "",
|
||||
optionsTabLabel: 'Opcje',
|
||||
mapWidthFieldLabel: 'Szerokość',
|
||||
mapHeightFieldLabel: 'Wysokość',
|
||||
mapZoomLevelFieldLabel: 'Zbliżenie',
|
||||
baseMapTileLabel: 'Rodzaj mapy',
|
||||
minimapCheckboxLabel: 'dołącz MiniMapę',
|
||||
responsiveMapCheckboxLabel: 'Mapa responsywna'
|
||||
});
|
||||
19
libraries/ckeditor/plugins/leaflet/lang/eu.js
Normal file
19
libraries/ckeditor/plugins/leaflet/lang/eu.js
Normal file
@@ -0,0 +1,19 @@
|
||||
CKEDITOR.plugins.setLang('leaflet', 'eu', {
|
||||
buttonLabel: 'Txertatu Leaflet mapa',
|
||||
dialogTitle: 'Sortu/Editatu Leaflet mapa',
|
||||
locationTabLabel: 'Kokalekua',
|
||||
googleSearchFieldLabel: 'Osatu automatikoki Google erabiliz',
|
||||
googleSearchFieldHint: 'Sartu toki-izen bat hemen',
|
||||
manualCoordinatesFieldLabel: 'Koordenatuen eskuzko sarrera',
|
||||
manualLatitudeFieldLabel: 'Latitudea',
|
||||
manualLongitudeFieldLabel: 'Longitudea',
|
||||
popupTextFieldLabel: 'Laster-menuaren testua (hautazkoa)',
|
||||
popupTextFieldHint: "Sartu markatzailearen testua",
|
||||
optionsTabLabel: 'Aukerak',
|
||||
mapWidthFieldLabel: 'Maparen zabalera',
|
||||
mapHeightFieldLabel: 'Maparen altuera',
|
||||
mapZoomLevelFieldLabel: 'Zoom maila',
|
||||
baseMapTileLabel: 'Maparen lauzak',
|
||||
minimapCheckboxLabel: 'Bistaratu mapatxoa',
|
||||
responsiveMapCheckboxLabel: 'Mapa moldakorra (100% zabalera)',
|
||||
});
|
||||
20
libraries/ckeditor/plugins/leaflet/lang/pl.js
Normal file
20
libraries/ckeditor/plugins/leaflet/lang/pl.js
Normal file
@@ -0,0 +1,20 @@
|
||||
// Declare the plugin's English translation.
|
||||
CKEDITOR.plugins.setLang('leaflet', 'en', {
|
||||
buttonLabel: 'Wstaw mapę',
|
||||
dialogTitle: 'Stwórz/Edytuj mapę',
|
||||
locationTabLabel: 'Location',
|
||||
googleSearchFieldLabel: 'Auto-Complete Search Using Google',
|
||||
googleSearchFieldHint: 'Enter a place name here',
|
||||
manualCoordinatesFieldLabel: 'Podaj współrzędne',
|
||||
manualLatitudeFieldLabel: 'Szerokość',
|
||||
manualLongitudeFieldLabel: 'Długość',
|
||||
popupTextFieldLabel: 'Pop-up (opcjonalnie)',
|
||||
popupTextFieldHint: "Enter the marker's text",
|
||||
optionsTabLabel: 'Opcje',
|
||||
mapWidthFieldLabel: 'Szerokość',
|
||||
mapHeightFieldLabel: 'Wysokość',
|
||||
mapZoomLevelFieldLabel: 'Zbliżenie',
|
||||
baseMapTileLabel: 'Rodzaj mapy',
|
||||
minimapCheckboxLabel: 'dołącz MiniMapę',
|
||||
responsiveMapCheckboxLabel: 'Mapa responsywna (szerokość 100%)'
|
||||
});
|
||||
19
libraries/ckeditor/plugins/leaflet/lang/ru.js
Normal file
19
libraries/ckeditor/plugins/leaflet/lang/ru.js
Normal file
@@ -0,0 +1,19 @@
|
||||
CKEDITOR.plugins.setLang('leaflet', 'ru', {
|
||||
buttonLabel: 'Вставить карту',
|
||||
dialogTitle: 'Карта',
|
||||
locationTabLabel: 'Местоположение',
|
||||
googleSearchFieldLabel: 'Поиск через Google',
|
||||
googleSearchFieldHint: 'Введите название места',
|
||||
manualCoordinatesFieldLabel: 'Ручной ввод координат',
|
||||
manualLatitudeFieldLabel: 'Широта',
|
||||
manualLongitudeFieldLabel: 'Долгота',
|
||||
popupTextFieldLabel: 'Всплывающий текст (Опционально)',
|
||||
popupTextFieldHint: "Введите текст маркера",
|
||||
optionsTabLabel: 'Параметры',
|
||||
mapWidthFieldLabel: 'Ширина карты',
|
||||
mapHeightFieldLabel: 'Высота карты',
|
||||
mapZoomLevelFieldLabel: 'Масштаб',
|
||||
baseMapTileLabel: 'Вид карты',
|
||||
minimapCheckboxLabel: 'Включить миникарту',
|
||||
responsiveMapCheckboxLabel: 'Адаптивная карта (ширина 100%)',
|
||||
});
|
||||
176
libraries/ckeditor/plugins/leaflet/plugin.js
Normal file
176
libraries/ckeditor/plugins/leaflet/plugin.js
Normal file
@@ -0,0 +1,176 @@
|
||||
/**
|
||||
* @fileOverview Leaflet Map Widget.
|
||||
*/
|
||||
(function() {
|
||||
/* Flow of Control for CKEditor and Widget components:
|
||||
Loading the page:
|
||||
CKEditor init()
|
||||
Widget upcast()
|
||||
|
||||
Creating new widgets:
|
||||
Widget init()
|
||||
Widget data()
|
||||
Dialog select element's items()
|
||||
Dialog onShow()
|
||||
Dialog setup()
|
||||
Dialog commit()
|
||||
|
||||
When editing existing widgets:
|
||||
Dialog onShow()
|
||||
Dialog setup()
|
||||
Dialog commit()
|
||||
Widget data()
|
||||
|
||||
When saving page or clicking the CKEditor's Source button:
|
||||
Widget downcast()
|
||||
*/
|
||||
|
||||
// Add a new CKEditor plugin. Note that widgets are subclass of plugins.
|
||||
CKEDITOR.plugins.add('leaflet', {
|
||||
// Declare dependencies.
|
||||
requires: 'widget',
|
||||
|
||||
// Declare the supported languages.
|
||||
lang: 'de,en,eu,ru',
|
||||
|
||||
init: function(editor) {
|
||||
var config = editor.config;
|
||||
|
||||
// Dummy global method for quick workaround of asynchronous document.write()
|
||||
// issue of Google APIs with respect to CKEditor.
|
||||
// See the Google APIs URL below for the query string usage of this dummy().
|
||||
// Using this hack, the document.write(...) requirement of Google APIs
|
||||
// will be replaced by the more 'gentle' combination of
|
||||
// document.createElement(...) and document.body.appendChild(...).
|
||||
window.dummy = function() {
|
||||
// Do nothing.
|
||||
}
|
||||
|
||||
// Check if jQuery is already loaded to avoid redundancy and overriding
|
||||
// existing 3rd-party jQuery plugins' bindings to jQuery prototype.
|
||||
if (typeof jQuery == 'undefined') {
|
||||
// This is asynchronous loading.
|
||||
// See also CKEDITOR.scriptLoader.queue.
|
||||
CKEDITOR.scriptLoader.load('//code.jquery.com/jquery-1.12.4.min.js');
|
||||
}
|
||||
|
||||
// Access the current translation file.
|
||||
var pluginTranslation = editor.lang.leaflet;
|
||||
|
||||
// Declare a new Dialog for interactive selection of
|
||||
// map parameters. It's still not bound to any widget at this moment.
|
||||
CKEDITOR.dialog.add('leaflet', this.path + 'dialogs/leaflet.js');
|
||||
|
||||
// For reusability, declare a global variable pointing to the map script path
|
||||
// that will build and render the map.
|
||||
// In JavaScript, relative path must include the leading slash.
|
||||
mapParserPath = CKEDITOR.getUrl(this.path + 'scripts/mapParser.html');
|
||||
|
||||
// Declare a new widget.
|
||||
editor.widgets.add('leaflet', {
|
||||
// Bind the widget to the Dialog command.
|
||||
dialog: 'leaflet',
|
||||
|
||||
// Declare the elements to be upcasted back.
|
||||
// Otherwise, the widget's code will be ignored.
|
||||
// Basically, we will allow all divs with 'leaflet_div' class,
|
||||
// including their alignment classes, and all iframes with
|
||||
// 'leaflet_iframe' class, and then include
|
||||
// all their attributes.
|
||||
// Read more about the Advanced Content Filter here:
|
||||
// * http://docs.ckeditor.com/#!/guide/dev_advanced_content_filter
|
||||
// * http://docs.ckeditor.com/#!/guide/plugin_sdk_integration_with_acf
|
||||
allowedContent: 'div(!leaflet_div,align-left,align-right,align-center,responsive-map)[*];'
|
||||
+ 'iframe(!leaflet_iframe,responsive-map-iframe)[*];',
|
||||
|
||||
// Declare the widget template/structure, containing the
|
||||
// important elements/attributes. This is a required property of widget.
|
||||
template:
|
||||
'<div id="" class="leaflet_div" data-lat="" data-lon="" data-width="" data-height="" ' +
|
||||
'data-zoom="" data-popup-text="" data-tile="" data-minimap="" data-alignment="" data-responsive=""></div>',
|
||||
|
||||
// This will be executed when going from the View Mode to Source Mode.
|
||||
// This is usually used as the function to convert the widget to a
|
||||
// dummy, simpler, or equivalent textual representation.
|
||||
downcast: function(element) {
|
||||
// Get the id of the div element.
|
||||
var divId = element.attributes["id"];
|
||||
|
||||
// Get the numeric part of divId: leaflet_div-1399121271748.
|
||||
// We'll use that number for quick fetching of target iframe.
|
||||
var iframeId = "leaflet_iframe-" + divId.substring(12);
|
||||
|
||||
// The current user might have changed the map's zoom level
|
||||
// via mouse events/zoom bar. The marker might have been
|
||||
// dragged also which means its lat/lon had changed.
|
||||
var mapContainer = editor.document.$.getElementById(iframeId).contentDocument.getElementById("map_container");
|
||||
|
||||
// Get the current map states.
|
||||
var currentZoom = mapContainer.getAttribute("data-zoom");
|
||||
var currentLat = mapContainer.getAttribute("data-lat");
|
||||
var currentLon = mapContainer.getAttribute("data-lon");
|
||||
|
||||
// Update the saved corresponding values in data attributes.
|
||||
element.attributes["data-zoom"] = currentZoom;
|
||||
element.attributes["data-lat"] = currentLat;
|
||||
element.attributes["data-lon"] = currentLon;
|
||||
|
||||
// Fetch the other data attributes needed for
|
||||
// updating the full path of the map.
|
||||
var width = element.attributes["data-width"];
|
||||
var height = element.attributes["data-height"];
|
||||
var popUpText = element.attributes["data-popup-text"];
|
||||
var tile = element.attributes["data-tile"];
|
||||
var minimap = element.attributes["data-minimap"];
|
||||
var responsive = element.attributes["data-responsive"];
|
||||
|
||||
// Build the updated full path to the map renderer.
|
||||
var mapParserPathFull = mapParserPath + "?lat=" + currentLat + "&lon=" + currentLon + "&width=" + width + "&height=" + height + "&zoom=" + currentZoom + "&text=" + popUpText + "&tile=" + tile + "&minimap=" + minimap + "&responsive=" + responsive;
|
||||
|
||||
// Update also the iframe's 'src' attributes.
|
||||
// Updating 'data-cke-saved-src' is also required for
|
||||
// internal use of CKEditor.
|
||||
element.children[0].attributes["src"] = mapParserPathFull;
|
||||
element.children[0].attributes["data-cke-saved-src"] = mapParserPathFull;
|
||||
|
||||
// Return the DOM's textual representation.
|
||||
return element;
|
||||
},
|
||||
|
||||
// Required property also for widgets, used when switching
|
||||
// from CKEditor's Source Mode to View Mode.
|
||||
// The reverse of downcast() method.
|
||||
upcast: function(element) {
|
||||
// If we encounter a div with a class of 'leaflet_div',
|
||||
// it means that it's a widget and we need to convert it properly
|
||||
// to its original structure.
|
||||
// Basically, it says to CKEditor which div is a valid widget.
|
||||
if (element.name == 'div' && element.hasClass('leaflet_div')) {
|
||||
return element;
|
||||
}
|
||||
},
|
||||
});
|
||||
|
||||
// Add the widget button in the toolbar and bind the widget command,
|
||||
// which is also bound to the Dialog command.
|
||||
// Apparently, this is required just like their plugin counterpart.
|
||||
editor.ui.addButton('leaflet', {
|
||||
label : pluginTranslation.buttonLabel,
|
||||
command : 'leaflet',
|
||||
icon : this.path + 'icons/leaflet.png',
|
||||
toolbar: 'insert,1'
|
||||
});
|
||||
|
||||
// Append the widget's styles when in the CKEditor edit page,
|
||||
// added for better user experience.
|
||||
// Assign or append the widget's styles depending on the existing setup.
|
||||
if (typeof config.contentsCss == 'object') {
|
||||
config.contentsCss.push(CKEDITOR.getUrl(this.path + 'css/contents.css'));
|
||||
}
|
||||
|
||||
else {
|
||||
config.contentsCss = [config.contentsCss, CKEDITOR.getUrl(this.path + 'css/contents.css')];
|
||||
}
|
||||
},
|
||||
});
|
||||
})();
|
||||
BIN
libraries/ckeditor/plugins/leaflet/scripts/.DS_Store
vendored
Normal file
BIN
libraries/ckeditor/plugins/leaflet/scripts/.DS_Store
vendored
Normal file
Binary file not shown.
BIN
libraries/ckeditor/plugins/leaflet/scripts/Leaflet-MiniMap/.DS_Store
vendored
Normal file
BIN
libraries/ckeditor/plugins/leaflet/scripts/Leaflet-MiniMap/.DS_Store
vendored
Normal file
Binary file not shown.
@@ -0,0 +1,22 @@
|
||||
Copyright (c) 2012, Norkart AS
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without modification, are
|
||||
permitted provided that the following conditions are met:
|
||||
|
||||
1. Redistributions of source code must retain the above copyright notice, this list of
|
||||
conditions and the following disclaimer.
|
||||
|
||||
2. Redistributions in binary form must reproduce the above copyright notice, this list
|
||||
of conditions and the following disclaimer in the documentation and/or other materials
|
||||
provided with the distribution.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
|
||||
EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
||||
COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
|
||||
TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
@@ -0,0 +1,25 @@
|
||||
{
|
||||
"name": "leaflet-minimap",
|
||||
"version": "1.0.0",
|
||||
"author": "Norkart AS",
|
||||
"description": "A plugin for Leaflet that provides a minimap in the corner of the map view.",
|
||||
"license": "BSD-2-Clause",
|
||||
"readmeFilename": "README.md",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/Norkart/Leaflet-MiniMap.git"
|
||||
},
|
||||
"homepage": "https://github.com/Norkart/Leaflet-MiniMap",
|
||||
"bugs": {
|
||||
"url": "https://github.com/Norkart/Leaflet-MiniMap/issues"
|
||||
},
|
||||
"dependencies": {
|
||||
"leaflet": ">=0.5.0"
|
||||
},
|
||||
"keywords": [
|
||||
"maps",
|
||||
"leaflet",
|
||||
"client",
|
||||
"minimap"
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,47 @@
|
||||
# Leaflet.MiniMap
|
||||
|
||||
Leaflet.MiniMap is a simple minimap control that you can drop into your leaflet map, and it will create a small map in the corner which shows the same as the main map with a set zoom offset. (By default it is -5.)
|
||||
|
||||
## Using the MiniMap control
|
||||
|
||||
The control can be inserted in two lines: First you have to construct a layer for it to use, and then you create and attach the minimap control. Don't reuse the layer you added to the main map, strange behaviour will ensue! Alternatively, you can pass in a LayerGroup with multiple layers (for example with overlays or suitably themed markers). Marker layers can't be reused either. (See issue #52 for a discussion of syncronising marker layers.)
|
||||
|
||||
From the [example](http://norkart.github.com/Leaflet-MiniMap/example.html):
|
||||
|
||||
var osm2 = new L.TileLayer(osmUrl, {minZoom: 0, maxZoom: 13, attribution: osmAttrib});
|
||||
var miniMap = new L.Control.MiniMap(osm2).addTo(map);
|
||||
|
||||
As the minimap control inherits from leaflet's control, positioning is handled automatically by leaflet. However, you can still style the minimap and set its size by modifying the css file.
|
||||
|
||||
**Note:** Leaflet version 0.5 or higher is required.
|
||||
|
||||
## Available Options
|
||||
The mini map uses options which can be set in the same way as other leaflet options, and these are the available options:
|
||||
|
||||
`position:` The standard Leaflet.Control position parameter, used like all the other controls. Defaults to 'bottomright'.
|
||||
|
||||
`width:` The width of the minimap in pixels. Defaults to 150.
|
||||
|
||||
`height:` The height of the minimap in pixels. Defaults to 150.
|
||||
|
||||
`zoomLevelOffset:` The offset applied to the zoom in the minimap compared to the zoom of the main map. Can be positive or negative, defaults to -5.
|
||||
|
||||
`zoomLevelFixed:` Overrides the offset to apply a fixed zoom level to the minimap regardless of the main map zoom. Set it to any valid zoom level, if unset `zoomLevelOffset` is used instead.
|
||||
|
||||
`zoomAnimation:` Sets whether the minimap should have an animated zoom. (Will cause it to lag a bit after the movement of the main map.) Defaults to false.
|
||||
|
||||
`toggleDisplay:` Sets whether the minimap should have a button to minimise it. Defaults to false.
|
||||
|
||||
`autoToggleDisplay:` Sets whether the minimap should hide automatically if the parent map bounds does not fit within the minimap bounds. Especially useful when 'zoomLevelFixed' is set.
|
||||
|
||||
`aimingRectOptions:` Sets the style of the aiming rectangle by passing in a [Path.Options object](http://leafletjs.com/reference.html#path-options). (Clickable will always be overridden and set to false.)
|
||||
|
||||
`shadowRectOptions:` Sets the style of the aiming shadow rectangle by passing in a [Path.Options object](http://leafletjs.com/reference.html#path-options). (Clickable will always be overridden and set to false.)
|
||||
|
||||
###Translation strings
|
||||
|
||||
These are not passed as options, but are overridden in a subclass. To do general translation overrides take a look at the german example sourcefile.
|
||||
|
||||
`hideText:` Text-String to be displayed as Tooltip when hovering over the toggle button on the MiniMap and it is visible.
|
||||
|
||||
`showText:` Text-String to be displayed as Tooltip when hovering over the toggle button on the MiniMap and it is hidden.
|
||||
BIN
libraries/ckeditor/plugins/leaflet/scripts/Leaflet-MiniMap/src/.DS_Store
vendored
Normal file
BIN
libraries/ckeditor/plugins/leaflet/scripts/Leaflet-MiniMap/src/.DS_Store
vendored
Normal file
Binary file not shown.
@@ -0,0 +1,43 @@
|
||||
.leaflet-control-minimap {
|
||||
border:solid rgba(255, 255, 255, 1.0) 4px;
|
||||
box-shadow: 0 1px 5px rgba(0,0,0,0.65);
|
||||
border-radius: 3px;
|
||||
background: #f8f8f9;
|
||||
transition: all .2s;
|
||||
}
|
||||
|
||||
.leaflet-control-minimap a {
|
||||
background-color: rgba(255, 255, 255, 1.0);
|
||||
background-repeat: no-repeat;
|
||||
z-index: 99999;
|
||||
transition: all .2s;
|
||||
border-radius: 3px 0px 0px 0px;
|
||||
}
|
||||
|
||||
.leaflet-control-minimap a.minimized {
|
||||
-webkit-transform: rotate(180deg);
|
||||
transform: rotate(180deg);
|
||||
border-radius: 0px;
|
||||
}
|
||||
|
||||
.leaflet-control-minimap-toggle-display {
|
||||
background-image: url("images/toggle.png");
|
||||
height: 19px;
|
||||
width: 19px;
|
||||
position: absolute;
|
||||
bottom: 0;
|
||||
right: 0;
|
||||
}
|
||||
|
||||
/* Old IE */
|
||||
.leaflet-oldie .leaflet-control-minimap {
|
||||
border: 1px solid #999;
|
||||
}
|
||||
|
||||
.leaflet-oldie .leaflet-control-minimap a {
|
||||
background-color: #fff;
|
||||
}
|
||||
|
||||
.leaflet-oldie .leaflet-control-minimap a.minimized {
|
||||
filter: progid:DXImageTransform.Microsoft.BasicImage(rotation=2);
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
L.Control.MiniMap=L.Control.extend({options:{position:"bottomright",toggleDisplay:!1,zoomLevelOffset:-5,zoomLevelFixed:!1,zoomAnimation:!1,autoToggleDisplay:!1,width:150,height:150,aimingRectOptions:{color:"#ff7800",weight:1,clickable:!1},shadowRectOptions:{color:"#000000",weight:1,clickable:!1,opacity:0,fillOpacity:0}},hideText:"Hide MiniMap",showText:"Show MiniMap",initialize:function(a,c){L.Util.setOptions(this,c);this.options.aimingRectOptions.clickable=!1;this.options.shadowRectOptions.clickable=
|
||||
!1;this._layer=a},onAdd:function(a){this._mainMap=a;this._container=L.DomUtil.create("div","leaflet-control-minimap");this._container.style.width=this.options.width+"px";this._container.style.height=this.options.height+"px";L.DomEvent.disableClickPropagation(this._container);L.DomEvent.on(this._container,"mousewheel",L.DomEvent.stopPropagation);this._miniMap=new L.Map(this._container,{attributionControl:!1,zoomControl:!1,zoomAnimation:this.options.zoomAnimation,autoToggleDisplay:this.options.autoToggleDisplay,
|
||||
touchZoom:!this.options.zoomLevelFixed,scrollWheelZoom:!this.options.zoomLevelFixed,doubleClickZoom:!this.options.zoomLevelFixed,boxZoom:!this.options.zoomLevelFixed,crs:a.options.crs});this._miniMap.addLayer(this._layer);this._minimized=this._userToggledDisplay=this._miniMapMoving=this._mainMapMoving=!1;this.options.toggleDisplay&&this._addToggleButton();this._miniMap.whenReady(L.Util.bind(function(){this._aimingRect=L.rectangle(this._mainMap.getBounds(),this.options.aimingRectOptions).addTo(this._miniMap);
|
||||
this._shadowRect=L.rectangle(this._mainMap.getBounds(),this.options.shadowRectOptions).addTo(this._miniMap);this._mainMap.on("moveend",this._onMainMapMoved,this);this._mainMap.on("move",this._onMainMapMoving,this);this._miniMap.on("movestart",this._onMiniMapMoveStarted,this);this._miniMap.on("move",this._onMiniMapMoving,this);this._miniMap.on("moveend",this._onMiniMapMoved,this)},this));return this._container},addTo:function(a){L.Control.prototype.addTo.call(this,a);this._miniMap.setView(this._mainMap.getCenter(),
|
||||
this._decideZoom(!0));this._setDisplay(this._decideMinimized());return this},onRemove:function(a){this._mainMap.off("moveend",this._onMainMapMoved,this);this._mainMap.off("move",this._onMainMapMoving,this);this._miniMap.off("moveend",this._onMiniMapMoved,this);this._miniMap.removeLayer(this._layer)},_addToggleButton:function(){this._toggleDisplayButton=this.options.toggleDisplay?this._createButton("",this.hideText,"leaflet-control-minimap-toggle-display",this._container,this._toggleDisplayButtonClicked,
|
||||
this):void 0},_createButton:function(a,c,b,d,e,f){b=L.DomUtil.create("a",b,d);b.innerHTML=a;b.href="#";b.title=c;a=L.DomEvent.stopPropagation;L.DomEvent.on(b,"click",a).on(b,"mousedown",a).on(b,"dblclick",a).on(b,"click",L.DomEvent.preventDefault).on(b,"click",e,f);return b},_toggleDisplayButtonClicked:function(){this._userToggledDisplay=!0;this._minimized?(this._restore(),this._toggleDisplayButton.title=this.hideText):(this._minimize(),this._toggleDisplayButton.title=this.showText)},_setDisplay:function(a){a!=
|
||||
this._minimized&&(this._minimized?this._restore():this._minimize())},_minimize:function(){this.options.toggleDisplay?(this._container.style.width="19px",this._container.style.height="19px",this._toggleDisplayButton.className+=" minimized"):this._container.style.display="none";this._minimized=!0},_restore:function(){this.options.toggleDisplay?(this._container.style.width=this.options.width+"px",this._container.style.height=this.options.height+"px",this._toggleDisplayButton.className=this._toggleDisplayButton.className.replace(/(?:^|\s)minimized(?!\S)/g,
|
||||
"")):this._container.style.display="block";this._minimized=!1},_onMainMapMoved:function(a){this._miniMapMoving?this._miniMapMoving=!1:(this._mainMapMoving=!0,this._miniMap.setView(this._mainMap.getCenter(),this._decideZoom(!0)),this._setDisplay(this._decideMinimized()));this._aimingRect.setBounds(this._mainMap.getBounds())},_onMainMapMoving:function(a){this._aimingRect.setBounds(this._mainMap.getBounds())},_onMiniMapMoveStarted:function(a){var c=this._aimingRect.getBounds();a=this._miniMap.latLngToContainerPoint(c.getSouthWest());
|
||||
c=this._miniMap.latLngToContainerPoint(c.getNorthEast());this._lastAimingRectPosition={sw:a,ne:c}},_onMiniMapMoving:function(a){!this._mainMapMoving&&this._lastAimingRectPosition&&(this._shadowRect.setBounds(new L.LatLngBounds(this._miniMap.containerPointToLatLng(this._lastAimingRectPosition.sw),this._miniMap.containerPointToLatLng(this._lastAimingRectPosition.ne))),this._shadowRect.setStyle({opacity:1,fillOpacity:.3}))},_onMiniMapMoved:function(a){this._mainMapMoving?this._mainMapMoving=!1:(this._miniMapMoving=
|
||||
!0,this._mainMap.setView(this._miniMap.getCenter(),this._decideZoom(!1)),this._shadowRect.setStyle({opacity:0,fillOpacity:0}))},_decideZoom:function(a){if(this.options.zoomLevelFixed)return a?this.options.zoomLevelFixed:this._mainMap.getZoom();if(a)return this._mainMap.getZoom()+this.options.zoomLevelOffset;a=this._miniMap.getZoom()-this._mainMap.getZoom();var c=this._miniMap.getZoom()-this.options.zoomLevelOffset;a>this.options.zoomLevelOffset&&this._mainMap.getZoom()<this._miniMap.getMinZoom()-
|
||||
this.options.zoomLevelOffset?this._miniMap.getZoom()>this._lastMiniMapZoom?(a=this._mainMap.getZoom()+1,this._miniMap.setZoom(this._miniMap.getZoom()-1)):a=this._mainMap.getZoom():a=c;this._lastMiniMapZoom=this._miniMap.getZoom();return a},_decideMinimized:function(){return this._userToggledDisplay?this._minimized:this.options.autoToggleDisplay?this._mainMap.getBounds().contains(this._miniMap.getBounds())?!0:!1:this._minimized}});L.Map.mergeOptions({miniMapControl:!1});
|
||||
L.Map.addInitHook(function(){this.options.miniMapControl&&(this.miniMapControl=(new L.Control.MiniMap).addTo(this))});L.control.minimap=function(a){return new L.Control.MiniMap(a)};
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 345 B |
BIN
libraries/ckeditor/plugins/leaflet/scripts/leaflet-providers/.DS_Store
vendored
Normal file
BIN
libraries/ckeditor/plugins/leaflet/scripts/leaflet-providers/.DS_Store
vendored
Normal file
Binary file not shown.
@@ -0,0 +1,75 @@
|
||||
Leaflet-providers
|
||||
=================
|
||||
An extension to [Leaflet](http://leafletjs.com/) that contains configurations for various free tile providers.
|
||||
|
||||
# Usage
|
||||
Leaflet-providers [providers](#providers) are refered to with a `provider[.<variant>]`-string. Let's say you want to add the nice [Watercolor](http://maps.stamen.com/#watercolor/) style from Stamen to your map, you pass `Stamen.Watercolor` to the `L.tileLayer.provider`-constructor, which will return a [L.TileLayer](http://leafletjs.com/reference.html#tilelayer) instance for Stamens Watercolor tile layer.
|
||||
|
||||
```Javascript
|
||||
// add Stamen Watercolor to map.
|
||||
L.tileLayer.provider('Stamen.Watercolor').addTo(map);
|
||||
```
|
||||
|
||||
# Providers
|
||||
|
||||
Leaflet-providers provides tile layers from different providers, including *OpenStreetMap*, *MapQuestOpen*, *Stamen*, *Esri* and *OpenWeatherMap*. The full listing of free to use layers can be [previewed](http://leaflet-extras.github.io/leaflet-providers/preview/index.html). The page will show you the name to use with `leaflet-providers.js` and the code to use it without dependencies.
|
||||
|
||||
## Providers requiring registration
|
||||
|
||||
In addition to the providers you are free to use, we support some layers which require registration.
|
||||
|
||||
### Nokia.
|
||||
|
||||
In order to use Nokia basemaps, you must [register](https://developer.here.com/web/guest/myapps). With your `devID` and `appID` specified in the options, the available layers are:
|
||||
|
||||
* Nokia.normalDay
|
||||
* Nokia.normalGreyDay
|
||||
* Nokia.satelliteNoLabelsDay
|
||||
* Nokia.satelliteYesLabelsDay
|
||||
* Nokia.terrainDay
|
||||
|
||||
For example:
|
||||
```Javascript
|
||||
L.tileLayer.provider('Nokia.terrainDay', {
|
||||
devID: 'insert ID here',
|
||||
appId: 'insert ID here'
|
||||
}).addTo(map);
|
||||
```
|
||||
|
||||
### Mapbox
|
||||
|
||||
In order to use Mapbox maps, you must [register](https://tiles.mapbox.com/signup). If your user name is `YourName` and your map is called `MyMap` you can add it with
|
||||
```JavaScript
|
||||
L.tileLayer.provider('MapBox.YourName.MyMap');
|
||||
```
|
||||
|
||||
### Esri/ArcGIS
|
||||
|
||||
In order to use ArcGIS maps, you must [register](https://developers.arcgis.com/en/sign-up/) and abide by the [terms of service](https://developers.arcgis.com/en/terms/). Available layers are...
|
||||
|
||||
* Esri.WorldStreetMap
|
||||
* Esri.DeLorme
|
||||
* Esri.WorldTopoMap
|
||||
* Esri.WorldImagery
|
||||
* Esri.WorldTerrain
|
||||
* Esri.WorldShadedRelief
|
||||
* Esri.WorldPhysical
|
||||
* Esri.OceanBasemap
|
||||
* Esri.NatGeoWorldMap
|
||||
* Esri.WorldGrayCanvas
|
||||
|
||||
# Goodies
|
||||
|
||||
An other little goodie this library provides is a prefilled layer control, so you can just provide an array of strings:
|
||||
|
||||
```JavaScript
|
||||
var baseLayers = ['Stamen.Watercolor', 'OpenStreetMap.Mapnik'],
|
||||
overlays = ['OpenWeatherMap.Clouds'];
|
||||
|
||||
var layerControl = L.control.layers.provided(baseLayers, overlays).addTo(map);
|
||||
|
||||
// you can still add your own afterwards with
|
||||
layerControl.addBaseLayer(layer, name);
|
||||
```
|
||||
|
||||
This work was inspired from <https://gist.github.com/1804938>, and originally created by [Stefan Seelmann](https://github.com/seelmann).
|
||||
@@ -0,0 +1,153 @@
|
||||
<!doctype html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<title>Leaflet Provider Demo</title>
|
||||
<meta charset="utf-8" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
|
||||
<!-- Leaflet style. REQUIRED! -->
|
||||
<link rel="stylesheet" href="http://cdn.leafletjs.com/leaflet-0.7/leaflet.css" />
|
||||
<style>
|
||||
html { height: 100% }
|
||||
body { height: 100%; margin: 0; padding: 0;}
|
||||
.map { height: 100% }
|
||||
</style>
|
||||
<!--Fork Me on Github ribbon, we're using the awsome version from simonwhitaker available at https://github.com/simonwhitaker/github-fork-ribbon-css -->
|
||||
<link rel="stylesheet" href="css/gh-fork-ribbon.css" />
|
||||
<!--[if IE]>
|
||||
<link rel="stylesheet" href="css/gh-fork-ribbon.ie.css" />
|
||||
<![endif]-->
|
||||
</head>
|
||||
<body>
|
||||
<div class="github-fork-ribbon-wrapper left">
|
||||
<div class="github-fork-ribbon">
|
||||
<a href="https://github.com/leaflet-extras/leaflet-providers">Fork me on GitHub</a>
|
||||
</div>
|
||||
</div>
|
||||
<div id="map" class="map"></div>
|
||||
|
||||
<script src="http://cdn.leafletjs.com/leaflet-0.7/leaflet-src.js"></script>
|
||||
<script src="leaflet-providers.js"></script>
|
||||
<script>
|
||||
var map = L.map('map', {
|
||||
center: [48, -3],
|
||||
zoom: 5,
|
||||
zoomControl: false
|
||||
});
|
||||
|
||||
var defaultLayer = L.tileLayer.provider('OpenStreetMap.Mapnik').addTo(map);
|
||||
|
||||
var baseLayers = {
|
||||
'OpenStreetMap Default': defaultLayer,
|
||||
'OpenStreetMap German Style': L.tileLayer.provider('OpenStreetMap.DE'),
|
||||
'OpenStreetMap Black and White': L.tileLayer.provider('OpenStreetMap.BlackAndWhite'),
|
||||
'OpenStreetMap H.O.T.': L.tileLayer.provider('OpenStreetMap.HOT'),
|
||||
'Thunderforest OpenCycleMap': L.tileLayer.provider('Thunderforest.OpenCycleMap'),
|
||||
'Thunderforest Transport': L.tileLayer.provider('Thunderforest.Transport'),
|
||||
'Thunderforest Landscape': L.tileLayer.provider('Thunderforest.Landscape'),
|
||||
'MapQuest OSM': L.tileLayer.provider('MapQuestOpen.OSM'),
|
||||
'MapQuest Aerial': L.tileLayer.provider('MapQuestOpen.Aerial'),
|
||||
'MapBox Example': L.tileLayer.provider('MapBox.examples.map-zr0njcqy'),
|
||||
'Stamen Toner': L.tileLayer.provider('Stamen.Toner'),
|
||||
'Stamen Terrain': L.tileLayer.provider('Stamen.Terrain'),
|
||||
'Stamen Watercolor': L.tileLayer.provider('Stamen.Watercolor'),
|
||||
'Esri WorldStreetMap': L.tileLayer.provider('Esri.WorldStreetMap'),
|
||||
'Esri DeLorme': L.tileLayer.provider('Esri.DeLorme'),
|
||||
'Esri WorldTopoMap': L.tileLayer.provider('Esri.WorldTopoMap'),
|
||||
'Esri WorldImagery': L.tileLayer.provider('Esri.WorldImagery'),
|
||||
'Esri WorldTerrain': L.tileLayer.provider('Esri.WorldTerrain'),
|
||||
'Esri WorldShadedRelief': L.tileLayer.provider('Esri.WorldShadedRelief'),
|
||||
'Esri WorldPhysical': L.tileLayer.provider('Esri.WorldPhysical'),
|
||||
'Esri OceanBasemap': L.tileLayer.provider('Esri.OceanBasemap'),
|
||||
'Esri NatGeoWorldMap': L.tileLayer.provider('Esri.NatGeoWorldMap'),
|
||||
'Esri WorldGrayCanvas': L.tileLayer.provider('Esri.WorldGrayCanvas'),
|
||||
'Nokia Normal Day': L.tileLayer.provider('Nokia.normalDay'),
|
||||
'Nokia Normal Day Grey': L.tileLayer.provider('Nokia.normalGreyDay'),
|
||||
'Nokia Satellite': L.tileLayer.provider('Nokia.satelliteNoLabelsDay'),
|
||||
'Nokia Satellite (Labeled)': L.tileLayer.provider('Nokia.satelliteYesLabelsDay'),
|
||||
'Nokia Terrain': L.tileLayer.provider('Nokia.terrainDay'),
|
||||
'Acetate': L.tileLayer.provider('Acetate')
|
||||
};
|
||||
|
||||
var overlayLayers = {
|
||||
'OpenSeaMap': L.tileLayer.provider('OpenSeaMap'),
|
||||
'OpenWeatherMap Clouds': L.tileLayer.provider('OpenWeatherMap.Clouds'),
|
||||
'OpenWeatherMap CloudsClassic': L.tileLayer.provider('OpenWeatherMap.CloudsClassic'),
|
||||
'OpenWeatherMap Precipitation': L.tileLayer.provider('OpenWeatherMap.Precipitation'),
|
||||
'OpenWeatherMap PrecipitationClassic': L.tileLayer.provider('OpenWeatherMap.PrecipitationClassic'),
|
||||
'OpenWeatherMap Rain': L.tileLayer.provider('OpenWeatherMap.Rain'),
|
||||
'OpenWeatherMap RainClassic': L.tileLayer.provider('OpenWeatherMap.RainClassic'),
|
||||
'OpenWeatherMap Pressure': L.tileLayer.provider('OpenWeatherMap.Pressure'),
|
||||
'OpenWeatherMap PressureContour': L.tileLayer.provider('OpenWeatherMap.PressureContour'),
|
||||
'OpenWeatherMap Wind': L.tileLayer.provider('OpenWeatherMap.Wind'),
|
||||
'OpenWeatherMap Temperature': L.tileLayer.provider('OpenWeatherMap.Temperature'),
|
||||
'OpenWeatherMap Snow': L.tileLayer.provider('OpenWeatherMap.Snow')
|
||||
};
|
||||
|
||||
var layerControl = L.control.layers(baseLayers, overlayLayers, {collapsed: false}).addTo(map);
|
||||
|
||||
/* you could also use the following code instead
|
||||
var map = new L.Map('map').setView([48, -3],5);
|
||||
|
||||
var defaultLayer = L.tileLayer.provider('OpenStreetMap.Mapnik').addTo(map);
|
||||
|
||||
var baseLayers = [
|
||||
'OpenStreetMap.Mapnik',
|
||||
'OpenStreetMap.DE',
|
||||
'OpenStreetMap.BlackAndWhite',
|
||||
'Thunderforest.OpenCycleMap',
|
||||
'Thunderforest.Transport',
|
||||
'Thunderforest.Landscape',
|
||||
'MapQuestOpen.OSM',
|
||||
'MapQuestOpen.Aerial',
|
||||
'MapBox.examples.map-zr0njcqy',
|
||||
'Stamen.Toner',
|
||||
'Stamen.Terrain',
|
||||
'Stamen.Watercolor',
|
||||
'Esri.WorldStreetMap',
|
||||
'Esri.DeLorme',
|
||||
'Esri.WorldTopoMap',
|
||||
'Esri.WorldImagery',
|
||||
'Esri.WorldTerrain',
|
||||
'Esri.WorldShadedRelief',
|
||||
'Esri.WorldPhysical',
|
||||
'Esri.OceanBasemap',
|
||||
'Esri.NatGeoWorldMap',
|
||||
'Esri.WorldGrayCanvas',
|
||||
'Nokia.normalDay',
|
||||
'Nokia.normalGreyDay',
|
||||
'Nokia.satelliteNoLabelsDay',
|
||||
'Nokia.satelliteYesLabelsDay,
|
||||
'Nokia.terrainDay'
|
||||
];
|
||||
|
||||
var overlayLayers = [
|
||||
'OpenWeatherMap.Clouds',
|
||||
'OpenWeatherMap.CloudsClassic',
|
||||
'OpenWeatherMap.Precipitation',
|
||||
'OpenWeatherMap.PrecipitationClassic',
|
||||
'OpenWeatherMap.Rain',
|
||||
'OpenWeatherMap.RainClassic',
|
||||
'OpenWeatherMap.Pressure',
|
||||
'OpenWeatherMap.PressureContour',
|
||||
'OpenWeatherMap.Wind',
|
||||
'OpenWeatherMap.Temperature',
|
||||
'OpenWeatherMap.Snow'
|
||||
];
|
||||
|
||||
L.control.layers.provided(baseLayers, overlayLayers, {collapsed: false}).addTo(map);
|
||||
*/
|
||||
|
||||
// resize layers control to fit into view.
|
||||
function resizeLayerControl() {
|
||||
var layerControlHeight = document.body.clientHeight - (10 + 50);
|
||||
var layerControl = document.getElementsByClassName('leaflet-control-layers-expanded')[0];
|
||||
|
||||
layerControl.style.overflowY = 'auto';
|
||||
layerControl.style.maxHeight = layerControlHeight + 'px';
|
||||
}
|
||||
map.on('resize', resizeLayerControl);
|
||||
resizeLayerControl();
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,20 @@
|
||||
(function(){L.TileLayer.Provider=L.TileLayer.extend({initialize:function(a,b){var f=L.TileLayer.Provider.providers,e=a.split("."),g=e[0],h=e[1];if(!f[g])throw"No such provider ("+g+")";var d={url:f[g].url,options:f[g].options};if(h&&"variants"in f[g]){if(!(h in f[g].variants))throw"No such name in provider ("+h+")";e=f[g].variants[h];d={url:e.url||d.url,options:L.Util.extend({},d.options,e.options)}}else"function"===typeof d.url&&(d.url=d.url(e.splice(1,e.length-1).join(".")));var c=function(a){return-1===
|
||||
a.indexOf("{attribution.")?a:a.replace(/\{attribution.(\w*)\}/,function(a,b){return c(f[b].options.attribution)})};d.options.attribution=c(d.options.attribution);e=L.Util.extend({},d.options,b);L.TileLayer.prototype.initialize.call(this,d.url,e)}});L.TileLayer.Provider.providers={OpenStreetMap:{url:"http://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png",options:{attribution:'\x26copy; \x3ca href\x3d"http://openstreetmap.org"\x3eOpenStreetMap\x3c/a\x3e contributors, \x3ca href\x3d"http://creativecommons.org/licenses/by-sa/2.0/"\x3eCC-BY-SA\x3c/a\x3e'},
|
||||
variants:{Mapnik:{},BlackAndWhite:{url:"http://{s}.www.toolserver.org/tiles/bw-mapnik/{z}/{x}/{y}.png"},DE:{url:"http://{s}.tile.openstreetmap.de/tiles/osmde/{z}/{x}/{y}.png"},HOT:{url:"http://{s}.tile.openstreetmap.fr/hot/{z}/{x}/{y}.png",options:{attribution:'{attribution.OpenStreetMap}, Tiles courtesy of \x3ca href\x3d"http://hot.openstreetmap.org/" target\x3d"_blank"\x3eHumanitarian OpenStreetMap Team\x3c/a\x3e'}}}},OpenCycleMap:{url:"http://{s}.tile.opencyclemap.org/cycle/{z}/{x}/{y}.png",options:{attribution:'\x26copy; \x3ca href\x3d"http://www.opencyclemap.org"\x3eOpenCycleMap\x3c/a\x3e, {attribution.OpenStreetMap}'}},
|
||||
OpenSeaMap:{url:"http://tiles.openseamap.org/seamark/{z}/{x}/{y}.png",options:{attribution:'Map data: \x26copy; \x3ca href\x3d"http://www.openseamap.org"\x3eOpenSeaMap\x3c/a\x3e contributors'}},Thunderforest:{url:"http://{s}.tile.opencyclemap.org/cycle/{z}/{x}/{y}.png",options:{attribution:"{attribution.OpenCycleMap}"},variants:{OpenCycleMap:{},Transport:{url:"http://{s}.tile2.opencyclemap.org/transport/{z}/{x}/{y}.png"},Landscape:{url:"http://{s}.tile3.opencyclemap.org/landscape/{z}/{x}/{y}.png"},
|
||||
Outdoors:{url:"http://{s}.tile.thunderforest.com/outdoors/{z}/{x}/{y}.png"}}},OpenMapSurfer:{url:"http://openmapsurfer.uni-hd.de/tiles/roads/x\x3d{x}\x26y\x3d{y}\x26z\x3d{z}",options:{attribution:'Imagery from \x3ca href\x3d"http://giscience.uni-hd.de/"\x3eGIScience Research Group @ University of Heidelberg\x3c/a\x3e \x26mdash; Map data {attribution.OpenStreetMap}'},variants:{Roads:{},AdminBounds:{url:"http://openmapsurfer.uni-hd.de/tiles/adminb/x\x3d{x}\x26y\x3d{y}\x26z\x3d{z}"},Grayscale:{url:"http://openmapsurfer.uni-hd.de/tiles/roadsg/x\x3d{x}\x26y\x3d{y}\x26z\x3d{z}"}}},
|
||||
MapQuestOpen:{url:"http://otile{s}.mqcdn.com/tiles/1.0.0/map/{z}/{x}/{y}.jpeg",options:{attribution:'Tiles Courtesy of \x3ca href\x3d"http://www.mapquest.com/"\x3eMapQuest\x3c/a\x3e \x26mdash; Map data {attribution.OpenStreetMap}',subdomains:"1234"},variants:{OSM:{},Aerial:{url:"http://oatile{s}.mqcdn.com/tiles/1.0.0/sat/{z}/{x}/{y}.jpg",options:{attribution:'Tiles Courtesy of \x3ca href\x3d"http://www.mapquest.com/"\x3eMapQuest\x3c/a\x3e \x26mdash; Portions Courtesy NASA/JPL-Caltech and U.S. Depart. of Agriculture, Farm Service Agency'}}}},
|
||||
MapBox:{url:function(a){return"http://{s}.tiles.mapbox.com/v3/"+a+"/{z}/{x}/{y}.png"},options:{attribution:'Imagery from \x3ca href\x3d"http://mapbox.com/about/maps/"\x3eMapBox\x3c/a\x3e \x26mdash; Map data {attribution.OpenStreetMap}',subdomains:"abcd"}},Stamen:{url:"http://{s}.tile.stamen.com/toner/{z}/{x}/{y}.png",options:{attribution:'Map tiles by \x3ca href\x3d"http://stamen.com"\x3eStamen Design\x3c/a\x3e, \x3ca href\x3d"http://creativecommons.org/licenses/by/3.0"\x3eCC BY 3.0\x3c/a\x3e \x26mdash; Map data {attribution.OpenStreetMap}',
|
||||
subdomains:"abcd",minZoom:0,maxZoom:20},variants:{Toner:{},TonerBackground:{url:"http://{s}.tile.stamen.com/toner-background/{z}/{x}/{y}.png"},TonerHybrid:{url:"http://{s}.tile.stamen.com/toner-hybrid/{z}/{x}/{y}.png"},TonerLines:{url:"http://{s}.tile.stamen.com/toner-lines/{z}/{x}/{y}.png"},TonerLabels:{url:"http://{s}.tile.stamen.com/toner-labels/{z}/{x}/{y}.png"},TonerLite:{url:"http://{s}.tile.stamen.com/toner-lite/{z}/{x}/{y}.png"},Terrain:{url:"http://{s}.tile.stamen.com/terrain/{z}/{x}/{y}.jpg",
|
||||
options:{minZoom:4,maxZoom:18}},TerrainBackground:{url:"http://{s}.tile.stamen.com/terrain-background/{z}/{x}/{y}.jpg",options:{minZoom:4,maxZoom:18}},Watercolor:{url:"http://{s}.tile.stamen.com/watercolor/{z}/{x}/{y}.jpg",options:{minZoom:3,maxZoom:16}}}},Esri:{url:"http://server.arcgisonline.com/ArcGIS/rest/services/World_Street_Map/MapServer/tile/{z}/{y}/{x}",options:{attribution:"Tiles \x26copy; Esri"},variants:{WorldStreetMap:{options:{attribution:"{attribution.Esri} \x26mdash; Source: Esri, DeLorme, NAVTEQ, USGS, Intermap, iPC, NRCAN, Esri Japan, METI, Esri China (Hong Kong), Esri (Thailand), TomTom, 2012"}},
|
||||
DeLorme:{url:"http://server.arcgisonline.com/ArcGIS/rest/services/Specialty/DeLorme_World_Base_Map/MapServer/tile/{z}/{y}/{x}",options:{minZoom:1,maxZoom:11,attribution:"{attribution.Esri} \x26mdash; Copyright: \x26copy;2012 DeLorme"}},WorldTopoMap:{url:"http://server.arcgisonline.com/ArcGIS/rest/services/World_Topo_Map/MapServer/tile/{z}/{y}/{x}",options:{attribution:"{attribution.Esri} \x26mdash; Esri, DeLorme, NAVTEQ, TomTom, Intermap, iPC, USGS, FAO, NPS, NRCAN, GeoBase, Kadaster NL, Ordnance Survey, Esri Japan, METI, Esri China (Hong Kong), and the GIS User Community"}},
|
||||
WorldImagery:{url:"http://server.arcgisonline.com/ArcGIS/rest/services/World_Imagery/MapServer/tile/{z}/{y}/{x}",options:{attribution:"{attribution.Esri} \x26mdash; Source: Esri, i-cubed, USDA, USGS, AEX, GeoEye, Getmapping, Aerogrid, IGN, IGP, UPR-EGP, and the GIS User Community"}},WorldTerrain:{url:"http://server.arcgisonline.com/ArcGIS/rest/services/World_Terrain_Base/MapServer/tile/{z}/{y}/{x}",options:{maxZoom:13,attribution:"{attribution.Esri} \x26mdash; Source: USGS, Esri, TANA, DeLorme, and NPS"}},
|
||||
WorldShadedRelief:{url:"http://server.arcgisonline.com/ArcGIS/rest/services/World_Shaded_Relief/MapServer/tile/{z}/{y}/{x}",options:{maxZoom:13,attribution:"{attribution.Esri} \x26mdash; Source: Esri"}},WorldPhysical:{url:"http://server.arcgisonline.com/ArcGIS/rest/services/World_Physical_Map/MapServer/tile/{z}/{y}/{x}",options:{maxZoom:8,attribution:"{attribution.Esri} \x26mdash; Source: US National Park Service"}},OceanBasemap:{url:"http://services.arcgisonline.com/ArcGIS/rest/services/Ocean_Basemap/MapServer/tile/{z}/{y}/{x}",
|
||||
options:{maxZoom:13,attribution:"{attribution.Esri} \x26mdash; Sources: GEBCO, NOAA, CHS, OSU, UNH, CSUMB, National Geographic, DeLorme, NAVTEQ, and Esri"}},NatGeoWorldMap:{url:"http://services.arcgisonline.com/ArcGIS/rest/services/NatGeo_World_Map/MapServer/tile/{z}/{y}/{x}",options:{maxZoom:16,attribution:"{attribution.Esri} \x26mdash; National Geographic, Esri, DeLorme, NAVTEQ, UNEP-WCMC, USGS, NASA, ESA, METI, NRCAN, GEBCO, NOAA, iPC"}},WorldGrayCanvas:{url:"http://server.arcgisonline.com/ArcGIS/rest/services/Canvas/World_Light_Gray_Base/MapServer/tile/{z}/{y}/{x}",
|
||||
options:{maxZoom:16,attribution:"{attribution.Esri} \x26mdash; Esri, DeLorme, NAVTEQ"}}}},OpenWeatherMap:{options:{attribution:'Map data \x26copy; \x3ca href\x3d"http://openweathermap.org"\x3eOpenWeatherMap\x3c/a\x3e',opacity:.5},variants:{Clouds:{url:"http://{s}.tile.openweathermap.org/map/clouds/{z}/{x}/{y}.png"},CloudsClassic:{url:"http://{s}.tile.openweathermap.org/map/clouds_cls/{z}/{x}/{y}.png"},Precipitation:{url:"http://{s}.tile.openweathermap.org/map/precipitation/{z}/{x}/{y}.png"},PrecipitationClassic:{url:"http://{s}.tile.openweathermap.org/map/precipitation_cls/{z}/{x}/{y}.png"},
|
||||
Rain:{url:"http://{s}.tile.openweathermap.org/map/rain/{z}/{x}/{y}.png"},RainClassic:{url:"http://{s}.tile.openweathermap.org/map/rain_cls/{z}/{x}/{y}.png"},Pressure:{url:"http://{s}.tile.openweathermap.org/map/pressure/{z}/{x}/{y}.png"},PressureContour:{url:"http://{s}.tile.openweathermap.org/map/pressure_cntr/{z}/{x}/{y}.png"},Wind:{url:"http://{s}.tile.openweathermap.org/map/wind/{z}/{x}/{y}.png"},Temperature:{url:"http://{s}.tile.openweathermap.org/map/temp/{z}/{x}/{y}.png"},Snow:{url:"http://{s}.tile.openweathermap.org/map/snow/{z}/{x}/{y}.png"}}},
|
||||
Nokia:{options:{attribution:'Map \x26copy; \x3ca href\x3d"http://developer.here.com"\x3eNokia\x3c/a\x3e, Data \x26copy; NAVTEQ 2012',subdomains:"1234",devID:"xyz",appID:"abc"},variants:{normalDay:{url:"http://{s}.maptile.lbs.ovi.com/maptiler/v2/maptile/newest/normal.day/{z}/{x}/{y}/256/png8?token\x3d{devID}\x26app_id\x3d{appID}"},normalGreyDay:{url:"http://{s}.maptile.lbs.ovi.com/maptiler/v2/maptile/newest/normal.day.grey/{z}/{x}/{y}/256/png8?token\x3d{devID}\x26app_id\x3d{appID}"},satelliteNoLabelsDay:{url:"http://{s}.maptile.lbs.ovi.com/maptiler/v2/maptile/newest/satellite.day/{z}/{x}/{y}/256/png8?token\x3d{devID}\x26app_id\x3d{appID}"},
|
||||
satelliteYesLabelsDay:{url:"http://{s}.maptile.lbs.ovi.com/maptiler/v2/maptile/newest/hybrid.day/{z}/{x}/{y}/256/png8?token\x3d{devID}\x26app_id\x3d{appID}"},terrainDay:{url:"http://{s}.maptile.lbs.ovi.com/maptiler/v2/maptile/newest/terrain.day/{z}/{x}/{y}/256/png8?token\x3d{devID}\x26app_id\x3d{appID}"}}},Acetate:{url:"http://a{s}.acetate.geoiq.com/tiles/acetate-hillshading/{z}/{x}/{y}.png",options:{attribution:"\x26copy;2012 Esri \x26 Stamen, Data from OSM and Natural Earth",subdomains:"0123",minZoom:2,
|
||||
maxZoom:18},variants:{all:{},basemap:{url:"http://a{s}.acetate.geoiq.com/tiles/acetate-base/{z}/{x}/{y}.png"},terrain:{url:"http://a{s}.acetate.geoiq.com/tiles/terrain/{z}/{x}/{y}.png"},foreground:{url:"http://a{s}.acetate.geoiq.com/tiles/acetate-fg/{z}/{x}/{y}.png"},roads:{url:"http://a{s}.acetate.geoiq.com/tiles/acetate-roads/{z}/{x}/{y}.png"},labels:{url:"http://a{s}.acetate.geoiq.com/tiles/acetate-labels/{z}/{x}/{y}.png"},hillshading:{url:"http://a{s}.acetate.geoiq.com/tiles/hillshading/{z}/{x}/{y}.png"}}}};
|
||||
L.tileLayer.provider=function(a,b){return new L.TileLayer.Provider(a,b)};L.Control.Layers.Provided=L.Control.Layers.extend({initialize:function(a,b,f){var e,g=function(a){return a.replace(/\./g,": ").replace(/([a-z])([A-Z])/g,"$1 $2")};a.length&&(function(){for(var b={},d=a.length,c=0;c<d;)"string"===typeof a[c]&&(0===c?(e=L.tileLayer.provider(a[0]),b[g(a[c])]=e):b[g(a[c])]=L.tileLayer.provider(a[c])),c++;a=b}(),this._first=e);b&&b.length&&function(){for(var a={},d=b.length,c=0;c<d;)"string"===typeof b[c]&&
|
||||
(a[g(b[c])]=L.tileLayer.provider(b[c])),c++;b=a}();L.Control.Layers.prototype.initialize.call(this,a,b,f)},onAdd:function(a){this._first.addTo(a);return L.Control.Layers.prototype.onAdd.call(this,a)}});L.control.layers.provided=function(a,b,f){return new L.Control.Layers.Provided(a,b,f)}})();
|
||||
@@ -0,0 +1,9 @@
|
||||
Copyright (c) 2013 Leaflet Providers contributors
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
|
||||
|
||||
* Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
|
||||
* Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
|
||||
|
||||
_THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE._
|
||||
@@ -0,0 +1,20 @@
|
||||
{
|
||||
"name": "leaflet-providers",
|
||||
"version": "1.0.3",
|
||||
"description": "An extension to Leaflet that contains configurations for various free tile providers.",
|
||||
"main": "leaflet-providers.js",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git://github.com/leaflet-extras/leaflet-providers.git"
|
||||
},
|
||||
"scripts":{
|
||||
"pretest":"jshint leaflet-providers.js"
|
||||
},
|
||||
"license": "BSD-2-Clause",
|
||||
"bugs": {
|
||||
"url": "https://github.com/leaflet-extras/leaflet-providers/issues"
|
||||
},
|
||||
"devDependencies": {
|
||||
"jshint": "~2.1.11"
|
||||
}
|
||||
}
|
||||
180
libraries/ckeditor/plugins/leaflet/scripts/mapParser.html
Normal file
180
libraries/ckeditor/plugins/leaflet/scripts/mapParser.html
Normal file
@@ -0,0 +1,180 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<script src="//cdnjs.cloudflare.com/ajax/libs/leaflet/0.7.7/leaflet.js"></script>
|
||||
<link rel="stylesheet" href="//cdnjs.cloudflare.com/ajax/libs/leaflet/0.7.7/leaflet.css" />
|
||||
|
||||
<script src="leaflet-providers/leaflet-providers.js"></script>
|
||||
|
||||
<script src="Leaflet-MiniMap/src/Control.MiniMap.js"></script>
|
||||
<link rel="stylesheet" href="Leaflet-MiniMap/src/Control.MiniMap.css" />
|
||||
|
||||
<script type="text/javascript" charset="utf-8">
|
||||
// Function to parse the URL search query parameters.
|
||||
// It will give A, B, C given http://www.somelink.com?lat=A&lon=B&zoom=C
|
||||
// See "http://javascriptproductivity.blogspot.com/" +
|
||||
// "2013/02/get-url-variables-with-javascript.html".
|
||||
function getParams(){
|
||||
// Make an object variable to hold
|
||||
// the parsed URL parameters' keys and vlaues.
|
||||
var params = {};
|
||||
|
||||
// Remove the '?' character after the base url.
|
||||
// x.substring(i) will return the substring of x starting at index i
|
||||
// up to the end of the string.
|
||||
// Drupal CMS might have a path like this (two '?' characters):
|
||||
// mapParser.html?t=E3OD?lat=14.6760413&lon=121.0437003&...
|
||||
// We need to handle this case also.
|
||||
var lastIndex = window.location.search.lastIndexOf("?")
|
||||
|
||||
// Get the substring not including any '?' character.
|
||||
var query_string = window.location.search.substring(lastIndex + 1);
|
||||
|
||||
// Explode the string using the '&' character.
|
||||
var query_string_parts = query_string.split('&');
|
||||
|
||||
// Traverse the exploded tokens.
|
||||
for(i in query_string_parts) {
|
||||
// Explode the string using '=' to isolate keys and values.
|
||||
key_value = query_string_parts[i].split('=');
|
||||
|
||||
// Insert a new key and set it to the current parsed value.
|
||||
params[key_value[0]] = key_value[1];
|
||||
}
|
||||
|
||||
// Return the parameter object contianing the keys and values.
|
||||
return params;
|
||||
}
|
||||
</script>
|
||||
<style>
|
||||
.leaflet-popup-content {
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
body {
|
||||
padding: 0;
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
html, body, #map_container {
|
||||
height: 100%;
|
||||
width: 100%;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div id='map_container' data-lat="" data-lon="" data-zoom=""></div>
|
||||
<script type="text/javascript">
|
||||
// Get the DOM node to which we will append the map.
|
||||
// In our setup the map container is a DIV element.
|
||||
var mapDiv = document.getElementById("map_container");
|
||||
|
||||
// Parse the query parameters in the URL to obtain the
|
||||
// LAT, LON, and ZOOM values.
|
||||
var queryString = getParams();
|
||||
|
||||
// Fetch the most important attributes.
|
||||
var latitude = queryString["lat"];
|
||||
var longitude= queryString["lon"];
|
||||
var zoom = queryString["zoom"];
|
||||
|
||||
// Initialize the mapDiv data attributes.
|
||||
mapDiv.setAttribute("data-lat", latitude);
|
||||
mapDiv.setAttribute("data-lon", longitude);
|
||||
mapDiv.setAttribute("data-zoom", zoom);
|
||||
|
||||
// Convert the parameters to their numeric equivalent.
|
||||
// Otherwise, initializing the Leaflet map object will not work.
|
||||
latitude = Number(latitude);
|
||||
longitude = Number(longitude);
|
||||
zoom = Number(zoom);
|
||||
|
||||
var responsive = queryString["responsive"];
|
||||
|
||||
// If responsive map option is enabled, set the map height to 100%.
|
||||
if (responsive == "on") {
|
||||
mapDiv.style.height = "100%";
|
||||
}
|
||||
|
||||
else {
|
||||
// Retrieve the map's height.
|
||||
var mapHeight = Number(queryString["height"]);
|
||||
mapDiv.style.height = String(mapHeight) + "px";
|
||||
}
|
||||
|
||||
// Retrive the popup text that will be used by the marker.
|
||||
var popUpText = decodeURIComponent(queryString["text"]);
|
||||
|
||||
// Retrieve the Base Map's Tile to be used.
|
||||
var tile = queryString["tile"];
|
||||
|
||||
// Retrieve the information about the inclusion of Overview map.
|
||||
var minimap = queryString["minimap"];
|
||||
|
||||
// Create a map in the the target DOM container.
|
||||
// Set the view to a given place and zoom value.
|
||||
var map = L.map('map_container').setView([latitude, longitude], zoom);
|
||||
|
||||
// Choose the Map Tile provider e.g. "Esri.WorldTopoMap"
|
||||
var mapTileProvider = tile;
|
||||
|
||||
var restrictedTiles = ['MapQuestOpen.Aerial', 'MapQuestOpen.OSM'];
|
||||
|
||||
// Redirect MapQuest tiles to OpenStreetMap tiles.
|
||||
if (restrictedTiles.indexOf(mapTileProvider) != -1) {
|
||||
mapTileProvider = 'OpenStreetMap.Mapnik';
|
||||
}
|
||||
|
||||
// Set the base map.
|
||||
var mapTile = L.tileLayer.provider(mapTileProvider, { attribution: "Map Tile: " + mapTileProvider });
|
||||
mapTile.addTo(map);
|
||||
|
||||
// Add a marker in the given location.
|
||||
// Make it draggble so that user could refine the position visually.
|
||||
var p1 = L.marker([latitude, longitude], {
|
||||
draggable: true,
|
||||
});
|
||||
p1.addTo(map);
|
||||
|
||||
// Add an event listener that will keep track the changes in the
|
||||
// marker location and will update the data attribute accordingly.
|
||||
p1.on('dragend', function(e) {
|
||||
var newLocation = this.getLatLng();
|
||||
var lat = newLocation.lat;
|
||||
var lon = newLocation.lng;
|
||||
|
||||
// Pan the map to its new center which is the last position
|
||||
// of the dragged marker.
|
||||
map.panTo([lat, lon]);
|
||||
|
||||
mapDiv.setAttribute("data-lat", String(lat));
|
||||
mapDiv.setAttribute("data-lon", String(lon));
|
||||
});
|
||||
|
||||
// If the pop-up text is specified.
|
||||
if (popUpText != '') {
|
||||
// Replace the %20 HTML Entity by an empty space.
|
||||
// %20 is the result of texts being piped via URL.
|
||||
popUpText = popUpText.replace(/%20/g, ' ');
|
||||
|
||||
// Bind the text to the current marker.
|
||||
p1.bindPopup(popUpText);
|
||||
}
|
||||
|
||||
// Check if MiniMap needs to be shown also.
|
||||
if (minimap == "on") {
|
||||
// Create a new Tile Layer for the MiniMap.
|
||||
// Per documentation, do not reuse the existing Tile object
|
||||
// to avoid rendering issues.
|
||||
var mapTile2 = L.tileLayer.provider(mapTileProvider);
|
||||
var miniMap = new L.Control.MiniMap(mapTile2).addTo(map);
|
||||
}
|
||||
|
||||
// Add an event listener that will keep track the changes in the
|
||||
// map's zoom levels and it will update the data attribute accordingly.
|
||||
map.on('zoomend', function(e) {
|
||||
mapDiv.setAttribute("data-zoom", map.getZoom());
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
Reference in New Issue
Block a user