app/static/scripts/globalScripts.js
// called by button. converts the global arrays to json and triggers download
called by button. converts the global arrays to json and triggers download
called by button . converts the global arrays to json and triggers download
function download_json() {
    var person_array_copy = [];
    for (let person of PERSON_ARRAY) {
        var person_copy = {};
        person_copy.id = person.id;
        person_copy.givenName = person.givenName;
        person_copy.familyName = person.familyName;
        person_copy.dateOfBirth = person.dateOfBirth;
        person_copy.dateOfDeath = person.dateOfDeath;
        person_copy.details = person.details;
        person_copy.gender = person.gender;
        person_array_copy.push(person_copy);
    }
    var data_array = [person_array_copy , RELATION_ARRAY];
    var json_string = JSON.stringify(data_array);
    var export_string = "data:text/json;charset=utf-8," + encodeURIComponent(json_string);
    var download_element = document.createElement('a');
    download_element.setAttribute('href', export_string);
    download_element.setAttribute('download', 'testing_family_tree.json');
    document.body.append(download_element);
    download_element.click();
    download_element.remove();
}
function download_json ( ) { var person_array_copy = [ ] ; for ( let person of PERSON_ARRAY ) { var person_copy = { } ; person_copy . id = person . id ; person_copy . givenName = person . givenName ; person_copy . familyName = person . familyName ; person_copy . dateOfBirth = person . dateOfBirth ; person_copy . dateOfDeath = person . dateOfDeath ; person_copy . details = person . details ; person_copy . gender = person . gender ; person_array_copy . push ( person_copy ) ; } var data_array = [ person_array_copy , RELATION_ARRAY ] ; var json_string = JSON . stringify ( data_array ) ; var export_string = "data:text/json;charset=utf-8," + encodeURIComponent ( json_string ) ; var download_element = document . createElement ( 'a' ) ; download_element . setAttribute ( 'href' , export_string ) ; download_element . setAttribute ( 'download' , 'testing_family_tree.json' ) ; document . body . append ( download_element ) ; download_element . click ( ) ; download_element . remove ( ) ; }
called by button.
called by button .
// create a copy that only includes non js side data