FR2012 - Webchat Sounds

WORKAROUNDAdminwolf 2010/04/04

get the pichat_webchat_templates.zip and install the 2 files (script_pichat.js and frame_browser_dynamic.html) to your ~/pichat/webserver/chat-Directory

if you want, copy your sound_chat_ping.wav and sound_chat_pong.wav to ~/pichat/webserver/chatmedia

modify script_pichat.js with

script_pichat.soundmod.js
var pichat = 
{ 
  /* modify function */
    onChatSoundEffect: function(action, data) { if(mChatOK) { pichat.control.sendClientInterface("CHAT_ACTION_CUSTOM", "SoundEffect", action, data); pichat.output.playSound(action, data); } },
}
 
pichat.output =
{ 
  /* add function */
    playSound: function(action, data) { if ( action=="CHAT_PING" ) { var sound="/chatmedia/sound_chat_ping.wav"; } else if ( action=="CHAT_PONG" ) { var sound="/chatmedia/sound_chat_pong.wav"; } else  { var sound=""; } if(!sound=="") { document.getElementById("sound").innerHTML="<embed src='"+sound+"' hidden=true autostart=true loop=false>"; } }
}

modify frame_browser_dynamic.html with

frame_browser_dynamic.soundmod.html
  <!-- ... -->
  <!-- modify sidebar section -->
    <div id="midright"><div id="sidebar" class="chatside">
    <div id="chat-chatrooms"></div>
    <div id="chat-chatusers"></div>
    <span id=sound></span>
    </div></div>
  <!-- ... -->