from:http://www.pittss.lv/jquery/gomap/solutions.php

jquery.gomap-1.3.3.js:

/**
* jQuery goMap
*
* @url http://www.pittss.lv/jquery/gomap/
* @author Jevgenijs Shtrauss <pittss@gmail.com>
* @version 1.3.3 2014.11.27
* This software is released under the MIT License <http://www.opensource.org/licenses/mit-license.php>
*/ (function($) {
var geocoder = new google.maps.Geocoder(); function MyOverlay(map) { this.setMap(map); };
MyOverlay.prototype = new google.maps.OverlayView();
MyOverlay.prototype.onAdd = function() { };
MyOverlay.prototype.onRemove = function() { };
MyOverlay.prototype.draw = function() { }; $.goMap = {}; $.fn.goMap = function(options) {
return this.each(function() {
var goMap = $(this).data('goMap');
if(!goMap) {
var goMapBase = $.extend(true, {}, $.goMapBase);
$(this).data('goMap', goMapBase.init(this, options));
$.goMap = goMapBase;
}
else {
$.goMap = goMap;
}
});
}; $.goMapBase = {
defaults: {
address: '', // Street, City, Country
latitude: 56.9,
longitude: 24.1,
zoom: 4,
delay: 200,
hideByClick: true,
oneInfoWindow: true,
prefixId: 'gomarker',
polyId: 'gopoly',
groupId: 'gogroup',
navigationControl: true, // Show or hide navigation control
navigationControlOptions: {
position: 'TOP_LEFT', // TOP, TOP_LEFT, TOP_RIGHT, BOTTOM, BOTTOM_LEFT, BOTTOM_RIGHT, LEFT, RIGHT
style: 'DEFAULT' // DEFAULT, SMALL, LARGE
},
mapTypeControl: true, // Show or hide map control
mapTypeControlOptions: {
position: 'TOP_RIGHT', // TOP, TOP_LEFT, TOP_RIGHT, BOTTOM, BOTTOM_LEFT, BOTTOM_RIGHT, LEFT, RIGHT
style: 'DEFAULT'// DEFAULT, DROPDOWN_MENU, HORIZONTAL_BAR
},
scaleControl: false, // Show or hide scale
scrollwheel: true, // Mouse scroll whell
directions: false,
directionsResult: null,
disableDoubleClickZoom: false,
streetViewControl: false,
markers: [],
overlays: [],
polyline: {
color: '#FF0000',
opacity: 1.0,
weight: 2
},
polygon: {
color: '#FF0000',
opacity: 1.0,
weight: 2,
fillColor: '#FF0000',
fillOpacity: 0.2
},
circle: {
color: '#FF0000',
opacity: 1.0,
weight: 2,
fillColor: '#FF0000',
fillOpacity: 0.2
},
rectangle: {
color: '#FF0000',
opacity: 1.0,
weight: 2,
fillColor: '#FF0000',
fillOpacity: 0.2
},
maptype: 'HYBRID', // Map type - HYBRID, ROADMAP, SATELLITE, TERRAIN
html_prepend: '<div class="gomapMarker">',
html_append: '</div>',
addMarker: false
},
map: null,
count: 0,
markers: [],
polylines: [],
polygons: [],
circles: [],
rectangles: [],
tmpMarkers: [],
geoMarkers: [],
lockGeocode: false,
bounds: null,
overlays: null,
overlay: null,
mapId: null,
plId: null,
pgId: null,
cId: null,
rId: null,
opts: null,
centerLatLng: null, init: function(el, options) {
var opts = $.extend(true, {}, $.goMapBase.defaults, options);
this.mapId = $(el);
this.opts = opts; if (opts.address)
this.geocode({address: opts.address, center: true});
// else if (opts.latitude != $.goMapBase.defaults.latitude && opts.longitude != $.goMapBase.defaults.longitude)
// this.centerLatLng = new google.maps.LatLng(opts.latitude, opts.longitude);
else if ($.isArray(opts.markers) && opts.markers.length > 0) {
if (opts.markers[0].address)
this.geocode({address: opts.markers[0].address, center: true});
else
this.centerLatLng = new google.maps.LatLng(opts.markers[0].latitude, opts.markers[0].longitude);
}
else
this.centerLatLng = new google.maps.LatLng(opts.latitude, opts.longitude); var myOptions = {
center: this.centerLatLng,
disableDoubleClickZoom: opts.disableDoubleClickZoom,
mapTypeControl: opts.mapTypeControl,
streetViewControl: opts.streetViewControl,
mapTypeControlOptions: {
position: google.maps.ControlPosition[opts.mapTypeControlOptions.position.toUpperCase()],
style: google.maps.MapTypeControlStyle[opts.mapTypeControlOptions.style.toUpperCase()]
},
mapTypeId: google.maps.MapTypeId[opts.maptype.toUpperCase()],
panControl: opts.navigationControl,
zoomControl: opts.navigationControl,
panControlOptions: {
position: google.maps.ControlPosition[opts.navigationControlOptions.position.toUpperCase()]
},
zoomControlOptions: {
position: google.maps.ControlPosition[opts.navigationControlOptions.position.toUpperCase()],
style: google.maps.ZoomControlStyle[opts.navigationControlOptions.style.toUpperCase()]
},
scaleControl: opts.scaleControl,
scrollwheel: opts.scrollwheel,
zoom: opts.zoom
}; this.map = new google.maps.Map(el, myOptions);
this.overlay = new MyOverlay(this.map); this.overlays = {
polyline: { id: 'plId', array: 'polylines', create: 'createPolyline' },
polygon: { id: 'pgId', array: 'polygons', create: 'createPolygon' },
circle: { id: 'cId', array: 'circles', create: 'createCircle' },
rectangle: { id: 'rId', array: 'rectangles', create: 'createRectangle' }
}; this.plId = $('<div style="display:none;"/>').appendTo(this.mapId);
this.pgId = $('<div style="display:none;"/>').appendTo(this.mapId);
this.cId = $('<div style="display:none;"/>').appendTo(this.mapId);
this.rId = $('<div style="display:none;"/>').appendTo(this.mapId); for (var j = 0, l = opts.markers.length; j < l; j++)
this.createMarker(opts.markers[j]); for (var j = 0, l = opts.overlays.length; j < l; j++)
this[this.overlays[opts.overlays[j].type].create](opts.overlays[j]); var goMap = this;
if (opts.addMarker == true || opts.addMarker == 'multi') {
google.maps.event.addListener(goMap.map, 'click', function(event) {
var options = {
position: event.latLng,
draggable: true
}; var marker = goMap.createMarker(options); google.maps.event.addListener(marker, 'dblclick', function(event) {
marker.setMap(null);
goMap.removeMarker(marker.id);
}); });
}
else if (opts.addMarker == 'single') {
google.maps.event.addListener(goMap.map, 'click', function(event) {
if(!goMap.singleMarker) {
var options = {
position: event.latLng,
draggable: true
}; var marker = goMap.createMarker(options);
goMap.singleMarker = true; google.maps.event.addListener(marker, 'dblclick', function(event) {
marker.setMap(null);
goMap.removeMarker(marker.id);
goMap.singleMarker = false;
});
}
});
}
delete opts.markers;
delete opts.overlays; return this;
}, ready: function(f) {
google.maps.event.addListenerOnce(this.map, 'bounds_changed', function() {
return f();
});
}, geocode: function(address, options) {
var goMap = this;
setTimeout(function() {
geocoder.geocode({'address': address.address}, function(results, status) {
if (status == google.maps.GeocoderStatus.OK && address.center)
goMap.map.setCenter(results[0].geometry.location); if (status == google.maps.GeocoderStatus.OK && options && options.markerId)
options.markerId.setPosition(results[0].geometry.location); else if (status == google.maps.GeocoderStatus.OK && options) {
if(goMap.lockGeocode) {
goMap.lockGeocode = false;
options.position = results[0].geometry.location;
options.geocode = true;
goMap.createMarker(options);
}
}
else if(status == google.maps.GeocoderStatus.OVER_QUERY_LIMIT) {
goMap.geocode(address, options);
}
});
}, this.opts.delay);
}, geoMarker: function() {
if(this.geoMarkers.length > 0 && !this.lockGeocode) {
this.lockGeocode = true;
var current = this.geoMarkers.splice(0, 1);
this.geocode({address:current[0].address}, current[0]);
}
else if(this.lockGeocode) {
var goMap = this;
setTimeout(function() {
goMap.geoMarker();
}, this.opts.delay);
}
}, setMap: function(options) {
delete options.mapTypeId; if (options.address) {
this.geocode({address: options.address, center: true});
delete options.address;
}
else if (options.latitude && options.longitude) {
options.center = new google.maps.LatLng(options.latitude, options.longitude);
delete options.longitude;
delete options.latitude;
} if(options.mapTypeControlOptions && options.mapTypeControlOptions.position)
options.mapTypeControlOptions.position = google.maps.ControlPosition[options.mapTypeControlOptions.position.toUpperCase()]; if(options.mapTypeControlOptions && options.mapTypeControlOptions.style)
options.mapTypeControlOptions.style = google.maps.MapTypeControlStyle[options.mapTypeControlOptions.style.toUpperCase()]; if(typeof options.navigationControl !== 'undefined') {
options.panControl = options.navigationControl;
options.zoomControl = options.navigationControl;
} if(options.navigationControlOptions && options.navigationControlOptions.position) {
options.panControlOptions = {position: google.maps.ControlPosition[options.navigationControlOptions.position.toUpperCase()]};
options.zoomControlOptions = {position: google.maps.ControlPosition[options.navigationControlOptions.position.toUpperCase()]};
} if(options.navigationControlOptions && options.navigationControlOptions.style) {
if(typeof options.zoomControlOptions === 'undefined')
options.zoomControlOptions = {style: google.maps.ZoomControlStyle[options.navigationControlOptions.style.toUpperCase()]};
else
options.zoomControlOptions.style = google.maps.ZoomControlStyle[options.navigationControlOptions.style.toUpperCase()];
}
this.map.setOptions(options);
}, getMap: function() {
return this.map;
}, createListener: function(type, event, data) {
var target; if(typeof type != 'object')
type = {type:type}; if(type.type == 'map')
target = this.map;
else if(type.type == 'marker' && type.marker)
target = $(this.mapId).data(type.marker);
else if(type.type == 'info' && type.marker)
target = $(this.mapId).data(type.marker + 'info'); if(target)
return google.maps.event.addListener(target, event, data);
else if((type.type == 'marker' || type.type == 'info') && this.getMarkerCount() != this.getTmpMarkerCount())
var goMap = this;
setTimeout(function() {
goMap.createListener(type, event, data);
}, this.opts.delay);
}, removeListener: function(listener) {
google.maps.event.removeListener(listener);
}, setInfoWindow: function(marker, html) {
var goMap = this;
html.content = goMap.opts.html_prepend + html.content + goMap.opts.html_append;
var infowindow = new google.maps.InfoWindow(html);
infowindow.show = false; $(goMap.mapId).data(marker.id + 'info',infowindow); if (html.popup) {
goMap.openWindow(infowindow, marker, html);
infowindow.show = true;
} google.maps.event.addListener(marker, 'click', function() {
if (infowindow.show && goMap.opts.hideByClick) {
infowindow.close();
infowindow.show = false;
}
else {
goMap.openWindow(infowindow, marker, html);
infowindow.show = true;
}
});
}, openWindow: function(infowindow, marker, html) {
var goMap = this;
if(this.opts.oneInfoWindow)
this.clearInfo(); if (html.ajax) {
infowindow.open(this.map, marker);
$.ajax({
url: html.ajax,
success: function(html) {
infowindow.setContent(goMap.opts.html_prepend + html + goMap.opts.html_append);
}
});
}
else if (html.id) {
infowindow.setContent(goMap.opts.html_prepend + $(html.id).html() + goMap.opts.html_append);
infowindow.open(this.map, marker);
}
else
infowindow.open(this.map, marker);
}, setInfo: function(id, text) {
var info = $(this.mapId).data(id + 'info'); if(typeof text == 'object')
info.setOptions(goMap.opts.html_prepend + text + goMap.opts.html_append);
else
info.setContent(goMap.opts.html_prepend + text + goMap.opts.html_append);
}, getInfo: function(id, hideDiv) {
var info = $(this.mapId).data(id + 'info').getContent();
if(hideDiv)
return $(info).html();
else
return info;
}, clearInfo: function() {
for (var i = 0, l = this.markers.length; i < l; i++) {
var info = $(this.mapId).data(this.markers[i] + 'info');
if(info) {
info.close();
info.show = false;
}
}
}, fitBounds: function(type, markers) {
var goMap = this;
if(this.getMarkerCount() != this.getTmpMarkerCount())
setTimeout(function() {
goMap.fitBounds(type, markers);
}, this.opts.delay);
else {
this.bounds = new google.maps.LatLngBounds(); if(!type || (type && type == 'all')) {
for (var i = 0, l = this.markers.length; i < l; i++) {
this.bounds.extend($(this.mapId).data(this.markers[i]).position);
}
}
else if (type && type == 'visible') {
for (var i = 0, l = this.markers.length; i < l; i++) {
if(this.getVisibleMarker(this.markers[i]))
this.bounds.extend($(this.mapId).data(this.markers[i]).position);
} }
else if (type && type == 'markers' && $.isArray(markers)) {
for (var i = 0, l = markers.length; i < l; i++) {
this.bounds.extend($(this.mapId).data(markers[i]).position);
}
}
this.map.fitBounds(this.bounds);
}
}, getBounds: function() {
return this.map.getBounds();
}, createPolyline: function(poly) {
poly.type = 'polyline';
return this.createOverlay(poly);
}, createPolygon: function(poly) {
poly.type = 'polygon';
return this.createOverlay(poly);
}, createCircle: function(poly) {
poly.type = 'circle';
return this.createOverlay(poly);
}, createRectangle: function(poly) {
poly.type = 'rectangle';
return this.createOverlay(poly);
}, createOverlay: function(poly) {
var overlay = [];
if (!poly.id) {
this.count++;
poly.id = this.opts.polyId + this.count;
}
switch(poly.type) {
case 'polyline':
if (poly.coords.length > 0) {
for (var j = 0, l = poly.coords.length; j < l; j++)
overlay.push(new google.maps.LatLng(poly.coords[j].latitude, poly.coords[j].longitude)); overlay = new google.maps.Polyline({
map: this.map,
path: overlay,
strokeColor: poly.color ? poly.color : this.opts.polyline.color,
strokeOpacity: poly.opacity ? poly.opacity : this.opts.polyline.opacity,
strokeWeight: poly.weight ? poly.weight : this.opts.polyline.weight
});
}
else
return false;
break;
case 'polygon':
if (poly.coords.length > 0) {
for (var j = 0, l = poly.coords.length; j < l; j++)
overlay.push(new google.maps.LatLng(poly.coords[j].latitude, poly.coords[j].longitude)); overlay = new google.maps.Polygon({
map: this.map,
path: overlay,
strokeColor: poly.color ? poly.color : this.opts.polygon.color,
strokeOpacity: poly.opacity ? poly.opacity : this.opts.polygon.opacity,
strokeWeight: poly.weight ? poly.weight : this.opts.polygon.weight,
fillColor: poly.fillColor ? poly.fillColor : this.opts.polygon.fillColor,
fillOpacity: poly.fillOpacity ? poly.fillOpacity : this.opts.polygon.fillOpacity
});
}
else
return false;
break;
case 'circle':
overlay = new google.maps.Circle({
map: this.map,
center: new google.maps.LatLng(poly.latitude, poly.longitude),
radius: poly.radius,
strokeColor: poly.color ? poly.color : this.opts.circle.color,
strokeOpacity: poly.opacity ? poly.opacity : this.opts.circle.opacity,
strokeWeight: poly.weight ? poly.weight : this.opts.circle.weight,
fillColor: poly.fillColor ? poly.fillColor : this.opts.circle.fillColor,
fillOpacity: poly.fillOpacity ? poly.fillOpacity : this.opts.circle.fillOpacity
});
break;
case 'rectangle':
overlay = new google.maps.Rectangle({
map: this.map,
bounds: new google.maps.LatLngBounds(new google.maps.LatLng(poly.sw.latitude, poly.sw.longitude), new google.maps.LatLng(poly.ne.latitude, poly.ne.longitude)),
strokeColor: poly.color ? poly.color : this.opts.circle.color,
strokeOpacity: poly.opacity ? poly.opacity : this.opts.circle.opacity,
strokeWeight: poly.weight ? poly.weight : this.opts.circle.weight,
fillColor: poly.fillColor ? poly.fillColor : this.opts.circle.fillColor,
fillOpacity: poly.fillOpacity ? poly.fillOpacity : this.opts.circle.fillOpacity
});
break;
default:
return false;
break;
}
this.addOverlay(poly, overlay);
return overlay;
}, addOverlay: function(poly, overlay) {
$(this[this.overlays[poly.type].id]).data(poly.id, overlay);
this[this.overlays[poly.type].array].push(poly.id);
}, setOverlay: function(type, overlay, options) {
overlay = $(this[this.overlays[type].id]).data(overlay); if (options.coords && options.coords.length > 0) {
var array = [];
for (var j = 0, l = options.coords.length; j < l; j++)
array.push(new google.maps.LatLng(options.coords[j].latitude, options.coords[j].longitude)); options.path = array;
delete options.coords;
}
else if (options.ne && options.sw) {
options.bounds = new google.maps.LatLngBounds(new google.maps.LatLng(options.sw.latitude, options.sw.longitude), new google.maps.LatLng(options.ne.latitude, options.ne.longitude));
delete options.ne;
delete options.sw;
}
else if (options.latitude && options.longitude) { options.center = new google.maps.LatLng(options.latitude, options.longitude);
delete options.latitude;
delete options.longitude;
}
overlay.setOptions(options);
}, showHideOverlay: function(type, overlay, display) {
if(typeof display === 'undefined') {
if(this.getVisibleOverlay(type, overlay))
display = false;
else
display = true;
} if(display)
$(this[this.overlays[type].id]).data(overlay).setMap(this.map);
else
$(this[this.overlays[type].id]).data(overlay).setMap(null);
}, getVisibleOverlay: function(type, overlay) {
if($(this[this.overlays[type].id]).data(overlay).getMap())
return true;
else
return false;
}, getOverlaysCount: function(type) {
return this[this.overlays[type].array].length;
}, removeOverlay: function(type, overlay) {
var index = $.inArray(overlay, this[this.overlays[type].array]), current;
if (index > -1) {
current = this[this.overlays[type].array].splice(index, 1);
var markerId = current[0];
$(this[this.overlays[type].id]).data(markerId).setMap(null);
$(this[this.overlays[type].id]).removeData(markerId); return true;
}
return false;
}, clearOverlays: function(type) {
for (var i = 0, l = this[this.overlays[type].array].length; i < l; i++) {
var markerId = this[this.overlays[type].array][i];
$(this[this.overlays[type].id]).data(markerId).setMap(null);
$(this[this.overlays[type].id]).removeData(markerId);
}
this[this.overlays[type].array] = [];
}, showHideMarker: function(marker, display) {
if(typeof display === 'undefined') {
if(this.getVisibleMarker(marker)) {
$(this.mapId).data(marker).setVisible(false);
var info = $(this.mapId).data(marker + 'info');
if(info && info.show) {
info.close();
info.show = false;
}
}
else
$(this.mapId).data(marker).setVisible(true);
}
else
$(this.mapId).data(marker).setVisible(display);
}, showHideMarkerByGroup: function(group, display) {
for (var i = 0, l = this.markers.length; i < l; i++) {
var markerId = this.markers[i];
var marker = $(this.mapId).data(markerId);
if(marker.group == group) {
if(typeof display === 'undefined') {
if(this.getVisibleMarker(markerId)) {
marker.setVisible(false);
var info = $(this.mapId).data(markerId + 'info');
if(info && info.show) {
info.close();
info.show = false;
}
}
else
marker.setVisible(true);
}
else
marker.setVisible(display);
}
}
}, getVisibleMarker: function(marker) {
return $(this.mapId).data(marker).getVisible();
}, getMarkerCount: function() {
return this.markers.length;
}, getTmpMarkerCount: function() {
return this.tmpMarkers.length;
}, getVisibleMarkerCount: function() {
return this.getMarkers('visiblesInMap').length;
}, getMarkerByGroupCount: function(group) {
return this.getMarkers('group', group).length;
}, getMarkers: function(type, name) {
var array = [];
switch(type) {
case "json":
for (var i = 0, l = this.markers.length; i < l; i++) {
var temp = "'" + i + "': '" + $(this.mapId).data(this.markers[i]).getPosition().toUrlValue() + "'";
array.push(temp);
}
array = "{'markers':{" + array.join(",") + "}}";
break;
case "data":
for (var i = 0, l = this.markers.length; i < l; i++) {
var temp = "marker[" + i + "]=" + $(this.mapId).data(this.markers[i]).getPosition().toUrlValue();
array.push(temp);
}
array = array.join("&");
break;
case "visiblesInBounds":
for (var i = 0, l = this.markers.length; i < l; i++) {
if (this.isVisible($(this.mapId).data(this.markers[i]).getPosition()))
array.push(this.markers[i]);
}
break;
case "visiblesInMap":
for (var i = 0, l = this.markers.length; i < l; i++) {
if(this.getVisibleMarker(this.markers[i]))
array.push(this.markers[i]);
}
break;
case "group":
if(name)
for (var i = 0, l = this.markers.length; i < l; i++) {
if($(this.mapId).data(this.markers[i]).group == name)
array.push(this.markers[i]);
}
break;
case "markers":
for (var i = 0, l = this.markers.length; i < l; i++) {
var temp = $(this.mapId).data(this.markers[i]);
array.push(temp);
}
break;
default:
for (var i = 0, l = this.markers.length; i < l; i++) {
var temp = $(this.mapId).data(this.markers[i]).getPosition().toUrlValue();
array.push(temp);
}
break;
}
return array;
}, getVisibleMarkers: function() {
return this.getMarkers('visiblesInBounds');
}, createMarker: function(marker) {
if (!marker.geocode) {
this.count++;
if (!marker.id)
marker.id = this.opts.prefixId + this.count;
this.tmpMarkers.push(marker.id);
}
if (marker.address && !marker.geocode) {
this.geoMarkers.push(marker);
this.geoMarker();
}
else if (marker.latitude && marker.longitude || marker.position) {
var options = { map:this.map };
options.id = marker.id;
options.group = marker.group ? marker.group : this.opts.groupId;
options.zIndex = marker.zIndex ? marker.zIndex : 0;
options.zIndexOrg = marker.zIndexOrg ? marker.zIndexOrg : 0; if (marker.visible == false)
options.visible = marker.visible; if (marker.title)
options.title = marker.title; if (marker.draggable)
options.draggable = marker.draggable; if (marker.icon && marker.icon.image) {
options.icon = marker.icon.image;
if (marker.icon.shadow)
options.shadow = marker.icon.shadow;
}
else if (marker.icon)
options.icon = marker.icon; else if (this.opts.icon && this.opts.icon.image) {
options.icon = this.opts.icon.image;
if (this.opts.icon.shadow)
options.shadow = this.opts.icon.shadow;
}
else if (this.opts.icon)
options.icon = this.opts.icon; options.position = marker.position ? marker.position : new google.maps.LatLng(marker.latitude, marker.longitude); var cmarker = new google.maps.Marker(options); if (marker.html) {
if (!marker.html.content && !marker.html.ajax && !marker.html.id)
marker.html = { content:marker.html };
else if (!marker.html.content)
marker.html.content = null; this.setInfoWindow(cmarker, marker.html);
}
this.addMarker(cmarker);
return cmarker;
}
}, addMarker: function(marker) {
$(this.mapId).data(marker.id, marker);
this.markers.push(marker.id);
}, setMarker: function(marker, options) {
var tmarker = $(this.mapId).data(marker); delete options.id;
delete options.visible; if(options.icon) {
var toption = options.icon;
delete options.icon; if(toption && toption == 'default') {
if (this.opts.icon && this.opts.icon.image) {
options.icon = this.opts.icon.image;
if (this.opts.icon.shadow)
options.shadow = this.opts.icon.shadow;
}
else if (this.opts.icon)
options.icon = this.opts.icon;
}
else if(toption && toption.image) {
options.icon = toption.image;
if (toption.shadow)
options.shadow = toption.shadow;
}
else if (toption)
options.icon = toption;
} if (options.address) {
this.geocode({address: options.address}, {markerId:tmarker});
delete options.address;
delete options.latitude;
delete options.longitude;
delete options.position;
}
else if (options.latitude && options.longitude || options.position) {
if (!options.position)
options.position = new google.maps.LatLng(options.latitude, options.longitude);
}
tmarker.setOptions(options);
}, removeMarker: function(marker) {
var index = $.inArray(marker, this.markers), current;
if (index > -1) {
this.tmpMarkers.splice(index,1);
current = this.markers.splice(index,1);
var markerId = current[0];
var marker = $(this.mapId).data(markerId);
var info = $(this.mapId).data(markerId + 'info'); marker.setVisible(false);
marker.setMap(null);
$(this.mapId).removeData(markerId); if(info) {
info.close();
info.show = false;
$(this.mapId).removeData(markerId + 'info');
}
return true;
}
return false;
}, clearMarkers: function() {
for (var i = 0, l = this.markers.length; i < l; i++) {
var markerId = this.markers[i];
var marker = $(this.mapId).data(markerId);
var info = $(this.mapId).data(markerId + 'info'); marker.setVisible(false);
marker.setMap(null);
$(this.mapId).removeData(markerId); if(info) {
info.close();
info.show = false;
$(this.mapId).removeData(markerId + 'info');
}
}
this.singleMarker = false;
this.lockGeocode = false;
this.markers = [];
this.tmpMarkers = [];
this.geoMarkers = [];
}, isVisible: function(latlng) {
return this.map.getBounds().contains(latlng);
}
}
})(jQuery);

  jquery.dump.js:

/**
* jquery.dump.js
* @author Torkild Dyvik Olsen
* @version 1.0
*
* A simple debug function to gather information about an object.
* Returns a nested tree with information.
*
*/
(function($) { $.fn.dump = function() {
return $.dump(this);
} $.dump = function(object) {
var recursion = function(obj, level) {
if(!level) level = 0;
var dump = '', p = '';
for(i = 0; i < level; i++) p += "\t"; t = type(obj);
switch(t) {
case "string":
return '"' + obj + '"';
break;
case "number":
return obj.toString();
break;
case "boolean":
return obj ? 'true' : 'false';
case "date":
return "Date: " + obj.toLocaleString();
case "array":
dump += 'Array ( \n';
$.each(obj, function(k,v) {
dump += p +'\t' + k + ' => ' + recursion(v, level + 1) + '\n';
});
dump += p + ')';
break;
case "object":
dump += 'Object { \n';
$.each(obj, function(k,v) {
dump += p + '\t' + k + ': ' + recursion(v, level + 1) + '\n';
});
dump += p + '}';
break;
case "jquery":
dump += 'jQuery Object { \n';
$.each(obj, function(k,v) {
dump += p + '\t' + k + ' = ' + recursion(v, level + 1) + '\n';
});
dump += p + '}';
break;
case "regexp":
return "RegExp: " + obj.toString();
case "error":
return obj.toString();
case "document":
case "domelement":
dump += 'DOMElement [ \n'
+ p + '\tnodeName: ' + obj.nodeName + '\n'
+ p + '\tnodeValue: ' + obj.nodeValue + '\n'
+ p + '\tinnerHTML: [ \n';
$.each(obj.childNodes, function(k,v) {
if(k < 1) var r = 0;
if(type(v) == "string") {
if(v.textContent.match(/[^\s]/)) {
dump += p + '\t\t' + (k - (r||0)) + ' = String: ' + trim(v.textContent) + '\n';
} else {
r--;
}
} else {
dump += p + '\t\t' + (k - (r||0)) + ' = ' + recursion(v, level + 2) + '\n';
}
});
dump += p + '\t]\n'
+ p + ']';
break;
case "function":
var match = obj.toString().match(/^(.*)\(([^\)]*)\)/im);
match[1] = trim(match[1].replace(new RegExp("[\\s]+", "g"), " "));
match[2] = trim(match[2].replace(new RegExp("[\\s]+", "g"), " "));
return match[1] + "(" + match[2] + ")";
case "window":
default:
dump += 'N/A: ' + t;
break;
} return dump;
} var type = function(obj) {
var type = typeof(obj); if(type != "object") {
return type;
} switch(obj) {
case null:
return 'null';
case window:
return 'window';
case document:
return 'document';
case window.event:
return 'event';
default:
break;
} if(obj.jquery) {
return 'jquery';
} switch(obj.constructor) {
case Array:
return 'array';
case Boolean:
return 'boolean';
case Date:
return 'date';
case Object:
return 'object';
case RegExp:
return 'regexp';
case ReferenceError:
case Error:
return 'error';
case null:
default:
break;
} switch(obj.nodeType) {
case 1:
return 'domelement';
case 3:
return 'string';
case null:
default:
break;
} return 'Unknown';
} return recursion(object);
} function trim(str) {
return ltrim(rtrim(str));
} function ltrim(str) {
return str.replace(new RegExp("^[\\s]+", "g"), "");
} function rtrim(str) {
return str.replace(new RegExp("[\\s]+$", "g"), "");
} })(jQuery);

  jquery.chili-2.2.js

/*
===============================================================================
Chili is the jQuery code highlighter plugin
...............................................................................
LICENSE: http://www.opensource.org/licenses/mit-license.php
WEBSITE: http://noteslog.com/chili/ Copyright 2008 / Andrea Ercolino
===============================================================================
*/ ( function($) { ChiliBook = { //implied global version: "2.2" // 2008-07-06 // options -------------------------------------------------------------------- , automatic: true
, automaticSelector: "code" , lineNumbers: !true , codeLanguage: function( el ) {
var recipeName = $( el ).attr( "class" );
return recipeName ? recipeName : '';
} , recipeLoading: true
, recipeFolder: "" // used like: recipeFolder + recipeName + '.js' // IE and FF convert   to " ", Safari and Opera do not
, replaceSpace: " "
, replaceTab: "    "
, replaceNewLine: " <br/>" , selectionStyle: [ "position:absolute; z-index:3000; overflow:scroll;"
, "width:16em;"
, "height:9em;"
, "border:1px solid gray;"
, "padding:15px;"
, "background-color:yellow;"
].join( ' ' ) // ------------------------------------------------------------- end of options , defaultReplacement: '<span class="$0">$$</span>' // TODO: make this an option again
, recipes: {} //repository
, queue: {} //registry , unique: function() {
return (new Date()).valueOf();
}
}; $.fn.chili = function( options ) {
var book = $.extend( {}, ChiliBook, options || {} ); function cook( ingredients, recipe, blockName ) { function prepareBlock( recipe, blockName ) {
var steps = [];
for( var stepName in recipe[ blockName ] ) {
steps.push( prepareStep( recipe, blockName, stepName ) );
}
return steps;
} // prepareBlock function prepareStep( recipe, blockName, stepName ) {
var step = recipe[ blockName ][ stepName ];
var exp = ( typeof step._match == "string" ) ? step._match : step._match.source;
return {
recipe: recipe
, blockName: blockName
, stepName: stepName
, exp: "(" + exp + ")"
, length: 1 // add 1 to account for the newly added parentheses
+ (exp // count number of submatches in here
.replace( /\\./g, "%" ) // disable any escaped character
.replace( /\[.*?\]/g, "%" ) // disable any character class
.match( /\((?!\?)/g ) // match any open parenthesis, not followed by a ?
|| [] // make sure it is an empty array if there are no matches
).length // get the number of matches
, replacement: step._replace ? step._replace : book.defaultReplacement
};
} // prepareStep function knowHow( steps ) {
var prevLength = 1;
var exps = [];
for (var i = 0; i < steps.length; i++) {
var exp = steps[ i ].exp;
// adjust backreferences
exp = exp.replace( /\\\\|\\(\d+)/g, function( m, aNum ) {
return !aNum ? m : "\\" + ( prevLength + 1 + parseInt( aNum, 10 ) );
} );
exps.push( exp );
prevLength += steps[ i ].length;
}
var prolog = '((?:\\s|\\S)*?)';
var epilog = '((?:\\s|\\S)+)';
var source = '(?:' + exps.join( "|" ) + ')';
source = prolog + source + '|' + epilog;
return new RegExp( source, recipe._case ? "g" : "gi" );
} // knowHow function escapeHTML( str ) {
return str.replace( /&/g, "&" ).replace( /</g, "<" );
} // escapeHTML function replaceSpaces( str ) {
return str.replace( / +/g, function( spaces ) {
return spaces.replace( / /g, replaceSpace );
} );
} // replaceSpaces function filter( str ) {
str = escapeHTML( str );
if( replaceSpace ) {
str = replaceSpaces( str );
}
return str;
} // filter function applyRecipe( subject, recipe ) {
return cook( subject, recipe );
} // applyRecipe function applyBlock( subject, recipe, blockName ) {
return cook( subject, recipe, blockName );
} // applyBlock function applyStep( subject, recipe, blockName, stepName ) {
var replaceSpace = book.replaceSpace; var step = prepareStep( recipe, blockName, stepName );
var steps = [step]; var perfect = subject.replace( knowHow( steps ), function() {
return chef.apply( { steps: steps }, arguments );
} );
return perfect;
} // applyStep function applyModule( subject, module, context ) {
if( ! module ) {
return filter( subject );
} var sub = module.split( '/' );
var recipeName = '';
var blockName = '';
var stepName = '';
switch( sub.length ) {
case 1:
recipeName = sub[0];
break;
case 2:
recipeName = sub[0]; blockName = sub[1];
break;
case 3:
recipeName = sub[0]; blockName = sub[1]; stepName = sub[2];
break;
default:
return filter( subject );
} function getRecipe( recipeName ) {
var path = getPath( recipeName );
var recipe = book.recipes[ path ];
if( ! recipe ) {
throw {msg:"recipe not available"};
}
return recipe;
} try {
var recipe;
if ( '' == stepName ) {
if ( '' == blockName ) {
if ( '' == recipeName ) {
//nothing to do
}
else { // ( '' != recipeName )
recipe = getRecipe( recipeName );
return applyRecipe( subject, recipe );
}
}
else { // ( '' != blockName )
if( '' == recipeName ) {
recipe = context.recipe;
}
else {
recipe = getRecipe( recipeName );
}
if( ! (blockName in recipe) ) {
return filter( subject );
}
return applyBlock( subject, recipe, blockName );
}
}
else { // ( '' != stepName )
if( '' == recipeName ) {
recipe = context.recipe;
}
else {
recipe = getRecipe( recipeName );
}
if( '' == blockName ) {
blockName = context.blockName;
}
if( ! (blockName in recipe) ) {
return filter( subject );
}
if( ! (stepName in recipe[blockName]) ) {
return filter( subject );
}
return applyStep( subject, recipe, blockName, stepName );
}
}
catch( e ) {
if (e.msg && e.msg == "recipe not available") {
var cue = 'chili_' + book.unique();
if( book.recipeLoading ) {
var path = getPath( recipeName );
if( ! book.queue[ path ] ) {
/* this is a new recipe to download */
try {
book.queue[ path ] = [ {cue: cue, subject: subject, module: module, context: context} ];
$.getJSON( path, function( recipeLoaded ) {
book.recipes[ path ] = recipeLoaded;
var q = book.queue[ path ];
for( var i = 0, iTop = q.length; i < iTop; i++ ) {
var replacement = applyModule( q[ i ].subject, q[ i ].module, q[ i ].context );
if( book.replaceTab ) {
replacement = replacement.replace( /\t/g, book.replaceTab );
}
if( book.replaceNewLine ) {
replacement = replacement.replace( /\n/g, book.replaceNewLine );
}
$( '#' + q[ i ].cue ).replaceWith( replacement );
}
} );
}
catch( recipeNotAvailable ) {
alert( "the recipe for '" + recipeName + "' was not found in '" + path + "'" );
}
}
else {
/* not a new recipe, so just enqueue this element */
book.queue[ path ].push( {cue: cue, subject: subject, module: module, context: context} );
}
return '<span id="' + cue + '">' + filter( subject ) + '</span>';
}
return filter( subject );
}
else {
return filter( subject );
}
}
} // applyModule function addPrefix( prefix, replacement ) {
var aux = replacement.replace( /(<span\s+class\s*=\s*(["']))((?:(?!__)\w)+\2\s*>)/ig, "$1" + prefix + "__$3" );
return aux;
} // addPrefix function chef() {
if (! arguments[ 0 ]) {
return '';
}
var steps = this.steps;
var i = 0; // iterate steps
var j = 2; // iterate chef's arguments
var prolog = arguments[ 1 ];
var epilog = arguments[ arguments.length - 3 ];
if (! epilog) {
var step;
while( step = steps[ i++ ] ) {
var aux = arguments; // this unmasks chef's arguments inside the next function
if( aux[ j ] ) {
var replacement = '';
if( $.isFunction( step.replacement ) ) {
var matches = []; //Array.slice.call( aux, j, step.length );
for (var k = 0, kTop = step.length; k < kTop; k++) {
matches.push( aux[ j + k ] );
}
matches.push( aux[ aux.length - 2 ] );
matches.push( aux[ aux.length - 1 ] );
replacement = step.replacement
.apply( {
x: function() {
var subject = arguments[0];
var module = arguments[1];
var context = {
recipe: step.recipe
, blockName: step.blockName
};
return applyModule( subject, module, context );
}
}, matches );
}
else { //we expect step.replacement to be a string
replacement = step.replacement
.replace( /(\\\$)|(?:\$\$)|(?:\$(\d+))/g, function( m, escaped, K ) {
if( escaped ) { /* \$ */
return "$";
}
else if( !K ) { /* $$ */
return filter( aux[ j ] );
}
else if( K == "0" ) { /* $0 */
return step.stepName;
}
else { /* $K */
return filter( aux[ j + parseInt( K, 10 ) ] );
}
} );
}
replacement = addPrefix( step.recipe._name, replacement );
return filter( prolog ) + replacement;
}
else {
j+= step.length;
}
}
}
else {
return filter( epilog );
}
} // chef if( ! blockName ) {
blockName = '_main';
checkSpices( recipe );
}
if( ! (blockName in recipe) ) {
return filter( ingredients );
}
var replaceSpace = book.replaceSpace;
var steps = prepareBlock( recipe, blockName );
var kh = knowHow( steps );
var perfect = ingredients.replace( kh, function() {
return chef.apply( { steps: steps }, arguments );
} );
return perfect; } // cook function loadStylesheetInline( sourceCode ) {
if( document.createElement ) {
var e = document.createElement( "style" );
e.type = "text/css";
if( e.styleSheet ) { // IE
e.styleSheet.cssText = sourceCode;
}
else {
var t = document.createTextNode( sourceCode );
e.appendChild( t );
}
document.getElementsByTagName( "head" )[0].appendChild( e );
}
} // loadStylesheetInline function checkSpices( recipe ) {
var name = recipe._name;
if( ! book.queue[ name ] ) { var content = ['/* Chili -- ' + name + ' */'];
for (var blockName in recipe) {
if( blockName.search( /^_(?!main\b)/ ) < 0 ) {
for (var stepName in recipe[ blockName ]) {
var step = recipe[ blockName ][ stepName ];
if( '_style' in step ) {
if( step[ '_style' ].constructor == String ) {
content.push( '.' + name + '__' + stepName + ' { ' + step[ '_style' ] + ' }' );
}
else {
for (var className in step[ '_style' ]) {
content.push( '.' + name + '__' + className + ' { ' + step[ '_style' ][ className ] + ' }' );
}
}
}
}
}
}
content = content.join('\n'); loadStylesheetInline( content ); book.queue[ name ] = true;
}
} // checkSpices function askDish( el ) {
var recipeName = book.codeLanguage( el );
if( '' != recipeName ) {
var path = getPath( recipeName );
if( book.recipeLoading ) {
/* dynamic setups come here */
if( ! book.queue[ path ] ) {
/* this is a new recipe to download */
try {
book.queue[ path ] = [ el ];
$.getJSON( path, function( recipeLoaded ) {
book.recipes[ path ] = recipeLoaded;
var q = book.queue[ path ];
for( var i = 0, iTop = q.length; i < iTop; i++ ) {
makeDish( q[ i ], path );
}
} );
}
catch( recipeNotAvailable ) {
alert( "the recipe for '" + recipeName + "' was not found in '" + path + "'" );
}
}
else {
/* not a new recipe, so just enqueue this element */
book.queue[ path ].push( el );
}
/* a recipe could have been already downloaded */
makeDish( el, path );
}
else {
/* static setups come here */
makeDish( el, path );
}
}
} // askDish function makeDish( el, recipePath ) {
var recipe = book.recipes[ recipePath ];
if( ! recipe ) {
return;
}
var $el = $( el );
var ingredients = $el.text();
if( ! ingredients ) {
return;
} //fix for msie: \r (13) is used instead of \n (10)
//fix for opera: \r\n is used instead of \n
ingredients = ingredients.replace(/\r\n?/g, "\n"); //reverse fix for safari: msie, mozilla and opera render the initial \n
if( $el.parent().is('pre') ) {
/*
if( ! $.browser.safari ) {
ingredients = ingredients.replace(/^\n/g, "");
}
*/
} var dish = cook( ingredients, recipe ); // all happens here if( book.replaceTab ) {
dish = dish.replace( /\t/g, book.replaceTab );
}
if( book.replaceNewLine ) {
dish = dish.replace( /\n/g, book.replaceNewLine );
} el.innerHTML = dish; //much faster than $el.html( dish );
//tried also the function replaceHtml from http://blog.stevenlevithan.com/archives/faster-than-innerhtml
//but it was not faster nor without sideffects (it was not possible to count spans into el) //opera and safari select PRE text correctly
/*
if( $.browser.msie || $.browser.mozilla ) {
enableSelectionHelper( el );
}
*/
var $that = $el.parent();
var classes = $that.attr( 'class' );
var ln = /ln-(\d+)-([\w][\w\-]*)|ln-(\d+)|ln-/.exec( classes );
if( ln ) {
addLineNumbers( el );
var start = 0;
if( ln[1] ) {
start = parseInt( ln[1], 10 );
var $pieces = $( '.ln-' + ln[1] + '-' + ln[2] );
var pos = $pieces.index( $that[0] );
$pieces.slice( 0, pos ).each( function() {
start += $( this ).find( 'li' ).length;
} );
}
else if( ln[3] ) {
start = parseInt( ln[3], 10 );
}
else {
start = 1;
}
$el.find( 'ol' )[0].start = start;
$('body').width( $('body').width() - 1 ).width( $('body').width() + 1 );
}
else if( book.lineNumbers ) {
addLineNumbers( el );
} } // makeDish function enableSelectionHelper( el ) {
return false; //disable the selection helper
var element = null;
$( el )
.parents()
.filter( "pre" )
.bind( "mousedown", function() {
element = this;
if( $.browser.msie ) {
document.selection.empty();
}
else {
window.getSelection().removeAllRanges();
}
} )
.bind( "mouseup", function( event ) {
if( element && (element == this) ) {
element = null;
var selected = '';
if( $.browser.msie ) {
selected = document.selection.createRange().htmlText;
if( '' == selected ) {
return;
}
selected = preserveNewLines( selected );
var container_tag = '<textarea style="STYLE">';
}
else {
selected = window.getSelection().toString(); //opera doesn't select new lines
if( '' == selected ) {
return;
}
selected = selected
.replace( /\r/g, '' )
.replace( /^# ?/g, '' )
.replace( /\n# ?/g, '\n' )
;
var container_tag = '<pre style="STYLE">';
}
var $container = $( container_tag.replace( /\bSTYLE\b/, ChiliBook.selectionStyle ) )
.appendTo( 'body' )
.text( selected )
.attr( 'id', 'chili_selection' )
.click( function() { $(this).remove(); } )
;
var top = event.pageY - Math.round( $container.height() / 2 ) + "px";
var left = event.pageX - Math.round( $container.width() / 2 ) + "px";
$container.css( { top: top, left: left } );
if( $.browser.msie ) {
// window.clipboardData.setData( 'Text', selected ); //I couldn't find anything similar for Mozilla
$container[0].focus();
$container[0].select();
}
else {
var s = window.getSelection();
s.removeAllRanges();
var r = document.createRange();
r.selectNodeContents( $container[0] );
s.addRange( r );
}
}
} )
;
} // enableSelectionHelper function getPath( recipeName ) {
return book.recipeFolder + recipeName + ".js";
} // getPath function getSelectedText() {
var text = '';
if( $.browser.msie ) {
text = document.selection.createRange().htmlText;
}
else {
text = window.getSelection().toString();
}
return text;
} // getSelectedText function preserveNewLines( html ) {
do {
var newline_flag = ChiliBook.unique();
}
while( html.indexOf( newline_flag ) > -1 );
var text = '';
if (/<br/i.test(html) || /<li/i.test(html)) {
if (/<br/i.test(html)) {
html = html.replace( /\<br[^>]*?\>/ig, newline_flag );
}
else if (/<li/i.test(html)) {
html = html.replace( /<ol[^>]*?>|<\/ol>|<li[^>]*?>/ig, '' ).replace( /<\/li>/ig, newline_flag );
}
var el = $( '<pre>' ).appendTo( 'body' ).hide()[0];
el.innerHTML = html;
text = $( el ).text().replace( new RegExp( newline_flag, "g" ), '\r\n' );
$( el ).remove();
}
return text;
} // preserveNewLines function addLineNumbers( el ) { function makeListItem1( not_last_line, not_last, last, open ) {
var close = open ? '</span>' : '';
var aux = '';
if( not_last_line ) {
aux = '<li>' + open + not_last + close + '</li>';
}
else if( last ) {
aux = '<li>' + open + last + close + '</li>';
}
return aux;
} // makeListItem1 function makeListItem2( not_last_line, not_last, last, prev_li ) {
var aux = '';
if( prev_li ) {
aux = prev_li;
}
else {
aux = makeListItem1( not_last_line, not_last, last, '' )
}
return aux;
} // makeListItem2 var html = $( el ).html();
var br = /<br>/.test(html) ? '<br>' : '<BR>';
var empty_line = '<li>' + book.replaceSpace + '</li>';
var list_items = html
//extract newlines at the beginning of a span
.replace( /(<span [^>]+>)((?:(?: |\xA0)<br>)+)(.*?)(<\/span>)/ig, '$2$1$3$4' ) // I don't know why <span .*?> does not work here
//transform newlines inside of a span
.replace( /(.*?)(<span .*?>)(.*?)(?:<\/span>(?: |\xA0)<br>|<\/span>)/ig, // but here it does
function( all, before, open, content ) {
if (/<br>/i.test(content)) {
var pieces = before.split( br );
var lastPiece = pieces.pop();
before = pieces.join( br );
var aux = (before ? before + br : '') //+ replace1( lastPiece + content, open );
+ (lastPiece + content).replace( /((.*?)(?: |\xA0)<br>)|(.*)/ig,
function( tmp, not_last_line, not_last, last ) {
var aux2 = makeListItem1( not_last_line, not_last, last, open );
return aux2;
}
);
return aux;
}
else {
return all;
}
}
)
//transform newlines outside of a span
.replace( /(<li>.*?<\/li>)|((.*?)(?: |\xA0)<br>)|(.+)/ig,
function( tmp, prev_li, not_last_line, not_last, last ) {
var aux2 = makeListItem2( not_last_line, not_last, last, prev_li );
return aux2;
}
)
//fix empty lines for Opera
.replace( /<li><\/li>/ig, empty_line )
; el.innerHTML = '<ol>' + list_items + '</ol>';
} // addLineNumbers function revealChars( tmp ) {
return $
.map( tmp.split(''),
function(n, i) {
return ' ' + n + ' ' + n.charCodeAt( 0 ) + ' ';
} )
.join(' ');
} // revealChars //-----------------------------------------------------------------------------
// the coloring starts here
this
.each( function() {
var $this = $( this );
$this.trigger( 'chili.before_coloring' );
askDish( this );
$this.trigger( 'chili.after_coloring' );
} ); return this;
//-----------------------------------------------------------------------------
}; //main
$( function() { if( ChiliBook.automatic ) {
$( ChiliBook.automaticSelector ).chili();
} } ); } ) ( jQuery );

  recipes.js

/*
===============================================================================
Chili is the jQuery code highlighter plugin
...............................................................................
LICENSE: http://www.opensource.org/licenses/mit-license.php
WEBSITE: http://noteslog.com/chili/ Copyright 2008 / Andrea Ercolino
===============================================================================
*/ ChiliBook.recipeLoading = false; ChiliBook.recipes[ "php.js" ] =
/* ----------------------------------------------------------------------------
* this recipe uses a little trick for highlighting php code
* 1: replace each php snippet with a placeholder
* 2: highlight html without php and php snippets apart
* 3: replace each placeholder with its highlighted php snippet
*
* the trick is not perfect only if the html without php is broken
* however, in such a case many highlighters get fooled but Chili does not
*
* ---
* this recipe has been adapted for working with Safari
* in fact, Safari cannot match more than 101236 characters with a lazy star
* --------------------------------------------------------------------------*/
{
_name: "php"
, _case: true
, _main: {
all: {
_match: /[\w\W]*/
, _replace: function( all ) {
var placeholder = String.fromCharCode(0);
var blocks = [];
var that = this;
var no_php_1 = all.replace( /<\?[^?]*\?+(?:[^>][^?]*\?+)*>/g, function( block ) {
blocks.push( that.x( block, '/block/php_1' ) );
return placeholder;
} );
var no_php_2 = no_php_1.replace( /^[^?]*\?+(?:[^>][^?]*\?+)*>|<\?[\w\W]*$/g, function( block ) {
blocks.push( that.x( block, '/block/php_2' ) );
return placeholder;
} );
if( blocks.length ) {
var html = this.x( no_php_2, 'html' );
var count = 0;
return html.replace( new RegExp( placeholder, "g" ), function() {
return blocks[ count++ ];
} );
}
else {
return this.x( all, '/php' );
}
}
}
}
, block: {
php_1: { // --- <? +++ ?> ---
_match: /(<\?(?:php\b)?)([^?]*\?+(?:[^>][^?]*\?+)*>)/
, _replace: function( all, open, content ) {
return "<span class='start'>" + this.x( open ) + "</span>"
+ this.x( content.replace( /\?>$/, '' ), '/php' )
+ "<span class='end'>" + this.x( '?>' ) + "</span>";
}
, _style: {
start: "color: red; font-weight: bold"
, end: "color: red;"
}
}
, php_2: { // +++ ?> --- <? +++
_match: /([^?]*\?+(?:[^>][^?]*\?+)*>)|(<\?(?:php\b)?)([\w\W]*)/
, _replace: function( all, content, open2, content2 ) {
if( open2 ) {
return "<span class='start'>" + this.x( open2 ) + "</span>"
+ this.x( content2, '/php' );
}
else {
return this.x( content.replace( /\?>$/, '' ), '/php' )
+ "<span class='end'>" + this.x( '?>' ) + "</span>";
}
}
, _style: {
start: "color: red; font-weight: bold"
, end: "color: red;"
}
}
}
, php: {
mlcom: {
_match: /\/\*[^*]*\*+([^\/][^*]*\*+)*\//
, _style: "color: gray;"
}
, com: {
_match: /(?:\/\/.*)|(?:[^\\]\#.*)/
, _style: "color: green;"
}
, string1: {
_match: /\'[^\'\\]*(?:\\.[^\'\\]*)*\'/
, _style: "color: purple;"
}
, string2: {
_match: /\"[^\"\\]*(?:\\.[^\"\\]*)*\"/
, _style: "color: fuchsia;"
}
, value: {
_match: /\b(?:[Nn][Uu][Ll][Ll]|[Tt][Rr][Uu][Ee]|[Ff][Aa][Ll][Ss][Ee])\b/
, _style: "color: gray; font-weight: bold;"
}
, number: {
_match: /\b[+-]?(\d*\.?\d+|\d+\.?\d*)([eE][+-]?\d+)?\b/
, _style: "color: red;"
}
, const1: {
_match: /\b(?:DEFAULT_INCLUDE_PATH|E_(?:ALL|CO(?:MPILE_(?:ERROR|WARNING)|RE_(?:ERROR|WARNING))|ERROR|NOTICE|PARSE|STRICT|USER_(?:ERROR|NOTICE|WARNING)|WARNING)|P(?:EAR_(?:EXTENSION_DIR|INSTALL_DIR)|HP_(?:BINDIR|CONFIG_FILE_(?:PATH|SCAN_DIR)|DATADIR|E(?:OL|XTENSION_DIR)|INT_(?:MAX|SIZE)|L(?:IBDIR|OCALSTATEDIR)|O(?:S|UTPUT_HANDLER_(?:CONT|END|START))|PREFIX|S(?:API|HLIB_SUFFIX|YSCONFDIR)|VERSION))|__COMPILER_HALT_OFFSET__)\b/
, _style: "color: red;"
}
, const2: {
_match: /\b(?:A(?:B(?:DAY_(?:1|2|3|4|5|6|7)|MON_(?:1(?:0|1|2|)|2|3|4|5|6|7|8|9))|LT_DIGITS|M_STR|SSERT_(?:ACTIVE|BAIL|CALLBACK|QUIET_EVAL|WARNING))|C(?:ASE_(?:LOWER|UPPER)|HAR_MAX|O(?:DESET|NNECTION_(?:ABORTED|NORMAL|TIMEOUT)|UNT_(?:NORMAL|RECURSIVE))|R(?:EDITS_(?:ALL|DOCS|FULLPAGE|G(?:ENERAL|ROUP)|MODULES|QA|SAPI)|NCYSTR|YPT_(?:BLOWFISH|EXT_DES|MD5|S(?:ALT_LENGTH|TD_DES)))|URRENCY_SYMBOL)|D(?:AY_(?:1|2|3|4|5|6|7)|ECIMAL_POINT|IRECTORY_SEPARATOR|_(?:FMT|T_FMT))|E(?:NT_(?:COMPAT|NOQUOTES|QUOTES)|RA(?:_(?:D_(?:FMT|T_FMT)|T_FMT|YEAR)|)|XTR_(?:IF_EXISTS|OVERWRITE|PREFIX_(?:ALL|I(?:F_EXISTS|NVALID)|SAME)|SKIP))|FRAC_DIGITS|GROUPING|HTML_(?:ENTITIES|SPECIALCHARS)|IN(?:FO_(?:ALL|C(?:ONFIGURATION|REDITS)|ENVIRONMENT|GENERAL|LICENSE|MODULES|VARIABLES)|I_(?:ALL|PERDIR|SYSTEM|USER)|T_(?:CURR_SYMBOL|FRAC_DIGITS))|L(?:C_(?:ALL|C(?:OLLATE|TYPE)|M(?:ESSAGES|ONETARY)|NUMERIC|TIME)|O(?:CK_(?:EX|NB|SH|UN)|G_(?:A(?:LERT|UTH(?:PRIV|))|C(?:ONS|R(?:IT|ON))|D(?:AEMON|EBUG)|E(?:MERG|RR)|INFO|KERN|L(?:OCAL(?:0|1|2|3|4|5|6|7)|PR)|MAIL|N(?:DELAY|EWS|O(?:TICE|WAIT))|ODELAY|P(?:ERROR|ID)|SYSLOG|U(?:SER|UCP)|WARNING)))|M(?:ON_(?:1(?:0|1|2|)|2|3|4|5|6|7|8|9|DECIMAL_POINT|GROUPING|THOUSANDS_SEP)|_(?:1_PI|2_(?:PI|SQRTPI)|E|L(?:N(?:10|2)|OG(?:10E|2E))|PI(?:_(?:2|4)|)|SQRT(?:1_2|2)))|N(?:EGATIVE_SIGN|O(?:EXPR|STR)|_(?:CS_PRECEDES|S(?:EP_BY_SPACE|IGN_POSN)))|P(?:ATH(?:INFO_(?:BASENAME|DIRNAME|EXTENSION)|_SEPARATOR)|M_STR|OSITIVE_SIGN|_(?:CS_PRECEDES|S(?:EP_BY_SPACE|IGN_POSN)))|RADIXCHAR|S(?:EEK_(?:CUR|END|SET)|ORT_(?:ASC|DESC|NUMERIC|REGULAR|STRING)|TR_PAD_(?:BOTH|LEFT|RIGHT))|T(?:HOUS(?:ANDS_SEP|EP)|_FMT(?:_AMPM|))|YES(?:EXPR|STR))\b/
, _style: "color: red;"
}
, global: {
_match: /(?:\$GLOBALS|\$_COOKIE|\$_ENV|\$_FILES|\$_GET|\$_POST|\$_REQUEST|\$_SERVER|\$_SESSION|\$php_errormsg)\b/
, _style: "color: red;"
}
, keyword: {
_match: /\b(?:__CLASS__|__FILE__|__FUNCTION__|__LINE__|__METHOD__|abstract|and|array|as|break|case|catch|cfunction|class|clone|const|continue|declare|default|die|do|echo|else|elseif|empty|enddeclare|endfor|endforeach|endif|endswitch|endwhile|eval|exception|exit|extends|extends|final|for|foreach|function|global|if|implements|include|include_once|interface|isset|list|new|old_function|or|php_user_filter|print|private|protected|public|require|require_once|return|static|switch|this|throw|try|unset|use|var|while|xor)\b/
, _style: "color: navy; font-weight: bold;"
}
, variable: {
_match: /\$(\w+)/
, _replace: '<span class="keyword">$</span><span class="variable">$1</span>'
, _style: "color: #4040c2;"
}
, heredoc: {
_match: /(\<\<\<\s*)(\w+)((?:(?!\2).*\n)+)(\2)\b/
, _replace: '<span class="keyword">$1</span><span class="string1">$2</span><span class="string2">$3</span><span class="string1">$4</span>'
}
}
} ChiliBook.recipes[ "html.js" ] =
{
_name: 'html'
, _case: false
, _main: {
doctype: {
_match: /<!DOCTYPE\b[\w\W]*?>/
, _style: "color: #CC6600;"
}
, ie_style: {
_match: /(<!--\[[^\]]*\]>)([\w\W]*?)(<!\[[^\]]*\]-->)/
, _replace: function( all, open, content, close ) {
return "<span class='ie_style'>" + this.x( open ) + "</span>"
+ this.x( content, '//style' )
+ "<span class='ie_style'>" + this.x( close ) + "</span>";
}
, _style: "color: DarkSlateGray; font-weight: bold;"
}
, comment: {
_match: /<!--[\w\W]*?-->/
, _style: "color: #4040c2;"
}
, script: {
_match: /(<script\s+[^>]*>)([\w\W]*?)(<\/script\s*>)/
, _replace: function( all, open, content, close ) {
return this.x( open, '//tag_start' )
+ this.x( content, 'js' )
+ this.x( close, '//tag_end' );
}
}
, style: {
_match: /(<style\s+[^>]*>)([\w\W]*?)(<\/style\s*>)/
, _replace: function( all, open, content, close ) {
return this.x( open, '//tag_start' )
+ this.x( content, 'css' )
+ this.x( close, '//tag_end' );
}
}
// matches a starting tag of an element (with attrs)
// like "<div ... >" or "<img ... />"
, tag_start: {
_match: /(<\w+)((?:[?%]>|[\w\W])*?)(\/>|>)/
, _replace: function( all, open, content, close ) {
return "<span class='tag_start'>" + this.x( open ) + "</span>"
+ this.x( content, '/tag_attrs' )
+ "<span class='tag_start'>" + this.x( close ) + "</span>";
}
, _style: "color: navy; font-weight: bold;"
}
// matches an ending tag
// like "</div>"
, tag_end: {
_match: /<\/\w+\s*>|\/>/
, _style: "color: navy;"
}
, entity: {
_match: /&\w+?;/
, _style: "color: blue;"
}
}
, tag_attrs: {
// matches a name/value pair
attr: {
// before in $1, name in $2, between in $3, value in $4
_match: /(\W*?)([\w-]+)(\s*=\s*)((?:\'[^\']*(?:\\.[^\']*)*\')|(?:\"[^\"]*(?:\\.[^\"]*)*\"))/
, _replace: "$1<span class='attr_name'>$2</span>$3<span class='attr_value'>$4</span>"
, _style: { attr_name: "color: green;", attr_value: "color: maroon;" }
}
}
}; ChiliBook.recipes[ "js.js" ] =
{
_name: 'js'
, _case: true
, _main: {
ml_comment: {
_match: /\/\*[^*]*\*+(?:[^\/][^*]*\*+)*\//
, _style: 'color: gray;'
}
, sl_comment: {
_match: /\/\/.*/
, _style: 'color: green;'
}
, string: {
_match: /(?:\'[^\'\\\n]*(?:\\.[^\'\\\n]*)*\')|(?:\"[^\"\\\n]*(?:\\.[^\"\\\n]*)*\")/
, _style: 'color: teal;'
}
, num: {
_match: /\b[+-]?(?:\d*\.?\d+|\d+\.?\d*)(?:[eE][+-]?\d+)?\b/
, _style: 'color: red;'
}
, reg_not: { //this prevents "a / b / c" to be interpreted as a reg_exp
_match: /(?:\w+\s*)\/[^\/\\\n]*(?:\\.[^\/\\\n]*)*\/[gim]*(?:\s*\w+)/
, _replace: function( all ) {
return this.x( all, '//num' );
}
}
, reg_exp: {
_match: /\/[^\/\\\n]*(?:\\.[^\/\\\n]*)*\/[gim]*/
, _style: 'color: maroon;'
}
, brace: {
_match: /[\{\}]/
, _style: 'color: red; font-weight: bold;'
}
, statement: {
_match: /\b(with|while|var|try|throw|switch|return|if|for|finally|else|do|default|continue|const|catch|case|break)\b/
, _style: 'color: navy; font-weight: bold;'
}
, error: {
_match: /\b(URIError|TypeError|SyntaxError|ReferenceError|RangeError|EvalError|Error)\b/
, _style: 'color: Coral;'
}
, object: {
_match: /\b(String|RegExp|Object|Number|Math|Function|Date|Boolean|Array)\b/
, _style: 'color: DeepPink;'
}
, property: {
_match: /\b(undefined|arguments|NaN|Infinity)\b/
, _style: 'color: Purple; font-weight: bold;'
}
, 'function': {
_match: /\b(parseInt|parseFloat|isNaN|isFinite|eval|encodeURIComponent|encodeURI|decodeURIComponent|decodeURI)\b/
, _style: 'color: olive;'
}
, operator: {
_match: /\b(void|typeof|this|new|instanceof|in|function|delete)\b/
, _style: 'color: RoyalBlue; font-weight: bold;'
}
, liveconnect: {
_match: /\b(sun|netscape|java|Packages|JavaPackage|JavaObject|JavaClass|JavaArray|JSObject|JSException)\b/
, _style: 'text-decoration: overline;'
}
}
}; ChiliBook.recipes[ "css.js" ] =
{
_name: 'css'
, _case: true
, _main: {
comment: {
_match: /\/\*[^*]*\*+(?:[^\/][^*]*\*+)*\//
, _style: "color: olive;"
}
, directive: {
_match: /@\w+/
, _style: "color: fuchsia;"
}
, url: {
_match: /\b(url\s*\()([^)]+)(\))/
, _replace: "<span class='url'>$1</span>$2<span class='url'>$3</span>"
, _style: "color: fuchsia;"
}
, block: {
_match: /\{([\w\W]*?)\}/
, _replace: function( all, pairs ) {
return '{' + this.x( pairs, '/definition' ) + '}';
}
}
, 'class': {
_match: /\.\w+/
, _style: "color: #CC0066; font-weight: bold;"
}
, id: {
_match: /#\w+/
, _style: "color: IndianRed; font-weight: bold;"
}
, pseudo: {
_match: /:\w+/
, _style: "color: #CC9900;"
}
, element: {
_match: /\w+/
, _style: "color: Purple; font-weight: bold;"
}
}
, definition: {
comment: {
_match: /\/\*[^*]*\*+(?:[^\/][^*]*\*+)*\//
}
, property: {
_match: /\b(?:zoom|z-index|writing-mode|word-wrap|word-spacing|word-break|width|widows|white-space|volume|voice-family|visibility|vertical-align|unicode-bidi|top|text-underline-position|text-transform|text-shadow|text-overflow|text-kashida-space|text-justify|text-indent|text-decoration|text-autospace|text-align-last|text-align|table-layout|stress|speech-rate|speak-punctuation|speak-numeral|speak-header|speak|size|scrollbar-track-color|scrollbar-shadow-color|scrollbar-highlight-color|scrollbar-face-color|scrollbar-dark-shadow-color|scrollbar-base-color|scrollbar-arrow-color|scrollbar-3d-light-color|ruby-position|ruby-overhang|ruby-align|right|richness|quotes|position|play-during|pitch-range|pitch|pause-before|pause-after|pause|page-break-inside|page-break-before|page-break-after|page|padding-top|padding-right|padding-left|padding-bottom|padding|overflow-Y|overflow-X|overflow|outline-width|outline-style|outline-color|outline|orphans|min-width|min-height|max-width|max-height|marks|marker-offset|margin-top|margin-right|margin-left|margin-bottom|margin|list-style-type|list-style-position|list-style-image|list-style|line-height|line-break|letter-spacing|left|layout-grid-type|layout-grid-mode|layout-grid-line|layout-grid-char-spacing|layout-grid-char|layout-grid|layout-flow|layer-background-image|layer-background-color|include-source|ime-mode|height|font-weight|font-variant|font-style|font-stretch|font-size-adjust|font-size|font-family|font|float|filter|empty-cells|elevation|display|direction|cursor|cue-before|cue-after|cue|counter-reset|counter-increment|content|color|clip|clear|caption-side|bottom|border-width|border-top-width|border-top-style|border-top-color|border-top|border-style|border-spacing|border-right-width|border-right-style|border-right-color|border-right|border-left-width|border-left-style|border-left-color|border-left|border-color|border-collapse|border-bottom-width|border-bottom-style|border-bottom-color|border-bottom|border|behavior|background-repeat|background-position-y|background-position-x|background-position|background-image|background-color|background-attachment|background|azimuth|accelerator)\s*:/
, _style: "color: #330066;"
}
, special: {
_match: /\b(?:-use-link-source|-set-link-source|-replace|-moz-user-select|-moz-user-modify|-moz-user-input|-moz-user-focus|-moz-outline-width|-moz-outline-style|-moz-outline-color|-moz-outline|-moz-opacity|-moz-border-top-colors|-moz-border-right-colors|-moz-border-radius-topright|-moz-border-radius-topleft|-moz-border-radius-bottomright|-moz-border-radius-bottomleft|-moz-border-radius|-moz-border-left-colors|-moz-border-bottom-colors|-moz-binding)\s*:/
, _style: "color: #330066; text-decoration: underline;"
}
, url: {
_match: /\b(url\s*\()([^)]+)(\))/
, _replace: "<span class='url'>$1</span>$2<span class='url'>$3</span>"
}
, value: {
_match: /\b(?:xx-small|xx-large|x-soft|x-small|x-slow|x-low|x-loud|x-large|x-high|x-fast|wider|wait|w-resize|visible|url|uppercase|upper-roman|upper-latin|upper-alpha|underline|ultra-expanded|ultra-condensed|tv|tty|transparent|top|thin|thick|text-top|text-bottom|table-row-group|table-row|table-header-group|table-footer-group|table-column-group|table-column|table-cell|table-caption|sw-resize|super|sub|status-bar|static|square|spell-out|speech|solid|soft|smaller|small-caption|small-caps|small|slower|slow|silent|show|separate|semi-expanded|semi-condensed|se-resize|scroll|screen|s-resize|run-in|rtl|rightwards|right-side|right|ridge|rgb|repeat-y|repeat-x|repeat|relative|projection|print|pre|portrait|pointer|overline|outside|outset|open-quote|once|oblique|nw-resize|nowrap|normal|none|no-repeat|no-open-quote|no-close-quote|ne-resize|narrower|n-resize|move|mix|middle|message-box|medium|marker|ltr|lowercase|lower-roman|lower-latin|lower-greek|lower-alpha|lower|low|loud|local|list-item|line-through|lighter|level|leftwards|left-side|left|larger|large|landscape|justify|italic|invert|inside|inset|inline-table|inline|icon|higher|high|hide|hidden|help|hebrew|handheld|groove|format|fixed|faster|fast|far-right|far-left|fantasy|extra-expanded|extra-condensed|expanded|embossed|embed|e-resize|double|dotted|disc|digits|default|decimal-leading-zero|decimal|dashed|cursive|crosshair|cross|crop|counters|counter|continuous|condensed|compact|collapse|code|close-quote|circle|center-right|center-left|center|caption|capitalize|braille|bottom|both|bolder|bold|block|blink|bidi-override|below|behind|baseline|avoid|auto|aural|attr|armenian|always|all|absolute|above)\b/
, _style: "color: #3366FF;"
}
, string: {
_match: /(?:\'[^\'\\\n]*(?:\\.[^\'\\\n]*)*\')|(?:\"[^\"\\\n]*(?:\\.[^\"\\\n]*)*\")/
, _style: "color: teal;"
}
, number: {
_match: /(?:\b[+-]?(?:\d*\.?\d+|\d+\.?\d*))(?:%|(?:(?:px|pt|em|)\b))/
, _style: "color: red;"
}
, color : {
_match: /(?:\#[a-fA-F0-9]{3,6})|\b(?:yellow|white|teal|silver|red|purple|olive|navy|maroon|lime|green|gray|fuchsia|blue|black|aqua|YellowGreen|Yellow|WhiteSmoke|White|Wheat|Violet|Turquoise|Tomato|Thistle|Teal|Tan|SteelBlue|SpringGreen|Snow|SlateGrey|SlateGray|SlateBlue|SkyBlue|Silver|Sienna|SeaShell|SeaGreen|SandyBrown|Salmon|SaddleBrown|RoyalBlue|RosyBrown|Red|Purple|PowderBlue|Plum|Pink|Peru|PeachPuff|PapayaWhip|PaleVioletRed|PaleTurquoise|PaleGreen|PaleGoldenRod|Orchid|OrangeRed|Orange|OliveDrab|Olive|OldLace|Navy|NavajoWhite|Moccasin|MistyRose|MintCream|MidnightBlue|MediumVioletRed|MediumTurquoise|MediumSpringGreen|MediumSlateBlue|MediumSeaGreen|MediumPurple|MediumOrchid|MediumBlue|MediumAquaMarine|Maroon|Magenta|Linen|LimeGreen|Lime|LightYellow|LightSteelBlue|LightSlateGrey|LightSlateGray|LightSkyBlue|LightSeaGreen|LightSalmon|LightPink|LightGrey|LightGreen|LightGray|LightGoldenRodYellow|LightCyan|LightCoral|LightBlue|LemonChiffon|LawnGreen|LavenderBlush|Lavender|Khaki|Ivory|Indigo|IndianRed|HotPink|HoneyDew|Grey|GreenYellow|Green|Gray|GoldenRod|Gold|GhostWhite|Gainsboro|Fuchsia|ForestGreen|FloralWhite|FireBrick|DodgerBlue|DimGrey|DimGray|DeepSkyBlue|DeepPink|Darkorange|DarkViolet|DarkTurquoise|DarkSlateGrey|DarkSlateGray|DarkSlateBlue|DarkSeaGreen|DarkSalmon|DarkRed|DarkOrchid|DarkOliveGreen|DarkMagenta|DarkKhaki|DarkGrey|DarkGreen|DarkGray|DarkGoldenRod|DarkCyan|DarkBlue|Cyan|Crimson|Cornsilk|CornflowerBlue|Coral|Chocolate|Chartreuse|CadetBlue|BurlyWood|Brown|BlueViolet|Blue|BlanchedAlmond|Black|Bisque|Beige|Azure|Aquamarine|Aqua|AntiqueWhite|AliceBlue)\b/
, _style: "color: green;"
}
}
};

  

<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="initial-scale=1.0, user-scalable=no" />
<meta http-equiv="content-type" content="text/html; charset=UTF-8"/>
<title>Search / goMap</title>
<link type="text/css" href="../main.css" rel="stylesheet" />
<script type="text/javascript" src="http://maps.google.com/maps/api/js?sensor=false"></script>
<script type="text/javascript" src="../js/jquery-1.11.1.min.js"></script>
<script type="text/javascript" src="../js/jquery.gomap-1.3.3.js"></script>
<script type="text/javascript" src="../js/jquery.dump.js"></script>
<script type="text/javascript" src="../js/jquery.chili-2.2.js"></script>
<script type="text/javascript" src="../js/recipes.js"></script>
<script type="text/javascript">
$(function() {
var lat = 56.946536;
var lon = 24.10485;
var zoom = 8; $("#map").goMap({
scaleControl: true,
maptype: 'ROADMAP',
streetViewControl: false,
zoom: zoom,
markers: [{
id: 'address',
latitude: lat,
longitude: lon,
draggable: true
}]
}); // $("#message").appendTo('#dialogMap').show(); $.goMap.createListener({type:'marker', marker:'address'}, 'position_changed', function() {
$("#latlon").val($($.goMap.mapId).data('address').getPosition().toUrlValue());
}); $("#search_map").click(function() {
if($("#map_address").val() == "")
alert("Address is empty!")
else {
var _address = $.goMap.createListener({type:'marker', marker:'address'}, 'position_changed', function() {
$.goMap.fitBounds();
$.goMap.removeListener(_address);
$.goMap.setMap({zoom:17});
}); $.goMap.setMarker('address', {address:$("#map_address").val()});
}
return false;
}); });
</script>
<style>
.gomapMarker {
width:30px;
height:200px;
display:block;
}
</style>
</head>
<body>
<div id="wrap">
<div id="header">
<div id="logo"><h1><b>$.goMap()</b> / search</h1> google maps jQuery plugn</div>
<div id="menu">
<a href="../solutions.php">→ Back</a>
</div>
</div>
<div id="content">
<b>$.goMap()</b> is <a href="http://www.jquery.com/">jQuery</a> plugin useing <a href="http://code.google.com/apis/maps/documentation/javascript/">Google Maps v3</a>.
<h3>Simple example</h3>
<input type="text" name="map_address" value="" id="map_address" /> <input type="button" name="search_map" value="Search" id="search_map" />
<br/>
<input type="text" name="latlon" value="" id="latlon" readonly/>
<br/>
<style>
em, .map, #map2 {
width:100%;
margin:0 auto;
height:400px;
display:block;
}
</style>
<br/>
<div id="map"></div> <div id="footer">pittss © / contacts: pittss@gmail.com</div>
</div>
</div>
</body>
</html>

  

<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="initial-scale=1.0, user-scalable=no" />
<meta http-equiv="content-type" content="text/html; charset=UTF-8"/>
<title>group / goMap</title>
<link type="text/css" href="../main.css" rel="stylesheet" />
<script type="text/javascript" src="http://maps.google.com/maps/api/js?sensor=false"></script>
<script type="text/javascript" src="../js/jquery-1.5.1.min.js"></script>
<script type="text/javascript" src="../js/jquery.gomap-1.3.1.js"></script>
<script type="text/javascript" src="../js/jquery.dump.js"></script>
<script type="text/javascript" src="../js/jquery.chili-2.2.js"></script>
<script type="text/javascript" src="../js/recipes.js"></script>
<script type="text/javascript">
$(function() { $("#map").goMap({
icon: '../img/apartment.png'
}); $.goMap.ready(function() {
var bounds = $.goMap.getBounds();
var southWest = bounds.getSouthWest();
var northEast = bounds.getNorthEast();
var lngSpan = northEast.lng() - southWest.lng();
var latSpan = northEast.lat() - southWest.lat(); for (var i = 0; i < 60; i++) { var group = 'g1';
var icon = 'http://www.google.com/intl/en_ALL/mapfiles/marker_green'+String.fromCharCode(i + 65)+'.png'; if(i > 50) {
group = 'g4';
icon = 'http://www.google.com/intl/en_ALL/mapfiles/marker_black'+String.fromCharCode((i-50) + 65)+'.png';
}
else if(i > 40) {
group = 'g3';
icon = 'http://www.google.com/intl/en_ALL/mapfiles/marker_orange'+String.fromCharCode((i-40) + 65)+'.png';
}
else if(i > 20) {
group = 'g2';
icon = 'http://www.google.com/intl/en_ALL/mapfiles/marker'+String.fromCharCode((i-20) + 65)+'.png';
} $.goMap.createMarker({
latitude: southWest.lat() + latSpan * Math.random(),
longitude: southWest.lng() + lngSpan * Math.random(),
group: group,
icon: icon });
} }); $("#group").change(function() {
var group = $(this).val(); if(group == 'all')
for (var i in $.goMap.markers) {
$.goMap.showHideMarker($.goMap.markers[i], true);
}
else {
for (var i in $.goMap.markers) {
$.goMap.showHideMarker($.goMap.markers[i], false);
} $.goMap.showHideMarkerByGroup(group, true);
} }); $("#count1").click(function(){
$("#map").goMap();
alert($.goMap.getMarkerCount());
}); });
</script>
</head>
<body>
<div id="wrap">
<div id="header">
<div id="logo"><h1><b>$.goMap()</b> / group</h1> google maps jQuery plugn</div>
<div id="menu">
<a href="../solutions.php">→ Back</a>
</div>
</div>
<div id="content">
<b>$.goMap()</b> is <a href="http://www.jquery.com/">jQuery v1.5</a> plugin useing <a href="http://code.google.com/apis/maps/documentation/javascript/">Google Maps v3</a>.
<h3>Simple example</h3>
<br/>
<style>
em, .map, #map2 {
width:100%;
margin:0 auto;
height:400px;
display:block;
}
</style>
<br/>
<select id="group">
<option value="all">Show all markers</option>
<option value="g1">Show only group "g1"</option>
<option value="g2">Show only group "g2"</option>
<option value="g3">Show only group "g3"</option>
<option value="g4">Show only group "g4"</option>
</select>
<input type="button" name="count1" value="count markers" id="count1" />
<div id="map"></div> <div id="footer">pittss © <?=date("Y");?> / contacts: pittss@gmail.com</div>
</div>
</div>
</body>
</html>

  

javascript: jquery.gomap-1.3.3.js的更多相关文章

  1. JavaScript、jQuery、HTML5、Node.js实例大全-读书笔记3

    技术很多,例子很多,只好慢慢学,慢慢实践!!现在学的这本书是[JavaScript实战----JavaScript.jQuery.HTML5.Node.js实例大全] JavaScript.jQuer ...

  2. JavaScript、jQuery、HTML5、Node.js实例大全-读书笔记2

    技术很多,例子很多,只好慢慢学,慢慢实践!!现在学的这本书是[JavaScript实战----JavaScript.jQuery.HTML5.Node.js实例大全] JavaScript.jQuer ...

  3. JavaScript、jQuery、HTML5、Node.js实例大全-读书笔记1

    技术很多,例子很多,只好慢慢学,慢慢实践!!现在学的这本书是[JavaScript实战----JavaScript.jQuery.HTML5.Node.js实例大全] 第 3 章 用 JavaScri ...

  4. Handlebars的基本用法 Handlebars.js使用介绍 http://handlebarsjs.com/ Handlebars.js 模板引擎 javascript/jquery模板引擎——Handlebars初体验 handlebars.js 入门(1) 作为一名前端的你,必须掌握的模板引擎:Handlebars 前端数据模板handlebars与jquery整

    Handlebars的基本用法 使用Handlebars,你可以轻松创建语义化模板,Mustache模板和Handlebars是兼容的,所以你可以将Mustache导入Handlebars以使用 Ha ...

  5. 【JavaScript框架封装】使用原生js封装的类似于JQuery的框架及核心源码分享(多文件版本)

    这个版本的JQuery是对上一个版本的JQuery,使用了require.js进行了二次封装,基本上把前面的每一个框架封装成为一个单独的模块,最终的目录结构如下: 由于代码量和目录比较多,这个封装好的 ...

  6. JavaScript jQuery 中定义数组与操作及jquery数组操作

    首先给大家介绍javascript jquery中定义数组与操作的相关知识,具体内容如下所示: 1.认识数组 数组就是某类数据的集合,数据类型可以是整型.字符串.甚至是对象Javascript不支持多 ...

  7. 用JavaScript动态加载CSS和JS文件

    本文转载自:http://www.cnblogs.com/xiaochaohuashengmi/archive/2011/11/14/2248451.html 今天项目中需要用到动态加载 CSS 文件 ...

  8. 在线运行Javascript,Jquery,HTML,CSS代码

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" http://www.w3.org/TR/xht ...

  9. Javascript模块化编程之路——(require.js)

    转自:http://www.ruanyifeng.com/blog/2012/10/javascript_module.html Javascript模块化编程(一):模块的写法 随着网站逐渐变成&q ...

随机推荐

  1. VC++ 学习笔记(一):如何开始

    毫无疑问,学习C++是一件痛苦的事情. 我大概十年前接触C++.那是在学校里,准备考研究生,某学校要求考C++.我就开始一点一点学习,学习的过程还是比较舒服的.不得不说,就古典C++的理论,钱老讲的还 ...

  2. mongodb_查询操作使用_条件查询、where子句等(转)

    <?php /*  mongodb_查询操作使用_条件查询.where子句等(转并学习)   1.find()/findOne() mongodb数据库的查询操作即使用find()或者findO ...

  3. 查看iOS模拟器应用的沙箱文件

    iOS 升级到8.3 以后就不能用iFunBox 这样的工具看沙箱里的文件了(非共享的), 而开发时我们的数据库文件又不在共享目录里.关于这个问题,我们可以看模拟器里的沙箱文件, iOS8.0 以后, ...

  4. IT战略规划咨询

    目录 1IT战略规划微咨询简介 2IT战略的意义 3服务模式 4IT战略规划焦点问题 5IT战略规划步骤 6服务提供方微咨询网 7微咨询价值 8微咨询服务方式 9IT工作规划与IT战略规... IT战 ...

  5. Oracle 11g EM安全证书问题无法访问的解决办法

    OS: Windows Server 2012 Oracle: 11g R2 上一篇 Oracle 11g EM删除重建的方法 通过命令的方式重建了EM,启动也成功 emctl status dbco ...

  6. 推荐几个学习Node的网址:

    推荐几个学习Node的网址: Nodejs 安装教程 http://jingyan.baidu.com/article/a948d6515d4c850a2dcd2e18.html http://nod ...

  7. Java中利用标签跳出外层循环break

    直接看代码: class ForLoop{ public static void main(String[] args){ //jump from outer loop outer:for(int i ...

  8. C# WinForm RDLC报表不预览直接连续打印

    用微软的RDLC报表直接打印不预览 直接上代码. //打印清单 System.Data.DataTable dt = print_QD(dr); ReportViewer rvDoc = new Re ...

  9. 自制Console线(已测试CISCO3560可用)

    D9的顺序是5口在上,4口在下.从右到左分别是1-5,6-9. 5 4 3 2 1 o o o o o o o o o 9 8 7 6 用万用表量出D9的口的对应颜色.然后按照下面的表.把颜色填写上. ...

  10. ExtJs Column 显示文字内容过长 使用Tootip显示全部内容

    { text: 'Column Header Blah', dataIndex: 'blah', renderer: function(value, metaData, record, rowIdx, ...