Learning Collaborative Development Lab Fall 2008 Results

From CDOT Wiki
Revision as of 12:27, 9 September 2008 by John64 (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);
 }
})