The forum of the forums
Welcome to the Official Support Forum of Forumotion!

To take full advantage of everything offered by our forum, please log in if you are already a member, or join our community if you've not yet.



Create a free forum like this one.

reputation system so it counts votes Issue.

View previous topic View next topic Go down

Solved reputation system so it counts votes Issue.

Post by smurfavr on August 21st 2015, 5:44 pm

@Ange Tuteur I use code from the link I gave, but by placing the cursor over the text does not appears.
http://help.forumotion.com/t142870-improve-the-reputation-system-so-it-counts-votes



Last edited by smurfavr on August 22nd 2015, 2:05 pm; edited 1 time in total

smurfavr
Active Poster

Male Posts : 1384
Reputation : 9
Language : Bulgarian

http://smurfa.bulgarianforum.net/

Back to top Go down

Solved Re: reputation system so it counts votes Issue.

Post by Ange Tuteur on August 21st 2015, 5:45 pm

Hi,

Could you provide a link to the topic on your forum ? It was developed mainly for English language, but it should work on others unless there's an inconsistency.

Thanks.

Ange Tuteur
Forumaster

Male Posts : 13021
Reputation : 2681
Language : EN10, FR5
Location : Pennsylvania

http://fmdesign.forumotion.com

Back to top Go down

Solved Re: reputation system so it counts votes Issue.

Post by smurfavr on August 21st 2015, 5:46 pm


smurfavr
Active Poster

Male Posts : 1384
Reputation : 9
Language : Bulgarian

http://smurfa.bulgarianforum.net/

Back to top Go down

Solved Re: reputation system so it counts votes Issue.

Post by Ange Tuteur on August 21st 2015, 6:41 pm

It appears to be working for me. I placed the cursor on the bar, text, and icon.


Depending on your browser you may need to keep the cursor over the element for a few seconds.

Ange Tuteur
Forumaster

Male Posts : 13021
Reputation : 2681
Language : EN10, FR5
Location : Pennsylvania

http://fmdesign.forumotion.com

Back to top Go down

Solved Re: reputation system so it counts votes Issue.

Post by smurfavr on August 21st 2015, 8:07 pm

On goglehrom not working. I put the mouse pointer 20 seconds and nothing appeared. With the Mozilla browser inscription shows.

smurfavr
Active Poster

Male Posts : 1384
Reputation : 9
Language : Bulgarian

http://smurfa.bulgarianforum.net/

Back to top Go down

Solved Re: reputation system so it counts votes Issue.

Post by Klemen on August 21st 2015, 8:12 pm

It works fine for me on Firefox as well as Google Chrome, if that helps.

Klemen
Forumember

Male Posts : 292
Reputation : 32
Language : English, German, Slovene

http://www.bannedbrotherhood.com

Back to top Go down

Solved Re: reputation system so it counts votes Issue.

Post by smurfavr on August 21st 2015, 8:53 pm

With me not working Google Chrome.How to fix it?

smurfavr
Active Poster

Male Posts : 1384
Reputation : 9
Language : Bulgarian

http://smurfa.bulgarianforum.net/

Back to top Go down

Solved Re: reputation system so it counts votes Issue.

Post by SLGray on August 21st 2015, 9:00 pm

Try this:  Clear your browser's cache and history.  Also make sure that Chrome is up to date.


When your topic has been solved, ensure you mark the topic solved.
Never post your email in public.


SLGray
Administrator
Administrator

Male Posts : 35608
Reputation : 2372
Language : English
Location : United States

http://fmthemes.forumotion.com/

Back to top Go down

Solved Re: reputation system so it counts votes Issue.

Post by smurfavr on August 21st 2015, 9:16 pm

@SLGray wrote:Try this:  Clear your browser's cache and history.  Also make sure that Chrome is up to date.
I did everything but the problem is not fine.


psp
How to do it. They can give an example?
There are also similar titles for grammar; singular for 1 vote and plural for multiple votes.

smurfavr
Active Poster

Male Posts : 1384
Reputation : 9
Language : Bulgarian

http://smurfa.bulgarianforum.net/

Back to top Go down

Solved Re: reputation system so it counts votes Issue.

Post by Ange Tuteur on August 22nd 2015, 10:45 am

It might be a problem related to Chrome itself. I can't find any definitive answers, but this is the closest to it.
https://code.google.com/p/chromium/issues/detail?id=389380

There are also similar titles for grammar; singular for 1 vote and plural for multiple votes.
Those are already in the script :
Code:
    title_like_singular : '%{VOTES} person likes %{USERNAME}\'s post',
    title_like_plural : '%{VOTES} people like %{USERNAME}\'s post',

They're denoted by "singular" and "plural," and simply change based on the votes. If there's only 1 vote the singular title is used, if there's more than 1 the plural title is used.

Ange Tuteur
Forumaster

Male Posts : 13021
Reputation : 2681
Language : EN10, FR5
Location : Pennsylvania

http://fmdesign.forumotion.com

Back to top Go down

Solved Re: reputation system so it counts votes Issue.

Post by smurfavr on August 22nd 2015, 11:07 am

I can not figure out exactly how to do it.You can make my code.

Code:
$(function() {
  // General Configuration of the plugin
  var config = {
    position_left : true, // true for left || false for right
    negative_vote : true, // true for negative votes || false for positive only
    vote_bar : true, // display a small bar under the vote buttons
   
    // button config
    icon_plus : '<img src="http://i18.servimg.com/u/f18/18/21/41/30/plus10.png" alt="+"/>',
    icon_minus : '<img src="http://i18.servimg.com/u/f18/18/21/41/30/minus10.png" alt="-"/>',
   
    // language config
    title_plus : 'Харесай поста на %{USERNAME}\'',
    title_minus : 'Не харесвам поста на %{USERNAME}\'',
   
    title_like_singular : '%{VOTES} харесва(т) поста на %{USERNAME}\'',
    title_like_plural : '%{VOTES} харесва(т) поста на %{USERNAME}\'',
   
    title_dislike_singular : '%{VOTES} не харесва(т) поста на %{USERNAME}\'',
    title_dislike_plural : '%{VOTES} не харесва(т) поста на %{USERNAME}\'',
   
    title_vote_bar : '%{VOTES} души харесаха поста на %{USERNAME}\ %{PERCENT}'
  },
     
     
  // function bound to the onclick handler of the vote buttons
  submit_vote = function() {
    var next = this.nextSibling, // the counter next to the vote button that was clicked
        box = this.parentNode,
        bar = box.getElementsByTagName('DIV'),
        vote = box.getElementsByTagName('A'),
        mode = /eval=plus/.test(this.href) ? 1 : 0,
        i = 0, j = vote.length, pos, neg, percent;
   
    // submit the vote asynchronously
    $.get(this.href, function() {
      next.innerHTML = +next.innerHTML + 1; // add to the vote count
      next.title = next.title.replace(/(\d+)/, function(M, $1) { return +$1 + 1 });
     
      pos = +vote[0].nextSibling.innerHTML;
      neg = vote[1] ? +vote[1].nextSibling.innerHTML : 0;
      percent = pos == 0 ? '0%' : pos == neg ? '50%' : Math.round(pos / (pos + neg) * 100) + '%';
     
      if (bar[0]) {
        bar[0].style.display = '';
        bar[0].firstChild.style.width = percent;
        box.title = box.title.replace(/\d+\/\d+/, pos + '/' + ( pos + neg )).replace(/\(\d+%\)/, '(' + percent + ')');
      }
    });
   
    // revoke voting capabilities on the post once the vote is cast
    for (; i < j; i++) {
      vote[i].href = '#';
      vote[i].className = vote[i].className.replace(/fa_vote/, 'fa_voted');
      vote[i].onclick = function() { return false };
    }
   
    return false;
  },
     
  vote = $('.vote'), i = 0, j = vote.length,
  version = $('.bodylinewidth')[0] ? 0 : document.getElementById('wrap') ? 1 : $('.pun')[0] ? 2 : document.getElementById('ipbwrapper') ? 3 : 'badapple', // version check
 
  // version data so we don't have to redefine these arrays during the loop
  vdata = {
    tag : ['SPAN', 'LI', 'SPAN', 'LI'][version],
    name : ['.name', '.postprofile dt > strong', '.username', '.popmenubutton'][version],
    actions : ['.post-options', '.profile-icons', '.post-options', '.posting-icons'][version],
  },
 
  post, plus, minus, n_pos, n_neg, title_pos, title_neg, li, ul, bar, button, total, percent, span, pseudo, vote_bar; // startup variables for later use in the loop
 
  // prevent execution if the version cannot be determined
  if (version == 'badapple') {
    if (window.console) console.warn('This plugin is not optimized for your forum version. Please contact the support for further assistance.');
    return;
  }
 
  for (; i < j; i++) {
    post = $(vote[i]).parentsUntil('.post').parent()[0];
    bar = $('.vote-bar', vote[i])[0]; // vote bar
    button = $('.vote-button', vote[i]); // plus and minus buttons
    pseudo = $(vdata.name, post).text() || 'MISSING_STRING'; // username of the poster
    ul = $(vdata.actions, post)[0]; // post actions
    li = document.createElement(vdata.tag); // vote system container
    li.className = 'fa_reputation';
   
    if (li.tagName == 'SPAN') li.style.display = 'inline-block';
   
    // calculate votes
    if (bar) {
      total = +bar.title.replace(/.*?\((\d+).*/, '$1');
      percent = +bar.title.replace(/.*?(\d+)%.*/, '$1');
     
      n_pos = Math.round(total * (percent / 100));
      n_neg = total - n_pos;
    } else {
      n_pos = 0;
      n_neg = 0;
    }
   
    // set up negative and positive titles with the correct grammar, votes, and usernames
    title_pos = (n_pos == 1 ? config.title_like_singular : config.title_like_plural).replace(/%\{USERNAME\}/g, pseudo).replace(/%\{VOTES\}/g, n_pos);
    title_neg = (n_neg == 1 ? config.title_dislike_singular : config.title_dislike_plural).replace(/%\{USERNAME\}/g, pseudo).replace(/%\{VOTES\}/g, n_neg);
   
    // define the vote counts
    li.innerHTML = '<span class="fa_count fa_positive" title="' + title_pos + '">' + n_pos + '</span>' + (config.negative_vote ? '&nbsp;<span class="fa_count fa_negative" title="' + title_neg + '">' + n_neg + '</span>' : '');
    span = li.getElementsByTagName('SPAN'); // get the vote count containers for use as insertion points
   
    // create positive vote button
    plus = document.createElement('A');
    plus.href = button[0] ? button[0].firstChild.href : '#';
    plus.onclick = button[0] ? submit_vote : function() { return false };
    plus.className = 'fa_vote' + (button[0] ? '' : 'd') + ' fa_plus';
    plus.innerHTML = config.icon_plus;
    plus.title = (button[0] ? config.title_plus : title_pos).replace(/%\{USERNAME\}/g, pseudo);
   
    span[0] && li.insertBefore(plus, span[0]);
   
    // create negative vote button
    if (config.negative_vote) {
      minus = document.createElement('A');
      minus.href = button[1] ? button[1].firstChild.href : '#';
      minus.onclick = button[1] ? submit_vote : function() { return false };
      minus.className = 'fa_vote' + (button[1] ? '' : 'd') + ' fa_minus';
      minus.innerHTML = config.icon_minus;
      minus.title = (button[1] ? config.title_minus : title_neg).replace(/%\{USERNAME\}/g, pseudo);
     
      span[1] && li.insertBefore(minus, span[1]);
    }
   
    // create vote bar
    if (config.vote_bar) {
      vote_bar = document.createElement('DIV');
      vote_bar.className = 'fa_votebar';
      vote_bar.innerHTML = '<div class="fa_votebar_inner" style="width:' + percent + '%;"></div>';
      vote_bar.style.display = bar ? '' : 'none';
      li.title = config.title_vote_bar.replace(/%\{USERNAME\}/, pseudo).replace(/%\{VOTES\}/, n_pos + '/' + (n_pos + n_neg)).replace(/%\{PERCENT\}/, '(' + percent + '%)');
      li.appendChild(vote_bar);
    }
   
    // finally insert the vote system and remove the default one
    config.position_left ? ul.insertBefore(li, ul.firstChild) : ul.appendChild(li);
    vote[i].parentNode.removeChild(vote[i]);
  }
});

smurfavr
Active Poster

Male Posts : 1384
Reputation : 9
Language : Bulgarian

http://smurfa.bulgarianforum.net/

Back to top Go down

Solved Re: reputation system so it counts votes Issue.

Post by Ange Tuteur on August 22nd 2015, 12:15 pm

It's already in the code. All you would need to do is edit the texts, which you already have. Smile

Ange Tuteur
Forumaster

Male Posts : 13021
Reputation : 2681
Language : EN10, FR5
Location : Pennsylvania

http://fmdesign.forumotion.com

Back to top Go down

Solved Re: reputation system so it counts votes Issue.

Post by smurfavr on August 22nd 2015, 2:05 pm

Thank you  Ange Tuteur. It only remains to find a solution to the problem googlehrom.

smurfavr
Active Poster

Male Posts : 1384
Reputation : 9
Language : Bulgarian

http://smurfa.bulgarianforum.net/

Back to top Go down

Solved Re: reputation system so it counts votes Issue.

Post by APE on August 22nd 2015, 7:28 pm

Topic solved and archived





APE
Manager
Manager

Male Posts : 8309
Reputation : 716
Language : fluent in dork / mumbojumbo & English haha
Location : STUCK IN FORUMOTIONS SERVERS HELP ME !!!!!!

http://chatworld.forumotion.co.uk/

Back to top Go down

View previous topic View next topic Back to top


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