Make PDF recognizer compatible with FF 3.5, and tweak regexp
This commit is contained in:
parent
1cf83d1760
commit
9b5679fa14
|
@ -26,7 +26,7 @@
|
||||||
const Zotero_RecognizePDF_SUCCESS_IMAGE = "chrome://zotero/skin/tick.png";
|
const Zotero_RecognizePDF_SUCCESS_IMAGE = "chrome://zotero/skin/tick.png";
|
||||||
const Zotero_RecognizePDF_FAILURE_IMAGE = "chrome://zotero/skin/cross.png";
|
const Zotero_RecognizePDF_FAILURE_IMAGE = "chrome://zotero/skin/cross.png";
|
||||||
const Zotero_RecognizePDF_LOADING_IMAGE = "chrome://global/skin/icons/loading_16.png";
|
const Zotero_RecognizePDF_LOADING_IMAGE = "chrome://global/skin/icons/loading_16.png";
|
||||||
const DOIre = /\bdoi\: *([^\s]+)/i;
|
const DOIre = /doi:\s*(10\.[\w.]+\/[^\/\s]+)/i;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Front end for recognizing PDFs
|
* Front end for recognizing PDFs
|
||||||
|
@ -315,6 +315,7 @@ Zotero_RecognizePDF.Recognizer.prototype.recognize = function(file, callback, ca
|
||||||
|
|
||||||
// look for DOI
|
// look for DOI
|
||||||
var allText = lines.join("\n");
|
var allText = lines.join("\n");
|
||||||
|
Zotero.debug(allText);
|
||||||
var m = DOIre.exec(allText);
|
var m = DOIre.exec(allText);
|
||||||
if(m) {
|
if(m) {
|
||||||
this._DOI = m[1];
|
this._DOI = m[1];
|
||||||
|
@ -362,7 +363,7 @@ Zotero_RecognizePDF.Recognizer.prototype._queryGoogle = function() {
|
||||||
var me = this;
|
var me = this;
|
||||||
if(this._DOI) {
|
if(this._DOI) {
|
||||||
// use CrossRef to look for DOI
|
// use CrossRef to look for DOI
|
||||||
translate = new Zotero.Translate("search", true, false);
|
var translate = new Zotero.Translate("search", true, false);
|
||||||
translate.setTranslator("11645bd1-0420-45c1-badb-53fb41eeb753");
|
translate.setTranslator("11645bd1-0420-45c1-badb-53fb41eeb753");
|
||||||
var item = {"itemType":"journalArticle", "DOI":this._DOI};
|
var item = {"itemType":"journalArticle", "DOI":this._DOI};
|
||||||
translate.setSearch(item);
|
translate.setSearch(item);
|
||||||
|
@ -425,6 +426,8 @@ Zotero_RecognizePDF.Recognizer.prototype._queryGoogle = function() {
|
||||||
* @private
|
* @private
|
||||||
*/
|
*/
|
||||||
Zotero_RecognizePDF.Recognizer.prototype._scrape = function(/**Zotero.Translate*/ translate) {
|
Zotero_RecognizePDF.Recognizer.prototype._scrape = function(/**Zotero.Translate*/ translate) {
|
||||||
|
if(this._hiddenBrowser.contentDocument.location.href == "about:blank") return;
|
||||||
|
|
||||||
if(this._hiddenBrowser.contentDocument.title == "403 Forbidden") {
|
if(this._hiddenBrowser.contentDocument.title == "403 Forbidden") {
|
||||||
// hit the captcha
|
// hit the captcha
|
||||||
/*
|
/*
|
||||||
|
|
Loading…
Reference in New Issue
Block a user