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

Forcing a Constant Color For User List

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

Post a reply
8 posts • Page 1 of 1

Postby RobbieThompson73 » Thu Dec 07, 2006 4:02 pm

Hello, I have a successful phpFreeChat installed on my server (great product and great support). I have one question though - when ever I re-connect to the chat or manually refresh the page using the Browser refresh - the color of the list of users changes along with the color of my name in the chat area. Is there a way of keeping these two colors constant such that they never change?

Thanks

Robbie
RobbieThompson73
New member
 
Posts: 5
Joined: Thu Dec 07, 2006 12:36 pm
Top

Postby Devis » Thu Dec 07, 2006 4:06 pm

Hi Robbie, my users asked me something similar, they would like to choose their nick colour.
PFC 1.07 beta - Log into /dev/shm - 1 channel - Average 6/7 users
Apache 2.2 - PHP 4.4 - Debian Linux - Own server
Interface redesign - Own PHPbb integration
Devis
Member
 
Posts: 10
Joined: Thu Dec 07, 2006 3:10 pm
Location: Italy
Top

Postby phpfreechat » Thu Dec 07, 2006 4:23 pm

currently this is not doable in phpfreechat, the color is chosen randomly on client side (in js).
phpfreechat
Site Admin
 
Posts: 2657
Joined: Tue Feb 07, 2006 3:35 pm
Location: France
Top

Postby RobbieThompson73 » Thu Dec 07, 2006 4:29 pm

Thanks for the quick response. Could you possibly tell me where in the code that random choice is made?
RobbieThompson73
New member
 
Posts: 5
Joined: Thu Dec 07, 2006 12:36 pm
Top

Postby Devis » Thu Dec 07, 2006 4:37 pm

may be we could set colors per user in the server writing cookies and patch the customize.js to read cookies ?
PFC 1.07 beta - Log into /dev/shm - 1 channel - Average 6/7 users
Apache 2.2 - PHP 4.4 - Debian Linux - Own server
Interface redesign - Own PHPbb integration
Devis
Member
 
Posts: 10
Joined: Thu Dec 07, 2006 3:10 pm
Location: Italy
Top

Postby phpfreechat » Thu Dec 07, 2006 4:39 pm

The code is located in src/client/pfcclient.js :
Code: Select all
  /**
   * get the corresponding nickname color
   */
  getAndAssignNickColor: function(nick)
  {
    /* check the nickname is colorized or not */
    var allready_colorized = false;
    var nc = '';
    for(var j = 0; j < this.nickcolor.length; j++)
    {
      if (this.nickcolor[j][0] == nick)
      {
  allready_colorized = true;
  nc = this.nickcolor[j][1];
      }
    }
    if (!allready_colorized)
    {
      /* reload the color stack if it's empty */
      if (this.colorlist.length == 0) this.reloadColorList();
      /* take the next color from the list and colorize this nickname */
      var cid = Math.round(Math.random()*(this.colorlist.length-1));
      nc = this.colorlist[cid];
      this.colorlist.splice(cid,1);
      this.nickcolor.push(new Array(nick, nc));
    }

    return nc;
  },
phpfreechat
Site Admin
 
Posts: 2657
Joined: Tue Feb 07, 2006 3:35 pm
Location: France
Top

Postby MusicalBox » Sat Dec 09, 2006 3:20 am

Well if someone finds a way to let users choose there own color please post the codes here ;)
MusicalBox
Member
 
Posts: 13
Joined: Sun Nov 05, 2006 10:08 pm
Location: Québec city
Top

Postby zilveer » Tue Dec 19, 2006 11:26 am

Hi,
I dont think it is hard to fix. maybe something similiar this would solve the problem?

btw I am not so good at programming. but tell me if i am wrong?
Code: Select all
/**
   * get the corresponding nickname color
   */
  getAndAssignNickColor: function(nick)
  {
    /* check the nickname is colorized or not */
    var allready_colorized = false;
    var nc = '';
    for(var j = 0; j < this.nickcolor.length; j++)
    {
      if (this.nickcolor[j][0] == nick)
      {
  allready_colorized = true;
  nc = "#FF00FF"
      }
    }
    if (!allready_colorized)
    {
     nc = "#FF00FF"
    }

    return nc;
  },
/Isa Acar, the truth is infront of you
zilveer
Member
 
Posts: 38
Joined: Sat Oct 07, 2006 11:35 am
Top


Post a reply
8 posts • Page 1 of 1

Return to General Support (v1.x)

Who is online

Users browsing this forum: No registered users and 3 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