mirror of
https://github.com/moodle/moodle.git
synced 2025-04-13 20:42:22 +02:00
MDL-57772 chat: BEEP is back baby!
This commit is contained in:
parent
159b4e5d8c
commit
efe2681894
BIN
mod/chat/beep.mp3
Normal file
BIN
mod/chat/beep.mp3
Normal file
Binary file not shown.
Binary file not shown.
@ -104,7 +104,7 @@ class ChatDaemon {
|
||||
$this->_trace_level = E_ALL ^ E_USER_NOTICE;
|
||||
$this->_pcntl_exists = function_exists('pcntl_fork');
|
||||
$this->_time_rest_socket = 20;
|
||||
$this->_beepsoundsrc = $GLOBALS['CFG']->wwwroot.'/mod/chat/beep.wav';
|
||||
$this->_beepsoundsrc = $GLOBALS['CFG']->wwwroot.'/mod/chat/beep.mp3';
|
||||
$this->_freq_update_records = 20;
|
||||
$this->_freq_poll_idle_chat = $GLOBALS['CFG']->chat_old_ping;
|
||||
$this->_stdout = fopen('php://stdout', 'w');
|
||||
@ -754,8 +754,11 @@ EOD;
|
||||
$this->conn_sets[$sessionid][CHAT_CONNECTION_CHANNEL]);
|
||||
|
||||
if ($output->beep) {
|
||||
$playscript = '(function() { var audioElement = document.createElement("audio");' . "\n";
|
||||
$playscript .= 'audioElement.setAttribute("src", "'.$this->_beepsoundsrc.'");' . "\n";
|
||||
$playscript .= 'audioElement.play(); })();' . "\n";
|
||||
$this->write_data($this->conn_sets[$sessionid][CHAT_CONNECTION_CHANNEL],
|
||||
'<embed src="'.$this->_beepsoundsrc.'" autostart="true" hidden="true" />');
|
||||
'<script>' . $playscript . '</script>');
|
||||
}
|
||||
|
||||
if ($info['quirks'] & QUIRK_CHUNK_UPDATE) {
|
||||
|
@ -133,7 +133,9 @@ M.mod_chat_ajax.init = function(Y, cfg) {
|
||||
item.addClass((message.mymessage) ? 'mdl-chat-my-entry' : 'mdl-chat-entry');
|
||||
Y.one('#messages-list').append(item);
|
||||
if (message.type && message.type == 'beep') {
|
||||
Y.one('#chat-notify').setContent('<embed src="../beep.wav" autostart="true" hidden="true" name="beep" />');
|
||||
var audioElement = document.createElement('audio');
|
||||
audioElement.setAttribute('src', '../beep.mp3');
|
||||
audioElement.play();
|
||||
}
|
||||
},
|
||||
|
||||
|
@ -173,7 +173,11 @@ if ($refreshusers) {
|
||||
<body>
|
||||
<?php
|
||||
if ($beep) {
|
||||
echo '<embed src="../beep.wav" autostart="true" hidden="true" name="beep" />';
|
||||
echo '<script> (function() {';
|
||||
echo 'var audioElement = document.createElement("audio");';
|
||||
echo 'audioElement.setAttribute("src", "../beep.mp3");';
|
||||
echo 'audioElement.play(); })();';
|
||||
echo '</script>';
|
||||
}
|
||||
?>
|
||||
<a href="<?php echo $refreshurlamp ?>" name="refreshLink">Refresh link</a>
|
||||
|
@ -223,7 +223,11 @@ EOD;
|
||||
print "//]]>\n";
|
||||
print '</script>' . "\n\n";
|
||||
if ($beep) {
|
||||
print '<embed src="../beep.wav" autostart="true" hidden="true" name="beep" />';
|
||||
print '<script> (function() {';
|
||||
print 'var audioElement = document.createElement("audio");';
|
||||
print 'audioElement.setAttribute("src", "../beep.mp3");';
|
||||
print 'audioElement.play(); })();';
|
||||
print '</script>';
|
||||
}
|
||||
print $CHAT_DUMMY_DATA;
|
||||
sleep($CFG->chat_refresh_room);
|
||||
|
Loading…
x
Reference in New Issue
Block a user