function get_stats() { var results; var functions; var loading_icon = document.getElementById("loading_icon"); var p_identity = document.getElementById("p_identity").value; //var p_identity = p_identity.replace(/[&\/\\#,+()$~%:*?<>{}]/g, ''); stats_form = { "p_identity" : p_identity.trim() }; var stats_data = JSON.stringify(stats_form); var xhttp = new XMLHttpRequest(); xhttp.onreadystatechange = function() { if (this.readyState == 4 && this.status == 200) { console.log(this.responseText); var result = JSON.parse(this.responseText); if(result.error) { loading_icon.style.display = "none"; search_button("SEARCH"); document.getElementById('results_error').innerHTML = '
' + result.message + '
'; } else { load_page(this.responseText); } } }; xhttp.withCredentials = true; xhttp.open("post", "api/get_stats.php"); xhttp.send(stats_data); loading_icon.style.display = "inline"; } function load_page(data){ results = JSON.parse(data); if(results.error) { $('#results_error').html(results.message); loading_icon.style.display = "none"; search_button("SEARCH"); return } var search_box = document.getElementById("search_input"); var login_content = document.getElementById("login_content"); var footer = document.getElementById("footer"); search_box.style.display = "none"; login_content.style.display = "none"; footer.style.display = "none"; load_introduction(); if(!results.user.user_movies.error && functions.get_user_movie_stats) { load_movies(); } if(!results.user.user_shows.error && functions.get_user_show_stats) { load_shows(); } if(!results.user.user_music.error && functions.get_user_music_stats) { load_music(); } if(!results.year_stats.error && (functions.get_year_stats_movies || functions.get_year_stats_shows || functions.get_year_stats_music)) { load_users(); } load_outro(); } //INTRODUCTION function load_introduction() { var text = ""; text += "(or not, I am pre-programmed to say that)
" text += "(at least you tried it out)
"; text += "(might wanna try it)
" text += ''; text += "(No, watching The Office twice in a year doesn't count as two shows)
" text += "(Better not be that same one again...)
" text += "(might wanna try it)
" text += ''; text += "(If you can call your taste "music"...)
' text += "(Whatever floats your boat...)
" text += "(might wanna try it)
" text += ''; text += "(or missing from it...)
" text += "