Monday, December 16, 2013

Google Drive

<?xml version="1.0" encoding="UTF-8"?><br />
<!-- http://brainglow.com/test/docsgadget.xml --><br />
<Module><br />
<br />
  <ModulePrefs
   title="Google Drive"
   title_url="http://drive.google.com/"
   thumbnail="https://www.google.com/ig/modules/docs-thm.png"
   screenshot="https://www.google.com/ig/modules/docs.png"
   description="Replacement for the broken Google Docs/Drive Gadget for GMail"
   height="180"
   width="600"
   author="Ben Moore"
   ><br />
    <Require feature="dynamic-height"/><br />
    <Require feature="setprefs" /><br />
  </ModulePrefs><br />
  <UserPref name="iframeURL" display_name="URL to content" required="true" default_value="https://docs.google.com/API/IGoogle?container=gm&view=default&lang=en&country=US&sanitize=0&authuser=0&libs=dynamic-height%3Asetprefs%3Acore%3Agoogle.waitforload%3Aauth-refresh&parent=https%3A%2F%2Fmail.google.com%2Fhtml&up_numDocuments=8&up_viewPreference=opened_by_me&mid=1" /><br />
<br />
<Content type="html" view="default,canvas"><![CDATA[
<div id='dest'><img src="https://www.google.com/ig/images/spinner.gif"/></div><script type="text/javascript">
  gadgets.util.registerOnLoadHandler(doRender);

  function doRender(){
    // setup variables
    var prefs = new gadgets.Prefs();
    var iframeURL = prefs.getString('iframeURL');
    var scroll = "no";
    var height = 180;
    var width = 600;

    if (gadgets.window) {
      var viewport = gadgets.window.getViewportDimensions();
      if (viewport.width) {
        width = viewport.width;
//    alert("WV: " + viewport.width);
      }
      if (viewport.height) {
//        height = viewport.height;
//    alert("VH: " + viewport.height);
      }
    }

    var iframe = document.createElement('iframe');
    iframe.setAttribute('width', width + 'px');
    iframe.setAttribute('height', height + 'px');
    iframe.setAttribute('frameborder','no');
    if(scroll){
      iframe.setAttribute('scrolling', scroll);
    }
    iframe.setAttribute('src', iframeURL);

    var dest = document.getElementById('dest');
    dest.innerHTML = ''; // dispose of the spinner
    dest.appendChild(iframe); // and insert the iframe
  }
  </script><br />
]]></Content><br />
</Module>