copyurlplus
| resources: | Home Customize! Mailing List Installation Source Code Members |
|---|
Customize!
Customize Copy URL+
As of version 1.1, Copy URL+ allows you to add your own menu entries. By simply adding a couple of entries to the user.js
file, you can create countless custom entries.
For each menu entry you need to have in addition to the standard three, you will need to add two lines to the user.js
file situated in your Mozilla/Firefox profile folder.
I recomend that you use the ChromEdit extension, to modify this file (thank Chad Cloman for the tip).
ChromEdit
Edit userChrome.css, userContent.css or user.js, without the hassle of finding your profile.
However, if you want to do it by yourself, please know that the location of theuser.jsfile is dependent of your operating system and it's per user. Since it's a user specific file, on a lot of systems it might not originally exist, so you'll have to create it.
To locate the proper folder read below:Quick Tip from David McRitchie (see more here):
- On Windows XP/2000, the path is usually
%AppData%\Mozilla\Firefox\Profiles\default.xxx\, where xxx is a random string of 3 characters. Just browse toC:\Documents and Settings\[User Name]\Application Data\Mozilla\Firefox\Profiles\and the rest should be obvious.- On Windows 95/98/Me, the path is usually
C:\WINDOWS\Application Data\Mozilla\Firefox\Profiles\default.xxx\- On Linux, the path is usually
~/.mozilla/firefox/default.xxx/- On MacOS X, the path is usually
~/Library/Application Support/Firefox/Profiles/default.xxx/
Check out this excellent page on more FireFox customizations:
- type in
about:cachein the address bar- notice the
Cache Directoryentry- take out the last
Cachefolder and that is the location of youruser.js
Firefox Help: Editing Configuration Files and Firefox Help: Tips & Tricks
These lines would like the following:
user_pref('copyurlplus.menus.1.label', 'Copy URL + Title + Sel (HREF + Tooltip)');
user_pref('copyurlplus.menus.1.copy', '<a href="%URL%" title="%SEL%">%TITLE%</a>');
In this example, the first line, the
.label line, defines the label of the new menu entry.
The second one defines the format of the text to be copied to clipboard when choosing this menu entry. The format of the entry is
copyurlplus.menus.<i>.label (or .copy), where i is an sequential number,
starting at 1. When creating multiple entries, make sure you don't skip any numbers as Copy URL+ will stop adding
entries to the menu when it detects a gap (e.g. 1,2,4 will only add entries 1 and 2).
The markup you can use inside the string is:
%URL%- the URL of the current document%TITLE%- the Title of the current document%SEL%- the current selection (empty string if nothing is selected)%RLINK%- the URL of the link you right-clicked on. This might be a little confusing, asURL, TITLE, SELare still properties of the current document, but you'll find this useful when copying text from blogs or news sites (which usually have a witty summary and a link to the remote site).%EOL%- End Of Line character and it's dependent on platform (\n for Linux, \r\n for Windows, \r for Macs).%UTC_TIME%- the time in UTC format%LOCAL_TIME%- the time in your local format (depending on browser and OS settings)%SEL_HTMLIFIED%- the current selection transformed to HTML. Useful for inclusion as HTML text.
For example, the following text:
<span class="foobar">Both you & me are "quoted".</span>
would be transformed to:
<span class="foobar">Both you & me are "quoted".</span>%TITLE_HTMLIFIED%- the title of the document, proper HTML format. (FWIW, no HTML tags should appear in the title of a document, but still...)%URL_HTMLIFIED%- the URL of the current document, in proper HTML format.%RLINK_HTMLIFIED%- the right-clicked link transformed to HTML.
Here are some examples of custom entries for your user.js file. Add as many as you want,
but don't forget to increment the number!
-
Wiki style
user_pref('copyurlplus.menus.1.label', 'Copy URL + Title (Wiki)'); user_pref('copyurlplus.menus.1.copy', '[[%URL% %TITLE%]]'); -
HTML Link
user_pref('copyurlplus.menus.1.label', 'Copy URL + Title (A href)'); user_pref('copyurlplus.menus.1.copy', '<a href="%URL_HTMLIFIED%">%TITLE%</a>'); -
HTML Link with selected text internalized as tooltip (TITLE)
user_pref('copyurlplus.menus.1.label', 'Copy URL + Title + Sel (A href + Tooltip)'); user_pref('copyurlplus.menus.1.copy', '<a href="%URL_HTMLIFIED%" title="%SEL_HTMLIFIED%">%TITLE_HTMLIFIED%</a>'); -
Link of the Remote site with Current's Page Title and Selected text
user_pref('copyurlplus.menus.1.label', 'Copy Link + Title + Sel'); user_pref('copyurlplus.menus.1.copy', "%TITLE%\n\"%SEL%\"\n%RLINK%"); -
Variation of the Remote Link Copy (courtesy of David McRitchie)
user_pref("copyurlplus.menus.1.label", "Copy URL + Title / *RLink* / Selection"); user_pref("copyurlplus.menus.1.copy", "%TITLE%\n%RLINK%\n%SEL%"); -
HTML Link with selected text externalized after a comma (courtesy of David McRitchie)
user_pref("copyurlplus.menus.1.label", "Copy URL + <a href=...>...</a>, selection"); user_pref("copyurlplus.menus.1.copy", "<a href=\"%URL_HTMLIFIED%\">%TITLE%</a>, %SEL_HTMLIFIED%"); -
Selection as link (courtesy of marbux)
user_pref("copyurlplus.menus.1.label", "Copy URL + <a href=...>selection</a>"); user_pref("copyurlplus.menus.1.copy", "<a href=\"%URL%\">%SEL%</a>"); -
Amazon Thumbnail with Link to Product (courtesy of Ren Aizawa)
(You need to select an ASIN number for the link to be properly generated. If you look at the Product Details of any listing on Amazon, it should have something like
ASIN: B0000C237Y)I'm breaking the copy text on multiple lines for display purposes. If this doesn't work for you, then you need to put it all on a single line; i.e. instead of
...affiliateid" ' + 'title...you need to have...affiliateid" title..., etc.user_pref('copyurlplus.menus.1.label', 'Amazon Thumbnail'); user_pref('copyurlplus.menus.1.copy', '<a href="http://www.amazon.com/exec/obidos/ASIN/%SEL%" ' +'title="%TITLE%"><img src="http://images.amazon.com/images/P/%SEL%.01.THUMBZZZ.jpg" ' +'alt="%TITLE%" title="%TITLE%" /></a>');If you are using an affiliate program the link changes slightly into:
user_pref('copyurlplus.menus.1.label', 'Amazon Thumbnail'); user_pref('copyurlplus.menus.1.copy', '<a href="http://www.amazon.com/exec/obidos/ASIN/%SEL%/affiliateid" ' +'title="%TITLE%"><img src="http://images.amazon.com/images/P/%SEL%.01.THUMBZZZ.jpg" ' +'alt="%TITLE%" title="%TITLE%" /></a>');replace
affiliateidwith your actual affiliateid -
Copying HTML code? Then your *_HTMLIFIED friends are here! (courtesy of Marc Meurrens)
HTML Link with selection as BLOCKQUOTEI'm breaking the copy text on multiple lines. If this doesn't work for you, then you need to put it all on a single line; i.e. instead of
...title="%TITLE_HTMLIFIED%">'' + '%EOL%...you need to have...title="%TITLE_HTMLIFIED%">'%EOL%..., etc.user_pref('copyurlplus.menus.1.label', 'Title + BQ Selection'); user_pref('copyurlplus.menus.1.copy', '<a href="%URL_HTMLIFIED%" target="_new" title="%TITLE_HTMLIFIED%">' + '%EOL%%TITLE% (on %LOCALTIME%)' + '%EOL%<blockquote>%SEL_HTMLIFIED%</blockquote>'); -
URL, Title and Quoted Selection in BBCode format (courtesy of Dominic Tey)
Almost all forum software supports BBCode formatting, so this should help.
user_pref("copyurlplus.menus.1.label", "Copy URL, Title, Sel (BBCode)"); user_pref("copyurlplus.menus.1.copy", "[url=\"%URL%\"]%TITLE%[/url], [quote]%SEL%[/quote]"); -
HTML Link displaying only the URL (courtesy of marbux)
user_pref('copyurlplus.menus.1.label', 'Copy URL as Hyperlink'); user_pref('copyurlplus.menus.1.copy', '<a href="%URL%">%URL%</a>');
Got more? Send them along and I'll be happy to add them!
Thanks!