Skip to content

Instantly share code, notes, and snippets.

@naoyeye
Created November 28, 2018 03:12
Show Gist options
  • Save naoyeye/51d8e1117a73c7e23ff7100f39b78194 to your computer and use it in GitHub Desktop.
Save naoyeye/51d8e1117a73c7e23ff7100f39b78194 to your computer and use it in GitHub Desktop.
var newVisit = getCookie("dt") ? !1 : !0,
userName = getCookie("nm") || !1;
setCookie("dt", Math.round((new Date).getTime() / 1E3), 8760);
var G = google.maps,
map;
window.panorama = "";
var svClient = new G.StreetViewService,
geocoder = new G.Geocoder,
selfLocationRevert = 0,
selfLocationRevertThreshold = 3,
nradius = 200,
radius = nradius,
vDate, views = [],
rPositions = [],
markers = [],
globalPointer = 0,
globalSvPosition, initPos, hideWaitTime = 30,
totalViews = 0,
searchMarker, requests, activeSearches = -1,
cancelSearch = 0,
getPointsActive = 0,
countryID, contCount = [],
totalCountries = 0,
sTime, eTime, slideEvent, noPanoLoadEvent, panoFixEvent, uiHideEvent, dragging = !1,
auto = 0,
tour = 0,
autoRotateInterval = 5,
dSlideTime = 4,
maxSearches = 3,
maxLocations = 100,
myMap = 0,
inside = 0,
hideLocation = 0,
slideTime, markerDefaultIcon = "/images/marker_red.png",
markerActiveIcon = "/images/marker.png",
markerSearchIcon = "/images/marker_search.png",
initEvent, myMapEvent, hostVal = window.location.protocol + "//" + window.location.hostname + "/",
hostValHttp = "http://" + window.location.hostname + "/",
permLink, lrPos = {
latLng: new G.LatLng(59.531383, 8.636734),
pov: {
heading: 182.55,
pitch: 18.44,
zoom: 1
}
},
cache = {
geo: {},
rgeo: {}
},
spinOpts = {
lines: 12,
length: 8,
width: 4,
radius: 10,
color: "#fff",
speed: 3,
trail: 47,
shadow: !0,
hwaccel: !1,
className: "spinner",
zIndex: 2E14,
top: "auto",
left: "auto"
},
spinner = new Spinner(spinOpts);
$(document).ready(function() {
$(window).unload(unloadHandler);
spinner.spin($("#container").get(0));
vDate = jsDate ? new Date(jsDate) : !1;
var a = "" != initString ? parseLoc(initString) : !1,
a = a ? a : lrPos;
initPos = a.latLng;
a = {
zoomControlOptions: {
position: G.ControlPosition.RIGHT_BOTTOM,
style: G.ZoomControlStyle.SMALL
},
pov: a.pov,
addressControl: !1,
panControl: !0,
disableDefaultUI: !1,
motionTracking: !1,
motionTrackingControl: !1,
disableDoubleClickZoom: !1,
fullscreenControl: !1
};
panorama = new G.StreetViewPanorama(document.getElementById("pano"), a);
panorama.registerPanoProvider(function() {
return null
});
panorama.description = "";
a = {
center: initPos,
zoom: 5,
mapTypeId: G.MapTypeId.ROADMAP,
minZoom: 1,
maxZoom: 17,
streetViewControl: !0,
mapTypeControl: !1,
streetView: panorama,
fullscreenControl: !1
};
map = new G.Map(document.getElementById("map"), a);
(new G.StreetViewCoverageLayer).setMap(map);
$(window).resize($.debounce(20, function() {
elementResize()
}));
a = window.location.href;
"?" == a[a.length - 1] && setTimeout("window.history.replaceState('{}', null, '/');", 100);
G.event.addListenerOnce(panorama, "pano_changed", function() {
setTimeout(function() {
window.disMon && $(".fa-home").css("color", "#eeffee")
}, 1E3);
setInterval(function() {
panorama.getPosition() && !panorama.getVisible() && panorama.setVisible(!0)
}, 500);
G.event.addListener(panorama, "pano_changed", function() {});
G.event.addListener(panorama, "position_changed", function() {
noPanoLoadEvent && clearTimeout(noPanoLoadEvent);
$("#gallery-wait,#gallery-complete").hide();
$("#gallery-submit").show();
updatePano();
updateMarker();
setCenter(panorama.getPosition())
});
G.event.addListener(panorama, "pov_changed", $.debounce(200, function() {
setCurrentLink();
updateMarker()
}));
G.event.addListener(map, "idle", function() {
rPositions.mm = []
});
G.event.addListenerOnce(map, "tilesloaded", function() {
spinner.stop();
elementResize();
setTimeout(function() {
setTimeout(function() {
$("#mainad iframe").length && $("#hidemainad").setVisible()
}, hideWaitTime);
elementResize()
}, 1E3)
});
$("#pano svg").first().css("opacity", "0.9");
addMarker(panorama.getPosition(), panorama.getPano(), panorama.getPov());
showGo();
$("#go-button").click(function() {
goClick()
});
$(document).keydown(function(a) {
!$("#v3searchinput").is(":focus") && !$("#name-input").is(":focus") && (78 == a.keyCode && !$("#go-button").is(":hidden") && $("#go-button").trigger("click"), 83 == a.keyCode && !$("#stop-button").is(":hidden") && $("#stop-button").trigger("click"), 75 == a.keyCode && $("#prev").trigger("click"), 74 == a.keyCode && $("#next").trigger("click"))
});
$("#link").click(function() {
$(this).val(getPermLink()).select()
});
$("#gallery-submit").click(function() {
userName ? ($("#gallery-submit").hide(), $("#gallery-wait").show(), $.post("/_g/add/", {
urlstring: urlSlug(),
user: userName
}, function() {
$("#gallery-wait,#gallery-submit").hide();
$("#gallery-complete").show()
})) : ($("#name-box").modal(), $("#name-input").focus())
});
$("#name").submit(function(a) {
a.preventDefault();
userName = $.trim($("#name-input").val()) || "anonymous";
setCookie("nm", userName, 24E3);
$("#name-box").modal("hide");
$("#gallery-submit").trigger("click");
return !1
});
$("#download-submit").click(function() {
$(this);
$("#download-submit").hide();
$("#download-wait").show();
var a = getGooglePanoHash();
a ? (setTimeout(function() {
window.location.href = hostVal + "_d/" + a
}, 50), setTimeout(function() {
$("#download-wait").hide();
$("#download-submit").show()
}, 1E4), gTrackEvent("Image Download")) : alert("Could not download image. Please try again later.")
});
$("#loading").remove();
$("#like-box").html(window.likeFrame);
$("#tweet-box").html(window.tweetFrame);
$("#social").show();
fbml();
isTouch && $(".hover").removeClass("hover")
});
initPanoId ? panorama.setPano(initPanoId) : panorama.setPosition(initPos);
setTimeout(function() {
panorama.getPano() || (alert("Invalid location. Returning to default page."), panorama = new G.StreetViewPanorama(document.getElementById("pano"), {
position: lrPos.latLng,
pov: lrPos.pov,
addressControl: !1
}), endSearch(), showGo())
}, 8E3);
$("#countrylist a").each(function() {
contCount[$(this).data("continent")] = void 0 == contCount[$(this).data("continent")] ? 1 : contCount[$(this).data("continent")] + 1;
$(this).bind("click", function() {
$(this).toggleClass("active")
});
totalCountries++
});
contCount[0] = totalCountries;
$(".continent").on("click", function() {
contClick($(this).data("id"))
});
$("#stop-button").click(function() {
stopSearch();
showBusy();
slideEvent && (clearTimeout(slideEvent), showGo(), slideEvent = !1)
});
$("#auto-slider").noUiSlider({
range: [2, 60],
start: dSlideTime,
step: 1,
handles: 1,
serialization: {
to: [$("#auto-secs"), "html"],
resolution: 1
}
}).change(function() {
slideTime = Math.max(2, parseInt($("#auto-secs").text()));
isNaN(slideTime) && (slideTime = dSlideTime)
});
$("#auto").change(function() {
$(this).is(":checked") ? (auto = 1, $("#auto-slider-box").show()) : (auto = 0, $("#auto-slider-box").hide())
});
$("#tour").change(function() {
tour = $(this).is(":checked") ? 1 : 0
});
$("#map-button").click(function() {
setTimeout("$('#v3searchinput').focus();", 100);
$("#map-button").hide();
$("#list-button").show();
rPositions.mm = [];
setCenter(panorama.getPosition());
myMap = 1;
hideLocation && $("#stealth").trigger("click");
$("#chooser").hide();
$("#allbox,#locationheader").hide();
$("#map-box").appendTo("#navi-panel").removeClass("behind");
$('label[for="cities"] span').addClass("light")
});
$("#list-button").click(function() {
$("#list-button").hide();
$("#map-button").show();
myMap = 0;
$("#map-box").appendTo("#container").addClass("behind");
$("#chooser").show();
$("#allbox,#locationheader").show();
$('label[for="cities"] span').removeClass("light")
});
$("#inside").change(function() {
rPositions = [];
$(this).is(":checked") ? (inside = 1, $("#countrylist a[data-inside=0]").addClass("disabled")) : (inside = 0, $("#countrylist a").removeClass("disabled"))
});
$("#options-button,#share-button").on("click", function() {
var a = "options-button" == $(this).attr("id") ? $("#share-panel") : $("#options-panel"),
c = "options-button" == $(this).attr("id") ? $("#options-panel") : $("#share-panel");
a.stop().removeClass("visible").animate({
left: "-330px"
}, 200);
c.hasClass("visible") ? c.stop().removeClass("visible").animate({
left: "-330px"
}, 200) : c.stop().addClass("visible").css({
left: "0"
}, 200)
});
slideTime = dSlideTime;
$("#delay").blur(function() {
$(this).val(slideTime)
});
$("#next").click(next);
$("#prev").click(prev);
$("#empty").click(function() {
resetCountries()
});
$("#all").click(function() {
selectAll()
});
$("#stealth").change(function() {
$(this).is(":checked") ? hideLoc() : showLoc()
});
$("#about-link").click(function() {
$("#about-box").modal()
});
$("#comment-link").click(function() {
$("#fb-comment-box").modal()
});
$("#v3searchsubmit").on("click", function() {});
$("#v3searchform").on("submit", function(a) {
codeAddress($("#v3searchinput").val());
a.preventDefault();
return !1
});
$("#hidemainad").click(function() {
$("#mainad,#hidemainad").fadeOut(function() {
$("#mainad").remove();
elementResize()
});
gTrackEvent("hidemainad");
setCookie("hidead", "1", 1)
});
$(".tip").tipsy({
opacity: 0.9,
offset: 2,
delayIn: 250,
gravity: "n"
}).on("click", function() {
$(this).tipsy("hide")
});
$("#map-button").tipsy({
opacity: 0.9,
offset: 2,
delayIn: 250,
gravity: "ne"
}).on("click", function() {
$(this).tipsy("hide")
});
$("#urban-label,#auto-slider").tipsy({
opacity: 0.9,
offset: 2,
delayIn: 250,
gravity: "nw"
}).on("click", function() {
$(this).tipsy("hide")
});
"1" != getCookie("fvisit") && ($("#go-button").tipsy({
opacity: 0.9,
fade: !0,
trigger: "manual",
title: "data-tip",
gravity: "n"
}).on("mouseenter click", function() {
$(this).tipsy("hide");
setCookie("fvisit", "1", 87600)
}), setTimeout(function() {
$("#go-button").tipsy("show")
}, 2E3), setTimeout(function() {
$("#go-button").tipsy("hide")
}, 8E3));
$("#share-fb").click(fbook);
$("#share-twitter").click(tweet);
$("#share-gplus").click(goo);
$("#share-pinterest").click(pinterest);
setTimeout(function() {
$("#cities").trigger("change");
$("#stealth").trigger("change");
$("#tour").trigger("change");
$("#auto").trigger("change");
$("#inside").trigger("change")
}, 500);
elementResize()
});
function goClick() {
panorama.tour = 0;
if (!searchActive()) {
initEvent && G.event.removeListener(initEvent);
4 < markers.length && (!$("#options-button").data("tip-active") && "1" != getCookie("ovisit")) && ($("#options-button").tipsy({
opacity: 0.9,
fade: !0,
trigger: "manual",
title: "data-tip",
gravity: "n"
}).on("mouseenter click", function() {
$(this).tipsy("hide");
setCookie("ovisit", "1", 87600)
}), $("#options-button").data("tip-active", "1"), $("#options-button").tipsy("show"), setTimeout(function() {
setCookie("ovisit", "1", 87600);
$("#options-button").tipsy("hide")
}, 5E3));
9 < markers.length && (!$("#gallery-link").data("tip-active") && "1" != getCookie("gvisit")) && ($("#gallery-link").tipsy({
opacity: 0.9,
fade: !0,
trigger: "manual",
title: "data-tip",
gravity: "nw"
}).on("mouseenter click", function() {
$(this).tipsy("hide");
setCookie("gvisit", "1", 87600)
}), $("#gallery-link").data("tip-active", "1"), $("#gallery-link").tipsy("show"), setTimeout(function() {
setCookie("gvisit", "1", 87600);
$("#gallery-link").tipsy("hide")
}, 5E3));
var a = auto ? 1500 * slideTime + 1E3 : 1E4;
clearTimeout(noPanoLoadEvent);
noPanoLoadEvent = setTimeout(function() {
alert("Sorry, there has been a problem loading the next panorama. Try again!");
stopSearch();
showGo()
}, a);
countryID = !1;
sTime = new Date;
cancelSearch = activeSearches = requests = 0;
hideNext();
hidePrev();
if (!myMap) {
var b = [];
$("#countrylist a").each(function() {
if ($(this).hasClass("active") && !$(this).hasClass("disabled")) {
var a = $(this).data("id");
b.push(a)
}
});
0 == b.length ? inside ? (a = $("#countrylist a[data-inside=1]"), countryID = a.eq(Math.floor(Math.random() * a.length)).data("id")) : (countryID = Math.floor(Math.random() * totalCountries) + 1, -1 != $.inArray(countryID, [25, 38, 9, 49]) && (countryID = 0.5 < Math.random() ? countryID : Math.floor(Math.random() * totalCountries) + 1)) : (a = Math.floor(Math.random() * b.length), countryID = b[a])
}
auto ? (startCountdown(), showStop()) : showBusy();
locate()
}
}
function locate() {
if (!getPointsActive) {
var a, b, c = $("#cities").is(":checked") ? "c" : "a";
b = "c" == c ? 1 : 0;
myMap ? (rPositions.mm || (rPositions.mm = []), b = "/_m/?b=" + (map.getBounds().getSouthWest().lat().toFixed(6) + "," + map.getBounds().getNorthEast().lat().toFixed(6) + "," + map.getBounds().getSouthWest().lng().toFixed(6) + "," + map.getBounds().getNorthEast().lng().toFixed(6)) + "&d=" + b + "&i=" + inside, a = rPositions.mm) : (rPositions[countryID] || (rPositions[countryID] = []), a = rPositions[countryID], b = "/_r/?c=" + countryID + "&d=" + b + "&i=" + inside);
!a[c] || a[c].length <= maxSearches ? (getPointsActive = 1, $.ajax({
url: b,
type: "get",
error: function() {
getPointsActive = 0;
failedSearch()
},
success: function(b) {
var e;
try {
e = $.parseJSON(b.replace(/while\(1\);/g, ""))
} catch (f) {
xlog("bad JSON response")
}
e && !e.error && e.points && 0 != e.points.length ? (countryID = e.country, a[c] = a[c] || [], $.each(e.points, function() {
a[c].push(this)
}), getPointsActive = 0, multiPoint(a[c])) : (getPointsActive = 0, failedSearch())
}
})) : multiPoint(a[c])
}
}
function multiPoint(a) {
if (searchActive()) for (tryPoint(a); activeSearches < maxSearches && !auto && 0 < a.length;) tryPoint(a);
else showGo()
}
function tryPoint(a) {
activeSearches++;
a = a.pop();
a = new G.LatLng(a[0], a[1]);
radius = 15 == map.getZoom() && myMap ? nradius / 2 : 15 < map.getZoom() && myMap ? nradius / 4 : nradius;
inside && (radius = 50);
svClient.getPanoramaByLocation(new G.LatLng(a.lat(), a.lng()), radius, v3process)
}
function v3process(a, b) {
requests++;
if (searchCancelled()) showGo();
else if (searchActive()) if ("ZERO_RESULTS" == b) locate();
else if ("OK" == b) {
panorama.description = "";
"undefined" != typeof a.location.description && (panorama.description = a.location.description);
endSearch();
var c = 0;
eTime = ((new Date - sTime) / 1E3).toFixed(2);
var d = a.location.pano,
e = {
heading: 360 * Math.random(),
pitch: 5,
zoom: 1
},
f = panorama.getPov();
f && (f.heading += 360, e.heading = (f.heading + 90 + Math.ceil(180 * Math.random())) % 720 - 360);
auto && (c = slideTime - eTime);
0 >= c ? setPano(d, e) : slideEvent = setTimeout(function() {
setPano(d, e)
}, 1E3 * c)
} else locate()
}
function setPano(a, b) {
totalViews++;
slideEvent = !1;
searchCancelled() ? showGo() : (G.event.addListenerOnce(panorama, "pano_changed", function() {
addMarker(panorama.getPosition(), panorama.getPano(), panorama.getPov());
gTrackView("/click");
auto && !searchCancelled() ? goClick() : showGo();
tour && (panorama.tour = 1, setTimeout("beginTour();", 1E3))
}), setView(a, b))
}
function updatePano() {
setCurrentLink();
panoFix();
var a = panorama.getPosition();
if (a) {
if (!globalSvPosition || 10 < G.geometry.spherical.computeDistanceBetween(globalSvPosition, a)) {
var b = globalPointer;
$.when(reverseGeo(a)).done(function(a) {
if (b == globalPointer) {
var d = "";
try {
d = panorama.location.description
} catch (e) {
d = ""
}
setAddress(a && a.formatted_address ? a.formatted_address : d, b)
}
})
}
globalSvPosition = a
}
}
function panoFix() {
clearTimeout(panoFixEvent);
panoFixEvent = setTimeout(function() {
panorama && (1 <= panorama.getZoom() && 2 > panorama.getZoom()) && panorama.setZoom(1 + Math.random() / 1E5)
}, 200)
}
function beginTour() {
setTimeout(function() {
panorama.oldHeading = panorama.oldHeading || panorama.getPov().heading;
var a = (panorama.getPov().heading + 0.5) % 360;
panorama.totalIncrement = panorama.totalIncrement ? panorama.totalIncrement + 0.5 : 1;
panorama.tour && 360 > panorama.totalIncrement ? (panorama.setPov({
heading: a,
zoom: panorama.getPov().zoom,
pitch: panorama.getPov().pitch
}), beginTour()) : (panorama.tour = 0, panorama.totalIncrement = 1, panorama.oldHeading = !1)
}, autoRotateInterval)
}
function searchActive() {
return -1 < activeSearches
}
function searchCancelled() {
return cancelSearch
}
function endSearch() {
activeSearches = -1;
noPanoLoadEvent && clearTimeout(noPanoLoadEvent)
}
function stopSearch() {
cancelSearch = 1;
activeSearches = -1;
noPanoLoadEvent && clearTimeout(noPanoLoadEvent)
}
function failedSearch() {
myMap || inside ? alert("No Street View in this area, using the options you selected.") : alert("An error occurred. Please try again.");
stopSearch();
showGo()
}
function addMarker(a, b, c) {
globalPointer = markers.length;
var d = new G.Marker({
position: a,
map: map,
title: "Point " + globalPointer,
icon: markerDefaultIcon
});
d.pov = c;
d.panoid = b;
d.index = globalPointer;
d.clickEvent = G.event.addListener(d, "click", function() {
$("#go-button").is(":hidden") || (globalPointer = d.index, setView(this.panoid, this.pov), setActiveMarker(d), showPrevNext())
});
markers.push(d);
myMap || setCenter(a);
setActiveMarker(d);
markers.length > maxLocations && removeMarker(markers.length - (maxLocations + 1))
}
function setActiveMarker(a) {
for (var b in markers) markers[b].active && (markers[b].setIcon(markerDefaultIcon), markers[b].active = 0);
a.setIcon(markerActiveIcon);
a.active = 1
}
function removeMarker(a) {
var b = markers[a];
b.clickEvent && G.event.removeListener(b.clickEvent);
b.setMap(null);
delete markers[a]
}
function next() {
searchActive() || (G.event.trigger(markers[globalPointer + 1], "click"), setCenter(markers[globalPointer].getPosition()))
}
function prev() {
searchActive() || (G.event.trigger(markers[globalPointer - 1], "click"), setCenter(markers[globalPointer].getPosition()))
}
function urlSlug() {
var a = panorama.getPosition(),
b = panorama.getPov();
return roundNum(a.lat(), 6) + "_" + roundNum(a.lng(), 6) + "_" + roundNum(b.heading, 2) + "_" + roundNum(-1 * b.pitch, 2) + "_" + (Math.round(b.zoom) - 1)
}
function getPermLink() {
return 0 == globalPointer && "" != gPermLink && panorama.getPosition().lat() == initPos.lat() ? gPermLink : hostValHttp + "p/" + urlSlug()
}
function getSvImageUrl() {
var a = panorama.getPov(),
b = Math.max(10, 180 / Math.pow(2, a.zoom));
return "http://maps.googleapis.com/maps/api/streetview?size=640x640&pano=" + panorama.getPano() + "&heading=" + a.heading + "&fov=" + b + "&pitch=" + a.pitch + "&sensor=false"
}
function contDeactivate(a) {
0 == a && resetCountries();
$("#countrylist a[data-continent=" + a + "]").removeClass("active")
}
function contActivate(a) {
0 == a && selectAll();
$("#countrylist a[data-continent=" + a + "]").addClass("active")
}
function resetCountries() {
$("#countrylist a").removeClass("active")
}
function selectAll() {
$("#countrylist a").addClass("active")
}
function contClick(a) {
var b = $("#countrylist a[data-continent=" + a + "][class~=active]").length;
0 == a && (b = $("#countrylist a[class~=active]").length);
b == contCount[a] ? contDeactivate(a) : contActivate(a)
}
function showPrevNext() {
void 0 != markers[globalPointer - 1] ? showPrev() : hidePrev();
globalPointer < markers.length - 1 ? showNext() : hideNext()
}
function showNext() {
$("#mnext").show();
$("#mnextno").hide()
}
function hideNext() {
$("#mnext").hide();
$("#mnextno").show()
}
function showPrev() {
$("#mprev").show();
$("#mprevno").hide()
}
function hidePrev() {
$("#mprev").hide();
$("#mprevno").show()
}
function showGo() {
$("#stop-button").hide();
$("#busy-button").hide();
$("#go-button").show();
showPrevNext()
}
function showBusy() {
$("#stop-button").hide();
$("#go-button").hide();
$("#busy-button").show()
}
function showStop() {
$("#go-button").hide();
$("#busy-button").hide();
$("#stop-button").show()
}
function parseLoc(a) {
if (0 == a) return !1;
var b = {},
c = a.split("_"),
a = parseFloat(c[0]),
d = parseFloat(c[1]),
e = parseFloat(c[2]),
f = parseFloat(c[3]),
c = parseFloat(c[4]);
return !isNaN(a) && !isNaN(d) && !isNaN(e) && !isNaN(f) && !isNaN(c) ? (b.latLng = new G.LatLng(a, d), b.pov = {
heading: e,
pitch: -1 * f,
zoom: c + 1
}, b) : !1
}
function updateMarker() {
markers[globalPointer].setPosition(panorama.getPosition());
markers[globalPointer].panoid = panorama.getPano();
markers[globalPointer].pov = panorama.getPov()
}
function setCurrentLink() {
$("#link").val(getPermLink())
}
function reverseGeo() {
var a = $.Deferred();
a.resolve(!1);
return a.promise()
}
function setAddress(a, b) {
0 == b && initViewType.length && "user" != initViewType ? ($("#info-firstview").show(), $("#address").hide()) : ($("#info-firstview").hide(), $("#stealth").is(":checked") || $("#address").show());
0 < b && ($("#prevnext").show(), $("#address").removeClass("noffset"), $("#info-firstview").addClass("offset"));
$("#address").text(a).attr("title", a);
$("#current").text(b)
}
function setView(a, b) {
panorama.setOptions({
pano: a,
pov: b
});
panorama.setZoom(b.zoom)
}
function setCenter(a, b) {
b = b || map.getZoom() || 5;
if (!map.getBounds() || map.getBounds() && !map.getBounds().contains(a) && !myMap) map.setCenter(a), map.setZoom(b)
}
function hideLoc() {
$("#address").hide();
$("#map-box").css("opacity", "0.05");
panorama.setOptions({
showRoadLabels: !1
});
hideLocation = 1
}
function showLoc() {
$("#map-box").css("opacity", "0.8");
("" == initViewType || 0 != globalPointer) && $("#address").show();
$("#hidetext").remove();
panorama.setOptions({
showRoadLabels: !0
});
hideLocation = 0
}
function codeAddress(a) {
geocoder.geocode({
address: a
}, function(a, c) {
if (c == google.maps.GeocoderStatus.OK) {
var d = a[0].geometry.viewport;
d ? map.fitBounds(d) : map.setCenter(a[0].geometry.location);
searchMarker ? searchMarker.setPosition(a[0].geometry.location) : (searchMarker = new google.maps.Marker({
map: map,
position: a[0].geometry.location
}), searchMarker.setIcon(markerSearchIcon))
}
})
}
function dist(a, b, c, d) {
var e = (c - a) * Math.PI / 180,
b = (d - b) * Math.PI / 180,
a = Math.sin(e / 2) * Math.sin(e / 2) + Math.cos(a * Math.PI / 180) * Math.cos(c * Math.PI / 180) * Math.sin(b / 2) * Math.sin(b / 2);
return 6371 * 2 * Math.atan2(Math.sqrt(a), Math.sqrt(1 - a))
}
function fbook() {
gTrackEvent("fbook");
window.open("https://www.facebook.com/sharer.php?u=" + encodeURIComponent(getPermLink()), "Facebook", "toolbar=0,status=0,width=650,height=350,scrollbars=0,menubar=0,top=" + (screen.height - 350) / 2 + ",left=" + (screen.width - 650) / 2)
}
function tweet() {
gTrackEvent("tweet");
window.open("https://twitter.com/share?url=" + encodeURIComponent(getPermLink()) + "&via=mapcrunch&hashtags=mapcrunch", "Twitter", "toolbar=0,status=0,width=480,height=250,scrollbars=0,menubar=0,top=" + (screen.height - 350) / 2 + ",left=" + (screen.width - 480) / 2)
}
function goo() {
gTrackEvent("gplus");
window.open("https://plus.google.com/share?url=" + encodeURIComponent(getPermLink()), "Google Plus", "toolbar=0,status=0,width=600,height=600,scrollbars=0,menubar=0,top=" + (screen.height - 600) / 2 + ",left=" + (screen.width - 600) / 2)
}
function pinterest() {
gTrackEvent("pinterest");
window.open("http://pinterest.com/pin/create/button/?url=" + encodeURIComponent(getPermLink()) + "&media=" + encodeURIComponent(getSvImageUrl()) + "&description=" + document.title, "Pinterest", "toolbar=0,status=0,width=650,height=350,scrollbars=0,menubar=0,top=" + (screen.height - 350) / 2 + ",left=" + (screen.width - 650) / 2)
}
function gTrackEvent(a, b, c) {
_gaq && a && _gaq.push(["_trackEvent", "main", a, b, c])
}
function gTrackView(a) {
_gaq && _gaq.push(["_trackPageview", a])
}
$.urlParam = function(a) {
a = RegExp("[\\?&]" + a + "=([^&#]*)").exec(window.location.href);
return !a ? 0 : a[1] || 0
};
function xlog(a) {
"undefined" != typeof console && "undefined" != typeof dm && console.log(a)
}
function setCookie(a, b, c) {
if (c) {
var d = new Date;
d.setTime(d.getTime() + 36E5 * c);
c = "; expires=" + d.toGMTString()
} else c = "";
document.cookie = a + "=" + b + c + "; path=/"
}
function getCookie(a) {
for (var a = a + "=", b = document.cookie.split(";"), c = 0; c < b.length; c++) {
for (var d = b[c];
" " == d.charAt(0);) d = d.substring(1, d.length);
if (0 == d.indexOf(a)) return d.substring(a.length, d.length)
}
return null
}
function eraseCookie(a) {
setCookie(a, "", -1)
}
function unloadHandler() {}
function startCountdown() {
"undefined" != typeof a && clearInterval(a);
$("#stopcounter").text(slideTime);
var a = setInterval(function() {
var b = parseInt($("#stopcounter").text()) - 1;
0 > b ? clearInterval(a) : $("#stopcounter").text(b)
}, 1E3)
}
function elementResize() {
var a = $("#pano").width() - $("#info-title").outerWidth() - $("#info-date").outerWidth() - $("#info-comment-link").outerWidth() - 70;
$("#info-finder").is(":visible") && (a -= $("#info-finder").outerWidth());
$("#info-address-first").css("max-width", a);
setTimeout(function() {
if ($("#bottom-box").length && !$("#mainad iframe").length || window.noAds) $("#bottom-box").remove(), $(window).trigger("resize")
}, 500);
parseInt($("#mainad").css("height"));
a = $("#bottom-box").outerHeight();
$("#container").css("height", $(window).height() - a);
G.event.trigger(panorama, "resize")
}
function cid2code(a) {
return $("#c" + a).data("code") || !1
}
function getGooglePanoHash(a, b) {
a = a || panorama.getPano();
b = b || panorama.getPov();
return a && b ? a + "," + roundNum(b.heading, 2) + "," + roundNum(b.pitch, 2) + "," + roundNum(b.zoom, 2) : !1
}
function fbml() {
var a = document;
$("#facebook-jssdk").remove();
var b = a.getElementsByTagName("script")[0],
a = a.createElement("script");
a.id = "facebook-jssdk";
a.src = "//connect.facebook.net/en_GB/all.js#xfbml=1&appId=248807751815810";
b.parentNode.insertBefore(a, b)
}
function gplus() {
var a = document.createElement("script");
a.type = "text/javascript";
a.async = !0;
a.src = "https://apis.google.com/js/plusone.js";
var b = document.getElementsByTagName("script")[0];
b.parentNode.insertBefore(a, b)
}
function tw() {
var a = document.createElement("script");
a.type = "text/javascript";
a.src = "https://platform.twitter.com/widgets.js";
var b = document.getElementById("deferedjs");
b.parentNode.insertBefore(a, b)
}
function roundNum(a, b) {
return Math.round(a * Math.pow(10, b)) / Math.pow(10, b)
}
$.fn.toggleClick = function() {
var a = arguments;
return this.click(function() {
var b = $(this).data("iteration") || 0;
a[b].apply(this, arguments);
b = (b + 1) % a.length;
$(this).data("iteration", b)
})
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment