Title: [Javascript] Little modification on plugin
Last modified: August 20, 2016

---

# [Javascript] Little modification on plugin

 *  [Lucas](https://wordpress.org/support/users/criatweb/)
 * (@criatweb)
 * [13 years, 3 months ago](https://wordpress.org/support/topic/javascript-little-modification-on-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:
 *     ```
       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:
 *     ```
       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](http://pastebin.com/38emXMZu)

The topic ‘[Javascript] Little modification on plugin’ is closed to new replies.

## Tags

 * [class](https://wordpress.org/support/topic-tag/class/)
 * [javascript](https://wordpress.org/support/topic-tag/javascript/)

 * 0 replies
 * 1 participant
 * Last reply from: [Lucas](https://wordpress.org/support/users/criatweb/)
 * Last activity: [13 years, 3 months ago](https://wordpress.org/support/topic/javascript-little-modification-on-plugin/)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
