mirror of
https://github.com/krateng/maloja.git
synced 2025-04-13 07:27:12 +03:00
Unified naming for stat selection UIs
This commit is contained in:
parent
112b3db07c
commit
4a87500cd5
@ -1,9 +1,12 @@
|
||||
minor_release_name: "Momo"
|
||||
minor_release_name: "Nicole"
|
||||
3.2.0:
|
||||
notes:
|
||||
- "[Architecture] Switched to linuxserver.io container base image"
|
||||
- "[Feature] Added basic support for albums"
|
||||
- "[Feature] New start page"
|
||||
- "[Feature] Added UI for track-artist, track-album and album-artist association"
|
||||
- "[Performance] Improved image rendering"
|
||||
- "[Bugfix] Fixed configuration of time format"
|
||||
- "[Bugfix] Fixed search on manual scrobble page"
|
||||
- "[Bugfix] Disabled DB maintenance while not running main server"
|
||||
- "[Bugfix] Removed some nonsensical ephemereal database entry creations"
|
||||
|
@ -23,6 +23,16 @@
|
||||
<script src="/neopolitan.js"></script>
|
||||
<script src="/upload.js"></script>
|
||||
<script src="/notifications.js"></script>
|
||||
<script>
|
||||
const defaultpicks = {
|
||||
topartists: '{{ settings["DEFAULT_RANGE_STARTPAGE"] }}',
|
||||
toptracks: '{{ settings["DEFAULT_RANGE_STARTPAGE"] }}',
|
||||
topalbums: '{{ settings["DEFAULT_RANGE_STARTPAGE"] }}',
|
||||
pulse: '{{ settings["DEFAULT_RANGE_STARTPAGE"] }}',
|
||||
pulseperformancecombined: '{{ settings["DEFAULT_RANGE_STARTPAGE"] }}',
|
||||
featured: 'artist'
|
||||
}
|
||||
</script>
|
||||
|
||||
<link rel="preload" href="/static/ttf/Ubuntu-Regular.ttf" as="font" type="font/woff2" crossorigin />
|
||||
|
||||
|
@ -4,7 +4,7 @@
|
||||
{% import 'snippets/links.jinja' as links %}
|
||||
|
||||
{% block scripts %}
|
||||
<script src="/rangeselect.js"></script>
|
||||
<script src="/statselect.js"></script>
|
||||
<script src="/edit.js"></script>
|
||||
{% endblock %}
|
||||
|
||||
@ -97,8 +97,8 @@
|
||||
<br/>
|
||||
{% for r in xranges %}
|
||||
<span
|
||||
onclick="showRangeManual('pulse','{{ r.identifier }}')"
|
||||
class="stat_selector_pulse selector_pulse_{{ r.identifier }}"
|
||||
onclick="showStatsManual('pulseperformancecombined','{{ r.identifier }}')"
|
||||
class="stat_selector_pulseperformancecombined selector_pulseperformancecombined_{{ r.identifier }}"
|
||||
style="{{ 'opacity:0.5;' if initialrange==r.identifier else '' }}">
|
||||
{{ r.localisation }}
|
||||
</span>
|
||||
@ -110,7 +110,7 @@
|
||||
{% for r in xranges %}
|
||||
|
||||
<span
|
||||
class="stat_module_pulse pulse_{{ r.identifier }}"
|
||||
class="stat_module_pulseperformancecombined pulseperformancecombined_{{ r.identifier }}"
|
||||
style="{{ 'display:none;' if initialrange!=r.identifier else '' }}"
|
||||
>
|
||||
|
||||
@ -127,8 +127,8 @@
|
||||
<br/>
|
||||
{% for r in xranges %}
|
||||
<span
|
||||
onclick="showRangeManual('pulse','{{ r.identifier }}')"
|
||||
class="stat_selector_pulse selector_pulse_{{ r.identifier }}"
|
||||
onclick="showStatsManual('pulseperformancecombined','{{ r.identifier }}')"
|
||||
class="stat_selector_pulseperformancecombined selector_pulseperformancecombined_{{ r.identifier }}"
|
||||
style="{{ 'opacity:0.5;' if initialrange==r.identifier else '' }}">
|
||||
{{ r.localisation }}
|
||||
</span>
|
||||
@ -140,7 +140,7 @@
|
||||
{% for r in xranges %}
|
||||
|
||||
<span
|
||||
class="stat_module_pulse pulse_{{ r.identifier }}"
|
||||
class="stat_module_pulseperformancecombined pulseperformancecombined_{{ r.identifier }}"
|
||||
style="{{ 'display:none;' if initialrange!=r.identifier else '' }}"
|
||||
>
|
||||
|
||||
|
@ -5,7 +5,7 @@
|
||||
{% import 'partials/awards_artist.jinja' as awards %}
|
||||
|
||||
{% block scripts %}
|
||||
<script src="/rangeselect.js"></script>
|
||||
<script src="/statselect.js"></script>
|
||||
<script src="/edit.js"></script>
|
||||
{% endblock %}
|
||||
|
||||
@ -128,8 +128,8 @@
|
||||
<br/>
|
||||
{% for r in xranges %}
|
||||
<span
|
||||
onclick="showRangeManual('pulse','{{ r.identifier }}')"
|
||||
class="stat_selector_pulse selector_pulse_{{ r.identifier }}"
|
||||
onclick="showStatsManual('pulseperformancecombined','{{ r.identifier }}')"
|
||||
class="stat_selector_pulseperformancecombined selector_pulseperformancecombined_{{ r.identifier }}"
|
||||
style="{{ 'opacity:0.5;' if initialrange==r.identifier else '' }}">
|
||||
{{ r.localisation }}
|
||||
</span>
|
||||
@ -141,7 +141,7 @@
|
||||
{% for r in xranges %}
|
||||
|
||||
<span
|
||||
class="stat_module_pulse pulse_{{ r.identifier }}"
|
||||
class="stat_module_pulseperformancecombined pulseperformancecombined_{{ r.identifier }}"
|
||||
style="{{ 'display:none;' if initialrange!=r.identifier else '' }}"
|
||||
>
|
||||
|
||||
@ -161,8 +161,8 @@
|
||||
|
||||
{% for r in xranges %}
|
||||
<span
|
||||
onclick="showRangeManual('pulse','{{ r.identifier }}')"
|
||||
class="stat_selector_pulse selector_pulse_{{ r.identifier }}"
|
||||
onclick="showStatsManual('pulseperformancecombined','{{ r.identifier }}')"
|
||||
class="stat_selector_pulseperformancecombined selector_pulseperformancecombined_{{ r.identifier }}"
|
||||
style="{{ 'opacity:0.5;' if initialrange==r.identifier else '' }}">
|
||||
{{ r.localisation }}
|
||||
</span>
|
||||
@ -174,7 +174,7 @@
|
||||
{% for r in xranges %}
|
||||
|
||||
<span
|
||||
class="stat_module_pulse pulse_{{ r.identifier }}"
|
||||
class="stat_module_pulseperformancecombined pulseperformancecombined_{{ r.identifier }}"
|
||||
style="{{ 'display:none;' if initialrange!=r.identifier else '' }}"
|
||||
>
|
||||
|
||||
|
@ -3,24 +3,8 @@
|
||||
|
||||
{% block scripts %}
|
||||
|
||||
<script src="/rangeselect.js"></script>
|
||||
<script>
|
||||
document.addEventListener('DOMContentLoaded',function() {
|
||||
for (let type of ["topartists","toptracks","topalbums","pulse"]) {
|
||||
var val = localStorage.getItem("rangeselect_" + type);
|
||||
if (val != null) {
|
||||
showRange(type,val);
|
||||
}
|
||||
else {
|
||||
showRange(type,'{{ settings["DEFAULT_RANGE_STARTPAGE"] }}');
|
||||
}
|
||||
<script src="/statselect.js"></script>
|
||||
|
||||
|
||||
}
|
||||
})
|
||||
</script>
|
||||
|
||||
<script src="/cookies.js"></script>
|
||||
<link rel="stylesheet" href="/static/css/startpage.css" />
|
||||
{% endblock %}
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
<h1><a class="stat_link_topalbums" href="/charts_albums?in=alltime">Top Albums</a></h1>
|
||||
|
||||
{% for r in xcurrent -%}
|
||||
<span onclick="showRangeManual('topalbums','{{ r.identifier }}')" class="stat_selector_topalbums selector_topalbums_{{ r.identifier }}">
|
||||
<span onclick="showStatsManual('topalbums','{{ r.identifier }}')" class="stat_selector_topalbums selector_topalbums_{{ r.identifier }}">
|
||||
{{ r.localisation }}
|
||||
</span>
|
||||
{{ "|" if not loop.last }}
|
||||
|
@ -1,7 +1,7 @@
|
||||
<h1><a class="stat_link_topartists" href="/charts_artists?in=alltime">Top Artists</a></h1>
|
||||
|
||||
{% for r in xcurrent -%}
|
||||
<span onclick="showRangeManual('topartists','{{ r.identifier }}')" class="stat_selector_topartists selector_topartists_{{ r.identifier }}">
|
||||
<span onclick="showStatsManual('topartists','{{ r.identifier }}')" class="stat_selector_topartists selector_topartists_{{ r.identifier }}">
|
||||
{{ r.localisation }}
|
||||
</span>
|
||||
{{ "|" if not loop.last }}
|
||||
|
@ -1,7 +1,7 @@
|
||||
<h1><a class="stat_link_toptracks" href="/charts_tracks?in=alltime">Top Tracks</a></h1>
|
||||
|
||||
{% for r in xcurrent -%}
|
||||
<span onclick="showRangeManual('toptracks','{{ r.identifier }}')" class="stat_selector_toptracks selector_toptracks_{{ r.identifier }}">
|
||||
<span onclick="showStatsManual('toptracks','{{ r.identifier }}')" class="stat_selector_toptracks selector_toptracks_{{ r.identifier }}">
|
||||
{{ r.localisation }}
|
||||
</span>
|
||||
{{ "|" if not loop.last }}
|
||||
|
@ -12,7 +12,7 @@
|
||||
|
||||
|
||||
{% for t in entitytypes -%}
|
||||
<span onclick="showFeatured('{{ t.identifier }}')" class="stat_selector_featured stat_selector_featured_{{ t.identifier }}">
|
||||
<span onclick="showStatsManual('featured','{{ t.identifier }}')" class="stat_selector_featured selector_featured_{{ t.identifier }}">
|
||||
{{ t.localisation }}
|
||||
</span>
|
||||
{{ "|" if not loop.last }}
|
||||
|
@ -1,7 +1,7 @@
|
||||
<h1><a class="stat_link_pulse" href="/pulse?trail=1&step=month">Pulse</a></h1>
|
||||
|
||||
{% for range in xranges -%}
|
||||
<span onclick="showRangeManual('pulse','{{ range.identifier }}')" class="stat_selector_pulse selector_pulse_{{ range.identifier }}">
|
||||
<span onclick="showStatsManual('pulse','{{ range.identifier }}')" class="stat_selector_pulse selector_pulse_{{ range.identifier }}">
|
||||
{{ range.localisation }}
|
||||
</span>
|
||||
{{ "|" if not loop.last }}
|
||||
|
@ -4,7 +4,7 @@
|
||||
{% import 'snippets/links.jinja' as links %}
|
||||
|
||||
{% block scripts %}
|
||||
<script src="/rangeselect.js"></script>
|
||||
<script src="/statselect.js"></script>
|
||||
<script src="/edit.js"></script>
|
||||
<script>
|
||||
function scrobble(encodedtrack) {
|
||||
@ -96,8 +96,8 @@
|
||||
<br/>
|
||||
{% for r in xranges %}
|
||||
<span
|
||||
onclick="showRangeManual('pulse','{{ r.identifier }}')"
|
||||
class="stat_selector_pulse selector_pulse_{{ r.identifier }}"
|
||||
onclick="showStatsManual('pulseperformancecombined','{{ r.identifier }}')"
|
||||
class="stat_selector_pulseperformancecombined selector_pulseperformancecombined_{{ r.identifier }}"
|
||||
style="{{ 'opacity:0.5;' if initialrange==r.identifier else '' }}">
|
||||
{{ r.localisation }}
|
||||
</span>
|
||||
@ -109,7 +109,7 @@
|
||||
{% for r in xranges %}
|
||||
|
||||
<span
|
||||
class="stat_module_pulse pulse_{{ r.identifier }}"
|
||||
class="stat_module_pulseperformancecombined pulseperformancecombined_{{ r.identifier }}"
|
||||
style="{{ 'display:none;' if initialrange!=r.identifier else '' }}"
|
||||
>
|
||||
|
||||
@ -126,8 +126,8 @@
|
||||
<br/>
|
||||
{% for r in xranges %}
|
||||
<span
|
||||
onclick="showRangeManual('pulse','{{ r.identifier }}')"
|
||||
class="stat_selector_pulse selector_pulse_{{ r.identifier }}"
|
||||
onclick="showStatsManual('pulseperformancecombined','{{ r.identifier }}')"
|
||||
class="stat_selector_pulseperformancecombined selector_pulseperformancecombined_{{ r.identifier }}"
|
||||
style="{{ 'opacity:0.5;' if initialrange==r.identifier else '' }}">
|
||||
{{ r.localisation }}
|
||||
</span>
|
||||
@ -139,7 +139,7 @@
|
||||
{% for r in xranges %}
|
||||
|
||||
<span
|
||||
class="stat_module_pulse pulse_{{ r.identifier }}"
|
||||
class="stat_module_pulseperformancecombined pulseperformancecombined_{{ r.identifier }}"
|
||||
style="{{ 'display:none;' if initialrange!=r.identifier else '' }}"
|
||||
>
|
||||
|
||||
|
@ -1,64 +0,0 @@
|
||||
apikeycorrect = false;
|
||||
|
||||
|
||||
|
||||
/// API KEY
|
||||
function insertAPIKeyFromCookie() {
|
||||
element = document.getElementById("apikey")
|
||||
if (element != null && element != undefined) {
|
||||
var key = neo.getCookie("apikey");
|
||||
if (key != null && key != undefined) {
|
||||
element.value = key;
|
||||
checkAPIkey();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
window.addEventListener("load",insertAPIKeyFromCookie);
|
||||
|
||||
|
||||
function saveAPIkey() {
|
||||
key = APIkey();
|
||||
neo.setCookie("apikey",key,false);
|
||||
}
|
||||
|
||||
|
||||
|
||||
function checkAPIkey(extrafunc=null) {
|
||||
|
||||
url = "/api/test?key=" + APIkey()
|
||||
var xhttp = new XMLHttpRequest();
|
||||
xhttp.onreadystatechange = function() {
|
||||
if (this.readyState == 4 && (this.status == 204 || this.status == 205)) {
|
||||
document.getElementById("apikey").style.backgroundColor = "lawngreen"
|
||||
apikeycorrect = true
|
||||
saveAPIkey();
|
||||
}
|
||||
else {
|
||||
document.getElementById("apikey").style.backgroundColor = "red"
|
||||
apikeycorrect = false
|
||||
}
|
||||
|
||||
if (extrafunc != null) {
|
||||
extrafunc();
|
||||
}
|
||||
|
||||
};
|
||||
try {
|
||||
xhttp.open("GET",url,true);
|
||||
xhttp.send();
|
||||
}
|
||||
catch (e) {
|
||||
document.getElementById("apikey").style.backgroundColor = "red"
|
||||
apikeycorrect = false
|
||||
if (extrafunc != null) {
|
||||
extrafunc();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function APIkey() {
|
||||
return document.getElementById("apikey").value;
|
||||
}
|
@ -1,6 +1,6 @@
|
||||
localStorage = window.localStorage;
|
||||
|
||||
function showRange(identifier,unit) {
|
||||
function showStats(identifier,unit) {
|
||||
// Make all modules disappear
|
||||
var modules = document.getElementsByClassName("stat_module_" + identifier);
|
||||
for (var i=0;i<modules.length;i++) {
|
||||
@ -38,8 +38,25 @@ function showRange(identifier,unit) {
|
||||
|
||||
}
|
||||
|
||||
function showRangeManual(identifier,unit) {
|
||||
showRange(identifier,unit);
|
||||
|
||||
function showStatsManual(identifier,unit) {
|
||||
showStats(identifier,unit);
|
||||
//neo.setCookie("rangeselect_" + identifier,unit);
|
||||
localStorage.setItem("rangeselect_" + identifier,unit);
|
||||
localStorage.setItem("statselect_" + identifier,unit);
|
||||
}
|
||||
|
||||
|
||||
|
||||
document.addEventListener('DOMContentLoaded',function() {
|
||||
for (var key of Object.keys(defaultpicks)) {
|
||||
var val = localStorage.getItem("statselect_" + key);
|
||||
if (val != null) {
|
||||
showStats(key,val);
|
||||
}
|
||||
else {
|
||||
showStats(key,defaultpicks[key]);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
})
|
Loading…
x
Reference in New Issue
Block a user