1º Passo - Instalando o código JavaScript
Vamos começar #criando um novo #documento JavaScript. Como fazer isto
Título * : Contador de #usuários em #cada fórum SGBR™
Investimento : Em todas as #páginas
Código JavaScript * : Coloque o código a baixo
- Código:
$(function () {
/* TUTORIAL = http://staffergroupbr.stuning.net/t1529- */
('Display Viewing users for Forumotion by LGforum. Copyright (c) AvacWeb 2013. No distribution without consent. No use or modification without this entire copyright notice in the original or modified script.');
$.get('/viewonline', function (r) {
for (var rows = $('.forumbg tbody tr', r.substring(r.indexOf('<body'), r.indexOf('</body>'))), i = 0, datastore = {}, row;
(row = rows[i++]);) {
var cells = row.getElementsByTagName('td'),
uname = cells[0].innerHTML.replace(/<.*?>/g, ''),
link = cells[2].getElementsByTagName('a')[0];
if (link && link.href.match(/\/f[0-9]+-/)) {
var forum = link.href.match(/\/f[0-9]+-/)[0];
if (forum in datastore) {
datastore[forum].count++;
datastore[forum].users.push(uname);
} else {
datastore[forum] = {
count: 1,
users: [uname]
};
}
}
}
for (var j = 0, titles = $('#main-content .forumtitle'), t;
(t = titles[j++]);) {
var f = t.href.match(/\/f[0-9]+-/);
t.parentNode.innerHTML += (f && f in datastore) ? '<span class="LG-viewing" title="' + datastore[f].users.join(', ') + '">(' + datastore[f].count + ' Usuários)</span>' : '<span class="LG-viewing">(Nenhum Usuário)</span>';
}
});
});
- Resultado:
PRECISA DE SUPORTE?
Criador: LGForum / AvacWeb Site: http://staffergroupbr.stuning.net/t1529-exibir-visualizacoes-dos-foruns-phpbb3 |