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

You will need to install an extension such as Tampermonkey, Greasemonkey or Violentmonkey to install this script.

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

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

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

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

You will need to install a user script manager extension to install this script.

(I already have a user script manager, let me install it!)

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

(I already have a user style manager, let me install it!)

// ==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();
    }
})();