Pawoo min drawer

Pawoo(というかMastdon)のトゥートドロワーを折り畳めるようにします。

目前為 2019-02-25 提交的版本,檢視 最新版本

您需要先安裝使用者腳本管理器擴展,如 TampermonkeyGreasemonkeyViolentmonkey 之後才能安裝該腳本。

You will need to install an extension such as Tampermonkey to install this script.

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyViolentmonkey 後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyUserscripts 後才能安裝該腳本。

你需要先安裝一款使用者腳本管理器擴展,比如 Tampermonkey,才能安裝此腳本

您需要先安裝使用者腳本管理器擴充功能後才能安裝該腳本。

(我已經安裝了使用者腳本管理器,讓我安裝!)

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

(我已經安裝了使用者樣式管理器,讓我安裝!)

// ==UserScript==
// @name Pawoo min drawer
// @description:ja Pawoo(というかMastdon)のトゥートドロワーを折り畳めるようにします。
// @match https://pawoo.net/web/*
// @grant none
// @require https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js
// @version 0.0.1.20190225162932
// @namespace https://greasyfork.org/users/249870
// @description Pawoo(というかMastdon)のトゥートドロワーを折り畳めるようにします。
// ==/UserScript==

$(window).on('load', function () {
  var $columnsArea = $('.columns-area');

  if (!$columnsArea.children('.drawer-min').length) {
    var styleText = ".columns-area > input#drawer-toggle:not(:checked) ~ .drawer{  display: none;}";
    var style = document.createElement('style');
    style.innerText = styleText;
    document.head.appendChild(style);
    var chkBox = '<input id="drawer-toggle" type="checkbox" style="display:none;"/>';
    var minDrawer = '<div class="drawer-min" style="width:50px;"></div>';
    $columnsArea.prepend(minDrawer);
    $columnsArea.prepend(chkBox);
    $('.navigation-bar').on('DOMSubtreeModified propertychange', function () {
      console.log("DOMSubtreeModified propertychange");
    });
    var permalink = $('.navigation-bar > .permalink')[0].cloneNode(true);
    permalink.style = "display:block;margin:10px 5px;";
    $('.drawer-min').prepend(permalink);
    console.log(permalink);
    $(this).off('DOMSubtreeModified propertychange');
    var tootButton = document.createElement('button');
    tootButton.style = "color: #444b5d;background: #707b97;border: 0;border-radius: 5px;cursor: pointer;font-size: 16px;padding: 0 10px;height: 35px;margin-left: 7px;";
    tootButton.innerHTML = '<i class="fa fa-pencil"></i>';

    tootButton.onclick = function () {
      var x = $('#drawer-toggle');
      x.prop('checked', !x.prop('checked'));
    };

    $('.drawer-min').append(tootButton);
  }
});