• Forum
  • Doc
  • Screenshots
  • Download
  • Donate
  • Contributors
  • Contact
  • Follow @phpfreechat
  • DEMO
  • Board index ‹ Version 1.x branch ‹ Contributions (v1.x)
  • Change font size
  • FAQ
  • Register
  • Login

userlist sorting

Post a bug fix, a new feature, a theme ...

Moderators: OldWolf, re*s.t.a.r.s.*2

Post a reply
2 posts • Page 1 of 1

Postby Bubba » Thu Dec 23, 2010 3:46 am

Simple sort for the userlist.

In pfcclient.js search for the function updateNickListBox: function(chanid)

Replace the whole function with this:
Code: Select all
  updateNickListBox: function(chanid)
  {
    var className = (!is_ie7 && !is_ie6) ? 'class' : 'className';

    var nickidlst = this.getChanMeta(chanid,'users').get('nickid');
    var nickhash = new Object();
    for (var i=0; i<nickidlst.length; i++)
    {
       nickhash[this.getUserMeta(nickidlst[i], 'nick').toLowerCase()] = nickidlst[i];
   }
    var keys = [];
    for (var key in nickhash) {
      if (nickhash.hasOwnProperty(key)) {
        keys.push(key);
      }
    }
    keys.sort ();
   
    var nickdiv = this.gui.getOnlineContentFromTabId(chanid);
    var ul = document.createElement('ul');
    ul.setAttribute(className, 'pfc_nicklist');
    for (var i = 0; i < keys.length; i++)
    {
      var key = keys[i];
      var nickid = nickhash[key];
      var li = this.buildNickItem(nickid);
      li.setAttribute(className, 'pfc_nickitem_'+nickid);
      ul.appendChild(li);
    }
    var fc = nickdiv.firstChild;
    if (fc)
      nickdiv.replaceChild(ul,fc);
    else
      nickdiv.appendChild(ul,fc);

    this.colorizeNicks(nickdiv);
  },

This has only been tested in pfc 1.3 (latest version)
Bubba
New member
 
Posts: 5
Joined: Mon Dec 13, 2010 3:46 am
Top

Postby siwula » Tue Dec 28, 2010 2:44 pm

Works well. But is it possible to place admins (after /identify) on top of the list (and of course sort them the same as users)?
siwula
Member
 
Posts: 10
Joined: Sun Oct 10, 2010 3:43 pm
Top


Post a reply
2 posts • Page 1 of 1

Return to Contributions (v1.x)

Who is online

Users browsing this forum: No registered users and 17 guests

  • Board index
  • The team • Delete all board cookies • All times are UTC + 1 hour
Powered by phpBB® Forum Software © phpBB Group
Sign in
Wrong credentials
Sign up I forgot my password
.
jeu-gratuit.net | more partners
Fork me on GitHub