Vimperator/Conkeror-like link selection - firefox

I use Conkeror on a daily basis except at work where I need Firebug, since I'm a web developer. I really miss having the "follow link" ability in Conkeror but I don't want to resort to using Vimperator to get it.
Is there any Firefox extension which lets me follow links by hitting a key followed by the link text like in Conkeror?

There are many ways you can already use only the keyboard to browse with Firefox.
Searching pages
The find-as-you-type feature was an epiphany. While Google is great at getting you to the right web page, Firefox's find-as-you-type feature gets you the rest of the way.
Find as you type text: /
Find as you type link: '
Regular old find: Ctrl/Cmd+F
The link search is very useful, especially when used in conjunction with...
Opening pages
Unless you do all of your browsing in one page, these shortcuts are huge when you don't want to go running for your mouse.
Open link in new window: Shift+Enter
Open link in new tab: Ctrl/Cmd+Enter
Open address/search in new tab: Alt/Option+Enter
Used together with their respective shortcuts (address and search bar shortcuts and the find-as-you-type link shortcut), the page opening shortcuts go a long way toward mouse-less browsing.
Of course, you can also use the Mousless Browsing plugin.
Mouseless Browsing (MLB) enables you to browse the web entirely with the keyboard. The basic principle is to add small boxes with unique ids behind every link and/or form element. You just have to type in the id to trigger the corresponding action i.e. following a link, pressing a button or selecting a textfield...

There's Pentadactyl - and all firefox extensions work well with it.

https://addons.mozilla.org/en-US/firefox/addon/8781
Works even better with Linkification, I might add.

Related

Lock Firebug to a specified page

Is there a way to keep Firebug on a single page, so that when I switch pages it remains on the page I want it set to?
For example, I'm working on a project and I get an error that I want to search for on Stack Overflow, but when I navigate here, the console changes to reflect this site. I'd like to stop that from happening.
There is no option to "pin" a page's data in Firebug (as of version 2.x). As far as I know this also doesn't work in any of the browser built-in dev tools.
Though the simple solution for your problem is to open the other page in a separate tab or window. Doing so keeps all the data of the page saved when you switch back to the tab containing your project's page.
Note that Firebug's activation model is based on URLs following the same origin policy. I.e. if you open it for your project's page, it will always get opened for your projects page, even on other tabs, but not for any other site.
I've found it useful to split the tab of interest off into a new window and to activate Firebug on that window. That way I can continue using my original tab collection/window without it changing as I link-hop.

Firefox Extension that copies HTML link to current web page to clipboard and not just the URL

The Situation
I need to automate the copying of a HTML link to the current page that
is viewed in the current Firefox Tab into other WYSIWYG editors. This
is not the same as copying just the plain-text of the URL, nor is it
the same as pasting just the plain-text of the web pages title. This
is also not the same thing as navigating to some other web page that
has the HTML link to the page of interest, selecting the text with the
mouse cursor, and typing CTRL-C to copy it into the current operating
systems clipboard (both Linux and Windows, should not make any
difference). Only the update to the clipboard is to be automated; the
pasting from the clipboard into the target application will be done
manually.
The desired use case is as follows:
The user browses to any web page from within Firefox.
The user types some user-specified key sequence that is not
in conflict with standard Firefox built-in key bindings.
Firefox will then do only part of what Copy Link Bookmarklet
does: Instead of opening up a new separate window/tab and
constructing and rendering the HTML for the link, and then
requiring the user to waste motion in selecting and copying the
link into the clipboard, the extension will then format the HTML
itself and copy that into the clipboard directly.
The user then selects any of the targets described below and
types CTRL-V to paste the formatted text.
The user then sees the link as a link in that target area, and does
not see anything literal like http://...
For example, if the webpage browsed to was http://www.google.com, and
the user clicked the user-defined key sequence, and if the user pasted
it into some Google Document, what they would see in that document is
not http://www.google.com nor would they see Google, but instead
would see what you would see when you read this in StackOverflow in a
web browser: Google
Now, there are Firefox extensions and bookmarklets that come close,
but they all involve no net reduction in mouse motion and/or key press
overhead, which is the most time-wasting aspect of this frequently
occuring use case. My searches for an existing extension turned
up nothing that exactly meets my needs (see Research section
below). Therefore, I think I may need to roll my own extension (or
modify an existing one), unless someone can point me to an existing
extension that provides this functionality.
The extension I have in mind should work in Firefox version 11 or
greater running on either Linux or any version of Windows. Only
Firefox and a suitable Firefox extension should be needed, and not any
other special software.
Targets of the paste should be:
GMail compose text areas
Google Documents
Microsoft Word documents
Microsoft Outlook compose text areas.
Any other WYSIWYG editor such as the Blogger post editor.
Notepad (in which case it is the web page title that is pasted only
and not the URL, or both the web page title and URL as separate
plaintext; either way).
About user-specified key bindings: If there was an extension already
that did the above but without providing the ability to bind a
keybinding to it, then I would expect to be able to use the keyconfig
extension extension to handle that aspect. Actually, that might
even be preferable; I don't know yet.
Research
Below are approaches I investigated that came close to what I want,
but did not exactly meet the need:
Hacking on Copy Link Bookmarklet won't work because, from what I can tell, there is no way to update the OS's clipboard from a bookmarklet, hence why I think that a Firefox extension is required.
In a Firefox extension, how can I copy rich text / links to the clipboard?
3 FireFox Addons to Easier Copy Links and Anchor Texts -- None of the extensions listed do what I want because they force you to use the right mouse button and navigate down one or two levels of context menu, which is wasted motion.
Copy Link Text (CoLT) -- CoLT also supports copying a hyperlink and it’s associated text as a rich-text formatted link, however it does not include a default keybinding. It looks like someone else is attempting to tie keyconfig to CoLT, which might be an option as a solution.
Copy URL Plus -- Looks like it has the copy-to-clipboard logic, but doesn't look like it has been maintained since Firefox 1.x timeframe.
I am answering my own question:
The CTRL-SHIFT-F11 binding will silently stop working if both keysnail and keyconfig are installed into the same Firefox browser. The fix for me was to simply uninstall keysnail as I don't use it.
I did not actually need to write my own Firefox extension, but I did
need to scrape out a bit of code that copies the richtext link from
the Copy Link Text (CoLT) extension and apply it directly as a
binding into the keyconfig extension as follows:
Install the keyconfig extension.
Restart Firefox.
After Firefox loads up, type CTRL-SHIFT-F12 to bring up the keyconfig configuration menu.
On the bottom of the page, click on the Add a new key button.
In the Name field, type in some suitable name such as Copy Rich Text Link to Current Page.
Type in the following chunk of Javascript code (This code I carved
out of the objCoLT.CopyBoth function inside the content/colt.js
file inside the Copy Link Text (CoLT) extension):
var url = content.document.location.href;
var text = content.document.title;
// Use the users selection instead of the title if text is selected:
var selection = document.commandDispatcher.focusedWindow.getSelection().toString();
if (selection != "")
{
text = selection;
}
var richText = "" + text + "";
var xfer = Components.classes["#mozilla.org/widget/transferable;1"].createInstance(Components.interfaces.nsITransferable);
xfer.addDataFlavor("text/html");
var htmlString = Components.classes["#mozilla.org/supports-string;1"].createInstance(Components.interfaces.nsISupportsString);
htmlString.data = richText;
xfer.setTransferData("text/html", htmlString, richText.length * 2);
var clipboard = Components.classes["#mozilla.org/widget/clipboard;1"].getService(Components.interfaces.nsIClipboard);
clipboard.setData(xfer, null, Components.interfaces.nsIClipboard.kGlobalClipboard);
Click Ok.
Back in the main Keyconfig dialog, <disabled> should be shown in the text field to the left of the Apply button.
Click in that text field, and type the keybinding you want to associate with it, such as CTRL-SHIFT-F11.
Click the Apply button.
Click the Close button to close the Keyconfig configuration dialog box.
To test this out, proceed as follows:
In Firefox, navigate to some arbitrary page.
Type in CTRL-SHIFT-F11 (or whatever keybinding you chose above).
Notice that no dialog boxes popup; that is intentional.
Open up Google Documents, and Create a new document.
Click in the new document, and type CTRL-V.
You should see the HTML/rich-text form of the link pasted in.
Click on the link and then click on the URL to the left of Change.
The browser should open up the original page corresponding to that URL.
I have been able to copy URL as HTML with the following bookmark:
javascript: navigator.clipboard.write([new ClipboardItem({ ["text/html"]: new Blob([`${document.title}`], { type: "text/html" }) })]);
Unfortunately in firefox the Clipboard write API still requires to set thedom.events.asyncClipboard.clipboardItem to true in about:config.
Several extensions exist that offer copying of title and URL but few seem to support Rich Text creation. The key is that the copied text needs to be formatted in html with a href and it needs to be copied as a text/html type.
The extension I went with in the end is CopyTabTitleUrl. (GitHub) It supports both requirements and also has a keybind feature along with a toolbar button that can also function as a single-click copy.
Set the Format option to:
${title}
Then Activate Extended Mode and make sure to check the "Copy in text/html format" option in Other. After that, using the format copy, the result can be correctly pasted into Office applications. And Stack Exchange evidently as the links above were created by the add-on.
Note that the Edge implementation of URL copying seems to be somewhat different still. With a default plaintext paste, Edge will just paste in the URL while this approach will of course paste unformatted HTML. But it's close enough.

What is the name of the stock Firefox tool to display HTML code for the part of the page under the mouse?

Less than month ago, by accident I discovered a nice tool in Firefox that was installed by default. I don't remember the name (probably code inspector or something like that) but I used Ctrl+Shift+I (Tools -> Webdeveloper -> Name of tool) shortcut to run it.
What was the tool? The tool worked such that when you positioned the mouse over some place in the webpage, in the tool's window you would see the HTML code for that place. Now, I my system is updated, and this tool has disappeared from my browser. I'm very disappointed. Anyone know what tool I'm looking for?
Thanks in advance,
Kuba
By the sound of what you are describing it was probably the Web Developer addon, might also have been Firebug (which in my opinion is better).
You can try right clicking on the page element and select "Inspect Element" which will enable element inspection. This will enable you to view the HTML contents of the elements under your mouse.
The name of this tool is: Page Inspector
https://developer.mozilla.org/en-US/docs/Tools/Page_Inspector

How do I disable Firefox's "Search for text when I start typing" on pages with keyboard shortcuts?

Some web pages such as GMail and Reddit(with the Reddit Enhancement Suite) have useful keyboard shortcuts that I'd like to use. However, whenever I start typing on one of these pages, the first onkeypress event fires, but then the "Search for text when I start typing" search bar opens and blocks further keys.
I don't want to disable "Search for text when I start typing" as I use it on most other web pages. Is there any way to selectively disable it, or to make a keyboard shortcut/bookmarklet to toggle it?
To disable this in firefox, just go to "Options->General Tab->Browsing and disable "Search for text when I start typing". More info here . This is very useful in some cases, for example when you try to play WebGL games or when using pages like Gmail or Protonmail that have their own kb shortcuts.
UPDATED to version 73.0.1- In previous versions of Firefox this is in "Tools->Options->Advanced->General Tab" or in "Preferences->General->Browsing"
This is still an issue huh? I love this feature but It also bothers me every now and then. There are some pages that get it right. I never dug into how they do it. For instance:
zty.pe - JS browser typing game. Would be pretty bad if typing caused searching here. It actually captures the keys just when the game starts and NOT by default on the page.
That is not Firefox or any other browser feature. To do this, you have to write server and client side code.
Catch text that user types into input, and send it using preferably AJAX to server-side script. Then server side script should look up for matches in DB (some search engine), and return possible combinations. All you have to do on client side (JS) is to show returned results in some nice way - like in google - you can use for example simple html lists, but you have to code some css to make it look properly. Also nice feature is to code JS to work on up/down keys and enter for selecting element (it should also work for mouse).
It's not very simple to do by yourself, but you have now idea how to do it. You could also google for some scripts - surely there is something :)
Good luck!

Developing a Firefox addon that turns a file's URI into its filename when saving it

I've read some documentation and tutorials about developing Firefox Addons.
But never found how to do this.
I would like to make an addon that when you try to save a file (via left-click or right-click/save as) it automatically sets the to-be-created-file's name to be the same as the original file's URI. (but with some changes, like making slashes into hyphens, etc.)
Any hints on how to do this?
Thanks!
I don't believe Firefox Add-ons can change the default "save as" behavior. They could however add another option in the context menu (right click) perhaps named "save as file named with uri". You'd want to learn some JavaScript and such and look at a demo Add-on for the context menu.
Okay, so I looked at a starting point, which took me to these:
A pretty complete get up an developing guide from Mozilla. (No context menu stuff)
A XUL reference. It mentions there is a way to configure the context menu.
Some code snippets for various Mozilla developing.
A very comprehensive hello-world. Similar to #1, but it DOES cover adding actions in the context menu.
I think you can override any behaviour in Firefox - finding out the correct XPCOM call and location in the DOM tree is another matter. Have a look at Extending Firefox and Thunderbird

Resources