Google Calendar Show All

By Arthaey Angosii Last update Nov 29, 2006 — Installed 1,071 times. Daily Installs: 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 2, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 0, 0, 0, 1, 3, 1, 0
// ==UserScript==
// @name           Google Calendar Show All
// @namespace      http://www.arthaey.com/
// @description    Removes scrollbars and displays entire schedule.
// @include        http*://www.google.com/calendar/*
// ==/UserScript==

// FIXME
//  - make new height dynamic, not hardcoded to 83em

window.addEventListener("load", function() {
   addGlobalStylesheet(
      "#showAll {" +
      "   cursor: pointer !important;" +
      "   padding-top: 4px !important;" +
      "   padding-right: 4px !important;" +
      "}"
   ); 
   var printLink = document.getElementById('printlink');
   if (printLink) {
      var showLink = createLink(
         "Show All", "showAll", showAll,
         "Show everything, from midnight to midnight"
      );
      var showCell = document.createElement('td');
      showCell.appendChild(showLink);
      printLink.parentNode.insertBefore(showCell, printLink);
   }
}, true);

function showAll() {
   addGlobalStylesheet(
      "#chrome_main2 {" +
      "   height: 83em !important;" +
      "}" +
      "#gridcontainer {" +
      "   overflow: visible !important;" +
      "}"
   );
}

function addGlobalStylesheet(css) {
   var head = document.getElementsByTagName('head')[0];
   if (head) {
      var style = document.createElement('style');
      style.type = 'text/css';
      style.innerHTML = css;
      head.appendChild(style);
   }
}

function createLink(text, id, fnct, title) {
   var link = document.createElement('img');
   link.alt = text;
   link.src = 'data:image/gif,GIF89a%0D%00%0D%00%C2%03%00%00%00%CCaa%DF%C8%C8%F4%FF%FF%FF%FF%FF%FF%FF%FF%FF%FF%FF%FF%FF%FF%FF!%F9%04%01%0A%00%04%00%2C%00%00%00%00%0D%00%0D%00%00%03)8%AA%02%B2%90%81%F9%A2%9A%D8%EA%D8V%1D%CE%D0%00J%00%04%97%93%8D!6%96g%FAt%CC%12n86m%ECg5%BEA%02%00%3B';

   link.addEventListener("click", fnct, true);
   link.id = id;
   if (title)
      link.title = title;

   return link;
}