function topFunction() {
document.body.scrollTop = 0; // For Safari
document.documentElement.scrollTop = 0; // For Chrome, Firefox, IE and Opera
}
function login_menu() {
topFunction();
var html = '
Admin Login ';
html += '';
document.getElementById("setup").innerHTML = html;
}
function log_in() {
// Disable button
document.getElementById("log_in_button").disabled = true;
document.getElementById("log_in_button").style.opacity = '0.5';
// Get variables
password = document.getElementById('password').value;
username = document.getElementById('username').value;
admin_login_form = {"password" : password, "username" : username};
var admin_login_data = JSON.stringify(admin_login_form);
var xhttp = new XMLHttpRequest();
xhttp.onreadystatechange = function() {
if (this.readyState == 4 && this.status == 200) {
try {
var result= JSON.parse(this.responseText);
} catch(error) {
console.log('Failed to parse API response. Response: ' + this.responseText)
document.getElementById("log_in_button").disabled = false;
document.getElementById("log_in_button").style.opacity = '1';
document.getElementById('password').value = '';
}
if(result.error) {
document.getElementById("password_login_form_error").innerHTML = result.message;
document.getElementById("log_in_button").disabled = false;
document.getElementById("log_in_button").style.opacity = '1';
document.getElementById('password').value = '';
} else {
set_cookie("wrapperr-admin", result.cookie, 7);
location.reload();
}
}
};
xhttp.withCredentials = true;
xhttp.open("post", "../api/get_login_admin_cookie.php");
xhttp.send(admin_login_data);
return;
}
function set_password_form() {
topFunction();
var html = 'Create admin ';
html += '';
document.getElementById("setup").innerHTML = html;
}
function set_password() {
// Disable button
document.getElementById("create_admin_button").disabled = true;
document.getElementById("create_admin_button").style.opacity = '0.5';
// Check password match
if(document.getElementById('password').value != document.getElementById('password_2').value) {
alert("The passwords must match.");
document.getElementById('password').value = "";
document.getElementById('password_2').value = "";
document.getElementById('password').focus();
document.getElementById("create_admin_button").disabled = false;
document.getElementById("create_admin_button").style.opacity = '1';
return false;
} else {
password = document.getElementById('password').value;
username = document.getElementById('username').value;
}
admin_create_form = {"password" : password, "username" : username};
var admin_create_data = JSON.stringify(admin_create_form);
var xhttp = new XMLHttpRequest();
xhttp.onreadystatechange = function() {
if (this.readyState == 4 && this.status == 200) {
try {
var result= JSON.parse(this.responseText);
} catch(error) {
console.log('Failed to parse API response. Response: ' + this.responseText)
document.getElementById("create_admin_button").disabled = false;
document.getElementById("create_admin_button").style.opacity = '1';
}
if(result.error) {
document.getElementById("password_form_error").innerHTML = result.message;
document.getElementById("create_admin_button").disabled = false;
document.getElementById("create_admin_button").style.opacity = '1';
} else {
location.reload();
}
}
};
xhttp.withCredentials = true;
xhttp.open("post", "../api/create_admin.php");
xhttp.send(admin_create_data);
return;
}
function update_password_form() {
topFunction();
var html = '';
html += '';
html += '
';
html += '';
html += '
';
html += '';
html += '';
document.getElementById("setup").innerHTML = html;
}
function update_password() {
// Disable button
document.getElementById("update_admin_button").disabled = true;
document.getElementById("update_admin_button").style.opacity = '0.5';
// Check password match
if(document.getElementById('password').value != document.getElementById('password_2').value) {
alert("The passwords must match.");
document.getElementById('password').value = "";
document.getElementById('password_2').value = "";
document.getElementById('password').focus();
document.getElementById("update_admin_button").disabled = false;
document.getElementById("update_admin_button").style.opacity = '1';
return false;
} else {
password = document.getElementById('password').value;
username = document.getElementById('username').value;
}
admin_create_form = {"cookie" : get_cookie("wrapperr-admin"), "password" : password, "username" : username};
var admin_create_data = JSON.stringify(admin_create_form);
var xhttp = new XMLHttpRequest();
xhttp.onreadystatechange = function() {
if (this.readyState == 4 && this.status == 200) {
try {
var result= JSON.parse(this.responseText);
} catch(error) {
document.getElementById("password_form_error").innerHTML = 'Failed to parse API response.';
console.log('Failed to parse API response. Response: ' + this.responseText)
document.getElementById("update_admin_button").disabled = false;
document.getElementById("update_admin_button").style.opacity = '1';
}
if(result.error) {
document.getElementById("password_form_error").innerHTML = result.message;
document.getElementById("update_admin_button").disabled = false;
document.getElementById("update_admin_button").style.opacity = '1';
} else {
set_cookie("wrapperr-admin", "", 1);
location.reload();
}
}
};
xhttp.withCredentials = true;
xhttp.open("post", "../api/set_admin.php");
xhttp.send(admin_create_data);
return;
}
function get_admin_state() {
var xhttp = new XMLHttpRequest();
xhttp.onreadystatechange = function() {
if (this.readyState == 4 && this.status == 200) {
try {
var result= JSON.parse(this.responseText);
} catch(error) {
console.log('Failed to parse API response. Response: ' + this.responseText)
}
if(result.error) {
console.log(result.message);
} else if(!result.configured) {
first_time = true;
set_password_form();
} else {
login_menu();
}
}
};
xhttp.withCredentials = true;
xhttp.open("post", "../api/get_admin_state.php");
xhttp.send();
return;
}
function sign_out() {
set_cookie("wrapperr-admin", "", 1);
location.reload();
}
function admin_menu() {
var html = '';
html += '';
html += '';
html += '
';
html += '';
html += '';
html += '';
html += '';
html += '';
html += '';
html += '
';
document.getElementById("setup").innerHTML = html;
if(timezone === '') {
document.getElementById("set_wrapperr_settings").style.border = '0.15em dashed var(--red)';
document.getElementById("caching_menu").disabled = true;
document.getElementById("caching_menu").style.opacity = '0.5';
}
if(wrapped_start === '' || wrapped_end === '') {
document.getElementById("set_wrapperr_customization").style.border = '0.15em dashed var(--red)';
document.getElementById("caching_menu").disabled = true;
document.getElementById("caching_menu").style.opacity = '0.5';
}
if(tautulli_ip === '' || tautulli_apikey === '' || tautulli_length === '') {
document.getElementById("set_tautulli_settings").style.border = '0.15em dashed var(--red)';
document.getElementById("caching_menu").disabled = true;
document.getElementById("caching_menu").style.opacity = '0.5';
}
}
function set_tautulli_settings() {
topFunction();
var html = '';
html += '';
html += '
';
html += '';
html += '
';
html += '';
html += '';
document.getElementById("setup").innerHTML = html;
}
function set_tautulli_settings_call() {
document.getElementById("set_tautulli_form_button").disabled = true;
document.getElementById("set_tautulli_form_button").style.opacity = '0.5';
tautulli_apikey = document.getElementById('tautulli_apikey').value;
tautulli_ip = document.getElementById('tautulli_ip').value;
tautulli_port = document.getElementById('tautulli_port').value;
tautulli_length = document.getElementById('tautulli_length').value;
tautulli_root = document.getElementById('tautulli_root').value;
tautulli_libraries = document.getElementById('tautulli_libraries').value;
tautulli_grouping = document.getElementById('tautulli_grouping').checked;
https = document.getElementById('https').checked;
if(tautulli_apikey === '') {
document.getElementById("set_tautulli_form_button").disabled = false;
document.getElementById("set_tautulli_form_button").style.opacity = '1';
alert('API key is required for Tautulli to function.');
document.getElementById('tautulli_apikey').focus();
return;
}
if(tautulli_ip === '') {
document.getElementById("set_tautulli_form_button").disabled = false;
document.getElementById("set_tautulli_form_button").style.opacity = '1';
alert('Tautulli IP is required for Tautulli to function.');
document.getElementById('tautulli_ip').focus();
return;
}
if(tautulli_length === '') {
document.getElementById("set_tautulli_form_button").disabled = false;
document.getElementById("set_tautulli_form_button").style.opacity = '1';
alert('Tautulli item length is required for Tautulli to function.');
document.getElementById('tautulli_length').focus();
return;
}
tautulli_settings_form = {
"cookie" : cookie,
"clear_cache" : false,
"data_type" : "tautulli_settings",
"data" : {
"tautulli_apikey" : tautulli_apikey,
"tautulli_ip" : tautulli_ip,
"tautulli_port" : tautulli_port,
"tautulli_length" : tautulli_length,
"tautulli_root" : tautulli_root,
"tautulli_libraries" : tautulli_libraries,
"tautulli_grouping" : tautulli_grouping,
"https" : https
}
};
var tautulli_settings_data = JSON.stringify(tautulli_settings_form);
var xhttp = new XMLHttpRequest();
xhttp.onreadystatechange = function() {
if (this.readyState == 4 && this.status == 200) {
try {
var result= JSON.parse(this.responseText);
} catch(error) {
alert('Failed to parse API response.');
console.log('Failed to parse API response. Response: ' + this.responseText)
document.getElementById("set_tautulli_form_button").disabled = false;
document.getElementById("set_tautulli_form_button").style.opacity = '1';
}
if(result.error) {
alert(result.message);
document.getElementById("set_tautulli_form_button").disabled = false;
document.getElementById("set_tautulli_form_button").style.opacity = '1';
} else {
get_config(get_cookie('wrapperr-admin'));
}
}
};
xhttp.withCredentials = true;
xhttp.open("post", "../api/set_config.php");
xhttp.send(tautulli_settings_data);
return;
}
function set_wrapperr_settings() {
topFunction();
var html = '';
html += '';
html += '
';
html += '';
html += '
';
html += '';
html += '';
document.getElementById("setup").innerHTML = html;
}
function set_wrapperr_settings_call() {
document.getElementById("set_wrapperr_settings_form_button").disabled = true;
document.getElementById("set_wrapperr_settings_form_button").style.opacity = '0.5';
use_cache = document.getElementById('use_cache').checked;
use_logs = document.getElementById('use_logs').checked;
use_plex_auth = document.getElementById('use_plex_auth').checked;
wrapperr_root = document.getElementById('wrapperr_root').value;
application_name_str = document.getElementById('application_name_str').value;
application_url_str = document.getElementById('application_url_str').value;
create_share_links = document.getElementById('create_share_links').checked;
timezone = document.getElementById('timezone').value;
clear_cache = document.getElementById('clear_cache').checked;
if(timezone === '') {
document.getElementById("set_wrapperr_settings_form_button").disabled = false;
document.getElementById("set_wrapperr_settings_form_button").style.opacity = '1';
alert('Timezone is required for Wrapperr to function.');
document.getElementById('timezone').focus();
return;
}
wrapperr_settings_form = {
"cookie" : cookie,
"clear_cache" : clear_cache,
"data_type" : "wrapperr_settings",
"data" : {
"use_cache" : use_cache,
"use_logs" : use_logs,
"use_plex_auth" : use_plex_auth,
"wrapperr_root" : wrapperr_root,
"create_share_links" : create_share_links,
"timezone" : timezone,
"application_name" : application_name_str,
"application_url" : application_url_str
}
};
var wrapperr_settings_data = JSON.stringify(wrapperr_settings_form);
var xhttp = new XMLHttpRequest();
xhttp.onreadystatechange = function() {
if (this.readyState == 4 && this.status == 200) {
try {
var result= JSON.parse(this.responseText);
} catch(error) {
alert('Failed to parse API response.');
console.log('Failed to parse API response. Response: ' + this.responseText);
document.getElementById("set_wrapperr_settings_form_button").disabled = false;
document.getElementById("set_wrapperr_settings_form_button").style.opacity = '1';
}
if(result.error) {
alert(result.message);
document.getElementById("set_wrapperr_settings_form_button").disabled = false;
document.getElementById("set_wrapperr_settings_form_button").style.opacity = '1';
} else {
get_config(get_cookie('wrapperr-admin'));
}
}
};
xhttp.withCredentials = true;
xhttp.open("post", "../api/set_config.php");
xhttp.send(wrapperr_settings_data);
return;
}
function set_wrapperr_customization() {
topFunction();
var html = '';
html += '';
html += '
';
html += '';
html += '
';
html += '';
html += '';
// Place content from config
document.getElementById("setup").innerHTML = html;
document.getElementById("wrapperr_front_page_title").value = wrapperr_front_page_title;
document.getElementById("wrapperr_front_page_subtitle").value = wrapperr_front_page_subtitle;
document.getElementById("stats_intro_title").value = stats_intro_title;
document.getElementById("stats_intro_subtitle").value = stats_intro_subtitle;
document.getElementById("stats_outro_title").value = stats_outro_title;
document.getElementById("stats_outro_subtitle").value = stats_outro_subtitle;
document.getElementById("get_user_movie_stats_title").value = get_user_movie_stats_title;
document.getElementById("get_user_movie_stats_subtitle").value = get_user_movie_stats_subtitle;
document.getElementById("get_user_movie_stats_subsubtitle").value = get_user_movie_stats_subsubtitle;
document.getElementById("get_user_movie_stats_subtitle_one").value = get_user_movie_stats_subtitle_one;
document.getElementById("get_user_movie_stats_subsubtitle_one").value = get_user_movie_stats_subsubtitle_one;
document.getElementById("get_user_movie_stats_subtitle_none").value = get_user_movie_stats_subtitle_none;
document.getElementById("get_user_movie_stats_subsubtitle_none").value = get_user_movie_stats_subsubtitle_none;
document.getElementById("get_user_movie_stats_movie_completion_title").value = get_user_movie_stats_movie_completion_title;
document.getElementById("get_user_movie_stats_movie_completion_title_plural").value = get_user_movie_stats_movie_completion_title_plural;
document.getElementById("get_user_movie_stats_movie_completion_subtitle").value = get_user_movie_stats_movie_completion_subtitle;
document.getElementById("get_user_movie_stats_pause_title").value = get_user_movie_stats_pause_title;
document.getElementById("get_user_movie_stats_pause_subtitle").value = get_user_movie_stats_pause_subtitle;
document.getElementById("get_user_movie_stats_pause_title_one").value = get_user_movie_stats_pause_title_one;
document.getElementById("get_user_movie_stats_pause_subtitle_one").value = get_user_movie_stats_pause_subtitle_one;
document.getElementById("get_user_movie_stats_pause_title_none").value = get_user_movie_stats_pause_title_none;
document.getElementById("get_user_movie_stats_pause_subtitle_none").value = get_user_movie_stats_pause_subtitle_none;
document.getElementById("get_user_movie_stats_oldest_title").value = get_user_movie_stats_oldest_title;
document.getElementById("get_user_movie_stats_oldest_subtitle").value = get_user_movie_stats_oldest_subtitle;
document.getElementById("get_user_movie_stats_oldest_subtitle_pre_1950").value = get_user_movie_stats_oldest_subtitle_pre_1950;
document.getElementById("get_user_movie_stats_oldest_subtitle_pre_1975").value = get_user_movie_stats_oldest_subtitle_pre_1975;
document.getElementById("get_user_movie_stats_oldest_subtitle_pre_2000").value = get_user_movie_stats_oldest_subtitle_pre_2000;
document.getElementById("get_user_movie_stats_spent_title").value = get_user_movie_stats_spent_title;
document.getElementById("get_user_show_stats_title").value = get_user_show_stats_title;
document.getElementById("get_user_show_stats_subtitle").value = get_user_show_stats_subtitle;
document.getElementById("get_user_show_stats_subsubtitle").value = get_user_show_stats_subsubtitle;
document.getElementById("get_user_show_stats_subtitle_one").value = get_user_show_stats_subtitle_one;
document.getElementById("get_user_show_stats_subsubtitle_one").value = get_user_show_stats_subsubtitle_one;
document.getElementById("get_user_show_stats_subtitle_none").value = get_user_show_stats_subtitle_none;
document.getElementById("get_user_show_stats_subsubtitle_none").value = get_user_show_stats_subsubtitle_none;
document.getElementById("get_user_show_stats_most_played_title").value = get_user_show_stats_most_played_title;
document.getElementById("get_user_show_stats_most_played_subtitle").value = get_user_show_stats_most_played_subtitle;
document.getElementById("get_user_show_stats_buddy_title").value = get_user_show_stats_buddy_title;
document.getElementById("get_user_show_stats_buddy_subtitle").value = get_user_show_stats_buddy_subtitle;
document.getElementById("get_user_show_stats_buddy_title_none").value = get_user_show_stats_buddy_title_none;
document.getElementById("get_user_show_stats_buddy_subtitle_none").value = get_user_show_stats_buddy_subtitle_none;
document.getElementById("get_user_show_stats_spent_title").value = get_user_show_stats_spent_title;
document.getElementById("get_user_music_stats_title").value = get_user_music_stats_title;
document.getElementById("get_user_music_stats_subtitle").value = get_user_music_stats_subtitle;
document.getElementById("get_user_music_stats_subsubtitle").value = get_user_music_stats_subsubtitle;
document.getElementById("get_user_music_stats_subtitle_one").value = get_user_music_stats_subtitle_one;
document.getElementById("get_user_music_stats_subsubtitle_one").value = get_user_music_stats_subsubtitle_one;
document.getElementById("get_user_music_stats_subtitle_none").value = get_user_music_stats_subtitle_none;
document.getElementById("get_user_music_stats_subsubtitle_none").value = get_user_music_stats_subsubtitle_none;
document.getElementById("get_user_music_stats_spent_title").value = get_user_music_stats_spent_title;
document.getElementById("get_user_music_stats_spent_subtitle").value = get_user_music_stats_spent_subtitle;
document.getElementById("get_user_music_stats_oldest_album_title").value = get_user_music_stats_oldest_album_title;
document.getElementById("get_user_music_stats_oldest_album_subtitle").value = get_user_music_stats_oldest_album_subtitle;
document.getElementById("get_year_stats_title").value = get_year_stats_title;
document.getElementById("get_year_stats_subtitle").value = get_year_stats_subtitle;
document.getElementById("get_year_stats_subsubtitle").value = get_year_stats_subsubtitle;
document.getElementById("get_year_stats_movies_duration_title").value = get_year_stats_movies_duration_title;
document.getElementById("get_year_stats_shows_duration_title").value = get_year_stats_shows_duration_title;
document.getElementById("get_year_stats_music_duration_title").value = get_year_stats_music_duration_title;
document.getElementById("get_year_stats_duration_sum_title").value = get_year_stats_duration_sum_title;
}
function toggle_hidden_form(div_id) {
var div = document.getElementById(div_id);
if(div.className === "form_shown") {
div.classList.remove('form_shown');
div.classList.add('form_hidden');
} else {
div.classList.remove('form_hidden');
div.classList.add('form_shown');
}
}
function set_wrapperr_customization_call() {
document.getElementById("set_wrapperr_customization_form_button").disabled = true;
document.getElementById("set_wrapperr_customization_form_button").style.opacity = '0.5';
wrapped_start = new Date(document.getElementById('wrapped_start').value);
wrapped_end = new Date(document.getElementById('wrapped_end').value);
wrapperr_front_page_title = document.getElementById('wrapperr_front_page_title').value;
wrapperr_front_page_subtitle = document.getElementById('wrapperr_front_page_subtitle').value;
stats_intro_title = document.getElementById('stats_intro_title').value;
stats_intro_subtitle = document.getElementById('stats_intro_subtitle').value;
stats_outro_title = document.getElementById('stats_outro_title').value;
stats_outro_subtitle = document.getElementById('stats_outro_subtitle').value;
stats_order_by_plays = document.getElementById('stats_order_by_plays').checked;
stats_order_by_duration = document.getElementById('stats_order_by_duration').checked;
get_user_movie_stats = document.getElementById('get_user_movie_stats').checked;
get_user_movie_stats_title = document.getElementById('get_user_movie_stats_title').value;
get_user_movie_stats_subtitle = document.getElementById('get_user_movie_stats_subtitle').value;
get_user_movie_stats_subsubtitle = document.getElementById('get_user_movie_stats_subsubtitle').value;
get_user_movie_stats_subtitle_one = document.getElementById('get_user_movie_stats_subtitle_one').value;
get_user_movie_stats_subsubtitle_one = document.getElementById('get_user_movie_stats_subsubtitle_one').value;
get_user_movie_stats_subtitle_none = document.getElementById('get_user_movie_stats_subtitle_none').value;
get_user_movie_stats_subsubtitle_none = document.getElementById('get_user_movie_stats_subsubtitle_none').value;
get_user_movie_stats_top_movie = document.getElementById('get_user_movie_stats_top_movie').value;
get_user_movie_stats_top_movie_plural = document.getElementById('get_user_movie_stats_top_movie_plural').value;
get_user_movie_stats_movie_completion_title = document.getElementById('get_user_movie_stats_movie_completion_title').value;
get_user_movie_stats_movie_completion_title_plural = document.getElementById('get_user_movie_stats_movie_completion_title_plural').value;
get_user_movie_stats_movie_completion_subtitle = document.getElementById('get_user_movie_stats_movie_completion_subtitle').value;
get_user_movie_stats_pause_title = document.getElementById('get_user_movie_stats_pause_title').value;
get_user_movie_stats_pause_subtitle = document.getElementById('get_user_movie_stats_pause_subtitle').value;
get_user_movie_stats_pause_title_one = document.getElementById('get_user_movie_stats_pause_title_one').value;
get_user_movie_stats_pause_subtitle_one = document.getElementById('get_user_movie_stats_pause_subtitle_one').value;
get_user_movie_stats_pause_title_none = document.getElementById('get_user_movie_stats_pause_title_none').value;
get_user_movie_stats_pause_subtitle_none = document.getElementById('get_user_movie_stats_pause_subtitle_none').value;
get_user_movie_stats_oldest_title = document.getElementById('get_user_movie_stats_oldest_title').value;
get_user_movie_stats_oldest_subtitle = document.getElementById('get_user_movie_stats_oldest_subtitle').value;
get_user_movie_stats_oldest_subtitle_pre_1950 = document.getElementById('get_user_movie_stats_oldest_subtitle_pre_1950').value;
get_user_movie_stats_oldest_subtitle_pre_1975 = document.getElementById('get_user_movie_stats_oldest_subtitle_pre_1975').value;
get_user_movie_stats_oldest_subtitle_pre_2000 = document.getElementById('get_user_movie_stats_oldest_subtitle_pre_2000').value;
get_user_movie_stats_spent_title = document.getElementById('get_user_movie_stats_spent_title').value;
get_user_show_stats = document.getElementById('get_user_show_stats').checked;
get_user_show_stats_buddy = document.getElementById('get_user_show_stats_buddy').checked;
get_user_show_stats_title = document.getElementById('get_user_show_stats_title').value;
get_user_show_stats_subtitle = document.getElementById('get_user_show_stats_subtitle').value;
get_user_show_stats_subsubtitle = document.getElementById('get_user_show_stats_subsubtitle').value;
get_user_show_stats_subtitle_one = document.getElementById('get_user_show_stats_subtitle_one').value;
get_user_show_stats_subsubtitle_one = document.getElementById('get_user_show_stats_subsubtitle_one').value;
get_user_show_stats_subtitle_none = document.getElementById('get_user_show_stats_subtitle_none').value;
get_user_show_stats_subsubtitle_none = document.getElementById('get_user_show_stats_subsubtitle_none').value;
get_user_show_stats_top_show = document.getElementById('get_user_show_stats_top_show').value;
get_user_show_stats_top_show_plural = document.getElementById('get_user_show_stats_top_show_plural').value;
get_user_show_stats_most_played_title = document.getElementById('get_user_show_stats_most_played_title').value;
get_user_show_stats_most_played_subtitle = document.getElementById('get_user_show_stats_most_played_subtitle').value;
get_user_show_stats_buddy_title = document.getElementById('get_user_show_stats_buddy_title').value;
get_user_show_stats_buddy_subtitle = document.getElementById('get_user_show_stats_buddy_subtitle').value;
get_user_show_stats_buddy_title_none = document.getElementById('get_user_show_stats_buddy_title_none').value;
get_user_show_stats_buddy_subtitle_none = document.getElementById('get_user_show_stats_buddy_subtitle_none').value;
get_user_show_stats_spent_title = document.getElementById('get_user_show_stats_spent_title').value;
get_user_music_stats = document.getElementById('get_user_music_stats').checked;
get_user_music_stats_title = document.getElementById('get_user_music_stats_title').value;
get_user_music_stats_subtitle = document.getElementById('get_user_music_stats_subtitle').value;
get_user_music_stats_subsubtitle = document.getElementById('get_user_music_stats_subsubtitle').value;
get_user_music_stats_subtitle_one = document.getElementById('get_user_music_stats_subtitle_one').value;
get_user_music_stats_subsubtitle_one = document.getElementById('get_user_music_stats_subsubtitle_one').value;
get_user_music_stats_subtitle_none = document.getElementById('get_user_music_stats_subtitle_none').value;
get_user_music_stats_subsubtitle_none = document.getElementById('get_user_music_stats_subsubtitle_none').value;
get_user_music_stats_top_track = document.getElementById('get_user_music_stats_top_track').value;
get_user_music_stats_top_track_plural = document.getElementById('get_user_music_stats_top_track_plural').value;
get_user_music_stats_top_album_plural = document.getElementById('get_user_music_stats_top_album_plural').value;
get_user_music_stats_top_artist_plural = document.getElementById('get_user_music_stats_top_artist_plural').value;
get_user_music_stats_spent_title = document.getElementById('get_user_music_stats_spent_title').value;
get_user_music_stats_spent_subtitle = document.getElementById('get_user_music_stats_spent_subtitle').value;
get_user_music_stats_oldest_album_title = document.getElementById('get_user_music_stats_oldest_album_title').value;
get_user_music_stats_oldest_album_subtitle = document.getElementById('get_user_music_stats_oldest_album_subtitle').value;
get_year_stats_title = document.getElementById('get_year_stats_title').value;
get_year_stats_subtitle = document.getElementById('get_year_stats_subtitle').value;
get_year_stats_subsubtitle = document.getElementById('get_year_stats_subsubtitle').value;
get_year_stats_movies = document.getElementById('get_year_stats_movies').checked;
get_year_stats_movies_title = document.getElementById('get_year_stats_movies_title').value;
get_year_stats_movies_duration_title = document.getElementById('get_year_stats_movies_duration_title').value;
get_year_stats_shows = document.getElementById('get_year_stats_shows').checked;
get_year_stats_shows_title = document.getElementById('get_year_stats_shows_title').value;
get_year_stats_shows_duration_title = document.getElementById('get_year_stats_shows_duration_title').value;
get_year_stats_music = document.getElementById('get_year_stats_music').checked;
get_year_stats_music_title = document.getElementById('get_year_stats_music_title').value;
get_year_stats_music_duration_title = document.getElementById('get_year_stats_music_duration_title').value;
get_year_stats_leaderboard = document.getElementById('get_year_stats_leaderboard').checked;
get_year_stats_leaderboard_title = document.getElementById('get_year_stats_leaderboard_title').value;
get_year_stats_duration_sum_title = document.getElementById('get_year_stats_duration_sum_title').value;
clear_cache = document.getElementById('clear_cache').checked;
wrapperr_and = document.getElementById("wrapperr_and").value;
wrapperr_play = document.getElementById("wrapperr_play").value;
wrapperr_play_plural = document.getElementById("wrapperr_play_plural").value;
wrapperr_day = document.getElementById("wrapperr_day").value;
wrapperr_day_plural = document.getElementById("wrapperr_day_plural").value;
wrapperr_hour = document.getElementById("wrapperr_hour").value;
wrapperr_hour_plural = document.getElementById("wrapperr_hour_plural").value;
wrapperr_minute = document.getElementById("wrapperr_minute").value;
wrapperr_minute_plural = document.getElementById("wrapperr_minute_plural").value;
wrapperr_second = document.getElementById("wrapperr_second").value;
wrapperr_second_plural = document.getElementById("wrapperr_second_plural").value;
wrapperr_sort_plays = document.getElementById("wrapperr_sort_plays").value;
wrapperr_sort_duration = document.getElementById("wrapperr_sort_duration").value;
if(wrapped_end < wrapped_start) {
document.getElementById("set_wrapperr_customization_form_button").disabled = false;
document.getElementById("set_wrapperr_customization_form_button").style.opacity = '1';
alert('The wrapped end period must be later than the wrapped start period.');
document.getElementById('wrapped_end').focus();
return;
}
if(wrapped_end === '') {
document.getElementById("set_wrapperr_customization_form_button").disabled = false;
document.getElementById("set_wrapperr_customization_form_button").style.opacity = '1';
alert('Ending of wrapped period is required for Wrapperr to function.');
document.getElementById('wrapped_end').focus();
return;
}
if(wrapped_start === '') {
document.getElementById("set_wrapperr_customization_form_button").disabled = false;
document.getElementById("set_wrapperr_customization_form_button").style.opacity = '1';
alert('Start of wrapped period is required for Wrapperr to function.');
document.getElementById('wrapped_start').focus();
return;
}
wrapperr_customization_form = {
"cookie" : cookie,
"clear_cache" : clear_cache,
"data_type" : "wrapperr_customization",
"data" : {
"wrapped_start" : Math.round(wrapped_start.getTime() / 1000),
"wrapped_end" : Math.round(wrapped_end.getTime() / 1000),
"wrapperr_front_page_title" : wrapperr_front_page_title,
"wrapperr_front_page_subtitle" : wrapperr_front_page_subtitle,
"stats_intro_title" : stats_intro_title,
"stats_intro_subtitle" : stats_intro_subtitle,
"stats_outro_title" : stats_outro_title,
"stats_outro_subtitle" : stats_outro_subtitle,
"stats_order_by_plays" : stats_order_by_plays,
"stats_order_by_duration" : stats_order_by_duration,
"get_user_movie_stats" : get_user_movie_stats,
"get_user_movie_stats_title" : get_user_movie_stats_title,
"get_user_movie_stats_subtitle" : get_user_movie_stats_subtitle,
"get_user_movie_stats_subsubtitle" : get_user_movie_stats_subsubtitle,
"get_user_movie_stats_subtitle_one" : get_user_movie_stats_subtitle_one,
"get_user_movie_stats_subsubtitle_one" : get_user_movie_stats_subsubtitle_one,
"get_user_movie_stats_subtitle_none" : get_user_movie_stats_subtitle_none,
"get_user_movie_stats_subsubtitle_none" : get_user_movie_stats_subsubtitle_none,
"get_user_movie_stats_top_movie" : get_user_movie_stats_top_movie,
"get_user_movie_stats_top_movie_plural" : get_user_movie_stats_top_movie_plural,
"get_user_movie_stats_movie_completion_title" : get_user_movie_stats_movie_completion_title,
"get_user_movie_stats_movie_completion_title_plural" : get_user_movie_stats_movie_completion_title_plural,
"get_user_movie_stats_movie_completion_subtitle" : get_user_movie_stats_movie_completion_subtitle,
"get_user_movie_stats_pause_title" : get_user_movie_stats_pause_title,
"get_user_movie_stats_pause_subtitle" : get_user_movie_stats_pause_subtitle,
"get_user_movie_stats_pause_title_one" : get_user_movie_stats_pause_title_one,
"get_user_movie_stats_pause_subtitle_one" : get_user_movie_stats_pause_subtitle_one,
"get_user_movie_stats_pause_title_none" : get_user_movie_stats_pause_title_none,
"get_user_movie_stats_pause_subtitle_none" : get_user_movie_stats_pause_subtitle_none,
"get_user_movie_stats_oldest_title" : get_user_movie_stats_oldest_title,
"get_user_movie_stats_oldest_subtitle" : get_user_movie_stats_oldest_subtitle,
"get_user_movie_stats_oldest_subtitle_pre_1950" : get_user_movie_stats_oldest_subtitle_pre_1950,
"get_user_movie_stats_oldest_subtitle_pre_1975" : get_user_movie_stats_oldest_subtitle_pre_1975,
"get_user_movie_stats_oldest_subtitle_pre_2000" : get_user_movie_stats_oldest_subtitle_pre_2000,
"get_user_movie_stats_spent_title" : get_user_movie_stats_spent_title,
"get_user_show_stats" : get_user_show_stats,
"get_user_show_stats_buddy" : get_user_show_stats_buddy,
"get_user_show_stats_title" : get_user_show_stats_title,
"get_user_show_stats_subtitle" : get_user_show_stats_subtitle,
"get_user_show_stats_subsubtitle" : get_user_show_stats_subsubtitle,
"get_user_show_stats_subtitle_one" : get_user_show_stats_subtitle_one,
"get_user_show_stats_subsubtitle_one" : get_user_show_stats_subsubtitle_one,
"get_user_show_stats_subtitle_none" : get_user_show_stats_subtitle_none,
"get_user_show_stats_subsubtitle_none" : get_user_show_stats_subsubtitle_none,
"get_user_show_stats_top_show" : get_user_show_stats_top_show,
"get_user_show_stats_top_show_plural" : get_user_show_stats_top_show_plural,
"get_user_show_stats_spent_title" : get_user_show_stats_spent_title,
"get_user_show_stats_most_played_title" : get_user_show_stats_most_played_title,
"get_user_show_stats_most_played_subtitle" : get_user_show_stats_most_played_subtitle,
"get_user_show_stats_buddy_title" : get_user_show_stats_buddy_title,
"get_user_show_stats_buddy_subtitle" : get_user_show_stats_buddy_subtitle,
"get_user_show_stats_buddy_title_none" : get_user_show_stats_buddy_title_none,
"get_user_show_stats_buddy_subtitle_none" : get_user_show_stats_buddy_subtitle_none,
"get_user_music_stats" : get_user_music_stats,
"get_user_music_stats_title" : get_user_music_stats_title,
"get_user_music_stats_subtitle" : get_user_music_stats_subtitle,
"get_user_music_stats_subsubtitle" : get_user_music_stats_subsubtitle,
"get_user_music_stats_subtitle_one" : get_user_music_stats_subtitle_one,
"get_user_music_stats_subsubtitle_one" : get_user_music_stats_subsubtitle_one,
"get_user_music_stats_subtitle_none" : get_user_music_stats_subtitle_none,
"get_user_music_stats_subsubtitle_none" : get_user_music_stats_subsubtitle_none,
"get_user_music_stats_top_track" : get_user_music_stats_top_track,
"get_user_music_stats_top_track_plural" : get_user_music_stats_top_track_plural,
"get_user_music_stats_top_album_plural" : get_user_music_stats_top_album_plural,
"get_user_music_stats_top_artist_plural" : get_user_music_stats_top_artist_plural,
"get_user_music_stats_spent_title" : get_user_music_stats_spent_title,
"get_user_music_stats_spent_subtitle" : get_user_music_stats_spent_subtitle,
"get_user_music_stats_oldest_album_title" : get_user_music_stats_oldest_album_title,
"get_user_music_stats_oldest_album_subtitle" : get_user_music_stats_oldest_album_subtitle,
"get_year_stats_title" : get_year_stats_title,
"get_year_stats_subtitle" : get_year_stats_subtitle,
"get_year_stats_subsubtitle" : get_year_stats_subsubtitle,
"get_year_stats_movies" : get_year_stats_movies,
"get_year_stats_movies_title" : get_year_stats_movies_title,
"get_year_stats_movies_duration_title" : get_year_stats_movies_duration_title,
"get_year_stats_shows" : get_year_stats_shows,
"get_year_stats_shows_title" : get_year_stats_shows_title,
"get_year_stats_shows_duration_title" : get_year_stats_shows_duration_title,
"get_year_stats_music" : get_year_stats_music,
"get_year_stats_music_title" : get_year_stats_music_title,
"get_year_stats_music_duration_title" : get_year_stats_music_duration_title,
"get_year_stats_leaderboard" : get_year_stats_leaderboard,
"get_year_stats_leaderboard_title" : get_year_stats_leaderboard_title,
"get_year_stats_duration_sum_title" : get_year_stats_duration_sum_title,
"wrapperr_and" : wrapperr_and,
"wrapperr_play" : wrapperr_play,
"wrapperr_play_plural" : wrapperr_play_plural,
"wrapperr_day" : wrapperr_day,
"wrapperr_day_plural" : wrapperr_day_plural,
"wrapperr_hour" : wrapperr_hour,
"wrapperr_hour_plural" : wrapperr_hour_plural,
"wrapperr_minute" : wrapperr_minute,
"wrapperr_minute_plural" : wrapperr_minute_plural,
"wrapperr_second" : wrapperr_second,
"wrapperr_second_plural" : wrapperr_second_plural,
"wrapperr_sort_plays" : wrapperr_sort_plays,
"wrapperr_sort_duration" : wrapperr_sort_duration
}
};
var wrapperr_customization_data = JSON.stringify(wrapperr_customization_form);
var xhttp = new XMLHttpRequest();
xhttp.onreadystatechange = function() {
if (this.readyState == 4 && this.status == 200) {
try {
var result= JSON.parse(this.responseText);
} catch(error) {
alert('Failed to parse API response.');
console.log('Failed to parse API response. Response: ' + this.responseText);
document.getElementById("set_wrapperr_customization_form_button").disabled = false;
document.getElementById("set_wrapperr_customization_form_button").style.opacity = '1';
}
if(result.error) {
alert(result.message);
document.getElementById("set_wrapperr_customization_form_button").disabled = false;
document.getElementById("set_wrapperr_customization_form_button").style.opacity = '1';
} else {
get_config(get_cookie('wrapperr-admin'));
}
}
};
xhttp.withCredentials = true;
xhttp.open("post", "../api/set_config.php");
xhttp.send(wrapperr_customization_data);
return;
}
function caching_menu() {
var html = '';
html += '';
html += '
';
html += '';
html += '
';
html += '';
html += `
Days to cache each loop:
`;
document.getElementById("setup").innerHTML = html;
}
function cache_initiate() {
var days = document.getElementById('days').value;
var html = `
Caching log:
`;
var today = new Date();
var time = today.getHours() + ":" + today.getMinutes() + ":" + today.getSeconds() + ' - ';
document.getElementById('cache').innerHTML = html;
document.getElementById('cache_results').innerHTML += '' + time + 'Creating new cache request. Maximum ' + days + ' days.' + '
';
get_stats(days);
}
function cache_log(days, result, complete) {
var today = new Date();
var time = today.getHours() + ":" + today.getMinutes() + ":" + today.getSeconds() + ' - ';
if(result) {
document.getElementById('cache_results').innerHTML += '' + time + 'Completed caching with a maxmimum of ' + days + ' days.' + '
';
} else {
document.getElementById('cache_results').innerHTML += ' ' + time + 'Error caching ' + days + ' days. Stopping.' + '
';
document.getElementById('loading_icon').style.display = "none";
document.getElementById("cache_button").disabled = false;
document.getElementById("cache_button").style.opacity = '1';
}
if(complete) {
document.getElementById('cache_results').innerHTML += '' + time + 'Finished caching request.' + '
';
document.getElementById('loading_icon').style.display = "none";
document.getElementById("cache_button").disabled = false;
document.getElementById("cache_button").style.opacity = '1';
} else {
document.getElementById('cache_results').innerHTML += '' + time + 'Requesting new cache from Wrapperr. Maximum ' + days + ' days.' + '
';
}
var cache_results = document.getElementById("cache_results");
cache_results.scrollTop = cache_results.scrollHeight;
}
function get_stats(days) {
document.getElementById("cache_button").disabled = true;
document.getElementById("cache_button").style.opacity = '0.5';
stats_form = {
"cookie" : get_cookie('wrapperr-admin'),
"caching" : true,
"cache_limit" : days
};
var stats_data = JSON.stringify(stats_form);
var xhttp = new XMLHttpRequest();
xhttp.onreadystatechange = function() {
if (this.readyState == 4 && this.status == 200) {
try {
var result= JSON.parse(this.responseText);
} catch(error) {
if(this.responseText.includes('Maximum execution time of')) {
cache_log(days, false, true);
document.getElementById("cache_button").disabled = false;
document.getElementById("cache_button").style.opacity = '1';
alert('PHP runtime was exceeded and stopped execution. Lower days cached to prevent this.');
console.log('Failed to parse API response. Error: ' + this.responseText);
} else {
cache_log(days, false, true);
alert('Failed to parse API response.');
console.log('Failed to parse API response. Error: ' + this.responseText);
document.getElementById("cache_button").disabled = false;
document.getElementById("cache_button").style.opacity = '1';
}
return;
}
if(result.error) {
alert(result.message);
cache_log(days, false, true);
} else {
if(!result.caching_complete) {
cache_log(days, true, result.caching_complete);
get_stats(days);
} else {
cache_log(days, true, result.caching_complete);
}
}
}
};
xhttp.withCredentials = true;
xhttp.open("post", root + "api/get_stats.php", );
xhttp.send(stats_data);
return;
}
function test_tautulli_connection() {
document.getElementById("test_connection").disabled = true;
document.getElementById("test_connection").style.opacity = '0.5';
var button = document.getElementById('test_connection');
button.style.backgroundColor = 'lightgrey';
https_temp = document.getElementById('https').checked;
ip_temp = document.getElementById('tautulli_ip').value;
root_temp = document.getElementById('tautulli_root').value;
port_temp = document.getElementById('tautulli_port').value;
api_temp = document.getElementById('tautulli_apikey').value;
if(https_temp) {
var prefix = 'https://';
} else {
var prefix = 'http://';
}
if(root_temp == "") {
var suffix = '';
} else {
var suffix = '/' + root_temp + '/';
}
if(port_temp == "") {
url = prefix + ip_temp + suffix + '/api/v2';
} else {
url = prefix + ip_temp + ':' + port_temp + suffix + '/api/v2';
}
config_form = {"url" : url, "https" : https_temp, "apikey" : api_temp};
var config_data = JSON.stringify(config_form);
var xhttp = new XMLHttpRequest();
xhttp.onreadystatechange = function() {
if (this.readyState == 4 && this.status == 200) {
try {
var result= JSON.parse(this.responseText);
} catch(error) {
console.log('Failed to parse API response. Response: ' + this.responseText)
alert('Failed to parse API response.');
button.style.backgroundColor = 'var(--red)';
document.getElementById("test_connection").disabled = false;
document.getElementById("test_connection").style.opacity = '1';
}
if(!result.error) {
button.style.backgroundColor = 'var(--green)';
document.getElementById("test_connection").disabled = false;
document.getElementById("test_connection").style.opacity = '1';
} else {
button.style.backgroundColor = 'var(--red)';
document.getElementById("test_connection").disabled = false;
document.getElementById("test_connection").style.opacity = '1';
alert(result.message);
}
}
};
xhttp.withCredentials = true;
xhttp.open("post", root + 'api/get_connection.php');
xhttp.send(config_data);
}
function get_wrapper_version() {
var xhttp = new XMLHttpRequest();
xhttp.onreadystatechange = function() {
if (this.readyState == 4 && this.status == 200) {
try {
var result= JSON.parse(this.responseText);
} catch(error) {
console.log('Failed to parse Wrapperr version. Response: ' + this.responseText)
}
if(!result.error) {
document.getElementById('github_link').innerHTML = 'GitHub (' + result.wrapperr_version + ')';
if(result.application_name && result.application_name !== '') {
document.getElementById('application_name').innerHTML = result.application_name + ' Setup';
document.title = result.application_name;
}
}
}
};
xhttp.withCredentials = true;
xhttp.open("post", "../api/get_wrapperr_version.php");
xhttp.send();
return;
}
// Get admin configuration state
function get_admin_state() {
var xhttp = new XMLHttpRequest();
xhttp.onreadystatechange = function() {
if (this.readyState == 4 && this.status == 200) {
try {
var result= JSON.parse(this.responseText);
} catch(error) {
console.log('Failed to parse API response. Response: ' + this.responseText)
}
if(result.error) {
console.log(result.message);
} else if(!result.wrapperr_admin_configured) {
first_time = true;
set_password_form();
} else {
cookie = get_cookie('wrapperr-admin');
if(cookie) {
validate_cookie_admin(cookie);
} else {
login_menu();
}
}
}
};
xhttp.withCredentials = true;
xhttp.open("post", "../api/get_admin_state.php");
xhttp.send();
return;
}
// Validate admin login
function validate_cookie_admin(cookie) {
var json_cookie = JSON.stringify({"cookie": cookie});
var xhttp = new XMLHttpRequest();
xhttp.onreadystatechange = function() {
if (this.readyState == 4 && this.status == 200) {
try {
var result= JSON.parse(this.responseText);
} catch(error) {
console.log('Failed to parse API response. Response: ' + this.responseText)
}
if(result.error) {
set_cookie("wrapperr-admin", "", 1);
login_menu();
} else {
get_config(get_cookie('wrapperr-admin'));
}
}
};
xhttp.withCredentials = true;
xhttp.open("post", "../api/validate_login_admin_cookie.php");
xhttp.send(json_cookie);
return;
}
// Get config for admin to configure
function get_config(cookie) {
config_form = {
"cookie" : cookie
};
var config_data = JSON.stringify(config_form);
var xhttp = new XMLHttpRequest();
xhttp.onreadystatechange = function() {
if (this.readyState == 4 && this.status == 200) {
var result = JSON.parse(this.responseText);
if(result.error) {
alert(result.message);
location.reload();
} else {
tautulli_apikey = result.data.tautulli_apikey;
tautulli_ip = result.data.tautulli_ip;
tautulli_port = result.data.tautulli_port;
tautulli_length = result.data.tautulli_length;
tautulli_root = result.data.tautulli_root;
tautulli_libraries = result.data.tautulli_libraries;
tautulli_grouping = result.data.tautulli_grouping;
https = result.data.https;
timezone = result.data.timezone;
wrapperr_front_page_title = result.data.wrapperr_front_page_title;
wrapperr_front_page_subtitle = result.data.wrapperr_front_page_subtitle;
stats_intro_title = result.data.stats_intro_title;
stats_intro_subtitle = result.data.stats_intro_subtitle;
stats_outro_title = result.data.stats_outro_title;
stats_outro_subtitle = result.data.stats_outro_subtitle;
stats_order_by_plays = result.data.stats_order_by_plays;
stats_order_by_duration = result.data.stats_order_by_duration;
create_share_links = result.data.create_share_links;
use_plex_auth = result.data.use_plex_auth;
use_cache = result.data.use_cache;
use_logs = result.data.use_logs;
clientID = result.data.clientID;
wrapperr_root = result.data.wrapperr_root;
application_name_str = result.data.application_name;
application_url_str = result.data.application_url;
wrapped_start = new Date(0);
wrapped_start.setUTCSeconds(result.data.wrapped_start);
wrapped_end = new Date(0);
wrapped_end.setUTCSeconds(result.data.wrapped_end);
get_user_movie_stats = result.data.get_user_movie_stats;
get_user_movie_stats_title = result.data.get_user_movie_stats_title;
get_user_movie_stats_subtitle = result.data.get_user_movie_stats_subtitle;
get_user_movie_stats_subsubtitle = result.data.get_user_movie_stats_subsubtitle;
get_user_movie_stats_subtitle_one = result.data.get_user_movie_stats_subtitle_one;
get_user_movie_stats_subsubtitle_one = result.data.get_user_movie_stats_subsubtitle_one;
get_user_movie_stats_subtitle_none = result.data.get_user_movie_stats_subtitle_none;
get_user_movie_stats_subsubtitle_none = result.data.get_user_movie_stats_subsubtitle_none;
get_user_movie_stats_top_movie = result.data.get_user_movie_stats_top_movie;
get_user_movie_stats_top_movie_plural = result.data.get_user_movie_stats_top_movie_plural;
get_user_movie_stats_movie_completion_title = result.data.get_user_movie_stats_movie_completion_title;
get_user_movie_stats_movie_completion_title_plural = result.data.get_user_movie_stats_movie_completion_title_plural;
get_user_movie_stats_movie_completion_subtitle = result.data.get_user_movie_stats_movie_completion_subtitle;
get_user_movie_stats_pause_title = result.data.get_user_movie_stats_pause_title;
get_user_movie_stats_pause_subtitle = result.data.get_user_movie_stats_pause_subtitle;
get_user_movie_stats_pause_title_one = result.data.get_user_movie_stats_pause_title_one;
get_user_movie_stats_pause_subtitle_one = result.data.get_user_movie_stats_pause_subtitle_one;
get_user_movie_stats_pause_title_none = result.data.get_user_movie_stats_pause_title_none;
get_user_movie_stats_pause_subtitle_none = result.data.get_user_movie_stats_pause_subtitle_none;
get_user_movie_stats_oldest_title = result.data.get_user_movie_stats_oldest_title;
get_user_movie_stats_oldest_subtitle = result.data.get_user_movie_stats_oldest_subtitle;
get_user_movie_stats_oldest_subtitle_pre_1950 = result.data.get_user_movie_stats_oldest_subtitle_pre_1950;
get_user_movie_stats_oldest_subtitle_pre_1975 = result.data.get_user_movie_stats_oldest_subtitle_pre_1975;
get_user_movie_stats_oldest_subtitle_pre_2000 = result.data.get_user_movie_stats_oldest_subtitle_pre_2000;
get_user_movie_stats_spent_title = result.data.get_user_movie_stats_spent_title;
get_user_show_stats = result.data.get_user_show_stats;
get_user_show_stats_buddy = result.data.get_user_show_stats_buddy;
get_user_show_stats_title = result.data.get_user_show_stats_title;
get_user_show_stats_subtitle = result.data.get_user_show_stats_subtitle;
get_user_show_stats_subsubtitle = result.data.get_user_show_stats_subsubtitle;
get_user_show_stats_subtitle_one = result.data.get_user_show_stats_subtitle_one;
get_user_show_stats_subsubtitle_one = result.data.get_user_show_stats_subsubtitle_one;
get_user_show_stats_subtitle_none = result.data.get_user_show_stats_subtitle_none;
get_user_show_stats_subsubtitle_none = result.data.get_user_show_stats_subsubtitle_none;
get_user_show_stats_top_show = result.data.get_user_show_stats_top_show;
get_user_show_stats_top_show_plural = result.data.get_user_show_stats_top_show_plural;
get_user_show_stats_spent_title = result.data.get_user_show_stats_spent_title;
get_user_show_stats_most_played_title = result.data.get_user_show_stats_most_played_title;
get_user_show_stats_most_played_subtitle = result.data.get_user_show_stats_most_played_subtitle;
get_user_show_stats_buddy_title = result.data.get_user_show_stats_buddy_title;
get_user_show_stats_buddy_subtitle = result.data.get_user_show_stats_buddy_subtitle;
get_user_show_stats_buddy_title_none = result.data.get_user_show_stats_buddy_title_none;
get_user_show_stats_buddy_subtitle_none = result.data.get_user_show_stats_buddy_subtitle_none;
get_user_music_stats = result.data.get_user_music_stats;
get_user_music_stats_title = result.data.get_user_music_stats_title;
get_user_music_stats_subtitle = result.data.get_user_music_stats_subtitle;
get_user_music_stats_subsubtitle = result.data.get_user_music_stats_subsubtitle;
get_user_music_stats_subtitle_one = result.data.get_user_music_stats_subtitle_one;
get_user_music_stats_subsubtitle_one = result.data.get_user_music_stats_subsubtitle_one;
get_user_music_stats_subtitle_none = result.data.get_user_music_stats_subtitle_none;
get_user_music_stats_subsubtitle_none = result.data.get_user_music_stats_subsubtitle_none;
get_user_music_stats_top_track = result.data.get_user_music_stats_top_track;
get_user_music_stats_top_track_plural = result.data.get_user_music_stats_top_track_plural;
get_user_music_stats_top_album_plural = result.data.get_user_music_stats_top_album_plural;
get_user_music_stats_top_artist_plural = result.data.get_user_music_stats_top_artist_plural;
get_user_music_stats_spent_title = result.data.get_user_music_stats_spent_title;
get_user_music_stats_spent_subtitle = result.data.get_user_music_stats_spent_subtitle;
get_user_music_stats_oldest_album_title = result.data.get_user_music_stats_oldest_album_title;
get_user_music_stats_oldest_album_subtitle = result.data.get_user_music_stats_oldest_album_subtitle;
get_year_stats_title = result.data.get_year_stats_title;
get_year_stats_subtitle = result.data.get_year_stats_subtitle;
get_year_stats_subsubtitle = result.data.get_year_stats_subsubtitle;
get_year_stats_movies = result.data.get_year_stats_movies;
get_year_stats_movies_title = result.data.get_year_stats_movies_title;
get_year_stats_movies_duration_title = result.data.get_year_stats_movies_duration_title;
get_year_stats_shows = result.data.get_year_stats_shows;
get_year_stats_shows_title = result.data.get_year_stats_shows_title;
get_year_stats_shows_duration_title = result.data.get_year_stats_shows_duration_title;
get_year_stats_music = result.data.get_year_stats_music;
get_year_stats_music_title = result.data.get_year_stats_music_title;
get_year_stats_music_duration_title = result.data.get_year_stats_music_duration_title;
get_year_stats_leaderboard = result.data.get_year_stats_leaderboard;
get_year_stats_leaderboard_title = result.data.get_year_stats_leaderboard_title;
get_year_stats_duration_sum_title = result.data.get_year_stats_duration_sum_title;
wrapperr_and = result.data.wrapperr_and;
wrapperr_play = result.data.wrapperr_play;
wrapperr_play_plural = result.data.wrapperr_play_plural;
wrapperr_day = result.data.wrapperr_day;
wrapperr_day_plural = result.data.wrapperr_day_plural;
wrapperr_hour = result.data.wrapperr_hour;
wrapperr_hour_plural = result.data.wrapperr_hour_plural;
wrapperr_minute = result.data.wrapperr_minute;
wrapperr_minute_plural = result.data.wrapperr_minute_plural;
wrapperr_second = result.data.wrapperr_second;
wrapperr_second_plural = result.data.wrapperr_second_plural;
wrapperr_sort_plays = result.data.wrapperr_sort_plays;
wrapperr_sort_duration = result.data.wrapperr_sort_duration;
username = result.admin;
admin_menu();
}
}
};
xhttp.withCredentials = true;
xhttp.open("post", "../api/get_config.php");
xhttp.send(config_data);
}