The Sysadmin Wiki
Advertisement

This page should present you the Ubiquity command, if you have the extension installed and you don't have the command already.

Source code[]

The code is saved in a .js file on this wiki. For security reasons, the .js files on the wiki are only editable by users with sysop access.

CmdUtils.CreateCommand({
	names: ["yubnub","yn"],
	locale: "en-US",
	arguments: [ {role: "object", nountype: noun_arb_text, label: "search term"}],
	homepage: "http://yubnub.org",
	icon: "http://yubnub.org/favicon.ico",
	preview: function(pblock, directObject) {
		searchText = jQuery.trim(directObject.text);
		if(searchText.length < 1) {
			pblock.innerHTML = "Lookup on YubNub";
			return;
		}

		var previewTemplate = "Looks up ${query} on YubNub";
		var previewData = {query: searchText};
		pblock.innerHTML = CmdUtils.renderTemplate(previewTemplate, previewData);
	},
	execute: function(args) {
		var url = "http://yubnub.org/parser/parse?command={QUERY}"
		var query = args.object.text;
		var urlString = url.replace("{QUERY}", query);
		Utils.openUrlInBrowser(urlString);
	}
});


TODO: Preview what the command does (See: Todo list)
Advertisement