Leopard introduces Web clips, a new way to make a Dashboard widget of your own—in about three clicks.. Play with the widget, and then click Keep to install it or Delete, if you think it
Trang 15.14 Web Clips: Make Your Own Widgets
You don't have to be satisfied with Apple's 20 widgets or the several thousand that other people have written Leopard introduces Web clips, a new way to make a Dashboard widget of your own—in about three clicks
Web clips exploit an inescapable characteristic of widgets: An awful lot of them exist to deliver real-time information from the Web That's the point of the Ski Report widget, Weather, Stocks, Flight Tracker, ESPN, and so on
Figure 5-31 Widgets could, in theory, harbor viruses, so Mac OS X is extremely
cautious in downloading them
Top: When you try to download a widget, the Mac asks if you're sure
Middle: After you download a widget and confirm your intention, you meet this test-drive mode for newly downloaded widgets It's a way to play with new widgets before you actually commit to adding them to your system Play with the widget,
and then click Keep to install it (or Delete, if you think it's evil)
Bottom: Not all good things come from Apple Here's a representative sample of widgets written by other people From top left: Plasma Tube, Guitar Chords, Chuck Norris Facts, World Radio, and MiniStat 2 (details about your Mac at the moment)
But what if your interest isn't skiing, stocks, or sports? What if it's the New York Times front page? Or the bestselling children's books on Amazon? Or the most-viewed video on You Tube?
That's the beauty of Web clips, a joint venture of Dashboard and the Safari Web browser
in Mac OS X 10.5 They let you turn any section of any Web page into a Dashboard widget that updates itself every time you open it It's like having a real-time keyhole peek
at all your favorite Web sites at once
5.14.1 Creating a Web Clip Widget
Here's how you go about creating a do-it-yourself widget:
1 Open Safari
Safari is the Mac's Web browser It's in your Applications folder
Trang 22 Navigate to the Web page that contains the information you want to snip Click the Web clips button identified in Figure 5-32
The screen goes dark, with only a small window of white As you move your cursor around the page, the small white rectangle conveniently snaps to fit the various rectangular sections of the page
As shown in Figure 5-32, your job is to make a frame around the part of the page that usually shows the information you want If the Web site ever redesigns its pages, it'll wreck your widget—but what the heck It takes only 5 seconds to make
it again
Figure 5-32 Drag the little round handles to make the white box just big enough to surround the part of the page you want to enshrine Or drag inside
the box to move the whole thing Clip button Adjust handles
3 Adjust the corner or side handles to enclose the piece of page you want When you're finished, click Add, or press Return or Enter
Now Dashboard opens automatically But wait—what's this? There's a new widget here that wasn't here before At first, you might not even notice, because it's
precisely centered over the piece of Web page that you enclosed But if you drag it
to one side, you'll see that it's a standalone, full-blown, real-time widget
At this point, you can dress up your widget, adding a little polish to this raw clipping you've ripped out of a Web page Click the button that appears when you move your mouse to the lower-right corner The widget flips around to reveal the controls shown in Figure 5-33
Figure 5-33 Top: Click a frame style to give your widget better-looking edges If the widget plays sound, it keeps playing sound when you close the Dashboard unless you
turn on "Play audio in Dashboard only."
Bottom: Click Edit to return to the front of the widget, where you can adjust its
position on the underlying Web page
Here, you can click one of the frame styles to give your widget a better-looking border
Trang 3If you click Edit, the widget flips around to face you again, and here's where it gets
weird: You can reposition your widget's contents as though they're a window on the Web page that's visible behind it Drag the widget contents in any direction within the frame,
or resize the frame using the lower-right resize handle Click Done
You can make as many Web-clip widgets as you want
But here's a big screaming caution: If you close one of these homemade widgets, it's gone forever (or at least until you re-create it) They're never represented as icons on the
Widget bar, as ordinariy widgets are
Ah, well—easy come, easy go, right?
Note: If you're of the programmer persuasion—if you're handy in Javascript and HTML,
for example—it's much easier to write custom widgets than ever before (Not just Web-clip widgets; real widgets.)That's because Leopard comes with Dashcode, an easy-to-use widget-assembly environment You'll find the installer for it on your Leopard installation DVD (in the Optional Installs XCode Tools folder), and you'll find tutorials and examples by typing dashcode tutorial into Google