summaryrefslogtreecommitdiff
path: root/chimere/templates/search/search_js.html
blob: 25edca62a02c0e04a0247a4e9b80641c0ca19d28 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
<script type='text/javascript'>
$(function(){
    // clean checked categories
    $('.subcategory').each(function(){ $(this).removeClass('selected'); });
    $('.subcategory input[type=checkbox]').attr('checked', false);

    var geo_objects = [{% for result in page.object_list %}{{result.object.getGeoJSON|safe}}{% if not forloop.last %}, {% endif %}{% endfor %}];
    var geo_features = {};
    for (idx=0 ; idx < geo_objects.length ; idx++){
        var c_idx = geo_objects[idx].properties.pk;
        if (search_result.indexOf(c_idx) == -1){
            search_result.push(c_idx);
            geo_features[c_idx] = $('#main-map').chimere('addMarker',
                                                         geo_objects[idx]);
        }
    }
    {% if page.object_list.count %}$("#main-map").chimere("zoomToMarkerExtent");{% endif %}

});
</script>