Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    New to the CF scene
    Join Date
    Feb 2013
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    [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

  • #2
    Senior Coder
    Join Date
    Jan 2011
    Location
    Missouri
    Posts
    4,083
    Thanks
    23
    Thanked 592 Times in 591 Posts
    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">');


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •