192 Part IV — Hacking Navigation, Downloads, and Searching Let’s start with hacking your mouse scroll feature. Firefox includes a feature called smooth scrolling that lets you see just how much of the page goes by when you use the Page Up or Page Down keys or your mouse scroll wheel. Without smooth scrolling, Firefox jumps up or down a page when you scroll, but, with this feature turned on, the browser glides up and down the page. With the mouse wheel and smooth scrolling, the amount of scroll depends on how fast you flick the wheel, but the visual effect is the same. You can turn off smooth scrolling in the Options window under Advanced. Firefox’s default scroll effect with the wheel alone is three lines on the web page. You can alter the scroll wheel behavior by holding down certain keys while using the wheel: Ⅲ Alt+scroll wheel cuts the amount of scroll per wheel notch to one line. Ⅲ Ctrl+scroll wheel increases or decreases the size of the type on the web page. Ⅲ Shift+scroll wheel moves forward or backward in the browser history for the current tab or window. These settings can be changed via about:config. Type mousewheel in the Filter field to narrow the focus to just the default mouse settings. Figure 10-12 shows the mousewheel settings in the about:config window. You can alter any of the settings by double-clicking on them. F IGURE 10-12: The mousewheel options in about:config. 16_596500 ch10.qxd 6/30/05 2:59 PM Page 192 193 Chapter 10 — Hacking Navigation and Tab Browsing You’ll need to keep these action variables in mind: Ⅲ 0 is scroll by lines of text in the browser window. Ⅲ 1 is scroll by pages of text in the browser window. Ⅲ 2 is move forward or backward in browser history. Ⅲ 3 is make the page text larger or smaller. For example, if you want to change the Shift+scroll wheel behavior to scroll a page at a time, double-click on the line mousewheel.withshiftkey.action and change the number in the popup window to 1. The change takes effect immediately. To increase the number of lines that the scroll wheel scrolls to 10, double-click on the follow- ing and change the number in the popup window to 10: mousewheel.withnokey.numlines You’ll also need to double-click on mousewheel.withnokey.sysnumlines to change the setting from true to false. Otherwise, Firefox ignores your other change and sticks to the browser’s default of 3 lines of scroll. Again, these changes take effect right away, so you can switch to another window or tab and see if you like the effect. To change the settings back to their defaults, right-click on the ones in boldface and select Reset from the menu. Using Configuration Mania to Adjust Your Mouse Scrolling If you don’t like editing your preferences through about:config and having to remember vari- ables, extension writers provide easy windowed methods of adjusting these settings. The Configuration Mania extension lets you tinker with many different Firefox features, among them mouse behavior. After you install the extension, you can access it through an entry on the Tools menu. Open the Configuration Mania window and select Mouse wheel from the list of items on the left (see Figure 10-13). Any changes you made to the scroll settings through the about:config menu carry over to Configuration Mania. Here, instead of keeping track of obscure variables, you can select the mouse wheel and key combination and change their functions as you like. To change the way mouse scrolling behaves when the Shift key is pressed, select Shift from the modifier drop- down list, then adjust the settings appropriately. To change the number of lines that a particular scroll setting scrolls on the page, uncheck the “Use system default” box if it is checked and change the number in the field. As with changes made with about:config, Configuration Mania’s changes take immediate effect. You can get Configuration Mania from http://members.lycos.co.uk/ toolbarpalette/confmania/index_en.html. 16_596500 ch10.qxd 6/30/05 2:59 PM Page 193 194 Part IV — Hacking Navigation, Downloads, and Searching F IGURE 10-13: Configuration Mania’s Mouse wheel options. Show Your Artistic Side with Mouse Gestures Navigating web sites usually means a lot of clicking on various browser buttons and menus as you look for the information you want. Mouse gestures make it easier for you to keep your mouse where it belongs — in the web browser window itself — by turning the functions of the browser’s menus into figures you trace with your mouse. You hold down a mouse button and drag the mouse in a two-to-five line design, and the browser performs the action associated with the gesture. To go back in the browser’s history, you would hold down the right mouse button and move the mouse from right to left across the web page. To close the browser win- dow, hold the right button and move the mouse down and to the right. You can assign mouse gestures to nearly any browser feature. There are several mouse gesture extensions out there, but the easiest one to configure and use is probably All-in-One Gestures. It provides detailed windows for its features and a well- designed interface listing the predefined mouse gestures and methods for creating your own. Figure 10-14 shows All-in-One Gestures’ list of predefined gestures. 16_596500 ch10.qxd 6/30/05 2:59 PM Page 194 195 Chapter 10 — Hacking Navigation and Tab Browsing F IGURE 10-14: The list of mouse gestures provided by All-in-One Gestures. The artistic aspect of mouse gestures is in how they can be displayed on screen. All-in-One Gestures shows you a thin red line that follows your cursor as you perform a gesture (see Figure 10-15). The line lets you see exactly which way you moved the mouse, and you see the letters corresponding to the gesture in Firefox’s status bar. Mouse gestures take a little adjustment, but once you get used to them you’ll find you want to use them in all of your applications. If you’re new to the concept, I suggest learning the follow- ing simple gestures first: Ⅲ History Forward Ⅲ History Back Ⅲ Next Tab Ⅲ Previous Tab Ⅲ Reload page Ⅲ Close Tab/Window Once you’re adept at these gestures, try some of the more complex ones or make your own. Soon, they will be like tabs: you will wonder how you ever used a browser without them. 16_596500 ch10.qxd 6/30/05 2:59 PM Page 195 196 Part IV — Hacking Navigation, Downloads, and Searching F IGURE 10-15: Mouse gestures in action. Summary There are many ways to customize Firefox to suit your personal browsing habits and tastes. You can open any number of web sites as your home page, using a tab for each site.Tabs can be styled however you like, with icons and progress bars to tell you which ones are active. And mouse gestures and scroll enhancements let you keep the control of your browsing in the palm of your hand. 16_596500 ch10.qxd 6/30/05 2:59 PM Page 196 Download and Plugin Hacks A side from browsing, downloading is probably the most important feature to most users, and hacking that experience is what this chapter is all about (that and, of course, plugins). One of the best enhancements that Firefox introduced over its predecessors was a unified and configurable Download Manager window. As you can see from Fig- ure 11-1, the Download Manager window consolidates what used to be individual download status dialogs for each download and displays them in one list. All of the options available in the original download status dialogs, such as Pause, Resume, Open, and so on, are also available in the new uni- fied window. Additionally, the ability to open the default downloads loca- tion by clicking the location label next to “All files downloaded to” and cleaning up the download history by clicking on the Clean Up button are available here. F IGURE 11-1: Default Download Manager window To change the default download location, hop over to the Downloads sec- tion from the Tools➪ Options menu, as shown in Figure 11-2, which also shows the other options available. ˛ Hacking download behavior ˛ Hacking downloads with extensions ˛ Hacking MIME types ˛ Hacking external download managers ˛ Hacking plugins chapter in this chapter by Mel Reyes 17_596500 ch11.qxd 6/30/05 3:01 PM Page 197 198 Part IV — Hacking Navigation, Downloads, and Searching In Mac OS X, the command is Firefox ➪ Preferences. F IGURE 11-2: Download preferences available from the Tools➪ Options screen While the Download Manager is a great tool, some may want additional features when it comes to downloading, such as displaying downloads in the status bar, sorting downloads into directories, and other tweaks. The following hacks and extensions allow you to customize your download experience to your liking. Hacking Download Behavior The default download experience using Firefox is pretty good. This section shows you how to hack the basic internal options to your liking, such as clearing your download history, configur- ing download alerts, and other useful hacks. Clearing Download History With the advent of security and privacy issues, many users want to make sure that downloads are not tracked well after they have closed Firefox. Figure 11-3 shows that Firefox 1.0 has a configurable interface to manage the Download Manager History from the Tools ➪ Options menu in the Privacy section. 17_596500 ch11.qxd 6/30/05 3:01 PM Page 198 199 Chapter 11 — Download and Plugin Hacks F IGURE 11-3: Download Manager History settings in Firefox 1.0 Figure 11-4 shows the Firefox 1.1 redesign of the Options screen. F IGURE 11-4: Download History Privacy settings in Firefox 1.1 17_596500 ch11.qxd 6/30/05 3:01 PM Page 199 200 Part IV — Hacking Navigation, Downloads, and Searching Despite the provision of this interface, my preference is to manually add settings to the user.js file to guarantee the setting is merged back into my preferences upon restart. To do this, enter one of the following settings into your user.js file, depending on which history method you prefer. Ⅲ To remove downloads from the history when they complete successfully, use the follow- ing entry. Keep in mind that cancelled downloads are not removed. user_pref(“browser.download.manager.retention”, 0) Ⅲ To remove all downloads when you close your instance of Firefox, use this setting. Keep in mind that downloads will persist in the Download Manager for the whole session that you have Firefox open and are not cleaned out until you exit. user_pref(“browser.download.manager.retention”, 1) Ⅲ To keep a history of all downloads and to allow yourself to manually prune the list, just add the following to your user.js file. user_pref(“browser.download.manager.retention”, 2) Figure 11-5 shows the Download Manager options via the about:config utility. F IGURE 11-5: The about:config tool with Download Manager retention setting highlighted 17_596500 ch11.qxd 6/30/05 3:01 PM Page 200 201 Chapter 11 — Download and Plugin Hacks To get more documentation on preferences that you can change, with their associated values and descriptions, visit this great MozillaZine Knowledge Base article: http:// kb.mozillazine.org/Firefox_:_FAQs_:_About:config_Entries. In Figure 11-6, you see that Firefox 1.1 introduces a Sanitize option to the Tools menu. This feature can be configured from the Privacy section of the Options screen and allows you to manually choose which settings to clear when shutting down Firefox. F IGURE 11-6: Sanitize options introduced with Firefox 1.1 While the final version of Firefox 1.1 was not officially released during the development of this book, intermittent test builds were. These builds provided insight into interface and feature enhancements, as well as into changes that were being coded and planned for the final release. These test builds, which are known as trunk builds, are usually compiled and made available on a daily basis and on some servers on an hourly basis. They usually provide fresh, bleeding-edge copies of code changes introduced throughout the previous day’s efforts of coding and fixes. For information or to download trunk builds or to see the progress of outstanding bugs and fixes that have been checked, visit the Firefox Builds forum on MozillaZine.org at http:// forums.mozillazine.org/viewforum.php?f=23 . Other Useful Hacks You can add the hacks in Table 11-1 to your user.js or prefs.js file to allow further customiza- tion of the Download Manager settings without having to install an extension. Each preference listed in the following table should be formatted as follows and saved to either the prefs.js or user.js file: user_pref(“name”, value) 17_596500 ch11.qxd 6/30/05 3:01 PM Page 201 . Hacks F IGURE 1 1-3 : Download Manager History settings in Firefox 1.0 Figure 1 1-4 shows the Firefox 1.1 redesign of the Options screen. F IGURE 1 1-4 : Download History Privacy settings in Firefox 1.1 17_596500. also shows the other options available. ˛ Hacking download behavior ˛ Hacking downloads with extensions ˛ Hacking MIME types ˛ Hacking external download managers ˛ Hacking plugins chapter in this chapter by. All-in-One Gestures. It provides detailed windows for its features and a well- designed interface listing the predefined mouse gestures and methods for creating your own. Figure 1 0-1 4 shows All-in-One