This is the complete bit of code from my header.tpl. Currently, it will only display the hidden JS pop up if there are new site updates AND you refresh the page. I'd like it to auto-refresh say every 30 or 45 seconds, perhaps sooner for a more "real time" feel to the site.
I'm still a JS noob, so any help would be most appreciated!
I'm still a JS noob, so any help would be most appreciated!
Code:
<div style='display: none;' id='newupdates_popup'>
<div style='margin-top: 10px;align:right;'>
{assign var="notifyscount" value=$notifys[0]|@count}
{lang_sprintf id=1199 1="<span id='notifyscount'>`$notifyscount`</span>"}
</div>
{section name=notify_loop loop=$notifys[0]}
<div style='font-weight: bold; padding-top: 5px;' id='notify_{$notifys[0][notify_loop].notifytype_id}_{$notifys[0][notify_loop].notify_grouped}'>
<a title='Remove Notification' style='color:#000000;' href='javascript:void(0);' onClick="parent.deleteNotify('{$notifys[0][notify_loop].notifytype_id}', '{$notifys[0][notify_loop].notify_grouped}');">X</a> <img src='./images/icons/{$notifys[0][notify_loop].notify_icon}' border='0' style='border: none; margin: 0px 5px 0px 5px; display: inline; vertical-align: middle;' class='icon'><a href="{$notifys[0][notify_loop].notify_url}">{lang_sprintf id=$notifys[0][notify_loop].notify_desc 1=$notifys[0][notify_loop].notify_total 2=$notifys[0][notify_loop].notify_text[0]}</a></div>
{/section}
</div>
</div>
{literal}
<script type='text/javascript'>
<!--
var se_show_newupdates = new Hash.Cookie('se_show_newupdates', {duration: 3600});
{/literal}{if $notifys[1] != 0}{literal}
window.addEvent('domready', function() {
if(se_show_newupdates.get('total') < {/literal}{$notifys[1]}{literal}) {
se_show_newupdates.set('total', '0');
$('newupdates').style.display='block';
}
});
{/literal}{/if}{literal}
var notify_count = {/literal}{$notifys[1]}{literal};
function deleteNotify(notifytype_id, notify_grouped) {
$('ajaxframe').src = 'misc_js.php?task=notify_delete¬ifytype_id='+notifytype_id+'¬ify_grouped='+notify_grouped;
}
function deleteNotifyConfirm(notifytype_id, notify_grouped) {
$("TB_window").getElements('div[id=notify_'+notifytype_id+'_'+notify_grouped+']').each(function(el) { if(el.id == 'notify_'+notifytype_id+'_'+notify_grouped) { el.style.display = 'none'; notify_count--; }});
$('newupdates_popup').getElements('div[id=notify_'+notifytype_id+'_'+notify_grouped+']').each(function(el) { if(el.id == 'notify_'+notifytype_id+'_'+notify_grouped) { el.style.display = 'none'; }});
$('notify_total').innerHTML = notify_count;
$("TB_window").getElements('span[id=notifyscount]').each(function(el) { if(el.id == 'notifyscount') { el.innerHTML = notify_count; }});
if(notify_count == 0) {
TB_remove();
$('newupdates').style.display = 'none';
}
}
function hideNewupdates() {
$('newupdates').fade('out');
se_show_newupdates.set('total', '{/literal}{$notifys[1]}{literal}');
}
function SwapOut(id1) {
$(id1).src = Rollarrow1.src;
return true;
}
function SwapBack(id1) {
$(id1).src = Rollarrow0.src;
return true;
}
//-->
</script>
{/literal}
{/if}