Hacking Firefox ™ More Than 150 Hacks, Mods, and Customizations phần 6 pps

45 252 0
Hacking Firefox ™ More Than 150 Hacks, Mods, and Customizations phần 6 pps

Đang tải... (xem toàn văn)

Tài liệu hạn chế xem trước, để xem đầy đủ mời bạn chọn Tải xuống

Thông tin tài liệu

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 202 Part IV — Hacking Navigation, Downloads, and Searching Optionally, you can modify them using the about:config functionality built into Firefox. Table 11-1 Customizing the Download Manager Settings Preference Name Description Value browser. download. manager. Use this to close the Download Manager window true/false closeWhenDone when it finishes downloading. browser. download. manager. Use this to focus the Download Manager window true/false focusWhenStarting when a download starts. browser. download. manager. This is the number of milliseconds that Firefox integer openDelay waits before displaying the Download Manager. Setting this to 2000 will have it wait 2 seconds before opening the manager window. This is useful if you are downloading a bunch of small files and do not want the Download Manager to keep popping up. browser. download. manager. Use this to enable/disable the download complete true/false showAlertOnComplete alert window that pops up on the bottom-right side of the browser. To change a preference back to the default, just remove the entry from the user.js file, if it exists; then open about:config, select the preference, right-click, and select the Reset option from the context menu. This will set the value back to the default value. Hacking Downloads with Extensions Hacking the download experience with extensions is the most useful way to personalize down- loading, whether it is showing the download status in the status bar, tab, or in the sidebar. Additionally, eliminating annoying situations such as blank new windows on file downloads and sorting downloads into different directories based on their file extension can really come in handy.This section covers them all and what options work best with each. Showing Downloads in the Status Bar Using the Download Statusbar Extension One of the most useful extensions that I have found to minimize the impact of downloading files, while maintaining a keen eye on progress and download throughput, is the Download Statusbar extension. While the title might imply that the default status bar is modified, in real- ity, what it does is build a custom download status bar that it places temporarily above the offi- cial status bar area extension, as shown in Figure 11-7. 17_596500 ch11.qxd 6/30/05 3:01 PM Page 202 203 Chapter 11 — Download and Plugin Hacks To maximize Download Statusbar’s effectiveness, disable Firefox’s built-in Download Manager window from popping up. Do this in the Downloads section of the Tools➪ Options menu. F IGURE 11-7: Download Statusbar extension, with Firefox download complete and Thunderbird download paused When Download Statusbar is in action, you will see a new bar open up above the status bar with the progress and information about each of the current downloads. To pause a download, left-click it and then click it again to resume. A red band appears around paused downloads. Additionally, right-clicking a download shows a context menu with different options based on active, paused, or completed downloads. Figure 11-8 displays the different configuration options available with this extension. For more information about the Download Statusbar extension, visit http:// downloadstatusbar.mozdev.org/. 17_596500 ch11.qxd 6/30/05 3:01 PM Page 203 204 Part IV — Hacking Navigation, Downloads, and Searching F IGURE 11-8: Download Statusbar extension options window Showing Download Manager in the Sidebar or Tab with Download Manager Tweak Extension On the surface, this extension appears to be a cute overlay to the internal Downloads Manger, as shown in Figure 11-9, but when you dig into the options, you’ll find that there are a few other interesting tweaks and possible hacks that you can apply. Nice hidden features include the following: Ⅲ Specify Download Manger window open delay. Ⅲ Specify buttons to show in the Download Manager window. Ⅲ Move the toolbar in the window and other minor tweaks. Another nice customization is placement of the Download Manager — whether you want it in a new window, in the sidebar, or in a tab. The basic features fit the extension’s name aptly but don’t do it justice with respect to what it really provides. There are three ways to get to the Download Manager Tweak options and settings. You can: Ⅲ open the Extension Manger and double-click on the extension’s entry on the list. Ⅲ click the Options button on the Download Manger’s toolbar. Ⅲ access it via the Tools➪ Options menu in the Downloads section by clicking the Download Manager Tweak Options button there. 17_596500 ch11.qxd 6/30/05 3:01 PM Page 204 205 Chapter 11 — Download and Plugin Hacks Figure 11-10 displays the options available for this extension. F IGURE 11-9: Download Manager Tweak customized version of the Download Manager F IGURE 11-10: Download Manager Tweak options and settings For more information on the Download Manger Tweak extension, visit http:// dmextension.mozdev.org/. 17_596500 ch11.qxd 6/30/05 3:01 PM Page 205 206 Part IV — Hacking Navigation, Downloads, and Searching Disabling Blank Download Windows with the Disable Targets for Downloads Extension One of the most annoying things about downloading files off the Internet is the insistence of web masters, HTML coders, and automated download sites on adding a target field to a file’s download link. You have probably seen this — for example, you click to download myhack.zip, and when you do, a new blank window opens and then download begins, leaving behind the blank window after the file has completed. As mentioned on this extension’s web site, this issue has been officially filed as Bug #241972, which can be found here: https://bugzilla .mozilla.org/show_bug.cgi?id=241972 . Most users would like a resolution sooner rather than later, and that is where the Disable Targets for Downloads extension comes in. This extension removes targets only from active hyperlinks, not those wrapped in JavaScript code, and so on. A normal link may look like this (shameless plug): <a href=”http://www.mrtech.com/mrsetup3_lite.exe”>Download Here</a> But a link with a target will look similar to the following: <a href=”http://www.mrtech.com/mrsetup3_lite.exe” target=”_blank”>Download Here</a> This extension disables the link’s additional target property so the browser handles the link normally and opens it in the current window. By default, this extension disables new windows for links with targets for the following file- name extensions: .zip, .rar, .exe, tar, .jar, .xpi, .gzip, .gz, .ace, and .bin. While this extension covers the majority of common filename extensions, I tend to add a few more potential culprits, including .7z, .cab, .msi, and .pdf. Figure 11-11 shows the Disable Targets for Downloads Options window. For more information or updates for the Disable Targets for Downloads extension, visit http://www.cusser.net/extensions/disabletarget/. 17_596500 ch11.qxd 6/30/05 3:01 PM Page 206 207 Chapter 11 — Download and Plugin Hacks F IGURE 11-11: Disable Targets for Downloads Options window Follow these steps to add additional filename extensions to the list for target disabling: 1. Install the Disable Targets for Downloads extension. 2. Restart your browser to finish the installation process. 3. Select the Extensions option from the main browser’s Tools menu. 4. Locate and double-click the Disable Targets for Downloads entry on the list. 5. For each filename extension desired, type the filename’s extension and click the Add button. 6. Click OK when you’re done, and your settings are ready for use. While most extensions are three letters, this is not a steadfast rule for all operating systems and applications, as you see with the .7z, .gz, and .gzip filename extensions. Another real bonus of this extension is its ability to use regular expression pattern matching to remove the blank target windows for links matching the regular expression. Because the exten- sion relies on regular expression pattern matching, this means that you are not restricted to just filename extensions. One example on this extension’s site is to add the following entry, which removes the blank window opened by downloading a file in Gmail: /gmail\?view=att/ 17_596500 ch11.qxd 6/30/05 3:01 PM Page 207 208 Part IV — Hacking Navigation, Downloads, and Searching Additionally, some sites open up just one too many tabs or windows when you are navigating from section to section, and although they are not necessarily blank, they are annoying. Some sites that I hack with this extension are http://www.klitetools.com/ and http:// www.versiontracker.com/ . While these sites have great content and are updated fre- quently, they are annoying when they open two, three, or more windows. To alleviate this on the KLite Tools site, I have pinpointed the most common URL snippet to match on to remove these target windows, which is as follows: klitetools.com/comments.php Or enter just the root domain to eliminate all targeted links for the Version Tracker site: versiontracker.com Using these will successfully remove the target window for the specified page or the entire site. Sorting Downloads to Directories with the Download Sort Extension Once you have the Download Sort extension installed, you can begin a life of organized down- loading. This extension allows you to add filename extensions or keywords to monitor and save files that match to the desired directory. As shown in Figure 11-12, the settings window for this extension allows full customization of each file extension, as well as the use of keywords in filenames. F IGURE 11-12: Main configuration settings for Download Sort 17_596500 ch11.qxd 6/30/05 3:01 PM Page 208 209 Chapter 11 — Download and Plugin Hacks To open the settings window, open the Extensions Manager and double-click on the Download Sort entry listed. After entering or modifying an entry, make sure to click the Apply/Update button, and your settings will be saved. For more information on the Download Sort extension, visit http://downloadstatusbar .mozdev.org/downsort/. Hacking MIME Types One of the key pieces of information that is communicated between a web server and a browser is a file’s content type or MIME type. Multipurpose Internet Mail Extensions (MIME) were originally implemented for use with e-mails and aides in defining a header of information for nontext e-mail attachments. This standard was extended to the Web to define the format of incoming objects that are requested. This section covers how to sniff out the MIME type being sent by a server, as well as how to modify Firefox’s behavior for these MIME types. Understanding File MIME Types The easiest way to explain MIME type is by using an example such as downloading an exe- cutable from a site. Most web servers will associate a Windows executable or .exe extension with a default MIME type of “application/octet-stream” or “application/exe.” When the web server initiates the transfer back to the browser, it includes this information in the initial com- munication header and lets the browser handle the information as it sees fit. A typical prompt that Firefox would display after receiving this information is shown in Figure 11-13. F IGURE 11-13: Default download confirmation window 17_596500 ch11.qxd 6/30/05 3:01 PM Page 209 [...]... Downloader, and GetRight have added Firefox detection or provide a mechanism for seamless integration MetaProducts has gone one step further and has created an official extension for Mass Downloader and Download Express to allow Firefox integration 215 2 16 Part IV — Hacking Navigation, Downloads, and Searching So what exactly are these programs doing to integrate themselves in the world of Firefox? Quite... installation, and restart Firefox Plugins are also the technology implemented by Flash and Macromedia to extend Firefox s capabilities Table 11-2 lists the directory and plugin files for GetRight and Mass Downloader Table 11-2 GetRight and Mass Downloader GetRight Mass Downloader Default directory C:\Program Files/GetRight C:\Program Files\Mass Downloader Plugin filename NPGetRt.dll npmassdn.dll You can find more. .. basic customizations that you can apply to Firefox to handle downloading, MIME types, and plugins, even more options are available At this point, you should be able to change the visual and the internal functionality of each of these functions, in addition to knowing where Firefox stores the related keys files Extensions such as Download Statusbar, Disable Targets for Download, Mimetype Editor, and Live... the following files to the corresponding Plugins subdirectory in Firefox: Ⅲ nppl3 260 .dll Ⅲ nprjplug.dll 219 220 Part IV — Hacking Navigation, Downloads, and Searching Then copy the following components files to the components subdirectory of your Firefox installation: Ⅲ nppl3 260 .xpt Ⅲ nsJSRealPlayerPlugin.xpt Because of security concerns and potential issues, Windows Media Player embedding with ActiveX... bar Type ms windows bsod and press Enter Firefox searches Microsoft’s web site using the terms “windows bsod” and shows you the results just as if you’d browsed to microsoft.com and used their search box Hacking the Search Box The real power of searching with Firefox is in the built-in search box in the browser’s upperright corner While Google is the default search engine, Firefox comes with several... Chinese, and more (see Figure 12 -6) FIGURE 12 -6: Translate’s list of available languages The Translate extension is available at https://addons.update.mozilla.org/ extensions/moreinfo.php?id=181 Put Your Search Results in a Sidebar The sidebar is a feature of the Mozilla suite that lets you keep your bookmarks, history, search tools, and other functions on the side of your browser window Firefox s... plugins that Firefox was able to automatically detect, based on operating system and configuration, in addition to the specific plugins located in the plugins subdirectory of your Firefox installation Because the Opera browser uses the same plugins programming interface, most, if not all, of the Opera plugins are compatible with Firefox 217 218 Part IV — Hacking Navigation, Downloads, and Searching... extensions such as Linky and DownThemAll by allowing you to download all links from the page being viewed via the right-click menu Another great feature that FlashGot provides, as shown in Figure 11-18, is that it adds an option to the standard Opening Firefox Setup dialog, which helps with MIME types that Firefox does not know how to handle Using FlashGot, you can avoid the lengthy setup and detailed drudgeries... implications For more information, visit the “Embedded Windows Media in Firefox posting available at http:// forums.mozillazine.org/viewtopic.php?t=2 062 13 A good reference for installing or configuring plugin support in Firefox for some common programs is available at http://www.mozilla.org/support /firefox/ faq#plugins Disabling Plugin Support for Specific File Extensions Because Firefox is designed... trying to figure out what the best MIME type handling setting are, I resorted to recommending a two-extension approach to dissecting the response headers and hacking MIME types from a web server The approach that has worked for me is to install both the LiveHTTPHeaders and Mimetype Editor extensions and to use the first to sniff out the MIME type or Content-Type and then add it using the editor The best . Tweak options and settings For more information on the Download Manger Tweak extension, visit http:// dmextension.mozdev.org/. 17_5 965 00 ch11.qxd 6/ 30/05 3:01 PM Page 205 2 06 Part IV — Hacking Navigation,. Mass Downloader and Download Express to allow Firefox integration. 17_5 965 00 ch11.qxd 6/ 30/05 3:02 PM Page 215 2 16 Part IV — Hacking Navigation, Downloads, and Searching So what exactly are these programs. extending and enhancing the fea- tures of the browser to handle audio, video, custom filetypes, or processing of requests. 17_5 965 00 ch11.qxd 6/ 30/05 3:02 PM Page 2 16 217 Chapter 11 — Download and

Ngày đăng: 10/08/2014, 12:21

Từ khóa liên quan

Tài liệu cùng người dùng

Tài liệu liên quan