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

目前為 2022-04-07 提交的版本,檢視 最新版本

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

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

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

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

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

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

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

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

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

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

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

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

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

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

// ==UserScript==
// @name         Allow Sidebar Hide Google Drive
// @namespace    http://tampermonkey.net/
// @version      0.2
// @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
// @license      MIT
// @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.onclick = function() {
      if(status) {
          newStyle.innerText = ".ALpC8b,.a-ec-Gd.a-ec-Gd-Cs-mp-S { display: block !important; }";
          status = false;
          btnCollapse.innerText = "<";
          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.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; }";
    document.body.appendChild(newStyle);

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