Version 4.0.13.1
This commit is contained in:
1 parent
f9e857d255
commit
c6a86f0d9b
7517 files changed
+597400
-668041
No files matched your search
Whitespace-only changes.
@@ -0,0 +1,56 @@
|
||||
//<?php
|
||||
|
||||
class chat_hook_tabCount extends _HOOK_CLASS_
|
||||
{
|
||||
/**
|
||||
* Output the basic javascript files every page needs
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected static function baseJs()
|
||||
{
|
||||
parent::baseJs();
|
||||
|
||||
if ( !isset( \IPS\Data\Store::i()->chatters ) )
|
||||
{
|
||||
\IPS\Data\Store::i()->chatters = array();
|
||||
}
|
||||
$chatters = \IPS\Data\Store::i()->chatters;
|
||||
$seen = array();
|
||||
|
||||
$count = 0;
|
||||
|
||||
if( is_array( $chatters ) AND count( $chatters ) )
|
||||
{
|
||||
foreach( $chatters as $uid => $chatter )
|
||||
{
|
||||
/* Have we already seen this? Remove duplicates */
|
||||
if( in_array( $chatter['forumUserID'], $seen ) )
|
||||
{
|
||||
unset( $chatters[ $uid ] );
|
||||
}
|
||||
|
||||
/* If the last update was longer than 120 seconds ago, they're gone */
|
||||
if( $chatter['last_update'] < time() - 120 )
|
||||
{
|
||||
unset( $chatters[ $uid ] );
|
||||
}
|
||||
|
||||
$seen[ $chatter['forumUserID'] ] = $chatter['forumUserID'];
|
||||
}
|
||||
|
||||
$count = count( $chatters );
|
||||
}
|
||||
|
||||
if( !$count )
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
\IPS\Output::i()->endBodyCode .= <<<HTML
|
||||
<script type='text/javascript'>
|
||||
$('.elNavigation_app_chat_Chat').append( $('<span/>').addClass('ipsNotificationCount').text('{$count}') );
|
||||
</script>
|
||||
HTML;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
//<?php
|
||||
|
||||
class chat_hook_tabCountLoad extends _HOOK_CLASS_
|
||||
{
|
||||
/**
|
||||
* Constructor
|
||||
* Gets stores which are always needed to save individual queries
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
$this->initLoad[] = 'chatters';
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,53 @@
|
||||
//<?php
|
||||
|
||||
class chat_hook_tabNewWindow extends _HOOK_CLASS_
|
||||
{
|
||||
/**
|
||||
* Output the basic javascript files every page needs
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected static function baseJs()
|
||||
{
|
||||
parent::baseJs();
|
||||
|
||||
if( !\IPS\Settings::i()->ipchat_new_window )
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
\IPS\Output::i()->endBodyCode .= <<<HTML
|
||||
<script type='text/javascript'>
|
||||
$('.elNavigation_app_chat_Chat').click( function( e ){
|
||||
e.preventDefault();
|
||||
|
||||
var joinWith = '?';
|
||||
|
||||
if ( $( e.currentTarget ).attr('href').indexOf('?') != -1 )
|
||||
{
|
||||
joinWith = '&';
|
||||
}
|
||||
|
||||
window.open( $( e.currentTarget ).attr('href') + joinWith + '_popup=1', '_blank', "height=480,width=1200,location=0,menubar=0,toolbar=0" );
|
||||
return false;
|
||||
});
|
||||
</script>
|
||||
HTML;
|
||||
}
|
||||
|
||||
/**
|
||||
* Finish
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function finish()
|
||||
{
|
||||
/* Is this a popup? */
|
||||
if ( \IPS\Request::i()->_popup == 1 AND \IPS\Dispatcher::i()->application->directory == 'chat' )
|
||||
{
|
||||
\IPS\Output::i()->sendOutput( \IPS\Theme::i()->getTemplate( 'global', 'core' )->blankTemplate( \IPS\Output::i()->output ), 200, 'text/html', \IPS\Output::i()->httpHeaders );
|
||||
}
|
||||
|
||||
parent::finish();
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user