Version Description
Download this release
Release Info
Developer | miyauchi |
Plugin | Simple Map |
Version | 2.4.1 |
Comparing to | |
See all releases |
Version 2.4.1
- .svnignore +18 -0
- Gruntfile.js +42 -0
- js/simple-map.js +104 -0
- js/simple-map.min.js +13 -0
- package.json +24 -0
- readme.txt +197 -0
- simple-map.php +168 -0
.svnignore
ADDED
@@ -0,0 +1,18 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
.DS_Store
|
2 |
+
.git
|
3 |
+
.gitignore
|
4 |
+
.travis.yml
|
5 |
+
Gruntfile.js
|
6 |
+
LINGUAS
|
7 |
+
Makefile
|
8 |
+
README.md
|
9 |
+
_site
|
10 |
+
bin
|
11 |
+
composer.json
|
12 |
+
composer.lock
|
13 |
+
node_modules
|
14 |
+
npm-debug.log
|
15 |
+
package.json
|
16 |
+
phpunit.xml
|
17 |
+
tests
|
18 |
+
vendor
|
Gruntfile.js
ADDED
@@ -0,0 +1,42 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
/* vim: set ft=javascript expandtab shiftwidth=2 tabstop=2: */
|
2 |
+
|
3 |
+
module.exports = function( grunt ) {
|
4 |
+
|
5 |
+
// Project configuration
|
6 |
+
grunt.initConfig( {
|
7 |
+
pkg: grunt.file.readJSON( 'package.json' ),
|
8 |
+
uglify: {
|
9 |
+
all: {
|
10 |
+
files: {
|
11 |
+
'js/simple-map.min.js': [
|
12 |
+
'node_modules/gmaps/gmaps.js',
|
13 |
+
'js/simple-map.js'
|
14 |
+
]
|
15 |
+
},
|
16 |
+
options: {
|
17 |
+
banner: '/**\n' +
|
18 |
+
' * <%= pkg.title %> - v<%= pkg.version %>\n' +
|
19 |
+
' *\n' +
|
20 |
+
' * <%= pkg.homepage %>\n' +
|
21 |
+
' * <%= pkg.repository.url %>\n' +
|
22 |
+
' *\n' +
|
23 |
+
' * Special thanks!\n' +
|
24 |
+
' * http://hpneo.github.io/gmaps/\n' +
|
25 |
+
' *\n' +
|
26 |
+
' * Copyright <%= grunt.template.today("yyyy") %>, <%= pkg.author.name %> (<%= pkg.author.url %>)\n' +
|
27 |
+
' * Released under the <%= pkg.license %>\n' +
|
28 |
+
' */\n',
|
29 |
+
mangle: {
|
30 |
+
except: ['jQuery']
|
31 |
+
}
|
32 |
+
}
|
33 |
+
}
|
34 |
+
}
|
35 |
+
} );
|
36 |
+
|
37 |
+
// Load other tasks
|
38 |
+
grunt.loadNpmTasks('grunt-contrib-uglify');
|
39 |
+
grunt.registerTask( 'default', ['uglify'] );
|
40 |
+
|
41 |
+
grunt.util.linefeed = '\n';
|
42 |
+
};
|
js/simple-map.js
ADDED
@@ -0,0 +1,104 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
(function($){
|
2 |
+
|
3 |
+
var SimpleMap = function(element, pos, zoom, infoCont) {
|
4 |
+
this.base_url = 'https://maps.google.com/maps?';
|
5 |
+
this.display(element, pos, zoom, infoCont);
|
6 |
+
}
|
7 |
+
|
8 |
+
SimpleMap.prototype.display = function(element, pos, zoom, infoCont) {
|
9 |
+
$(element).show();
|
10 |
+
var breakpoint = $(element).data('breakpoint');
|
11 |
+
if (breakpoint > 640) {
|
12 |
+
breakpoint = 640;
|
13 |
+
}
|
14 |
+
if ($('html').width() > breakpoint) {
|
15 |
+
var map = new GMaps({
|
16 |
+
div: element,
|
17 |
+
lat: pos.lat(),
|
18 |
+
lng: pos.lng(),
|
19 |
+
mapTypeControl: false,
|
20 |
+
zoom: parseFloat(zoom),
|
21 |
+
streetViewControl: false,
|
22 |
+
scrollwheel: false,
|
23 |
+
mapTypeId: google.maps.MapTypeId.ROADMAP
|
24 |
+
});
|
25 |
+
if (infoCont.length) {
|
26 |
+
var marker = map.addMarker({
|
27 |
+
lat: pos.lat(),
|
28 |
+
lng: pos.lng(),
|
29 |
+
infoWindow: {
|
30 |
+
content: infoCont
|
31 |
+
}
|
32 |
+
});
|
33 |
+
if ($(element).data('infowindow') == 'open') {
|
34 |
+
marker.infoWindow.open(marker.map, marker);
|
35 |
+
}
|
36 |
+
} else {
|
37 |
+
map.addMarker({
|
38 |
+
lat: pos.lat(),
|
39 |
+
lng: pos.lng()
|
40 |
+
});
|
41 |
+
}
|
42 |
+
} else {
|
43 |
+
var url = GMaps.staticMapURL({
|
44 |
+
center: pos.lat()+','+pos.lng(),
|
45 |
+
zoom: zoom,
|
46 |
+
size: breakpoint+'x'+$(element).height(),
|
47 |
+
markers: [
|
48 |
+
{lat: pos.lat(), lng: pos.lng()}
|
49 |
+
],
|
50 |
+
sensor: 'false'
|
51 |
+
});
|
52 |
+
var img = $('<img />');
|
53 |
+
$(img).attr('src', url);
|
54 |
+
$(img).attr('alt', $(element).text());
|
55 |
+
var a = $('<a />');
|
56 |
+
$(a).attr(
|
57 |
+
'href',
|
58 |
+
this.base_url+'q='+pos.lat()+','+pos.lng()+'&z='+zoom
|
59 |
+
);
|
60 |
+
$(a).html(img);
|
61 |
+
$(element).html(a);
|
62 |
+
$(element).addClass('staticmap');
|
63 |
+
}
|
64 |
+
}
|
65 |
+
|
66 |
+
$('.simplemap').each(function(){
|
67 |
+
var element = $('div', this).get(0);
|
68 |
+
var zoom = 16;
|
69 |
+
if (parseFloat($(element).data('zoom'))) {
|
70 |
+
zoom = $(element).data('zoom');
|
71 |
+
}
|
72 |
+
if ($(element).data('lat') && $(element).data('lng')) {
|
73 |
+
var lat = $(element).data('lat');
|
74 |
+
var lng = $(element).data('lng');
|
75 |
+
var infoCont = $(element).html();
|
76 |
+
var pos = new google.maps.LatLng(
|
77 |
+
lat,
|
78 |
+
lng
|
79 |
+
);
|
80 |
+
new SimpleMap(element, pos, zoom, infoCont);
|
81 |
+
} else if ($(element).data('addr')) {
|
82 |
+
GMaps.geocode({
|
83 |
+
address: $(element).data('addr'),
|
84 |
+
callback: function(results, status) {
|
85 |
+
if (status == 'OK') {
|
86 |
+
var pos = results[0].geometry.location;
|
87 |
+
new SimpleMap(element, pos, zoom, $(element).html());
|
88 |
+
}
|
89 |
+
}
|
90 |
+
});
|
91 |
+
} else if ($(element).text().length) {
|
92 |
+
GMaps.geocode({
|
93 |
+
address: $(element).text(),
|
94 |
+
callback: function(results, status) {
|
95 |
+
if (status == 'OK') {
|
96 |
+
var pos = results[0].geometry.location;
|
97 |
+
new SimpleMap(element, pos, zoom, $(element).text());
|
98 |
+
}
|
99 |
+
}
|
100 |
+
});
|
101 |
+
}
|
102 |
+
});
|
103 |
+
|
104 |
+
})(jQuery);
|
js/simple-map.min.js
ADDED
@@ -0,0 +1,13 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
/**
|
2 |
+
* Simple Map - v1.3.0
|
3 |
+
*
|
4 |
+
* http://wordpress.org/plugins/simple-map/
|
5 |
+
* https://github.com/miya0001/simple-map
|
6 |
+
*
|
7 |
+
* Special thanks!
|
8 |
+
* http://hpneo.github.io/gmaps/
|
9 |
+
*
|
10 |
+
* Copyright 2015, Takayuki Miyauchi (http://wpist.me/)
|
11 |
+
* Released under the GPLv2
|
12 |
+
*/
|
13 |
+
(function(e,t){"object"==typeof exports?module.exports=t():"function"==typeof define&&define.amd&&define("GMaps",[],t),e.GMaps=t()})(this,function(){if("object"!=typeof window.google||!window.google.maps)throw"Google Maps API is required. Please register the following JavaScript library http://maps.google.com/maps/api/js?sensor=true.";var t=function(e,t){var o;if(e===t)return e;for(o in t)e[o]=t[o];return e},o=function(e,t){var o,n=Array.prototype.slice.call(arguments,2),r=[],a=e.length;if(Array.prototype.map&&e.map===Array.prototype.map)r=Array.prototype.map.call(e,function(e){return callback_params=n,callback_params.splice(0,0,e),t.apply(this,callback_params)});else for(o=0;a>o;o++)callback_params=n,callback_params.splice(0,0,e[o]),r.push(t.apply(this,callback_params));return r},n=function(e){var t,o=[];for(t=0;e.length>t;t++)o=o.concat(e[t]);return o},r=function(e,t){var o=e[0],n=e[1];return t&&(o=e[1],n=e[0]),new google.maps.LatLng(o,n)},a=function(e,t){var o;for(o=0;e.length>o;o++)e[o]instanceof google.maps.LatLng||(e[o]=e[o].length>0&&"object"==typeof e[o][0]?a(e[o],t):r(e[o],t));return e},s=function(e,t){var o,e=e.replace("#","");return o="jQuery"in this&&t?$("#"+e,t)[0]:document.getElementById(e)},i=function(e){var t=0,o=0;if(e.offsetParent)do t+=e.offsetLeft,o+=e.offsetTop;while(e=e.offsetParent);return[t,o]},l=function(){"use strict";var e=document,o=function(n){if(!this)return new o(n);n.zoom=n.zoom||15,n.mapType=n.mapType||"roadmap";var r,a=this,l=["bounds_changed","center_changed","click","dblclick","drag","dragend","dragstart","idle","maptypeid_changed","projection_changed","resize","tilesloaded","zoom_changed"],p=["mousemove","mouseout","mouseover"],c=["el","lat","lng","mapType","width","height","markerClusterer","enableNewStyle"],g=n.el||n.div,h=n.markerClusterer,d=google.maps.MapTypeId[n.mapType.toUpperCase()],u=new google.maps.LatLng(n.lat,n.lng),m=n.zoomControl||!0,f=n.zoomControlOpt||{style:"DEFAULT",position:"TOP_LEFT"},y=f.style||"DEFAULT",v=f.position||"TOP_LEFT",k=n.panControl||!0,w=n.mapTypeControl||!0,L=n.scaleControl||!0,b=n.streetViewControl||!0,_=_||!0,M={},x={zoom:this.zoom,center:u,mapTypeId:d},C={panControl:k,zoomControl:m,zoomControlOptions:{style:google.maps.ZoomControlStyle[y],position:google.maps.ControlPosition[v]},mapTypeControl:w,scaleControl:L,streetViewControl:b,overviewMapControl:_};if(this.el="string"==typeof n.el||"string"==typeof n.div?s(g,n.context):g,this.el===void 0||null===this.el)throw"No element defined.";for(window.context_menu=window.context_menu||{},window.context_menu[a.el.id]={},this.controls=[],this.overlays=[],this.layers=[],this.singleLayers={},this.markers=[],this.polylines=[],this.routes=[],this.polygons=[],this.infoWindow=null,this.overlay_el=null,this.zoom=n.zoom,this.registered_events={},this.el.style.width=n.width||this.el.scrollWidth||this.el.offsetWidth,this.el.style.height=n.height||this.el.scrollHeight||this.el.offsetHeight,google.maps.visualRefresh=n.enableNewStyle,r=0;c.length>r;r++)delete n[c[r]];for(1!=n.disableDefaultUI&&(x=t(x,C)),M=t(x,n),r=0;l.length>r;r++)delete M[l[r]];for(r=0;p.length>r;r++)delete M[p[r]];this.map=new google.maps.Map(this.el,M),h&&(this.markerClusterer=h.apply(this,[this.map]));var O=function(e,t){var o="",n=window.context_menu[a.el.id][e];for(var r in n)if(n.hasOwnProperty(r)){var l=n[r];o+='<li><a id="'+e+"_"+r+'" href="#">'+l.title+"</a></li>"}if(s("gmaps_context_menu")){var p=s("gmaps_context_menu");p.innerHTML=o;var r,c=p.getElementsByTagName("a"),g=c.length;for(r=0;g>r;r++){var h=c[r],d=function(o){o.preventDefault(),n[this.id.replace(e+"_","")].action.apply(a,[t]),a.hideContextMenu()};google.maps.event.clearListeners(h,"click"),google.maps.event.addDomListenerOnce(h,"click",d,!1)}var u=i.apply(this,[a.el]),m=u[0]+t.pixel.x-15,f=u[1]+t.pixel.y-15;p.style.left=m+"px",p.style.top=f+"px",p.style.display="block"}};this.buildContextMenu=function(e,t){if("marker"===e){t.pixel={};var o=new google.maps.OverlayView;o.setMap(a.map),o.draw=function(){var n=o.getProjection(),r=t.marker.getPosition();t.pixel=n.fromLatLngToContainerPixel(r),O(e,t)}}else O(e,t)},this.setContextMenu=function(t){window.context_menu[a.el.id][t.control]={};var o,n=e.createElement("ul");for(o in t.options)if(t.options.hasOwnProperty(o)){var r=t.options[o];window.context_menu[a.el.id][t.control][r.name]={title:r.title,action:r.action}}n.id="gmaps_context_menu",n.style.display="none",n.style.position="absolute",n.style.minWidth="100px",n.style.background="white",n.style.listStyle="none",n.style.padding="8px",n.style.boxShadow="2px 2px 6px #ccc",e.body.appendChild(n);var i=s("gmaps_context_menu");google.maps.event.addDomListener(i,"mouseout",function(e){e.relatedTarget&&this.contains(e.relatedTarget)||window.setTimeout(function(){i.style.display="none"},400)},!1)},this.hideContextMenu=function(){var e=s("gmaps_context_menu");e&&(e.style.display="none")};var P=function(e,t){google.maps.event.addListener(e,t,function(e){void 0==e&&(e=this),n[t].apply(this,[e]),a.hideContextMenu()})};google.maps.event.addListener(this.map,"zoom_changed",this.hideContextMenu);for(var T=0;l.length>T;T++){var z=l[T];z in n&&P(this.map,z)}for(var T=0;p.length>T;T++){var z=p[T];z in n&&P(this.map,z)}google.maps.event.addListener(this.map,"rightclick",function(e){n.rightclick&&n.rightclick.apply(this,[e]),void 0!=window.context_menu[a.el.id].map&&a.buildContextMenu("map",e)}),this.refresh=function(){google.maps.event.trigger(this.map,"resize")},this.fitZoom=function(){var e,t=[],o=this.markers.length;for(e=0;o>e;e++)"boolean"==typeof this.markers[e].visible&&this.markers[e].visible&&t.push(this.markers[e].getPosition());this.fitLatLngBounds(t)},this.fitLatLngBounds=function(e){var t,o=e.length,n=new google.maps.LatLngBounds;for(t=0;o>t;t++)n.extend(e[t]);this.map.fitBounds(n)},this.setCenter=function(e,t,o){this.map.panTo(new google.maps.LatLng(e,t)),o&&o()},this.getElement=function(){return this.el},this.zoomIn=function(e){e=e||1,this.zoom=this.map.getZoom()+e,this.map.setZoom(this.zoom)},this.zoomOut=function(e){e=e||1,this.zoom=this.map.getZoom()-e,this.map.setZoom(this.zoom)};var S,W=[];for(S in this.map)"function"!=typeof this.map[S]||this[S]||W.push(S);for(r=0;W.length>r;r++)(function(e,t,o){e[o]=function(){return t[o].apply(t,arguments)}})(this,this.map,W[r])};return o}(this);l.prototype.createControl=function(e){var t=document.createElement("div");t.style.cursor="pointer",e.disableDefaultStyles!==!0&&(t.style.fontFamily="Roboto, Arial, sans-serif",t.style.fontSize="11px",t.style.boxShadow="rgba(0, 0, 0, 0.298039) 0px 1px 4px -1px");for(var o in e.style)t.style[o]=e.style[o];e.id&&(t.id=e.id),e.classes&&(t.className=e.classes),e.content&&("string"==typeof e.content?t.innerHTML=e.content:e.content instanceof HTMLElement&&t.appendChild(e.content)),e.position&&(t.position=google.maps.ControlPosition[e.position.toUpperCase()]);for(var n in e.events)(function(t,o){google.maps.event.addDomListener(t,o,function(){e.events[o].apply(this,[this])})})(t,n);return t.index=1,t},l.prototype.addControl=function(e){var t=this.createControl(e);return this.controls.push(t),this.map.controls[t.position].push(t),t},l.prototype.removeControl=function(e){var t,o=null;for(t=0;this.controls.length>t;t++)this.controls[t]==e&&(o=this.controls[t].position,this.controls.splice(t,1));if(o)for(t=0;this.map.controls.length>t;t++){var n=this.map.controls[e.position];if(n.getAt(t)==e){n.removeAt(t);break}}return e},l.prototype.createMarker=function(e){if(void 0==e.lat&&void 0==e.lng&&void 0==e.position)throw"No latitude or longitude defined.";var o=this,n=e.details,r=e.fences,a=e.outside,s={position:new google.maps.LatLng(e.lat,e.lng),map:null},i=t(s,e);delete i.lat,delete i.lng,delete i.fences,delete i.outside;var l=new google.maps.Marker(i);if(l.fences=r,e.infoWindow){l.infoWindow=new google.maps.InfoWindow(e.infoWindow);for(var p=["closeclick","content_changed","domready","position_changed","zindex_changed"],c=0;p.length>c;c++)(function(t,o){e.infoWindow[o]&&google.maps.event.addListener(t,o,function(t){e.infoWindow[o].apply(this,[t])})})(l.infoWindow,p[c])}for(var g=["animation_changed","clickable_changed","cursor_changed","draggable_changed","flat_changed","icon_changed","position_changed","shadow_changed","shape_changed","title_changed","visible_changed","zindex_changed"],h=["dblclick","drag","dragend","dragstart","mousedown","mouseout","mouseover","mouseup"],c=0;g.length>c;c++)(function(t,o){e[o]&&google.maps.event.addListener(t,o,function(){e[o].apply(this,[this])})})(l,g[c]);for(var c=0;h.length>c;c++)(function(t,o,n){e[n]&&google.maps.event.addListener(o,n,function(o){o.pixel||(o.pixel=t.getProjection().fromLatLngToPoint(o.latLng)),e[n].apply(this,[o])})})(this.map,l,h[c]);return google.maps.event.addListener(l,"click",function(){this.details=n,e.click&&e.click.apply(this,[this]),l.infoWindow&&(o.hideInfoWindows(),l.infoWindow.open(o.map,l))}),google.maps.event.addListener(l,"rightclick",function(t){t.marker=this,e.rightclick&&e.rightclick.apply(this,[t]),void 0!=window.context_menu[o.el.id].marker&&o.buildContextMenu("marker",t)}),l.fences&&google.maps.event.addListener(l,"dragend",function(){o.checkMarkerGeofence(l,function(e,t){a(e,t)})}),l},l.prototype.addMarker=function(e){var t;if(e.hasOwnProperty("gm_accessors_"))t=e;else{if(!(e.hasOwnProperty("lat")&&e.hasOwnProperty("lng")||e.position))throw"No latitude or longitude defined.";t=this.createMarker(e)}return t.setMap(this.map),this.markerClusterer&&this.markerClusterer.addMarker(t),this.markers.push(t),l.fire("marker_added",t,this),t},l.prototype.addMarkers=function(e){for(var t,o=0;t=e[o];o++)this.addMarker(t);return this.markers},l.prototype.hideInfoWindows=function(){for(var e,t=0;e=this.markers[t];t++)e.infoWindow&&e.infoWindow.close()},l.prototype.removeMarker=function(e){for(var t=0;this.markers.length>t;t++)if(this.markers[t]===e){this.markers[t].setMap(null),this.markers.splice(t,1),this.markerClusterer&&this.markerClusterer.removeMarker(e),l.fire("marker_removed",e,this);break}return e},l.prototype.removeMarkers=function(e){var t=[];if(e===void 0){for(var o=0;this.markers.length>o;o++){var n=this.markers[o];n.setMap(null),this.markerClusterer&&this.markerClusterer.removeMarker(n),l.fire("marker_removed",n,this)}this.markers=t}else{for(var o=0;e.length>o;o++){var r=this.markers.indexOf(e[o]);if(r>-1){var n=this.markers[r];n.setMap(null),this.markerClusterer&&this.markerClusterer.removeMarker(n),l.fire("marker_removed",n,this)}}for(var o=0;this.markers.length>o;o++){var n=this.markers[o];null!=n.getMap()&&t.push(n)}this.markers=t}},l.prototype.drawOverlay=function(e){var t=new google.maps.OverlayView,o=!0;return t.setMap(this.map),null!=e.auto_show&&(o=e.auto_show),t.onAdd=function(){var o=document.createElement("div");o.style.borderStyle="none",o.style.borderWidth="0px",o.style.position="absolute",o.style.zIndex=100,o.innerHTML=e.content,t.el=o,e.layer||(e.layer="overlayLayer");var n=this.getPanes(),r=n[e.layer],a=["contextmenu","DOMMouseScroll","dblclick","mousedown"];r.appendChild(o);for(var s=0;a.length>s;s++)(function(e,t){google.maps.event.addDomListener(e,t,function(e){-1!=navigator.userAgent.toLowerCase().indexOf("msie")&&document.all?(e.cancelBubble=!0,e.returnValue=!1):e.stopPropagation()})})(o,a[s]);e.click&&(n.overlayMouseTarget.appendChild(t.el),google.maps.event.addDomListener(t.el,"click",function(){e.click.apply(t,[t])})),google.maps.event.trigger(this,"ready")},t.draw=function(){var n=this.getProjection(),r=n.fromLatLngToDivPixel(new google.maps.LatLng(e.lat,e.lng));e.horizontalOffset=e.horizontalOffset||0,e.verticalOffset=e.verticalOffset||0;var a=t.el,s=a.children[0],i=s.clientHeight,l=s.clientWidth;switch(e.verticalAlign){case"top":a.style.top=r.y-i+e.verticalOffset+"px";break;default:case"middle":a.style.top=r.y-i/2+e.verticalOffset+"px";break;case"bottom":a.style.top=r.y+e.verticalOffset+"px"}switch(e.horizontalAlign){case"left":a.style.left=r.x-l+e.horizontalOffset+"px";break;default:case"center":a.style.left=r.x-l/2+e.horizontalOffset+"px";break;case"right":a.style.left=r.x+e.horizontalOffset+"px"}a.style.display=o?"block":"none",o||e.show.apply(this,[a])},t.onRemove=function(){var o=t.el;e.remove?e.remove.apply(this,[o]):(t.el.parentNode.removeChild(t.el),t.el=null)},this.overlays.push(t),t},l.prototype.removeOverlay=function(e){for(var t=0;this.overlays.length>t;t++)if(this.overlays[t]===e){this.overlays[t].setMap(null),this.overlays.splice(t,1);break}},l.prototype.removeOverlays=function(){for(var e,t=0;e=this.overlays[t];t++)e.setMap(null);this.overlays=[]},l.prototype.drawPolyline=function(e){var t=[],o=e.path;if(o.length)if(void 0===o[0][0])t=o;else for(var n,r=0;n=o[r];r++)t.push(new google.maps.LatLng(n[0],n[1]));var a={map:this.map,path:t,strokeColor:e.strokeColor,strokeOpacity:e.strokeOpacity,strokeWeight:e.strokeWeight,geodesic:e.geodesic,clickable:!0,editable:!1,visible:!0};e.hasOwnProperty("clickable")&&(a.clickable=e.clickable),e.hasOwnProperty("editable")&&(a.editable=e.editable),e.hasOwnProperty("icons")&&(a.icons=e.icons),e.hasOwnProperty("zIndex")&&(a.zIndex=e.zIndex);for(var s=new google.maps.Polyline(a),i=["click","dblclick","mousedown","mousemove","mouseout","mouseover","mouseup","rightclick"],p=0;i.length>p;p++)(function(t,o){e[o]&&google.maps.event.addListener(t,o,function(t){e[o].apply(this,[t])})})(s,i[p]);return this.polylines.push(s),l.fire("polyline_added",s,this),s},l.prototype.removePolyline=function(e){for(var t=0;this.polylines.length>t;t++)if(this.polylines[t]===e){this.polylines[t].setMap(null),this.polylines.splice(t,1),l.fire("polyline_removed",e,this);break}},l.prototype.removePolylines=function(){for(var e,t=0;e=this.polylines[t];t++)e.setMap(null);this.polylines=[]},l.prototype.drawCircle=function(e){e=t({map:this.map,center:new google.maps.LatLng(e.lat,e.lng)},e),delete e.lat,delete e.lng;for(var o=new google.maps.Circle(e),n=["click","dblclick","mousedown","mousemove","mouseout","mouseover","mouseup","rightclick"],r=0;n.length>r;r++)(function(t,o){e[o]&&google.maps.event.addListener(t,o,function(t){e[o].apply(this,[t])})})(o,n[r]);return this.polygons.push(o),o},l.prototype.drawRectangle=function(e){e=t({map:this.map},e);var o=new google.maps.LatLngBounds(new google.maps.LatLng(e.bounds[0][0],e.bounds[0][1]),new google.maps.LatLng(e.bounds[1][0],e.bounds[1][1]));e.bounds=o;for(var n=new google.maps.Rectangle(e),r=["click","dblclick","mousedown","mousemove","mouseout","mouseover","mouseup","rightclick"],a=0;r.length>a;a++)(function(t,o){e[o]&&google.maps.event.addListener(t,o,function(t){e[o].apply(this,[t])})})(n,r[a]);return this.polygons.push(n),n},l.prototype.drawPolygon=function(e){var r=!1;e.hasOwnProperty("useGeoJSON")&&(r=e.useGeoJSON),delete e.useGeoJSON,e=t({map:this.map},e),0==r&&(e.paths=[e.paths.slice(0)]),e.paths.length>0&&e.paths[0].length>0&&(e.paths=n(o(e.paths,a,r)));for(var s=new google.maps.Polygon(e),i=["click","dblclick","mousedown","mousemove","mouseout","mouseover","mouseup","rightclick"],p=0;i.length>p;p++)(function(t,o){e[o]&&google.maps.event.addListener(t,o,function(t){e[o].apply(this,[t])})})(s,i[p]);return this.polygons.push(s),l.fire("polygon_added",s,this),s},l.prototype.removePolygon=function(e){for(var t=0;this.polygons.length>t;t++)if(this.polygons[t]===e){this.polygons[t].setMap(null),this.polygons.splice(t,1),l.fire("polygon_removed",e,this);break}},l.prototype.removePolygons=function(){for(var e,t=0;e=this.polygons[t];t++)e.setMap(null);this.polygons=[]},l.prototype.getFromFusionTables=function(e){var t=e.events;delete e.events;var o=e,n=new google.maps.FusionTablesLayer(o);for(var r in t)(function(e,o){google.maps.event.addListener(e,o,function(e){t[o].apply(this,[e])})})(n,r);return this.layers.push(n),n},l.prototype.loadFromFusionTables=function(e){var t=this.getFromFusionTables(e);return t.setMap(this.map),t},l.prototype.getFromKML=function(e){var t=e.url,o=e.events;delete e.url,delete e.events;var n=e,r=new google.maps.KmlLayer(t,n);for(var a in o)(function(e,t){google.maps.event.addListener(e,t,function(e){o[t].apply(this,[e])})})(r,a);return this.layers.push(r),r},l.prototype.loadFromKML=function(e){var t=this.getFromKML(e);return t.setMap(this.map),t},l.prototype.addLayer=function(e,t){t=t||{};var o;switch(e){case"weather":this.singleLayers.weather=o=new google.maps.weather.WeatherLayer;break;case"clouds":this.singleLayers.clouds=o=new google.maps.weather.CloudLayer;break;case"traffic":this.singleLayers.traffic=o=new google.maps.TrafficLayer;break;case"transit":this.singleLayers.transit=o=new google.maps.TransitLayer;break;case"bicycling":this.singleLayers.bicycling=o=new google.maps.BicyclingLayer;break;case"panoramio":this.singleLayers.panoramio=o=new google.maps.panoramio.PanoramioLayer,o.setTag(t.filter),delete t.filter,t.click&&google.maps.event.addListener(o,"click",function(e){t.click(e),delete t.click});break;case"places":if(this.singleLayers.places=o=new google.maps.places.PlacesService(this.map),t.search||t.nearbySearch||t.radarSearch){var n={bounds:t.bounds||null,keyword:t.keyword||null,location:t.location||null,name:t.name||null,radius:t.radius||null,rankBy:t.rankBy||null,types:t.types||null};t.radarSearch&&o.radarSearch(n,t.radarSearch),t.search&&o.search(n,t.search),t.nearbySearch&&o.nearbySearch(n,t.nearbySearch)}if(t.textSearch){var r={bounds:t.bounds||null,location:t.location||null,query:t.query||null,radius:t.radius||null};o.textSearch(r,t.textSearch)}}return void 0!==o?("function"==typeof o.setOptions&&o.setOptions(t),"function"==typeof o.setMap&&o.setMap(this.map),o):void 0},l.prototype.removeLayer=function(e){if("string"==typeof e&&void 0!==this.singleLayers[e])this.singleLayers[e].setMap(null),delete this.singleLayers[e];else for(var t=0;this.layers.length>t;t++)if(this.layers[t]===e){this.layers[t].setMap(null),this.layers.splice(t,1);break}};var p,c;return l.prototype.getRoutes=function(e){switch(e.travelMode){case"bicycling":p=google.maps.TravelMode.BICYCLING;break;case"transit":p=google.maps.TravelMode.TRANSIT;break;case"driving":p=google.maps.TravelMode.DRIVING;break;default:p=google.maps.TravelMode.WALKING}c="imperial"===e.unitSystem?google.maps.UnitSystem.IMPERIAL:google.maps.UnitSystem.METRIC;var o={avoidHighways:!1,avoidTolls:!1,optimizeWaypoints:!1,waypoints:[]},n=t(o,e);n.origin=/string/.test(typeof e.origin)?e.origin:new google.maps.LatLng(e.origin[0],e.origin[1]),n.destination=/string/.test(typeof e.destination)?e.destination:new google.maps.LatLng(e.destination[0],e.destination[1]),n.travelMode=p,n.unitSystem=c,delete n.callback,delete n.error;var r=this,a=new google.maps.DirectionsService;a.route(n,function(t,o){if(o===google.maps.DirectionsStatus.OK){for(var n in t.routes)t.routes.hasOwnProperty(n)&&r.routes.push(t.routes[n]);e.callback&&e.callback(r.routes)}else e.error&&e.error(t,o)})},l.prototype.removeRoutes=function(){this.routes=[]},l.prototype.getElevations=function(e){e=t({locations:[],path:!1,samples:256},e),e.locations.length>0&&e.locations[0].length>0&&(e.locations=n(o([e.locations],a,!1)));var r=e.callback;delete e.callback;var s=new google.maps.ElevationService;if(e.path){var i={path:e.locations,samples:e.samples};s.getElevationAlongPath(i,function(e,t){r&&"function"==typeof r&&r(e,t)})}else delete e.path,delete e.samples,s.getElevationForLocations(e,function(e,t){r&&"function"==typeof r&&r(e,t)})},l.prototype.cleanRoute=l.prototype.removePolylines,l.prototype.drawRoute=function(e){var t=this;this.getRoutes({origin:e.origin,destination:e.destination,travelMode:e.travelMode,waypoints:e.waypoints,unitSystem:e.unitSystem,error:e.error,callback:function(o){if(o.length>0){var n={path:o[o.length-1].overview_path,strokeColor:e.strokeColor,strokeOpacity:e.strokeOpacity,strokeWeight:e.strokeWeight};e.hasOwnProperty("icons")&&(n.icons=e.icons),t.drawPolyline(n),e.callback&&e.callback(o[o.length-1])}}})},l.prototype.travelRoute=function(e){if(e.origin&&e.destination)this.getRoutes({origin:e.origin,destination:e.destination,travelMode:e.travelMode,waypoints:e.waypoints,unitSystem:e.unitSystem,error:e.error,callback:function(t){if(t.length>0&&e.start&&e.start(t[t.length-1]),t.length>0&&e.step){var o=t[t.length-1];if(o.legs.length>0)for(var n,r=o.legs[0].steps,a=0;n=r[a];a++)n.step_number=a,e.step(n,o.legs[0].steps.length-1)}t.length>0&&e.end&&e.end(t[t.length-1])}});else if(e.route&&e.route.legs.length>0)for(var t,o=e.route.legs[0].steps,n=0;t=o[n];n++)t.step_number=n,e.step(t)},l.prototype.drawSteppedRoute=function(e){var t=this;if(e.origin&&e.destination)this.getRoutes({origin:e.origin,destination:e.destination,travelMode:e.travelMode,waypoints:e.waypoints,error:e.error,callback:function(o){if(o.length>0&&e.start&&e.start(o[o.length-1]),o.length>0&&e.step){var n=o[o.length-1];if(n.legs.length>0)for(var r,a=n.legs[0].steps,s=0;r=a[s];s++){r.step_number=s;var i={path:r.path,strokeColor:e.strokeColor,strokeOpacity:e.strokeOpacity,strokeWeight:e.strokeWeight};e.hasOwnProperty("icons")&&(i.icons=e.icons),t.drawPolyline(i),e.step(r,n.legs[0].steps.length-1)}}o.length>0&&e.end&&e.end(o[o.length-1])}});else if(e.route&&e.route.legs.length>0)for(var o,n=e.route.legs[0].steps,r=0;o=n[r];r++){o.step_number=r;var a={path:o.path,strokeColor:e.strokeColor,strokeOpacity:e.strokeOpacity,strokeWeight:e.strokeWeight};e.hasOwnProperty("icons")&&(a.icons=e.icons),t.drawPolyline(a),e.step(o)}},l.Route=function(e){this.origin=e.origin,this.destination=e.destination,this.waypoints=e.waypoints,this.map=e.map,this.route=e.route,this.step_count=0,this.steps=this.route.legs[0].steps,this.steps_length=this.steps.length;var t={path:new google.maps.MVCArray,strokeColor:e.strokeColor,strokeOpacity:e.strokeOpacity,strokeWeight:e.strokeWeight};e.hasOwnProperty("icons")&&(t.icons=e.icons),this.polyline=this.map.drawPolyline(t).getPath()},l.Route.prototype.getRoute=function(t){var o=this;this.map.getRoutes({origin:this.origin,destination:this.destination,travelMode:t.travelMode,waypoints:this.waypoints||[],error:t.error,callback:function(){o.route=e[0],t.callback&&t.callback.call(o)}})},l.Route.prototype.back=function(){if(this.step_count>0){this.step_count--;var e=this.route.legs[0].steps[this.step_count].path;for(var t in e)e.hasOwnProperty(t)&&this.polyline.pop()}},l.Route.prototype.forward=function(){if(this.step_count<this.steps_length){var e=this.route.legs[0].steps[this.step_count].path;for(var t in e)e.hasOwnProperty(t)&&this.polyline.push(e[t]);this.step_count++}},l.prototype.checkGeofence=function(e,t,o){return o.containsLatLng(new google.maps.LatLng(e,t))},l.prototype.checkMarkerGeofence=function(e,t){if(e.fences)for(var o,n=0;o=e.fences[n];n++){var r=e.getPosition();this.checkGeofence(r.lat(),r.lng(),o)||t(e,o)}},l.prototype.toImage=function(e){var e=e||{},t={};if(t.size=e.size||[this.el.clientWidth,this.el.clientHeight],t.lat=this.getCenter().lat(),t.lng=this.getCenter().lng(),this.markers.length>0){t.markers=[];for(var o=0;this.markers.length>o;o++)t.markers.push({lat:this.markers[o].getPosition().lat(),lng:this.markers[o].getPosition().lng()})}if(this.polylines.length>0){var n=this.polylines[0];t.polyline={},t.polyline.path=google.maps.geometry.encoding.encodePath(n.getPath()),t.polyline.strokeColor=n.strokeColor,t.polyline.strokeOpacity=n.strokeOpacity,t.polyline.strokeWeight=n.strokeWeight}return l.staticMapURL(t)},l.staticMapURL=function(e){function t(e,t){if("#"===e[0]&&(e=e.replace("#","0x"),t)){if(t=parseFloat(t),t=Math.min(1,Math.max(t,0)),0===t)return"0x00000000";t=(255*t).toString(16),1===t.length&&(t+=t),e=e.slice(0,8)+t}return e}var o,n=[],r=("file:"===location.protocol?"http:":location.protocol)+"//maps.googleapis.com/maps/api/staticmap";e.url&&(r=e.url,delete e.url),r+="?";var a=e.markers;delete e.markers,!a&&e.marker&&(a=[e.marker],delete e.marker);var s=e.styles;delete e.styles;var i=e.polyline;if(delete e.polyline,e.center)n.push("center="+e.center),delete e.center;else if(e.address)n.push("center="+e.address),delete e.address;else if(e.lat)n.push(["center=",e.lat,",",e.lng].join("")),delete e.lat,delete e.lng;else if(e.visible){var l=encodeURI(e.visible.join("|"));n.push("visible="+l)}var p=e.size;p?(p.join&&(p=p.join("x")),delete e.size):p="630x300",n.push("size="+p),e.zoom||e.zoom===!1||(e.zoom=15);var c=e.hasOwnProperty("sensor")?!!e.sensor:!0;delete e.sensor,n.push("sensor="+c);for(var g in e)e.hasOwnProperty(g)&&n.push(g+"="+e[g]);if(a)for(var h,d,u=0;o=a[u];u++){h=[],o.size&&"normal"!==o.size?(h.push("size:"+o.size),delete o.size):o.icon&&(h.push("icon:"+encodeURI(o.icon)),delete o.icon),o.color&&(h.push("color:"+o.color.replace("#","0x")),delete o.color),o.label&&(h.push("label:"+o.label[0].toUpperCase()),delete o.label),d=o.address?o.address:o.lat+","+o.lng,delete o.address,delete o.lat,delete o.lng;for(var g in o)o.hasOwnProperty(g)&&h.push(g+":"+o[g]);h.length||0===u?(h.push(d),h=h.join("|"),n.push("markers="+encodeURI(h))):(h=n.pop()+encodeURI("|"+d),n.push(h))}if(s)for(var u=0;s.length>u;u++){var m=[];s[u].featureType&&m.push("feature:"+s[u].featureType.toLowerCase()),s[u].elementType&&m.push("element:"+s[u].elementType.toLowerCase());for(var f=0;s[u].stylers.length>f;f++)for(var y in s[u].stylers[f]){var v=s[u].stylers[f][y];("hue"==y||"color"==y)&&(v="0x"+v.substring(1)),m.push(y+":"+v)}var k=m.join("|");""!=k&&n.push("style="+k)}if(i){if(o=i,i=[],o.strokeWeight&&i.push("weight:"+parseInt(o.strokeWeight,10)),o.strokeColor){var w=t(o.strokeColor,o.strokeOpacity);i.push("color:"+w)}if(o.fillColor){var L=t(o.fillColor,o.fillOpacity);i.push("fillcolor:"+L)}var b=o.path;if(b.join)for(var _,f=0;_=b[f];f++)i.push(_.join(","));else i.push("enc:"+b);i=i.join("|"),n.push("path="+encodeURI(i))}var M=window.devicePixelRatio||1;return n.push("scale="+M),n=n.join("&"),r+n},l.prototype.addMapType=function(e,t){if(!t.hasOwnProperty("getTileUrl")||"function"!=typeof t.getTileUrl)throw"'getTileUrl' function required.";t.tileSize=t.tileSize||new google.maps.Size(256,256);var o=new google.maps.ImageMapType(t);this.map.mapTypes.set(e,o)},l.prototype.addOverlayMapType=function(e){if(!e.hasOwnProperty("getTile")||"function"!=typeof e.getTile)throw"'getTile' function required.";var t=e.index;delete e.index,this.map.overlayMapTypes.insertAt(t,e)},l.prototype.removeOverlayMapType=function(e){this.map.overlayMapTypes.removeAt(e)},l.prototype.addStyle=function(e){var t=new google.maps.StyledMapType(e.styles,{name:e.styledMapName});this.map.mapTypes.set(e.mapTypeId,t)},l.prototype.setStyle=function(e){this.map.setMapTypeId(e)},l.prototype.createPanorama=function(e){return e.hasOwnProperty("lat")&&e.hasOwnProperty("lng")||(e.lat=this.getCenter().lat(),e.lng=this.getCenter().lng()),this.panorama=l.createPanorama(e),this.map.setStreetView(this.panorama),this.panorama},l.createPanorama=function(e){var o=s(e.el,e.context);e.position=new google.maps.LatLng(e.lat,e.lng),delete e.el,delete e.context,delete e.lat,delete e.lng;for(var n=["closeclick","links_changed","pano_changed","position_changed","pov_changed","resize","visible_changed"],r=t({visible:!0},e),a=0;n.length>a;a++)delete r[n[a]];for(var i=new google.maps.StreetViewPanorama(o,r),a=0;n.length>a;a++)(function(t,o){e[o]&&google.maps.event.addListener(t,o,function(){e[o].apply(this)})})(i,n[a]);return i},l.prototype.on=function(e,t){return l.on(e,this,t)},l.prototype.off=function(e){l.off(e,this)},l.custom_events=["marker_added","marker_removed","polyline_added","polyline_removed","polygon_added","polygon_removed","geolocated","geolocation_failed"],l.on=function(e,t,o){if(-1==l.custom_events.indexOf(e))return t instanceof l&&(t=t.map),google.maps.event.addListener(t,e,o);var n={handler:o,eventName:e};return t.registered_events[e]=t.registered_events[e]||[],t.registered_events[e].push(n),n},l.off=function(e,t){-1==l.custom_events.indexOf(e)?(t instanceof l&&(t=t.map),google.maps.event.clearListeners(t,e)):t.registered_events[e]=[]},l.fire=function(e,t,o){if(-1==l.custom_events.indexOf(e))google.maps.event.trigger(t,e,Array.prototype.slice.apply(arguments).slice(2));else if(e in o.registered_events)for(var n=o.registered_events[e],r=0;n.length>r;r++)(function(e,t,o){e.apply(t,[o])})(n[r].handler,o,t)},l.geolocate=function(e){var t=e.always||e.complete;navigator.geolocation?navigator.geolocation.getCurrentPosition(function(o){e.success(o),t&&t()},function(o){e.error(o),t&&t()},e.options):(e.not_supported(),t&&t())},l.geocode=function(e){this.geocoder=new google.maps.Geocoder;var t=e.callback;e.hasOwnProperty("lat")&&e.hasOwnProperty("lng")&&(e.latLng=new google.maps.LatLng(e.lat,e.lng)),delete e.lat,delete e.lng,delete e.callback,this.geocoder.geocode(e,function(e,o){t(e,o)})},google.maps.Polygon.prototype.getBounds||(google.maps.Polygon.prototype.getBounds=function(){for(var e,t=new google.maps.LatLngBounds,o=this.getPaths(),n=0;o.getLength()>n;n++){e=o.getAt(n);for(var r=0;e.getLength()>r;r++)t.extend(e.getAt(r))}return t}),google.maps.Polygon.prototype.containsLatLng||(google.maps.Polygon.prototype.containsLatLng=function(e){var t=this.getBounds();if(null!==t&&!t.contains(e))return!1;for(var o=!1,n=this.getPaths().getLength(),r=0;n>r;r++)for(var a=this.getPaths().getAt(r),s=a.getLength(),i=s-1,l=0;s>l;l++){var p=a.getAt(l),c=a.getAt(i);(p.lng()<e.lng()&&c.lng()>=e.lng()||c.lng()<e.lng()&&p.lng()>=e.lng())&&p.lat()+(e.lng()-p.lng())/(c.lng()-p.lng())*(c.lat()-p.lat())<e.lat()&&(o=!o),i=l}return o}),google.maps.Circle.prototype.containsLatLng||(google.maps.Circle.prototype.containsLatLng=function(e){return google.maps.geometry?google.maps.geometry.spherical.computeDistanceBetween(this.getCenter(),e)<=this.getRadius():!0}),google.maps.LatLngBounds.prototype.containsLatLng=function(e){return this.contains(e)},google.maps.Marker.prototype.setFences=function(e){this.fences=e},google.maps.Marker.prototype.addFence=function(e){this.fences.push(e)},google.maps.Marker.prototype.getId=function(){return this.__gm_id},Array.prototype.indexOf||(Array.prototype.indexOf=function(e){"use strict";if(null==this)throw new TypeError;var t=Object(this),o=t.length>>>0;if(0===o)return-1;var n=0;if(arguments.length>1&&(n=Number(arguments[1]),n!=n?n=0:0!=n&&1/0!=n&&n!=-1/0&&(n=(n>0||-1)*Math.floor(Math.abs(n)))),n>=o)return-1;for(var r=n>=0?n:Math.max(o-Math.abs(n),0);o>r;r++)if(r in t&&t[r]===e)return r;return-1}),l}),function(e){var t=function(e,t,o,n){this.base_url="https://maps.google.com/maps?",this.display(e,t,o,n)};t.prototype.display=function(t,o,n,r){e(t).show();var a=e(t).data("breakpoint");if(a>640&&(a=640),e("html").width()>a){var s=new GMaps({div:t,lat:o.lat(),lng:o.lng(),mapTypeControl:!1,zoom:parseFloat(n),streetViewControl:!1,scrollwheel:!1,mapTypeId:google.maps.MapTypeId.ROADMAP});if(r.length){var i=s.addMarker({lat:o.lat(),lng:o.lng(),infoWindow:{content:r}});"open"==e(t).data("infowindow")&&i.infoWindow.open(i.map,i)}else s.addMarker({lat:o.lat(),lng:o.lng()})}else{var l=GMaps.staticMapURL({center:o.lat()+","+o.lng(),zoom:n,size:a+"x"+e(t).height(),markers:[{lat:o.lat(),lng:o.lng()}],sensor:"false"}),p=e("<img />");e(p).attr("src",l),e(p).attr("alt",e(t).text());var c=e("<a />");e(c).attr("href",this.base_url+"q="+o.lat()+","+o.lng()+"&z="+n),e(c).html(p),e(t).html(c),e(t).addClass("staticmap")}},e(".simplemap").each(function(){var o=e("div",this).get(0),n=16;if(parseFloat(e(o).data("zoom"))&&(n=e(o).data("zoom")),e(o).data("lat")&&e(o).data("lng")){var r=e(o).data("lat"),a=e(o).data("lng"),s=e(o).html(),i=new google.maps.LatLng(r,a);new t(o,i,n,s)}else e(o).data("addr")?GMaps.geocode({address:e(o).data("addr"),callback:function(r,a){if("OK"==a){var s=r[0].geometry.location;new t(o,s,n,e(o).html())}}}):e(o).text().length&&GMaps.geocode({address:e(o).text(),callback:function(r,a){if("OK"==a){var s=r[0].geometry.location;new t(o,s,n,e(o).text())}}})})}(jQuery);
|
package.json
ADDED
@@ -0,0 +1,24 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"name": "simple-map",
|
3 |
+
"title": "Simple Map",
|
4 |
+
"license" : "GPLv2",
|
5 |
+
"description": "Easy way to embed google map(s) using gmaps.js.",
|
6 |
+
"version": "2.4.0",
|
7 |
+
"homepage": "http://wordpress.org/plugins/simple-map/",
|
8 |
+
"repository" : {
|
9 |
+
"type" : "git",
|
10 |
+
"url" : "https://github.com/miya0001/simple-map"
|
11 |
+
},
|
12 |
+
"author": {
|
13 |
+
"name": "Takayuki Miyauchi",
|
14 |
+
"url": "http://wpist.me/"
|
15 |
+
},
|
16 |
+
"dependencies": {
|
17 |
+
"gmaps": "git+ssh://git@github.com:HPNeo/gmaps.git#0.4.17"
|
18 |
+
},
|
19 |
+
"devDependencies": {
|
20 |
+
"grunt": "~0.4.1",
|
21 |
+
"grunt-contrib-uglify": "~0.1.1"
|
22 |
+
},
|
23 |
+
"keywords": []
|
24 |
+
}
|
readme.txt
ADDED
@@ -0,0 +1,197 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
=== Simple Map ===
|
2 |
+
Contributors: miyauchi
|
3 |
+
Donate link: http://wpist.me/
|
4 |
+
Tags: google maps, map, shortcode, address
|
5 |
+
Requires at least: 3.6
|
6 |
+
Tested up to: 4.2
|
7 |
+
Stable tag: 2.4.1
|
8 |
+
|
9 |
+
Easy way to embed google map(s).
|
10 |
+
|
11 |
+
== Description ==
|
12 |
+
|
13 |
+
Easy way to embed google map(s) using [gmaps.js](http://hpneo.github.com/gmaps/).
|
14 |
+
|
15 |
+
This plugin allows you to convert address into google maps like below:
|
16 |
+
|
17 |
+
`[map]San Francisco, California[/map]`
|
18 |
+
|
19 |
+
Another way, you can embed Google Map with url only like oEmbed.
|
20 |
+
|
21 |
+
|
22 |
+
You can also use coordinates, set width, height and zoom:
|
23 |
+
|
24 |
+
`[map lat="37.77493" lng="-122.41942"]
|
25 |
+
Text you would
|
26 |
+
like to appear
|
27 |
+
as a tooltip
|
28 |
+
goes here
|
29 |
+
[/map]`
|
30 |
+
|
31 |
+
In this case there will be a marker on the map with a tooltip appearing on click on the said marker.
|
32 |
+
You can use simple html as the tooltip content.
|
33 |
+
|
34 |
+
|
35 |
+
[This plugin is maintained on GitHub.](https://github.com/miya0001/simple-map)
|
36 |
+
|
37 |
+
= Some features: =
|
38 |
+
|
39 |
+
* Allows you to embed google map based on shortcode.
|
40 |
+
* Markers can be added using address or lat/long.
|
41 |
+
* Displays static map for iPhone automatically.
|
42 |
+
* oEmbed Support.
|
43 |
+
|
44 |
+
= Arguments =
|
45 |
+
|
46 |
+
* width: Width of the map. Default value is "100%".
|
47 |
+
* height: Height of the map. Default value is "200px".
|
48 |
+
* zoom: Zoom of the map. Default value is "16".
|
49 |
+
* breakpoint: If display is narrower than this value, this plugin will display static map. Default value is "480".
|
50 |
+
* addr: Address of the map you want to place.
|
51 |
+
* lat: Lat of the map you want to place.
|
52 |
+
* lng: Lng of the map you want to place.
|
53 |
+
* infowindow: If you want to open infoWindow by Default, please set "open".
|
54 |
+
|
55 |
+
If you will set lat/lng and address, this plugin gives priority to lat/lng.
|
56 |
+
|
57 |
+
= Filter Hooks =
|
58 |
+
|
59 |
+
This plugin has some filter hooks for customize default.
|
60 |
+
|
61 |
+
* simplemap_default_width
|
62 |
+
* simplemap_default_height
|
63 |
+
* simplemap_default_zoom
|
64 |
+
* simplemap_default_breakpoint
|
65 |
+
* simplemap_default_infowindow
|
66 |
+
|
67 |
+
`add_filter( 'simplemap_default_zoom', function(){
|
68 |
+
return 10; // Default zoom is 10
|
69 |
+
} );`
|
70 |
+
|
71 |
+
= Translators =
|
72 |
+
|
73 |
+
* Japanese(ja) - [Takayuki Miyauchi](http://firegoby.jp/)
|
74 |
+
|
75 |
+
Please contact me.
|
76 |
+
|
77 |
+
* https://github.com/miya0001/simple-map/issues
|
78 |
+
|
79 |
+
= Contributors =
|
80 |
+
|
81 |
+
* [Takayuki Miyauchi](http://firegoby.jp/)
|
82 |
+
* [Zoltán Balogh](http://birdcreation.com/)
|
83 |
+
* [Takanobu Watanabe](https://github.com/tknv)
|
84 |
+
* [Shinichi Nishikawa](http://th-daily.shinichi.me/)
|
85 |
+
|
86 |
+
== Installation ==
|
87 |
+
|
88 |
+
* Download the zip, extract it and upload the extracted folder to your-wp-directory/wp-content/plugins/
|
89 |
+
* Go to the plugins administration screen in your WordPress admin and activate the plugin.
|
90 |
+
|
91 |
+
OR
|
92 |
+
|
93 |
+
* Download the zip, go to the plugins administration screen in your WordPress admin, click on Add New then on upload, browse to the downloaded zip, upload the plugin and activate it.
|
94 |
+
|
95 |
+
OR
|
96 |
+
|
97 |
+
* Go to the plugins administration screen in your WordPress admin, click on Add New, search for Simple Map and click on Install Now.
|
98 |
+
|
99 |
+
*Usage*
|
100 |
+
|
101 |
+
This plugin allows you to convert address into google maps like below:
|
102 |
+
|
103 |
+
`[map]San Francisco, California[/map]`
|
104 |
+
|
105 |
+
Another way, you can embed Google Map with url only like oEmbed.
|
106 |
+
|
107 |
+
You can also use coordinates, set width, height and zoom:
|
108 |
+
|
109 |
+
`[map lat="37.77493" lng="-122.41942" width="100%" height="400px" zoom="15"]
|
110 |
+
Text you would
|
111 |
+
like to appear
|
112 |
+
as a tooltip
|
113 |
+
goes here
|
114 |
+
[/map]`
|
115 |
+
|
116 |
+
In this case there will be a marker on the map with a tooltip appearing on click on the said marker.
|
117 |
+
You can use simple html as the tooltip content.
|
118 |
+
|
119 |
+
== Screenshots ==
|
120 |
+
|
121 |
+
1. Very easy.
|
122 |
+
2. Info Window.
|
123 |
+
3. Mobile Support. (Google static map)
|
124 |
+
|
125 |
+
== Changelog ==
|
126 |
+
|
127 |
+
= 2.4.0 =
|
128 |
+
* Update gmaps.js 0.4.16 to 0.4.17
|
129 |
+
|
130 |
+
= 2.3.0 =
|
131 |
+
* Tested on the WordPress 4.1.
|
132 |
+
* Up to minimum required to WordPress 3.6.
|
133 |
+
|
134 |
+
= 2.2.0 =
|
135 |
+
* update gmaps.js 0.4.15 to 0.4.16
|
136 |
+
|
137 |
+
= 2.1.0 =
|
138 |
+
* update gmaps.js 0.4.14 to 0.4.15
|
139 |
+
|
140 |
+
= 2.0.0 =
|
141 |
+
* Add argument infowindow
|
142 |
+
* little fix
|
143 |
+
|
144 |
+
= 1.9.0 =
|
145 |
+
* update gmaps.js 0.4.13 to 0.4.14
|
146 |
+
|
147 |
+
= 1.8.0 =
|
148 |
+
* update gmaps.js 0.4.12 to 0.4.13
|
149 |
+
|
150 |
+
= 1.7.0 =
|
151 |
+
* update gmaps.js 0.4.11 to 0.4.12
|
152 |
+
|
153 |
+
= 1.6.0 =
|
154 |
+
* update gmaps.js 0.4.9 to 0.4.11
|
155 |
+
|
156 |
+
= 1.5.0 =
|
157 |
+
* enable ssl source of google map api js
|
158 |
+
|
159 |
+
= 1.4.0 =
|
160 |
+
* change URL match pattern.
|
161 |
+
|
162 |
+
= 1.3.0 =
|
163 |
+
* Update gmaps.js to 0.4.9.
|
164 |
+
|
165 |
+
= 1.2.0 =
|
166 |
+
* Tested on the WordPress 3.8.
|
167 |
+
* Add Grunt.
|
168 |
+
|
169 |
+
= 1.1.0 =
|
170 |
+
* Added support for gmaps.js tooltip on markers
|
171 |
+
|
172 |
+
= 1.0.0 =
|
173 |
+
* Delete hl=ja param from static map link uri.
|
174 |
+
|
175 |
+
= 0.9.0 =
|
176 |
+
* hook changed to the init.
|
177 |
+
|
178 |
+
= 0.8.0 =
|
179 |
+
* shortcode atts and address priority changed.
|
180 |
+
|
181 |
+
= 0.7.0 =
|
182 |
+
* gmaps.js updated 0.4.4 to 0.4.5
|
183 |
+
|
184 |
+
= 0.6.0 =
|
185 |
+
* oEmbed Support
|
186 |
+
|
187 |
+
= 0.1.0 =
|
188 |
+
* The first release.
|
189 |
+
|
190 |
+
== Credits ==
|
191 |
+
|
192 |
+
This plugin is not guaranteed though the user of WordPress can freely use this plugin free of charge regardless of the purpose.
|
193 |
+
The author must acknowledge the thing that the operation guarantee and the support in this plugin use are not done at all beforehand.
|
194 |
+
|
195 |
+
== Contact ==
|
196 |
+
|
197 |
+
twitter @miya0001
|
simple-map.php
ADDED
@@ -0,0 +1,168 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/*
|
3 |
+
Plugin Name: Simple Map
|
4 |
+
Author: Takayuki Miyauchi
|
5 |
+
Plugin URI: https://github.com/miya0001/simple-map
|
6 |
+
Description: Insert google map convert from address.
|
7 |
+
Version: 2.4.1
|
8 |
+
Author URI: http://wpist.me/
|
9 |
+
Domain Path: /languages
|
10 |
+
Text Domain: simplemap
|
11 |
+
*/
|
12 |
+
|
13 |
+
$simplemap = new Simple_Map();
|
14 |
+
|
15 |
+
class Simple_Map {
|
16 |
+
|
17 |
+
private $shortcode_tag = 'map';
|
18 |
+
private $class_name = 'simplemap';
|
19 |
+
private $width = '100%';
|
20 |
+
private $height = '200px';
|
21 |
+
private $zoom = 16;
|
22 |
+
private $breakpoint = 480;
|
23 |
+
private $max_breakpoint = 640;
|
24 |
+
|
25 |
+
function __construct()
|
26 |
+
{
|
27 |
+
add_action( 'init', array( $this, 'init' ) );
|
28 |
+
}
|
29 |
+
|
30 |
+
public function init()
|
31 |
+
{
|
32 |
+
add_action( 'wp_head', array( $this, 'wp_head' ) );
|
33 |
+
add_shortcode( $this->get_shortcode_tag(), array( $this, 'shortcode' ) );
|
34 |
+
|
35 |
+
wp_embed_register_handler(
|
36 |
+
'google-map',
|
37 |
+
'#( https://( www|maps ).google.[a-z]{2,3}\.?[a-z]{0,3}/maps( /ms )?\?.+ )#i',
|
38 |
+
array( &$this, 'oembed_handler' )
|
39 |
+
);
|
40 |
+
}
|
41 |
+
|
42 |
+
public function oembed_handler( $match )
|
43 |
+
{
|
44 |
+
return sprintf(
|
45 |
+
'[%s url="%s"]',
|
46 |
+
$this->get_shortcode_tag(),
|
47 |
+
esc_url( $match[0] )
|
48 |
+
);
|
49 |
+
}
|
50 |
+
|
51 |
+
public function wp_head()
|
52 |
+
{
|
53 |
+
echo "<style>.simplemap img{max-width:none !important;padding:0 !important;margin:0 !important;}.staticmap,.staticmap img{max-width:100% !important;height:auto !important;}.simplemap .simplemap-content{display:none;}</style>\n";
|
54 |
+
}
|
55 |
+
|
56 |
+
public function wp_enqueue_scripts()
|
57 |
+
{
|
58 |
+
wp_register_script(
|
59 |
+
'google-maps-api',
|
60 |
+
'//maps.google.com/maps/api/js?sensor=false',
|
61 |
+
false,
|
62 |
+
null,
|
63 |
+
true
|
64 |
+
);
|
65 |
+
|
66 |
+
wp_register_script(
|
67 |
+
'simplemap',
|
68 |
+
apply_filters(
|
69 |
+
'simplemap_script',
|
70 |
+
plugins_url( 'js/simple-map.min.js' , __FILE__ )
|
71 |
+
),
|
72 |
+
array( 'jquery', 'google-maps-api' ),
|
73 |
+
filemtime( dirname( __FILE__ ).'/js/simple-map.min.js' ),
|
74 |
+
true
|
75 |
+
);
|
76 |
+
wp_enqueue_script( 'simplemap' );
|
77 |
+
}
|
78 |
+
|
79 |
+
public function shortcode( $p, $content = null )
|
80 |
+
{
|
81 |
+
add_action( 'wp_footer', array( &$this, 'wp_enqueue_scripts' ) );
|
82 |
+
|
83 |
+
if ( isset( $p['width'] ) && preg_match( '/^[0-9]+(%|px)$/', $p['width'] ) ) {
|
84 |
+
$w = $p['width'];
|
85 |
+
} else {
|
86 |
+
$w = apply_filters( 'simplemap_default_width', $this->width );
|
87 |
+
}
|
88 |
+
if ( isset( $p['height'] ) && preg_match( '/^[0-9]+(%|px)$/', $p['height'] ) ) {
|
89 |
+
$h = $p['height'];
|
90 |
+
} else {
|
91 |
+
$h = apply_filters( 'simplemap_default_height', $this->height );
|
92 |
+
}
|
93 |
+
if ( isset( $p['zoom'] ) && intval( $p['zoom'] ) ) {
|
94 |
+
$zoom = $p['zoom'];
|
95 |
+
} else {
|
96 |
+
$zoom = apply_filters( 'simplemap_default_zoom', $this->zoom );
|
97 |
+
}
|
98 |
+
if ( isset( $p['breakpoint'] ) && intval( $p['breakpoint'] ) ) {
|
99 |
+
if ( intval( $p['breakpoint'] ) > $this->max_breakpoint ) {
|
100 |
+
$breakpoint = $this->max_breakpoint;
|
101 |
+
} else {
|
102 |
+
$breakpoint = intval( $p['breakpoint'] );
|
103 |
+
}
|
104 |
+
} else {
|
105 |
+
$breakpoint = apply_filters(
|
106 |
+
'simplemap_default_breakpoint',
|
107 |
+
$this->breakpoint
|
108 |
+
);
|
109 |
+
}
|
110 |
+
if ( $content ) {
|
111 |
+
$content = do_shortcode( $content );
|
112 |
+
}
|
113 |
+
if ( isset( $p['infowindow'] ) && $p['infowindow'] ) {
|
114 |
+
$infowindow = $p['infowindow'];
|
115 |
+
} else {
|
116 |
+
$infowindow = apply_filters( 'simplemap_default_infowindow', 'close' );
|
117 |
+
}
|
118 |
+
|
119 |
+
$addr = '';
|
120 |
+
$lat = '';
|
121 |
+
$lng = '';
|
122 |
+
|
123 |
+
if ( isset( $p['url'] ) && $p['url'] ) {
|
124 |
+
$iframe = '<iframe width="%s" height="%s" frameborder="0" scrolling="no" marginheight="0" marginwidth="0" src="%s"></iframe>';
|
125 |
+
|
126 |
+
return sprintf(
|
127 |
+
$iframe,
|
128 |
+
$w,
|
129 |
+
$h,
|
130 |
+
esc_url( $p['url'].'&output=embed' )
|
131 |
+
);
|
132 |
+
} elseif ( isset( $p['lat'] ) && preg_match( '/^\-?[0-9\.]+$/', $p['lat'] )
|
133 |
+
&& isset( $p['lng'] ) && preg_match( '/^\-?[0-9\.]+$/', $p['lng'] ) ){
|
134 |
+
$lat = $p['lat'];
|
135 |
+
$lng = $p['lng'];
|
136 |
+
} elseif ( isset( $p['addr'] ) && $p['addr'] ) {
|
137 |
+
if ( $content ) {
|
138 |
+
$addr = esc_html( $p['addr'] );
|
139 |
+
} else {
|
140 |
+
$content = esc_html( $p['addr'] );
|
141 |
+
}
|
142 |
+
} elseif ( ! $content ) {
|
143 |
+
return;
|
144 |
+
}
|
145 |
+
return sprintf(
|
146 |
+
'<div class="%1$s"><div class="%1$s-content" data-breakpoint="%2$s" data-lat="%3$s" data-lng="%4$s" data-zoom="%5$s" data-addr="%6$s" data-infowindow="%7$s" style="width:%8$s;height:%9$s;">%10$s</div></div>',
|
147 |
+
apply_filters( 'simplemap_class_name', $this->class_name ),
|
148 |
+
$breakpoint,
|
149 |
+
$lat,
|
150 |
+
$lng,
|
151 |
+
$zoom,
|
152 |
+
$addr,
|
153 |
+
$infowindow,
|
154 |
+
$w,
|
155 |
+
$h,
|
156 |
+
trim( $content )
|
157 |
+
);
|
158 |
+
}
|
159 |
+
|
160 |
+
private function get_shortcode_tag()
|
161 |
+
{
|
162 |
+
return apply_filters( 'simplemap_shortcode_tag', $this->shortcode_tag );
|
163 |
+
}
|
164 |
+
|
165 |
+
} // end class
|
166 |
+
|
167 |
+
|
168 |
+
// EOF
|