Open main menu

CDOT Wiki β

Changes

Learning Collaborative Development Lab Fall 2008 Results

1,788 bytes added, 14:07, 9 September 2008
no edit summary
-- [[User:Crulshorukh|Crulshorukh]] 17:46, 9 September 2008 (UTC)
 
----
<b>Pirate Bay Search N Sort</b><br />
by [[User:Ashughes|ashughes]]<br />
 
Perform a search on The Pirate Bay and sort the results.
 
<b>Usage:</b> pirate [<i>search</i>] sort [<i>how to sort</i>]
<pre>
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 );
}
})
</pre>
----
1
edit