Learning Collaborative Development Lab Fall 2008 Results
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); } })
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)
Pirate Bay Search N Sort
by ashughes
Perform a search on The Pirate Bay and sort the results.
Usage: pirate [search] sort [how to sort]
CmdUtils.CreateCommand({ name: "pirate", homepage: "http://ashughes.com/", author: { name: "Anthony Hughes", email: "anthony.s.hughes@gmail.com"}, description: "Searches The Pirate Bay and sorts the results", takes: {"search": noun_arb_text}, modifiers: { sort: noun_arb_text }, preview: function(pblock, search, mods) { var msg = 'Searches for "${search}" sorted by ${sort}.'; var subs = {search: search.text, sort: mods.sort.text}; pblock.innerHTML = CmdUtils.renderTemplate(msg, subs); pblock.innerHTML = "<h4><u>HELP</u></h4>" + "<p><b>USAGE:</b>" + "<blockquote>pirate <i>[search term]</i> sort <i>[column to sort by]</i></blockquote></p>" + "<p><b>SORT:</b><ul>" + "<li>leechers - sort by leechers</li>" + "<li>seeders - sort by seeders</li>" + "<li>size - sort by size</li>" + "<li>upload - sort by upload date/time</li>" + "</ul>"; }, execute: function(theSearch, mods) { var msg = theSearch.text + "..Search Complete"; var url = "http://thepiratebay.org/search/" + theSearch.text; if (mods.sort.text == "seeders") { url += "/0/7/0"; } else if (mods.sort.text == "leechers") { url += "/0/9/0"; } else if (mods.sort.text == "upload") { url += "/0/3/0"; } else if (mods.sort.text == "size") { url += "/0/5/0"; } Utils.openUrlInBrowser( url ); } })
Displays users IP address immediately
by AaronMT
Usage: ip
Utilizes the whatismyip website to parse the IP and display it right in the console
CmdUtils.CreateCommand({ name: "ip", homepage: "http://aaronmt.wordpress.com", author: { name: "Aaron Train", email: "aaron.train@gmail.com"}, description: "Displays your internal IP address.", help: "Just type IP", icon: "http://whatismyip.com/favicon.ico", preview: function(pblock) { var url = "http://whatismyip.com/automation/n09230945.asp"; jQuery.get( url, function(data) { pblock.innerHTML = data; }); }, execute: function() { var url = "http://whatismyip.com"; Utils.openUrlInBrowser(url); }, });
Searches Altavista for specified term, modification of John Ford's code
CmdUtils.CreateCommand({ name: "altavista:", takes: {"search terms": noun_arb_text}, preview: function( pblock, searchquery ) { pblock.innerHTML = "<img src='http://us.i1.yimg.com/us.yimg.com/i/us/av/logo_srp.gif' /> Will Search For: " + searchquery.text; }, execute: function( altavistaquery ) { var url = "http://www.altavista.com/web/results?itag=ody&q={QUERY}&kgs=1&kls=0" var query = altavistaquery.text; query = query.replace("+", " "); var urlString = url.replace("{QUERY}", query); Utils.openUrlInBrowser(urlString); } })
--JesseV 23:19, 9 September 2008 (UTC)