Go Back   CodingForums.com > :: Client side development > JavaScript programming > JavaScript frameworks

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
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
Old 02-11-2013, 04:25 PM   PM User | #2
sunfighter
Senior Coder

 
Join Date: Jan 2011
Location: Missouri
Posts: 2,383
Thanks: 18
Thanked 350 Times in 349 Posts
sunfighter is on a distinguished road
You might want to give this a look see http://www.schillmania.com/projects/soundmanager2/

Or add this to the jq:
Code:
    $('embed').remove();
    $('body').append('<embed src="/path/to/your/sound.wav" autostart="true" hidden="true" loop="false">');
sunfighter is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 10:40 PM.


Advertisement
Log in to turn off these ads.