Greasy Fork

Greasy Fork is available in English.

Allow Sidebar Hide Google Drive

Google Drive Folder/File List wide, create button to hide google drive left side bar so there're more estate for showing file name

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

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

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

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

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

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

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

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

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

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

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

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

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

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

// ==UserScript==
// @name         Allow Sidebar Hide Google Drive
// @namespace    http://tampermonkey.net/
// @version      0.2
// @license      MIT
// @description  Google Drive Folder/File List wide, create button to hide google drive left side bar so there're more estate for showing file name
// @author       Benyamin Limanto <[email protected]>
// @match        https://drive.google.com/drive/*
// @icon         https://www.google.com/s2/favicons?domain=google.com
// @grant        none
// ==/UserScript==

(function() {
    'use strict';
    var defaultCollapsed = true;

    var status = true; var newStyle = document.createElement("style");
    var btnCollapse = document.createElement("button");
    btnCollapse.innerText = "<"; btnCollapse.style.marginLeft = "210px";
    btnCollapse.style.padding = "4px"; btnCollapse.style.fontWeight = "bolder"; btnCollapse.style.cursor = "pointer";
    btnCollapse.style.background = "#fff"; btnCollapse.style.borderRadius = "4px"; btnCollapse.style.border = "#0011008c solid 1px";
    btnCollapse.style.top = "13px";
    btnCollapse.onclick = function() {
      if(status) {
          newStyle.innerText = ".ALpC8b,.a-ec-Gd.a-ec-Gd-Cs-mp-S { display: block !important; } .ZHllM {position: relative;}";
          status = false;
          btnCollapse.innerText = "<";
          btnCollapse.style.position = "absolute";
          btnCollapse.style.marginLeft = "210px";
      } else {
          newStyle.innerText = ".ALpC8b,.a-ec-Gd.a-ec-Gd-Cs-mp-S { display: none !important; }";
          status = true;
          btnCollapse.innerText = ">";
          btnCollapse.style.position = "inherit";
          btnCollapse.style.marginLeft = 0;
      }
    };

    var newButton = document.querySelector(".a-ec-Gd-Cs-mp-S");
    newButton.after(btnCollapse);
    // Set Style and Append
    newStyle.id = "new-style";
    newStyle.innerText = ".a-hrN2W-S-kl-Gd > .a-s-tb-kl-Gd-ig, .a-D-B-Lc-j { min-width: 0px !important; } .ZHllM {position: relative;}";
    console.log(newStyle.innerText);
    document.body.appendChild(newStyle);

    if (defaultCollapsed) {
        status = false;
        btnCollapse.click();
    }
})();