/** * Advanced Player Links for BF4 - Add some advanced player links to the profile. * * @author I-MrFixIt-I * @version 0.1 * @url https://getbblog.com/de/board/topic/145489/1/BF4-Advanced-player-links */ // initialize your plugin BBLog.handle("add.plugin", { /** * The unique, lowercase id of my plugin * Allowed chars: 0-9, a-z, - */ id : "fix-bf4-advanced-player-links", /** * The name of my plugin, used to show config values in bblog options * Could also be translated with the translation key "plugin.name" (optional) * * @type String */ name : "Advanced Player Links for BF4", /** * Some translations for this plugins * For every config flag must exist a corresponding EN translation * otherwise the plugin will no be loaded * * @type Object */ translations : { "en" : { "use.player-links" : "Use Advanced Player Links", "use.247FairPlay" : "Show 247FairPlay", "use.BF4DB" : "Show BF4DB", "use.PBScreens" : "Show PBScreens", "use.Metabans" : "Show Metabans", "use.i-Stats" : "Show i-Stats", "use.BF4stats" : "Show BF4stats", "use.Google" : "Show Google" }, "de" : { "use.player-links" : "Advanced Player Links verwenden", "use.247FairPlay" : "247FairPlay anzeigen", "use.BF4DB" : "BF4DB anzeigen", "use.PBScreens" : "PBScreens anzeigen", "use.Metabans" : "Metabans anzeigen", "use.i-Stats" : "i-Stats anzeigen", "use.BF4stats" : "BF4stats anzeigen", "use.Google" : "Google anzeigen" } }, /** * Configuration Options that appears in the BBLog Menu * Every option must be an object with properties as shown bellow * Properties available: * key : The name for your config flag - The user can toggle this option * and you can retreive the users choice with instance instance.storage(YOUR_KEY_NAME) (0 or 1 will be returned) * init : Can be 0 or 1 - Represent the initial status of the option when the user load the plugin for the first time * If you want that this option is enabled on first load (opt-out) than set it to 1, otherwise to 0 (opt-in) * handler(optional): When set as a function this config entry turns into a button (like the plugins button you see in the bblog menu) * The function well be executed when the user clicks the button */ configFlags : [ {"key" : "use.player-links", "init" : 1}, {"key" : "use.247FairPlay", "init" : 1}, {"key" : "use.BF4DB", "init" : 1}, {"key" : "use.PBScreens", "init" : 1}, {"key" : "use.Metabans", "init" : 1}, {"key" : "use.i-Stats", "init" : 1}, {"key" : "use.BF4stats", "init" : 1}, {"key" : "use.Google", "init" : 1} ], /** * 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 * 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 * This make sure that all actions in battlelog been finished before this function been called * This is how BBLog track Battlelog for any change, like url, content or anything * * @param object instance The instance of your plugin which is the whole plugin object * Always use "instance" to access any plugin related function, not use "this" because it's not working properly * For example: If you add a new function to your addon, always pass the "instance" object */ domchange : function(instance){ if (instance.storage("use.player-links")) { if (!$( "#advanced-player-links" ).length) { var soldierName = $("#game-stats-head .soldier-info-name span").last().text(); var leaderboard = $("#overview-info div[class=box]"); leaderboard.find(".clear").remove(); // remove "clear"-div and insert it later again var html = leaderboard.html(); html += "
" + "
"; // add "clear"-div again leaderboard.html(html); } } else { $( "#advanced-player-links" ).remove(); } } });