mirror of
https://github.com/aunefyren/wrapperr
synced 2024-12-04 08:39:11 +00:00
CSS updates and leaderboard stats
Expanding items on hover Admin can enable/disable leaderboard stats
This commit is contained in:
parent
65e866955b
commit
dd51c329e0
8 changed files with 60 additions and 15 deletions
|
@ -78,6 +78,7 @@
|
|||
"get_year_stats_music":true,
|
||||
"get_year_stats_music_title":"Top artists",
|
||||
"get_year_stats_leaderboard":true,
|
||||
"get_year_stats_leaderboard_number":false,
|
||||
"get_year_stats_leaderboard_title":"Top users",
|
||||
"get_year_stats_movies_duration_title":"All users combined spent {movie_duration_sum} watching movies.",
|
||||
"get_year_stats_shows_duration_title":"All users combined spent {show_duration_sum} watching shows.",
|
||||
|
|
|
@ -134,6 +134,7 @@ func CreateConfigFile() error {
|
|||
config.WrapperrCustomize.GetYearStatsShows = true
|
||||
config.WrapperrCustomize.GetYearStatsMusic = true
|
||||
config.WrapperrCustomize.GetYearStatsLeaderboard = true
|
||||
config.WrapperrCustomize.GetYearStatsLeaderboardNumbers = false
|
||||
|
||||
err := SaveConfig(&config)
|
||||
if err != nil {
|
||||
|
|
|
@ -148,6 +148,7 @@ type WrapperrCustomize struct {
|
|||
GetYearStatsMusic bool `json:"get_year_stats_music"`
|
||||
GetYearStatsMusicTitle string `json:"get_year_stats_music_title"`
|
||||
GetYearStatsLeaderboard bool `json:"get_year_stats_leaderboard"`
|
||||
GetYearStatsLeaderboardNumbers bool `json:"get_year_stats_leaderboard_numbers"`
|
||||
GetYearStatsLeaderboardTitle string `json:"get_year_stats_leaderboard_title"`
|
||||
GetYearStatsMoviesDurationTitle string `json:"get_year_stats_movies_duration_title"`
|
||||
GetYearStatsShowsDurationTitle string `json:"get_year_stats_shows_duration_title"`
|
||||
|
|
|
@ -1066,6 +1066,26 @@ func WrapperrLoopData(user_id int, config *WrapperrConfig, wrapperr_data []Wrapp
|
|||
|
||||
wrapperr_reply.YearStats.YearMovies.Message = "All users processed."
|
||||
|
||||
// Scrub the data after ordering array
|
||||
if !config.WrapperrCustomize.GetYearStatsLeaderboardNumbers {
|
||||
for index, _ := range wrapperr_reply.YearStats.YearUsers.Data.UsersPlays {
|
||||
wrapperr_reply.YearStats.YearUsers.Data.UsersPlays[index].Duration = 0
|
||||
wrapperr_reply.YearStats.YearUsers.Data.UsersPlays[index].DurationArtists = 0
|
||||
wrapperr_reply.YearStats.YearUsers.Data.UsersPlays[index].DurationMovies = 0
|
||||
wrapperr_reply.YearStats.YearUsers.Data.UsersPlays[index].DurationShows = 0
|
||||
wrapperr_reply.YearStats.YearUsers.Data.UsersPlays[index].Plays = 0
|
||||
wrapperr_reply.YearStats.YearUsers.Data.UsersPlays[index].PausedCounter = 0
|
||||
}
|
||||
for index, _ := range wrapperr_reply.YearStats.YearUsers.Data.UsersDuration {
|
||||
wrapperr_reply.YearStats.YearUsers.Data.UsersDuration[index].Duration = 0
|
||||
wrapperr_reply.YearStats.YearUsers.Data.UsersDuration[index].DurationArtists = 0
|
||||
wrapperr_reply.YearStats.YearUsers.Data.UsersDuration[index].DurationMovies = 0
|
||||
wrapperr_reply.YearStats.YearUsers.Data.UsersDuration[index].DurationShows = 0
|
||||
wrapperr_reply.YearStats.YearUsers.Data.UsersDuration[index].Plays = 0
|
||||
wrapperr_reply.YearStats.YearUsers.Data.UsersDuration[index].PausedCounter = 0
|
||||
}
|
||||
}
|
||||
|
||||
} else {
|
||||
wrapperr_reply.YearStats.YearUsers.Data.UsersDuration = []WrapperrYearUserEntry{}
|
||||
wrapperr_reply.YearStats.YearUsers.Data.UsersPlays = []WrapperrYearUserEntry{}
|
||||
|
|
12
web/admin.js
12
web/admin.js
|
@ -1349,6 +1349,15 @@ function set_wrapperr_customization() {
|
|||
html += '/><br>';
|
||||
html += '</div>';
|
||||
|
||||
html += '<div class="form-group">';
|
||||
html += '<label for="get_year_stats_leaderboard_numbers" title="Displays the statistics of users on the leaderboard.">Display server-wide leaderboard numbers:<br>';
|
||||
html += '<input type="checkbox" class="form-control" id="get_year_stats_leaderboard_numbers" ';
|
||||
if(get_year_stats_leaderboard_numbers) {
|
||||
html += 'checked="' + get_year_stats_leaderboard_numbers + '" ';
|
||||
}
|
||||
html += '/><br>';
|
||||
html += '</div>';
|
||||
|
||||
html += '<div class="form-group newline">';
|
||||
html += '</div>';
|
||||
|
||||
|
@ -1733,6 +1742,7 @@ function set_wrapperr_customization_call() {
|
|||
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;
|
||||
|
@ -1838,6 +1848,7 @@ function set_wrapperr_customization_call() {
|
|||
"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,
|
||||
|
@ -2489,6 +2500,7 @@ function get_config(cookie) {
|
|||
get_year_stats_music_title = result.data.wrapperr_customize.get_year_stats_music_title;
|
||||
get_year_stats_music_duration_title = result.data.wrapperr_customize.get_year_stats_music_duration_title;
|
||||
get_year_stats_leaderboard = result.data.wrapperr_customize.get_year_stats_leaderboard;
|
||||
get_year_stats_leaderboard_numbers = result.data.wrapperr_customize.get_year_stats_leaderboard_numbers;
|
||||
get_year_stats_leaderboard_title = result.data.wrapperr_customize.get_year_stats_leaderboard_title;
|
||||
get_year_stats_duration_sum_title = result.data.wrapperr_customize.get_year_stats_duration_sum_title;
|
||||
|
||||
|
|
|
@ -162,6 +162,7 @@ var get_year_stats_music = '';
|
|||
var get_year_stats_music_title = '';
|
||||
var get_year_stats_music_duration_title = '';
|
||||
var get_year_stats_leaderboard = '';
|
||||
var get_year_stats_leaderboard_number = false;
|
||||
var get_year_stats_leaderboard_title = '';
|
||||
var get_year_stats_duration_sum_title = '';
|
||||
|
||||
|
|
|
@ -297,11 +297,20 @@ img {
|
|||
.item:hover {
|
||||
background-color: var(--black) !important;
|
||||
border-radius: 0.5em;
|
||||
margin: 0.5em 0;
|
||||
max-height: none;
|
||||
}
|
||||
|
||||
.item {
|
||||
padding: 0.5em;
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
transition: 1s;
|
||||
}
|
||||
|
||||
.item-expandable {
|
||||
max-height: 1.25em;
|
||||
overflow-y: hidden;
|
||||
}
|
||||
|
||||
.gold {
|
||||
|
@ -338,9 +347,7 @@ img {
|
|||
text-align: right;
|
||||
margin: 0.1em;
|
||||
display: inline-block;
|
||||
width: 10%;
|
||||
vertical-align: top;
|
||||
float: left;
|
||||
}
|
||||
|
||||
.info {
|
||||
|
@ -355,8 +362,6 @@ img {
|
|||
text-align: right;
|
||||
margin: 0.1em;
|
||||
display: inline-block;
|
||||
width: 90%;
|
||||
vertical: center;
|
||||
text-overflow: ellipsis;
|
||||
vertical-align: top;
|
||||
}
|
||||
|
@ -366,7 +371,6 @@ img {
|
|||
}
|
||||
|
||||
.movie_name {
|
||||
width: 90%;
|
||||
text-align: right;
|
||||
display: inline-block;
|
||||
margin: 0.1em;
|
||||
|
@ -376,7 +380,6 @@ img {
|
|||
}
|
||||
|
||||
.info_name {
|
||||
width: 14em;
|
||||
text-align: right;
|
||||
display: inline-block;
|
||||
margin: 0.1em;
|
||||
|
|
|
@ -782,16 +782,22 @@ function top_list_names(array, title, div_id) {
|
|||
html += "<div class='number'>";
|
||||
html += i+1 + ". ";
|
||||
html += "</div>";
|
||||
|
||||
html += "<div class='name'>";
|
||||
|
||||
html += array[i].user;
|
||||
|
||||
if(array[i].duration !== 0 && array[i].plays !== 0) {
|
||||
var duration_string = seconds_to_time(array[i].duration, true);
|
||||
html += "<br>"
|
||||
html += duration_string
|
||||
|
||||
html += "<br>"
|
||||
html += play_plays(array[i].plays)
|
||||
}
|
||||
|
||||
html += "</div>";
|
||||
|
||||
if(array[i].user == results.user.name) {
|
||||
html += "<div class='name you'>";
|
||||
html += array[i].user;
|
||||
html += "</div>";
|
||||
}else {
|
||||
html += "<div class='name'>";
|
||||
html += array[i].user;
|
||||
html += "</div>";
|
||||
}
|
||||
html += "</div>";
|
||||
}
|
||||
html += "</div>";
|
||||
|
|
Loading…
Reference in a new issue