Chen Zhen can you help me with something
how to set the following definitions according to smf 2.1
./Themes/temanızın klasörü/index.template.php açın.
<body>';
// Mesaj geldiğinde "Mesajınız var" zobbiği. :)
if (($context['user']['unread_messages']) >= 1)
{
echo '
<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,0,0" width="0" height="0" id="gotmail" align="middle">
<param name="allowScriptAccess" value="sameDomain" />
<param name="movie" value="'. $settings['images_url'] . '/mesajvar.swf" />
<param name="quality" value="high" />
<param name="bgcolor" value="#ffffff" />
<embed src="'. $settings['images_url'] . '/mesajvar.swf" quality="high" bgcolor="#ffffff" width="1" height="1" name="gotmail" align="middle" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />
</object>';
}
In the attached messagevar.swf file, put a list of your theme in ./Themes//images directory.
mesajvar.zip
Using flash for something like that isn't a good idea since no current popular browsers use it out of the box.
HTML5 and/or JS is a better option.
I'll take a look in the next few days when I have time.
Quote from: Chen Zhen on June 08, 2023, 11:54:25 AMUsing flash for something like that isn't a good idea since no current popular browsers use it out of the box.
HTML5 and/or JS is a better option.
I'll take a look in the next few days when I have time.
ok thanks i'm waiting
Does this new message alert just play a sound or a video?
You can try what I've attached.
I didn't view your swf file except for extracting the mp3 audio files from it.
Download the attachment, unzip it on your PC/Mac & upload the EhMedia folder to your main forum directory path.
Put this in a PHP block:
global $boardurl, $context;
// use video, audio or audio2
list($type, $path, $width, $height) = array(
'video',
'EhMedia',
'200px',
'200px'
);
if ($type == 'video' && $context['user']['unread_messages'] >= 1) {
echo '
<div style="display: none;margin: 0 auto;width: 100%;" class="centertext newPMessageCheckOnce" id="newPMessageCheck"></div>
<video style="position: relative;left: 50%;transform: translateX(-50%);" width="' . $width . '" height="' . $height . '" id="eh_video_player" poster="">
<source id="ehvideo_mp4" src="" type=\'video/mp4; codecs="avc1.42E01E, mp4a.40.2"\' />
</video>
</div>
<script>
if ($("#newPMessageCheck").hasClass("newPMessageCheckOnce")) {
$(document).one("mousemove", function(event){
ehPlayVideo(\'' . $boardurl . '/' . $path . '/alert_bell.mp4\');
ehPlayAudio(\'' . $boardurl . '/' . $path . '/alert.mp3\');
ehPlayAudio(\'' . $boardurl . '/' . $path . '/message.mp3\');
$("#newPMessageCheck").css("display", "flex");
});
}
function ehPlayVideo(url) {
var ehvideo = $("#eh_video_player");
ehvideo[0].autoplay = true;
ehvideo[0].src = url;
ehvideo[0].load();
ehvideo[0].play();
}
function ehPlayAudio(url) {
const audio = new Audio(url);
audio.play();
}
</script>';
}
else {
echo '
<div style="display: none;" class="newPMessageCheckOnce" id="newPMessageCheck"></div>
<script>
function ehPlayAudio(url) {
const audio = new Audio(url);
audio.play();
}
</script>';
if ($context['user']['unread_messages'] >= 1) {
echo '
<script>
$(document).one("mousemove", function(event){' . ($type == 'audio' ? '
ehPlayAudio(\'' . $boardurl . '/' . $path . '/whistle_alert.wav\');' : '
ehPlayAudio(\'' . $boardurl . '/' . $path . '/alert.mp3\');
ehPlayAudio(\'' . $boardurl . '/' . $path . '/message.mp3\');') . '
$("#newPMessageCheck").attr("class", "newPMessageCheckOnce");
});
</script>';
}
}
You can change the first setting from video to audio or audio2.
Quote from: Chen Zhen on June 08, 2023, 04:54:55 PMDoes this new message alert just play a sound or a video?
it only plays sound
So use the audio2 option.
global $boardurl, $context;
// use video, audio or audio2
list($type, $path, $width, $height) = array(
'audio2',
'EhMedia',
'200px',
'200px'
);
if ($type == 'video' && $context['user']['unread_messages'] >= 1) {
echo '
<div style="display: none;margin: 0 auto;width: 100%;" class="centertext newPMessageCheckOnce" id="newPMessageCheck"></div>
<video style="position: relative;left: 50%;transform: translateX(-50%);" width="' . $width . '" height="' . $height . '" id="eh_video_player" poster="">
<source id="ehvideo_mp4" src="" type=\'video/mp4; codecs="avc1.42E01E, mp4a.40.2"\' />
</video>
</div>
<script>
if ($("#newPMessageCheck").hasClass("newPMessageCheckOnce")) {
$(document).one("mousemove", function(event){
ehPlayVideo(\'' . $boardurl . '/' . $path . '/alert_bell.mp4\');
ehPlayAudio(\'' . $boardurl . '/' . $path . '/alert.mp3\');
ehPlayAudio(\'' . $boardurl . '/' . $path . '/message.mp3\');
$("#newPMessageCheck").css("display", "flex");
});
}
function ehPlayVideo(url) {
var ehvideo = $("#eh_video_player");
ehvideo[0].autoplay = true;
ehvideo[0].src = url;
ehvideo[0].load();
ehvideo[0].play();
}
function ehPlayAudio(url) {
const audio = new Audio(url);
audio.play();
}
</script>';
}
else {
echo '
<div style="display: none;" class="newPMessageCheckOnce" id="newPMessageCheck"></div>
<script>
function ehPlayAudio(url) {
const audio = new Audio(url);
audio.play();
}
</script>';
if ($context['user']['unread_messages'] >= 1) {
echo '
<script>
$(document).one("mousemove", function(event){' . ($type == 'audio' ? '
ehPlayAudio(\'' . $boardurl . '/' . $path . '/whistle_alert.wav\');' : '
ehPlayAudio(\'' . $boardurl . '/' . $path . '/alert.mp3\');
ehPlayAudio(\'' . $boardurl . '/' . $path . '/message.mp3\');') . '
$("#newPMessageCheck").attr("class", "newPMessageCheckOnce");
});
</script>';
}
}
You have to download the file I provided to make it work.
Put the EhMedia folder in your main forum path (directory).
Quoteecho '
</head>
<body id="', $context['browser_body_id'], '" class="action_', !empty($context['current_action']) ? $context['current_action'] : (!empty($context['current_board']) ?
'messageindex' : (!empty($context['current_topic']) ? 'display' : 'home')), !empty($context['current_board']) ? ' board_' . $context['current_board'] : '', '">';
global $boardurl, $context;
// use video, audio or audio2
list($type, $path, $width, $height) = array(
'audio2',
'EhMedia',
'200px',
'200px'
);
if ($type == 'video' && $context['user']['unread_messages'] >= 1) {
echo '
<div style="display: none;margin: 0 auto;width: 100%;" class="centertext newPMessageCheckOnce" id="newPMessageCheck"></div>
<video style="position: relative;left: 50%;transform: translateX(-50%);" width="' . $width . '" height="' . $height . '" id="eh_video_player" poster="">
<source id="ehvideo_mp4" src="" type=\'video/mp4; codecs="avc1.42E01E, mp4a.40.2"\' />
</video>
</div>
<script>
if ($("#newPMessageCheck").hasClass("newPMessageCheckOnce")) {
$(document).one("mousemove", function(event){
ehPlayVideo(\'' . $boardurl . '/' . $path . '/alert_bell.mp4\');
ehPlayAudio(\'' . $boardurl . '/' . $path . '/alert.mp3\');
ehPlayAudio(\'' . $boardurl . '/' . $path . '/message.mp3\');
$("#newPMessageCheck").css("display", "flex");
});
}
function ehPlayVideo(url) {
var ehvideo = $("#eh_video_player");
ehvideo
[o].autoplay = true;
ehvideo
[o].src = url;
ehvideo
[o].load();
ehvideo
[o].play();
}
function ehPlayAudio(url) {
const audio = new Audio(url);
audio.play();
}
</script>';
}
else {
echo '
<div style="display: none;" class="newPMessageCheckOnce" id="newPMessageCheck"></div>
<script>
function ehPlayAudio(url) {
const audio = new Audio(url);
audio.play();
}
</script>';
if ($context['user']['unread_messages'] >= 1) {
echo '
<script>
$(document).one("mousemove", function(event){' . ($type == 'audio' ? '
ehPlayAudio(\'' . $boardurl . '/' . $path . '/whistle_alert.wav\');' : '
ehPlayAudio(\'' . $boardurl . '/' . $path . '/alert.mp3\');
ehPlayAudio(\'' . $boardurl . '/' . $path . '/message.mp3\');') . '
$("#newPMessageCheck").attr("class", "newPMessageCheckOnce");
});
</script>';
}
}
WORKED THANKS
you really know this job ;)
can it work in notifications? or make a different sound in notifications?
let it work in messages and notifications
Wow, it never occurred to me to put voice notifications
Ha ha! Excellent!