1
edit
Changes
→show time in
==Introduction==
These are the results for the [[DPS909]]/[[OSD600]] [[Learning Collaborative Development Lab Fall 2008|lab 1]]. Place any and all common results, code, notes here.
====Zenit Wiki Search====
[http://matrix.senecac.on.ca/%7Eevmarbella/ Zenit-Wiki Search] by [http://zadkielm.blogspot.com/2008/09/lab-in-ubiquityin-search-of.html Ezadkiel Marbella]:
----
====Zenit Google Search====
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.
----
====Open irc====
--[[User:pplam3|Patrick Lam]]
})
====Goto blogspot user====
This command goes to any users blog at Blogspot
CmdUtils.CreateCommand({
})
====Goto Planet or Schedule====
This command goes to either Weekly Schedule or the Planet blog
CmdUtils.CreateCommand({
Utils.openUrlInBrowser( "http://zenit.senecac.on.ca/~chris.tyler/planet/" );
}
}
})
====Print current wiki page====
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 );
}
})
----
====Search XKCD====
Searches the XKCD archives for whatever term you enter. Not complex, but can be enjoyable.
CmdUtils.CreateCommand({
----
====Goto a wordpress blog====
Goto a specified users blog on wordpress, modification of Patrick Lam's code
--[[User:nadavers|nadavers]] 17:16, 9 September 2008 (UTC)
---- Simple command, goes to edit a user's page.
var url = "http://zenit.senecac.on.ca/wiki/index.php?title=User:" + user.text + "&action=edit";
Utils.openUrlInBrowser(url);
}
})
--[[User:twlai1|twlai1]] 17:24, 9 September 2008 (UTC)
====Search for wiki user====
---- <b>By Sid Kalra</b><br />Modified version of zenit/wiki search. This searches the zenit/wiki users
<pre>
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);
}
})
</pre>
-- [[User:Crulshorukh|Crulshorukh]] 17:46, 9 September 2008 (UTC)
====Search wowhead====
<pre>
CmdUtils.CreateCommand({
name: "wowhead search:",
homepage: "http://sidkalra.com/",
author: { name: "Sid Kalra" },
description: "Searches wowhead and sorts the results",
takes: {"search": noun_arb_text},
modifiers: {
sort: noun_arb_text
},
preview: function(pblock, search1, modifier){
var message = 'Searching for ${search} sorting by ${sort}';
},
execute: function(search, mods) {
var url = "http://www.wowhead.com/?search={QUERY}";
var query = search.text;
var urlString = url.replace("{QUERY}", query);
urlString += "#" + mods.sort.text;
Utils.openUrlInBrowser(urlString);
}
})
</pre>
-- [[User:Crulshorukh|Crulshorukh]] 00:48, 10 September 2008 (UTC)
----
====Search Pirate Bay====
<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>
----
====Display IP address====
<b>Displays users IP address immediately</b><br />
by [[User:AaronMT|AaronMT]]<br />
<b>Usage:</b> ip
Utilizes the whatismyip website to parse the IP and display it right in the console
<pre>
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);
},
});
</pre>
====Search Altavista====
----Searches Altavista for specified term, modification of Ezadkiel Marbella's code
<pre>
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);
}
})
</pre>
--[[User:JesseV|JesseV]] 23:19, 9 September 2008 (UTC)
----
====Google Map Directions====
[http://matrix.senecac.on.ca/~cbishop2/ubiquity.html Google Map Directions] by [http://zenit.senecac.on.ca/wiki/index.php/User:Cbishop2 Chris Bishop]
<pre>
CmdUtils.CreateCommand(
{
author: { name: "Chris Bishop", email: "dee132@gmail.com" },
description: "Will direct to a page displaying the directions to the addresses supplied by the user.",
help: "There needs to be atleast one address and each address must end with a semi-colon.",
name: "Map-Directions",
takes: {from: noun_arb_text},
// load map page
execute: function ( directObj )
{
// get the second element which is an object with source
// and destination addresses
var params = this._getAddresses( directObj.text )[1];
// make sure that there is a source address
if ( params != null )
{
var url = "http://maps.google.com/?";
// change the object attributes into url parameters
url += jQuery.param( params );
// open in a new window
Utils.openUrlInBrowser( url );
}
else
{
// error message for no address supplied
displayMessage( "An address has not been inputed. Example is: New York; " );
}
}, // execute
// gets the addresses from the supplied text
_getAddresses: function( text )
{
// check if there are no valid addresses
if ( text.indexOf( ";" ) == - 1 )
{
return [];
}
// split the addresses based on a semi colon
var addrs = text.split(";");
var directions = null;
var params = {};
// set the first address to be the from address
directions = "from: " + addrs[ 0 ];
params.saddr = addrs[ 0 ];
// loop through the rest of the addresses and add them
// to the directions or parameters
for ( var idx = 1; idx < addrs.length - 1; idx++ )
{
directions += " to: " + addrs[ idx ];
if ( idx == 1 )
{
params.daddr = addrs[ idx ];
}
else
{
params.daddr += "+to:" + addrs[ idx ];
}
}
// return both the directions and parameters
return [directions,params];
}, // _getAddresses
// load a preview map
preview: function ( pblock, directObj )
{
var text = directObj.text;
var directions = this._getAddresses( text )[0];
// check if a null address was returned
if ( directions != null )
{
pblock.innerHTML = directions;
}
else
{
pblock.innerHTML = "Enter an address followed by a semi-colon for each address to ";
pblock.innerHTML += "find directions to.<br />";
pblock.innerHTML += "Example. New York; Chicago; Miami;";
pblock.innerHTML += "<br /><br />Each Address must end with a semi-colon.";
}
} // preview
}
)
</pre>
I'll probably continue to work on it. Add some dynamic CSS to the preview div. <br />
I was successful at adding a preview. Check the link above for the updated version.
--[[User:Cbishop2|Cbishop2]] 01:05, 10 September 2008 (UTC)
----
====Chris Bishop's Google Map Directions Ver 1.1====
<b></b>
by [[User:kwpark1|Park KiWon]]<br />
Add two functions: do not need to type ';' end of 'To:' position, and preview the map.
<pre>
CmdUtils.CreateCommand(
{
author: { name: "Park, KiWon", email: "kwpark1@gmail.com" },
description: "Will direct to a page displaying the directions to the addresses supplied by the user.",
//Original Version Chris Bishop's
//Google Map Directions (dee132@gmail.com)
//
//2009-09-12 add two functions:
// - do not need tying ';' end of "To" position
// ex)
// Before) Map-Directions Seneca;New York;
// Modify) Map-Directions Seneca;New York
// - map preview:
// add new function :_preViewMap()
//
help: "There needs to be atleast one address and each address must end with a semi-colon.",
name: "Map-Directions",
takes: {from: noun_arb_text},
icon: "chrome://ubiquity/content/icons/map.png",
//*************************************************//
// it displays map on the Ubiquity window.
// thic code copies from builtin command 'map' function
//*************************************************//
_preViewMap:function(pblock,location)
{
CmdUtils.showPreviewFromFile( pblock,
"templates/map.html",
function(winInsecure) {
winInsecure.setPreview( location );
winInsecure.insertHtml = function(html) {
var doc = context.focusedWindow.document;
var focused = context.focusedElement;
// This would be nice to store the map in the buffer...
// But for now, it causes a problem with a large image showing up as the default
//CmdUtils.setLastResult( html );
if (doc.designMode == "on") {
doc.execCommand("insertHTML", false, location + "<br/>" + html);
}
else if (CmdUtils.getSelection()) {
CmdUtils.setSelection(html);
}
else {
displayMessage("Cannot insert in a non-editable space. Use 'edit page' for an editable page.");
}
};});
},
//*************************************************//
// load map page
execute: function ( directObj )
{
// get the second element which is an object with source
// and destination addresses
var params = this._getAddresses( directObj.text )[1];
// make sure that there is a source address
if ( params != null )
{
var url = "http://maps.google.com/?";
// change the object attributes into url parameters
url += jQuery.param( params );
// open in a new window
Utils.openUrlInBrowser( url );
}
else
{
// error message for no address supplied
displayMessage( "An address has not been inputed. Example is: New York; " );
}
}, // execute
// gets the addresses from the supplied text
_getAddresses: function( text )
{
// check if there are no valid addresses
if ( text.indexOf( ";" ) == - 1 )
{
return [];
}
//*************************************************//
//if a user dose not type ";" at the end
//*************************************************//
if( text.indexOf(";") != text.length -1 )
{
text+=";";
}
//*************************************************//
// split the addresses based on a semi colon
var addrs = text.split(";");
var directions = null;
var params = {};
// set the first address to be the from address
directions = "from: " + addrs[ 0 ];
params.saddr = addrs[ 0 ];
// loop through the rest of the addresses and add them
// to the directions or parameters
for ( var idx = 1; idx < addrs.length - 1; idx++ )
{
directions += " to: " + addrs[ idx ];
if ( idx == 1 )
{
params.daddr = addrs[ idx ];
}
else
{
params.daddr += "+to:" + addrs[ idx ];
}
}
// return both the directions and parameters
return [directions,params];
}, // _getAddresses
// load a preview map
preview: function ( pblock, directObj )
{
var text = directObj.text;
var directions = this._getAddresses( text )[0];
// check if a null address was returned
if ( directions != null )
{
pblock.innerHTML = directions;
}
else
{
pblock.innerHTML = "Enter an address followed by a semi-colon for each address to ";
pblock.innerHTML += "find directions to.<br />";
pblock.innerHTML += "Example. New York; Chicago; Miami;";
pblock.innerHTML += "<br /><br />Each Address must end with a semi-colon.";
}
//*************************************************//
// it displays only current area's map
// ex) Map-Directions Seneca <-- display seneca
// Map-Directions Seneca;New York <-- display New York
//*************************************************//
if ( text != null )
{
var disPlayLocation = null;
if(text.indexOf(";") < 0 ) //has value, it means desplay "TO" position
{
disPlayLocation = text;
}
else // display "from" position
{
disPlayLocation = text.substring(text.lastIndexOf(";"));
}
this._preViewMap(pblock,disPlayLocation);
}
//*************************************************//
} // preview
}
)
</pre>
<br />
------
====Search MedicineNet====
<b>Searches MedicineNet with a given keyword</b>
by [[User:AaronMT|AaronMT]]<br />
<b>Usage:</b> health <i>keyword phrase</i>
<pre>CmdUtils.CreateCommand(
{
name: "health",
homepage: "http://medicinenet.com",
author: { name: "Aaron Train", email: "aaron.train@gmail.com" },
description: "Takes keyword phrase and searches MedicineNet",
help: "health <i>keyword phrase</i>",
icon: "http://images.medicinenet.com/images/fav/MN.ico",
takes: {"Enter a noun": noun_arb_text},
preview: function(pblock, keywordPhrase)
{
pblock.innerHTML = "Search the MedicineNet by entering any phrase <b>" + keywordPhrase.text + "</b>"
},
execute: function(keywordPhrase)
{
var searchURL = "http://www.medicinenet.com/" + keywordPhrase.text;
Utils.openUrlInBrowser(searchURL);
}
});
</pre>
<br>
------
====Search cnet.com====
<br> So I reused Ezadkiel Marbella's code and made code for searching cnet.com. this thing is so much fun I am thinking about making something else too.<br>
- Zaid Ghansar 11th September 2008
<br>
<pre>
CmdUtils.CreateCommand({
name: "cnet",
author: { name: "Zaid Ghansar" },
description: "Searches cnet.com.",
help: "searches for a highlighted term or typed term at cnet.com",
takes: {"search terms": noun_arb_text},
preview: function( pblock, searchquery ) {
pblock.innerHTML = "<img src='http://i.afterdawn.com/v3/news/cnet_logo.gif' /> Will Search For: " + searchquery.text;
},
execute: function( cnetquery ) {
var url = "http://www.cnet.com/1770-5_1-0.html?query={QUERY}&tag=srch"
var query = cnetquery.text;
query = query.replace("+", " ");
var urlString = url.replace("{QUERY}", query);
Utils.openUrlInBrowser(urlString);
}
})
</pre>
====Get NASDAQ quote====
and another for getting NASDAQ stock quotes:
<pre>
CmdUtils.CreateCommand({
name: "nasdaq",
author: { name: "Zaid Ghansar" },
description: "Shows current NASDAQ stock value.",
help: "searches for a stocks current vallue at NASDAQ using google",
takes: {"search stock": noun_arb_text},
preview: function( pblock, searchquery ) {
pblock.innerHTML = "<img src='http://www.buylow-sellhigh.com/images/NASDAQ_logo.gif' /> Will Search For: " + searchquery.text;
},
execute: function( query ) {
var url = "http://finance.google.com/finance?client=ob&q=NASDAQ:" + query.text;
Utils.openUrlInBrowser(url);
}
})
</pre>
<br>
----
====Seneca Library Search====
[http://matrix.senecac.on.ca/~jwboston/ubiquity/ seneca-library-search]<br />
by [http://jamesboston.ca James Boston]<br />
Search the Seneca College Library<br />
'''Usage''': seneca-library-search (search term)<br />
CmdUtils.CreateCommand({
name: "seneca-library-search",
takes: {"your search term": noun_arb_text},
preview: function( pblock, theSearch ) {
pblock.innerHTML = "Will look for: " + theSearch.text;
},
execute: function( theSearch ) {
var baseUrl = "http://libcat.senecac.on.ca/cgi-bin/Pwebrecon.cgi";
var params = Utils.paramsToString({
CNT: "50",
DB: "local",
SL: "Submit&LOCA=Books+(no+eResources)|5",
Search_Arg: theSearch.text,
Search_Code: "FT*"
});
Utils.openUrlInBrowser(baseUrl+params);
}
})
----
====Paste to pastebin====
[http://matrix.senecac.on.ca/~jwboston/ubiquity/ pastebin]<br />
by [http://jamesboston.ca James Boston]<br />
Send highlighted text to pastebin<br />
'''Usage''': pastebin (code)<br />
CmdUtils.CreateCommand({
name: "pastebin",
takes: {"your code": noun_arb_text},
preview: function( pblock, theCode ) {
pblock.innerHTML = "Will paste: " + theCode.text;
},
execute: function( theCode ) {
var baseUrl = "http://pastebin.mozilla.org";
// var params = Utils.paramsToString({code2: theCode.text, parent_pid: ""});
var params = {
format: "text",
poster: "ubiquity",
expiry: "m",
code2: theCode.text,
paste: "Send"
};
jQuery.post( baseUrl, params, function(html) {
var re = /dl=(.+?)"/;
var pid = re.exec(html);
if (pid) {
displayMessage(pid[1]);
Utils.openUrlInBrowser("http://pastebin.mozilla.org/"+pid[1]);
}
else {
displayMessage("Failure!");
}
});
}
})
<br>
----
====Get timezone====
["Now in" timezone]<br />
by [http://felisfelis.blogspot.com/ Irina Sh.]<br />
Tells you what time is it now in (city). Suggests some of them when you type the first letter(s) <br />
'''Usage''': Now-in (city)<br />
v.0.1, must be fixed for using winter-summer time...<br />
noun_type_city = new CmdUtils.NounType( "City", ["Abidjan","Abu Dhabi","Adana","AddisAbaba","Adelaide*","Aden","Aklavik","Aleutian","Alexandria","Algiers","Amsterdam","Anadyr","Anchorage","Ankara","Antananarivo","Antwerp","Asuncion *","Athens","Atlanta","Auckland *","Aveiro","Baghdad","Bamako","Bandar Seri Begawan","Bangkok","Bangui","Banjul","Barcelona","Barranquilla","Beijing","Beirut","Belgrade","Belize City","Berlin","Blantyre","Bogota","Bologna","Bombay - Mumbai","Brasilia","Bratislava","Brazzaville","Bridgetown","Brisbane","Brussels","Bucharest","Budapest","Buenos Aires","Bujumbura","Cairo","Calcutta","Calgary","Cali","Cape Town","Caracas","Cebu","Chicago","Christchurch","Colombo","Conakry","Copenhagen","Cotonou","Dakar","Dallas","Darwin","Delhi","Detroit","Dhaka","Djibouti","Dover","Dubai","Dublin","Dusseldorf","Edmonton","Fairbanks","Florence","Fort de France","Frankfurt","Freetown","Gaborone","Geneva","Gibraltar","Scotland","GMT","Guatemala City","Guayaquil","Hamilton","Harare","Havana","Helsinki","Hobart","Hong Kong","Honolulu","Indianapolis","Ipswich","Islamabad","Istanbul","Jakarta","Jerusalem","Johannesburg","Kabul","Kaduna","Kahira","Kamchatka","Kano","Karachi","Kathmandu","Kiev","Kigali","Kingston","Kinshasa","Kobe","Kosice","Kuala Lumpur","Kuwait City","Kyoto","La Paz","Lagos","Libreville","Lima","Limon","Lisbon","Lome","London","Los Angeles","Lubumbashi","Luxembourg","Madrid","Manama","Manila","Maracaibo","Maseru","Mayaguez","Mbabane","Medan","Medellin","Melbourne *","Mexico City","Milan","Mogadishu","Mombasa","Monrovia","Monte Carlo","Montevideo","Montreal","Morgantown","Moscow","Mumbai - Bombay","Munich","Murmansk","Muscat","N'Djamena","Nagasaki","Nagoya","Nairobi","Naples","Nassau","New Hebrides","New York City","Newfoundland","Niamey","Nice","Nicosia","Nome","Nottingham","Nouakchott","Nuk","Odessa","Oran","Osaka","Oslo","Ottawa","Ouagadougou","Oulu","Oxford","Palma","Panjim","Paramaribo","Paris","Peking","Perth","Phoenix","Ponce","Port Louis","Port Moresby","Port of Spain","Prague","Praia","Puntarenas","Quebec","Quito","Rangoon","Reykjavik","Riga","Rio de Janeiro","Riyadh","Rome","Saigon","Saint Petersburg - Leningrad","Salt Lake City","Salzburg","San Francisco","San Jose","San Juan","Santa Cruz de Tenerife","Santiago *","Santo Domingo","Sao Paulo","Sapporo","Sarajevo","Seattle","Seoul","Shanghai","Singapore","Sofia","Stockholm","Stuttgart","Surabaya","Suva","Sydney *","Taipei","Tallinn","Tampere","Tashkent","Tegucigalpa","Tehran","Tel Aviv","Tokyo","Toronto","Tripoli","Tunis","Turin","Ulanbatar","Valletta","Vancouver","Vatican","Venice","Victoria Falls","Vienna","Vientiane","Vladimir","Vladivostok","Warsaw","Washington DC","Wellington","Winnipeg","Yalta","Zagreb","Zaragoza","Zurich"] );
var timezone = new Array(); timezone["abidjan"] = +0; timezone["abu dhabi"] = +4; timezone["adana"] = +2; timezone["addis ababa"] = +3; timezone["adelaide *"] = +10; timezone["aden"] = +3; timezone["aklavik"] = -9; timezone["aleutian"] = -10; timezone["alexandria"] = +2; timezone["algiers"] = +0; timezone["amsterdam"] = +1; timezone["anadyr"] = +13; timezone["anchorage"] = -9; timezone["ankara"] = +2; timezone["antananarivo"] = +3; timezone["antwerp"] = +0; timezone["asuncion *"] = -3; timezone["athens"] = +2; timezone["atlanta"] = +5; timezone["auckland *"] = +12; timezone["aveiro"] = +0; timezone["baghdad"] = +3; timezone["bamako"] = +0; timezone["bandar seri begawan"] = +8; timezone["bangkok"] = +7; timezone["bangui"] = +1; timezone["banjul"] = +1; timezone["barcelona"] = +1; timezone["barranquilla"] = -5; timezone["beijing"] = +8; timezone["beirut"] = +2; timezone["belgrade"] = +1; timezone["belize city"] = -5; timezone["berlin"] = +1; timezone["blantyre"] = +2; timezone["bogota"] = -5; timezone["bologna"] = +2; timezone["bombay - mumbai"] = +6; timezone["brasilia"] = -3; timezone["bratislava"] = +1; timezone["brazzaville"] = +0; timezone["bridgetown"] = -4; timezone["brisbane"] = +10; timezone["brussels"] = +1; timezone["bucharest"] = +2; timezone["budapest"] = +1; timezone["buenos aires"] = -3; timezone["bujumbura"] = +2; timezone["cairo"] = +2; timezone["calcutta"] = +6; timezone["calgary"] = -6; timezone["cali"] = +0; timezone["cape town"] = +1; timezone["caracas"] = -4; timezone["cebu"] = +8; timezone["chicago"] = -6; timezone["christchurch"] = +12; timezone["colombo"] = +5; timezone["conakry"] = +0; timezone["copenhagen"] = +1; timezone["cotonou"] = +0; timezone["dakar"] = +0; timezone["dallas"] = -6; timezone["darwin"] = +10; timezone["delhi"] = +5; timezone["detroit"] = -5; timezone["dhaka"] = +6; timezone["djibouti"] = +2; timezone["dover"] = -5; timezone["dubai"] = +3; timezone["dublin"] = +0; timezone["dusseldorf"] = +1; timezone["edmonton"] = -7; timezone["fairbanks"] = -9; timezone["florence"] = +2; timezone["fort de france"] = -4; timezone["frankfurt"] = +1; timezone["freetown"] = +0; timezone["gaborone"] = +1; timezone["geneva"] = +1; timezone["gibraltar"] = +1; timezone["scotland"] = +0; timezone["gmt"] = +0; timezone["guatemala city"] = -6; timezone["guayaquil"] = -5; timezone["hamilton"] = -4; timezone["harare"] = +2; timezone["havana"] = -5; timezone["helsinki"] = +2; timezone["hobart"] = +10; timezone["hong kong"] = +8; timezone["honolulu"] = -10; timezone["indianapolis"] = -5; timezone["ipswich"] = +10; timezone["islamabad"] = +5; timezone["istanbul"] = +2; timezone["jakarta"] = +7; timezone["jerusalem"] = +2; timezone["johannesburg"] = +2; timezone["kabul"] = +5; timezone["kaduna"] = +0; timezone["kahira"] = +2; timezone["kamchatka"] = +11; timezone["kano"] = +1; timezone["karachi"] = +5; timezone["kathmandu"] = +6; timezone["kiev"] = +3; timezone["kigali"] = +1; timezone["kingston"] = -5; timezone["kinshasa"] = +1; timezone["kobe"] = +9; timezone["kosice"] = +1; timezone["kuala lumpur"] = +8; timezone["kuwait city"] = +3; timezone["kyoto"] = +9; timezone["la paz"] = -5; timezone["lagos"] = +1; timezone["libreville"] = +0; timezone["lima"] = -5; timezone["limon"] = -5; timezone["lisbon"] = +0; timezone["lome"] = +0; timezone["london"] = +0; timezone["los angeles"] = -8; timezone["lubumbashi"] = +1; timezone["luxembourg"] = +1; timezone["madrid"] = +1; timezone["manama"] = +3; timezone["manila"] = +8; timezone["maracaibo"] = -5; timezone["maseru"] = +2; timezone["mayaguez"] = -4; timezone["mbabane"] = +2; timezone["medan"] = +8; timezone["medellin"] = -5; timezone["melbourne *"] = +10; timezone["mexico city"] = -6; timezone["milan"] = +1; timezone["mogadishu"] = +3; timezone["mombasa"] = +3; timezone["monrovia"] = +0; timezone["monte carlo"] = +1; timezone["montevideo"] = -3; timezone["montreal"] = -5; timezone["morgantown"] = -5; timezone["moscow"] = +3; timezone["mumbai - bombay"] = +5; timezone["munich"] = +1; timezone["murmansk"] = +2; timezone["muscat"] = +3; timezone["n'djamena"] = +0; timezone["nagasaki"] = +9; timezone["nagoya"] = +9; timezone["nairobi"] = +3; timezone["naples"] = +1; timezone["nassau"] = -5; timezone["new hebrides"] = +11; timezone["new york city"] = -5; timezone["newfoundland"] = -3; timezone["niamey"] = +0; timezone["nice"] = +1; timezone["nicosia"] = +2; timezone["nome"] = -9; timezone["nottingham"] = +0; timezone["nouakchott"] = +0; timezone["nuk"] = -3; timezone["odessa"] = +3; timezone["oran"] = +0; timezone["osaka"] = +9; timezone["oslo"] = +1; timezone["ottawa"] = -5; timezone["ouagadougou"] = +0; timezone["oulu"] = +2; timezone["oxford"] = +0; timezone["palma"] = +1; timezone["panjim"] = +5; timezone["paramaribo"] = -4; timezone["paris"] = +1; timezone["peking"] = +8; timezone["perth"] = +8; timezone["phoenix"] = -7; timezone["ponce"] = -4; timezone["port louis"] = +4; timezone["port moresby"] = +10; timezone["port of spain"] = -4; timezone["prague"] = +1; timezone["praia"] = -2; timezone["puntarenas"] = -5; timezone["quebec"] = -5; timezone["quito"] = -5; timezone["rangoon"] = +7; timezone["reykjavik"] = -1; timezone["riga"] = +4; timezone["rio de janeiro"] = -3; timezone["riyadh"] = +3; timezone["rome"] = +1; timezone["saigon"] = +7; timezone["saint petersburg - leningrad"] = +3; timezone["salt lake city"] = -7; timezone["salzburg"] = +1; timezone["san francisco"] = -8; timezone["san jose"] = -6; timezone["san juan"] = -4; timezone["santa cruz de tenerife"] = +0; timezone["santiago *"] = -3; timezone["santo domingo"] = -4; timezone["sao paulo"] = -3; timezone["sapporo"] = +9; timezone["sarajevo"] = +1; timezone["seattle"] = -8; timezone["seoul"] = +9; timezone["shanghai"] = +8; timezone["singapore"] = +8; timezone["sofia"] = +2; timezone["stockholm"] = +1; timezone["stuttgart"] = +1; timezone["surabaya"] = +7; timezone["suva"] = +12; timezone["sydney *"] = +11; timezone["taipei"] = +8; timezone["tallinn"] = +2; timezone["tampere"] = +2; timezone["tashkent"] = +3; timezone["tegucigalpa"] = -5; timezone["tehran"] = +4; timezone["tel aviv"] = +2; timezone["tokyo"] = +9; timezone["toronto"] = -5; timezone["tripoli"] = +1; timezone["tunis"] = +1; timezone["turin"] = +1; timezone["ulanbatar"] = +8; timezone["valletta"] = +1; timezone["vancouver"] = -8; timezone["vatican"] = +1; timezone["venice"] = +1; timezone["victoria falls"] = +2; timezone["vienna"] = +1; timezone["vientiane"] = +7; timezone["vladimir"] = +3; timezone["vladivostok"] = +10; timezone["warsaw"] = +1; timezone["washington dc"] = -5; timezone["wellington"] = +12; timezone["winnipeg"] = -6; timezone["yalta"] = +3; timezone["zagreb"] = +1; timezone["zaragoza"] = +1; timezone["zurich"] = +1;
CmdUtils.CreateCommand({
name: "now-in",
takes: {"city": noun_type_city},
execute: function nowIn(city) {
var localDate = new Date();
var localTime = localDate.getTime();
var localOffset = localDate.getTimezoneOffset() * 60000;
var utc = localTime + localOffset;
var offset = timezone[city.text];
var tz = utc + (3600000*offset);
var now = new Date(tz);
displayMessage( "Now in " + city.text + " : " + now.toLocaleString() );
}
})
----
====Timer====
Written by: [[User:Scott|Scott Lunel]] <br />
For this lab I was interested to see whether or not it would be possible to run a delayed command under Ubiquity. I've recently<br />been dealing with threads and sleeping them in C++.<br /><br />
At first I attempted something along the lines of:<br />
<br />
<pre>
CmdUtils.CreateCommand({
name: "Timer",
author: "Scott Lunel",
takes: {"Time": noun_arb_text},
preview: "A simple timer that executes a message to the user after the entered time period.",
execute: function(directObj) {
var start = new Date().getTime();
var cur = start;
var secDuration = start + parseInt(directObj.text);
while(parseInt(cur) < parseInt(secDuration)){
cur = new Date().getTime();
}
displayMessage( "Time's Up!" );
}
})</pre>
<br />
However this wasn't exactly what I was looking for because it caused the browser to freeze while the command was running.<br /><br />
I did a little more looking and found this method instead:<br />
<br />
<pre>
CmdUtils.CreateCommand({
name: "Timer",
author: "Scott Lunel",
takes: {"Time": noun_arb_text},
preview: "A simple timer that executes a message to the user after the entered time period.",
execute: function(directObj) {
Utils.setTimeout(function() { displayMessage("Time's Up!"); }, parseInt(directObj.text));
}
})
</pre>
<br />
Unlike the previous command, it will not freeze the browser while the timed command is being performed.<br />
---
----
====Simple Google Image Search====
[[User:jsdoodna|Joshua Doodnauth]]
<br />
Simple Google Image Search, working on retrieving some images to for preview
CmdUtils.CreateCommand({
name: "image-search",
author: {name:"Joshua Doodnauth", email:"jsdoodnauth@gmail.com"},
licence: "GPL",
description: "Searches for images on Google",
takes: {"image-search": noun_arb_text},
preview: function(pblock, imSearch) {
pblock.innerHTML = "Google Image Search: " + imSearch.text +" <br /><img src='http://www.google.ca/intl/en_ALL/images/images_hp.gif' width='150' />";
},
execute: function(imSearch) {
var URL = "http://images.google.ca/images?gbv=2&hl=en&safe=on&q={QUERY}&btnG=Search+Images";
var query = imSearch.text;
var searchStr = URL.replace("{QUERY}",query);
Utils.openUrlInBrowser(searchStr);
}
})
====Cuil Search====
[[User:cdpatel1|Chinmay Patel]]
<br />
Cuil is the new sensation in the search market. Cuil is the search engine for the future. That's why I have just implemented the search for CUIL. This is so simple but I'll try to make it better, efficient and useful.
The code is totally based on Zed's code(except only one line). It has just better Documentation.
CmdUtils.CreateCommand({
// Name of the Command
name: "cuil",
// Homepage
homepage: "http://zenit.senecac.on.ca/wiki/index.php/User:Cdpatel1",
// Author
author: { name: "Chinmay Patel", email: "cdpatel1@learn.senecac.on.ca"},
// Contributors
contributors: ["Chinmay Patel"],
// License
license: "Open For ALL ... any time ... any where ... in all conditions",
// Input from selection
takes: {"search zenit/wiki term": noun_arb_text},
/* Preview of the Command */
preview: function( previewBlock, searchQuery ) {
// HTML part for the preview block
previewBlock.innerHTML = "Search for" + searchQuery.text;
},
/* Execute Function*/
execute: function( searchQuery ) {
// Searching URL from cuil website. I just copied this URL from a search in CUIL
var url = "http://www.cuil.com/search?q={QUERY}"
// Putting our serching term in a variable
var query = searchQuery.text;
// replacing {QUERY} with the search terms
var urlString = url.replace("{QUERY}", query);
// When press enter, open new window with URL of urlString.
Utils.openUrlInBrowser(urlString);
}
})
----
====Go to a specific web page using Aliases or URL====
[[User:Hellwolf36]]
This add-on allows you to go to a specific web page using goto (url). You may also specify an alias that will take you to a different location without having to specify the complete URL (to add on your own, you must add on to the source array, and to the noun listing.
noun_type_link = new CmdUtils.NounType( "link",["blog","facebook","mail","google","battleforums",
"south-park","japtoeng","wwe","zy-el","zenit-wiki", "pso",
"d2m", "nezmod", "schtserv", "mySeneca","Senecamail",
"orderofthestick", "8bit", "news"]);
CmdUtils.CreateCommand({ name: "goto",
takes: {url: noun_type_link},
description: "Causes the browser to open a specific webpage via URL or Keywords",
//Original author: {name: "benny sheerin"}, url: "http://www.bennysheerin.com/cmd_news.js",
//This Version Author
author: {name: "Chris Cameirao"}, url: 'http://zenit.senecac.on.ca/wiki/',
preview: function(preview,vendor)
{
if(vendor.text != "") {
{
preview.innerHTML = "Opens "+vendor.text+" in a new window or tab.";
}
else
{
preview.innerHTML = "Opens the selected URL in a new window or tab.";
},
execute: function(vendor)
{ //Site listing
//Keywords
var sources = new Array();
sources['facebook'] = 'http://www.facebook.com/';
sources['mail'] = 'http://www.hotmail.com/';
sources['google'] = 'http://www.google.com/';
sources['battleforums'] = 'http://www.battleforums.com/';
sources['wwe'] = 'http://www.wwe.com/';
sources['zy-el'] = 'http://http://zyel.wikispaces.com/';
sources['zenit-wiki'] = 'http://zenit.senecac.on.ca/wiki/';
sources['homepage'] = 'http://zenit.senecac.on.ca/wiki/index.php/User:Hellwolf36';
sources['japtoeng'] = 'http://http://rut.org/cgi-bin/j-e/dict/';
sources['blog'] = 'http://hellwolf36.blogspot.com/';
sources['south-park'] = 'http://www.southparkzone.com/';
sources['pso'] = 'http://www.pso-world.com/';
sources['schtserv'] = 'http://schtserv.com/forum/';
sources['d2m'] = 'http://www.d2maniacs.org/';
sources['mininova'] = 'http://www.mininova.org/';
sources['nezmod'] = 'http://www.nez.exofire.net/forum/';
sources['mySeneca'] = 'http://my.senecacollege.ca/';
sources['Senecamail'] = 'http://learn.senecac.on.ca/';
sources['orderofthestick'] = 'http://www.giantitp.com/comics/oots.html';
sources['8bit'] = 'http://www.nuklearpower.com/archive.php';
sources['news'] = 'http://www.drudgereport.com';
Utils.openUrlInBrowser(sources[vendor.text]); }
})
//Revision History from original
//Replaced Yahoo with Hotmail
//Added some personal sites
//Rewrote preview messages
---
====Share a webpage on Facebook!====
[[User:tjbro]]
This command allows a user to share a web page on Facebook. Although I couldn't get the preview to act the way I orginally had in mind I'm going to continue working on it in hopes of avoiding the pop-up window.
<br />
<pre>
CmdUtils.CreateCommand(
{
name: "share-fb:",
preview: function( pblock, wikiquery ) {
pblock.innerHTML = "Share this page on Facebook!";
},
author: {name: "Thomas Brown"},
execute: function() {
window.open("http://www.new.facebook.com/sharer.php?u=" + context.focusedWindow.document.location,"Share on Facebook","menubar=no,width=600,height=360,toolbar=no");
}
})
</pre>
<br />
---
---
====Sherdog Fight Finder Search====
[[User:bbarcick]]
This command allows a user to search the Sherdog Fight Finder for a specific fighter. Currently only allows the first word to be the fighters first name and the second word to be the fighters last name.
<br />
<pre>
CmdUtils.CreateCommand({
name: "fight-finder",
author: {name:"Bartosz Barcicki", email:"bartb_69@hotmail.com"},
description: "Searches the Sherdog Fight Finder",
takes: {"search-string": noun_arb_text},
preview: function(pblock, search) {
pblock.innerHTML = "Sherdog Fight Finder Search: " + search.text;
},
execute: function(search) {
var name = search.text.split(' ');
if (!name[1])
{
name[1] = "";
}
var url = "http://sherdog.com/fightfinder.php?firstname=" + name[0] + "&lastname=" + name[1] + "&search=yes&nickname=&association=&weight=";
Utils.openUrlInBrowser(url);
}
})
</pre>
<br />
---
====Start a new cl1p.net page====
by [http://johpan.thruhere.net/opensource/ Johann Manzano]:<br/>
I originally wanted to make it so that selected text would make it into the page created by this command but i couldn't figure it out. It'll be something I'll continue to look into when time permits.
cl1p.net is an internet clipboard like pastebin but you can select the name that your clipboard gets. This command allows you to select the name of the page via ubiquity and it loads it for you. If you don't supply a name, it just takes you to the site.
[http://johpan.thruhere.net/opensource/?p=7 original post here]
<pre>
function cl1pPage( name ) {
var url = "http://cl1p.net/" + name;
Utils.openUrlInBrowser(url);
}
CmdUtils.CreateCommand ({
name: "cl1p",
takes: {"page name": noun_arb_text},
preview: function(pBlock, directObj) {
if (directObj.text)
pBlock.innerHTML = "goto cl1p.net/" + directObj.text;
else
pBlock.innerHTML = "goto cl1p.net";
},
execute: function(directObj) {
var text = directObj.text
cl1pPage(text);
}
});
</pre>
----
====show time in====
[http://gist.github.com/128853 show-time-in] command by [[User: Jyoti | Jyoti]]
This command shows the current time in the place specified
CmdUtils.CreateCommand({
name: "show time in",
author: {name:"jyoti", email: "mail2jyoti88@gmail.com"},
description:"It will show the current time in the place you specified.",
takes: {"name of a place" : noun_arb_text},
_time: function(term)
{
return "http://www.timeanddate.com/worldclock/results.html?query="+term;
},
preview: function(pblock,pname)
{
var msg="It will show the current time in "+ pname.text;
pblock.innerHTML=msg;
},
execute: function(pname)
{
if (pname.text=="")
{
displayMessage("enter name of the place whose current time u want to know");
}
else
Utils.openUrlInBrowser(this._time(pname.text));
}
})