View Single Post
Old 02-10-2013, 03:43 PM   PM User | #1
lukinhasb
New to the CF scene

 
Join Date: Feb 2013
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
lukinhasb is an unknown quantity at this point
[Javascript] Little modification on Wordpress plugin

The problem

  • This is a chat javascript
  • When you receive a message and the chat is minimized, it turns to
  • blue (.addClass('notify'))
  • When you receive a message and the chat is active, you only receive a sound warning
  • When you are chatting to user A, and user B sends a message, you only receive a sound warning


I would like to have a notification (besides sound) when I receive a message, can someone try to help me in this one? ._.

I think the closed chat notification happens here:
Code:
if(needsNotify) {
	    		if(!$chatElements.container.hasClass('open')){
					if(_parseBoolean(data.settings.admin_bar)){
						$chatElements.adminTitleBar.parent().addClass('notify');
					} else {
						$chatElements.titleBar.addClass('notify');
					}

		    	}
	    	}
By removing the first "if" I got a notification when receiving a message, wich is good:

Code:
if(needsNotify) {

					if(_parseBoolean(data.settings.admin_bar)){
						$chatElements.adminTitleBar.parent().addClass('notify');
					} else {
						$chatElements.titleBar.addClass('notify');
					}

	    	}
Next steps:

  • Notify only when chat isn't the active one
  • Change title, instead of "Chatting with: username", it flashes a message like "username sent you a message", with the blue notification class too


Can someone try to give me a light here? *-*

Thanks!

http://pastebin.com/38emXMZu
lukinhasb is offline   Reply With Quote