Census group don't working

3 posters

Go down

Solved Census group don't working

Post by Amadeus March 9th 2021, 6:29 pm

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
Amadeus
Amadeus
Forumember

Female Posts : 157
Reputation : 1
Language : Polish, English
Location : Poland

View user profile

Back to top Go down

Solved Re: Census group don't working

Post by skouliki March 9th 2021, 6:57 pm

hello

where did you find this code ?
skouliki
skouliki
Manager
Manager

Female Posts : 11671
Reputation : 1462
Language : English,Greek
Location : Greece

View user profile http://iconskouliki.forumgreek.com

Back to top Go down

Solved Re: Census group don't working

Post by Amadeus March 9th 2021, 7:20 pm

Amadeus
Amadeus
Forumember

Female Posts : 157
Reputation : 1
Language : Polish, English
Location : Poland

View user profile

Back to top Go down

Solved Re: Census group don't working

Post by Ape March 9th 2021, 8:47 pm

The reason it is not working is the forum version is not the same and the code is looking for parts that don't exist on your forum version or if it does it's not named the same.


Census group don't working Left1212Census group don't working Center11Census group don't working Right112
Census group don't working Ape_b110
Census group don't working Keep_s10
Census group don't working Ape1010
Ape
Ape
Administrator
Administrator

Male Posts : 17218
Reputation : 1856
Language : fluent in dork / mumbojumbo & English haha

View user profile http://chatworld.forumotion.co.uk/

Back to top Go down

Solved Re: Census group don't working

Post by Amadeus March 9th 2021, 10:28 pm

@Ape wrote:The reason it is not working is the forum version is not the same and the code is looking for parts that don't exist on your forum version or if it does it's not named the same.

What I know, the person who modified it so much on my forum that he does not charge it at all. Can you help me please to make it work for me on modernbb please? Sad
Amadeus
Amadeus
Forumember

Female Posts : 157
Reputation : 1
Language : Polish, English
Location : Poland

View user profile

Back to top Go down

Solved Re: Census group don't working

Post by Ape March 10th 2021, 5:01 pm

Sadly I am not a coder so I would not know where to start you maybe better off tagging the one who made the code in hope they will help.


Census group don't working Left1212Census group don't working Center11Census group don't working Right112
Census group don't working Ape_b110
Census group don't working Keep_s10
Census group don't working Ape1010
Ape
Ape
Administrator
Administrator

Male Posts : 17218
Reputation : 1856
Language : fluent in dork / mumbojumbo & English haha

View user profile http://chatworld.forumotion.co.uk/

Back to top Go down

Solved Re: Census group don't working

Post by Amadeus March 11th 2021, 4:43 am

@Ape wrote:Sadly I am not a coder so I would not know where to start you maybe better off tagging the one who made the code in hope they will help.

After a few attempts I've grasped javascript and everything works as it should. The topic can be closed.
Amadeus
Amadeus
Forumember

Female Posts : 157
Reputation : 1
Language : Polish, English
Location : Poland

View user profile

Back to top Go down

Solved Re: Census group don't working

Post by skouliki March 11th 2021, 9:31 am

Problem solved & topic archived.
Please read our forum rules: ESF General Rules
skouliki
skouliki
Manager
Manager

Female Posts : 11671
Reputation : 1462
Language : English,Greek
Location : Greece

View user profile http://iconskouliki.forumgreek.com

Back to top Go down

Back to top


 
Permissions in this forum:
You cannot reply to topics in this forum