TinyPortal

Development => Block Codes => Topic started by: MKJ on February 24, 2006, 03:24:19 AM

Title: Shoutbox Autorefresh
Post by: MKJ on February 24, 2006, 03:24:19 AM
The new shoutbox script is the bizz really.  No need for my auto refresh code as it has it built in.  Was set on a few minutes so I wasn't aware of it.  Me rushing into things again.  Altered the script and my site now so that it is looking ok and working ok too.  This bit of code for silent refresh of pages or scripts I found quite a long time ago and really is very useful.  No clicking on refresh and no mention of anything on the task bar.  Nothing that would annoy anyone infact.  Here is the code.  Dead simple to alter the timer as you should be able to see.


<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<title>Timer</title>
</head>

<body>

<!--compiled in <?=round(((time() + microtime()) - $GLOBALS['timer'])*1000)?> milliseconds-->
<noscript>
<!--
    We have the "refresh" meta-tag in case the user's browser does
    not correctly support JavaScript or has JavaScript disabled.

    Notice that this is nested within a "noscript" block.
-->
<meta http-equiv="refresh" content="2">

</noscript>

<script language="JavaScript">
<!--

var sURL = unescape(window.location.pathname);

function doLoad()
{
    // the timeout value should be the same as in the "refresh" meta-tag
    setTimeout( "refresh()", 5*1000 );
}

function refresh()
{
    //  This version of the refresh function will cause a new
    //  entry in the visitor's history.  It is provided for
    //  those browsers that only support JavaScript 1.0.
    //
    window.location.href = sURL;
}
//-->
</script>

<script language="JavaScript1.1">
<!--
function refresh()
{
    //  This version does NOT cause an entry in the browser's
    //  page view history.  Most browsers will always retrieve
    //  the document from the web-server whether it is already
    //  in the browsers page-cache or not.
    // 
    window.location.replace( sURL );
}
//-->
</script>

<script language="JavaScript1.2">
<!--
function refresh()
{
    //  This version of the refresh function will be invoked
    //  for browsers that support JavaScript version 1.2
    //
   
    //  The argument to the location.reload function determines
    //  if the browser should retrieve the document from the
    //  web-server.  In our example all we need to do is cause
    //  the JavaScript block in the document body to be
    //  re-evaluated.  If we needed to pull the document from
    //  the web-server again (such as where the document contents
    //  change dynamically) we would pass the argument as 'true'.
    // 
    window.location.reload( false );
}
//-->
</script>
</head>
<!--
    Use the "onload" event to start the refresh process.
-->
<body onload="doLoad()">

<script language="JavaScript">
<!--
    // we put this here so we can see something change
    document.write('<b>' + (new Date).toLocaleString() + '</b>');
//-->
</script>
</body>
</html>



Just create a new page with the above code and watch the refresh timer work silently.  You can enter this code into pages you want to refresh.  Very neat code if you ask me.

Regards.
Title: Re: Shoutbox Autorefresh
Post by: WarBirD on November 07, 2006, 07:34:05 AM
When I use this, I got the Date and the Time displayed in whereever I use it. Thats almost as anoying as having a stupid countdown there. CanÂÃ,´t this be done without any text or something ? Just plain silent refresh.
Title: Re: Shoutbox Autorefresh
Post by: ScoobyDan on November 08, 2006, 01:28:06 PM
WarBirD,

Simply remove this section of code from the script:
<script language="JavaScript">
<!--
    // we put this here so we can see something change
    document.write('<b>' + (new Date).toLocaleString() + '</b>');
//-->
</script>


Hey presto! Silent refreshing :D
Title: Re: Shoutbox Autorefresh
Post by: Greenbug on November 09, 2006, 09:57:04 AM
What I am doing wrong here, I would like only the shoutbox to auto refresh. I added that and the whole page refreshes. Can I add this to the shoutbox code if so how?
Title: Re: Shoutbox Autorefresh
Post by: Crip on November 09, 2006, 12:19:31 PM
TP-Shoutbox only refreshes when a Shout is made.. there is no auto-refresh for the shoutbox only..if ya'll want auto-refresh you'll need to look for a different shoutbox code..
Here are a few you can can in a scriptbox if you want..

- http://www.shoutmix.com/
- http://www.cj-design.com/demos/cjtagboardv3/index.php
- http://cbox.ws/getone.php
- http://txtbox.co.za/p_txtshout.php
Title: Re: Shoutbox Autorefresh
Post by: Greenbug on November 09, 2006, 10:34:15 PM
Quote from: crip on November 09, 2006, 12:19:31 PM
TP-Shoutbox only refreshes when a Shout is made.. there is no auto-refresh for the shoutbox only..if ya'll want auto-refresh you'll need to look for a different shoutbox code..
Here are a few you can can in a scriptbox if you want..

- http://www.shoutmix.com/
- http://www.cj-design.com/demos/cjtagboardv3/index.php
- http://cbox.ws/getone.php
- http://txtbox.co.za/p_txtshout.php

Thanks Crip, Ill check these out.

Please excuse my ignorance, but you cant add the above script into the native shoutbox page?
Title: Re: Shoutbox Autorefresh
Post by: Crip on November 12, 2006, 12:57:42 AM
No..
you put any of those scripts in a phpbox. EZ as pie. ;)
Title: Re: Shoutbox Autorefresh
Post by: RoarinRow on February 24, 2007, 09:21:53 PM
The http://www.shoutmix.com/ is very cool.  I like it.  It's a mini-chat/shoutbox with auto-refresh   :up:
Title: Re: Shoutbox Autorefresh
Post by: Crip on February 24, 2007, 09:55:06 PM
I don't think this one does autorefresh..
http://www.phptagboard.com/
Title: Re: Shoutbox Autorefresh
Post by: akulion on February 24, 2007, 10:40:15 PM
by the way guys
just wanted to say
ajax shoutboxes may be very cool indeed
but they are very server heavy

so always use a ajax shoutbox which has an 'inactivity' check
meaning it checks to see if the person is even using it or not and then disables if the person dosent use it for more than X mins

also make sure guests cant see it
Title: Re: Shoutbox Autorefresh
Post by: RoarinRow on February 24, 2007, 11:04:28 PM
So far it's good.  Not sure if it uses ajax?   Just like our TP shoutbox our was never open to guest or ungrouped members   :up:

Here's a screenshot of the ShoutMix box.
Title: Re: Shoutbox Autorefresh
Post by: brianjw on February 25, 2007, 10:28:50 PM
I think I may use the shoutmix one but there is a cpl of things I would like to ask first.

Title: Re: Shoutbox Autorefresh
Post by: RoarinRow on February 25, 2007, 10:39:17 PM
Quote from: brianjw on February 25, 2007, 10:28:50 PM
I think I may use the shoutmix one but there is a cpl of things I would like to ask first.

  • Is there a way I can make this shoutbox or another autorefreshing shoutbox use the same smilies as I have in my simple machines/ with the same codes?
  • Is there some code I can edit or add to some file to make the Tinyportal shoutbox autorefresh.

    Also... In another tinyportal version, the original shoutbox can remain normal without autorefresh. But you can create a block that is called Chat that you can easily make by checking in the radio button when creating a new bloc. :D It could look the same as the shoutbox now but can autorefresh without annoyance and without refreshing the entire page ;)

    Brianjw
Hey Brian,

  To answer you questions:

- yes you could use some of the same smileys from your forum.  you have to add them through the shoutmix control panel and it will show up in your new shoutbox.  you can use the same or similar code, but it does work like the forum.  In the forum you do something like this :smileycat:  but with shoutmix you just type in 'smileycat' or whatever code name you gave it.
- not sure about the TP questions.  i'll leave that to the TP staff

  I have been using it for the last 24 hours and love it!  it autofreshes without having to refresh the entire page.  I upgraded to the premium version so i wouldn't have advertisements and would have more flexibility in configuration, storage, etc.

  I sent an email to the developer asking if he could integrate our SMF member database with this shoutmix box so people wouldn't have to input their username.  I also asked if there was a way to add sound so you know when someone left a shout.
Title: Re: Shoutbox Autorefresh
Post by: Crip on February 25, 2007, 10:44:05 PM
Is Shoutmix remotely hosted??..if so, you cannot change smilies, but if it's a php script you can change
Title: Re: Shoutbox Autorefresh
Post by: brianjw on February 25, 2007, 10:51:45 PM
Hopefully they integrate it for smf or maybe someone can help me with modifying the existing shoutbox ;)
Title: Re: Shoutbox Autorefresh
Post by: Crip on February 25, 2007, 10:53:47 PM
I doubt it with TP, smf has a Shoutbox wit auto-refresh
Title: Re: Shoutbox Autorefresh
Post by: brianjw on February 25, 2007, 10:54:39 PM
Quote from: Ï‚Ã'ÏŠÏ on February 25, 2007, 10:53:47 PM
I doubt it with TP, smf has a Shoutbox wit auto-refresh
Is it able to display in a tinyportal block and if your talking about nneonneos shoutbox, that one didn't work out :-\
Title: Re: Shoutbox Autorefresh
Post by: RoarinRow on February 25, 2007, 11:00:37 PM
Quote from: Ï‚Ã'ÏŠÏ on February 25, 2007, 10:44:05 PM
Is Shoutmix remotely hosted??..if so, you cannot change smilies, but if it's a php script you can change

It is remotely hosted and you can disable the default smileys that it comes with and add your own custom smileys.  In the first attachment that last 6 smileys are ones I added.  The ones above that are the default ones.

Another cool feature is that you can undock the shoutbox as in the second attachment.
Title: Re: Shoutbox Autorefresh
Post by: RoarinRow on February 25, 2007, 11:01:46 PM
Quote from: brianjw on February 25, 2007, 10:54:39 PM
Quote from: Ï‚Ã'ÏŠÏ on February 25, 2007, 10:53:47 PM
I doubt it with TP, smf has a Shoutbox wit auto-refresh
Is it able to display in a tinyportal block and if your talking about nneonneos shoutbox, that one didn't work out :-\

that didn't work for me either   :o
Title: Re: Shoutbox Autorefresh
Post by: brianjw on February 25, 2007, 11:11:57 PM
Quote from: RoarinRow on February 25, 2007, 11:01:46 PM
Quote from: brianjw on February 25, 2007, 10:54:39 PM
Quote from: Ï‚Ã'ÏŠÏ on February 25, 2007, 10:53:47 PM
I doubt it with TP, smf has a Shoutbox wit auto-refresh
Is it able to display in a tinyportal block and if your talking about nneonneos shoutbox, that one didn't work out :-\

that didn't work for me either   :o
I dont see the AVS Messenger on your site :o how come?
Title: Re: Shoutbox Autorefresh
Post by: brianjw on February 25, 2007, 11:13:04 PM
Also... do you have to pay monthly/yearly or is it one time only?
Title: Re: Shoutbox Autorefresh
Post by: Crip on February 25, 2007, 11:14:29 PM
Popup window?
Title: Re: Shoutbox Autorefresh
Post by: RoarinRow on February 25, 2007, 11:15:31 PM
Quote from: brianjw on February 25, 2007, 11:13:04 PM
Also... do you have to pay monthly/yearly or is it one time only?

Per their site - Subscribe annually for just $20 or pay $6 quarterly to start enjoying all the premium features.

I went with the $20 annual set up   :)
Title: Re: Shoutbox Autorefresh
Post by: RoarinRow on February 25, 2007, 11:20:04 PM
Quote from: brianjw on February 25, 2007, 11:11:57 PM
Quote from: RoarinRow on February 25, 2007, 11:01:46 PM
Quote from: brianjw on February 25, 2007, 10:54:39 PM
Quote from: Ï‚Ã'ÏŠÏ on February 25, 2007, 10:53:47 PM
I doubt it with TP, smf has a Shoutbox wit auto-refresh
Is it able to display in a tinyportal block and if your talking about nneonneos shoutbox, that one didn't work out :-\

that didn't work for me either   :o
I dont see the AVS Messenger on your site :o how come?

It can only be seen by members who have 'Contributor' status.

Quote from: Ï‚Ã'ÏŠÏ on February 25, 2007, 11:14:29 PM
Popup window?

Yup you click on 'Popup Shoutbox' then a second shoutbox will appear into a floating Popup Window.
Title: Re: Shoutbox Autorefresh
Post by: brianjw on February 25, 2007, 11:28:08 PM
You mean you have to post atleast one post to see it or what?
Title: Re: Shoutbox Autorefresh
Post by: RoarinRow on February 25, 2007, 11:31:56 PM
Quote from: brianjw on February 25, 2007, 11:28:08 PM
You mean you have to post atleast one post to see it or what?

Our 'Contributors' are hand picked by our Admins.  Normally, the criteria is that they have 50 posts or more, then it's subjective after that.

There is a demo box at their site - http://www.shoutmix.com/main/  It works I just tried it.
Title: Re: Shoutbox Autorefresh
Post by: RoarinRow on February 26, 2007, 04:06:25 PM
This is the code I got from the shoutmix developer.  He said we can put this in a phpbox, but i didn't work.  Can someone please look at this sample code and see what it's missing:

global $user_info;// Edit configurations$shoutbox = 'http://www.shoutmix.com/?shoutmix'; // URL of shoutbox$width = '100%';$height = '360'; // without the % sign, value will be in pixels.$border = 0; // 0 for none, 1 for border.// Do not edit below this lineecho '<iframe src="' . htmlspecialchars($shoutbox) . '&name=' . htmlspecialchars($user_info['name']) . '" width="' . $width . '" height="' . $height . '" frameborder="' . $border . '" scrolling="auto"><a href="' . htmlspecialchars($shoutbox) . '">View shoutbox</a></iframe>';

I'm trying to use it in a right phpbox and all I see is the title, with nothing inside the block.

Thanks,
RoarinRow
Title: Re: Shoutbox Autorefresh
Post by: RoarinRow on February 26, 2007, 06:56:22 PM
This code works.  To use it you have to make your shoutbox Public instead of Membership, then put this in a php block.  Just changes the URL to your own shoutbox account URL:

global $user_info;

// Edit configurations

$shoutbox = 'http://www.shoutmix.com/?shoutmix'; // URL of shoutbox
$width = '160';
$height = '400'; // without the % sign, value will be in pixels.
$border = 0; // 0 for none, 1 for border.

// Do not edit below this line

echo '<iframe src="' . htmlspecialchars($shoutbox) . '&name=' .
htmlspecialchars($user_info['name']) . '" width="' . $width . '"
height="' .
$height . '" frameborder="' . $border . '" scrolling="auto"><a href="'
.
htmlspecialchars($shoutbox) . '">View shoutbox</a></iframe>';


Even though this code will recongize your member's user names automatically, there is nothing to prevent them from changing to something else.

Personally, I reverted back to Membership access, which means they have to register their username via the shoutbox.
Title: Re: Shoutbox Autorefresh
Post by: brianjw on February 26, 2007, 11:35:08 PM
Thanks I am testing that code right now :D
Title: Re: Shoutbox Autorefresh
Post by: RoarinRow on February 26, 2007, 11:50:21 PM
Quote from: brianjw on February 26, 2007, 11:35:08 PM
Thanks I am testing that code right now :D

It does work, we just don't like the fact that people can still change their user name to something else.   :down:
Title: Re: Shoutbox Autorefresh
Post by: brianjw on February 27, 2007, 12:00:04 AM
Quote from: RoarinRow on February 26, 2007, 11:50:21 PM
Quote from: brianjw on February 26, 2007, 11:35:08 PM
Thanks I am testing that code right now :D

It does work, we just don't like the fact that people can still change their user name to something else.   :down:
We need JPDeni or another TP Code Staff... Maybe they can make a php code to go into this that will deactivate the textbox the display name is in :D
Title: Re: Shoutbox Autorefresh
Post by: RoarinRow on February 27, 2007, 12:05:16 AM
Quote from: brianjw on February 27, 2007, 12:00:04 AM
Quote from: RoarinRow on February 26, 2007, 11:50:21 PM
Quote from: brianjw on February 26, 2007, 11:35:08 PM
Thanks I am testing that code right now :D

It does work, we just don't like the fact that people can still change their user name to something else.   :down:
We need JPDeni or another TP Code Staff... Maybe they can make a php code to go into this that will deactivate the textbox the display name is in :D

yeah, that would be cool if it could recogize the member's name and just grey it out   :up:
Title: Re: Shoutbox Autorefresh
Post by: brianjw on February 27, 2007, 12:11:12 AM
Quote from: RoarinRow on February 27, 2007, 12:05:16 AM
Quote from: brianjw on February 27, 2007, 12:00:04 AM
Quote from: RoarinRow on February 26, 2007, 11:50:21 PM
Quote from: brianjw on February 26, 2007, 11:35:08 PM
Thanks I am testing that code right now :D

It does work, we just don't like the fact that people can still change their user name to something else.   :down:
We need JPDeni or another TP Code Staff... Maybe they can make a php code to go into this that will deactivate the textbox the display name is in :D

yeah, that would be cool if it could recogize the member's name and just grey it out   :up:
Like nneonneos shoutbox, i cant use it though cuz it has errors on my site but lets focus on getting this done :D
Title: Re: Shoutbox Autorefresh
Post by: RoarinRow on February 27, 2007, 12:14:35 AM
Quote from: brianjw on February 27, 2007, 12:11:12 AM
Quote from: RoarinRow on February 27, 2007, 12:05:16 AM
Quote from: brianjw on February 27, 2007, 12:00:04 AM
Quote from: RoarinRow on February 26, 2007, 11:50:21 PM
Quote from: brianjw on February 26, 2007, 11:35:08 PM
Thanks I am testing that code right now :D

It does work, we just don't like the fact that people can still change their user name to something else.   :down:
We need JPDeni or another TP Code Staff... Maybe they can make a php code to go into this that will deactivate the textbox the display name is in :D

yeah, that would be cool if it could recogize the member's name and just grey it out   :up:
Like nneonneos shoutbox, i cant use it though cuz it has errors on my site but lets focus on getting this done :D

I just saw it on your site.  Looks good   :up:
Title: Re: Shoutbox Autorefresh
Post by: insanemustang on July 09, 2007, 03:47:54 AM
What about getting this ShoutMix to scroll down automatically like the TP Shoutbox does....
Title: Re: Shoutbox Autorefresh
Post by: RoarinRow on July 15, 2007, 08:05:29 PM
Quote from: insanemustang on July 09, 2007, 03:47:54 AM
What about getting this ShoutMix to scroll down automatically like the TP Shoutbox does....

You could email the developers at ShoutMix and make the suggestion.

They just added sound to ShoutMix.  When someone leaves a shout, there is a nice ping sound.  It's not too annoying for us since it's not very active, but at least you know when someone does leave a shout.
Title: Re: Shoutbox Autorefresh
Post by: TimUSA on October 23, 2007, 07:54:23 PM
any chances of getting this code to work without being open for guests. When I disable guest view in the block, no one can see the contents other than admins?

global $user_info;

// Edit configurations

$shoutbox = 'http://www.shoutmix.com/?shoutmix'; // URL of shoutbox
$width = '160';
$height = '400'; // without the % sign, value will be in pixels.
$border = 0; // 0 for none, 1 for border.

// Do not edit below this line

echo '<iframe src="' . htmlspecialchars($shoutbox) . '&name=' .
htmlspecialchars($user_info['name']) . '" width="' . $width . '"
height="' .
$height . '" frameborder="' . $border . '" scrolling="auto"><a href="'
.
htmlspecialchars($shoutbox) . '">View shoutbox</a></iframe>';


SOLVED!!!! On my own this time
for some reason this doesn't work if you disable guest in the block settings, but it does work by adding this line just under //Do not edit below this line
if (count(array_intersect(array(1,4,9,10,11,12,13), $user_info['groups'])))