Toggle Simplenote Sidebar

Button in footer to hide Simplenote siadebar.

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

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

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

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

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

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

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

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

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

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

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

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

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

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

// ==UserScript==
// @name Toggle Simplenote Sidebar
// @namespace http://calon.weblogs.us/
// @version 0.1
// @description Button in footer to hide Simplenote siadebar. 
// @match https://app.simplenote.com/*
// @include https://app.simplenote.com/*
// @match http://app.simplenote.com/*
// @include http://app.simplenote.com/*
// @supportURL [email protected]
// ==/UserScript==

var footList = document.createElement("li");
var toggleButton = document.createElement("a");
toggleButton.innerHTML = "Hide";
footList.appendChild(toggleButton);

var footerrightElement = document.getElementsByClassName("footer-right");
footerrightElement[0].insertBefore(footList, footerrightElement[0].firstChild);

var sidebarElement = document.getElementsByClassName("sidebar");
var noteElement = document.getElementsByClassName("note");

toggleButton.onclick = function toggle() {
  if (sidebarElement[0].style.width == "0px") {
    noteElement[0].style.left = "361px";
    sidebarElement[0].style.width = "360px";
    toggleButton.innerHTML = "Hide";
  } else {
    noteElement[0].style.left = "0px";
    sidebarElement[0].style.width = "0px";
    toggleButton.innerHTML = "Show";
  }
}