mirror of
https://github.com/overte-org/overte.git
synced 2025-08-09 02:36:54 +02:00
Lint: Preferred control constructs
This commit is contained in:
parent
adba46f90c
commit
42b9ee8e77
1 changed files with 12 additions and 8 deletions
|
@ -216,8 +216,10 @@ function stringDivider(str, slotWidth, spaceReplacer) {
|
||||||
|
|
||||||
if (str.length > slotWidth) {
|
if (str.length > slotWidth) {
|
||||||
p = slotWidth;
|
p = slotWidth;
|
||||||
for (; p > 0 && str[p] != ' '; p--) {
|
while (p > 0 && str[p] !== ' ') {
|
||||||
|
p -= 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (p > 0) {
|
if (p > 0) {
|
||||||
left = str.substring(0, p);
|
left = str.substring(0, p);
|
||||||
right = str.substring(p + 1);
|
right = str.substring(p + 1);
|
||||||
|
@ -314,18 +316,20 @@ function isStartingUp() {
|
||||||
|
|
||||||
// Triggers notification if a user logs on or off
|
// Triggers notification if a user logs on or off
|
||||||
function onOnlineUsersChanged(users) {
|
function onOnlineUsersChanged(users) {
|
||||||
var user;
|
var user,
|
||||||
|
i;
|
||||||
|
|
||||||
if (!isStartingUp()) { // Skip user notifications at startup.
|
if (!isStartingUp()) { // Skip user notifications at startup.
|
||||||
for (user in users) {
|
for (i = 0; i < users.length; i += 1) {
|
||||||
if (last_users.indexOf(users[user]) === -1.0) {
|
if (last_users.indexOf(users[i]) === -1.0) {
|
||||||
createNotification(users[user] + " has joined");
|
createNotification(users[i] + " has joined");
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
for (user in last_users) {
|
for (i = 0; i < last_users.length; i += 1) {
|
||||||
if (users.indexOf(last_users[user]) === -1.0) {
|
if (users.indexOf(last_users[i]) === -1.0) {
|
||||||
createNotification(last_users[user] + " has left");
|
createNotification(last_users[i] + " has left");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue