/media/mod_shoutbox/js/mod_shoutbox.js
function JJShoutbox.getPosts
var request = { 'option' : 'com_ajax', 'module' : 'shoutbox', 'method' : 'getPosts', 'format' : 'json', 'jjshout[id]' : lastID, /* add last id */ 'jjshout[title]' : params.title, }; disable //params.instance.find('#jjshoutboxoutput').empty().prepend($('<div class="jj-shout-new"></div>')); Change from: //params.instance.find('.jj-shout-new').after(response.data.html + historyButton); to: $('#jjshoutboxoutput .jj-shout-new').after(response.data.html) and changed in helper: /modules/mod_shoutbox/helper.php function getPostsAjax() added var $post["id"] like $shouts = $helper->getShouts($offset, $helper->getParams()->get('maximum'), JText::_('SHOUT_DATABASEERRORSHOUT'), $post["id"]); function getShouts($offset, $number, $message, $id) /* add $id */ try { $shouts = $this->getShoutData($offset, $number, $id); /* add $id */ } function getShoutData($offset, $number, $id) /* add $id */ $query = $this->db->getQuery(true) ->select('*') ->from($this->db->qn('#__shoutbox')) ->order($this->db->qn('id') . ' DESC') /* only Shout IDs greater then last known lastID */ ->where($this->db->qn('id') . ' > ' . (int)$id) // ->setLimit($number, $offset);
/modules/mod_shoutbox/tmpl/default.php <?php if (!$user->guest): ?> setInterval(function(){ var JJ_ShoutGetParams = { title : '<?php echo $title; ?>', sound : <?php echo $sound; ?>, notifications : <?php echo $notifications; ?>, Itemid : '<?php echo $Itemid; ?>', instance : JJ_instance, loggedInUser : '<?php echo $displayName == 'user' ? $user->username : $user->name; ?>', history : JJ_history, }; JJShoutbox.getPosts(JJ_ShoutGetParams); }, <?php echo $refresh; ?>); <?php else :?> /* enable Ajax Refresh for guests */ setInterval(function(){ var JJ_ShoutGetParams = { title : '<?php echo $title; ?>', sound : <?php echo $sound; ?>, notifications : <?php echo $notifications; ?>, Itemid : '<?php echo $Itemid; ?>', instance : JJ_instance, history : JJ_history, }; JJShoutbox.getPosts(JJ_ShoutGetParams); }, <?php echo $refresh; ?>); <?php endif; ?> /* Delete oldest Shouts in Shoutbox */ setInterval(function() { if ($('#jjshoutboxoutput > div').length > (<?php echo $number; ?>+1)) { $('#jjshoutboxoutput > div:last-child').remove(); } },250);
Please Log in or Create an account to join the conversation.