Commit 2d30ae0d authored by Daniela Feitosa's avatar Daniela Feitosa Committed by Antonio Terceiro

Enhancements of chat

Added sound when user receives message on chat
Fixed width on css of chat

(ActionItem1679)
parent 7e35c147
......@@ -5,7 +5,7 @@
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<meta name="description" content="<%= @environment.name %>" />
<link rel="shortcut icon" href="<%= image_path(theme_favicon) %>" type="image/x-icon" />
<%= javascript_include_tag 'jquery-latest', 'jquery.noconflict', 'jquery-ui-1.8.2.custom.min', 'jquery.scrollTo', 'jquery.scrollabletab', 'strophejs-1.0.1/strophe', 'jquery.emoticon', '/designs/icons/pidgin/emoticons.js', 'ba-linkify', 'application', 'chat', :cache => 'cache-chat' %>
<%= javascript_include_tag 'jquery-latest', 'jquery.noconflict', 'jquery-ui-1.8.2.custom.min', 'jquery.scrollTo', 'jquery.scrollabletab', 'strophejs-1.0.1/strophe', 'jquery.emoticon', '/designs/icons/pidgin/emoticons.js', 'ba-linkify', 'application', 'chat', 'jquery.sound', :cache => 'cache-chat' %>
<%= stylesheet_link_tag noosfero_stylesheets, :cache => 'cache' %>
<%= stylesheet_link_tag icon_theme_stylesheet_path %>
<%= stylesheet_link_tag theme_stylesheet_path %>
......
......@@ -232,6 +232,7 @@ jQuery(function($) {
var name = $('#' + jid_id).data('name');
create_conversation_tab(name, jid_id);
Jabber.show_message(jid, body, 'other');
$.sound.play('/sounds/receive.wav');
return true;
},
......@@ -384,7 +385,7 @@ jQuery(function($) {
$('#chat-window #tabs').removeClass("ui-corner-all ui-widget-content");
// positionting scrollabletab wrapper at bottom and tabs next/prev buttons
$('#stTabswrapper,#tabs').css('position', 'absolute').css('top', 0).css('bottom', 0).css('left', 0).css('right', 0);
$('#stTabswrapper,#tabs').css({'position':'absolute', 'top':0, 'bottom':0, 'left': 0, 'right': 0, 'width': 'auto'});
$('.stNavWrapper').css('position', 'absolute').css('bottom', 0).css('left', 0).css('right', 0)
.find('.stNav').css('top', null).css('bottom', '12px').css('height', '22px')
.find('.ui-icon').css('margin-top', '2px');
......
/**
* jQuery sound plugin (no flash)
*
* port of script.aculo.us' sound.js (http://script.aculo.us), based on code by Jules Gravinese (http://www.webveteran.com/)
*
* Copyright (c) 2007 Jörn Zaefferer (http://bassistance.de)
*
* Licensed under the MIT license:
* http://www.opensource.org/licenses/mit-license.php
*
* $Id$
*/
/**
* API Documentation
*
* // play a sound from the url
* $.sound.play(url)
*
* // play a sound from the url, on a track, stopping any sound already running on that track
* $.sound.play(url, {
* track: "track1"
* });
*
* // increase the timeout to four seconds before removing the sound object from the dom for longer sounds
* $.sound.play(url, {
* timeout: 4000
* });
*
* // disable playing sounds
* $.sound.enabled = false;
*
* // enable playing sounds
* $.sound.enabled = true
*/
(function($) {
$.sound = {
tracks: {},
enabled: true,
template: function(src) {
return '<embed style="height:0" loop="false" src="' + src + '" autostart="true" hidden="true"/>';
},
play: function(url, options){
if (!this.enabled)
return;
var settings = $.extend({
url: url,
timeout: 2000
}, options);
if (settings.track) {
if (this.tracks[settings.track]) {
var current = this.tracks[settings.track];
current.Stop && current.Stop();
current.remove();
}
}
var element = $.browser.msie
? $('<bgsound/>').attr({
src: settings.url,
loop: 1,
autostart: true
})
: $(this.template(settings.url));
element.appendTo("body");
if (settings.track) {
this.tracks[settings.track] = element;
}
setTimeout(function() {
element.remove();
}, 2000)
}
};
})(jQuery);
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment