collapse

* Simple Portal Archived Forum

This is an Archive Forum.

The content in this forum may be out-of-date or have been superseded by newer information, and links in forum pages to other sites may not work.
This forum contains archives for future reference.

Visit our thread at Simple Machines Forum for current support.

SMF 2.1 users: EhPortal is a ported version of Simple Portal specifically designed for the SMF 2.1 branch.
Please visit web-develop.ca to download EhPortal and for its support.

* User Info

 
 
Welcome, Guest. Please login or register.

* Who's Online

  • Dot Guests: 234
  • Dot Hidden: 0
  • Dot Users: 0

There aren't any users online.

* Shoutbox

Refresh History
  • Shoutbox is not for support!
  • {OCS}MasterSeal: Yup, Still adore SP
    April 21, 2019, 07:08:06 PM
  • {OCS}MasterSeal: STILL love SP :)
    November 24, 2018, 05:05:50 AM
  • ♦ Ninja ZX-10RR ♦: <3 aegersz
    September 13, 2018, 03:36:09 PM
  • aegersz: I STILL <3 LOVE SimplePortal
    September 13, 2018, 07:11:39 AM
  • aegersz: o LOVE you guys - Simple Portal rocks !
    May 09, 2018, 05:18:59 AM
  • Chen Zhen: our apologies for the site being down.. please read server issues topic
    March 22, 2018, 05:32:38 AM
  • {OCS}MasterSeal: LOL PLEASE forget I just posted that. I found the answer in my own dang post back in 2015. lol sorry!
    July 04, 2017, 10:47:55 PM
  • {OCS}MasterSeal: I know this SB isnt' for support, but I just have a general question. Who would I contact to find out where SP stores its block info? Is it DB driven or files? I searched the site but came up with nothing. probably my fault any insight is appreciated.
    July 04, 2017, 10:43:36 PM
  • ♦ Ninja ZX-10RR ♦: Excuse me but what does Simpleportal have to deal with that?
    February 05, 2017, 08:21:14 PM
  • WhiteEagle: of course IMHO that site appears to be dead :(
    February 04, 2017, 01:08:05 PM
  • WhiteEagle: If I can get that, then I'll use it for that site...
    February 04, 2017, 01:07:35 PM
  • WhiteEagle: decided to not use SMF for any projects, unless I can get a copy of the premium version of the fanfiction archive plugin
    February 04, 2017, 01:06:54 PM
  • expertdecisions: cloudflare
    January 28, 2017, 08:01:47 AM
  • aegersz: SM release 2.0.13 !
    January 12, 2017, 06:00:13 AM
  • raffo: Tks Emanuele, even if I didn't understand the fix :D
    November 07, 2016, 02:01:20 AM
  • emanuele: [link]
    November 01, 2016, 12:43:50 PM
  • emanuele: raffo: the English support board is a good place. ;)
    November 01, 2016, 12:43:38 PM
  • raffo: Where can I find the fix for the shoutbox?
    November 01, 2016, 05:06:09 AM
  • {OCS}MasterSeal: To the SP team, I make a point to come here and thank you as much as possible for your work.  so again, THANK YOU!
    October 28, 2016, 10:38:05 AM
  • emanuele: That's indeed funny, the limit is present only in the patch and not the full install.
    October 22, 2016, 06:14:58 PM

* Recent Posts

Adding Forums Button to Nav bar by jirapon
[August 01, 2019, 09:07:12 AM]


Re: Board Icons by ♦ Ninja ZX-10RR ♦
[July 30, 2019, 04:03:41 PM]


MOVED: Czech translation???? by ♦ Ninja ZX-10RR ♦
[July 30, 2019, 03:04:51 PM]


Board Icons by jirapon
[July 30, 2019, 07:28:44 AM]


Re: Thankyou Simpleportal, by ♦ Ninja ZX-10RR ♦
[July 29, 2019, 09:41:29 AM]

Welcome to SimplePortal.net! You can download SimplePortal from the Downloads Area!

Author Topic: Audible alert sound in ShoutBox.  (Read 33087 times)

0 Members and 1 Guest are viewing this topic.

Offline N.E.Media

  • Semi Newbie
  • *
  • Posts: 21
  • Gender: Male
  • SMF Version: 1.1.10
  • SP Version: 2.3.1
Audible alert sound in ShoutBox.
« on: November 06, 2009, 08:04:52 PM »
I had been using the Ajax Chat/Shout package, in which both had a little alert tone each time a new entry was made.

I installed SP and love it - and started using the SP shout block because it meshes seamlessly with the rest of SP, and switched off the Ajax shoutbox.

Problem is, we're missing that feature because no one realized how handy that alert tone was until it was gone.

No one notices a new shout now until they happen to look - if at all.

Would love to get that feature added to the SP shoutbox.

Any ideas?

Does it already exist and I just haven't found it?

I really have searched it.

THANKS!!!


Dan

« Last Edit: November 08, 2009, 09:51:40 AM by N.E.Media »

Offline homer09001

  • Semi Newbie
  • *
  • Posts: 36
  • SMF Version: 2 RC1.2
  • SP Version: 2.3
Re: Audible alert sound in ShoutBox.
« Reply #1 on: November 08, 2009, 08:23:27 AM »
I'll take a look tonight it should be easy enough to do.

I don't use the shoutbox on my site so can you tell me does it automatticaly update itself in the browser without reloading the page?

Offline N.E.Media

  • Semi Newbie
  • *
  • Posts: 21
  • Gender: Male
  • SMF Version: 1.1.10
  • SP Version: 2.3.1
Re: Audible alert sound in ShoutBox.
« Reply #2 on: November 08, 2009, 09:46:37 AM »
Thank you very much!

And yes, updates are live - not just between refreshes.

Every time someone makes a new comment, a little tone would be great - makes you look.

Dan


Offline homer09001

  • Semi Newbie
  • *
  • Posts: 36
  • SMF Version: 2 RC1.2
  • SP Version: 2.3
Re: Audible alert sound in ShoutBox.
« Reply #3 on: November 08, 2009, 11:42:53 AM »
Right not a problem like I said should be easy enough to do, I'm finished work in 2 hours so I'll take a look at the code this evening. :)

Offline homer09001

  • Semi Newbie
  • *
  • Posts: 36
  • SMF Version: 2 RC1.2
  • SP Version: 2.3
Re: Audible alert sound in ShoutBox.
« Reply #4 on: November 08, 2009, 02:27:38 PM »
Forgot to add which version of SMF and SP are you using?

Offline N.E.Media

  • Semi Newbie
  • *
  • Posts: 21
  • Gender: Male
  • SMF Version: 1.1.10
  • SP Version: 2.3.1
Re: Audible alert sound in ShoutBox.
« Reply #5 on: November 08, 2009, 04:04:08 PM »
Forgot to add which version of SMF and SP are you using?

smf 1.1.10

SP 2.3.1


Thanks again!

Dan


Offline homer09001

  • Semi Newbie
  • *
  • Posts: 36
  • SMF Version: 2 RC1.2
  • SP Version: 2.3
Re: Audible alert sound in ShoutBox.
« Reply #6 on: November 08, 2009, 04:43:29 PM »
right i've spent the last 2-3 hours and im at a total block so far, the only way i can think of doing this so far is to check the time that has elapsed since the last post was made, if it is within the last 10 seconds play the sound.

Now, i can work the elapsed time out, but i can't work it out every time the shoutbox reloads itself?

so if anyone else can help me here it would be a great help :)

Offline Nathaniel

  • Comrade
  • *
  • Posts: 5203
  • Gender: Male
    • Verbtest.com
  • SMF Version: 2 RC4
  • SP Version: 2.3.3
Re: Audible alert sound in ShoutBox.
« Reply #7 on: November 08, 2009, 05:15:29 PM »
Find the code below in your '/Themes/default/portal.js' file:
Code: [Select]
setInnerHTML(document.getElementById('shouts_' + shoutbox_id), new_body);
I suggest that you put any code that plays the sound, straight after that code. Any code there, will be run whenever the shoutbox is updated and there is a new shout.
SMF Friend (Former Support Specialist) | SimplePortal DeveloperMy SMF Mods | SimplePortal"Quis custodiet ipsos custodes?" - Who will Guard the Guards?Please don't send me ANY support related PMs. I will just delete them.

Offline homer09001

  • Semi Newbie
  • *
  • Posts: 36
  • SMF Version: 2 RC1.2
  • SP Version: 2.3
Re: Audible alert sound in ShoutBox.
« Reply #8 on: November 08, 2009, 06:28:43 PM »
Find the code below in your '/Themes/default/portal.js' file:
Code: [Select]
setInnerHTML(document.getElementById('shouts_' + shoutbox_id), new_body);
I suggest that you put any code that plays the sound, straight after that code. Any code there, will be run whenever the shoutbox is updated and there is a new shout.

if i try to put any code after that part everytime i click the refresh icon on the shoutbox it take me to the history?

Offline Nathaniel

  • Comrade
  • *
  • Posts: 5203
  • Gender: Male
    • Verbtest.com
  • SMF Version: 2 RC4
  • SP Version: 2.3.3
Re: Audible alert sound in ShoutBox.
« Reply #9 on: November 08, 2009, 11:17:50 PM »
That indicates that there is an error with the JS that is being run when that button is clicked. Can you post the code that you are trying to add there?
SMF Friend (Former Support Specialist) | SimplePortal DeveloperMy SMF Mods | SimplePortal"Quis custodiet ipsos custodes?" - Who will Guard the Guards?Please don't send me ANY support related PMs. I will just delete them.

Offline homer09001

  • Semi Newbie
  • *
  • Posts: 36
  • SMF Version: 2 RC1.2
  • SP Version: 2.3
Re: Audible alert sound in ShoutBox.
« Reply #10 on: November 09, 2009, 03:04:35 AM »
Doesn't matter sorry got it working so to speak, just trying to get the sound to play in the browser ATM rather than in media player?

Offline Nathaniel

  • Comrade
  • *
  • Posts: 5203
  • Gender: Male
    • Verbtest.com
  • SMF Version: 2 RC4
  • SP Version: 2.3.3
Re: Audible alert sound in ShoutBox.
« Reply #11 on: November 09, 2009, 04:58:11 AM »
Basically, you were using the method which just passes the file straight to the browser right? That doesn't work as intended, I have had a go at this, using the SoundManager2 library to implement it so that it works properly.

I might package this up as a mod sometime, but for now, here are some instructions for adding this.

1) Download the attached archive, extract the files into your '/Themes/default/' folder.
2) Perform these edits to your '/Themes/default/portal.js' file.

Code: ("Find") [Select]
            setInnerHTML(document.getElementById('shouts_' + shoutbox_id), new_body);
Code: ("Replace") [Select]
            setInnerHTML(document.getElementById('shouts_' + shoutbox_id), new_body);
            soundManager.play('refresh_shoutbox');

Code: ("Find") [Select]
    shoutbox_indicator(shoutbox_id, false);
Code: ("Replace") [Select]
    var sp_date = new Date; // Generic JS date object
    var unixtime_ms = sp_date.getTime(); // Returns milliseconds since the epoch
    document.getElementById("last_refresh_" + shoutbox_id).value = parseInt(unixtime_ms / 1000);

    shoutbox_indicator(shoutbox_id, false);

3) Perform these edits to your '/Themes/default/PortalShoutbox.template.php' file.

Code: ("Find") [Select]
sp_refresh_shout(', $shoutbox['id'], ', 0);
Code: ("Replace") [Select]
sp_refresh_shout(', $shoutbox['id'], ', last_refresh_', $shoutbox['id'], '.value);
Code: ("Find") [Select]
        <input type="hidden" name="shoutbox_id" value="', $shoutbox['id'], '" />
Code: (Replace) [Select]
        <input type="hidden" id="last_refresh_', $shoutbox['id'], '" value="', time(), '" />
        <input type="hidden" name="shoutbox_id" value="', $shoutbox['id'], '" />

Code: ("Find") [Select]
    <script language="Javascript" type="text/javascript"><!-- // --><![CDATA[';
Code: ("Replace") [Select]
    <script type="text/javascript" src="', $settings['theme_url'], '/soundmanager.js"></script>
    <script language="Javascript" type="text/javascript"><!-- // --><![CDATA[
        var last_refresh_', $shoutbox['id'], ' = document.getElementById("last_refresh_', $shoutbox['id'], '");
        soundManager.url = \'', $settings['theme_url'], '/swf/\';
        soundManager.onload = function()
        {
            soundManager.createSound(\'refresh_shoutbox\',\'', $settings['theme_url'], '/alert.mp3\');
        };';

Code: ("Find") [Select]
        var last_refresh_', $shoutbox['id'], ' = ', time(), ';
        function sp_auto_refresh_', $shoutbox['id'], '()
        {
            if (window.XMLHttpRequest)
            {
                sp_refresh_shout(', $shoutbox['id'], ', last_refresh_', $shoutbox['id'], ');
                last_refresh_', $shoutbox['id'], ' += ', $shoutbox['refresh'], ';

Code: ("Replace") [Select]
        function sp_auto_refresh_', $shoutbox['id'], '()
        {
            if (window.XMLHttpRequest)
            {
                sp_refresh_shout(', $shoutbox['id'], ', last_refresh_', $shoutbox['id'], '.value);

4) Lastly, you can change the 'alter.mp3' file, if you want. As long as its a .mp3 file it should work fine.
SMF Friend (Former Support Specialist) | SimplePortal DeveloperMy SMF Mods | SimplePortal"Quis custodiet ipsos custodes?" - Who will Guard the Guards?Please don't send me ANY support related PMs. I will just delete them.

Offline homer09001

  • Semi Newbie
  • *
  • Posts: 36
  • SMF Version: 2 RC1.2
  • SP Version: 2.3
Re: Audible alert sound in ShoutBox.
« Reply #12 on: November 09, 2009, 08:41:57 AM »
work perfect in SMF 2.0 RC 1.2 it should work perfect in 1.1.10 aswell as its only modifying SP and not smf?

I can package it up if you like?

Offline Nathaniel

  • Comrade
  • *
  • Posts: 5203
  • Gender: Male
    • Verbtest.com
  • SMF Version: 2 RC4
  • SP Version: 2.3.3
Re: Audible alert sound in ShoutBox.
« Reply #13 on: November 09, 2009, 05:52:56 PM »
Go for it.

I tested it under SMF 1.1.10 only, but yes, its editing of SP code will mean that as long as you are running SP 2.3.1 it should work fine.
SMF Friend (Former Support Specialist) | SimplePortal DeveloperMy SMF Mods | SimplePortal"Quis custodiet ipsos custodes?" - Who will Guard the Guards?Please don't send me ANY support related PMs. I will just delete them.

Offline N.E.Media

  • Semi Newbie
  • *
  • Posts: 21
  • Gender: Male
  • SMF Version: 1.1.10
  • SP Version: 2.3.1
Re: Audible alert sound in ShoutBox.
« Reply #14 on: November 10, 2009, 02:31:32 PM »
Hmmmmm . . .

What did I do wrong?

I'm not new to manual parsing and editors - seemed simple enough.

The entry showed up OK (doesn't show here because I hit the screen-shot too soon).

Any ideas?




Dan


« Last Edit: November 10, 2009, 02:53:41 PM by N.E.Media »

Offline Nathaniel

  • Comrade
  • *
  • Posts: 5203
  • Gender: Male
    • Verbtest.com
  • SMF Version: 2 RC4
  • SP Version: 2.3.3
Re: Audible alert sound in ShoutBox.
« Reply #15 on: November 10, 2009, 03:49:48 PM »
That error indicates that the code which stops the refresh button from showing, is not being run, most likely because there is a javascript error somewhere.

Could you please attach you '/Themes/default/PortalShoutbox.template.php' and '/Themes/default/portal.js' files?
SMF Friend (Former Support Specialist) | SimplePortal DeveloperMy SMF Mods | SimplePortal"Quis custodiet ipsos custodes?" - Who will Guard the Guards?Please don't send me ANY support related PMs. I will just delete them.

Offline N.E.Media

  • Semi Newbie
  • *
  • Posts: 21
  • Gender: Male
  • SMF Version: 1.1.10
  • SP Version: 2.3.1
Re: Audible alert sound in ShoutBox.
« Reply #16 on: November 10, 2009, 04:14:25 PM »
I'm sorry, these are the un-altered files before the new code was attempted.

I had already done a restore.

Thank you for all the help!

Dan




Offline Nathaniel

  • Comrade
  • *
  • Posts: 5203
  • Gender: Male
    • Verbtest.com
  • SMF Version: 2 RC4
  • SP Version: 2.3.3
Re: Audible alert sound in ShoutBox.
« Reply #17 on: November 10, 2009, 04:34:20 PM »
Try the attached files. Also make sure that you uploaded and extracted the contents of the package that I attached to my earlier post.
SMF Friend (Former Support Specialist) | SimplePortal DeveloperMy SMF Mods | SimplePortal"Quis custodiet ipsos custodes?" - Who will Guard the Guards?Please don't send me ANY support related PMs. I will just delete them.

Offline N.E.Media

  • Semi Newbie
  • *
  • Posts: 21
  • Gender: Male
  • SMF Version: 1.1.10
  • SP Version: 2.3.1
Re: Audible alert sound in ShoutBox.
« Reply #18 on: November 10, 2009, 04:48:23 PM »
Getting there!

Recycling problem stopped - still no sound though.

(yes, the speakers are on.   ;D)

I wonder if I have the files exactly where they need to go?

I extracted the archive which of course, yielded a folder - I put the contents of the folder in the themes/default directory.

Dan


Offline Nathaniel

  • Comrade
  • *
  • Posts: 5203
  • Gender: Male
    • Verbtest.com
  • SMF Version: 2 RC4
  • SP Version: 2.3.3
Re: Audible alert sound in ShoutBox.
« Reply #19 on: November 10, 2009, 04:51:48 PM »
Well, you should have these files:
/Themes/default/alert.mp3
/Themes/default/soundmanager.js

And this folder, with some .swf files in it:
/Themes/default/swf/

If you are using a Custom theme, then copy the files into your custom theme's directory as well.

Then the only requirement of the js, is that you have flash installed, although its most likely that you do have it installed.
SMF Friend (Former Support Specialist) | SimplePortal DeveloperMy SMF Mods | SimplePortal"Quis custodiet ipsos custodes?" - Who will Guard the Guards?Please don't send me ANY support related PMs. I will just delete them.