Gmail Compactor

Click the text at the bottom of the table or press (t) to compact the size of gmail.

  1. // ==UserScript==
  2. // @name Gmail Compactor
  3. // @description Click the text at the bottom of the table or press (t) to compact the size of gmail.
  4. // @namespace https://greasyfork.org/users/3159
  5. // @include http://mail.google.com/mail/*
  6. // @include https://mail.google.com/mail/*
  7. // @grant GM_getValue
  8. // @grant GM_setValue
  9. // @version 1.0.1
  10. // ==/UserScript==
  11. a = ".nH.w-asV.aiw, .nH.oy8Mbf.nn.aeN, .Bu.y3, .AT{display:none !important}.ar4{margin:.5vw;width:99vw !important}.if{margin:0 !important}.aeJ{padding:0 !important;overflow-y: auto !important}.G-atb{padding: 0 0 9px 400px !important}.l2{padding-top: 12px !important;padding-bottom: 12px !important;margin:0 !important}.l6{padding: 0 !important}.fY{margin-right:16px !important}";
  12.  
  13. function csc(n) {
  14. cnc = document.getElementsByClassName('css');
  15. for (i = 0; i < cnc.length; i++) {
  16. cnc[i].innerText = n;
  17. }
  18. window.dispatchEvent(new Event('resize'));
  19. }
  20.  
  21. function cst() {
  22. if (GM_getValue("cssave")) {
  23. csc("");
  24. GM_setValue("cssave", 0);
  25. } else {
  26. csc(a);
  27. GM_setValue("cssave", 1);
  28. }
  29. }
  30.  
  31. function start() {
  32.  
  33. css = document.createElement("style");
  34. css.className = "css";
  35. document.head.appendChild(css);
  36.  
  37. if (GM_getValue("cssave")) {
  38. csc(a);
  39. } else {
  40. csc("");
  41. }
  42.  
  43. document.addEventListener("keydown", function (e) {
  44. if (e.which == 84 && !document.activeElement.getAttribute('aria-label')) {
  45. cst();
  46. }
  47. });
  48.  
  49. document.getElementById(':3').onclick = cst;
  50. document.getElementById(':2').addEventListener('mouseover', function () {
  51. document.getElementsByClassName('nH Gn')[0].onclick = cst;
  52. });
  53. }
  54.  
  55. itr=setInterval(function(){"Gmail"!=document.title&&""!=document.title&&(clearInterval(itr),start())},1E3);setTimeout(function(){clearInterval(itr)},12E4);