Skip to content
Permalink
Browse files

BnF: Restore public view after translation (#1358)

Closes #1302.

* Restore also public view after scraping multiples
  • Loading branch information...
zuphilip authored and adam3smith committed Jul 7, 2017
1 parent f5b41c1 commit 60bb359bac4b16f3d17f2fe9436defb808321973
Showing with 14 additions and 6 deletions.
  1. +14 −6 Bibliotheque nationale de France.js
@@ -9,7 +9,7 @@
"inRepository": true,
"translatorType": 4,
"browserSupport": "g",
"lastUpdated": "2016-02-18 11:28:15"
"lastUpdated": "2017-07-07 11:47:44"
}

/*
@@ -530,7 +530,7 @@ var BnfClass = function() {


/* Process UNIMARC URL. */
this.processMarcUrl = function(newDoc) {
this.processMarcUrl = function(newDoc, url) {
/* Init MARC record. */
// Load MARC
var translator = Zotero.loadTranslator("import");
@@ -591,7 +591,15 @@ var BnfClass = function() {
//Check for Gallica URL
checkGallica(record, newItem);

newItem.complete();
//We have to restore the public view for the next actions
//by the users, which is achieved by opening the url with
//public ending again.
if (url.indexOf('.public')==-1) {
url = url.replace('.unimarc', '') + '.public';
}
ZU.doGet(url, function(text) {;
newItem.complete();
});
});
};
};
@@ -644,15 +652,15 @@ function doWeb(doc, url) {
if (urls.length > 0) {
//Z.debug(urls)
Zotero.Utilities.processDocuments(urls, function(doc) {
Bnf.processMarcUrl.call(Bnf, doc)
Bnf.processMarcUrl.call(Bnf, doc, urls[0]);
});
}
});
break;
case "single":
urls = [Bnf.reformURL(url)];
Zotero.Utilities.processDocuments(urls, function(doc) {
Bnf.processMarcUrl.call(Bnf, doc)
Bnf.processMarcUrl.call(Bnf, doc, url);
});
break;
default:
@@ -662,4 +670,4 @@ function doWeb(doc, url) {
}
/** BEGIN TEST CASES **/
var testCases = []
/** END TEST CASES **/
/** END TEST CASES **/

0 comments on commit 60bb359

Please sign in to comment.
You can’t perform that action at this time.