From 759c7bd58b86b18408d786f89e2553e781840f9a Mon Sep 17 00:00:00 2001 From: Dan Stillman Date: Wed, 7 Mar 2012 11:34:31 -0500 Subject: [PATCH 01/37] Fix metadata retrieval for files with extended characters in filenames --- chrome/content/zotero/recognizePDF.js | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/chrome/content/zotero/recognizePDF.js b/chrome/content/zotero/recognizePDF.js index 11754ec3b..72b6cb3ca 100644 --- a/chrome/content/zotero/recognizePDF.js +++ b/chrome/content/zotero/recognizePDF.js @@ -269,7 +269,18 @@ Zotero_RecognizePDF.Recognizer.prototype.recognize = function(file, libraryID, c var args = ['-enc', 'UTF-8', '-nopgbrk', '-layout', '-l', MAX_PAGES]; args.push(file.path, cacheFile.path); - proc.run(true, args, args.length); + try { + if (!Zotero.isFx36) { + proc.runw(true, args, args.length); + } + else { + proc.run(true, args, args.length); + } + } + catch (e) { + Zotero.debug("Error running pdfinfo", 1); + Zotero.debug(e, 1); + } if(!cacheFile.exists()) { this._callback(false, "recognizePDF.couldNotRead"); From e3ce3bf0c431cc0f0b761812bc6c58165d03c3ad Mon Sep 17 00:00:00 2001 From: aurimasv Date: Wed, 7 Mar 2012 21:27:51 -0600 Subject: [PATCH 02/37] Include \s in superCleanString, so we match non-breaking space and other space characters outside of 7 bit ASCII --- chrome/content/zotero/xpcom/utilities.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/chrome/content/zotero/xpcom/utilities.js b/chrome/content/zotero/xpcom/utilities.js index cc484142d..15f514015 100644 --- a/chrome/content/zotero/xpcom/utilities.js +++ b/chrome/content/zotero/xpcom/utilities.js @@ -215,8 +215,8 @@ Zotero.Utilities = { throw "superCleanString: argument must be a string"; } - var x = x.replace(/^[\x00-\x27\x29-\x2F\x3A-\x40\x5B-\x60\x7B-\x7F]+/, ""); - return x.replace(/[\x00-\x28\x2A-\x2F\x3A-\x40\x5B-\x60\x7B-\x7F]+$/, ""); + var x = x.replace(/^[\x00-\x27\x29-\x2F\x3A-\x40\x5B-\x60\x7B-\x7F\s]+/, ""); + return x.replace(/[\x00-\x28\x2A-\x2F\x3A-\x40\x5B-\x60\x7B-\x7F\s]+$/, ""); }, /** From 52f47b2510b195b48a45336e4a75e1184cac2556 Mon Sep 17 00:00:00 2001 From: Simon Kornblith Date: Thu, 8 Mar 2012 01:26:45 -0500 Subject: [PATCH 03/37] Fix bug affecting translation-server --- chrome/content/zotero/xpcom/translation/translate.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/chrome/content/zotero/xpcom/translation/translate.js b/chrome/content/zotero/xpcom/translation/translate.js index 061f94914..28ab273cd 100644 --- a/chrome/content/zotero/xpcom/translation/translate.js +++ b/chrome/content/zotero/xpcom/translation/translate.js @@ -459,7 +459,7 @@ Zotero.Translate.Sandbox = { var newCallback = function(selectedItems) { callbackExecuted = true; if(haveAsyncHandler) { - translate.translate(this._libraryID, this._saveAttachments, selectedItems); + translate.translate(translate._libraryID, translate._saveAttachments, selectedItems); } else { returnedItems = selectedItems; } From 5bdb050b5fe791176eded9e7d8632f78e880d3a1 Mon Sep 17 00:00:00 2001 From: Simon Kornblith Date: Thu, 8 Mar 2012 01:27:03 -0500 Subject: [PATCH 04/37] Support multiple character browsers --- chrome/content/zotero/tools/testTranslators/testTranslators.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/chrome/content/zotero/tools/testTranslators/testTranslators.js b/chrome/content/zotero/tools/testTranslators/testTranslators.js index 5c6a6757c..ed1c00d4d 100644 --- a/chrome/content/zotero/tools/testTranslators/testTranslators.js +++ b/chrome/content/zotero/tools/testTranslators/testTranslators.js @@ -488,7 +488,7 @@ function init() { hashVars[myVar.substr(0, index)] = myVar.substr(index+1); } - if(hashVars["browser"] && /^[a-z]$/.test(hashVars["browser"]) + if(hashVars["browser"] && /^[a-z]+$/.test(hashVars["browser"]) && hashVars["version"] && /^[0-9a-zA-Z\-._]/.test(hashVars["version"])) { loc = "testResults-"+hashVars["browser"]+"-"+hashVars["version"]+".json"; } From 5816e586fe7e8bf265f5e1d5c6c9f7bac0fca52d Mon Sep 17 00:00:00 2001 From: aurimasv Date: Thu, 8 Mar 2012 02:34:38 -0600 Subject: [PATCH 05/37] Sort arrays before comparing them. Tag order does not matter and authors will not be sorted. --- chrome/content/zotero/tools/testTranslators/translatorTester.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/chrome/content/zotero/tools/testTranslators/translatorTester.js b/chrome/content/zotero/tools/testTranslators/translatorTester.js index c987bc120..29a7a0814 100644 --- a/chrome/content/zotero/tools/testTranslators/translatorTester.js +++ b/chrome/content/zotero/tools/testTranslators/translatorTester.js @@ -574,6 +574,8 @@ Zotero_TranslatorTester.prototype._compare = function(i, j) { var match = false; if (Object.prototype.toString.apply(i) === '[object Array]') { if (Object.prototype.toString.apply(j) === '[object Array]') { + i.sort(); + j.sort(); do { match = this._compare(i.pop(), j.pop()); } while (match && i.length && j.length); From 1475a79cd1450a71de927550faf6e45709677a74 Mon Sep 17 00:00:00 2001 From: Dan Stillman Date: Thu, 8 Mar 2012 14:32:38 -0500 Subject: [PATCH 06/37] Open csledit/cslpreview in new tab in existing window in Fx Fixes #75 --- chrome/content/zotero/preferences/preferences.js | 8 ++++++-- chrome/content/zotero/preferences/preferences.xul | 6 +++--- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/chrome/content/zotero/preferences/preferences.js b/chrome/content/zotero/preferences/preferences.js index a1e8857d0..f08f363b0 100644 --- a/chrome/content/zotero/preferences/preferences.js +++ b/chrome/content/zotero/preferences/preferences.js @@ -1914,7 +1914,7 @@ function handleShowInPreferenceChange() { /** * Opens a URI in the basic viewer in Standalone, or a new window in Firefox */ -function openInViewer(uri) { +function openInViewer(uri, newTab) { var wm = Components.classes["@mozilla.org/appshell/window-mediator;1"] .getService(Components.interfaces.nsIWindowMediator); const features = "menubar=yes,toolbar=no,location=no,scrollbars,centerscreen,resizable"; @@ -1930,7 +1930,11 @@ function openInViewer(uri) { } else { var win = wm.getMostRecentWindow("navigator:browser"); if(win) { - win.open(uri, null, features); + if(newTab) { + win.gBrowser.selectedTab = win.gBrowser.addTab(uri); + } else { + win.open(uri, null, features); + } } else { var ww = Components.classes["@mozilla.org/embedcomp/window-watcher;1"] diff --git a/chrome/content/zotero/preferences/preferences.xul b/chrome/content/zotero/preferences/preferences.xul index d73f0ad6d..2058aca63 100644 --- a/chrome/content/zotero/preferences/preferences.xul +++ b/chrome/content/zotero/preferences/preferences.xul @@ -800,9 +800,9 @@ To add a new preference: -