From c5716a395f0ae42e46d7d1cccf40e2d9f9e06ed0 Mon Sep 17 00:00:00 2001 From: Dan Stillman Date: Fri, 15 Apr 2016 04:20:09 -0400 Subject: [PATCH] Various RTF Scan fixes - Firefox 46 compatibility - Async DB - Stretched progress meters --- chrome/content/zotero/rtfScan.js | 19 +++++++++++-------- chrome/content/zotero/rtfScan.xul | 4 ++-- 2 files changed, 13 insertions(+), 10 deletions(-) diff --git a/chrome/content/zotero/rtfScan.js b/chrome/content/zotero/rtfScan.js index ffa9cc788..9172492bf 100644 --- a/chrome/content/zotero/rtfScan.js +++ b/chrome/content/zotero/rtfScan.js @@ -143,7 +143,7 @@ var Zotero_RTFScan = new function() { /** * Scans file for citations, then proceeds to next wizard page. */ - function _scanRTF() { + var _scanRTF = Zotero.Promise.coroutine(function* () { // set up globals citations = []; citationItemIDs = {}; @@ -231,7 +231,7 @@ var Zotero_RTFScan = new function() { } if(title) s.addCondition("title", "contains", title); s.addCondition("date", "is", date); - var ids = s.search(); + var ids = yield s.search(); Zotero.debug("Mapped to "+ids); citationItemIDs[citationString] = ids; @@ -239,11 +239,12 @@ var Zotero_RTFScan = new function() { unmappedCitationsChildren.appendChild(_generateItem(citationString, "")); unmappedCitationsItem.hidden = undefined; } else { // some mapping found - var items = Zotero.Items.get(ids); + var items = yield Zotero.Items.getAsync(ids); if(items.length > 1) { // check to see how well the author list matches the citation var matchedItems = []; for(var i=0; i name[0].toUpperCase()) + .join(""); if(initials != itemInitials) return false; } else { // not all initials; verify that the first name matches - var firstWord = firstName.substr(0, itemCreator.ref.firstName).toLowerCase(); - var itemFirstWord = itemCreator.ref.firstName.substr(0, itemCreator.ref.firstName.indexOf(" ")).toLowerCase(); + var firstWord = firstName.substr(0, itemCreator.firstName).toLowerCase(); + var itemFirstWord = itemCreator.firstName.substr(0, itemCreator.firstName.indexOf(" ")).toLowerCase(); if(firstWord != itemFirstWord) return false; } } diff --git a/chrome/content/zotero/rtfScan.xul b/chrome/content/zotero/rtfScan.xul index 1c533101d..1b83e42ad 100644 --- a/chrome/content/zotero/rtfScan.xul +++ b/chrome/content/zotero/rtfScan.xul @@ -45,7 +45,7 @@ &zotero.rtfScan.scanPage.description; - + &zotero.rtfScan.formatPage.description; - +