commit 9b5679fa1449d16355f7ee47e6beb30935456b1a
parent 1cf83d176039a22fe79d7af507462eb1bec152e7
Author: Simon Kornblith <simon@simonster.com>
Date: Thu, 30 Apr 2009 00:34:51 +0000
Make PDF recognizer compatible with FF 3.5, and tweak regexp
Diffstat:
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/chrome/content/zotero/recognizePDF.js b/chrome/content/zotero/recognizePDF.js
@@ -26,7 +26,7 @@
const Zotero_RecognizePDF_SUCCESS_IMAGE = "chrome://zotero/skin/tick.png";
const Zotero_RecognizePDF_FAILURE_IMAGE = "chrome://zotero/skin/cross.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
@@ -315,6 +315,7 @@ Zotero_RecognizePDF.Recognizer.prototype.recognize = function(file, callback, ca
// look for DOI
var allText = lines.join("\n");
+ Zotero.debug(allText);
var m = DOIre.exec(allText);
if(m) {
this._DOI = m[1];
@@ -362,7 +363,7 @@ Zotero_RecognizePDF.Recognizer.prototype._queryGoogle = function() {
var me = this;
if(this._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");
var item = {"itemType":"journalArticle", "DOI":this._DOI};
translate.setSearch(item);
@@ -425,6 +426,8 @@ Zotero_RecognizePDF.Recognizer.prototype._queryGoogle = function() {
* @private
*/
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") {
// hit the captcha
/*