0

Fixed the tabbing in overviewerConfig.js

This commit is contained in:
Zach McCullough
2011-10-24 19:16:03 -05:00
parent 420e784451
commit d77673f406

View File

@@ -249,11 +249,11 @@ var overviewer = {
overviewer.collections.mapTypes[i]); overviewer.collections.mapTypes[i]);
} }
// Jump to the hash if given // Jump to the hash if given
overviewer.util.initHash(); overviewer.util.initHash();
// Add live hash update listeners // Add live hash update listeners
// Note: It is important to add them after jumping to the hash // Note: It is important to add them after jumping to the hash
google.maps.event.addListener(overviewer.map, 'dragend', function() { google.maps.event.addListener(overviewer.map, 'dragend', function() {
overviewer.util.updateHash(); overviewer.util.updateHash();
}); });
@@ -262,13 +262,13 @@ var overviewer = {
overviewer.util.updateHash(); overviewer.util.updateHash();
}); });
// Make the link again whenever the map changes // Make the link again whenever the map changes
google.maps.event.addListener(overviewer.map, 'maptypeid_changed', function() { google.maps.event.addListener(overviewer.map, 'maptypeid_changed', function() {
$('#'+overviewerConfig.CONST.mapDivId).css( $('#'+overviewerConfig.CONST.mapDivId).css(
'background-color', overviewer.util.getMapTypeBackgroundColor( 'background-color', overviewer.util.getMapTypeBackgroundColor(
overviewer.map.getMapTypeId())); overviewer.map.getMapTypeId()));
//smuggled this one in here for maptypeid hash generation --CounterPillow //smuggled this one in here for maptypeid hash generation --CounterPillow
overviewer.util.updateHash(); overviewer.util.updateHash();
}); });
}, },
/** /**
@@ -843,12 +843,12 @@ var overviewer = {
var searchInput = document.createElement("input"); var searchInput = document.createElement("input");
searchInput.type = "text"; searchInput.type = "text";
searchInput.value = "Sign Search"; searchInput.value = "Sign Search";
searchInput.title = "Sign Search"; searchInput.title = "Sign Search";
$(searchInput).addClass("inactive"); $(searchInput).addClass("inactive");
/* Hey dawg, I heard you like functions. /* Hey dawg, I heard you like functions.
* So we defined a function inside your function. * So we defined a function inside your function.
*/ */
searchInput.onfocus = function() { searchInput.onfocus = function() {
if (searchInput.value == "Sign Search") { if (searchInput.value == "Sign Search") {
@@ -856,7 +856,7 @@ var overviewer = {
$(searchInput).removeClass("inactive").addClass("active"); $(searchInput).removeClass("inactive").addClass("active");
} }
}; };
searchInput.onblur = function() { searchInput.onblur = function() {
if (searchInput.value == "") { if (searchInput.value == "") {
searchInput.value = "Sign Search"; searchInput.value = "Sign Search";
$(searchInput).removeClass("active").addClass("inactive"); $(searchInput).removeClass("active").addClass("inactive");
@@ -957,8 +957,8 @@ var overviewer = {
'initHash': function() { 'initHash': function() {
if(window.location.hash.split("/").length > 1) { if(window.location.hash.split("/").length > 1) {
overviewer.util.goToHash(); overviewer.util.goToHash();
// Clean up the hash. // Clean up the hash.
overviewer.util.updateHash(); overviewer.util.updateHash();
// Add a marker indicating the user-supplied position // Add a marker indicating the user-supplied position
var coordinates = overviewer.util.fromLatLngToWorld(overviewer.map.getCenter().lat(), overviewer.map.getCenter().lng()); var coordinates = overviewer.util.fromLatLngToWorld(overviewer.map.getCenter().lat(), overviewer.map.getCenter().lng());
@@ -976,7 +976,7 @@ var overviewer = {
'updateHash': function() { 'updateHash': function() {
var coordinates = overviewer.util.fromLatLngToWorld(overviewer.map.getCenter().lat(), overviewer.map.getCenter().lng()); var coordinates = overviewer.util.fromLatLngToWorld(overviewer.map.getCenter().lat(), overviewer.map.getCenter().lng());
var zoom = overviewer.map.getZoom(); var zoom = overviewer.map.getZoom();
var maptype = overviewer.map.getMapTypeId(); var maptype = overviewer.map.getMapTypeId();
if (zoom == overviewerConfig.map.maxZoom) { if (zoom == overviewerConfig.map.maxZoom) {
zoom = 'max'; zoom = 'max';
} else if (zoom == overviewerConfig.map.minZoom) { } else if (zoom == overviewerConfig.map.minZoom) {
@@ -988,18 +988,18 @@ var overviewer = {
overviewer.util.setHash(coordinates.x, coordinates.y, coordinates.z, zoom, maptype); overviewer.util.setHash(coordinates.x, coordinates.y, coordinates.z, zoom, maptype);
}, },
'goToHash': function() { 'goToHash': function() {
// Note: the actual data begins at coords[1], coords[0] is empty. // Note: the actual data begins at coords[1], coords[0] is empty.
var coords = window.location.hash.split("/"); var coords = window.location.hash.split("/");
var latlngcoords = overviewer.util.fromWorldToLatLng(parseInt(coords[1]), parseInt(coords[2]), parseInt(coords[3])); var latlngcoords = overviewer.util.fromWorldToLatLng(parseInt(coords[1]), parseInt(coords[2]), parseInt(coords[3]));
var zoom; var zoom;
var maptype = ''; var maptype = '';
// The if-statements try to prevent unexpected behaviour when using incomplete hashes, e.g. older links // The if-statements try to prevent unexpected behaviour when using incomplete hashes, e.g. older links
if (coords.length > 4) { if (coords.length > 4) {
zoom = coords[4]; zoom = coords[4];
} }
if (coords.length > 5) { if (coords.length > 5) {
maptype = coords[5]; maptype = coords[5];
} }
if (zoom == 'max') { if (zoom == 'max') {
zoom = overviewerConfig.map.maxZoom; zoom = overviewerConfig.map.maxZoom;
@@ -1015,13 +1015,13 @@ var overviewer = {
zoom = overviewerConfig.map.defaultZoom; zoom = overviewerConfig.map.defaultZoom;
} }
} }
// If the maptype isn't set, set the default one. // If the maptype isn't set, set the default one.
if (maptype == '') { if (maptype == '') {
// We can now set the map to use the 'coordinate' map type // We can now set the map to use the 'coordinate' map type
overviewer.map.setMapTypeId(overviewer.util.getDefaultMapTypeId()); overviewer.map.setMapTypeId(overviewer.util.getDefaultMapTypeId());
} else { } else {
overviewer.map.setMapTypeId(maptype); overviewer.map.setMapTypeId(maptype);
} }
overviewer.map.setCenter(latlngcoords); overviewer.map.setCenter(latlngcoords);
overviewer.map.setZoom(zoom); overviewer.map.setZoom(zoom);