Toggle Messenger Sidebar

Button to hide messengers list of conversations, coloured for stylish black messenger

当前为 2015-11-25 提交的版本,查看 最新版本

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Greasemonkey 油猴子Violentmonkey 暴力猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Violentmonkey 暴力猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Userscripts ,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展后才能安装此脚本。

(我已经安装了用户脚本管理器,让我安装!)

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

(我已经安装了用户样式管理器,让我安装!)

// ==UserScript==
// @name Toggle Messenger Sidebar
// @namespace http://jamesswandale.com/
// @version 0.1
// @description Button to hide messengers list of conversations, coloured for stylish black messenger 
// @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";
        }
    });
});