<commit_before>var latt,lont,altt,epoch_g;
var message_buffer="";

$(function() {

    // Do an automatic check-in to test credentials and log coordinates without a mesage 
    if (navigator.geolocation) {
	navigator.geolocation.getCurrentPosition(initPositionProbe);
    }
    else {
	$("#response").addClass("alert alert-danger");
	$("#response").html("Geolocation is not supported or enabled");
    }
       
    // Enables the user to submit status by pressing down the Space key 3 times in a row 
    // TODO: implement cellphone longpress unicode triggers
    var spaces = 0;
    $("#status-textarea").keydown(function( event ) {

	if ( event.which == 32 ) {
	    //event.preventDefault();
	    spaces++;
	    if (spaces == 3){
		spaces = 0;
		submit_status();
		$("#status-textarea").addClass("textarea-pending");
	    }
	}
	else{
	    spaces = 0;
	}
	
    });

    $("#submiter").click(submit_status);

});

// Try to submit a GPS tagged message to the server with credentials 
function submit_status(){

    if (message_buffer === ""){
	message_buffer = $("#status-textarea").val();
    }

    $("#status-textarea").val("");
    $('#status-textarea').prop('disabled', true);
    $("#status-textarea").attr("placeholder","Sending . . .");

    $.ajax({
	url: "cgi/status-update.php",
	type: "POST",
	cache:false,

	data: {
	    password: $("#<PASSWORD>").val(),
	    message: message_buffer,
	    lat: latt,
	    alt: altt,
	    lon: lont,
	    date: epoch_g},
	
	success:response_handler
    });
}


function updatePosition(){
    navigator.geolocation.getCurrentPosition(initPositionProbe);
}

// General getCurrentPosition callback that updates and displays the coordinates
function showPosition(position) {

    var epoch = parseInt(position.timestamp/1000);

    var date = new Date(position.timestamp);
    $("#epoch").text(date.toDateString() + " " + date.toLocaleTimeString());
    $("#latitude").text( DECtoDMS_string(position.coords.latitude,"lat"));
    $("#longitude").text( DECtoDMS_string(position.coords.longitude,"lon"));

    if (position.coords.altitude)
	$("#altitude").html(Math.round(position.coords.altitude)+" m");
    else
	$("#altitude").html("<small><tt>unknown</tt></small>");

    // Update the coordinate global vars
    latt = position.coords.latitude;
    altt = position.coords.altitude;
    lont = position.coords.longitude;
    epoch_g = epoch;
}


// GPS getCurrentPosition callback for the initial page load 
//  database status messages are identified with '#probe'
function initPositionProbe(position) {
    $.ajax({
	url: "cgi/status-update.php",
	type: "POST",
	cache:false,
	
	data: {
	    password: <PASSWORD>(),
	    message: "#probe",
	    lat: position.coords.latitude,
	    alt: position.coords.altitude,<commit_msg>Seperate date and time string with newline<commit_after>var latt,lont,altt,epoch_g;
var message_buffer="";

$(function() {

    // Do an automatic check-in to test credentials and log coordinates without a mesage 
    if (navigator.geolocation) {
	navigator.geolocation.getCurrentPosition(initPositionProbe);
    }
    else {
	$("#response").addClass("alert alert-danger");
	$("#response").html("Geolocation is not supported or enabled");
    }
       
    // Enables the user to submit status by pressing down the Space key 3 times in a row 
    // TODO: implement cellphone longpress unicode triggers
    var spaces = 0;
    $("#status-textarea").keydown(function( event ) {

	if ( event.which == 32 ) {
	    //event.preventDefault();
	    spaces++;
	    if (spaces == 3){
		spaces = 0;
		submit_status();
		$("#status-textarea").addClass("textarea-pending");
	    }
	}
	else{
	    spaces = 0;
	}
	
    });

    $("#submiter").click(submit_status);

});

// Try to submit a GPS tagged message to the server with credentials 
function submit_status(){

    if (message_buffer === ""){
	message_buffer = $("#status-textarea").val();
    }

    $("#status-textarea").val("");
    $('#status-textarea').prop('disabled', true);
    $("#status-textarea").attr("placeholder","Sending . . .");

    $.ajax({
	url: "cgi/status-update.php",
	type: "POST",
	cache:false,

	data: {
	    password: <PASSWORD>(),
	    message: message_buffer,
	    lat: latt,
	    alt: altt,
	    lon: lont,
	    date: epoch_g},
	
	success:response_handler
    });
}


function updatePosition(){
    navigator.geolocation.getCurrentPosition(initPositionProbe);
}

// General getCurrentPosition callback that updates and displays the coordinates
function showPosition(position) {

    var epoch = parseInt(position.timestamp/1000);

    var date = new Date(position.timestamp);
    $("#epoch").html(date.toDateString() + "<br>" + date.toLocaleTimeString());
    $("#latitude").text( DECtoDMS_string(position.coords.latitude,"lat"));
    $("#longitude").text( DECtoDMS_string(position.coords.longitude,"lon"));

    if (position.coords.altitude)
	$("#altitude").html(Math.round(position.coords.altitude)+" m");
    else
	$("#altitude").html("<small><tt>unknown</tt></small>");

    // Update the coordinate global vars
    latt = position.coords.latitude;
    altt = position.coords.altitude;
    lont = position.coords.longitude;
    epoch_g = epoch;
}


// GPS getCurrentPosition callback for the initial page load 
//  database status messages are identified with '#probe'
function initPositionProbe(position) {
    $.ajax({
	url: "cgi/status-update.php",
	type: "POST",
	cache:false,
	
	data: {
	    password: <PASSWORD>").<PASSWORD>(),
	    message: "#probe",
	    lat: position.coords.latitude,
	    alt: position.coords.altitude,
{'fraction_non_alphanumeric': 0.15928251121076234, 'fraction_numerical': 0.003946188340807175, 'mean_word_length': 3.638935108153078, 'pattern_counts': {'":': 0, '<': 17, '<?xml version=': 0, '>': 17, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2710048', 'n_tokens_mistral': 1799, 'n_tokens_neox': 1705, 'n_words': 394}