Advertisement
Ansolley

Plugin - Comcenter remover

Jun 28th, 2019
67
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
CSS 3.92 KB | None | 0 0
  1.  
  2.  
  3. /*
  4.      FILE ARCHIVED ON 15:53:35 May 19, 2018 AND RETRIEVED FROM THE
  5.      INTERNET ARCHIVE ON 15:53:35 May 19, 2018.
  6.      JAVASCRIPT APPENDED BY WAYBACK MACHINE, COPYRIGHT INTERNET ARCHIVE.
  7.  
  8.      ALL OTHER CONTENT MAY ALSO BE PROTECTED BY COPYRIGHT (17 U.S.C.
  9.      SECTION 108(a)(3)).
  10. */
  11. /**
  12. * Comcenter Remover - Removes the comcenter (chat and friends)
  13. *
  14. * @author I-MrFixIt-I
  15. * @version 1.0
  16. * @url /save/https://getbblog.com/
  17. */
  18.  
  19. // initialize your plugin
  20. BBLog.handle("add.plugin", {
  21.  
  22.     /**
  23.     * The unique, lowercase id of my plugin
  24.     * Allowed chars: 0-9, a-z, -
  25.     */
  26.     id : "mrfixit-comcenter-remover",
  27.  
  28.     /**
  29.     * The name of my plugin, used to show config values in bblog options
  30.     * Could also be translated with the translation key "plugin.name" (optional)
  31.     *
  32.     * @type String
  33.     */
  34.     name : "Comcenter Remover",
  35.  
  36.     /**
  37.     * Some translations for this plugins
  38.     * For every config flag must exist a corresponding EN translation
  39.     *   otherwise the plugin will no be loaded
  40.     *
  41.     * @type Object
  42.     */
  43.     translations : {
  44.         "en" : {
  45.             "use.comcenter-remover" : "Use Comcenter Remover"
  46.         },
  47.         "de" : {
  48.             "use.comcenter-remover" : "Comcenter Remover verwenden"
  49.         }
  50.     },
  51.  
  52.     /**
  53.     * Configuration Options that appears in the BBLog Menu
  54.     * Every option must be an object with properties as shown bellow
  55.     * Properties available:
  56.     *   key : The name for your config flag - The user can toggle this option
  57.     *         and you can retreive the users choice with instance instance.storage(YOUR_KEY_NAME) (0 or 1 will be returned)
  58.     *   init : Can be 0 or 1 - Represent the initial status of the option when the user load the plugin for the first time
  59.     *          If you want that this option is enabled on first load (opt-out) than set it to 1, otherwise to 0 (opt-in)
  60.     *   handler(optional): When set as a function this config entry turns into a button (like the plugins button you see in the bblog menu)
  61.     *                       The function well be executed when the user clicks the button
  62.     */
  63.     configFlags : [
  64.         {"key" : "use.comcenter-remover", "init" : 1}
  65.     ],
  66.  
  67.     /**
  68.     * 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
  69.     * 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
  70.     * This make sure that all actions in battlelog been finished before this function been called
  71.     * This is how BBLog track Battlelog for any change, like url, content or anything
  72.     *
  73.     * @param object instance The instance of your plugin which is the whole plugin object
  74.     *    Always use "instance" to access any plugin related function, not use "this" because it's not working properly
  75.     *    For example: If you add a new function to your addon, always pass the "instance" object
  76.     */
  77.     domchange : function(instance){
  78.         if (instance.storage("use.comcenter-remover"))
  79.         {
  80.             $("#comcenter_container").remove(); // remove comcenter container which is holding the comcenter object
  81.            
  82.             var body = $('body'); // get body container
  83.            
  84.             // remove any classes which contain the word "comcenter", for example the class "show-comcenter"
  85.             var classList = String(body.attr('class')).split(/\s+/);
  86.             $.each(classList, function(index, item) {
  87.                 if (item.indexOf('comcenter') >= 0)
  88.                 {
  89.                     body.removeClass(item);
  90.                 }
  91.             });
  92.            
  93.             // add the class "no-comcenter" to fix the positioning of the content (default class if you are logged out (no comcenter))                    
  94.             body.addClass("no-comcenter");
  95.         }
  96.     }
  97. });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement