Re: Firefox: How to make Shift-Mouse-Button = Save Link As ... ?
Akkana <[email protected]> Tue, 16 Aug 2005 09:36:04 -0700
| Newsgroups | gmane.comp.mozilla.devel.unix |
|---|---|
| Message-ID | <[email protected]> |
Achim Schaefer asks how to get shift-click to "save as".
> Rinaldi J. Montessi wrote:
> > http://www.mozilla.org/unix/customizing.html#keys might help.
Alas, mouse clicks are not customizable like key events are.
Achim Schaefer writes:
> - I don't find the configuration files. Neither in the installation
> directory (/usr/lib/firefox-1.0.6/) nor in my local ~/.mozilla directory.
They're part of one of the .jar files -- toolkit.jar, it looks like.
A .jar file is just a zip archive -- use your favorite zip/unzip
program to expand it then pack it up again after you've edited it.
But those key bindings files won't help you with mouse clicks.
Here are the steps to get shift click to Save Link As:
- Unzip chrome/browser.jar
- Edit browser.js
- Find: function handleLinkClick
(around line 4984 in my tree, YMMV)
- Find the next instance of "if (event.shiftKey) {"
- Notice that it does the wrong thing. Delete everything up to
the line that starts with saveURL. You should end up with
something that looks something like this:
if (event.shiftKey) {
saveURL(href, linkNode ? gatherTextUnder(linkNode) : "", null, true, true, makeURI(docURL));
return true;
}
If you're not used to looking at Javascript code, note that it's
important that the number of { match the number of }, so be
careful about those curly braces.
- Notice that you no longer have an alt key binding (because you just
deleted it). If you want alt-click to do something, add a binding
for it while you're here. I just delete it, since alt-click is
used by window managers on Linux and never gets to mozilla so
it's not a useful binding.
- Zip up browser.jar again and put it back in the chrome directory
where it came from.
It's unfortunate that we have to hack the source to restore this
basic functionality to firefox, but none of the pleas from people
missing mozilla's easy "save as" method have been heeded in bug 245015.
In patch format, it looks like this (line numbers may be off):
Index: browser/base/content/browser.js
===================================================================
RCS file: /cvsroot/mozilla/browser/base/content/browser.js,v
retrieving revision 1.479
diff -u -p -u -p -0 -r1.479 browser.js
--- browser/base/content/browser.js 12 Aug 2005 07:01:08 -0000 1.479
+++ browser/base/content/browser.js 12 Aug 2005 21:23:54 -0000
@@ -4999,6 +5001 @@ function handleLinkClick(event, href, li
- openNewWindowWith(href, docURL, null);
- event.preventBubble();
- return true;
- }
-
- if (event.altKey) {
Hope this helps someone.
...Akkana