Browse Source

try to parse new google maps urls. Still don't know how to decode data parameter. see #638

pull/639/head
Joe Germuska 11 years ago
parent
commit
4ca046914d
  1. 12
      source/js/Core/Media/VMM.ExternalAPI.js
  2. 4
      source/js/Core/Media/VMM.MediaType.js

12
source/js/Core/Media/VMM.ExternalAPI.js

@ -514,7 +514,16 @@ if(typeof VMM != 'undefined' && typeof VMM.ExternalAPI == 'undefined') {
layer = google.maps.MapTypeId['TERRAIN']; layer = google.maps.MapTypeId['TERRAIN'];
} }
var new_google_url_regex = new RegExp(/@([0-9\.\-]+),([0-9\.\-]+),(\d+)z/);
if (m.id.match(new_google_url_regex)) {
var match = m.id.match(new_google_url_regex)
lat = parseFloat(match[1]);
lng = parseFloat(match[2]);
location = new google.maps.LatLng(lat,lng);
zoom = parseFloat(match[3]);
has_location = has_zoom = true;
} else {
if (type.of(VMM.Util.getUrlVars(m.id)["ll"]) == "string") { if (type.of(VMM.Util.getUrlVars(m.id)["ll"]) == "string") {
has_location = true; has_location = true;
latlong = VMM.Util.getUrlVars(m.id)["ll"].split(","); latlong = VMM.Util.getUrlVars(m.id)["ll"].split(",");
@ -529,6 +538,7 @@ if(typeof VMM != 'undefined' && typeof VMM.ExternalAPI == 'undefined') {
has_zoom = true; has_zoom = true;
zoom = parseFloat(VMM.Util.getUrlVars(m.id)["z"]); zoom = parseFloat(VMM.Util.getUrlVars(m.id)["z"]);
} }
}
map_options = { map_options = {
zoom: zoom, zoom: zoom,

4
source/js/Core/Media/VMM.MediaType.js

@ -88,6 +88,10 @@ if(typeof VMM != 'undefined' && typeof VMM.MediaType == 'undefined') {
media.type = "google-map"; media.type = "google-map";
media.id = d.split(/src=['|"][^'|"]*?['|"]/gi); media.id = d.split(/src=['|"][^'|"]*?['|"]/gi);
success = true; success = true;
} else if (d.match(/www.google.\w+\/maps/)) {
media.type = "google-map";
media.id = d;
success = true;
} else if (d.match("plus.google")) { } else if (d.match("plus.google")) {
media.type = "googleplus"; media.type = "googleplus";
media.id = d.split("/posts/")[1]; media.id = d.split("/posts/")[1];

Loading…
Cancel
Save