Skip to content

Instantly share code, notes, and snippets.

@Sinfrax
Last active August 16, 2018 01:00
Show Gist options
  • Save Sinfrax/84dc312bd1ee20019f5e to your computer and use it in GitHub Desktop.
Save Sinfrax/84dc312bd1ee20019f5e to your computer and use it in GitHub Desktop.
Toggle Messenger Sidebar Script
// ==UserScript==
// @name Toggle Messenger Sidebar
// @namespace http://jamesswandale.com/
// @version 0.1
// @description Button to hide messengers list of conversations
// @match https://www.messenger.com/*
// @copyright 2015+, James Swandale
// @require http://code.jquery.com/jquery-latest.js
// ==/UserScript==
$(document).ready(function() {
$('body').append('<input type="button" value="Hide Sidebar" id="showHideButton" style="background-color:#000000; color:#FFFFFF;">');
$("#showHideButton").css("position", "fixed").css("top", 15).css("left", 60);
$("#showHideButton").click(function(){
var convThreads = document.getElementsByClassName("_1enh");
if(convThreads.item().style.display == 'none'){
convThreads.item().style.display = 'block';
showHideButton.value = "Hide Sidebar";
}else {
convThreads.item().style.display = 'none';
showHideButton.value = "Show Sidebar";
}
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment