PluginProbe
Leaflet Map / 2.10.0
Leaflet Map v2.10.0
3.4.7 3.4.6 trunk 2.10.0 2.10.1 2.11.0 2.11.1 2.11.2 2.11.3 2.11.4 2.11.5 2.12.0 2.13.0 2.14.0 2.15.0 2.16.0 2.16.1 2.16.2 2.17.0 2.17.1 2.17.2 2.17.3 2.18.0 2.19.0 2.19.1 All 49 releases
leaflet-map / scripts / get-shortcode.js

get-shortcode.js in Leaflet Map 2.10.0, at scripts/get-shortcode.js

57 lines 1.2 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 (function () {
2
3 WPLeafletMapPlugin.add( initAdminShortcodes );
4
5 function initAdminShortcodes () {
6 var map_input = document.getElementById('map-shortcode'),
7 marker_input = document.getElementById('marker-shortcode'),
8 map_1 = WPLeafletMapPlugin.maps[0],
9 marker_1 = WPLeafletMapPlugin.markers[0];
10
11 function update_marker () {
12 var latlng = marker_1.getLatLng();
13 marker_input.value = '[leaflet-marker lat=' +
14 latlng.lat +
15 ' lng=' +
16 latlng.lng +
17 ']';
18 }
19
20 function update_map () {
21 var latlng = map_1.getCenter();
22 map_input.value = '[leaflet-map lat=' +
23 latlng.lat +
24 ' lng=' +
25 latlng.lng +
26 ' zoom=' +
27 map_1.getZoom() +
28 ']';
29 }
30
31 marker_1.on('drag', update_marker);
32 map_1.on('move', update_map);
33
34 update_map();
35 update_marker();
36
37 if (map_input.addEventListener) {
38 map_input.addEventListener('click', function () {
39 this.select();
40 });
41
42 marker_input.addEventListener('click', function () {
43 this.select();
44 });
45 } else {
46 // IE 8
47 map_input.attachEvent('onclick', function () {
48 map_input.select();
49 });
50
51 marker_input.attachEvent('onclick', function () {
52 marker_input.select();
53 });
54 }
55
56 };
57 })();