www

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs | Submodules | README | LICENSE

commit 6d1e4471548b77bab99ed219fe95817b33804336
parent 90ff41cb40c3f80b92bf266249ce91e68c75f769
Author: Simon Kornblith <simon@simonster.com>
Date:   Wed, 21 Jun 2006 15:18:18 +0000

- Remove load eventListener after it has been called once
- Capture editors from Google Books



Diffstat:
Mchrome/chromeFiles/content/scholar/xpcom/ingester.js | 14+++++++++-----
Mscrapers.sql | 12+++++++++++-
2 files changed, 20 insertions(+), 6 deletions(-)

diff --git a/chrome/chromeFiles/content/scholar/xpcom/ingester.js b/chrome/chromeFiles/content/scholar/xpcom/ingester.js @@ -147,7 +147,7 @@ Scholar.Ingester.Utilities.prototype.processDocuments = function(browser, firstD var onLoad = function() { Scholar.debug("onLoad called"); if(hiddenBrowser.id == "scholar-hidden-browser") { - hiddenBrowser.removeEventListener("DOMContentLoaded", onLoad, true); + hiddenBrowser.removeEventListener("load", onLoad, true); try { var newHiddenBrowser = new Object(); Scholar.debug("new hidden browser"); @@ -586,20 +586,18 @@ Scholar.Ingester.Document.prototype.scrapePage = function(callback) { Scholar.debug("Scraping "+this.browser.contentDocument.location.href); - Scholar.debug(this.scraper.scraperJavaScript); - var scraperSandbox = this._sandbox; try { Components.utils.evalInSandbox(this.scraper.scraperJavaScript, scraperSandbox); } catch(e) { Scholar.debug(e+' in scraperJavaScript for '+this.scraper.label); this._scrapePageComplete(); + return; } - Scholar.debug("scraping complete"); - // If synchronous, call _scrapePageComplete(); if(!this._waitForCompletion) { + Scholar.debug("is asynch"); this._scrapePageComplete(); } } @@ -739,6 +737,12 @@ Scholar.Ingester.Document.prototype._updateDatabase = function() { creatorIndex++; } } + if(this.model.data[uri][prefixDummy + 'editor']) { + for(i in this.model.data[uri][prefixDummy + 'editor']) { + newItem.setCreator(creatorIndex, null, this.model.data[uri][prefixDummy + 'editor'][i], 3); + creatorIndex++; + } + } // Handle years, extracting from date if necessary if(Scholar.ItemFields.isValidForType(Scholar.ItemFields.getID("year"), typeID)) { diff --git a/scrapers.sql b/scrapers.sql @@ -1412,11 +1412,21 @@ utilities.loadDocument(newUri, browser, function(newBrowser) { for(j in authors) { model.addStatement(uri, prefixDC + ''creator'', authors[j]); } + } else if(field == "Editor(s)") { + var authors = value.split(", "); + for(j in authors) { + model.addStatement(uri, prefixDummy + ''editor'', authors[j]); + } } else if(field == "Publisher") { model.addStatement(uri, prefixDC + ''publisher'', value); } else if(field == "Publication Date") { + var date = value; + jsDate = new Date(value); - var date = utilities.dateToISO(jsDate); + if(!isNaN(jsDate.valueOf())) { + date = utilities.dateToISO(jsDate); + } + model.addStatement(uri, prefixDC + ''date'', date); } else if(field == "Format") { model.addStatement(uri, prefixDC + ''medium'', value);