diff --git a/app/views/layouts/chat.rhtml b/app/views/layouts/chat.rhtml
index 511f45b..4f2446c 100644
--- a/app/views/layouts/chat.rhtml
+++ b/app/views/layouts/chat.rhtml
@@ -5,7 +5,7 @@
- <%= 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 %>
diff --git a/public/javascripts/chat.js b/public/javascripts/chat.js
index f23aa22..b562930 100644
--- a/public/javascripts/chat.js
+++ b/public/javascripts/chat.js
@@ -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');
diff --git a/public/javascripts/jquery.sound.js b/public/javascripts/jquery.sound.js
new file mode 100644
index 0000000..e86a317
--- /dev/null
+++ b/public/javascripts/jquery.sound.js
@@ -0,0 +1,80 @@
+/**
+ * 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 '';
+ },
+ 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
+ ? $('').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);
diff --git a/public/sounds/receive.wav b/public/sounds/receive.wav
new file mode 100644
index 0000000..dce135e
Binary files /dev/null and b/public/sounds/receive.wav differ
--
libgit2 0.21.2