YOURLS Firefox extension

Extension to shorten URLs from Firefox with your own YOURLS installation.

YOURLS is an URL shortener, just like bit.ly or goo.gl, but you are allowed to install your own private instance. So you can diminish the tracking of these big platforms ;-)
This piece of software is an extension for the browser Firefox that let’s you quickly shorten the URL of the website you are just visiting. All you need is a Firefox and an installation of YOURLS. You can also find this plugin at Mozillas addon service platform.

Integration

This add-on for the Firefox consists of three modifications of your browser overlay:

  1. Toolbar-button: This button comes with a menu, you can shorten the current page or open a new window browsing to the admin page of your YOURLS API:
    Toolbar button

    Toolbar button

  2. Context-menu: A new entry is integrated in your browsers context menu, that will shorten the current page:
    Context menu

    Context menu


    You can also select some text on the website to give a hint about the keyword (works only if you setup the extension to ask for keywords):
    Context menu with selection

    Context menu with selection

  3. Statusbar-button: In addition a small button is placed into the add-ons status bar, a click shortens the current page:
    Statusbar button

    Statusbar button

The result of a shortening will be displayed in an alert box:

Resulting window

Resulting window

Settings

The setup can be done in the Add-ons Manager (browse to about:addons). Click on the Preferences button next to the YOURLS shortener entry and you’ll see a window like this:

Settings window

Settings window

Following values should be provided:

API URL
The URL to your YOURLS installation. In my case it’s https://s.binfalse.de/
Signature
The signature of your account. You will find this string on the Tools page in the Secure passwordless API call section. This string is not required for public YOURLS installations.
Ask for a keyword?
Should the extension ask for a keyword before shortening? If this box is checked you’ll always be asked like this:
Provide keyword

Provide keyword


Not providing such a keyword has the same effect as unchecking the box: The API will decide about the short URL.
Max wait time
How many seconds should we wait for an answer from the API before we give up?

Download

This extension is licensed under GPLv3 and has it’s own project at SourceForge and of course it’s listed on AMO.

Download:
Extension: from AMO
Extension: 1.4 from SourceForge
Extension: 1.3 from SourceForge
Extension: 1.2 from SourceForge
Extension: 1.1 from SourceForge
Extension: 1.0 from SourceForge
SourceCode: from SourceForge
(Please take a look at the man-page. Browse bugs and feature requests.)

17 responses to “YOURLS Firefox extension”

  1. Looks neat !!
    I’ve been reported it doesn’t work with FF 5, could you update?

  2. Hi there-

    This is fantastic! Two quick questions for you. :)

    1. Am I understanding it correctly that the customization comes after the toolbar is installed?

    2. If so… As I understand it, this would be no bueno for public installations. Is there a way to adapt this in such a way that we could, say, offer the extension to download from our website for other people to use?

    Thanks and best wishes,
    Kristen

    That’s a very cruel authorization method you got going there, btw…

  3. Thank you!

  4. I suggest include the Russian language for your plagin, will help with translation.
    Is it possible, given the opportunity send a link to Twitter and Facebook? Thanks.

  5. Will there be support for plug-in FF6?

  6. Hello, Martin.

    I’d like to install this extension, as I own my Yourls instance; do you have any news about FF 6.x compatibility release ?

    Thanks, anymay.

  7. Hi Martin,

    great extension, muchos kudos!
    With bumping the maxVersion in install.rdf to 7.* your extension also works fine on Firefox 7.

    Would it be possible to automatically copy the short-url to the clipboard after it has been generated?
    Code would probably just this:

    1
    2
    3
    var clipboard = Components.classes["@mozilla.org/widget/clipboardhelper;1"]
                    .getService(Components.interfaces.nsIClipboardHelper);
    clipboard.copyString( ... );
  8. Some other small things I noticed while playing with the extension (btw: I am using v1.2, bumped for Fx7):

    • The extension should handle the case when the keyword already exists. You can test that easily if you set a specific keyword twice for different pages. On the second attempt the extension’s response is “The API returned crap”. Better would be a hint of duplication and the chance to enter an alternative keyword (and all of this silently if the option to enter the keyword manually is not set).

    • While everything is configured and works correctly the button “test configuration” in the options returns “undefined”, “4″ and shortens afterwards. A test shouldn’t really write to the database but just check if the settings make sense and work. What does “undefined” and “4″ mean?

    • If the option to enter the keyword manually is set it takes the keyword when entered and generates randomly when nothing is entered. But what is the Cancel button for? It seems to do the same thing as just entering nothing. Maybe it would be a good idea to give the user the option to cancel the keyword generation that way, so that hitting “Cancel” just closes all dialogues and doesn’t create a DB-entry.

    Just thoughts. :-) Love your extension, makes using YOURLS so much easier.

  9. Hi

    I’ve a suggestion, it possible move button from statusbar to toolbar to made shorturl direct and fast? Or can you add a short key combination to made short url?

    Congratulations for your addon

  10. [...] YOURLS Firefox extension [...]

  11. Right-clicked on a url on a page expecting the intuitive result of the link target url to be shortened, but the page itself got shortened instead.

  12. Right-click on link to shorten target link seemed to be working after modifying browsel.xul:

    thanks for the addon!

Leave a Reply