<commit_before>var findme_map = L.map('findme-map').setView([37.7, -97.3], 3);
var osmUrl='http://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png';
var osmAttrib='Map data © OpenStreetMap contributors';
var osm = new L.TileLayer(osmUrl, {minZoom: 2, maxZoom: 18, attribution: osmAttrib});
osm.addTo(findme_map);

var findme_marker = L.marker([0,0], {draggable:true});
findme_marker.addTo(findme_map);
findme_marker.setOpacity(0);

var category_data = [];

$.ajax('./categories.json').success(function(data){
    category_data = data;
});

$("#category").select2({
    query: function (query) {
        var data = {results: []}, i;

        for (i = 0; i < category_data.length; i++) {
            if (query.term.length === 0 || category_data[i].toLowerCase().indexOf(query.term.toLowerCase()) >= 0) {
                data.results.push({id: category_data[i], text: category_data[i]});
            }
        }

        query.callback(data);
    }
});

$("#findme").click(function() {
    $("#couldnt-find").hide();

    var address_to_find = $("#address").val();

    if (address_to_find.length === 0) {
        return;
    }

    var qwarg = {
        'format': 'json',
        'q': address_to_find
    };
    var url = "http://nominatim.openstreetmap.org/search?" + $.param(qwarg);
    console.log("Nominatim URL is " + url);

    $("#findme h4").text("Searching...");
    $("#findme").addClass("loading");
    $.getJSON(url, function(data) {
        if (data.length > 0) {
            var chosen_place = data[0];
            console.log(chosen_place);

            var bounds = new L.LatLngBounds([+chosen_place.boundingbox[0], +chosen_place.boundingbox[2]],
                                            [+chosen_place.boundingbox[1], +chosen_place.boundingbox[3]]);
            findme_map.fitBounds(bounds);

            findme_marker.setOpacity(1);
            findme_marker.setLatLng([chosen_place.lat, chosen_place.lon]);

            $("#instructions").text("We found it! Click and drag the marker to sit on your business.");

            $("#findme h4").text("Done!");
            $("#findme").removeClass("loading");
            $("#findme").unbind('click').click(function() {
                $("#address-step").hide();
                $("#collect-data-step").show();
            });
        } else {
            console.log("No data found :(");
            $("#couldnt-find").show();
            $("#findme h4").text("Find Me!");
            $("#findme").removeClass("loading");
        }
    });
});

$("#collect-data-done").click(function() {
    $("#collect-data-step").hide();
    $("#confirm-step").show();

    var note_body = "onosm.org submitted note from a business:\n" +
        "name: " + $("#name").val() + "\n" +
        "phone: " + $("#phone").val() + "\n" +
        "fax: " + $("#fax").val() + "\n" +
        "website: " + $("#website").val() + "\n" +
        "twitter: " + $("#twitter").val() + "\n" +
        "hours: " + $("#opening_hours").val() + "\n" +
        "category: " + $("#category").val() + "\n" +
        "address:" + $("#address").val(),
        latlon = findme_marker.getLatLng(),
        qwarg = {
            lat: latlon.lat,
            lon: latlon.lng,
            text: note_body
        };

    $.post('http://api.openstreetmap.org/api/0.6/notes.json', {
        data: qwarg
    });
});<commit_msg>Clean up the POST data a bit.<commit_after>var findme_map = L.map('findme-map').setView([37.7, -97.3], 3);
var osmUrl='http://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png';
var osmAttrib='Map data © OpenStreetMap contributors';
var osm = new L.TileLayer(osmUrl, {minZoom: 2, maxZoom: 18, attribution: osmAttrib});
osm.addTo(findme_map);

var findme_marker = L.marker([0,0], {draggable:true});
findme_marker.addTo(findme_map);
findme_marker.setOpacity(0);

var category_data = [];

$.ajax('./categories.json').success(function(data){
    category_data = data;
});

$("#category").select2({
    query: function (query) {
        var data = {results: []}, i;

        for (i = 0; i < category_data.length; i++) {
            if (query.term.length === 0 || category_data[i].toLowerCase().indexOf(query.term.toLowerCase()) >= 0) {
                data.results.push({id: category_data[i], text: category_data[i]});
            }
        }

        query.callback(data);
    }
});

$("#findme").click(function() {
    $("#couldnt-find").hide();

    var address_to_find = $("#address").val();

    if (address_to_find.length === 0) {
        return;
    }

    var qwarg = {
        'format': 'json',
        'q': address_to_find
    };
    var url = "http://nominatim.openstreetmap.org/search?" + $.param(qwarg);
    console.log("Nominatim URL is " + url);

    $("#findme h4").text("Searching...");
    $("#findme").addClass("loading");
    $.getJSON(url, function(data) {
        if (data.length > 0) {
            var chosen_place = data[0];
            console.log(chosen_place);

            var bounds = new L.LatLngBounds([+chosen_place.boundingbox[0], +chosen_place.boundingbox[2]],
                                            [+chosen_place.boundingbox[1], +chosen_place.boundingbox[3]]);
            findme_map.fitBounds(bounds);

            findme_marker.setOpacity(1);
            findme_marker.setLatLng([chosen_place.lat, chosen_place.lon]);

            $("#instructions").text("We found it! Click and drag the marker to sit on your business.");

            $("#findme h4").text("Done!");
            $("#findme").removeClass("loading");
            $("#findme").unbind('click').click(function() {
                $("#address-step").hide();
                $("#collect-data-step").show();
            });
        } else {
            console.log("No data found :(");
            $("#couldnt-find").show();
            $("#findme h4").text("Find Me!");
            $("#findme").removeClass("loading");
        }
    });
});

$("#collect-data-done").click(function() {
    $("#collect-data-step").hide();
    $("#confirm-step").show();

    var note_body = "onosm.org submitted note from a business:\n" +
        "name: " + $("#name").val() + "\n" +
        "phone: " + $("#phone").val() + "\n" +
        "fax: " + $("#fax").val() + "\n" +
        "website: " + $("#website").val() + "\n" +
        "twitter: " + $("#twitter").val() + "\n" +
        "hours: " + $("#opening_hours").val() + "\n" +
        "category: " + $("#category").val() + "\n" +
        "address: " + $("#address").val(),
        latlon = findme_marker.getLatLng(),
        qwarg = {
            lat: latlon.lat,
            lon: latlon.lng,
            text: note_body
        };

    $.post('http://api.openstreetmap.org/api/0.6/notes.json', qwarg);
});
{'fraction_non_alphanumeric': 0.21376105531404588, 'fraction_numerical': 0.008994153800029981, 'mean_word_length': 2.383367139959432, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 4, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5119141', 'n_tokens_mistral': 2208, 'n_tokens_neox': 2172, 'n_words': 363}