Technical Details
Forum version : #ModernBB
Position : Founder
Concerned browser(s) : Google Chrome
Who the problem concerns : Yourself
When the problem appeared : census group don't working
Forum link : ( link is hidden, you must reply to see )
Description of problem
Hello, I have a problem with the census script I have placed in index_body and it is not counting people for me. I will give an example I have Yokai - 0, and I would like the number 0, to be 1 after the person added, etc. That is why I am asking for help.My forum is Modernbb
HTML:
- Code:
<div class="qeel-groups">
<a href="#">Ludzie <span id="census_Ludzie" class="censusValue"><span class="censusCount">0</span></span></a>
<a href="#">Pradawni <span id="census_Pradawni" class="censusValue"><span class="censusCount">0</span></span></a>
<a href="/g5-yokai">Yokai <span id="censusYokai" class="censusValue"><span class="censusCount">0</span></span></a>
<a href="#">Hanyou <span id="census_Hanyou" class="censusValue"><span class="censusCount">0</span></span></a>
<a href="#">Gobliny <span id="census_Gobliny" class="censusValue"><span class="censusCount">0</span></span></a>
<a href="#">Daishin <span id="census_Daishin" class="censusValue"><span class="censusCount">0</span></span></a>
<a href="#">Inne Istoty <span id="census_InneIstoty" class="censusValue"><span class="censusCount">0</span></span></a>
<a href="#">NPC <span id="census_NPC" class="censusValue"><span class="censusCount">0</span></span></a></div></div>
Javascript:
- Code:
<![CDATA[
(function() {
window._faCensus = {
title : 'Group census', // main title
// syntax : 'GROUP_NAME' : 'GROUP_ID'
groups : {
'Hanyou' : 6,
'Pradawni' : 2,
'Yokai' : 5,
'Ludzie' : 4,
'Daishin' : 3,
'Gobliny' : 7,
'Inne Istoty' : 8,
'NPC' : 13
},
// get group member count from AJAX or storage
getCount : function(id, callback) {
var count = 0, pages, storage = window.localStorage;
if (storage && storage['group_count_' + id] && storage['group_count_' + id + '_exp'] > +new Date - 1*60*60*1000) callback(storage['group_count_' + id]);
else jQuery.get('/g' + id + '-?change_version=prosilver', function(d) {
count = jQuery('.forumbg-table a[href^="/u"]', d).length;
pages = jQuery('.pagination span a:not(.pag-img):last', d);
if (pages[0]) {
pages = +jQuery(pages).text();
count = count * pages;
}
if (storage) {
storage['group_count_' + id] = count;
storage['group_count_' + id + '_exp'] = +new Date;
}
callback(count);
});
}
};
var census = document.createElement('DIV'),
node = document.getElementById('censusNode'),
i,
row;
census.id = 'faCensus';
census.innerHTML = '<div id="censusMainTitle">' + _faCensus.title + '</div>';
// set content
for (i in _faCensus.groups) {
row = document.createElement('DIV');
row.innerHTML = 'loading...';
row.className = 'censusRow';
_faCensus.getCount(_faCensus.groups[i], function(count) {
row.innerHTML = '<span class="censusTitle">' + i + '</span><span id="census_' + i.replace(/\s/g, '_') + '" class="censusValue"><span class="censusCount">' + count + '</span></span>';
});
census.appendChild(row); // add the row to the census
}
censusNode.appendChild(census); // append the census to the drop point
})();
// par ange tuteur
//]]>
please help me
Last edited by Amadeus on March 11th 2021, 4:43 am; edited 1 time in total