Zh-CN:Ubiquity 0.1.2 User Tutorial

回到 Labs/Ubiquity.

In other languages

If English isn't your first language feel free to read the tutorial in your own language. If it doesn't exists, feel free to jump in and translate.

日本語で En español 简体中文

欢迎

Ubiquity 是一个处于实验中的 Firefox 扩展,它可以让您更有效的与 Web 交互。

在以前,您只有在 URL 栏中输入网络地址才能要告诉 Firefox 您想去哪

2421200474_1bf74ef498_o.png

但是如果使用 Ubiquity ,您可以通过往新的 Ubiquity 输入界面中输入命令告诉 Firefox 您想做的事情

20080819151657.jpg

Ubiquity 命令几乎可以做任何事情。 Ubiquity 在发布时已经内置了一些让您的 Web 任务更加简单更加高效的命令。在这个教程中,我们会告诉您如何去使用它们中的一些。在这篇教程结束的时候,您应该可以完成快速的 wikipedia, google, definition 和 yelp 查找、在您的的电子邮件中插入地图、以及翻译网页的部分内容、高亮一个单词并把它通过电子邮件发送给朋友。

Ubiquity 内置的命令仅仅是开始:任何人可以创建一个新命令并分享给别人。创建 Ubiquity 命令—并且 extending the web—和新建一个网页一样容易。 如果您希望了解如何创建自己的命令,请参阅 开发者教程

Ubiquity 仍然是一个在发展中的工具,我们渴望您参与到我们实验的虚拟小组中来。如 果在阅读这篇教程的过程中,您觉得 Ubiquity 可以在某些方面做的更容易使用,或者对 于 Ubiquity 未来发展的一些想法,我们希望您能花费一点时间来 分享您的想法。 由于 Ubiquity 正处于发展的早期,所以如果您在这时加入项目的话,您会有机会去改变 它成长的方向。

如果您是苹果 (Mac) 用户

您需要安装 Growl。这是一个 Mac OS X 的系统扩展,它可以显示友好的半透明信息。 Ubiquity 的运行结果及运行时的错误会通过 Growl 展示给您。

在 Windows (XP 及以后) 上,您不需要额外安装任何软件,因为 Ubiquity 会使用操作系统 内置 "toaster" 样式的弹出消息。

在 Linux 上,您也不需要特意去做任何其它的事情:只需要确认您的 Firefox 已经是最新版即可。

基础知识

启动 Ubiquity

如果您还没安装 Ubiquity,请 安装 Ubiquity。在安装完成后,您可以通过快捷键调出 Ubiquity,在 Mac 上是 option-space ,在 Windows 上是 control-space ,而在 Linux 上您应该尝试 control-alt-space

在您按下正确的快捷键后,您会看到一个黑色的半透明界面出现在浏览器的左上角,并且在其中有一个白色的光标。

20080714190900.jpg

如果想要给 Ubiquity 一个命令,只需要在其中输入一些字符并且按回车。为了简洁起见我们称之为 "使用 (issuing)" 一个命令。在后文中,当我们说 "使用 'XYZ'" 的时候,即是指 "按下 alt-space (或 ctrl-space) 调出 Ubiquity 界面,然后输入 XYZ" 。

第一条命令:查找 Wikipedia

让我们从 Wikipedia 开始。假设您想知道 "babel fish" 是什么,您只需要简单的使用命令 "wikipedia babel fish"。

在您输入命令的时候,您会看见在输入框的下面有两样东西:当前命令的 提示列表 (suggestion list)预览 (preview) 。在下面的图片中,提示列表中是 "wikipedia" 和 "weather" ,而预览中显示的是 "Searches Wikipedia" 。

20080819152417.jpg

当您完成输入 "wikipedia babel fish" 时,您可以看到在 Wikipedia 上关于 Babel Fish 页面的一些摘要。就像下面这样:

20080819152930.jpg

从 Wikipedia 上收集上面的信息需要耗费一些时间,在这个过程中, Ubiquity 仍然有很好的响应性。

接下来,您可以:

  • 按回车键 执行 这条命令。执行这条命令会把您带到 Wikipedia 页面。
  • 按 Escape 键以取消这条命令, Ubiquity 会消失,并且不做任何操作。
  • 在 preview 中点击相应的链接。在 Wikipedia 的预览中,点击任何一个链接会将您直接带到您感兴趣的文章中。

简化命令和使用推荐列表

"Wikipedia babel fish" 需要输入很多文字。在推荐列表的帮助下,你可以为您的的手指节省大量的时间。在上一节中可以看到,当启动 Ubiquity 并仅仅输入一个 "w" 的时候,推荐列表中会列出所有以此字母开头的命令: Wikipedia 和 Weather。

当您在后面再输入字母 "i" 的时候,推荐列表会将可选范围缩小为以 "wi" 开头的一条命令 —"Wikipedia" 。这时,您可以按空格后继续输入您的其它指令,而 Ubiquity 会知道您想要使用的是 "Wikipedia" 。所以使用 "wi babel fish" 就相当于使用 "wikipedia babel fish" 。

下面是另一个例子。假如您想要知道芝加哥的天气状况,试着调用 "w chicago" 命令。

20080819155204.jpg

您会看到在推荐列表的第一条是 "wikipedia chicago" 。如果您在此时按下回车,这条命令就会被执行。但这并不是我们现在所需要的,所以通过下方向键将高亮的光标移动到第二个推荐项: "weather chicago" 。

您现在会看到 Chicago 的天气预报的预览。按下回车可以跳转到 Wunderground.com 上完整天气预报的页面。

当然,你可以使用 "we chicago" 或者 "we 60601" (芝加哥的邮政编码) 得到相同的结果。

Doing Commands on Selections

Often, the thing you're interested in searching for is right in front of you, on the web page you're looking at. Why go to the trouble of re-typing it when you can use what you've already got?

Select the words "Mountain View, California" below by dragging your mouse across them:

 Mountain View, California

Now summon Ubiquity, and just type the first few letters of the command name:

20080819155845.jpg

Or, let's say you're reading a web page and you find an unfamiliar word:

 aglet

Just select the word and issue "define".

You could have achieved the same thing by typing "define aglet"—or just "def aglet", or even "def this". (Ubiquity understands "this" to refer to the selection.)

More Command Examples

Emailing

Right now, the email command uses Google Mail. That means you'll only be able to follow along with the next part of the tutorial if you have a GMail account. Eventually, of course, the command should work with all major web-based email providers, as well as applications like Thunderbird. (If you're a programmer, we'd love some help with that.) For now, if you have a GMail account, please make sure you're logged in. If you don't, you might want to skip ahead to the next part of the tutorial.

Assuming you're logged into your GMail account, issue "email". In the suggestion list, you'll see a suggestion that says "Email (message) (to contact)".

20080819160313.jpg

This is a clue that the Email command expects two pieces of information: the message is what you're emailing, and the contact is who you want to send it to. However, you can leave out one of these things — or both of them — and the Email command will still work. So I can issue any of these commands:

  • "email hello"
  • "email to chris"
  • "email hello to chris"
  • "email to chris hello"

I'm using "chris" because that's the name of someone in my GMail contacts list. If you don't have a "chris" in your contacts list, just substitute the name of any of your friends in these examples.

Let's say I've found an interesting fact on a web page and I want to send it to Chris. I can select part of the page, including links, pictures, and anything else, and then issue "email this to chris". Ubiquity understands "this" to refer to my selection. (I could also have said "email it to chris" or "email selection to chris" -- all of these are equivalent.) The selected part of the page shows up in my preview:

 

(Actual email addresses blurred out to protect the innocent.) Since I know several people named Chris, there are several lines in the suggestion list -- one each Chris in my GMail contacts list. I can arrow-key down to the Chris I want and then hit the Enter key.

I'm taken to the GMail "compose new email" page. The chunk of the page that I selected is reproduced in the body of my email, the "to" field is filled with the email address I selected, and the "subect" field contains the title of the web page I was on. I can now edit this email to add anything else I want to say, before clicking "Send".

The Map command

Let's say you're arranging to meet up with a friend at a restaurant, and you want to include a map in the email. (Yes, it's Aza's favorite example.)

Type out the address you want to map, then select it and issue "map". In the preview, you'll see a thumbnail-size map of the area (from Google Maps).

 

If you execute the command, you'll be taken to the Google Maps page. Or, you can click on the image in the preview to get a larger, interactive version. After scrolling and zooming this map to your liking, you can click the "insert map in page" link to insert the map into your email.

 

You can give it a try by selecting the address below and issuing "map":

Mozilla Corporation, 1981 Landings Drive, Mountain View, CA

Then click the image in the preview to get the larger map, then click the "insert map in page" link and watch what happens. Surprised?

The Translate command

That's right, Ubiquity commands can alter the contents of a page, even if the page wouldn't normally be editable. A command that makes good use of this ability is the "Translate" command. To try it, select the text below and issue "translate" (or just "tra") and execute.

  21世紀に、国際化をよく考えなければなりません。

It's translation-by-machine, so the results are bound to sound awkward, but at least you can get the gist of the meaning.

The full command is

translate (text) (from language) (to language)

So you can specify what language you want to translate from, and what language you want to translate to. If you leave either of these out, Ubiquity will just make a guess about what you want.

Here are some other examples you can try:

  • "tr good evening to spanish"
  • "tr buenos tardes from spanish to french"
  • Select some English text on this page and then: "translate this to german"

Going Further

Getting Help and Discovering Commands

By now you're probably wondering, "How many commands are there? What are they all called? How am I supposed to know what a command could be unless I memorize them all?"

These are good questions! To start getting some answers, issue the "command-list" command, and hit Return to execute it. You'll be taken to a special page listing every command you have installed, and describing what each one does.

 

For more general help, you can execute the "help" command. Here, you can change the hotkey that you use to activate Ubiquity, un-subscribe from command feeds, and so on.

The general help page and the command-list page link to each other, so whichever one you open, you can get to the other with a single click.

You can also get to the main help page by typing about:ubiquity into the Firefox URL bar.


Teaching Ubiquity New Commands

We've mentioned that anyone can create Ubiquity commands. Once created, these commands can be embedded in any web page. If you have Ubiquity installed and you visit a page with an embedded command, Firefox will present you with the option of subscribing to the command.

To see this in action, you can visit this example page on Atul's personal site. You should see a bar coming down from the top of the browser window asking you whether you want to subscribe to the command or not.

20080820111209.jpg

If you choose to subscribe, you'll see a rather scary-looking warning page:

20080820111725.jpg

It's important to understand the dangers of subscribing to Ubiquity commands from sites that you don't trust. Since a Ubiquity command can do anything, and it has full access to your web browser, a bad person could write a Ubiquity command to steal your personal information or do malicious things to your computer. You should not install Ubiquity commands unless you are confident that the source is trustworthy.

In the future, we'll be creating something called a "trust network" that Ubiquity users can use to share knowledge about which commands are trustworthy. When you visit a page with an embedded command, you'll be able to see what your friends with Ubiquity have said about this command -- whether they've given it a thumbs-up or left you a warning to let you know it could be dangerous. This system doesn't exist yet, but once it does we will modify this section of the tutorial to let you know how to use it.