Team LiB
Previous Section Next Section

Hack 37. Get More Feeds and News

Not getting enough information? You have several different ways to get more in Firefox.

This hack introduces you to the push content that a couple of extensionsSage and ForecastFox (previously named WeatherFox)make possible. Push content comes to you without you asking, or at least without you asking much.

4.6.1. Get Feeds with Sage

Long before Live Bookmarks came out in Firefox 1.0, Sage, a sidebar extension (shown in Figure 4-6), provided RSS and Atom feed aggregation in the Firefox sidebar. It's still a very useful extension.

Figure 4-6. The Sage sidebar


Sage provides full-service feed aggregation. It includes a feed preview rendered in the contents area; a tooltip description of each item in the feed, usually containing a brief excerpt of the article; the ability to mark items as read or unread; and many other features.

To begin using Sage, you first need to install it from the Mozilla Update web page (http://update.mozilla.org). Don't forget to place the Sage icon in your toolbar (context-click on a toolbar, select Customize, and drag and drop the icon onto the toolbar). Once Sage is installed, you can start setting up some feeds.

4.6.1.1 Setting up the feed system

First, you must create a folder in your Bookmarks hierarchy. That's where you will place either bookmarks pointing to the feed URLs or live bookmarks that directly implement the feed (live bookmarks use Firefox's autodiscovery service). When such a folder is created and you've placed some bookmarks into it, you can open Sage in the sidebar. This can be done several ways:

  • Sage's toolbar button

  • Keyboard shortcut Alt-S

  • ToolsSage

  • ViewSidebarSage

Once that's done, click the Options drop-down menu in the Sage sidebar and select Settings. Here, you can find and select the folder into which you have put the feed bookmarks. That should be all that's required to begin with.

In the Sage Settings window, you can also choose automatic update of the feeds and switch between 12- and 24-hour time display mode. You can also select the sorting method: chronological order or source order. The latter uses the order from the feed source.

4.6.1.2 Adding feeds

There are several ways to add feeds in the Sage sidebar:

  • Display a web page that has a feed link. Right-click the link and select Bookmark This Link.

  • If the orange RSS feed icon appears on the status bar, just click the icon and follow the instructions.

  • Use the discovery service of Sage to put the feeds in. It's available via the Sage icon on the sidebar.

Just make sure that all the bookmarks and live bookmarks to be shown in Sage are placed in the common bookmark folder that you set as Feed Folder in the Sage configuration.

4.6.1.3 Show the content

Now, when you select a feed in the Sage sidebar, the last 10 feed items will load, provided that you selected automatic feed update. If not, you must press the Refresh button.

Hovering over the feed items might show Description Tooltips, if you have enabled them in the Options menu. When you click an item, the content will load in the content area, unless you configured Sage to render feeds in the sidebar. When shown in the sidebar, you can customize the matching CSS file to change the look of rendered feeds. As a starting point, just modify Sage's default CSS file at chrome://sage/content/res/sage.css and save it in any convenient location. Then, open Sage settings and choose Using Custom Stylesheet and browse to your modified file.

4.6.2. Get Weather News with ForecastFox

Another example of a news-retrieving extension is ForecastFox, which allows you to have the weather forecast at your fingertips. The first step is to download the ForecastFox extension, available through the Mozilla Update web site (update.mozilla.org). Figure 4-7 shows its About dialog box.

Figure 4-7. The About ForecastFox dialog box


The figures in this hack display the original name of the extension (WeatherFox), which has since been renamed ForecastFox.


4.6.2.1 Setting a location

Once the installation process has been completed, you need to set up a location for the forecast you want:

  1. Open the extension's Options window. Start it from either the Extension Manager or from the pop-up menu that appears when you click the ForecastFox extension icon on the Status bar.

  2. In the Options window, select the Profiles tab.

  3. Create a new profile by pressing the Create Profile button and providing a profile name. These profiles are geographic profiles specific to ForecastFox. They've got nothing to do with Firefox profiles.

  4. Once the profile has been created, set it as the current profile by highlighting it in the list and pressing the Select Profile button. The name of the profile will then displayed in the Current Profile field. Figure 4-8 shows the completed dialog box.

    Figure 4-8. Geographic Profiles defined in ForecastFox


  5. A profile is just a name. Next you need to choose the location for the forecast you want to obtain. Just select the General tab and, assuming you don't know the location code, press the Find Code button.

  6. In the opened Location Search window, type the name of the city you want to watch and then press Search. In the returned list of found locations, choose the one you've been looking for. Close the Location Search window.

  7. Lastly, just press Apply or OK to refresh the data on your status bar and close the Options box.

4.6.2.2 Tweaking the display

On the General tab of the ForecastFox Options window, you can adjust several attributes that specify how the data is displayed:

  • In the Unit of Measure section, choose between displaying Metric (Celsius) or American (Fahrenheit) units.

  • In the Location section, choose the location where you want ForecastFox to be placed. If you have some toolbars installed, your list of options will also include those.

You can also define display options for both the current conditions and the forecast. The two tabs for these purposes are again located in the Options window:


Current Conditions

In this tab, you can enable or disable whether the current conditions show up at all, and enable or disable showing images on the toolbar and labels when the mouse is hovering. You can also enable popping up of the Alert Slider. If the Slider is enabled, you can define in what frequency it shows up. The highest frequency is 1, which tells ForecastFox to show the pop-up at every refresh. Figure 4-9 shows the pop up hovering over the Windows dashboard.

Figure 4-9. ForecastFox pop up



Forecast

In the Forecast tab, you can define the number of days for which you want to show the forecast. Nine days is the maximum. In the Display Options area of the tab, you can choose to show days and/or nights, as well as images and/or labels for each day.

4.6.2.3 Customizing tooltips and labels

In the General tab, if you click the Customize Tooltips and Labels button, a new window will appear, allowing you to change the look of labels and tooltips, as shown in Figure 4-10.

Figure 4-10. Message templating for ForecastFox pop ups


Here, you can define tooltip and label text using predefined variables and choose whether to show images in tooltips for both the current conditions and the forecast. Descriptions of the variables used can be found at the bottom area of the window. This window acts like a very simple report of ForecastFox's template system.

Tomás Marek

    Team LiB
    Previous Section Next Section