mirror of
https://github.com/MrUnknownDE/VRCX.git
synced 2026-04-24 09:13:50 +02:00
world & group instance sorting
This commit is contained in:
@@ -17089,9 +17089,6 @@ speechSynthesis.getVoices();
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
D.rooms.sort(function (a, b) {
|
|
||||||
return b.users.length - a.users.length || b.occupants - a.occupants;
|
|
||||||
});
|
|
||||||
if (D.fileSize === 'Loading') {
|
if (D.fileSize === 'Loading') {
|
||||||
$app.getBundleDateSize(ref)
|
$app.getBundleDateSize(ref)
|
||||||
.then(({ createdAt, fileSize }) => {
|
.then(({ createdAt, fileSize }) => {
|
||||||
@@ -17285,7 +17282,7 @@ speechSynthesis.getVoices();
|
|||||||
friendCount: 0,
|
friendCount: 0,
|
||||||
users: [],
|
users: [],
|
||||||
shortName: '',
|
shortName: '',
|
||||||
json: {}
|
ref: {}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -17298,7 +17295,7 @@ speechSynthesis.getVoices();
|
|||||||
friendCount: 0,
|
friendCount: 0,
|
||||||
users: [],
|
users: [],
|
||||||
shortName,
|
shortName,
|
||||||
json: {}
|
ref: {}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
var cachedCurrentUser = API.cachedUsers.get(API.currentUser.id);
|
var cachedCurrentUser = API.cachedUsers.get(API.currentUser.id);
|
||||||
@@ -17419,9 +17416,40 @@ speechSynthesis.getVoices();
|
|||||||
room.ref = ref;
|
room.ref = ref;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// sort by more friends, occupants
|
|
||||||
rooms.sort(function (a, b) {
|
rooms.sort(function (a, b) {
|
||||||
return b.users.length - a.users.length || b.occupants - a.occupants;
|
// sort selected and current instance to top
|
||||||
|
if (
|
||||||
|
b.location === D.$location.tag ||
|
||||||
|
b.location === lastLocation$.tag
|
||||||
|
) {
|
||||||
|
// sort selected instance above current instance
|
||||||
|
if (a.location === D.$location.tag) {
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
if (
|
||||||
|
a.location === D.$location.tag ||
|
||||||
|
a.location === lastLocation$.tag
|
||||||
|
) {
|
||||||
|
// sort selected instance above current instance
|
||||||
|
if (b.location === D.$location.tag) {
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
// sort by number of users when no friends in instance
|
||||||
|
if (a.users.length === 0 && b.users.length === 0) {
|
||||||
|
if (a.ref?.n_users < b.ref?.n_users) {
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
// sort by number of friends in instance
|
||||||
|
if (a.users.length < b.users.length) {
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
return -1;
|
||||||
});
|
});
|
||||||
D.rooms = rooms;
|
D.rooms = rooms;
|
||||||
this.updateTimers();
|
this.updateTimers();
|
||||||
@@ -17560,9 +17588,26 @@ speechSynthesis.getVoices();
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// sort by more friends, occupants
|
|
||||||
rooms.sort(function (a, b) {
|
rooms.sort(function (a, b) {
|
||||||
return b.users.length - a.users.length || b.occupants - a.occupants;
|
// sort current instance to top
|
||||||
|
if (b.location === currentLocation) {
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
if (a.location === currentLocation) {
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
// sort by number of users when no friends in instance
|
||||||
|
if (a.users.length === 0 && b.users.length === 0) {
|
||||||
|
if (a.ref?.n_users < b.ref?.n_users) {
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
// sort by number of friends in instance
|
||||||
|
if (a.users.length < b.users.length) {
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
return -1;
|
||||||
});
|
});
|
||||||
D.instances = rooms;
|
D.instances = rooms;
|
||||||
this.updateTimers();
|
this.updateTimers();
|
||||||
|
|||||||
Reference in New Issue
Block a user