From 120f8500458b58d7920aa69274fd92641b6150a9 Mon Sep 17 00:00:00 2001 From: Matt Burton Date: Thu, 14 May 2009 20:23:49 +0000 Subject: [PATCH] #zotero.org.js adding 2.0 site changes to translator. --- translators/zotero.org.js | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/translators/zotero.org.js b/translators/zotero.org.js index 8e71972b9..3ee1626be 100644 --- a/translators/zotero.org.js +++ b/translators/zotero.org.js @@ -16,7 +16,7 @@ function detectWeb(doc, url) { var nsResolver = namespace ? function(prefix) { if (prefix == 'x') return namespace; else return null; } : null; - var a = doc.evaluate('//li[@class="topnav"]/a[text()="My Library"]', doc, nsResolver, XPathResult.ANY_TYPE, null).iterateNext(); + var a = doc.evaluate('//li[@id="library-tab"]/a[text()="My Library"]', doc, nsResolver, XPathResult.ANY_TYPE, null).iterateNext(); // Skip current user's library if (a && url.indexOf(a.href.match(/(^.+)\/items/)[1]) == 0) { return false; @@ -134,15 +134,13 @@ function xmlToItem(xmlItem) { function doWeb(doc, url) { if (url.indexOf("/groups/") == -1) { - var userID = url.match(/^http:\/\/[^\/]*zotero\.net\/[^\/]+\/([0-9]+)/)[1]; - var apiPrefix = "https://apidev.zotero.org/users/" + userID + "/"; - var itemRe = /^http:\/\/[^\/]*zotero\.net\/[^\/]+\/[0-9]+\/items\/([0-9]+)/; + var userID = url.match(/^http:\/\/[^\/]*zotero\.org\/[^\/]+\/([0-9]+)/)[1]; + var apiPrefix = "https://api.zotero.org/users/" + userID + "/"; + var itemRe = /^http:\/\/[^\/]*zotero\.org\/[^\/]+\/[0-9]+\/items\/([0-9]+)/; } else { - //var groupID = url.match(/^http:\/\/[^\/]*zotero\.net\/groups\/[^\/]+\/([0-9]+)/)[1]; // need slug url fix - var groupID = url.match(/^http:\/\/[^\/]*zotero\.net\/groups\/([0-9]+)/)[1]; - var apiPrefix = "https://apidev.zotero.org/groups/" + groupID + "/"; - //var itemRe = /^http:\/\/[^\/]*zotero\.net\/groups\/[^\/]+\/[0-9]+\/items\/([0-9]+)/; - var itemRe = /^http:\/\/[^\/]*zotero\.net\/groups\/[0-9]+\/items\/([0-9]+)/; + var groupID = url.match(/^http:\/\/[^\/]*zotero\.org\/groups\/[^\/]+\/([0-9]+)/)[1]; + var apiPrefix = "https://api.zotero.org/groups/" + groupID + "/"; + var itemRe = /^http:\/\/[^\/]*zotero\.org\/groups\/[^\/]+\/[0-9]+\/items\/([0-9]+)/; } var nsAtom = new Namespace('http://www.w3.org/2005/Atom');