From 35efd798defcd254b995ae80a789774e64a82c11 Mon Sep 17 00:00:00 2001 From: Dan Stillman Date: Mon, 16 Jan 2012 23:07:56 -0500 Subject: [PATCH] Save real target URLs from Google search results "Save Link as Zotero Item" previously saved Google's tracking page instead of the real destination. This can be extended to other sites if necessary. --- chrome/content/zotero/xpcom/utilities.js | 27 ++++++++++++++++++++++++ chrome/content/zotero/zoteroPane.js | 2 ++ 2 files changed, 29 insertions(+) diff --git a/chrome/content/zotero/xpcom/utilities.js b/chrome/content/zotero/xpcom/utilities.js index e65d1881ba..bfa170f977 100644 --- a/chrome/content/zotero/xpcom/utilities.js +++ b/chrome/content/zotero/xpcom/utilities.js @@ -1417,5 +1417,32 @@ Zotero.Utilities = { } } } + }, + + + /** + * Get the real target URL from an intermediate URL + */ + "resolveIntermediateURL":function(url) { + var patterns = [ + // Google search results + { + regexp: /^https?:\/\/(www.)?google\.(com|(com?\.)?[a-z]{2})\/url\?/, + variable: "url" + } + ]; + + for (var i=0, len=patterns.length; i