diff --git a/chrome/chromeFiles/content/scholar/xpcom/ingester.js b/chrome/chromeFiles/content/scholar/xpcom/ingester.js index c90b78ade..61bb23ed2 100644 --- a/chrome/chromeFiles/content/scholar/xpcom/ingester.js +++ b/chrome/chromeFiles/content/scholar/xpcom/ingester.js @@ -46,6 +46,20 @@ Scholar.Ingester.ProxyMonitor = new function() { function observe(channel) { channel.QueryInterface(Components.interfaces.nsIHttpChannel); try { + // remove content-disposition headers for endnote, etc. + var contentType = channel.getResponseHeader("Content-Type").toLowerCase(); + for each(var desiredContentType in Scholar.Ingester.MIMEHandler.URIContentListener.desiredContentTypes) { + if(contentType.length < desiredContentType.length) { + break; + } else { + if(contentType.substr(0, desiredContentType.length) == desiredContentType) { + channel.setResponseHeader("Content-Disposition", "", false); + break; + } + } + } + + // find ezproxies if(channel.getResponseHeader("Server") == "EZproxy") { // We're connected to an EZproxy if(channel.responseStatus != "302") { @@ -479,7 +493,10 @@ Scholar.Ingester.MIMEHandler = new function() { * nsIURIContentListener interface to grab MIME types */ Scholar.Ingester.MIMEHandler.URIContentListener = new function() { - var _desiredContentTypes = ["application/x-endnote-refer", "application/x-research-info-systems"]; + // list of content types to capture + // NOTE: must be from shortest to longest length + this.desiredContentTypes = ["application/x-endnote-refer", + "application/x-research-info-systems"]; this.QueryInterface = QueryInterface; this.canHandleContent = canHandleContent; @@ -497,7 +514,7 @@ Scholar.Ingester.MIMEHandler.URIContentListener = new function() { } function canHandleContent(contentType, isContentPreferred, desiredContentType) { - if(Scholar.inArray(contentType, _desiredContentTypes)) { + if(Scholar.inArray(contentType, this.desiredContentTypes)) { return true; } return false; @@ -510,7 +527,7 @@ Scholar.Ingester.MIMEHandler.URIContentListener = new function() { } function isPreferred(contentType, desiredContentType) { - if(Scholar.inArray(contentType, _desiredContentTypes)) { + if(Scholar.inArray(contentType, this.desiredContentTypes)) { return true; } return false; @@ -537,6 +554,8 @@ Scholar.Ingester.MIMEHandler.StreamListener = function(request, contentType) { getService(Components.interfaces.nsIWindowWatcher); this._frontWindow = windowWatcher.activeWindow; this._frontWindow.Scholar_Ingester_Interface.Progress.show(); + + Scholar.debug("EndNote prepared to grab content type "+contentType); } Scholar.Ingester.MIMEHandler.StreamListener.prototype.QueryInterface = function(iid) { diff --git a/chrome/chromeFiles/content/scholar/xpcom/scholar.js b/chrome/chromeFiles/content/scholar/xpcom/scholar.js index 1ce416e6f..e014c7991 100644 --- a/chrome/chromeFiles/content/scholar/xpcom/scholar.js +++ b/chrome/chromeFiles/content/scholar/xpcom/scholar.js @@ -745,7 +745,9 @@ Scholar.Date = new function(){ Scholar.debug("DATE: got year ("+date.year+", "+date.part+")"); // get short month strings from CSL interpreter - var months = CSL.getMonthStrings("short"); + if(!months) { + var months = CSL.getMonthStrings("short"); + } if(!_monthRe) { // then, see if have anything resembling a month anywhere _monthRe = new RegExp("^(.*)\\b("+months.join("|")+")[^ ]* (.*)$", "i"); @@ -791,6 +793,9 @@ Scholar.Date = new function(){ string += date.part+" "; } + if(!months) { + var months = CSL.getMonthStrings("short"); + } if(date.month != undefined && months[date.month]) { // get short month strings from CSL interpreter var months = CSL.getMonthStrings("long"); diff --git a/scrapers.sql b/scrapers.sql index 422e45839..a8f9bcd5f 100644 --- a/scrapers.sql +++ b/scrapers.sql @@ -1,4 +1,4 @@ --- 85 +-- 86 -- Set the following timestamp to the most recent scraper update date REPLACE INTO "version" VALUES ('repository', STRFTIME('%s', '2006-08-31 22:44:00')); @@ -5747,7 +5747,7 @@ Scholar.addOption("exportNotes", true); function detectImport() { var line; - while(line = Scholar.read()) { + while((line = Scholar.read()) !== "false") { line = line.replace(/^\s+/, ""); if(line != "") { if(line.substr(0, 6) == "TY - ") {