#zotero.org.js

adding 2.0 site changes to translator.
This commit is contained in:
Matt Burton 2009-05-14 20:23:49 +00:00
parent 3e7995fee5
commit 120f850045

View file

@ -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');