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

目前为 2021-07-29 提交的版本。查看 最新版本

  1. // ==UserScript==
  2. // @name Allow Sidebar Hide Google Drive
  3. // @namespace http://tampermonkey.net/
  4. // @version 0.1
  5. // @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
  6. // @author Benyamin Limanto <me@benyamin.xyz>
  7. // @match https://drive.google.com/drive/*
  8. // @icon https://www.google.com/s2/favicons?domain=google.com
  9. // @grant none
  10. // ==/UserScript==
  11.  
  12. (function() {
  13. 'use strict';
  14. var status = true; var newStyle = document.createElement("style");
  15. var btnCollapse = document.createElement("button");
  16. btnCollapse.innerText = ">"; btnCollapse.style.marginLeft = "100px";
  17. btnCollapse.style.padding = "4px"; btnCollapse.style.fontWeight = "bolder"; btnCollapse.style.cursor = "pointer";
  18. btnCollapse.style.background = "#fff"; btnCollapse.style.borderRadius = "4px"; btnCollapse.style.border = "#0011008c solid 1px";
  19. btnCollapse.onclick = function() {
  20. if(status) {
  21. newStyle.innerText = ".a-hrN2W-S-kl-Gd > .a-s-tb-kl-Gd-ig, .a-D-B-Lc-j { min-width: 256px !important; }";
  22. status = false;
  23. btnCollapse.innerText = "<";
  24. } else {
  25. newStyle.innerText = ".a-hrN2W-S-kl-Gd > .a-s-tb-kl-Gd-ig, .a-D-B-Lc-j { min-width: 0px !important; }";
  26. status = true;
  27. btnCollapse.innerText = ">";
  28. }
  29. };
  30. var newButton = document.querySelector(".a-ec-Gd-Cs-mp-S");
  31. newButton.after(btnCollapse);
  32. // Set Style and Append
  33. newStyle.id = "new-style";
  34. newStyle.innerText = ".a-hrN2W-S-kl-Gd > .a-s-tb-kl-Gd-ig, .a-D-B-Lc-j { min-width: 0px !important; }";
  35. document.body.appendChild(newStyle);
  36. })();