This commit is contained in:
parent
e03a7262c6
commit
1d9d109fac
16
js/main.js
16
js/main.js
@ -397,14 +397,16 @@ Number.prototype.toKmH = function() {
|
|||||||
function toggleLatest() {
|
function toggleLatest() {
|
||||||
var usersSelect = document.getElementsByName('user')[0];
|
var usersSelect = document.getElementsByName('user')[0];
|
||||||
if (latest == 0) {
|
if (latest == 0) {
|
||||||
if (!hasAllUsers() && usersSelect.length > 2) {
|
if (!hasAllUsers() && usersSelect && usersSelect.length > 2) {
|
||||||
usersSelect.options.add(new Option('- ' + lang['allusers'] + ' -', 'all'), usersSelect.options[1]);
|
usersSelect.options.add(new Option('- ' + lang['allusers'] + ' -', 'all'), usersSelect.options[1]);
|
||||||
}
|
}
|
||||||
latest = 1;
|
latest = 1;
|
||||||
loadTrack(userid, 0, 1);
|
loadTrack(userid, 0, 1);
|
||||||
} else {
|
} else {
|
||||||
if (hasAllUsers()) {
|
if (usersSelect && hasAllUsers()) {
|
||||||
|
if (isSelectedAllUsers()) {
|
||||||
usersSelect.selectedIndex = 0;
|
usersSelect.selectedIndex = 0;
|
||||||
|
}
|
||||||
usersSelect.remove(1);
|
usersSelect.remove(1);
|
||||||
}
|
}
|
||||||
latest = 0;
|
latest = 0;
|
||||||
@ -423,9 +425,11 @@ function selectTrack(f) {
|
|||||||
trackid = 0;
|
trackid = 0;
|
||||||
}
|
}
|
||||||
document.getElementById('latest').checked = false;
|
document.getElementById('latest').checked = false;
|
||||||
var usersSelect = document.getElementsByName('user')[0];
|
if (latest == 1) {
|
||||||
if (latest == 1) { toggleLatest(); }
|
toggleLatest();
|
||||||
|
} else {
|
||||||
loadTrack(userid, trackid, 1);
|
loadTrack(userid, trackid, 1);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function selectUser(f) {
|
function selectUser(f) {
|
||||||
@ -512,12 +516,12 @@ function autoReload() {
|
|||||||
|
|
||||||
function isSelectedAllUsers() {
|
function isSelectedAllUsers() {
|
||||||
var usersSelect = document.getElementsByName('user')[0];
|
var usersSelect = document.getElementsByName('user')[0];
|
||||||
return usersSelect[usersSelect.selectedIndex].value == 'all';
|
return usersSelect && usersSelect[usersSelect.selectedIndex].value == 'all';
|
||||||
}
|
}
|
||||||
|
|
||||||
function hasAllUsers() {
|
function hasAllUsers() {
|
||||||
var usersSelect = document.getElementsByName('user')[0];
|
var usersSelect = document.getElementsByName('user')[0];
|
||||||
if (usersSelect.length > 2 && usersSelect.options[1].value == 'all') {
|
if (usersSelect && usersSelect.length > 2 && usersSelect.options[1].value == 'all') {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user