commit 939a105cfe085075607f4eaccab7029324a86a85
parent d3a58f94778d1f45f12cf0ffd91769fd8d79dcbe
Author: Avram Lyon <ajlyon@gmail.com>
Date: Sun, 3 Apr 2011 19:26:52 +0000
Trans: Fixed Aleph by Ming Yeung Cheung, see http://forums.zotero.org/discussion/17299/
Still concerns with multiple item save, but at least sometimes works
Diffstat:
1 file changed, 47 insertions(+), 7 deletions(-)
diff --git a/translators/Library Catalog (Aleph).js b/translators/Library Catalog (Aleph).js
@@ -2,7 +2,7 @@
"translatorID":"cf87eca8-041d-b954-795a-2d86348999d5",
"translatorType":4,
"label":"Library Catalog (Aleph)",
- "creator":"Simon Kornblith and Michael Berkowitz",
+ "creator":"Simon Kornblith, Michael Berkowitz, Ming Yeung Cheung",
"target":"https?://[^/]+/F(?:/[A-Z0-9\\-]+(?:\\?.*)?$|\\?func=find|\\?func=scan|\\?func=short)",
"minVersion":"1.0.0b3.r1",
"maxVersion":"",
@@ -11,8 +11,34 @@
"lastUpdated":"2009-10-22 19:00:00"
}
+/*
+Aleph OPAC Translator
+Example installations (mainly French):
+http://naude.bibliotheque-mazarine.fr/
+http://bibli.polytechnique.fr/
+http://sifrix2.sdv.fr/
+http://aleph.insa-rouen.fr
+http://brenet.ens-lyon.fr
+http://bu-pau.univ-pau.fr/
+http://babel.bu.univ-paris5.fr
+http://inti.univ-paris4.fr/
+http://aleph.u-paris10.fr/
+http://servaleph.univ-catholyon.fr/
+http://armada.scd.univ-paris12.fr/
+http://catalogue.univ-angers.fr/
+http://biblio.ville-lehavre.fr/
+http://opac.nebis.ch/
+http://scd2.univ-lille1.fr/
+http://catalogue.univ-paris1.fr/
+http://source.ulg.ac.be/
+http://med.cite-sciences.fr/
+http://biblio.mulhouse.fr/
+http://mediatheque.sigdci76.fr/
+http://opac.biu-montpellier.fr/
+*/
+
function detectWeb(doc, url) {
- var singleRe = new RegExp("^https?://[^/]+/F/[A-Z0-9\-]+\?.*(?:func=full-set-set.*\&format=[0-9]{3}|func=direct|func=myshelf-full.*)");
+ var singleRe = new RegExp("^https?://[^/]+/F/[A-Z0-9\-]+\?.*(?:func=full-set-set|func=direct|func=myshelf-full.*)");
if(singleRe.test(doc.location.href)) {
return "book";
@@ -27,14 +53,29 @@ function detectWeb(doc, url) {
}
function doWeb(doc, url) {
- var detailRe = new RegExp("^https?://[^/]+/F/[A-Z0-9\-]+\?.*(?:func=full-set-set.*\&format=[0-9]{3}|func=direct|func=myshelf-full.*)");
+ var detailRe = new RegExp("^https?://[^/]+/F/[A-Z0-9\-]+\?.*(?:func=full-set-set|func=direct|func=myshelf-full|func=myself_full.*)");
var mab2Opac = new RegExp("^https?://[^/]+berlin|193\.30\.112\.134|duisburg-essen/F/[A-Z0-9\-]+\?.*");
var uri = doc.location.href;
var newUris = new Array();
if(detailRe.test(uri)) {
- var newuri = uri.replace(/\&format=[0-9]{3}/, "&format=001");
- if (newuri == uri) newuri += "&format=001";
+ // find the 'add to basket' link where it will have the document number, replace the function with 'direct'
+ if (doc.evaluate('//*[contains(@href, "myshelf-add-ful-1")]', doc, null, XPathResult.ANY_TYPE, null).iterateNext()) {
+ var elmts_add = doc.evaluate('//*[contains(@href, "myshelf-add-ful-1")]', doc, null, XPathResult.ANY_TYPE, null);
+ var adduri = elmts_add.iterateNext().attributes.getNamedItem("href").value;
+ adduri = adduri.replace("myshelf-add-ful-1", "direct");
+ //adduri = adduri.replace("myshelf-add-ful-1", "myshelf-full");
+ var baseuri = uri.match(".*\\?");
+ var funcuri = adduri.match("\\?.*");
+ newuri = baseuri + funcuri[0].match("[^\\?].*");
+ newuri += "&format=001";
+ //Zotero.debug('baseuri = ' + baseuri);
+ //Zotero.debug('funcuri = ' + funcuri);
+ Zotero.debug('directuri = ' + newuri);
+ } else {
+ var newuri = uri.replace(/\&format=[0-9]{3}/, "&format=001");
+ if (newuri == uri) newuri += "&format=001";
+ }
newUris.push(newuri);
} else {
var itemRegexp = '^https?://[^/]+/F/[A-Z0-9\-]+\?.*(?:func=full-set-set.*\&format=999|func=direct|func=myshelf-full.*)'
@@ -170,4 +211,4 @@ function doWeb(doc, url) {
newItem.complete();
}, function() {Zotero.done();});
Zotero.wait();
-}
-\ No newline at end of file
+}