Labs/Bespin/Commands/Doctype

From MozillaWiki
< Labs‎ | Bespin‎ | Commands
Jump to: navigation, search
 /*
  * The doctype command takes a section, which is the WikiWordSection 
  * that must be one of the items on this list:
  * http://code.google.com/p/doctype/w/list
  *
  * It grabs the data and puts it up in an inline popup
  *
  * E.g. doctype DivElement
  */
 {
   name: 'doctype',
   takes: ['section'], // part on the Wiki
   preview: 'grab the doctype info for a section<br><br><em><a href="http://code.google.com/p/doctype/w/list" target="_blank">See full list</a>',
   completeText: 'can you give me the Doctype wiki section?<br><br><em><a href="http://code.google.com/p/doctype/w/list" target="_blank">See full list</a>',
   execute: function(self, section) {
       if (!section) section = "Welcome";
       var el = dojo.byId('centerpopup');
       el.innerHTML = "<table width='100%'><tr><td><em>Showing information from <a href='http://code.coogle.com/doctype'>Google Doctype</a> for '" + section + "'</em></td><td align='right' style='font-size: smaller; color: #ddd; cursor: pointer'>close popup</a></td></tr></table><div style='background-color: #fff; border: 1px solid #000;'><iframe src='http://code.google.com/p/doctype/wiki/" + section + "?show=content' height='95%' width='100%' border='none' frameborder='0'></iframe></div>";
       el.style.width = "80%";
       el.style.height = "80%";
       dojo.require("dijit._base.place");
       dojo.require("bespin.util.webpieces");
 
       bespin.util.webpieces.showCenterPopup(el);
       
       dojo.byId("overlay").onclick = el.onclick = function() {
           bespin.util.webpieces.hideCenterPopup(el);
       };        
   }
 }