# Ask Ubuntu Toolbar Buttons - A set of toolbar buttons for Ask Ubuntu that make it easy to insert links to packages, PPAs, etc.

## Update:

This script was previously called "Insert APT Link" but has now been renamed. As such, you need to uninstall any previous versions before installing the new one.

## Screenshot / Code Snippet

This UserScript adds some buttons to the editing toolbar that allow the following to easily be inserted:

This UserScript is fully compatible with inline editing and the toolbar buttons should show up anywhere there is a WMD editor.

You can install the script by clicking the link below:
http://files.quickmediasolutions.com/userscripts/au_toolbar.user.js

### Platform

Tested on Firefox 11 (and reported to work on Chrome too).

## Contact

I can be reached at admin@quickmediasolutions.com

## Code

Written in JavaScript using jQuery.

-
 Can this be made into an addon? Greasemonkey doesn't work with nightlies :/ – RolandiXor Jul 7 '11 at 20:23 @Roland: Really? (Shame on GreaseMonkey!) Actually, I'm afraid I have never written a Firefox addon. Ever. :( – Nathan Osman♦ Jul 7 '11 at 20:25 I guess this is time for me to brush up on javascript and write a jetpack :). – RolandiXor Jul 7 '11 at 22:26 Guess who got greasemonkey working since the latest update :D... – RolandiXor Jul 28 '11 at 4:54 @Roland: Hooray! So what Firefox version are we working with now? :) – Nathan Osman♦ Jul 28 '11 at 4:56 Firefox 8 still, 9 is on the way but hasn't landed yet :) – RolandiXor Jul 28 '11 at 5:20 Can this be updated to insert this new awesome button? meta.askubuntu.com/a/395/235 – Jorge Castro Apr 24 '12 at 22:32 @JorgeCastro: Sure - that button looks awesome. – Nathan Osman♦ Apr 25 '12 at 5:56 It looks like apps.ubuntu.com is the preferred way to install now, see here: meta.askubuntu.com/a/395/235 – Jorge Castro Apr 25 '12 at 16:20

I've made some improvements:

• [bugfix] At some pages, the button would not be added: Tag wiki and pressing "Add another answer"
• [feature] selected text will now immediately be converted to an APT link
• [feature] URLs like http://packages.ubuntu.com/package will now be converted to package (technically, it takes the part after the last /)
• Code cleanup: stripping http:// made no sense and was possibly a leftover from copying code directly

@GeorgeEdison: No problem, you may remove the download link from my answer after updating, keeping multiple (out-dated) copies is not a good idea. Could you add an link to this page in the userscript for future reference? E.g. @website http://stackapps.com/q/2405 – Lekensteyn Jun 13 '11 at 18:22
Chrome is giving me errors when I try to use the button when editing answers: Uncaught SyntaxError: Unexpected token ILLEGAL edit:13 // Uncaught TypeError: Object [object Object] has no method 'selection' – Nathan Osman Jun 15 '11 at 6:44