From 4f81e9399051cc90ccddeb69b785d7422a28a1ff Mon Sep 17 00:00:00 2001 From: Comment Date: Wed, 8 May 2013 22:59:04 +0100 Subject: initial commit --- maps-extra.js | 165 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 165 insertions(+) create mode 100755 maps-extra.js (limited to 'maps-extra.js') diff --git a/maps-extra.js b/maps-extra.js new file mode 100755 index 0000000..e6cc7e1 --- /dev/null +++ b/maps-extra.js @@ -0,0 +1,165 @@ +// Version 1.3 20081218.1405 + +//var show_parking_warning=true; + +// Start up Shadowbox. +Shadowbox.init({ + players: ['img', 'qt','html'] // See http://www.shadowbox-js.com/options.html#players for more players. +}); + +$(document).ready(function() { + + // Set the default message to be displayed in the search box. + var search_query_message = 'Search the map' + // The following is the mechanics for the search box to show and hide the default message. + if ($('#query').attr('value') != search_query_message) + { + if (search_posted != '') + { + $('#query').attr('value', search_posted); + } + else + { + $('#query').attr('value', search_query_message); + } + } + $('#query').focus(function() { + if ($(this).attr('value') == search_query_message) + { + $(this).attr('value', ''); + } + }); + $('#query').blur(function() { + if (!$(this).attr('value') || $(this).attr('value').replace(/^\s*/, "").replace(/\s*$/, "") == '') + { + $(this).attr('value', search_query_message); + } + }); + // Set the action when the search box form is submitted. + if ($('#headerform')) { + $('#headerform').submit(function() { + var el = document.getElementById('query'); + onsearch(el.value); + return submit_the_query_form; + }); + }; + // Set the default height for the map. + if ($('#map') && parseInt($('#map').css('height'), 10) < 201) { + $('#map').css('height', '200px'); + }; + + +}); +// +function callback_for_resizing() { + + // Chuck the map icons in and prepare the events. + if ($('#mapicons')) + { + // Display the map icon buttons.
  • Parking
  • + $('#mapicons').html('

    Map toggles

    '); + // Set the click event. + $('#mapicons li').click(function() { + if ($(this).attr('id')=="Parking"&&show_parking_warning) { + Shadowbox.open({ + content: "
    There is no public parking available in Trinity; parking is permit or by arrangement only.

    The icons displayed show the locations of enabled parking for those with a permit or prior arrangement to park on the grounds.
    ", + player: "html", + title: "Parking Notice", + height: 350, + width: 360 + }); + show_parking_warning=false; + } + show_markers($(this).attr('id')); + if (markers[$(this).attr('id')].visible) + { + $(this).attr('class', 'selected'); + } + else + { + $(this).attr('class', ''); + } + return false; + }); + // Set the key event. + $('#mapicons li').keyup(function(event) { + if (event.keyCode == 13 || event.keyCode == 32) // Return/enter or space. + { + show_markers($(this).attr('id')); + if (markers[$(this).attr('id')].visible) + { + $(this).attr('class', 'selected'); + } + else + { + $(this).attr('class', ''); + } + return false; + } + }); + } + // Get the element mapwrap and apply the class js_active. This will give a means for different styles to be applied when Javascript is off. + var mapwrap = $('.wrap'); + mapwrap[0].className = mapwrap[0].className + ' js_active'; + // Do the same but with the searchoptions element. + //var mapwrap = document.getElementById('searchoptions'); + //mapwrap.parentNode.className += ' js_active'; + resize_map_and_results(); + $(window).resize(function() { + resize_map_and_results(); + }); + // Check if the POST search variable was passed to Javascript. + if (search_posted != '') + { + // Update the search results. + onsearch(search_posted); + } + // Check if the POST quicklinks variable was passed to Javascript. + if (quicklinks_posted != '') + { + // Update the search results. + do_menu(quicklinks_posted); + } +} +function resize_map_and_results() { + // Fix mapicons and searchresulttitle so that they have the same height by adding padding to the top. + if ($('#searchresulttitle') && $('#map') && $('#mapicons')) + { + var diff = $('#searchresults').offset().top - $('#map').offset().top; + var searchresulttitle_padding = parseFloat($('#searchresulttitle').css('padding-top'), 10); + var mapicons_padding = parseFloat($('#mapicons').css('padding-top'), 10); + if (diff > 0) + { + // Increase the height of mapicons by adding padding to the top. + mapicons_padding = mapicons_padding + diff; + } + else if (diff < 0) + { + searchresulttitle_padding = searchresulttitle_padding - diff; + } + diff = 0; + if (searchresulttitle_padding > 0 && mapicons_padding > 0) + { + diff = Math.min(searchresulttitle_padding, mapicons_padding); + } + $('#mapicons').css('padding-top', mapicons_padding - diff + 'px'); + $('#searchresulttitle').css('padding-top', searchresulttitle_padding - diff + 'px'); + } + // Fix the vertical dimensions of the map. + if ($('#searchresults') && $('#map')) + { + var diff = Math.abs($(window).height() - $('#map').offset().top - 10); // The 10 is the base padding value used throughout the design. + if (diff < 400) { + diff = 400; + } + $('#map').css('height', diff + 'px'); + $('#searchresults').css('height', diff + 2 + 'px'); // The 2 is a bit random but adjusts the bottom of the results to match the map. + } + + map.setCenter(STARTPOS, 17); +} +function MM_jumpMenu(targ,selObj,restore){ //v3.0 + eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'"); + if (restore) selObj.selectedIndex=0; +} + -- cgit v1.2.3