Version Description
[2013-10-12] = * fixed: Greek translation (thanks, Pantelis Orfanos!) * fixed: Dutch translation (thanks, Ivan Beemster!) * fixed: KML map zoom sometimes doesn't happen on first page visit * fixed: some themes (e.g. twentythirteen) mess up Google Maps directions markers * fixed: Google link opens maps without marker (NB: <
Download this release
Release Info
Developer | webaware |
Plugin | Flexible Map |
Version | 1.7.0 |
Comparing to | |
See all releases |
Code changes from version 1.6.5 to 1.7.0
- class.FlxMapAdmin.php +1 -1
- class.FlxMapPlugin.php +17 -1
- flexible-map.js +179 -110
- flexible-map.min.js +1 -1
- flexible-map.php +2 -2
- i18n/el.js +4 -4
- i18n/nl.js +3 -3
- instructions.html +10 -2
- readme.txt +39 -11
- styles.css +12 -0
class.FlxMapAdmin.php
CHANGED
@@ -44,7 +44,7 @@ class FlxMapAdmin {
|
|
44 |
if ($file == FLXMAP_PLUGIN_NAME) {
|
45 |
$links[] = '<a href="admin.php?page=' . self::MENU_PAGE . '-instructions">' . __('Instructions') . '</a>';
|
46 |
$links[] = '<a href="http://wordpress.org/support/plugin/wp-flexible-map">' . __('Get help') . '</a>';
|
47 |
-
$links[] = '<a href="http://wordpress.org/
|
48 |
$links[] = '<a href="https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=6ZCY9PST8E4GQ">' . __('Donate') . '</a>';
|
49 |
}
|
50 |
|
44 |
if ($file == FLXMAP_PLUGIN_NAME) {
|
45 |
$links[] = '<a href="admin.php?page=' . self::MENU_PAGE . '-instructions">' . __('Instructions') . '</a>';
|
46 |
$links[] = '<a href="http://wordpress.org/support/plugin/wp-flexible-map">' . __('Get help') . '</a>';
|
47 |
+
$links[] = '<a href="http://wordpress.org/plugins/wp-flexible-map/">' . __('Rating') . '</a>';
|
48 |
$links[] = '<a href="https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=6ZCY9PST8E4GQ">' . __('Donate') . '</a>';
|
49 |
}
|
50 |
|
class.FlxMapPlugin.php
CHANGED
@@ -86,7 +86,7 @@ class FlxMapPlugin {
|
|
86 |
public function actionEnqueueScripts() {
|
87 |
// allow others to override the Google Maps API URL
|
88 |
$protocol = is_ssl() ? 'https' : 'http';
|
89 |
-
$args = apply_filters('flexmap_google_maps_api_args', array('v' => '3.
|
90 |
$apiURL = apply_filters('flexmap_google_maps_api_url', add_query_arg($args, "$protocol://maps.google.com/maps/api/js"));
|
91 |
if (!empty($apiURL)) {
|
92 |
wp_register_script('google-maps', $apiURL, false, null, true);
|
@@ -213,6 +213,10 @@ HTML;
|
|
213 |
$script .= " f.zoomControl = false;\n";
|
214 |
}
|
215 |
|
|
|
|
|
|
|
|
|
216 |
if (isset($attrs['hidestreetview']) && self::isNo($attrs['hidestreetview'])) {
|
217 |
$script .= " f.streetViewControl = true;\n";
|
218 |
}
|
@@ -266,6 +270,14 @@ HTML;
|
|
266 |
$script .= " f.dirSuppressMarkers = true;\n";
|
267 |
}
|
268 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
269 |
if (isset($attrs['maptype'])) {
|
270 |
$script .= " f.mapTypeId = \"{$this->str2js($attrs['maptype'])}\";\n";
|
271 |
}
|
@@ -284,6 +296,10 @@ HTML;
|
|
284 |
$this->enqueueLocale($locale);
|
285 |
}
|
286 |
|
|
|
|
|
|
|
|
|
287 |
// add map based on coordinates, with optional marker coordinates
|
288 |
if (isset($attrs['center']) && self::isCoordinates($attrs['center'])) {
|
289 |
$marker = self::str2js($attrs['center']);
|
86 |
public function actionEnqueueScripts() {
|
87 |
// allow others to override the Google Maps API URL
|
88 |
$protocol = is_ssl() ? 'https' : 'http';
|
89 |
+
$args = apply_filters('flexmap_google_maps_api_args', array('v' => '3.13', 'sensor' => 'false'));
|
90 |
$apiURL = apply_filters('flexmap_google_maps_api_url', add_query_arg($args, "$protocol://maps.google.com/maps/api/js"));
|
91 |
if (!empty($apiURL)) {
|
92 |
wp_register_script('google-maps', $apiURL, false, null, true);
|
213 |
$script .= " f.zoomControl = false;\n";
|
214 |
}
|
215 |
|
216 |
+
if (!empty($attrs['zoomstyle'])) {
|
217 |
+
$script .= " f.zoomControlStyle = \"{$this->str2js($attrs['zoomstyle'])}\";\n";
|
218 |
+
}
|
219 |
+
|
220 |
if (isset($attrs['hidestreetview']) && self::isNo($attrs['hidestreetview'])) {
|
221 |
$script .= " f.streetViewControl = true;\n";
|
222 |
}
|
270 |
$script .= " f.dirSuppressMarkers = true;\n";
|
271 |
}
|
272 |
|
273 |
+
if (isset($attrs['dirshowsteps']) && self::isNo($attrs['dirshowsteps'])) {
|
274 |
+
$script .= " f.dirShowSteps = false;\n";
|
275 |
+
}
|
276 |
+
|
277 |
+
if (isset($attrs['dirshowssearch']) && self::isNo($attrs['dirshowssearch'])) {
|
278 |
+
$script .= " f.dirShowSearch = false;\n";
|
279 |
+
}
|
280 |
+
|
281 |
if (isset($attrs['maptype'])) {
|
282 |
$script .= " f.mapTypeId = \"{$this->str2js($attrs['maptype'])}\";\n";
|
283 |
}
|
296 |
$this->enqueueLocale($locale);
|
297 |
}
|
298 |
|
299 |
+
if (isset($attrs['visualrefresh']) && self::isYes($attrs['visualrefresh'])) {
|
300 |
+
$script .= " f.visualRefresh = true;\n";
|
301 |
+
}
|
302 |
+
|
303 |
// add map based on coordinates, with optional marker coordinates
|
304 |
if (isset($attrs['center']) && self::isCoordinates($attrs['center'])) {
|
305 |
$marker = self::str2js($attrs['center']);
|
flexible-map.js
CHANGED
@@ -62,17 +62,37 @@ function FlexibleMap() {
|
|
62 |
this.showMap = function(divID, latLng) {
|
63 |
centre = new google.maps.LatLng(latLng[0], latLng[1]);
|
64 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
65 |
map = new google.maps.Map(document.getElementById(divID), {
|
66 |
mapTypeId: this.mapTypeId,
|
67 |
mapTypeControl: this.mapTypeControl,
|
68 |
scaleControl: this.scaleControl,
|
69 |
panControl: this.panControl,
|
|
|
70 |
zoomControl: this.zoomControl,
|
|
|
71 |
draggable: this.draggable,
|
72 |
disableDoubleClickZoom: !this.dblclickZoom,
|
73 |
scrollwheel: this.scrollwheel,
|
74 |
-
streetViewControl: this.streetViewControl,
|
75 |
-
navigationControlOptions: this.navigationControlOptions,
|
76 |
center: centre,
|
77 |
zoom: this.zoom
|
78 |
});
|
@@ -87,8 +107,7 @@ function FlexibleMap() {
|
|
87 |
*/
|
88 |
this.loadKmlMap = function(kmlFileURL) {
|
89 |
// load KML file as a layer and add to map
|
90 |
-
kmlLayer = new google.maps.KmlLayer(kmlFileURL);
|
91 |
-
kmlLayer.setMap(map);
|
92 |
|
93 |
// listen for KML loaded
|
94 |
google.maps.event.addListenerOnce(kmlLayer, "defaultviewport_changed", function() {
|
@@ -105,6 +124,7 @@ function FlexibleMap() {
|
|
105 |
this.scaleControl = false; // no control for changing scale
|
106 |
this.panControl = false; // no control for panning
|
107 |
this.zoomControl = true; // show control for zooming
|
|
|
108 |
this.streetViewControl = false; // no control for street view
|
109 |
this.scrollwheel = false; // no scroll wheel zoom
|
110 |
this.draggable = true; // support dragging to pan
|
@@ -121,19 +141,21 @@ function FlexibleMap() {
|
|
121 |
this.markerDirectionsDefault = ''; // default from: location for directions
|
122 |
this.markerAddress = ''; // address of marker, if given
|
123 |
this.targetFix = true; // remove target="_blank" from links on KML map
|
124 |
-
this.navigationControlOptions = { style: google.maps.NavigationControlStyle.SMALL };
|
125 |
this.dirService = false;
|
126 |
-
this.
|
127 |
-
this.dirDraggable = false;
|
128 |
-
this.dirSuppressMarkers = false;
|
|
|
|
|
129 |
this.region = '';
|
130 |
this.locale = 'en';
|
131 |
this.localeActive = 'en';
|
|
|
132 |
}
|
133 |
|
134 |
FlexibleMap.prototype = (function() {
|
135 |
|
136 |
-
var addEventListener, stopEvent
|
137 |
|
138 |
// detect standard event model
|
139 |
if (document.addEventListener) {
|
@@ -145,12 +167,6 @@ FlexibleMap.prototype = (function() {
|
|
145 |
event.stopPropagation();
|
146 |
event.preventDefault();
|
147 |
};
|
148 |
-
|
149 |
-
fireEvent = function(element, eventName) {
|
150 |
-
var event = document.createEvent("HTMLEvents");
|
151 |
-
event.initEvent(eventName, true, true);
|
152 |
-
element.dispatchEvent(event);
|
153 |
-
};
|
154 |
}
|
155 |
else
|
156 |
// detect IE event model
|
@@ -163,12 +179,6 @@ FlexibleMap.prototype = (function() {
|
|
163 |
event.cancelBubble = true;
|
164 |
event.returnValue = 0;
|
165 |
};
|
166 |
-
|
167 |
-
fireEvent = function(element, eventName) {
|
168 |
-
var event = document.createEventObject();
|
169 |
-
event.eventType = eventName;
|
170 |
-
element.fireEvent("on" + eventName, event);
|
171 |
-
};
|
172 |
}
|
173 |
|
174 |
/**
|
@@ -267,6 +277,9 @@ FlexibleMap.prototype = (function() {
|
|
267 |
* @param {Number} zoom [optional] zoom level
|
268 |
*/
|
269 |
showKML: function(divID, kmlFileURL, zoom) {
|
|
|
|
|
|
|
270 |
var self = this,
|
271 |
mapDiv = document.getElementById(divID),
|
272 |
varName = mapDiv.getAttribute("data-flxmap"),
|
@@ -275,8 +288,8 @@ FlexibleMap.prototype = (function() {
|
|
275 |
|
276 |
// set zoom if specified
|
277 |
if (typeof zoom != "undefined") {
|
278 |
-
// listen for KML layer
|
279 |
-
google.maps.event.addListenerOnce(map, "
|
280 |
map.setZoom(zoom);
|
281 |
self.zoom = zoom;
|
282 |
});
|
@@ -430,7 +443,13 @@ FlexibleMap.prototype = (function() {
|
|
430 |
google.maps.event.addListener(point, "click", function() {
|
431 |
infowin.open(map, point);
|
432 |
});
|
|
|
|
|
|
|
|
|
|
|
433 |
}
|
|
|
434 |
},
|
435 |
|
436 |
/**
|
@@ -459,6 +478,30 @@ FlexibleMap.prototype = (function() {
|
|
459 |
});
|
460 |
},
|
461 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
462 |
/**
|
463 |
* tell Google Maps to redraw the map, and centre it back where it started with default zoom
|
464 |
*/
|
@@ -486,12 +529,13 @@ FlexibleMap.prototype = (function() {
|
|
486 |
if (!this.dirService)
|
487 |
this.dirService = new google.maps.DirectionsService();
|
488 |
|
489 |
-
|
490 |
-
|
|
|
491 |
map: map,
|
492 |
draggable: this.dirDraggable,
|
493 |
suppressMarkers: this.dirSuppressMarkers,
|
494 |
-
panel: document.getElementById(this.markerDirectionsDiv)
|
495 |
});
|
496 |
}
|
497 |
},
|
@@ -504,98 +548,123 @@ FlexibleMap.prototype = (function() {
|
|
504 |
* @param {bool} focus [optional]
|
505 |
*/
|
506 |
showDirections: function(latitude, longitude, title, focus) {
|
507 |
-
var
|
508 |
-
|
509 |
-
|
510 |
-
|
511 |
-
|
512 |
-
|
513 |
-
|
514 |
-
|
515 |
-
|
516 |
-
|
517 |
-
|
518 |
-
|
519 |
-
|
520 |
-
|
521 |
-
|
522 |
-
|
523 |
-
|
524 |
-
|
525 |
-
|
526 |
-
|
527 |
-
|
528 |
-
|
529 |
-
|
530 |
-
|
531 |
-
|
532 |
-
|
533 |
-
|
534 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
535 |
}
|
536 |
|
537 |
-
|
538 |
-
|
539 |
-
|
540 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
541 |
}
|
542 |
|
543 |
-
|
544 |
-
|
545 |
-
|
546 |
-
|
547 |
-
|
548 |
-
|
549 |
-
|
550 |
-
|
551 |
-
|
552 |
-
|
553 |
-
|
554 |
-
|
555 |
-
|
556 |
-
|
557 |
-
|
558 |
-
|
559 |
-
|
560 |
-
|
561 |
-
|
562 |
-
|
563 |
-
|
564 |
-
|
565 |
-
|
566 |
-
|
567 |
-
|
568 |
-
|
569 |
-
|
570 |
-
|
571 |
-
|
572 |
-
|
573 |
-
|
574 |
-
|
575 |
-
|
576 |
-
|
577 |
-
|
578 |
-
|
579 |
-
case DirectionsStatus.INVALID_REQUEST:
|
580 |
-
alert("Invalid directions request.");
|
581 |
-
break;
|
582 |
-
|
583 |
-
case DirectionsStatus.NOT_FOUND:
|
584 |
-
alert("Origin or destination was not found.");
|
585 |
-
break;
|
586 |
-
|
587 |
-
default:
|
588 |
-
alert("A directions request could not be processed due to a server error. The request may succeed if you try again.");
|
589 |
-
break;
|
590 |
-
}
|
591 |
-
});
|
592 |
}
|
|
|
593 |
|
594 |
-
|
|
|
|
|
|
|
595 |
|
596 |
// if the from: location is already set, trigger the directions query
|
597 |
-
if (
|
598 |
-
|
599 |
}
|
600 |
|
601 |
}
|
62 |
this.showMap = function(divID, latLng) {
|
63 |
centre = new google.maps.LatLng(latLng[0], latLng[1]);
|
64 |
|
65 |
+
// style the zoom control
|
66 |
+
var zoomControlStyle, zoomControlStyles = {
|
67 |
+
"small" : google.maps.ZoomControlStyle.SMALL,
|
68 |
+
"large" : google.maps.ZoomControlStyle.LARGE,
|
69 |
+
"default" : google.maps.ZoomControlStyle.DEFAULT
|
70 |
+
};
|
71 |
+
|
72 |
+
if (this.zoomControlStyle in zoomControlStyles) {
|
73 |
+
zoomControlStyle = zoomControlStyles[this.zoomControlStyle];
|
74 |
+
}
|
75 |
+
else {
|
76 |
+
zoomControlStyle = zoomControlStyles.small;
|
77 |
+
}
|
78 |
+
|
79 |
+
// enable visual refresh, if requested
|
80 |
+
// NB: affect all maps on page!
|
81 |
+
if (this.visualRefresh)
|
82 |
+
google.maps.visualRefresh = true;
|
83 |
+
|
84 |
+
// create a map
|
85 |
map = new google.maps.Map(document.getElementById(divID), {
|
86 |
mapTypeId: this.mapTypeId,
|
87 |
mapTypeControl: this.mapTypeControl,
|
88 |
scaleControl: this.scaleControl,
|
89 |
panControl: this.panControl,
|
90 |
+
streetViewControl: this.streetViewControl,
|
91 |
zoomControl: this.zoomControl,
|
92 |
+
zoomControlOptions: { style: zoomControlStyle },
|
93 |
draggable: this.draggable,
|
94 |
disableDoubleClickZoom: !this.dblclickZoom,
|
95 |
scrollwheel: this.scrollwheel,
|
|
|
|
|
96 |
center: centre,
|
97 |
zoom: this.zoom
|
98 |
});
|
107 |
*/
|
108 |
this.loadKmlMap = function(kmlFileURL) {
|
109 |
// load KML file as a layer and add to map
|
110 |
+
kmlLayer = new google.maps.KmlLayer({ map: map, url: kmlFileURL });
|
|
|
111 |
|
112 |
// listen for KML loaded
|
113 |
google.maps.event.addListenerOnce(kmlLayer, "defaultviewport_changed", function() {
|
124 |
this.scaleControl = false; // no control for changing scale
|
125 |
this.panControl = false; // no control for panning
|
126 |
this.zoomControl = true; // show control for zooming
|
127 |
+
this.zoomControlStyle = "small"; // from "small", "large", "default"
|
128 |
this.streetViewControl = false; // no control for street view
|
129 |
this.scrollwheel = false; // no scroll wheel zoom
|
130 |
this.draggable = true; // support dragging to pan
|
141 |
this.markerDirectionsDefault = ''; // default from: location for directions
|
142 |
this.markerAddress = ''; // address of marker, if given
|
143 |
this.targetFix = true; // remove target="_blank" from links on KML map
|
|
|
144 |
this.dirService = false;
|
145 |
+
this.dirRenderer = false;
|
146 |
+
this.dirDraggable = false; // directions route is draggable (for alternate routing)
|
147 |
+
this.dirSuppressMarkers = false; // suppress A/B markers on directions route
|
148 |
+
this.dirShowSteps = true; // show the directions steps (turn-by-turn)
|
149 |
+
this.dirShowSearch = true; // show the directions form for searching directions
|
150 |
this.region = '';
|
151 |
this.locale = 'en';
|
152 |
this.localeActive = 'en';
|
153 |
+
this.visualRefresh = false;
|
154 |
}
|
155 |
|
156 |
FlexibleMap.prototype = (function() {
|
157 |
|
158 |
+
var addEventListener, stopEvent;
|
159 |
|
160 |
// detect standard event model
|
161 |
if (document.addEventListener) {
|
167 |
event.stopPropagation();
|
168 |
event.preventDefault();
|
169 |
};
|
|
|
|
|
|
|
|
|
|
|
|
|
170 |
}
|
171 |
else
|
172 |
// detect IE event model
|
179 |
event.cancelBubble = true;
|
180 |
event.returnValue = 0;
|
181 |
};
|
|
|
|
|
|
|
|
|
|
|
|
|
182 |
}
|
183 |
|
184 |
/**
|
277 |
* @param {Number} zoom [optional] zoom level
|
278 |
*/
|
279 |
showKML: function(divID, kmlFileURL, zoom) {
|
280 |
+
if (typeof zoom != "undefined")
|
281 |
+
this.zoom = zoom;
|
282 |
+
|
283 |
var self = this,
|
284 |
mapDiv = document.getElementById(divID),
|
285 |
varName = mapDiv.getAttribute("data-flxmap"),
|
288 |
|
289 |
// set zoom if specified
|
290 |
if (typeof zoom != "undefined") {
|
291 |
+
// listen for zoom changing to fit markers on KML layer, force it back to what we asked for
|
292 |
+
google.maps.event.addListenerOnce(map, "zoom_changed", function() {
|
293 |
map.setZoom(zoom);
|
294 |
self.zoom = zoom;
|
295 |
});
|
443 |
google.maps.event.addListener(point, "click", function() {
|
444 |
infowin.open(map, point);
|
445 |
});
|
446 |
+
|
447 |
+
// find Google link and append marker info, modern browsers only!
|
448 |
+
function googleLink() { self.updateGoogleLink(); }
|
449 |
+
google.maps.event.addListener(map, "idle", googleLink);
|
450 |
+
google.maps.event.addListener(map, "center_changed", googleLink);
|
451 |
}
|
452 |
+
|
453 |
},
|
454 |
|
455 |
/**
|
478 |
});
|
479 |
},
|
480 |
|
481 |
+
/**
|
482 |
+
* set query parameters on Google link to maps
|
483 |
+
* NB: will only set the query parameters once, won't find links after that
|
484 |
+
*/
|
485 |
+
updateGoogleLink: function() {
|
486 |
+
if ("querySelectorAll" in document) {
|
487 |
+
try {
|
488 |
+
var flxmap = this.getMap().getDiv(),
|
489 |
+
location = this.getCenter(),
|
490 |
+
googleLinks = flxmap.querySelectorAll("a[href*='maps.google.com/maps']:not([href*='mps_dialog']):not([href*='&q='])"),
|
491 |
+
i = 0, len = googleLinks.length,
|
492 |
+
query = encodeURIComponent((this.markerAddress ? this.markerAddress : this.markerTitle) +
|
493 |
+
" @" + location.lat() + "," + location.lng());
|
494 |
+
|
495 |
+
for (; i < len; i++) {
|
496 |
+
googleLinks[i].href += "&mrt=loc&iwloc=A&q=" + query;
|
497 |
+
}
|
498 |
+
}
|
499 |
+
catch (e) {
|
500 |
+
// we don't care
|
501 |
+
}
|
502 |
+
}
|
503 |
+
},
|
504 |
+
|
505 |
/**
|
506 |
* tell Google Maps to redraw the map, and centre it back where it started with default zoom
|
507 |
*/
|
529 |
if (!this.dirService)
|
530 |
this.dirService = new google.maps.DirectionsService();
|
531 |
|
532 |
+
// make sure we have a directions renderer
|
533 |
+
if (!this.dirRenderer) {
|
534 |
+
this.dirRenderer = new google.maps.DirectionsRenderer({
|
535 |
map: map,
|
536 |
draggable: this.dirDraggable,
|
537 |
suppressMarkers: this.dirSuppressMarkers,
|
538 |
+
panel: this.dirShowSteps ? document.getElementById(this.markerDirectionsDiv) : null
|
539 |
});
|
540 |
}
|
541 |
},
|
548 |
* @param {bool} focus [optional]
|
549 |
*/
|
550 |
showDirections: function(latitude, longitude, title, focus) {
|
551 |
+
var self = this;
|
552 |
+
|
553 |
+
/**
|
554 |
+
* show the directions form to allow directions searches
|
555 |
+
*/
|
556 |
+
function showDirectionsForm() {
|
557 |
+
var panel = document.getElementById(self.markerDirectionsDiv),
|
558 |
+
form = document.createElement("form"),
|
559 |
+
input, p, from;
|
560 |
+
|
561 |
+
// remove all from panel
|
562 |
+
while (!!(p = panel.lastChild))
|
563 |
+
panel.removeChild(p);
|
564 |
+
|
565 |
+
// populate form and add to panel
|
566 |
+
p = document.createElement("p");
|
567 |
+
p.appendChild(document.createTextNode(self.gettext("From") + ": "));
|
568 |
+
from = document.createElement("input");
|
569 |
+
from.type = "text";
|
570 |
+
from.name = "from";
|
571 |
+
from.value = self.markerDirectionsDefault;
|
572 |
+
p.appendChild(from);
|
573 |
+
input = document.createElement("input");
|
574 |
+
input.type = "submit";
|
575 |
+
input.value = self.gettext("Get directions");
|
576 |
+
p.appendChild(input);
|
577 |
+
form.appendChild(p);
|
578 |
+
panel.appendChild(form);
|
579 |
+
|
580 |
+
// hack to fix IE<=7 name weirdness for dynamically created form elements;
|
581 |
+
// see http://msdn.microsoft.com/en-us/library/ms534184.aspx but have a hanky ready
|
582 |
+
if (typeof form.elements.from == "undefined") {
|
583 |
+
form.elements.from = from;
|
584 |
+
}
|
585 |
+
|
586 |
+
// only focus when asked, to prevent problems autofocusing on elements and scrolling the page!
|
587 |
+
if (focus) {
|
588 |
+
from.focus();
|
589 |
+
}
|
590 |
+
|
591 |
+
// handle the form submit
|
592 |
+
addEventListener(form, "submit", function(event) {
|
593 |
+
stopEvent(event);
|
594 |
+
|
595 |
+
var from = this.elements.from.value;
|
596 |
+
|
597 |
+
// only process if something was entered to search on
|
598 |
+
if (/\S/.test(from)) {
|
599 |
+
requestDirections(from);
|
600 |
+
}
|
601 |
+
|
602 |
+
});
|
603 |
}
|
604 |
|
605 |
+
/**
|
606 |
+
* request directions
|
607 |
+
* @param {String} from
|
608 |
+
*/
|
609 |
+
function requestDirections(from) {
|
610 |
+
var dest = (self.markerAddress === "") ? new google.maps.LatLng(latitude, longitude) : self.markerAddress,
|
611 |
+
request = {
|
612 |
+
origin: from,
|
613 |
+
region: self.region || '',
|
614 |
+
destination: dest,
|
615 |
+
travelMode: google.maps.DirectionsTravelMode.DRIVING
|
616 |
+
};
|
617 |
+
|
618 |
+
self.dirService.route(request, dirResponseHander);
|
619 |
}
|
620 |
|
621 |
+
/**
|
622 |
+
* handle the response for Google directions service
|
623 |
+
* @param {google.maps.DirectionsResult} response
|
624 |
+
* @param {Number} status
|
625 |
+
*/
|
626 |
+
function dirResponseHander(response, status) {
|
627 |
+
var DirectionsStatus = google.maps.DirectionsStatus;
|
628 |
+
|
629 |
+
switch (status) {
|
630 |
+
case DirectionsStatus.OK:
|
631 |
+
self.dirRenderer.setDirections(response);
|
632 |
+
break;
|
633 |
+
|
634 |
+
case DirectionsStatus.ZERO_RESULTS:
|
635 |
+
alert("No route could be found between the origin and destination.");
|
636 |
+
break;
|
637 |
+
|
638 |
+
case DirectionsStatus.OVER_QUERY_LIMIT:
|
639 |
+
alert("The webpage has gone over the requests limit in too short a period of time.");
|
640 |
+
break;
|
641 |
+
|
642 |
+
case DirectionsStatus.REQUEST_DENIED:
|
643 |
+
alert("The webpage is not allowed to use the directions service.");
|
644 |
+
break;
|
645 |
+
|
646 |
+
case DirectionsStatus.INVALID_REQUEST:
|
647 |
+
alert("Invalid directions request.");
|
648 |
+
break;
|
649 |
+
|
650 |
+
case DirectionsStatus.NOT_FOUND:
|
651 |
+
alert("Origin or destination was not found.");
|
652 |
+
break;
|
653 |
+
|
654 |
+
default:
|
655 |
+
alert("A directions request could not be processed due to a server error. The request may succeed if you try again.");
|
656 |
+
break;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
657 |
}
|
658 |
+
}
|
659 |
|
660 |
+
// if we have a directions div, show the form for searching it
|
661 |
+
if (this.markerDirectionsDiv && this.dirShowSearch) {
|
662 |
+
showDirectionsForm();
|
663 |
+
}
|
664 |
|
665 |
// if the from: location is already set, trigger the directions query
|
666 |
+
if (this.markerDirectionsDefault) {
|
667 |
+
requestDirections(this.markerDirectionsDefault);
|
668 |
}
|
669 |
|
670 |
}
|
flexible-map.min.js
CHANGED
@@ -2,4 +2,4 @@
|
|
2 |
JavaScript for the WordPress plugin wp-flexible-map
|
3 |
copyright (c) 2011-2013 WebAware Pty Ltd, released under LGPL v2.1
|
4 |
*/
|
5 |
-
;function FlexibleMap(){var d,b,c,a=false;this.getMap=function(){return d};this.getCenter=function(){return b};this.setCenter=function(e){b=e;d.setCenter(b)};this.getKmlLayer=function(){return c};this.redrawOnce=function(){if(!a){a=true;this.redraw()}};this.showMap=function(e,
|
2 |
JavaScript for the WordPress plugin wp-flexible-map
|
3 |
copyright (c) 2011-2013 WebAware Pty Ltd, released under LGPL v2.1
|
4 |
*/
|
5 |
+
;function FlexibleMap(){var d,b,c,a=false;this.getMap=function(){return d};this.getCenter=function(){return b};this.setCenter=function(e){b=e;d.setCenter(b)};this.getKmlLayer=function(){return c};this.redrawOnce=function(){if(!a){a=true;this.redraw()}};this.showMap=function(e,g){b=new google.maps.LatLng(g[0],g[1]);var h,f={small:google.maps.ZoomControlStyle.SMALL,large:google.maps.ZoomControlStyle.LARGE,"default":google.maps.ZoomControlStyle.DEFAULT};if(this.zoomControlStyle in f){h=f[this.zoomControlStyle]}else{h=f.small}if(this.visualRefresh){google.maps.visualRefresh=true}d=new google.maps.Map(document.getElementById(e),{mapTypeId:this.mapTypeId,mapTypeControl:this.mapTypeControl,scaleControl:this.scaleControl,panControl:this.panControl,streetViewControl:this.streetViewControl,zoomControl:this.zoomControl,zoomControlOptions:{style:h},draggable:this.draggable,disableDoubleClickZoom:!this.dblclickZoom,scrollwheel:this.scrollwheel,center:b,zoom:this.zoom});return d};this.loadKmlMap=function(e){c=new google.maps.KmlLayer({map:d,url:e});google.maps.event.addListenerOnce(c,"defaultviewport_changed",function(){b=c.getDefaultViewport().getCenter()});return c};this.mapTypeId=google.maps.MapTypeId.ROADMAP;this.mapTypeControl=true;this.scaleControl=false;this.panControl=false;this.zoomControl=true;this.zoomControlStyle="small";this.streetViewControl=false;this.scrollwheel=false;this.draggable=true;this.dblclickZoom=true;this.zoom=16;this.markerTitle="";this.markerDescription="";this.markerHTML="";this.markerLink="";this.markerIcon="";this.markerShowInfo=true;this.markerDirections=false;this.markerDirectionsShow=false;this.markerDirectionsDefault="";this.markerAddress="";this.targetFix=true;this.dirService=false;this.dirRenderer=false;this.dirDraggable=false;this.dirSuppressMarkers=false;this.dirShowSteps=true;this.dirShowSearch=true;this.region="";this.locale="en";this.localeActive="en";this.visualRefresh=false}FlexibleMap.prototype=(function(){var c,b;if(document.addEventListener){c=function(e,d,f){e.addEventListener(d,f,false)};b=function(d){d.stopPropagation();d.preventDefault()}}else{if(document.attachEvent){c=function(d,e,f){d.attachEvent("on"+e,function(){f.call(d,window.event)})};b=function(d){d.cancelBubble=true;d.returnValue=0}}}var a=(function(){function d(f){var g=f.charCodeAt(0),e=g.toString(16);if(g<256){return"\\x"+("00"+e).slice(-2)}return"\\u"+("0000"+e).slice(-4)}return function(e){return e.replace(/[\\\/"'&<>\x00-\x1f\x7f-\xa0\u2000-\u200f\u2028-\u202f]/g,d)}})();return{constructor:FlexibleMap,i18n:{en:{"Click for details":"Click for details",Directions:"Directions",From:"From","Get directions":"Get directions"}},setlocale:function(d){this.locale=d;if(d in this.i18n){this.localeActive=d}else{d=d.substr(0,2);if(d in this.i18n){this.localeActive=d}else{this.localeActive="en"}}return this.localeActive},gettext:function(e){var d=this.i18n[this.localeActive];if(e in d){return d[e]}return e},showKML:function(d,g,h){if(typeof h!="undefined"){this.zoom=h}var f=this,e=document.getElementById(d),k=e.getAttribute("data-flxmap"),j=this.showMap(d,[0,0]),i=this.loadKmlMap(g);if(typeof h!="undefined"){google.maps.event.addListenerOnce(j,"zoom_changed",function(){j.setZoom(h);f.zoom=h})}if(this.markerDirections||this.markerDirectionsShow){this.startDirService(j)}google.maps.event.addListener(i,"click",function(q){var o=q.featureData;if(!o._flxmapOnce){o._flxmapOnce=true;if(f.targetFix){var n=/ target="_blank"/ig;o.description=o.description.replace(n,"");o.infoWindowHtml=o.infoWindowHtml.replace(n,"")}if(f.markerDirections){var m=q.latLng,p=m.lat()+","+m.lng()+",'"+a(o.name)+"',true",l='<br /><a href="#" data-flxmap-fix-opera="1" onclick="'+k+".showDirections("+p+'); return false;">'+f.gettext("Directions")+"</a>";o.infoWindowHtml=o.infoWindowHtml.replace(/<\/div><\/div>$/i,l+"</div></div>")}}});if(window.opera&&this.markerDirections){c(e,"click",function(l){if(l.target.getAttribute("data-flxmap-fix-opera")){b(l)}})}},showMarker:function(g,f,l){var e=this.showMap(g,f),p=new google.maps.Marker({map:e,position:new google.maps.LatLng(l[0],l[1]),icon:this.markerIcon});if(!this.markerTitle){this.markerTitle=this.markerAddress}if(this.markerTitle){var k,m,r,h,j,o,q=this,d=document.createElement("DIV");d.className="flxmap-infowin";p.setTitle(this.markerTitle);j=document.createElement("DIV");j.className="flxmap-marker-title";j.appendChild(document.createTextNode(this.markerTitle));d.appendChild(j);if(this.markerHTML){j=document.createElement("DIV");j.innerHTML=this.markerHTML;d.appendChild(j)}if(this.markerDescription||this.markerLink){j=document.createElement("DIV");j.className="flxmap-marker-link";if(this.markerDescription){r=this.markerDescription.split("\n");for(k=0,m=r.length;k<m;k++){if(k>0){j.appendChild(document.createElement("BR"))}j.appendChild(document.createTextNode(r[k]))}if(this.markerLink){j.appendChild(document.createElement("BR"))}}if(this.markerLink){o=document.createElement("A");o.href=this.markerLink;o.appendChild(document.createTextNode(this.gettext("Click for details")));j.appendChild(o)}d.appendChild(j)}if(this.markerDirections){j=document.createElement("DIV");j.className="flxmap-directions-link";o=document.createElement("A");o.href="#";o.dataLatitude=l[0];o.dataLongitude=l[1];o.dataTitle=this.markerTitle;c(o,"click",function(i){b(i);q.showDirections(this.dataLatitude,this.dataLongitude,this.dataTitle,true)});o.appendChild(document.createTextNode(this.gettext("Directions")));j.appendChild(o);d.appendChild(j)}if(this.markerDirections||this.markerDirectionsShow){this.startDirService(e);if(this.markerDirectionsShow){this.showDirections(l[0],l[1],this.markerTitle,false)}}h=new google.maps.InfoWindow({content:d});if(this.markerShowInfo){google.maps.event.addListenerOnce(e,"tilesloaded",function(){h.open(e,p)})}google.maps.event.addListener(p,"click",function(){h.open(e,p)});function n(){q.updateGoogleLink()}google.maps.event.addListener(e,"idle",n);google.maps.event.addListener(e,"center_changed",n)}},showAddress:function(d,e){var f=this,g=new google.maps.Geocoder();this.markerAddress=e;if(this.markerTitle===""){this.markerTitle=e}g.geocode({address:e,region:this.region},function(j,i){if(i==google.maps.GeocoderStatus.OK){var h=j[0].geometry.location,k=[h.lat(),h.lng()];f.showMarker(d,k,k)}else{alert("Map address returns error: "+i)}})},updateGoogleLink:function(){if("querySelectorAll" in document){try{var l=this.getMap().getDiv(),f=this.getCenter(),h=l.querySelectorAll("a[href*='maps.google.com/maps']:not([href*='mps_dialog']):not([href*='&q='])"),g=0,d=h.length,j=encodeURIComponent((this.markerAddress?this.markerAddress:this.markerTitle)+" @"+f.lat()+","+f.lng());for(;g<d;g++){h[g].href+="&mrt=loc&iwloc=A&q="+j}}catch(k){}}},redraw:function(){var e=this.getMap(),d=this.getKmlLayer();google.maps.event.trigger(e,"resize");if(d){e.fitBounds(d.getDefaultViewport())}else{e.setCenter(this.getCenter());e.setZoom(this.zoom)}},startDirService:function(d){if(!this.dirService){this.dirService=new google.maps.DirectionsService()}if(!this.dirRenderer){this.dirRenderer=new google.maps.DirectionsRenderer({map:d,draggable:this.dirDraggable,suppressMarkers:this.dirSuppressMarkers,panel:this.dirShowSteps?document.getElementById(this.markerDirectionsDiv):null})}},showDirections:function(k,g,j,d){var e=this;function i(){var l=document.getElementById(e.markerDirectionsDiv),n=document.createElement("form"),m,o,q;while(!!(o=l.lastChild)){l.removeChild(o)}o=document.createElement("p");o.appendChild(document.createTextNode(e.gettext("From")+": "));q=document.createElement("input");q.type="text";q.name="from";q.value=e.markerDirectionsDefault;o.appendChild(q);m=document.createElement("input");m.type="submit";m.value=e.gettext("Get directions");o.appendChild(m);n.appendChild(o);l.appendChild(n);if(typeof n.elements.from=="undefined"){n.elements.from=q}if(d){q.focus()}c(n,"submit",function(p){b(p);var r=this.elements.from.value;if(/\S/.test(r)){h(r)}})}function h(n){var l=(e.markerAddress==="")?new google.maps.LatLng(k,g):e.markerAddress,m={origin:n,region:e.region||"",destination:l,travelMode:google.maps.DirectionsTravelMode.DRIVING};e.dirService.route(m,f)}function f(n,l){var m=google.maps.DirectionsStatus;switch(l){case m.OK:e.dirRenderer.setDirections(n);break;case m.ZERO_RESULTS:alert("No route could be found between the origin and destination.");break;case m.OVER_QUERY_LIMIT:alert("The webpage has gone over the requests limit in too short a period of time.");break;case m.REQUEST_DENIED:alert("The webpage is not allowed to use the directions service.");break;case m.INVALID_REQUEST:alert("Invalid directions request.");break;case m.NOT_FOUND:alert("Origin or destination was not found.");break;default:alert("A directions request could not be processed due to a server error. The request may succeed if you try again.");break}}if(this.markerDirectionsDiv&&this.dirShowSearch){i()}if(this.markerDirectionsDefault){h(this.markerDirectionsDefault)}}}})();
|
flexible-map.php
CHANGED
@@ -3,7 +3,7 @@
|
|
3 |
Plugin Name: Flexible Map
|
4 |
Plugin URI: http://snippets.webaware.com.au/wordpress-plugins/wp-flexible-map/
|
5 |
Description: Embed Google Maps in pages and posts, either by centre coodinates or street address, or by URL to a Google Earth KML file.
|
6 |
-
Version: 1.
|
7 |
Author: WebAware
|
8 |
Author URI: http://www.webaware.com.au/
|
9 |
*/
|
@@ -33,7 +33,7 @@ if (!defined('FLXMAP_PLUGIN_ROOT')) {
|
|
33 |
if (defined('SCRIPT_DEBUG') && SCRIPT_DEBUG)
|
34 |
define('FLXMAP_PLUGIN_VERSION', time());
|
35 |
else
|
36 |
-
define('FLXMAP_PLUGIN_VERSION', '1.
|
37 |
|
38 |
// shortcode tags
|
39 |
define('FLXMAP_PLUGIN_TAG_MAP', 'flexiblemap');
|
3 |
Plugin Name: Flexible Map
|
4 |
Plugin URI: http://snippets.webaware.com.au/wordpress-plugins/wp-flexible-map/
|
5 |
Description: Embed Google Maps in pages and posts, either by centre coodinates or street address, or by URL to a Google Earth KML file.
|
6 |
+
Version: 1.7.0
|
7 |
Author: WebAware
|
8 |
Author URI: http://www.webaware.com.au/
|
9 |
*/
|
33 |
if (defined('SCRIPT_DEBUG') && SCRIPT_DEBUG)
|
34 |
define('FLXMAP_PLUGIN_VERSION', time());
|
35 |
else
|
36 |
+
define('FLXMAP_PLUGIN_VERSION', '1.7.0');
|
37 |
|
38 |
// shortcode tags
|
39 |
define('FLXMAP_PLUGIN_TAG_MAP', 'flexiblemap');
|
i18n/el.js
CHANGED
@@ -1,13 +1,13 @@
|
|
1 |
// Greek
|
2 |
-
//
|
3 |
|
4 |
if (typeof FlexibleMap != "undefined") {
|
5 |
|
6 |
FlexibleMap.prototype.i18n["el"] = {
|
7 |
"Click for details" : "Κάντε κλικ για λεπτομέρειες",
|
8 |
-
"Directions" : "
|
9 |
-
"From" : "
|
10 |
-
"Get directions" : "
|
11 |
};
|
12 |
|
13 |
}
|
1 |
// Greek
|
2 |
+
// translation by Pantelis Orfanos http://profiles.wordpress.org/ironwiller/ -- thanks!
|
3 |
|
4 |
if (typeof FlexibleMap != "undefined") {
|
5 |
|
6 |
FlexibleMap.prototype.i18n["el"] = {
|
7 |
"Click for details" : "Κάντε κλικ για λεπτομέρειες",
|
8 |
+
"Directions" : "Οδηγίες διαδρομής",
|
9 |
+
"From" : "Από",
|
10 |
+
"Get directions" : "Δείτε διαδρομή"
|
11 |
};
|
12 |
|
13 |
}
|
i18n/nl.js
CHANGED
@@ -1,13 +1,13 @@
|
|
1 |
// Dutch
|
2 |
-
//
|
3 |
|
4 |
if (typeof FlexibleMap != "undefined") {
|
5 |
|
6 |
FlexibleMap.prototype.i18n["nl"] = {
|
7 |
"Click for details" : "Klik hier voor details",
|
8 |
-
"Directions" : "
|
9 |
"From" : "Plaats van vertrek",
|
10 |
-
"Get directions" : "
|
11 |
};
|
12 |
|
13 |
}
|
1 |
// Dutch
|
2 |
+
// translation by Ivan Beemster http://www.lijndiensten.com/ -- thanks!
|
3 |
|
4 |
if (typeof FlexibleMap != "undefined") {
|
5 |
|
6 |
FlexibleMap.prototype.i18n["nl"] = {
|
7 |
"Click for details" : "Klik hier voor details",
|
8 |
+
"Directions" : "Routebeschrijving",
|
9 |
"From" : "Plaats van vertrek",
|
10 |
+
"Get directions" : "Routebeschrijving opvragen"
|
11 |
};
|
12 |
|
13 |
}
|
instructions.html
CHANGED
@@ -33,6 +33,8 @@ many different markers all on the one map.</p>
|
|
33 |
<dd>hide the zoom controls, from [true, false], e.g. <em>hidezooming="true"</em>; default=false</dd>
|
34 |
<dt>hidestreetview</dt>
|
35 |
<dd>hide the street view control, from [true, false], e.g. <em>hidestreetview="true"</em>; default=true</dd>
|
|
|
|
|
36 |
<dt>hidescale</dt>
|
37 |
<dd>hide the map scale, from [true, false], e.g. <em>hidescale="true"</em>; default=true</dd>
|
38 |
<dt>scrollwheel</dt>
|
@@ -47,10 +49,16 @@ many different markers all on the one map.</p>
|
|
47 |
<dd>allow directions to be draggable, from [true, false]; default=false</dd>
|
48 |
<dt>dirnomarkers</dt>
|
49 |
<dd>suppress start and end markers when showing directions, from [true, false]; default=false</dd>
|
|
|
|
|
|
|
|
|
50 |
<dt>region</dt>
|
51 |
-
<dd>specify region to help localise address searches for street address map and directions, taken from the list of <a href="http://en.wikipedia.org/wiki/List_of_Internet_top-level_domains#Country_code_top-level_domains">ccTLD</a> (without the .), e.g. <em>region="au"</em></dd>
|
52 |
<dt>locale</dt>
|
53 |
<dd>use a specific locale (language) for messages like the text of the Directions link, e.g. <em>locale="nl-BE"</em></dd>
|
|
|
|
|
54 |
</dl>
|
55 |
|
56 |
<hr />
|
@@ -84,7 +92,7 @@ many different markers all on the one map.</p>
|
|
84 |
<dt>locale</dt>
|
85 |
<dd>use a specific locale (language) for messages like the text of the Directions link, e.g. <em>locale="nl-BE"</em></dd>
|
86 |
<dt>region</dt>
|
87 |
-
<dd>specify region to help localise address searches for street address map and directions, taken from the list of <a href="http://en.wikipedia.org/wiki/List_of_Internet_top-level_domains#Country_code_top-level_domains">ccTLD</a> (without the .), e.g. <em>region="au"</em></dd>
|
88 |
<dt>Samples:</dt>
|
89 |
<dd><code>[flexiblemap center="-34.916721,138.828878" width="500" height="400" zoom="9" title="Adelaide Hills" description="The Adelaide Hills are repleat with wineries."]</code></dd>
|
90 |
<dd><code>[flexiblemap center="-34.916721,138.828878" width="500" height="400" title="Adelaide Hills" directions="true"]</code></dd>
|
33 |
<dd>hide the zoom controls, from [true, false], e.g. <em>hidezooming="true"</em>; default=false</dd>
|
34 |
<dt>hidestreetview</dt>
|
35 |
<dd>hide the street view control, from [true, false], e.g. <em>hidestreetview="true"</em>; default=true</dd>
|
36 |
+
<dt>zoomstyle</dt>
|
37 |
+
<dd>which zoom control style, from [small, large, default]; default=small</dd>
|
38 |
<dt>hidescale</dt>
|
39 |
<dd>hide the map scale, from [true, false], e.g. <em>hidescale="true"</em>; default=true</dd>
|
40 |
<dt>scrollwheel</dt>
|
49 |
<dd>allow directions to be draggable, from [true, false]; default=false</dd>
|
50 |
<dt>dirnomarkers</dt>
|
51 |
<dd>suppress start and end markers when showing directions, from [true, false]; default=false</dd>
|
52 |
+
<dt>dirshowsteps</dt>
|
53 |
+
<dd>show or suppress directions steps when showing directions, from [true, false]; default=true</dd>
|
54 |
+
<dt>dirshowssearch</dt>
|
55 |
+
<dd>show or suppress directions search form when showing directions, from [true, false]; default=true</dd>
|
56 |
<dt>region</dt>
|
57 |
+
<dd>specify region to help localise address searches for street address map and directions, taken from the list of <a target="_blank" href="http://en.wikipedia.org/wiki/List_of_Internet_top-level_domains#Country_code_top-level_domains">ccTLD</a> (without the .), e.g. <em>region="au"</em></dd>
|
58 |
<dt>locale</dt>
|
59 |
<dd>use a specific locale (language) for messages like the text of the Directions link, e.g. <em>locale="nl-BE"</em></dd>
|
60 |
+
<dt>visualrefresh</dt>
|
61 |
+
<dd>enable <a target="_blank" href="https://developers.google.com/maps/documentation/javascript/basics#VisualRefresh">visual refresh</a>; NB: affects all maps on the page! from [true, false]; default=false</dd>
|
62 |
</dl>
|
63 |
|
64 |
<hr />
|
92 |
<dt>locale</dt>
|
93 |
<dd>use a specific locale (language) for messages like the text of the Directions link, e.g. <em>locale="nl-BE"</em></dd>
|
94 |
<dt>region</dt>
|
95 |
+
<dd>specify region to help localise address searches for street address map and directions, taken from the list of <a target="_blank" href="http://en.wikipedia.org/wiki/List_of_Internet_top-level_domains#Country_code_top-level_domains">ccTLD</a> (without the .), e.g. <em>region="au"</em></dd>
|
96 |
<dt>Samples:</dt>
|
97 |
<dd><code>[flexiblemap center="-34.916721,138.828878" width="500" height="400" zoom="9" title="Adelaide Hills" description="The Adelaide Hills are repleat with wineries."]</code></dd>
|
98 |
<dd><code>[flexiblemap center="-34.916721,138.828878" width="500" height="400" title="Adelaide Hills" directions="true"]</code></dd>
|
readme.txt
CHANGED
@@ -6,8 +6,8 @@ Author URI: http://www.webaware.com.au/
|
|
6 |
Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=6ZCY9PST8E4GQ
|
7 |
Tags: google, map, maps, google maps, shortcode, kml
|
8 |
Requires at least: 3.2.1
|
9 |
-
Tested up to: 3.6
|
10 |
-
Stable tag: 1.
|
11 |
License: GPLv2 or later
|
12 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
13 |
|
@@ -27,6 +27,7 @@ Flexible Map allows you to add Google Maps to your WordPress website.
|
|
27 |
* simple shortcode for adding maps to pages/posts
|
28 |
* PHP function `flexmap_show_map()` for theme and plugin developers
|
29 |
* supports multiple maps on a page/post
|
|
|
30 |
* map marker doesn't have to be the centre of the map
|
31 |
* optional description for info window
|
32 |
* optional directions link for info window
|
@@ -40,6 +41,16 @@ Click to see [WP Flexible Map in action](http://snippets.webaware.com.au/wordpre
|
|
40 |
|
41 |
Thanks for sponsoring new features on WP Flexible Maps!
|
42 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
43 |
== Installation ==
|
44 |
|
45 |
1. Upload this plugin to your /wp-content/plugins/ directory.
|
@@ -55,8 +66,8 @@ To add a Flexible Map to a post or a page, add a shortcode [flexiblemap] and giv
|
|
55 |
|
56 |
= Parameters for all maps =
|
57 |
|
58 |
-
* **width**: width in pixels or valid CSS units, e.g. *width="
|
59 |
-
* **height**: height in pixels or valid CSS units, e.g. *height="
|
60 |
* **id**: the CSS id of the container div (instead of a random generated unique ID), e.g. *id="my_map"*
|
61 |
* **zoom**: zoom level as an integer, larger is closer, e.g. *zoom="16"*
|
62 |
* **maptype**: type of map to show, from [roadmap, satellite], e.g. *maptype="roadmap"*; default=roadmap
|
@@ -65,14 +76,18 @@ To add a Flexible Map to a post or a page, add a shortcode [flexiblemap] and giv
|
|
65 |
* **hidezooming**: hide the zoom controls, from [true, false], e.g. *hidezooming="true"*; default=false
|
66 |
* **hidestreetview**: hide the street view control, from [true, false], e.g. *hidestreetview="true"*; default=true
|
67 |
* **hidescale**: hide the map scale, from [true, false], e.g. *hidescale="true"*; default=true
|
|
|
68 |
* **scrollwheel**: enable zoom with mouse scroll wheel, from [true, false], e.g. *scrollwheel="true"*; default=false
|
69 |
* **draggable**: enable dragging to pan, from [true, false], e.g. *draggable="true"*; default=true
|
70 |
* **dblclickzoom**: enable double-clicking to zoom, from [true, false], e.g. *dblclickzoom="true"*; default=true
|
71 |
* **directions**: show directions link in text bubble; by default, directions will be displayed underneath map, but you can specify the element ID for directions here, e.g. *directions="true", directions="my-dir-id"*; default=false
|
72 |
* **dirdraggable**: allow directions to be draggable, from [true, false]; default=false
|
73 |
* **dirnomarkers**: suppress start and end markers when showing directions, from [true, false]; default=false
|
|
|
|
|
74 |
* **region**: specify region to help localise address searches for street address map and directions, taken from the list of [ccTLD](http://en.wikipedia.org/wiki/List_of_Internet_top-level_domains#Country_code_top-level_domains) (without the .), e.g. *region="au"*
|
75 |
* **locale**: use a specific locale (language) for messages like the text of the Directions link, e.g. *locale="nl-BE"*
|
|
|
76 |
|
77 |
= Additional parameters for centre coordinates or street address map =
|
78 |
|
@@ -91,7 +106,7 @@ Either the center or the address paramater is required. If you provide both, the
|
|
91 |
* **directionsfrom**: initial from: location for directions, e.g. *directionsfrom="Sydney"*
|
92 |
|
93 |
*Samples*:
|
94 |
-
`[flexiblemap center="-34.916721,138.828878" width="
|
95 |
[flexiblemap address="116 Beaumont Street Hamilton NSW Australia" region="au" directions="true"]
|
96 |
[flexiblemap center="-32.891058,151.538042" title="Mount Sugarloaf" directions="true"]
|
97 |
[flexiblemap center="-32.918827,151.806164" title="Nobby's Head" directions="my-dir-div"]`
|
@@ -102,7 +117,7 @@ Either the center or the address paramater is required. If you provide both, the
|
|
102 |
* **targetfix**: prevent links from opening in new window, from [true, false], e.g. *targetfix="true"*; default=true
|
103 |
|
104 |
*Sample*:
|
105 |
-
`[flexiblemap src="http://snippets.webaware.com.au/maps/example-toronto.kml" width="
|
106 |
|
107 |
= Calling from templates or plugins =
|
108 |
|
@@ -111,7 +126,7 @@ There is a PHP function `flexmap_show_map()` for theme and plugin developers. Al
|
|
111 |
*Sample*:
|
112 |
`flexmap_show_map(array(
|
113 |
'center' => '-34.916721,138.828878',
|
114 |
-
'width' =>
|
115 |
'height' => 400,
|
116 |
'zoom' => 12,
|
117 |
'title' => 'Adelaide Hills',
|
@@ -168,7 +183,7 @@ Since version 1.1.0, this plugin now uses localised messages for things like the
|
|
168 |
|
169 |
= You've translated my language badly / it's missing =
|
170 |
|
171 |
-
The initial translations were made using Google Translate, so it's likely that some will be truly awful! Please help by editing the .js file for your language in the i18n folder, and tell me about it in the support forum.
|
172 |
|
173 |
= The map is broken in jQuery UI tabs =
|
174 |
|
@@ -208,8 +223,8 @@ For tabs in jQuery Tools, see [this support topic](http://wordpress.org/support/
|
|
208 |
|
209 |
If you want to add your own scripting for the map, you can get the map object by identifying the FlexibleMap global variable for your map, and asking it to getMap(). By default, each FlexibleMap is given a randomly generated ID and the global variable name is derived from that. The map's containing div has a data property with this global variable name. Here's some sample jQuery code that gets the map object for the (first) map:
|
210 |
|
211 |
-
|
212 |
-
var flxmapName =
|
213 |
var flxmap = window[flxmapName];
|
214 |
var map = flxmap.getMap();
|
215 |
// ... use map ...
|
@@ -221,7 +236,7 @@ Alternatively, you can specify the ID used for a given map, and it will then der
|
|
221 |
|
222 |
And here's some sample jQuery code:
|
223 |
|
224 |
-
|
225 |
var map = flxmap_sugarloaf.getMap();
|
226 |
// ... use map ...
|
227 |
});`
|
@@ -255,6 +270,19 @@ NB: currently, only AJAX methods that parse script tags will work correctly; thi
|
|
255 |
|
256 |
== Changelog ==
|
257 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
258 |
= 1.6.5 [2013-07-19] =
|
259 |
* fixed: stop twentythirteen theme stuffing up Google Maps infowindows with its too-promiscuous box-sizing rules
|
260 |
* added: `dirdraggable` and `dirnomarkers` parameters
|
6 |
Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=6ZCY9PST8E4GQ
|
7 |
Tags: google, map, maps, google maps, shortcode, kml
|
8 |
Requires at least: 3.2.1
|
9 |
+
Tested up to: 3.6.1
|
10 |
+
Stable tag: 1.7.0
|
11 |
License: GPLv2 or later
|
12 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
13 |
|
27 |
* simple shortcode for adding maps to pages/posts
|
28 |
* PHP function `flexmap_show_map()` for theme and plugin developers
|
29 |
* supports multiple maps on a page/post
|
30 |
+
* supports responsive design -- specify width / height in percent
|
31 |
* map marker doesn't have to be the centre of the map
|
32 |
* optional description for info window
|
33 |
* optional directions link for info window
|
41 |
|
42 |
Thanks for sponsoring new features on WP Flexible Maps!
|
43 |
|
44 |
+
= Translations =
|
45 |
+
|
46 |
+
Many thanks to the generous efforts of these people for human translations:
|
47 |
+
|
48 |
+
* Dutch (nl) -- [Ivan Beemster](http://www.lijndiensten.com/)
|
49 |
+
* French (fr) -- [mister klucha](http://wordpress.org/support/profile/mister-klucha)
|
50 |
+
* Greek (el) -- [Pantelis Orfanos](http://profiles.wordpress.org/ironwiller/)
|
51 |
+
|
52 |
+
The initial translations for all other languages were made using Google Translate, so it's likely that some will be truly awful! Please help by editing the .js file for your language in the i18n folder, and tell me about it in the [support forum](http://wordpress.org/support/plugin/wp-flexible-map).
|
53 |
+
|
54 |
== Installation ==
|
55 |
|
56 |
1. Upload this plugin to your /wp-content/plugins/ directory.
|
66 |
|
67 |
= Parameters for all maps =
|
68 |
|
69 |
+
* **width**: width in pixels or valid CSS units, e.g. *width="100%"*
|
70 |
+
* **height**: height in pixels or valid CSS units, e.g. *height="400px"*
|
71 |
* **id**: the CSS id of the container div (instead of a random generated unique ID), e.g. *id="my_map"*
|
72 |
* **zoom**: zoom level as an integer, larger is closer, e.g. *zoom="16"*
|
73 |
* **maptype**: type of map to show, from [roadmap, satellite], e.g. *maptype="roadmap"*; default=roadmap
|
76 |
* **hidezooming**: hide the zoom controls, from [true, false], e.g. *hidezooming="true"*; default=false
|
77 |
* **hidestreetview**: hide the street view control, from [true, false], e.g. *hidestreetview="true"*; default=true
|
78 |
* **hidescale**: hide the map scale, from [true, false], e.g. *hidescale="true"*; default=true
|
79 |
+
* **zoomstyle**: which zoom control style, from [small, large, default]; default=small
|
80 |
* **scrollwheel**: enable zoom with mouse scroll wheel, from [true, false], e.g. *scrollwheel="true"*; default=false
|
81 |
* **draggable**: enable dragging to pan, from [true, false], e.g. *draggable="true"*; default=true
|
82 |
* **dblclickzoom**: enable double-clicking to zoom, from [true, false], e.g. *dblclickzoom="true"*; default=true
|
83 |
* **directions**: show directions link in text bubble; by default, directions will be displayed underneath map, but you can specify the element ID for directions here, e.g. *directions="true", directions="my-dir-id"*; default=false
|
84 |
* **dirdraggable**: allow directions to be draggable, from [true, false]; default=false
|
85 |
* **dirnomarkers**: suppress start and end markers when showing directions, from [true, false]; default=false
|
86 |
+
* **dirshowsteps**: show or suppress directions steps when showing directions, from [true, false]; default=true
|
87 |
+
* **dirshowssearch**: show or suppress directions search form when showing directions, from [true, false]; default=true
|
88 |
* **region**: specify region to help localise address searches for street address map and directions, taken from the list of [ccTLD](http://en.wikipedia.org/wiki/List_of_Internet_top-level_domains#Country_code_top-level_domains) (without the .), e.g. *region="au"*
|
89 |
* **locale**: use a specific locale (language) for messages like the text of the Directions link, e.g. *locale="nl-BE"*
|
90 |
+
* **visualrefresh**: enable [visual refresh](https://developers.google.com/maps/documentation/javascript/basics#VisualRefresh); NB: affects all maps on the page! from [true, false]; default=false
|
91 |
|
92 |
= Additional parameters for centre coordinates or street address map =
|
93 |
|
106 |
* **directionsfrom**: initial from: location for directions, e.g. *directionsfrom="Sydney"*
|
107 |
|
108 |
*Samples*:
|
109 |
+
`[flexiblemap center="-34.916721,138.828878" width="100%" height="400px" zoom="9" title="Adelaide Hills" description="The Adelaide Hills are repleat with wineries."]
|
110 |
[flexiblemap address="116 Beaumont Street Hamilton NSW Australia" region="au" directions="true"]
|
111 |
[flexiblemap center="-32.891058,151.538042" title="Mount Sugarloaf" directions="true"]
|
112 |
[flexiblemap center="-32.918827,151.806164" title="Nobby's Head" directions="my-dir-div"]`
|
117 |
* **targetfix**: prevent links from opening in new window, from [true, false], e.g. *targetfix="true"*; default=true
|
118 |
|
119 |
*Sample*:
|
120 |
+
`[flexiblemap src="http://snippets.webaware.com.au/maps/example-toronto.kml" width="100%" height="400px"]`
|
121 |
|
122 |
= Calling from templates or plugins =
|
123 |
|
126 |
*Sample*:
|
127 |
`flexmap_show_map(array(
|
128 |
'center' => '-34.916721,138.828878',
|
129 |
+
'width' => '100%',
|
130 |
'height' => 400,
|
131 |
'zoom' => 12,
|
132 |
'title' => 'Adelaide Hills',
|
183 |
|
184 |
= You've translated my language badly / it's missing =
|
185 |
|
186 |
+
The initial translations were made using Google Translate, so it's likely that some will be truly awful! Please help by editing the .js file for your language in the i18n folder, and tell me about it in the [support forum](http://wordpress.org/support/plugin/wp-flexible-map).
|
187 |
|
188 |
= The map is broken in jQuery UI tabs =
|
189 |
|
223 |
|
224 |
If you want to add your own scripting for the map, you can get the map object by identifying the FlexibleMap global variable for your map, and asking it to getMap(). By default, each FlexibleMap is given a randomly generated ID and the global variable name is derived from that. The map's containing div has a data property with this global variable name. Here's some sample jQuery code that gets the map object for the (first) map:
|
225 |
|
226 |
+
`jQuery(window).load(function() {
|
227 |
+
var flxmapName = jQuery("div.flxmap-container").attr("data-flxmap");
|
228 |
var flxmap = window[flxmapName];
|
229 |
var map = flxmap.getMap();
|
230 |
// ... use map ...
|
236 |
|
237 |
And here's some sample jQuery code:
|
238 |
|
239 |
+
`jQuery(window).load(function() {
|
240 |
var map = flxmap_sugarloaf.getMap();
|
241 |
// ... use map ...
|
242 |
});`
|
270 |
|
271 |
== Changelog ==
|
272 |
|
273 |
+
= 1.7.0 [2013-10-12] =
|
274 |
+
* fixed: Greek translation (thanks, [Pantelis Orfanos](http://profiles.wordpress.org/ironwiller/)!)
|
275 |
+
* fixed: Dutch translation (thanks, [Ivan Beemster](http://www.lijndiensten.com/)!)
|
276 |
+
* fixed: KML map zoom sometimes doesn't happen on first page visit
|
277 |
+
* fixed: some themes (e.g. twentythirteen) mess up Google Maps directions markers
|
278 |
+
* fixed: Google link opens maps without marker (NB: <= IE8 not supported)
|
279 |
+
* added: `dirshowsteps` parameter, to allow directions steps (i.e. turn-by-turn steps) to be turned off
|
280 |
+
* added: `dirshowssearch` parameter, to allow directions search form to be turned off
|
281 |
+
* added: `zoomstyle` parameter, to allow large or small zoom controls
|
282 |
+
* added: `visualrefresh` parameter, to enable [visual refresh](https://developers.google.com/maps/documentation/javascript/basics#VisualRefresh) for all maps on the page
|
283 |
+
* added: default CSS sets info window text color to #333
|
284 |
+
* changed: bump version of Google Maps API to 3.13
|
285 |
+
|
286 |
= 1.6.5 [2013-07-19] =
|
287 |
* fixed: stop twentythirteen theme stuffing up Google Maps infowindows with its too-promiscuous box-sizing rules
|
288 |
* added: `dirdraggable` and `dirnomarkers` parameters
|
styles.css
CHANGED
@@ -14,10 +14,22 @@
|
|
14 |
background-color: transparent !important;
|
15 |
}
|
16 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
17 |
/* some basic styling for info window */
|
18 |
|
19 |
.flxmap-infowin {
|
20 |
font-family: Arial,Helvetica,sans-serif;
|
|
|
21 |
}
|
22 |
|
23 |
.flxmap-marker-title {
|
14 |
background-color: transparent !important;
|
15 |
}
|
16 |
|
17 |
+
.entry-content .flxmap-directions img.adp-marker {
|
18 |
+
max-width: none;
|
19 |
+
-webkit-box-shadow: none;
|
20 |
+
-moz-box-shadow: none;
|
21 |
+
box-shadow: none;
|
22 |
+
}
|
23 |
+
|
24 |
+
.flxmap-directions td.adp-text {
|
25 |
+
vertical-align: middle;
|
26 |
+
}
|
27 |
+
|
28 |
/* some basic styling for info window */
|
29 |
|
30 |
.flxmap-infowin {
|
31 |
font-family: Arial,Helvetica,sans-serif;
|
32 |
+
color: #333;
|
33 |
}
|
34 |
|
35 |
.flxmap-marker-title {
|