Advertisement:

Author Topic: OnLine Users Today - collapsable  (Read 23006 times)

Offline Ivan Minic

  • Full Member
  • ***
  • Posts: 513
  • Gender: Male
  • Owner: www.Burek.com
    • Burek Forum
OnLine Users Today - collapsable
« on: July 31, 2005, 10:28:29 PM »
A small modification done by me, since i had like 1500 users daily, even more, and it took whole screen to show:
So, now it is collapsable :)

Of course, you need OnLine Users Today mod installed

Replace original BoardIndex.template.php - OnLine Users Today with this:
Code: [Select]
// "Users online Today"
echo '
<script language="JavaScript1.2" type="text/javascript" src="', $settings['default_theme_url'], '/select_expand_bbcodes.js"></script>
<tr>
<td class="catbg" colspan="3">', $txt['158bis'], ' ( ', $context['num_users_today'], ' ', $context['num_users_today'] == 1 ? $txt['user'] : $txt['users'], ' )
</td>
</tr><tr>
<td class="windowbg" width="20" valign="middle" align="center"><img src="', $settings['images_url'], '/icons/online2.gif" alt="', $txt['158bis'], '" border="0" /></td>
<td class="windowbg2" width="100%" colspan="2">
<table border="0" width="100%">
<tr>
<td class="windowbg2">
<script type="text/javascript"><!--

var id = \'SXBB\' + (1000 + Math.floor(Math.random() * 5000));
SXBB[id] = new _SXBB(id);
SXBB[id].T[\'expand\'] = \'Click for full list of users\';
SXBB[id].T[\'contract\'] = \'Collapse back\';
SXBB[id].writeCmd();

//--></script>
<br>
', $txt['online_today_explain'], '</td>

</tr>
</table>
<script type="text/javascript"><!--

SXBB[id].writeDiv();

//--></script>
<span class="smalltext">', $context['user_today'], '</span>
<script type="text/javascript"><!--

document.write(\'</div>\');

//--></script>
</td>
</tr>';

Then open a new txt file.
Copy paste this into it:
Code: [Select]
/*************************************************************
 * SXBB - Select Expand BBcodes MOD v1.0.2
 *
 * Copyright (C) 2004, Markus (http://www.phpmix.com)
 * This script is released under GPL License.
 * Feel free to use this script (or part of it) wherever you need
 * it ...but please, give credit to original author. Thank you. :-)
 * We will also appreciate any links you could give us.
 *
 * Enjoy! ;-)
 *
 *************************************************************/

//
// ADVICE: Editor Settings -> TabSize 4 ;-)
//

function SXBB_IsIEMac()
{
// Any better way to detect IEMac?
var ua = String(navigator.userAgent).toLowerCase();
if( document.all && ua.indexOf("mac") >= 0 )
return true;
return false;
}
function SXBB_IsOverflowAble()
{
// Reliable overflow usage seems to require correct DOM support with some exceptions:
// - Opera5/6 renders 'auto' as if it was 'visible'. Bang!
// - IEMac seems to be buggy in some circumstances:
//   http://sonofhans.net/mac_ie5_bug/
//
if( document.getElementById && document.childNodes && !SXBB_IsIEMac() )
return true;
return false;
}

function _SXBB(id)
{
this.id = id;
this.size = this.min = 0; // --- Adjust MINIMUM_BLOCK_HEIGHT here :-)
this.extra = 5; // --- This is added to height when expanded
this.margin = 20; // --- Hide [expand] command if just a few pixels height when expanded.
this.T = [];
}
_SXBB.prototype.genCmd = function(cmd, txt)
{
return '<a class="genmed" style="text-decoration:none;" href="javascript:void(0)" onclick="SXBB[\''+this.id+'\'].'+cmd+'(\''+txt+'\');" onfocus="this.blur();"><b>'+txt+'</b></a>';
}
_SXBB.prototype.writeCmd = function()
{
var s='';
if( SXBB_IsOverflowAble() )
{
// Actually, the [expand] link will be placed by the onload event (if necessary) :-)
s += '<span id="'+this.id+'x"></span>';
}
document.write(s); // ‹Select› ‹Expand›
}
_SXBB.prototype.writeDiv = function()
{
// Use 'overflow:auto;height:#px' only if 'overflow:auto' is supported...
// Works on IE4+, Mozilla, Opera7, Safari
// Fails on IEMac, NS4, Opera6-
//
var s = ( SXBB_IsOverflowAble() ? 'style="overflow:auto;height:'+this.min+'px;"' : '' );
document.write('<div id="'+this.id+'" '+s+'>');
}
_SXBB.prototype.getObj = function(id)
{
return ( document.getElementById ? document.getElementById(id) : null );
}
_SXBB.prototype.select = function()
{
var o = this.getObj(this.id);
if( !o ) return;
var r, s;
if( document.selection && !SXBB_IsIEMac() )
{
// Works on: IE5+
// To be confirmed: IE4? / IEMac fails?
r = document.body.createTextRange();
r.moveToElementText(o);
r.select();
}
else if( document.createRange && (document.getSelection || window.getSelection) )
{
// Works on: Netscape/Mozilla/Konqueror/Safari
// To be confirmed: Konqueror/Safari use window.getSelection ?
r = document.createRange();
r.selectNodeContents(o);
s = window.getSelection ? window.getSelection() : document.getSelection();
s.removeAllRanges();
s.addRange(r);
}
}
_SXBB.prototype.resize = function(cmd)
{
var o = this.getObj(this.id);
if( !o ) return;
var x = this.getObj(this.id+'x');
if( !x ) return;

// First, deal with requested command...
if( cmd == 'onload' || cmd == 'onresize' )
{
if( o.scrollHeight <= this.min ) { x.innerHTML = ''; return; }
if( x.innerHTML != '' ) return;
if( cmd == 'onload' )
{
x.innerHTML = this.genCmd('resize', this.T['expand']);
return;
}
cmd = this.T['contract'];
}
if( cmd == this.T['expand'] )
{
this.size = o.scrollHeight + this.extra;
o.style.height = 'auto';
o.style.overflow = 'visible';
// Check to conditionally hide the [expand] link, if once expanded, adding [contract] is not really useful.
x.innerHTML = ( (o.scrollHeight-this.margin) > this.min ? this.genCmd('resize', this.T['contract']) : '' );
}
else
{
this.size = this.min;
o.style.height = this.size + 'px';
o.style.overflow = 'auto';
x.innerHTML = this.genCmd('resize', this.T['expand']);
}
if( cmd != 'onresize' )
{
// If necessary, adjust height of outer blocks...
if( o.parentNode ) for( o = o.parentNode; o.parentNode; o = o.parentNode )
{
if( o.tagName && o.tagName == 'DIV' && o.id && o.id.indexOf('SXBB') == 0 )
{
if( !document.all ) SXBB[o.id].resize(this.T['contract']);
SXBB[o.id].resize(this.T['expand']);
}
}
}
return false;
}

// --------------------------------------------------------------------------------
// Actually, this script is being included for every instance of a boxed BBCode,
// so... we MUST do something to ensure we only do the job just once!
//
if( typeof(SXBB) == 'undefined' ) {
// --------------------------------------------------------------------------------

var SXBB = [];

// --------------------------------------------------------------------------------
if( SXBB_IsOverflowAble() ) { // The following is Not necessary on some browsers!
// --------------------------------------------------------------------------------

var SXBB_oldOnLoad = null;
var SXBB_oldOnResize = null;

function SXBB_onLoad()
{
if( SXBB_oldOnLoad ) { SXBB_oldOnLoad(); SXBB_oldOnLoad = null; }
SXBB_evalSize('onload');
}
function SXBB_onResize()
{
if( SXBB_oldOnResize ) { SXBB_oldOnResize(); SXBB_oldOnResize = null; }
SXBB_evalSize('onresize');
}
function SXBB_evalSize(cmd)
{
for( var id in SXBB ) SXBB[id].resize(cmd);
}

if( window.addEventListener )
{
// The DOM method
window.addEventListener('load', SXBB_onLoad, false);
window.addEventListener('resize', SXBB_onResize, false);
}
else if( window.attachEvent )
{
// The IE Method
window.attachEvent('onload', SXBB_onLoad);
window.attachEvent('onresize', SXBB_onResize);
}
else
{
// The 'legacy' method
SXBB_oldOnLoad = window.onload;
SXBB_oldOnResize = window.onresize;
window.onload = SXBB_onLoad;
window.onresize = SXBB_onResize;
}

// --------------------------------------------------------------------------------
} // if( SXBB_IsOverflowAble() )
// --------------------------------------------------------------------------------
} // if( typeof(SXBB) == 'undefined' )
// --------------------------------------------------------------------------------
Name it select_expand_bbcodes.js
And upload it in your Themes/default/

Offline Vranx

  • Semi-Newbie
  • *
  • Posts: 67
  • Gender: Male
Re: OnLine Users Today - collapsable
« Reply #1 on: October 28, 2005, 11:40:57 AM »
Please direct me to the Online Users Today mod.

Offline JayBachatero

  • SMF Friend
  • SMF Super Hero
  • *
  • Posts: 19,562
  • Gender: Male
    • @jaycreations on Twitter
    • JayBachatero.com
Re: OnLine Users Today - collapsable
« Reply #2 on: October 28, 2005, 01:19:34 PM »
Please direct me to the Online Users Today mod.

This mod was remove by its author.  you can get it over at smitalia.net.  you need to register though.
Follow me on Twitter

"HELP!!! I've fallen and I can't get up"
This moment has been brought to you by LifeAlert

Offline Vranx

  • Semi-Newbie
  • *
  • Posts: 67
  • Gender: Male
Re: OnLine Users Today - collapsable
« Reply #3 on: October 28, 2005, 02:22:42 PM »
Thanks, appreciate the help. Any other sites like that around?

Offline N3lson

  • Sr. Member
  • ****
  • Posts: 808
  • Gender: Male
Re: OnLine Users Today - collapsable
« Reply #4 on: February 04, 2006, 02:18:21 AM »
I did that and not show the users or the collapsable option...
What´s wrong?
I´m Portuguese Yeah

Offline kikkok

  • Newbie
  • *
  • Posts: 4
  • www.korkwai.com
    • www.korkwai.com
Re: OnLine Users Today - collapsable
« Reply #5 on: February 05, 2006, 01:10:06 AM »
it notwork ???
hxxp:www.fakroop.com [nonactive]
hxxp:www.korkwai.com/ [nonactive]

Offline N3lson

  • Sr. Member
  • ****
  • Posts: 808
  • Gender: Male
Re: OnLine Users Today - collapsable
« Reply #6 on: February 05, 2006, 06:33:48 AM »
I´m Portuguese Yeah

Offline Vinspire^

  • Semi-Newbie
  • *
  • Posts: 82
Re: OnLine Users Today - collapsable
« Reply #7 on: May 02, 2006, 12:19:09 PM »
Is this the mod ?



And ermm .... its not working ?

Offline iv_nik

  • Semi-Newbie
  • *
  • Posts: 30
Re: OnLine Users Today - collapsable
« Reply #8 on: May 03, 2006, 04:05:01 PM »
Am I understood right: we delete this:
Quote
// Users online today
echo '
<tr>
<td class="titlebg" colspan="2">', $txt['uot_users_online_today_title'], '</td>
</tr><tr>
<td class="windowbg" width="20" valign="middle" align="center">
<img src="', $settings['images_url'], '/icons/online.gif" alt="', $txt[158], ' ', $txt['uot_users_online_today_title'], '" border="0" />
</td>
<td class="windowbg2" width="100%">';

echo '
<div class="smalltext">';

echo $context['num_users_online_today'], ' ', $context['num_users_online_today'] == 1 ? $txt['uot_user_online_today'] : $txt['uot_users_online_today'];

// Assuming there ARE users online... each user in users_online has an id, username, name, group, href, and link.
if (!empty($context['users_online_today']))
echo ':<br />', implode(', ', $context['list_users_online_today']);

echo '
<br />', $context['show_stats'] && !$settings['show_sp1_info'] ? '
<a href="' . $scripturl . '?action=stats">' . $txt['smf223'] . '</a>' : '', '
</div>
</td>
</tr>';
and paste there the code from the 1st post?