tests/Leaflet/sl-application.js
/**
 * Makes a marker & map window tied to a particular sidebar search result or
 * Destination Guide item. When the marker is clicked & the map window opens,
 * the sidebar item becomes selected; it becomes deselected again when the map
 * window is closed. Clicking the sidebar item pans the map to the marker &
 * opens the map window.
 *
 * @param {Element|String} windowContent the content of the marker's map window
 * @param {Point} markerLocation the map location to place the marker at
 * @param {JQueryResult} $sidebarItem the jQuery set representing the marker's related sidebar item
 * @param {String} regionLocation the SL region location string to link the window's Join button to when the window is opened (optional)
 */
Makes a marker & map window tied to a particular sidebar search result or
Destination Guide item. When the marker is clicked & the map window opens,
the sidebar item becomes selected; it becomes deselected again when the map
window is closed. Clicking the sidebar item pans the map to the marker &
opens the map window.

@param {Element|String} windowContent the content of the marker's map window
@param {Point} markerLocation the map location to place the marker at
@param {JQueryResult} $sidebarItem the jQuery set representing the marker's related sidebar item
@param {String} regionLocation the SL region location string to link the window's Join button to when the window is opened (optional)
Makes a marker & map window tied to a particular sidebar search result or Destination Guide item . When the marker is clicked & the map window opens the sidebar item becomes selected ; it becomes deselected again when the map window is closed . Clicking the sidebar item pans the map to the marker & opens the map window . @param { Element|String } windowContent the content of the marker ' s map window @param { Point } markerLocation the map location to place the marker at @param { JQueryResult } $sidebarItem the jQuery set representing the marker ' s related sidebar item @param { String } regionLocation the SL region location string to link the window ' s Join button to when the window is opened ( optional )
function makeMarkerForSidebar(windowContent, markerLatLng, $sidebarItem, regionLocation)
{
    var domId = $sidebarItem.attr('id');
    var marker = L.marker(markerLatLng, {
        icon: L.icon({
            iconUrl: assetsURL + "marker-sm.png",
            iconSize: [53, 48],
            iconAnchor: [26, 48]
        })
    }).addTo($map);
    marker.bindPopup(windowContent, {minWidth: 350}).on('popupopen', function (event) {
        $('#' + domId).addClass('result-selected');
        if (!regionLocation) {
            return;
        }
        var $joinButton = $(event.popup.getPane()).find('a.join_button');
        if (0 < $joinButton.length) {
            directSlurl($joinButton, regionLocation);
        }
    }).on('popupclose', function (event) {
        $('#' + domId).removeClass('result-selected');
    });
    $sidebarItem.click(function (evt) {
        evt.preventDefault();
        marker.togglePopup();  
    });
    return marker;
}
function makeMarkerForSidebar ( windowContent , markerLatLng , $sidebarItem , regionLocation ) { var domId = $sidebarItem . attr ( 'id' ) ; var marker = L . marker ( markerLatLng , { icon : L . icon ( { iconUrl : assetsURL + "marker-sm.png" , iconSize : [ 53 , 48 ] , iconAnchor : [ 26 , 48 ] } ) } ) . addTo ( $map ) ; marker . bindPopup ( windowContent , { minWidth : 350 } ) . on ( 'popupopen' , function ( event ) { $ ( '#' + domId ) . addClass ( 'result-selected' ) ; if ( ! regionLocation ) { return ; } var $joinButton = $ ( event . popup . getPane ( ) ) . find ( 'a.join_button' ) ; if ( 0 < $joinButton . length ) { directSlurl ( $joinButton , regionLocation ) ; } } ) . on ( 'popupclose' , function ( event ) { $ ( '#' + domId ) . removeClass ( 'result-selected' ) ; } ) ; $sidebarItem . click ( function ( evt ) { evt . preventDefault ( ) ; marker . togglePopup ( ) ; } ) ; return marker ; }
Makes a marker & map window tied to a particular sidebar search result or
 Destination Guide item.
Makes a marker & map window tied to a particular sidebar search result or Destination Guide item .
// TODO: 350 is the declared width of the .balloon-content div wrapping the // windowContent. Someday we should figure out how to let Leaflet figure // that out instead of hardcoding it here? // ???