<commit_before>Brooklyn.location = (function() {
    // Config
    var tableId = '#location-data';
    var aoColumns = [ { "mDataProp": "name", "sTitle": "Location", "sWidth":"100%"  }];
    var appLocations;
    // Status
    var map;
    var loc;
    var locationNumber = 0;

    function updateLocation(event) {
        var result = Brooklyn.tabs.getDataTableSelectedRowData(tableId, event);

        // TODO why is this necessary? (location, etc should be in result!)
        for (i in appLocations) {
            if (appLocations[i].name === result.name) {
                locationNumber = i;
                moveToLoc();
                break;
            }
        }
 	$(event.target.parentNode).addClass('row_selected');
    }

    function moveToLoc() {
        var settings = Brooklyn.tabs.getDataTable(tableId).fnSettings().aoData;
        for(row in settings) {
       	    $(settings[row].nTr).removeClass('row_selected');
   	}

        for(i in appLocations) {
            appLocations[i].infowindow.close(map , appLocations[i].marker);
        }

        map.setCenter(appLocations[locationNumber].location);
        appLocations[locationNumber].infowindow.open(map , appLocations[locationNumber].marker);
    }

    function addLocationToMap(location, i){
        var address = location.add;
        var lat = location.lat;
        var lon = location.lon;
        var name = location.name;
        var iso = location.iso;
        var description = location.description;
        if(address!=null){
        new google.maps.Geocoder().geocode( { 'address': address}, function(results, status) {
            if (status === google.maps.GeocoderStatus.OK) { 
                loc = results[0].geometry.location;
                appLocations[i].location = loc;
                var contentString = '<div id="content" style="height:80px">'+
                    '<h1>'+address+'</h1>'+
                    '<table border="1">'+
                    '<tr>'+
                    '<td>Address</td>'+
                    '<td>Active</td>'+
                    '<td>Resources</td>'+
                    '</tr>'+
                    '<tr>'+
                    '<td>'+address+'</td>'+
                    '<td>True</td>'+
                    '<td>'+'resources'+'</td>'+
                    '</tr>'+
                    '</table>'+
                    '</div>';
                var marker = new google.maps.Marker({
                    map: map,
                    position: loc ,
                    title: address
                });
                var infowindow = new google.maps.InfoWindow({
                    content: contentString
                });
                google.maps.event.addListener(marker, 'click' , function(){
                    infowindow.open(map , marker);
                });
                appLocations[i].marker = marker;
                appLocations[i].infowindow = infowindow;
                appLocations[i].locationNumber = i;
                locationNumber = locationNumber + 1;
                map.setCenter(loc);
            } else {
                $(Brooklyn.eventBus).trigger('update_failed', "Got data from server but could not geocode an entity: "
                                             + status);
            }
        });}
        else if(lat!=null&&lon!=null){
                loc = new google.maps.LatLng(lat,lon);
                appLocations[i].location = loc;
                var contentString = '<div id="content" style="height:80px">'+
                    '<h1>'+'address'+'</h1>'+
                    '<table border="1">'+
                    '<tr>'+
                    '<td>Address</td>'+
                    '<td>Active</td>'+
                    '<td>Resources</td>'+
                    '</tr>'+
                    '<tr>'+
                    '<td>'+'address'+'</td>'+
                    '<td>True</td>'+
                    '<td>'+'resources'+'</td>'+
                    '</tr>'+
                    '</table>'+
                    '</div>';
                var marker = new google.maps.Marker({
                    map: map,
                    position: loc ,
                    title: "Title"
                });
                var infowindow = new google.maps.InfoWindow({
                    content: contentString
                });
                google.maps.event.addListener(marker, 'click' , function(){
                    infowindow.open(map , marker);
                });
                appLocations[i].marker = marker;
                appLocations[i].infowindow = infowindow;
                appLocations[i].locationNumber = i;
                locationNumber = locationNumber + 1;
                map.setCenter(loc);
        }
        else if (iso != null) {
            // use ISO code TBI
            alert("use of ISO Code TBI");
        } else {
            $(Brooklyn.eventBus).trigger('update_failed', "No geolocation information available from google for " + location.name);
        }
    }

    function toggleLocation(e){
        if(appLocations.length <= ++locationNumber) {
            locationNumber = 0;
        }
        moveToLoc();
    }

    // TODO call when set of locations changes?
    function updateLocations() {
        var myOptions = {
            width: 400,
            zoom: 7,
            mapTypeId: google.maps.MapTypeId.ROADMAP
        }

        map = new google.maps.Map(document.getElementById("map-canvas"), myOptions);
        for(i in appLocations) {
            addLocationToMap(appLocations[i], i);
        }
        Brooklyn.tabs.getDataTable(tableId, '.', aoColumns, updateLocation, appLocations);
    }
<commit_msg>Formatting.<commit_after>Brooklyn.location = (function() {
    // Config
    var tableId = '#location-data';
    var aoColumns = [ { "mDataProp": "name", "sTitle": "Location", "sWidth":"100%"  }];
    var appLocations;
    // Status
    var map;
    var loc;
    var locationNumber = 0;

    function updateLocation(event) {
        var result = Brooklyn.tabs.getDataTableSelectedRowData(tableId, event);

        // TODO why is this necessary? (location, etc should be in result!)
        for (i in appLocations) {
            if (appLocations[i].name === result.name) {
                locationNumber = i;
                moveToLoc();
                break;
            }
        }
 	$(event.target.parentNode).addClass('row_selected');
    }

    function moveToLoc() {
        var settings = Brooklyn.tabs.getDataTable(tableId).fnSettings().aoData;
        for(row in settings) {
       	    $(settings[row].nTr).removeClass('row_selected');
   	}

        for(i in appLocations) {
            appLocations[i].infowindow.close(map , appLocations[i].marker);
        }

        map.setCenter(appLocations[locationNumber].location);
        appLocations[locationNumber].infowindow.open(map , appLocations[locationNumber].marker);
    }

    function addLocationToMap(location, i){
        var address = location.add;
        var lat = location.lat;
        var lon = location.lon;
        var name = location.name;
        var iso = location.iso;
        var description = location.description;

        if (address != null) {
            new google.maps.Geocoder().geocode( { 'address': address}, function(results, status) {
                if (status === google.maps.GeocoderStatus.OK) { 
                    loc = results[0].geometry.location;
                    appLocations[i].location = loc;
                    var contentString = '<div id="content" style="height:80px">'+
                        '<h1>'+address+'</h1>'+
                        '<table border="1">'+
                        '<tr>'+
                        '<td>Address</td>'+
                        '<td>Active</td>'+
                        '<td>Resources</td>'+
                        '</tr>'+
                        '<tr>'+
                        '<td>'+address+'</td>'+
                        '<td>True</td>'+
                        '<td>'+'resources'+'</td>'+
                        '</tr>'+
                        '</table>'+
                        '</div>';
                    var marker = new google.maps.Marker({
                        map: map,
                        position: loc,
                        title: address
                    });
                    var infowindow = new google.maps.InfoWindow({
                        content: contentString
                    });
                    google.maps.event.addListener(marker, 'click' , function(){
                        infowindow.open(map, marker);
                    });
                    appLocations[i].marker = marker;
                    appLocations[i].infowindow = infowindow;
                    appLocations[i].locationNumber = i;
                    locationNumber = locationNumber + 1;
                    map.setCenter(loc);
                } else {
                    $(Brooklyn.eventBus).trigger('update_failed', "Got data from server but could not geocode an entity: "
                                                 + status);
                }
            });
        } else if (lat != null && lon != null) {
            loc = new google.maps.LatLng(lat, lon);
            appLocations[i].location = loc;
            var contentString = '<div id="content" style="height:80px">'+
                '<h1>'+'address'+'</h1>'+
                '<table border="1">'+
                '<tr>'+
                '<td>Address</td>'+
                '<td>Active</td>'+
                '<td>Resources</td>'+
                '</tr>'+
                '<tr>'+
                '<td>'+'address'+'</td>'+
                '<td>True</td>'+
                '<td>'+'resources'+'</td>'+
                '</tr>'+
                '</table>'+
                '</div>';
            var marker = new google.maps.Marker({
                map: map,
                position: loc ,
                title: "Title"
            });
            var infowindow = new google.maps.InfoWindow({
                content: contentString
            });
            google.maps.event.addListener(marker, 'click' , function(){
                infowindow.open(map , marker);
            });
            appLocations[i].marker = marker;
            appLocations[i].infowindow = infowindow;
            appLocations[i].locationNumber = i;
            locationNumber = locationNumber + 1;
            map.setCenter(loc);
        } else if (iso != null) {
            // use ISO code TBI
            alert("use of ISO Code TBI");
        } else {
            $(Brooklyn.eventBus).trigger('update_failed',
                                         "No geolocation information available from google for " + location.name);
        }
    }

    function toggleLocation(e){
        if(appLocations.length <= ++locationNumber) {
            locationNumber = 0;
        }
        moveToLoc();
    }

    // TODO call when set of locations changes?
    function updateLocations() {
        var myOptions = {
            width: 400,
            zoom: 7,
            mapTypeId: google.maps.MapTypeId.ROADMAP
        }

        map = new google.maps.Map(document.getElementById("map-canvas"), myOptions);
        for(i in appLocations) {
            addLocationToMap(appLocations[i], i);
        }
        Brooklyn.tabs.getDataTable(tableId, '.', aoColumns, updateLocation, appLocations);
    }

{'fraction_non_alphanumeric': 0.13238916256157635, 'fraction_numerical': 0.0038705137227304713, 'mean_word_length': 1.3754701211867948, 'pattern_counts': {'":': 6, '<': 93, '<?xml version=': 0, '>': 91, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 6, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5703416', 'n_tokens_mistral': 3045, 'n_tokens_neox': 2940, 'n_words': 579}