Reputation limits - [Tutorial] Reputation Levels Hitskin_logo Hitskin.com

This is a Hitskin.com skin preview
Install the skinReturn to the skin page

The forum of the forums
Would you like to react to this message? Create an account in a few clicks or log in to continue.
4 posters

    [Tutorial] Reputation Levels

    Daemon
    Daemon
    Forumember


    Posts : 104
    Reputation : 91
    Language : Português

    Reputation limits - [Tutorial] Reputation Levels Empty [Tutorial] Reputation Levels

    Post by Daemon Thu 20 Jul 2017 - 6:59

    With this code you can customize the reputation profile by adding levels according to the reputation number.

    Reputation limits - [Tutorial] Reputation Levels Sem_ty10

    Create a new JavaScript code with the following content (The placement "In topics" only):
    Code:
    /*
     *  Application: Reputation Levels
     *  Date: 14/06/2018
     *  Version: 2.014062018
     *  Copyright (c) 2018 Daemon <help.forumotion.com>
     *  This work is free. You can redistribute it and/or modify it
     */
    function bs_reputation_ipb() {
     
    /*
     * Configure below the levels for the reputation profile,
     * with the respective number needed to win it.
     * You can also add a class to customize the element.
     */
     
    var reputation = [
        {
          reputation: 0,
          level: "Neutral",
          class: "zero"
        },
        {
          reputation: 1,
          level: "Beginner"
        },
        {
          reputation: 10,
          level: "Regular"
        },
        {
          reputation: 20,
          level: "Good"
        },
        {
          reputation: 35,
          level: "Great"
        },
        {
          reputation: 50,
          level: "Excellent",
          class: "awesome"
        }
    ];
     
    /*
     * No need to change anything from here down
     */

        var post = $(".post"),
            level = "",
            repClass = "",
            BreakException = {};

        $.ajax({
            url: post.first().find("a[href^='/u']").attr("href"),
            type: "GET",
            success: function(data) {
                var fieldName = $("#field_id-14", data).find("dt").text().split(" ")[0],
                    regExp = RegExp("<span[^>]*>(?:<span[^>]*>)?(" + fieldName + ")(?:<\\/span>)?\\s:\\s<\\/span>\\s*(\\d+)", "g");
                $.each($(".post"), function(idx) {
                    $(this).html(
                        $(this).html()
                        .replace(regExp, "<div class='reputation-bs'>$1 : $2<br><span class='title' style='font-weight:normal'></span></div>")
                    );
                    var repDiv = $(".reputation-bs", this),
                        fieldValue = repDiv.text().match(/\d+/);
                    try {
                        $.each(reputation, function(i, item) {
                            if (item.reputation <= fieldValue) {
                                level = (item.level) ? item.level : "",
                                repClass = (item.class) ? item.class : "";
                            } else {
                                throw BreakException;
                            }
                        });
                    } catch (e) {
                        if (e !== BreakException) throw e;
                    }
                    repDiv.addClass(repClass).find(".title").text(level);
                });
            },
            error: function(jqXHR, textStatus, errorThrown) {
                console.log(textStatus, errorThrown);
            }
        });
     
    };
    $(function() {
        bs_reputation_ipb();
    });
    Add the following in your css stylesheet:
    Code:
    .reputation-bs {
      background-color: #DFF0D8;
      font-weight: bold;
      padding: 3px 8px;
      display: block !important;
      -moz-border-radius: 3px;
      -webkit-border-radius: 3px;
      border-radius: 3px;
      color: #3C763D;
      margin: 5px auto;
      font-family: Lato,Arial,Helvetica,sans-serif;
      font-size: 13px;
      margin-bottom: 5px;
      max-width: 123px;
      text-align: center;
    }
    .reputation-bs.zero {
      background: none repeat scroll 0% 0% rgba(222, 222, 222, 0.34);
      color: #6e6e6e;
    }
    The instructions are inside the code.
    Wink


    Last edited by Daemon on Mon 25 Jun 2018 - 20:03; edited 15 times in total
    Daemon
    Daemon
    Forumember


    Posts : 104
    Reputation : 91
    Language : Português

    Reputation limits - [Tutorial] Reputation Levels Empty Re: [Tutorial] Reputation Levels

    Post by Daemon Thu 20 Jul 2017 - 17:37

    I made a small change to the current code. :p
    TonnyKamper
    TonnyKamper
    Active Poster


    Female Posts : 1094
    Reputation : 80
    Language : Dutch/English
    Location : DSF Admin

    Reputation limits - [Tutorial] Reputation Levels Empty Re: [Tutorial] Reputation Levels

    Post by TonnyKamper Thu 20 Jul 2017 - 18:02

    Awesome @Deamon thank you Yes
    SLGray
    SLGray
    Administrator
    Administrator


    Male Posts : 51554
    Reputation : 3523
    Language : English
    Location : United States

    Reputation limits - [Tutorial] Reputation Levels Empty Re: [Tutorial] Reputation Levels

    Post by SLGray Thu 20 Jul 2017 - 18:09

    You need to state where the placement is for the JavaScripts in your tutorials.



    Reputation limits - [Tutorial] Reputation Levels Slgray10

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


    Posts : 104
    Reputation : 91
    Language : Português

    Reputation limits - [Tutorial] Reputation Levels Empty Re: [Tutorial] Reputation Levels

    Post by Daemon Thu 20 Jul 2017 - 18:24

    SLGray wrote:You need to state where the placement is for the JavaScripts in your tutorials.

    Done! I made another small change.
    smurfavr
    smurfavr
    Active Poster


    Male Posts : 1881
    Reputation : 22
    Language : Bulgarian

    Reputation limits - [Tutorial] Reputation Levels Empty Re: [Tutorial] Reputation Levels

    Post by smurfavr Sun 23 Jul 2017 - 16:51

    Should I remove the old code I use?

    Code:
    $(document).ready(function() {
                   
                      var version = 'phpBB2';
                   
                      var settings = {
                          repName : 'Reputation',
                          repStyle : 'block',
                          repImage : 'http://i57.servimg.com/u/f57/18/21/41/30/star12.png'
                        };
                   
                      var repLv = {
                          lv1 : 1,
                          lv2 : 20,
                          lv3 : 30,
                          lv4 : 40,
                          lv5 : 50,
                          lv6 : 60,
                          lv7 : 70,
                          lv8 : 80,
                          lv9 : 90,
                          lv10 : 200
                        };
                   
                      if (settings.repStyle.toLowerCase() == 'block') { var repBlock = '<span id="rLv" class="repuBlock">' }
                        else if (settings.repStyle.toLowerCase() == 'image') { var repBlock = '<img id="rLv" src="'+settings.repImage+'"/>' }
                        else { var repBlock = '<span id="rLv" class="repuBlock">' }
                        var ver = { phpbb2 : version.toLowerCase() == 'phpbb2', phpbb3 : version.toLowerCase() == 'phpbb3', punbb : version.toLowerCase() == 'punbb', invision : version.toLowerCase() == 'invision', modernbb : version.toLowerCase() == 'modernbb' };
                        var reg = new RegExp('.*'+settings.repName+'\\s+:\\s+(\\d+).*');
                   
                      if (ver.phpbb3 || ver.punbb || ver.invision || ver.modernbb) {
                          if (ver.phpbb3 || ver.invision || ver.modernbb) { var profSel = '.postprofile'; var addRepu = $(this).find('dt').append('<div id="repu">'); }
                          else if (ver.punbb) { var profSel = '.user'; var addRepu = $(this).find('.user-ident').prepend('<div id="repu">'); }
                          $(profSel).each(function() {
                              var rep = Number($(this).text().replace(reg,'$1'));
                              addRepu;
                              if (rep >= repLv.lv1) { $(this).find('#repu').append(repBlock); var next = rep + '/' + repLv.lv2 }
                              if (rep >= repLv.lv2) { $(this).find('#repu').append(repBlock); var next = rep + '/' + repLv.lv3 }
                              if (rep >= repLv.lv3) { $(this).find('#repu').append(repBlock); var next = rep + '/' + repLv.lv4 }
                              if (rep >= repLv.lv4) { $(this).find('#repu').append(repBlock); var next = rep + '/' + repLv.lv5 }
                              if (rep >= repLv.lv5) { $(this).find('#repu').append(repBlock); var next = rep + '/' + repLv.lv6 }
                              if (rep >= repLv.lv6) { $(this).find('#repu').append(repBlock); var next = rep + '/' + repLv.lv7 }
                              if (rep >= repLv.lv7) { $(this).find('#repu').append(repBlock); var next = rep + '/' + repLv.lv8 }
                              if (rep >= repLv.lv8) { $(this).find('#repu').append(repBlock); var next = rep + '/' + repLv.lv9 }
                              if (rep >= repLv.lv9) { $(this).find('#repu').append(repBlock); var next = rep + '/' + repLv.lv10 }
                              if (rep >= repLv.lv10) { $(this).find('#repu').append(repBlock); var next = 'MAX' }
                              $(this).find('#repu').attr('title','Reputation level' + $(this).find('#rLv').length + '\nNext : (' + next + ')');
                          });
                        }
                        else if (ver.phpbb2) {
                          $('td .postdetails.poster-profile').each(function() {
                              var rep = Number($(this).text().replace(reg,'$1'));
                              $(this).parent().find('.name').next().after('<div id="repu">');
                              if (rep >= repLv.lv1) { $(this).parent().find('#repu').append(repBlock); var next = rep + '/' + repLv.lv2  }
                              if (rep >= repLv.lv2) { $(this).parent().find('#repu').append(repBlock); var next = rep + '/' + repLv.lv3  }
                              if (rep >= repLv.lv3) { $(this).parent().find('#repu').append(repBlock); var next = rep + '/' + repLv.lv4  }
    if (rep >= repLv.lv4) { $(this).parent().find('#repu').append(repBlock); var next = rep + '/' + repLv.lv5  }
                              if (rep >= repLv.lv5) { $(this).parent().find('#repu').append(repBlock); var next = rep + '/' + repLv.lv6  }
                              if (rep >= repLv.lv6) { $(this).parent().find('#repu').append(repBlock); var next = rep + '/' + repLv.lv7  }
                              if (rep >= repLv.lv7) { $(this).parent().find('#repu').append(repBlock); var next = rep + '/' + repLv.lv8  }
                              if (rep >= repLv.lv8) { $(this).parent().find('#repu').append(repBlock); var next = rep + '/' + repLv.lv9  }
                              if (rep >= repLv.lv9) { $(this).parent().find('#repu').append(repBlock); var next = rep + '/' + repLv.lv10  }
                              if (rep >= repLv.lv10) { $(this).parent().find('#repu').append(repBlock); var next = 'MAX'  }
                              $(this).parent().find('#repu').attr('title','Ниво на репутация ' + $(this).parent().find('#rLv').length  + '\nСледващo ниво: (' + next + ')');
                          });
                        }
                    });
    Daemon
    Daemon
    Forumember


    Posts : 104
    Reputation : 91
    Language : Português

    Reputation limits - [Tutorial] Reputation Levels Empty Re: [Tutorial] Reputation Levels

    Post by Daemon Sun 23 Jul 2017 - 17:52

    These codes are different. The effect of the result is on the image in the topic.
    smurfavr
    smurfavr
    Active Poster


    Male Posts : 1881
    Reputation : 22
    Language : Bulgarian

    Reputation limits - [Tutorial] Reputation Levels Empty Re: [Tutorial] Reputation Levels

    Post by smurfavr Sun 23 Jul 2017 - 18:29

    I AM YOUR CODE, BUT Nothing Happens? Here's a link to my test forum.

    http://vracatestforum.bulgarianforum.net/t18-topic
    Daemon
    Daemon
    Forumember


    Posts : 104
    Reputation : 91
    Language : Português

    Reputation limits - [Tutorial] Reputation Levels Empty Re: [Tutorial] Reputation Levels

    Post by Daemon Sun 23 Jul 2017 - 19:06

    Try that:
    Code:
    /*
     *  Application: Reputation Levels
     *  Date: 19/05/2017
     *  Version: 1.219072017
     *  Copyright (c) 2017 Daemon <help.forumotion.com>
     *  This work is free. You can redistribute it and/or modify it
     */
    function bs_reputation_ipb() {

    /*
     * Configure below the levels for the reputation profile,
     * with the respective number needed to win it.
     * You can also add a class to customize the element.
     */
     
    var arrConfig = [
        {
          reputation: 0,
          level: "Neutral",
          class: "zero"
        },
        {
          reputation: 1,
          level: "Beginner"
        },
        {
          reputation: 10,
          level: "Regular"
        },
        {
          reputation: 20,
          level: "Good"
        },
        {
          reputation: 35,
          level: "Great"
        },
        {
          reputation: 50,
          level: "Excellent",
          class: "awesome"
        }
    ];

    /*
     * No need to change anything from here down
     */

    var userLink, repField, repFieldName, repFieldValue, regExp, level, repClass;
    var BreakException = {};
    jQuery.each(jQuery(".post"), function(i, val) {
        var thisPost = jQuery(val);
        userLink = thisPost.find("a[href^='/u']").attr("href");
        jQuery.ajax({
            type: "GET",
            url: userLink,
            success: function(data) {
                repField = jQuery("#field_id-14", data);
                repFieldName = repField.find("dt").text().split(" ")[0];
                repFieldValue = parseInt(repField.find("dd").text());
                regExp = new RegExp("(<span class=\"label\">(?:<span style=\"[^\"]*\">)?" + repFieldName + "(?:<\\/span>)?\\s:\\s<\\/span>\\s\\d+)", "g");
                try {
                    jQuery.each(arrConfig, function(i, val) {
                        if (val.reputation <= repFieldValue) {
                            level = (val.level) ? val.level : "";
                            repClass = (val.class) ? " " + val.class : "";
                        } else {
                            throw BreakException;
                        }
                    });
                } catch (e) {
                    if (e !== BreakException) throw e;
                }
                thisPost.find(".label").parent().html(function(i, val) {
                    return val.replace(regExp, "<div class='reputation_bs" + repClass + "'>$1<br><span class='title' style='font-weight:normal'>" + level + "</span></div>");
                });
            },
            error: function(jqXHR, textStatus, errorThrown) {
                console.log("**An error occurred while trying to request the data");
            }
        });
    });
     
    };
    jQuery(function() {
        bs_reputation_ipb();
    });
    Smile
    smurfavr
    smurfavr
    Active Poster


    Male Posts : 1881
    Reputation : 22
    Language : Bulgarian

    Reputation limits - [Tutorial] Reputation Levels Empty Re: [Tutorial] Reputation Levels

    Post by smurfavr Sun 23 Jul 2017 - 19:57

    Now it works. Can you increase the reputation to 100?

    Code:
    /*
     *  Application: Reputation Levels
     *  Date: 19/05/2017
     *  Version: 1.219072017
     *  Copyright (c) 2017 Daemon <help.forumotion.com>
     *  This work is free. You can redistribute it and/or modify it
     */
    function bs_reputation_ipb() {
     
    /*
     * Configure below the levels for the reputation profile,
     * with the respective number needed to win it.
     * You can also add a class to customize the element.
     */
     
    var arrConfig = [
        {
          reputation: 0,
          level: "Neutral",
          class: "Потребител"
        },
        {
          reputation: 1,
          level: "Начинаещ"
        },
        {
          reputation: 10,
          level: "Редовен потребител"
        },
        {
          reputation: 20,
          level: "Фен"
        },
        {
          reputation: 35,
          level: "Напредващ"
        },
        {
          reputation: 50,
          level: "HL маняк",
          class: "awesome"
        }
    ];
     
    /*
     * No need to change anything from here down
     */
     
    var userLink, repField, repFieldName, repFieldValue, regExp, level, repClass;
    var BreakException = {};
    jQuery.each(jQuery(".post"), function(i, val) {
        var thisPost = jQuery(val);
        userLink = thisPost.find("a[href^='/u']").attr("href");
        jQuery.ajax({
            type: "GET",
            url: userLink,
            success: function(data) {
                repField = jQuery("#field_id-14", data);
                repFieldName = repField.find("dt").text().split(" ")[0];
                repFieldValue = parseInt(repField.find("dd").text());
                regExp = new RegExp("(<span class=\"label\">(?:<span style=\"[^\"]*\">)?" + repFieldName + "(?:<\\/span>)?\\s:\\s<\\/span>\\s\\d+)", "g");
                try {
                    jQuery.each(arrConfig, function(i, val) {
                        if (val.reputation <= repFieldValue) {
                            level = (val.level) ? val.level : "";
                            repClass = (val.class) ? " " + val.class : "";
                        } else {
                            throw BreakException;
                        }
                    });
                } catch (e) {
                    if (e !== BreakException) throw e;
                }
                thisPost.find(".label").parent().html(function(i, val) {
                    return val.replace(regExp, "<div class='reputation_bs" + repClass + "'>$1<br><span class='title' style='font-weight:normal'>" + level + "</span></div>");
                });
            },
            error: function(jqXHR, textStatus, errorThrown) {
                console.log("**An error occurred while trying to request the data");
            }
        });
    });
     
    };
    jQuery(function() {
        bs_reputation_ipb();
    });

    reputation: 65

    reputation: 75

    reputation: 90

    reputation: 100
    Daemon
    Daemon
    Forumember


    Posts : 104
    Reputation : 91
    Language : Português

    Reputation limits - [Tutorial] Reputation Levels Empty Re: [Tutorial] Reputation Levels

    Post by Daemon Sun 23 Jul 2017 - 22:53

    See how the structure works:
    Code:
      {
          reputation: 0,
          level: "Neutral",
          class: "zero"
        },
        {
          reputation: 1,
          level: "Beginner"
        },
        {
          reputation: 10,
          level: "Regular"
        },
        {
          reputation: 20,
          level: "Good"
        },
        {
          reputation: 35,
          level: "Great"
        },
        {
          reputation: 50,
          level: "Excellent",
          class: "awesome"
        }
    Each new entry starts with this -> '{' and ends with this -> '}'. Always with a comma at the end, except for the last entry.

    Reputation: equals the required number of reputations to reach the level.
    Level: The name of the level equivalent to the number of reputations.
    Class: add an optional class to customize the reputation element.
    smurfavr
    smurfavr
    Active Poster


    Male Posts : 1881
    Reputation : 22
    Language : Bulgarian

    Reputation limits - [Tutorial] Reputation Levels Empty Re: [Tutorial] Reputation Levels

    Post by smurfavr Sun 23 Jul 2017 - 23:40

    Can you do that code from my previous post? I will not be able to do it because I do not understand English well.

    Where can I change the caption from the photo?
    Reputation limits - [Tutorial] Reputation Levels AsaJPGYEkFa1a
    smurfavr
    smurfavr
    Active Poster


    Male Posts : 1881
    Reputation : 22
    Language : Bulgarian

    Reputation limits - [Tutorial] Reputation Levels Empty Re: [Tutorial] Reputation Levels

    Post by smurfavr Wed 26 Jul 2017 - 19:59

    smurfavr wrote:Can you do that code from my previous post? I will not be able to do it because I do not understand English well.

    Where can I change the caption from the photo?
    Reputation limits - [Tutorial] Reputation Levels AsaJPGYEkFa1a

    up
    SLGray
    SLGray
    Administrator
    Administrator


    Male Posts : 51554
    Reputation : 3523
    Language : English
    Location : United States

    Reputation limits - [Tutorial] Reputation Levels Empty Re: [Tutorial] Reputation Levels

    Post by SLGray Wed 26 Jul 2017 - 20:27

    Daemon wrote:See how the structure works:
    Code:
      {
          reputation: 0,
          level: "Neutral",
          class: "zero"
        },
        {
          reputation: 1,
          level: "Beginner"
        },
        {
          reputation: 10,
          level: "Regular"
        },
        {
          reputation: 20,
          level: "Good"
        },
        {
          reputation: 35,
          level: "Great"
        },
        {
          reputation: 50,
          level: "Excellent",
          class: "awesome"
        }
    Each new entry starts with this -> '{' and ends with this -> '}'. Always with a comma at the end, except for the last entry.

    Reputation: equals the required number of reputations to reach the level.
    Level: The name of the level equivalent to the number of reputations.
    Class: add an optional class to customize the reputation element.



    Reputation limits - [Tutorial] Reputation Levels Slgray10

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


    Male Posts : 1881
    Reputation : 22
    Language : Bulgarian

    Reputation limits - [Tutorial] Reputation Levels Empty Re: [Tutorial] Reputation Levels

    Post by smurfavr Wed 26 Jul 2017 - 22:04

    smurfavr wrote:I will not be able to do it because I do not understand English well.
    SLGray
    SLGray
    Administrator
    Administrator


    Male Posts : 51554
    Reputation : 3523
    Language : English
    Location : United States

    Reputation limits - [Tutorial] Reputation Levels Empty Re: [Tutorial] Reputation Levels

    Post by SLGray Thu 27 Jul 2017 - 3:07

    Do not Google translate well enough for you to understand what to do?



    Reputation limits - [Tutorial] Reputation Levels Slgray10

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


    Male Posts : 1881
    Reputation : 22
    Language : Bulgarian

    Reputation limits - [Tutorial] Reputation Levels Empty Re: [Tutorial] Reputation Levels

    Post by smurfavr Thu 27 Jul 2017 - 10:57

    SLGray wrote:Do not Google translate well enough for you to understand what to do?
    Yes.
    smurfavr
    smurfavr
    Active Poster


    Male Posts : 1881
    Reputation : 22
    Language : Bulgarian

    Reputation limits - [Tutorial] Reputation Levels Empty Re: [Tutorial] Reputation Levels

    Post by smurfavr Sat 29 Jul 2017 - 11:15

    smurfavr wrote:
    smurfavr wrote:Can you do that code from my previous post? I will not be able to do it because I do not understand English well.

    Where can I change the caption from the photo?
    Reputation limits - [Tutorial] Reputation Levels AsaJPGYEkFa1a

    up
    smurfavr
    smurfavr
    Active Poster


    Male Posts : 1881
    Reputation : 22
    Language : Bulgarian

    Reputation limits - [Tutorial] Reputation Levels Empty Re: [Tutorial] Reputation Levels

    Post by smurfavr Sun 6 Aug 2017 - 13:21

    smurfavr wrote:
    smurfavr wrote:
    smurfavr wrote:Can you do that code from my previous post? I will not be able to do it because I do not understand English well.

    Where can I change the caption from the photo?
    Reputation limits - [Tutorial] Reputation Levels AsaJPGYEkFa1a

    up
    avatar
    Guest
    Guest


    Reputation limits - [Tutorial] Reputation Levels Empty Re: [Tutorial] Reputation Levels

    Post by Guest Sun 6 Aug 2017 - 14:00

    Code:
            /*
            *  Application: Reputation Levels
            *  Date: 19/05/2017
            *  Version: 1.219072017
            *  Copyright (c) 2017 Daemon <help.forumotion.com>
            *  This work is free. You can redistribute it and/or modify it
            */
            function bs_reputation_ipb() {
           
            /*
            * Configure below the levels for the reputation profile,
            * with the respective number needed to win it.
            * You can also add a class to customize the element.
            */
           
            var arrConfig = [
                {
                  reputation: 0,
                  level: "Neutral",
                  class: "zero"
                },
                {
                  reputation: 65,
                  level: "Beginner"
                },
                {
                  reputation: 75,
                  level: "Regular"
                },
                {
                  reputation: 90,
                  level: "Good"
                },
                {
                  reputation: 100,
                  level: "Great"
                },
                {
                  reputation: 50,
                  level: "Excellent",
                  class: "awesome"
                }
            ];
           
            /*
            * No need to change anything from here down
            */
           
            var userLink, repField, repFieldName, repFieldValue, regExp, level, repClass;
            var BreakException = {};
            jQuery.each(jQuery(".post"), function(i, val) {
                var thisPost = jQuery(val);
                userLink = thisPost.find("a[href^='/u']").attr("href");
                jQuery.ajax({
                    type: "GET",
                    url: userLink,
                    success: function(data) {
                        repField = jQuery("#field_id-14", data);
                        repFieldName = repField.find("dt").text().split(" ")[0];
                        repFieldValue = parseInt(repField.find("dd").text());
                        regExp = new RegExp("(<span class=\"label\">(?:<span style=\"[^\"]*\">)?" + repFieldName + "(?:<\\/span>)?\\s:\\s<\\/span>\\s\\d+)", "g");
                        try {
                            jQuery.each(arrConfig, function(i, val) {
                                if (val.reputation <= repFieldValue) {
                                    level = (val.level) ? val.level : "";
                                    repClass = (val.class) ? " " + val.class : "";
                                } else {
                                    throw BreakException;
                                }
                            });
                        } catch (e) {
                            if (e !== BreakException) throw e;
                        }
                        thisPost.find(".label").parent().html(function(i, val) {
                            return val.replace(regExp, "<div class='reputation_bs" + repClass + "'>$1<br><span class='title' style='font-weight:normal'>" + level + "</span></div>");
                        });
                    },
                    error: function(jqXHR, textStatus, errorThrown) {
                        console.log("**An error occurred while trying to request the data");
                    }
                });
            });
           
            };
            jQuery(function() {
                bs_reputation_ipb();
            });
    smurfavr
    smurfavr
    Active Poster


    Male Posts : 1881
    Reputation : 22
    Language : Bulgarian

    Reputation limits - [Tutorial] Reputation Levels Empty Re: [Tutorial] Reputation Levels

    Post by smurfavr Sun 6 Aug 2017 - 16:52

    I intended to add these numbers to the others.
    0,1,10,20,35,50.65......

    reputation: 65

    reputation: 75

    reputation: 90



    If you can add them to this code I've given. At the new line item level, write xxx I will add names.

    Code:
    /*
     *  Application: Reputation Levels
     *  Date: 19/05/2017
     *  Version: 1.219072017
     *  Copyright (c) 2017 Daemon <help.forumotion.com>
     *  This work is free. You can redistribute it and/or modify it
     */
    function bs_reputation_ipb() {
     
    /*
     * Configure below the levels for the reputation profile,
     * with the respective number needed to win it.
     * You can also add a class to customize the element.
     */
     
    var arrConfig = [
        {
          reputation: 0,
          level: "Neutral",
          class: "Потребител"
        },
        {
          reputation: 1,
          level: "Начинаещ"
        },
        {
          reputation: 10,
          level: "Редовен потребител"
        },
        {
          reputation: 20,
          level: "Фен"
        },
        {
          reputation: 35,
          level: "Напредващ"
        },
        {
          reputation: 50,
          level: "HL маняк",
          class: "awesome"
        }
    ];
     
    /*
     * No need to change anything from here down
     */
     
    var userLink, repField, repFieldName, repFieldValue, regExp, level, repClass;
    var BreakException = {};
    jQuery.each(jQuery(".post"), function(i, val) {
        var thisPost = jQuery(val);
        userLink = thisPost.find("a[href^='/u']").attr("href");
        jQuery.ajax({
            type: "GET",
            url: userLink,
            success: function(data) {
                repField = jQuery("#field_id-14", data);
                repFieldName = repField.find("dt").text().split(" ")[0];
                repFieldValue = parseInt(repField.find("dd").text());
                regExp = new RegExp("(<span class="label">(?:<span style="[^"]*">)?" + repFieldName + "(?:<\\/span>)?\\s:\\s<\\/span>\\s\\d+)", "g");
                try {
                    jQuery.each(arrConfig, function(i, val) {
                        if (val.reputation <= repFieldValue) {
                            level = (val.level) ? val.level : "";
                            repClass = (val.class) ? " " + val.class : "";
                        } else {
                            throw BreakException;
                        }
                    });
                } catch (e) {
                    if (e !== BreakException) throw e;
                }
                thisPost.find(".label").parent().html(function(i, val) {
                    return val.replace(regExp, "<div class='reputation_bs" + repClass + "'>$1<br><span class='title' style='font-weight:normal'>" + level + "</span></div>");
                });
            },
            error: function(jqXHR, textStatus, errorThrown) {
                console.log("**An error occurred while trying to request the data");
            }
        });
    });
     
    };
    jQuery(function() {
        bs_reputation_ipb();
    });

    reputation: 100
    avatar
    Guest
    Guest


    Reputation limits - [Tutorial] Reputation Levels Empty Re: [Tutorial] Reputation Levels

    Post by Guest Sun 6 Aug 2017 - 17:01

    Code:
            /*
            *  Application: Reputation Levels
            *  Date: 19/05/2017
            *  Version: 1.219072017
            *  Copyright (c) 2017 Daemon <help.forumotion.com>
            *  This work is free. You can redistribute it and/or modify it
            */
            function bs_reputation_ipb() {
           
            /*
            * Configure below the levels for the reputation profile,
            * with the respective number needed to win it.
            * You can also add a class to customize the element.
            */
           
            var arrConfig = [
                {
                  reputation: 0,
                  level: "Neutral",
                  class: "??????????"
                },
                {
                  reputation: 1,
                  level: "????????"
                },
                {
                  reputation: 10,
                  level: "??????? ??????????"
                },
                {
                  reputation: 20,
                  level: "???"
                },
                {
                  reputation: 35,
                  level: "?????????"
                },
                {
                  reputation: 50,
                  level: "HL ?????"
                },
           {
                  reputation: 65,
                  level: "HL ?????"
                },
           {
                  reputation: 75,
                  level: "HL ?????"
                },
           {
                  reputation: 90,
                  level: "HL ?????"
                },
           {
                  reputation: 100,
                  level: "HL ?????"
                }
            ];
           
            /*
            * No need to change anything from here down
            */
           
            var userLink, repField, repFieldName, repFieldValue, regExp, level, repClass;
            var BreakException = {};
            jQuery.each(jQuery(".post"), function(i, val) {
                var thisPost = jQuery(val);
                userLink = thisPost.find("a[href^='/u']").attr("href");
                jQuery.ajax({
                    type: "GET",
                    url: userLink,
                    success: function(data) {
                        repField = jQuery("#field_id-14", data);
                        repFieldName = repField.find("dt").text().split(" ")[0];
                        repFieldValue = parseInt(repField.find("dd").text());
                        regExp = new RegExp("(<span class="label">(?:<span style="[^"]*">)?" + repFieldName + "(?:<\\/span>)?\\s:\\s<\\/span>\\s\\d+)", "g");
                        try {
                            jQuery.each(arrConfig, function(i, val) {
                                if (val.reputation <= repFieldValue) {
                                    level = (val.level) ? val.level : "";
                                    repClass = (val.class) ? " " + val.class : "";
                                } else {
                                    throw BreakException;
                                }
                            });
                        } catch (e) {
                            if (e !== BreakException) throw e;
                        }
                        thisPost.find(".label").parent().html(function(i, val) {
                            return val.replace(regExp, "<div class='reputation_bs" + repClass + "'>$1<br><span class='title' style='font-weight:normal'>" + level + "</span></div>");
                        });
                    },
                    error: function(jqXHR, textStatus, errorThrown) {
                        console.log("**An error occurred while trying to request the data");
                    }
                });
            });
           
            };
            jQuery(function() {
                bs_reputation_ipb();
            });
    smurfavr
    smurfavr
    Active Poster


    Male Posts : 1881
    Reputation : 22
    Language : Bulgarian

    Reputation limits - [Tutorial] Reputation Levels Empty Re: [Tutorial] Reputation Levels

    Post by smurfavr Sun 6 Aug 2017 - 17:18

    Thank you Wolfuryo .


    Where can I change the caption from the photo?
    Reputation limits - [Tutorial] Reputation Levels AsaJPGYEkFa1a
    smurfavr
    smurfavr
    Active Poster


    Male Posts : 1881
    Reputation : 22
    Language : Bulgarian

    Reputation limits - [Tutorial] Reputation Levels Empty Re: [Tutorial] Reputation Levels

    Post by smurfavr Sun 6 Aug 2017 - 17:28

    Wolfuryo
    I put the code, but I do not work.


    Code:
    /*
            *  Application: Reputation Levels
            *  Date: 19/05/2017
            *  Version: 1.219072017
            *  Copyright (c) 2017 Daemon <help.forumotion.com>
            *  This work is free. You can redistribute it and/or modify it
            */
            function bs_reputation_ipb() {
         
            /*
            * Configure below the levels for the reputation profile,
            * with the respective number needed to win it.
            * You can also add a class to customize the element.
            */
         
            var arrConfig = [
                {
                  reputation: 0,
                  level: "Neutral",
                  class: "Потребител"
                },
                {
                  reputation: 1,
                  level: "Начинаещ"
                },
                {
                  reputation: 10,
                  level: "Редовен потребител"
                },
                {
                  reputation: 20,
                  level: "Фен"
                },
                {
                  reputation: 35,
                  level: "Напредващ"
                },
                {
                  reputation: 50,
                  level: "HL маняк"
                },
          {
                  reputation: 65,
                  level: "Пристрастен"
                },
          {
                  reputation: 75,
                  level: "Разбирач"
                },
          {
                  reputation: 90,
                  level: "VIP"
                },
          {
                  reputation: 100,
                  level: "HL постер"
                }
            ];
         
            /*
            * No need to change anything from here down
            */
         
            var userLink, repField, repFieldName, repFieldValue, regExp, level, repClass;
            var BreakException = {};
            jQuery.each(jQuery(".post"), function(i, val) {
                var thisPost = jQuery(val);
                userLink = thisPost.find("a[href^='/u']").attr("href");
                jQuery.ajax({
                    type: "GET",
                    url: userLink,
                    success: function(data) {
                        repField = jQuery("#field_id-14", data);
                        repFieldName = repField.find("dt").text().split(" ")[0];
                        repFieldValue = parseInt(repField.find("dd").text());
                        regExp = new RegExp("(<span class="label">(?:<span style="[^"]*">)?" + repFieldName + "(?:<\\/span>)?\\s:\\s<\\/span>\\s\\d+)", "g");
                        try {
                            jQuery.each(arrConfig, function(i, val) {
                                if (val.reputation <= repFieldValue) {
                                    level = (val.level) ? val.level : "";
                                    repClass = (val.class) ? " " + val.class : "";
                                } else {
                                    throw BreakException;
                                }
                            });
                        } catch (e) {
                            if (e !== BreakException) throw e;
                        }
                        thisPost.find(".label").parent().html(function(i, val) {
                            return val.replace(regExp, "<div class='reputation_bs" + repClass + "'>$1<br><span class='title' style='font-weight:normal'>" + level + "</span></div>");
                        });
                    },
                    error: function(jqXHR, textStatus, errorThrown) {
                        console.log("**An error occurred while trying to request the data");
                    }
                });
            });
         
            };
            jQuery(function() {
                bs_reputation_ipb();
            });
    avatar
    Guest
    Guest


    Reputation limits - [Tutorial] Reputation Levels Empty Re: [Tutorial] Reputation Levels

    Post by Guest Sun 6 Aug 2017 - 17:37

    Hmm, I don't see anything wrong at the code. What your forum's link?
    smurfavr
    smurfavr
    Active Poster


    Male Posts : 1881
    Reputation : 22
    Language : Bulgarian

    Reputation limits - [Tutorial] Reputation Levels Empty Re: [Tutorial] Reputation Levels

    Post by smurfavr Sun 6 Aug 2017 - 17:39

    This is my test forum.
    http://vracatestforum.bulgarianforum.net/t52-topic#210

    psp
    Something happened because I tried and the original code did not work.
    avatar
    Guest
    Guest


    Reputation limits - [Tutorial] Reputation Levels Empty Re: [Tutorial] Reputation Levels

    Post by Guest Sun 6 Aug 2017 - 18:09

    Code:
            /*
             *  Application: Reputation Levels
             *  Date: 19/05/2017
             *  Version: 1.219072017
             *  Copyright (c) 2017 Daemon <help.forumotion.com>
             *  This work is free. You can redistribute it and/or modify it
             */
            function bs_reputation_ipb() {
            
            /*
             * Configure below the levels for the reputation profile,
             * with the respective number needed to win it.
             * You can also add a class to customize the element.
             */
            
            var arrConfig = [
                {
                  reputation: 0,
                  level: "Neutral",
                  class: "Потребител"
                },
                {
                  reputation: 1,
                  level: "Начинаещ"
                },
                {
                  reputation: 10,
                  level: "Редовен потребител"
                },
                {
                  reputation: 20,
                  level: "Фен"
                },
                {
                  reputation: 35,
                  level: "Напредващ"
                },
                {
                  reputation: 50,
                  level: "HL маняк"
                },
          {
                  reputation: 65,
                  level: "Пристрастен"
                },
          {
                  reputation: 75,
                  level: "Разбирач"
                },
          {
                  reputation: 90,
                  level: "VIP"
                },
          {
                  reputation: 100,
                  level: "HL постер"
                }
            ];
            
            /*
             * No need to change anything from here down
             */
            
            var userLink, repField, repFieldName, repFieldValue, regExp, level, repClass;
            var BreakException = {};
            jQuery.each(jQuery(".post"), function(i, val) {
                var thisPost = jQuery(val);
                userLink = thisPost.find("a[href^='/u']").attr("href");
                jQuery.ajax({
                    type: "GET",
                    url: userLink,
                    success: function(data) {
                        repField = jQuery("#field_id-14", data);
                        repFieldName = repField.find("dt").text().split(" ")[0];
                        repFieldValue = parseInt(repField.find("dd").text());
                        regExp = new RegExp("(<span class=\"label\">(?:<span style=\"[^\"]*\">)?" + repFieldName + "(?:<\\/span>)?\\s:\\s<\\/span>\\s\\d+)", "g");
                        try {
                            jQuery.each(arrConfig, function(i, val) {
                                if (val.reputation <= repFieldValue) {
                                    level = (val.level) ? val.level : "";
                                    repClass = (val.class) ? " " + val.class : "";
                                } else {
                                    throw BreakException;
                                }
                            });
                        } catch (e) {
                            if (e !== BreakException) throw e;
                        }
                        thisPost.find(".label").parent().html(function(i, val) {
                            return val.replace(regExp, "<div class='reputation_bs" + repClass + "'>$1<br><span class='title' style='font-weight:normal'>" + level + "</span></div>");
                        });
                    },
                    error: function(jqXHR, textStatus, errorThrown) {
                        console.log("**An error occurred while trying to request the data");
                    }
                });
            });
            
            };
            jQuery(function() {
                bs_reputation_ipb();
            });
    smurfavr
    smurfavr
    Active Poster


    Male Posts : 1881
    Reputation : 22
    Language : Bulgarian

    Reputation limits - [Tutorial] Reputation Levels Empty Re: [Tutorial] Reputation Levels

    Post by smurfavr Sun 6 Aug 2017 - 18:15

    Thanks now works.
    How do I change the caption from the photo in my previous post?

    avatar
    Guest
    Guest


    Reputation limits - [Tutorial] Reputation Levels Empty Re: [Tutorial] Reputation Levels

    Post by Guest Sun 6 Aug 2017 - 19:06

    Replace the script with:
    Code:
                    /*
                    *  Application: Reputation Levels
                    *  Date: 19/05/2017
                    *  Version: 1.219072017
                    *  Copyright (c) 2017 Daemon <help.forumotion.com>
                    *  This work is free. You can redistribute it and/or modify it
                    */
                    function bs_reputation_ipb() {

                        /*
                        * Configure below the levels for the reputation profile,
                        * with the respective number needed to win it.
                        * You can also add a class to customize the element.
                        */

                        var arrConfig = [{
                            reputation: 0,
                            level: "Neutral",
                            class: "Потребител"
                        }, {
                            reputation: 1,
                            level: "Начинаещ"
                        }, {
                            reputation: 10,
                            level: "Редовен потребител"
                        }, {
                            reputation: 20,
                            level: "Фен"
                        }, {
                            reputation: 35,
                            level: "Напредващ"
                        }, {
                            reputation: 50,
                            level: "HL маняк"
                        }, {
                            reputation: 65,
                            level: "Пристрастен"
                        }, {
                            reputation: 75,
                            level: "Разбирач"
                        }, {
                            reputation: 90,
                            level: "VIP"
                        }, {
                            reputation: 100,
                            level: "HL постер"
                        }];

                        /*
                        * No need to change anything from here down
                        */

                        var userLink, repField, repFieldName, repFieldValue, regExp, level, repClass;
                        var BreakException = {};
                        jQuery.each(jQuery(".post"), function(i, val) {
                            var thisPost = jQuery(val);
                            userLink = thisPost.find("a[href^='/u']").attr("href");
                            jQuery.ajax({
                                type: "GET",
                                url: userLink,
                                success: function(data) {
                                    repField = jQuery("#field_id-14", data);
                                    repFieldName = repField.find("dt").text().split(" ")[0];
                                    repFieldValue = parseInt(repField.find("dd").text());
                                    regExp = new RegExp("(<span class=\"label\">(?:<span style=\"[^\"]*\">)?" + repFieldName + "(?:<\\/span>)?\\s:\\s<\\/span>\\s\\d+)", "g");
                                    try {
                                        jQuery.each(arrConfig, function(i, val) {
                                            if (val.reputation <= repFieldValue) {
                                                level = (val.level) ? val.level : "";
                                                repClass = (val.class) ? " " + val.class : "";
                                            } else {
                                                throw BreakException;
                                            }
                                        });
                                    } catch (e) {
                                        if (e !== BreakException) throw e;
                                    }
                                    thisPost.find(".label").parent().html(function(i, val) {
                                        return val.replace(regExp, "<div class='reputation_bs" + repClass + "'>$1<br><span class='title' style='font-weight:normal'>" + level + "</span></div>");
                                    });
                                },
                                error: function(jqXHR, textStatus, errorThrown) {
                                    console.log("**An error occurred while trying to request the data");
                                }
                            });
                        });

                    };
                    jQuery(function() {
                        bs_reputation_ipb();
                        var rep = $(".reputation_bs>span.label>span");
                        if (rep) rep.text("Reputation");
                    });

    At the end of the code, look for this:
    Code:
    if (rep) rep.text("Reputation");
    Change Reputation to whatever you want.
    smurfavr
    smurfavr
    Active Poster


    Male Posts : 1881
    Reputation : 22
    Language : Bulgarian

    Reputation limits - [Tutorial] Reputation Levels Empty Re: [Tutorial] Reputation Levels

    Post by smurfavr Sun 6 Aug 2017 - 20:32

    I changed the code, but the caption did not change.

    Code:
    /*
                    *  Application: Reputation Levels
                    *  Date: 19/05/2017
                    *  Version: 1.219072017
                    *  Copyright (c) 2017 Daemon <help.forumotion.com>
                    *  This work is free. You can redistribute it and/or modify it
                    */
                    function bs_reputation_ipb() {
     
                        /*
                        * Configure below the levels for the reputation profile,
                        * with the respective number needed to win it.
                        * You can also add a class to customize the element.
                        */
     
                        var arrConfig = [{
                            reputation: 0,
                            level: "Neutral",
                            class: "Потребител"
                        }, {
                            reputation: 1,
                            level: "Начинаещ"
                        }, {
                            reputation: 10,
                            level: "Редовен потребител"
                        }, {
                            Репутация: 20,
                            level: "Фен"
                        }, {
                            reputation: 35,
                            level: "Напредващ"
                        }, {
                            reputation: 50,
                            level: "HL маняк"
                        }, {
                            reputation: 65,
                            level: "Пристрастен"
                        }, {
                            reputation: 75,
                            level: "Разбирач"
                        }, {
                            reputation: 90,
                            level: "VIP"
                        }, {
                            reputation: 100,
                            level: "HL постер"
                        }];
     
                        /*
                        * No need to change anything from here down
                        */
     
                        var userLink, repField, repFieldName, repFieldValue, regExp, level, repClass;
                        var BreakException = {};
                        jQuery.each(jQuery(".post"), function(i, val) {
                            var thisPost = jQuery(val);
                            userLink = thisPost.find("a[href^='/u']").attr("href");
                            jQuery.ajax({
                                type: "GET",
                                url: userLink,
                                success: function(data) {
                                    repField = jQuery("#field_id-14", data);
                                    repFieldName = repField.find("dt").text().split(" ")[0];
                                    repFieldValue = parseInt(repField.find("dd").text());
                                    regExp = new RegExp("(<span class="label">(?:<span style="[^"]*">)?" + repFieldName + "(?:<\\/span>)?\\s:\\s<\\/span>\\s\\d+)", "g");
                                    try {
                                        jQuery.each(arrConfig, function(i, val) {
                                            if (val.reputation <= repFieldValue) {
                                                level = (val.level) ? val.level : "";
                                                repClass = (val.class) ? " " + val.class : "";
                                            } else {
                                                throw BreakException;
                                            }
                                        });
                                    } catch (e) {
                                        if (e !== BreakException) throw e;
                                    }
                                    thisPost.find(".label").parent().html(function(i, val) {
                                        return val.replace(regExp, "<div class='reputation_bs" + repClass + "'>$1<br><span class='title' style='font-weight:normal'>" + level + "</span></div>");
                                    });
                                },
                                error: function(jqXHR, textStatus, errorThrown) {
                                    console.log("**An error occurred while trying to request the data");
                                }
                            });
                        });
     
                    };
                    jQuery(function() {
                        bs_reputation_ipb();
                        var rep = $(".reputation_bs>span.label>span");
                        if (rep) rep.text("Репутация");
                    });