Skip to content

Instantly share code, notes, and snippets.

@WiBla
Last active December 11, 2016 16:11
Show Gist options
  • Save WiBla/e7c26136a7527e26345e9d5715a9a1f4 to your computer and use it in GitHub Desktop.
Save WiBla/e7c26136a7527e26345e9d5715a9a1f4 to your computer and use it in GitHub Desktop.

BetterDiscord plugin to hide offline users in Discord no matter the numbers of people in the server.

##Install

  1. Scroll down to the hideOffline.plugin.js file and click the "Raw" button next to his name. Raw button
  2. Download the page with ctrl+s and place it in:
    • Windows: %appdata%\BetterDiscord\plugins
    • OSX: ~/Library/Preferences/BetterDiscord/plugins
  3. Reload Discord after with either ctrl+r or closing/re-opening it.
  4. Go to the "Plugins" tab in the BetterDiscord settings and enable the plugin.
  5. You're done ! Thanks for trying my plugin !

##Uninstall

  1. Go to your plugins settings in BetterDiscord, click "Open Plugin Folder" BetterDiscord Plugins settings
  2. Delete "hideOffline.plugin.js"
  3. Reload Discord either with ctrl+r or closing/re-opening it.

##Updating

The plugin will notify you on new updates but until BetterDiscord V2, you will have to manually update by uninstall/re-installing.

##Boring stuff

       DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
               Version 2, December 2004

Copyright (C) 2004 Sam Hocevar sam@hocevar.net

Everyone is permitted to copy and distribute verbatim or modified copies of this license document, and changing it is allowed as long as the name is changed.

       DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE

TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION

  1. You just DO WHAT THE FUCK YOU WANT TO.
//META{"name":"hideOffline"}*//
function hideOffline() {}
var ho = {
settings: {
version: '1.1.0',
antiSpam: 0
},
functions: {
checkForUpdates: function() {
$.ajax({
url: 'https://rawgit.com/WiBla/e7c26136a7527e26345e9d5715a9a1f4/raw/hideOffline.plugin.js',
success: function(data) {
var versionRE = /([0-9]\.[0-9]\.[0-9])/;
var newVersion = data.match(versionRE)[0];
if (newVersion > ho.settings.version) {
Core.prototype.alert(
'hideOffline v'+newVersion+' is available !',
'A new verion for hideOffline is available, Click this link to install it:<br>'+
'<a href="https://gist.github.com/WiBla/e7c26136a7527e26345e9d5715a9a1f4">https://gist.github.com/WiBla/e7c26136a7527e26345e9d5715a9a1f4</a>'
);
}
},
fail: function(err) {
console.log(err);
}
});
},
hideOfflineUsers: function() {
if ($('.member-status-offline').length === 0 && ho.settings.antiSpam < 8) {
ho.settings.antiSpam++;
setTimeout(function() {
ho.functions.hideOfflineUsers();
}, 250);
} else {
ho.settings.antiSpam = 0;
// If removed, will cause issue
$('.member-status-offline').hide();
$('.member-status-offline:first').prev().hide();
// If last online user is visible, hide the scrollbar
if ($('.member-status-offline:first').prev().prev().position().top < $('.channel-members').height()) {
$('.channel-members div:last').hide();
}
}
}
}
};
hideOffline.prototype.onSwitch = function() {
ho.functions.hideOfflineUsers();
};
hideOffline.prototype.onMessage = function() {
};
hideOffline.prototype.load = function() {
ho.functions.checkForUpdates();
ho.functions.hideOfflineUsers();
$('.channel-members-wrap').on('mousewheel.ho', ho.functions.hideOfflineUsers());
};
hideOffline.prototype.unload = function() {
$('.channel-members-wrap').off('mousewheel.ho', ho.functions.hideOfflineUsers());
};
hideOffline.prototype.start = function() {
ho.functions.checkForUpdates();
ho.functions.hideOfflineUsers();
$('.channel-members-wrap').on('mousewheel.ho', ho.functions.hideOfflineUsers());
};
hideOffline.prototype.stop = function() {
$('.channel-members-wrap').off('mousewheel.ho', ho.functions.hideOfflineUsers());
};
hideOffline.prototype.getName = function() {
return 'Remove offline users';
};
hideOffline.prototype.getDescription = function() {
return 'Hides offline users no matter the numbers of people in the server.';
};
hideOffline.prototype.getVersion = function() {
return ho.settings.version;
};
hideOffline.prototype.getAuthor = function() {
return 'WiBla';
};
hideOffline.prototype.getSettingsPanel = function() {
return '';
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment