function loadAdminPage() {
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("stats_top_list_length").value = stats_top_list_length;
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 set_wrapperr_customization_call() {
document.getElementById("set_wrapperr_customization_form_button").disabled = true;
document.getElementById("set_wrapperr_customization_form_button").style.opacity = '0.5';
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;
stats_top_list_length = parseInt(document.getElementById("stats_top_list_length").value);
obfuscate_other_users = document.getElementById('obfuscate_other_users').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_numbers = document.getElementById('get_year_stats_leaderboard_numbers').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;
wrapperr_customization_form = {
"clear_cache" : clear_cache,
"data_type" : "wrapperr_customize",
"tautulli_config" : [],
"wrapperr_data" : {},
"wrapperr_customize" : {
"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,
"stats_top_list_length" : stats_top_list_length,
"obfuscate_other_users": obfuscate_other_users,
"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_numbers" : get_year_stats_leaderboard_numbers,
"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);
// Debug line
// console.log(wrapperr_customization_data);
var xhttp = new XMLHttpRequest();
xhttp.onreadystatechange = function() {
if (this.readyState == 4) {
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';
return;
}
if(result.error) {
alert(result.error);
document.getElementById("set_wrapperr_customization_form_button").disabled = false;
document.getElementById("set_wrapperr_customization_form_button").style.opacity = '1';
} else {
AdminPageRedirect();
}
}
};
xhttp.withCredentials = true;
xhttp.open("post", api_url + "set/config");
xhttp.setRequestHeader("Content-Type", "application/json;charset=UTF-8");
xhttp.setRequestHeader("Authorization", cookie);
xhttp.send(wrapperr_customization_data);
return;
}