Learning Collaborative Development Lab Fall 2008 Results

From CDOT Wiki
Revision as of 14:05, 9 September 2008 by Pplam3 (talk | contribs)
Jump to: navigation, search

Place any and all common results, code, notes here.

Zenit-Wiki Search by Ezadkiel Marbella:

CmdUtils.CreateCommand({
 name: "zenit/wiki specific search:",
 takes: {"search zenit/wiki term": noun_arb_text},
 preview: function( pblock, wikiquery ) {
   pblock.innerHTML = "Will Search For: " + wikiquery.text;
 },
 execute: function( wikiquery ) {
  var url = "http://zenit.senecac.on.ca/wiki/index.php/Special:Search?search={QUERY}&go=Go"
  var query = wikiquery.text;
  var urlString = url.replace("{QUERY}", query);
  Utils.openUrlInBrowser(urlString);
 }
})

This is my submission. I am assuming we are encouraged to reuse code wherever possible. When using the search it is recommended that you separate the terms by + signs as that is what the goggle interface inserts between search terms. I found that it works when spaces are used as well though.

--John64 16:24, 9 September 2008 (UTC)

/*This function is based off Ezadkiel Marbella's code
  http://zenit.senecac.on.ca/wiki/index.php/Learning_Collaborative_Development_Lab_Fall_2008_Results
*/
CmdUtils.CreateCommand({
 name: "zenit-google-search:",
 takes: {"search terms seperated by a '+' sign": noun_arb_text},
 preview: function( pblock, googlequery ) {
   pblock.innerHTML = "Will Search For: " + googlequery.text;
 },
 execute: function( googlequery ) {
  var urlPrefix = "http://www.google.ca/search?hl=en&q=site%3Azenit.senecac.on.ca%2Fwiki+"
  var urlSuffix = "&btnG=Search&meta="
  var query = googlequery.text;
  var urlString = urlPrefix + query + urlSuffix;
  Utils.openUrlInBrowser(urlString);
 }
})

--Patrick Lam

This command opens up the ChatZilla extension and connect to moznet

CmdUtils.CreateCommand({
 name: "irc",
 author: {name: "Patrick Lam"},
 icon: "https://addons.mozilla.org/en-US/firefox/images/addon_icon/16",
 preview: "Starts ChatZilla 0.9.83 and connects to irc://moznet/",
 execute: function() {
   Utils.openUrlInBrowser( "irc://moznet/" );
 }
})

This command goes to any users blog at Blogspot

CmdUtils.CreateCommand({
 name: "blog",
 author: {name: "Patrick Lam"},
 takes: {"user": noun_arb_text},
 icon: "http://pplam3.blogspot.com/favicon.ico",
 preview: "Goes to Blogspot by default or to the specified user's blog",
 execute: function( directObj  ) {
   var preText = "www";
   if (directObj.text != "") {
      preText = directObj.text;
   }
   Utils.openUrlInBrowser( "http://" + preText + ".blogspot.com" );
 }
})

This command goes to either Weekly Schedule or the Planet blog

CmdUtils.CreateCommand({
 name: "osd",
 author: {name: "Patrick Lam"},
 takes: {"blog": noun_arb_text},
 preview: "Goes to OSD600 Weekly Schedule. By typing 'blog' after, it goes to the Planet's Blog",
 execute: function( directObj ) {
   if( directObj.text == "") {
     Utils.openUrlInBrowser( "http://zenit.senecac.on.ca/wiki/index.php/DPS909_and_OSD600_Fall_2008_Weekly_Schedule" );
   }
   else {
     Utils.openUrlInBrowser( "http://zenit.senecac.on.ca/~chris.tyler/planet/" );
   }
 }
})

This goes to the printable version of the current wiki page

CmdUtils.CreateCommand({
 name: "print",
 author: {name: "Patrick Lam"},
 preview: "Takes the current wiki page and make it printable",
 execute: function() {
   var currentPath = CmdUtils.getDocumentInsecure().location.href;

   var wikiHome = currentPath.substring(0, currentPath.lastIndexOf("/"));

   /* Gets the title of the document in wiki */
   var wikiTitle = currentPath.substring(currentPath.lastIndexOf("/") + 1);

   /* Makes the printable version url */
   var printURL = wikiHome + "?title=" + wikiTitle + "&printable=yes";

   Utils.openUrlInBrowser( printURL );
 }
})

Searches the XKCD archives for whatever term you enter. Not complex, but can be enjoyable.

CmdUtils.CreateCommand({
	name: "xkcd",
	homepage: "http://belligero.org",
	author: {name: "Jason", email: "slokun@belligero.org"},
	license: "MPL",
	
	description: "Search XKCD",
	takes: {"phrase": noun_arb_text},
	_getSearchUrl: function(term) {
		return "http://www.ohnorobot.com/?comic=56&s="+term;
	},
	
	/* Preview */
	preview: function(pblock, theSearch) {
		var msg = "<img src='http://imgs.xkcd.com/static/xkcdLogo.png'>"+
		"
Search the XKCD archives for "+theSearch.text+""; pblock.innerHTML = msg; }, execute: function(theSearch) { var msg = "Search completed for "+theSearch.text+"..."; Utils.openUrlInBrowser(this._getSearchUrl(theSearch.text)); displayMessage(msg); } })

--Jtarka 17:05, 9 September 2008 (UTC)


Goto a specified users blog on wordpress, modification of Patrick Lam's code

CmdUtils.CreateCommand({
 name: "wpblog",
 takes: {"user": noun_arb_text},
 preview: "Goes to the specified user's blog on wordpress",
 execute: function(directObj) {
   var subdomain = "www";
   if (directObj.text != "") {
      subdomain = directObj.text;
   }
   Utils.openUrlInBrowser( "http://" + subdomain + ".wordpress.com" );
 }
})

--nadavers 17:16, 9 September 2008 (UTC)


Simple command, goes to edit a user's page.
CmdUtils.CreateCommand( {
  name: "EditUserPage",
  author: {name: "Tony Lai"},
  takes: {"user": noun_arb_text},
  preview: function (pblock, user) {
     pblock.innerHTML = "Edits " + user + "'s profile page if the user's page exists";
  },
  execute: function (user) {
     var url = "http://zenit.senecac.on.ca/wiki/index.php?title=User:" + user.text + "&action=edit";
     Utils.openUrlInBrowser(url);
  }
})

--twlai1 17:24, 9 September 2008 (UTC)


Modified version of zenit/wiki search. This searches the zenit/wiki users
CmdUtils.CreateCommand({
 name: "zenit/wiki user search:",
 takes: {"search zenit/wiki user": noun_arb_text},
 preview: function( pblock, wikiquery ) {
   pblock.innerHTML = "Searching For: " + wikiquery.text;
 },
 execute: function( wikiquery ) {
  var url = "http://zenit.senecac.on.ca/wiki/index.php/Special:Search?ns2=1&search={QUERY}&searchx=Search";
  var query = wikiquery.text;
  var urlString = url.replace("{QUERY}", query);
  Utils.openUrlInBrowser(urlString);
 }
})

-- Crulshorukh 17:46, 9 September 2008 (UTC)