onlineusers

onlineusers iii

Αυτός ο κώδικας δεν πρέπει να εγκατασταθεί άμεσα. Είναι μια βιβλιοθήκη για άλλους κώδικες που περιλαμβάνεται μέσω της οδηγίας meta // @require https://update.greasyfork.org/scripts/546042/1642883/onlineusers.js

θα χρειαστεί να εγκαταστήσετε μια επέκταση όπως το Tampermonkey, το Greasemonkey ή το Violentmonkey για να εγκαταστήσετε αυτόν τον κώδικα.

You will need to install an extension such as Tampermonkey to install this script.

θα χρειαστεί να εγκαταστήσετε μια επέκταση όπως το Tampermonkey ή το Violentmonkey για να εγκαταστήσετε αυτόν τον κώδικα.

θα χρειαστεί να εγκαταστήσετε μια επέκταση όπως το Tampermonkey ή το Userscripts για να εγκαταστήσετε αυτόν τον κώδικα.

You will need to install an extension such as Tampermonkey to install this script.

Θα χρειαστεί να εγκαταστήσετε μια επέκταση διαχείρισης κώδικα χρήστη για να εγκαταστήσετε αυτόν τον κώδικα.

(Έχω ήδη έναν διαχειριστή κώδικα χρήστη, επιτρέψτε μου να τον εγκαταστήσω!)

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

(Έχω ήδη έναν διαχειριστή στυλ χρήστη, επιτρέψτε μου να τον εγκαταστήσω!)

// Add a new tab for Alliance Online Status
Tabs.AllianceOnline = {
    tabLabel: 'Alliance Online',
    tabColor: 'purple',
    tabOrder: 999,
    tabDisabled: false,
    init: function(div) {
        // Get alliance member data from Seed
        var members = [];
        if (Seed && Seed.allianceDiplomacies && Seed.allianceDiplomacies.members) {
            for (var uid in Seed.allianceDiplomacies.members) {
                var member = Seed.allianceDiplomacies.members[uid];
                var player = Seed.players["u" + uid];
                members.push({
                    name: player ? player.n : member.name,
                    title: player ? player.t : '',
                    might: player ? player.m : '',
                    online: member.onlineStatus == 1 // 1 = online, 0 = offline
                });
            }
        }

        // Build the table
        var html = '<table id="allianceOnlineTable" class="xtab onlineStatus">';
        html += '<tr><th>Name</th><th>Title</th><th>Might</th><th>Status</th></tr>';
        for (var i = 0; i < members.length; i++) {
            var statusClass = members[i].online ? 'online' : 'offline';
            html += '<tr class="' + statusClass + '">';
            html += '<td>' + members[i].name + '</td>';
            html += '<td>' + members[i].title + '</td>';
            html += '<td>' + addCommas(members[i].might) + '</td>';
            html += '<td>' + (members[i].online ? 'Online' : 'Offline') + '</td>';
            html += '</tr>';
        }
        html += '</table>';
        div.innerHTML = html;
    }
};

// Add custom styles for the table
GM_addStyle(`
    #allianceOnlineTable {
        width: 100%;
        border-collapse: collapse;
        background: #f9f9f9;
        margin-top: 10px;
    }
    #allianceOnlineTable th, #allianceOnlineTable td {
        border: 1px solid #ccc;
        padding: 6px 12px;
        text-align: left;
    }
    #allianceOnlineTable th {
        background: #342819;
        color: #fff;
    }
    #allianceOnlineTable tr.online {
        background: #d4ffd4;
    }
    #allianceOnlineTable tr.offline {
        background: #ffd4d4;
    }
`);