Advertisement
Ansolley

Advanced Player Links

Jan 17th, 2020
449
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
CSS 5.72 KB | None | 0 0
  1. /**
  2. * BF4 Advanced Player Links - Add some advanced player links (Anti-Cheat) to the profile.
  3. *
  4. * @author I-MrFixIt-I + Elementofprgress (ACI)
  5. * @edited by Kappadamic
  6. * @version 1.1.1 (edited)
  7. * @url https://getbblog.com/de/board/topic/145489/1/BF4-Advanced-player-links
  8. */
  9.  
  10. // initialize your plugin
  11. BBLog.handle("add.plugin", {
  12.  
  13.     /**
  14.     * The unique, lowercase id of my plugin
  15.     * Allowed chars: 0-9, a-z, -
  16.     */
  17.     id : "mrfixit-bf4-advanced-player-links",
  18.  
  19.     /**
  20.     * The name of my plugin, used to show config values in bblog options
  21.     * Could also be translated with the translation key "plugin.name" (optional)
  22.     *
  23.     * @type String
  24.     */
  25.     name : "BF4 Advanced Player Links",
  26.  
  27.     /**
  28.     * Some translations for this plugins
  29.     * For every config flag must exist a corresponding EN translation
  30.     *   otherwise the plugin will no be loaded
  31.     *
  32.     * @type Object
  33.     */
  34.     translations : {
  35.         "en" : {
  36.             "use.player-links" : "Use Advanced Player Links",
  37.             "use.BFAgency" : "Show BFAgency",
  38.             "use.BF4DB" : "Show BF4DB",
  39.             "use.CheatReport" : "Show CheatReport",
  40.             "use.247FairPlay" : "Show 247FairPlay"
  41.         },
  42.         "de" : {
  43.             "use.player-links" : "Advanced Player Links verwenden",
  44.             "use.BFAgency" : "BFAgency anzeigen",
  45.             "use.BF4DB" : "BF4DB anzeigen",
  46.             "use.CheatReport" : "CheatReport anzeigen",
  47.             "use.247FairPlay" : "247FairPlay anzeigen"
  48.         }
  49.     },
  50.  
  51.     /**
  52.     * Configuration Options that appears in the BBLog Menu
  53.     * Every option must be an object with properties as shown bellow
  54.     * Properties available:
  55.     *   key : The name for your config flag - The user can toggle this option
  56.     *         and you can retreive the users choice with instance instance.storage(YOUR_KEY_NAME) (0 or 1 will be returned)
  57.     *   init : Can be 0 or 1 - Represent the initial status of the option when the user load the plugin for the first time
  58.     *          If you want that this option is enabled on first load (opt-out) than set it to 1, otherwise to 0 (opt-in)
  59.     *   handler(optional): When set as a function this config entry turns into a button (like the plugins button you see in the bblog menu)
  60.     *                       The function well be executed when the user clicks the button
  61.     */
  62.     configFlags : [
  63.         {"key" : "use.player-links", "init" : 1},
  64.         {"key" : "use.BFAgency", "init" : 1},
  65.         {"key" : "use.BF4DB", "init" : 1},
  66.         {"key" : "use.CheatReport", "init" : 1},
  67.         {"key" : "use.247FairPlay", "init" : 1}
  68.     ],
  69.  
  70.     /**
  71.     * A trigger that fires everytime when the dom is changing but at max only once each 200ms (5x per second) to prevent too much calls in a short time
  72.     * Example Case: If 10 DOM changes happen in a period of 100ms than this function will only been called 200ms after the last of this 10 DOM changes
  73.     * This make sure that all actions in battlelog been finished before this function been called
  74.     * This is how BBLog track Battlelog for any change, like url, content or anything
  75.     *
  76.     * @param object instance The instance of your plugin which is the whole plugin object
  77.     *    Always use "instance" to access any plugin related function, not use "this" because it's not working properly
  78.     *    For example: If you add a new function to your addon, always pass the "instance" object
  79.     */
  80.     domchange : function(instance){
  81.         if (instance.storage("use.player-links"))
  82.         {
  83.             if(BBLog.cache("mode") == "bf4")
  84.             {
  85.                 if (!$( "#advanced-player-links" ).length) {
  86.                     var urlParts = window.location.pathname.replace(/\/+$/, "").split('/');
  87.                     var personaId = urlParts[urlParts.length - 2];
  88.                     var soldierName = $("#game-stats-head .soldier-info-name span").last().text();
  89.                     var html = "<div id='advanced-player-links' class='box-content no-padding leaderboard-highlight'>";
  90.    
  91.                     html += "<div class='description'>•</div>";
  92.    
  93.                     if (instance.storage("use.BFAgency")) html += "<div class='description'><a href='https://battlefield.agency/?search=" + personaId + "' target='_blank'>BFAgency</a></div>"
  94.                                                                 + "<div class='description'>•</div>";
  95.    
  96.                     if (instance.storage("use.BF4DB")) html += "<div class='description'><a href='https://bf4db.com/player/" + personaId + "' target='_blank'>BF4DB</a></div>"
  97.                                                                     + "<div class='description'>•</div>";
  98.                                                                    
  99.                     if (instance.storage("use.CheatReport")) html += "<div class='description'><a href='https://bf4cheatreport.com/?pid=" + personaId + "&cnt=200' target='_blank'>CheatReport</a></div>"
  100.                                                                     + "<div class='description'>•</div>";
  101.                                                                    
  102.                     if (instance.storage("use.247FairPlay")) html += "<div class='description'><a href='https://www.247fairplay.com/CheatDetector/" + soldierName + "' target='_blank'>247FairPlay</a></div>"
  103.                                                                     + "<div class='description'>•</div>";
  104.  
  105.                     html += "<div class='clear'></div></div>";
  106.                    
  107.                     $("#overview-info div[class=box]").append(html);
  108.                 }
  109.             }
  110.         }
  111.         else
  112.         {
  113.             $( "#advanced-player-links" ).remove();
  114.         }
  115.     }
  116. });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement