cool extension! - patch to avoid discarding parts of title after a "-" Rated 3 out of 5 stars

I find this extension very useful. Thanks for writing and sharing it.

Here's a patch so that it doesn't discard stuff after the first "-" character.

--- chrome/content/copy-title.js.orig 2009-07-01 14:37:08.000000000 -0400
+++ chrome/content/copy-title.js 2010-04-06 21:46:38.000000000 -0400
@@ -1,7 +1,9 @@
function copy_page_title_to_clipboard() {
var str = Components.classes["@mozilla.org/supports-string;1"].createInstance(Components.interfaces.nsISupportsString);
var title = content.document.title;
- str.data = title.replace(/\s-\s[\w\s]*/, '');
+ // don't truncate stuff after "-"
+ // str.data = title.replace(/\s-\s[\w\s]*/, '');
+ str.data = title;

var trans = Components.classes["@mozilla.org/widget/transferable;1"].createInstance(Components.interfaces.nsITransferable);
trans.addDataFlavor("text/unicode");



I haven't put together any extensions myself but it would be really nice if you could test and incorporate this patch if it works for you. I imagine you'd want to check for the browser version to see if it's new enough that the "- Mozilla Firefox" isn't part of content.document.title. It isn't in 3.6 which is what I run and why I made the patch.

Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.2) Gecko/20100115 Firefox/3.6

I think I want to allow the user to configure their own regex.