closes #264, UMich lib catalog doesn't work on Windows; other issues related to Mirlyn
positions "saving item" window in a slightly better place on Windows the UMich bug was actually bigger than I though. as it turns out, the HiddenDOMWindow in Windows is not a chrome window, so i had to modify createHiddenBrowser() to attach the hidden browser object to an existing browser window. i don't believe this should have any adverse effects for snapshots, etc., but Dan, correct me if i'm wrong. it would be nice to be able to create a real chrome instance instead of a XUL element, but all of my attempts at doing so have failed.
This commit is contained in:
parent
2b0bebe7a4
commit
aa6e2cfab1
|
@ -457,8 +457,8 @@ Scholar_Ingester_Interface.Progress = new function() {
|
|||
function _move() {
|
||||
_progressWindow.sizeToContent();
|
||||
_progressWindow.moveTo(
|
||||
window.screenX + window.outerWidth - _progressWindow.outerWidth - 30,
|
||||
window.screenY + window.outerHeight - _progressWindow.outerHeight - 10
|
||||
window.screenX + window.innerWidth - _progressWindow.outerWidth - 30,
|
||||
window.screenY + window.innerHeight - _progressWindow.outerHeight - 10
|
||||
);
|
||||
}
|
||||
|
||||
|
|
|
@ -770,15 +770,15 @@ Scholar.Browser = new function() {
|
|||
|
||||
function createHiddenBrowser(myWindow) {
|
||||
if(!myWindow) {
|
||||
var myWindow = Components.classes["@mozilla.org/appshell/appShellService;1"]
|
||||
.getService(Components.interfaces.nsIAppShellService)
|
||||
.hiddenDOMWindow;
|
||||
var myWindow = Components.classes["@mozilla.org/appshell/window-mediator;1"]
|
||||
.getService(Components.interfaces.nsIWindowMediator)
|
||||
.getMostRecentWindow("navigator:browser");
|
||||
}
|
||||
|
||||
// Create a hidden browser
|
||||
var newHiddenBrowser = myWindow.document.createElement("browser");
|
||||
var windows = myWindow.document.getElementsByTagName("window");
|
||||
windows[0].appendChild(newHiddenBrowser);
|
||||
Scholar.debug(myWindow.document.documentElement.nodeName);
|
||||
myWindow.document.documentElement.appendChild(newHiddenBrowser);
|
||||
Scholar.debug("created hidden browser");
|
||||
return newHiddenBrowser;
|
||||
}
|
||||
|
|
|
@ -499,6 +499,7 @@ Scholar.Utilities.HTTP = new function() {
|
|||
// want to do this, because it makes it easier to leak memory
|
||||
Scholar.Utilities.HTTP.processDocuments = function(firstDoc, urls, processor, done, exception, saveBrowser) {
|
||||
var hiddenBrowser = Scholar.Browser.createHiddenBrowser();
|
||||
hiddenBrowser.docShell.allowImages = false;
|
||||
var prevUrl, url;
|
||||
|
||||
if (urls.length == 0) {
|
||||
|
|
60
scrapers.sql
60
scrapers.sql
|
@ -5,7 +5,7 @@ REPLACE INTO "version" VALUES ('repository', STRFTIME('%s', '2006-08-31 22:44:00
|
|||
|
||||
REPLACE INTO "translators" VALUES ('96b9f483-c44d-5784-cdad-ce21b984fe01', '2006-08-11 11:18:00', 4, 'Amazon.com', 'Simon Kornblith', '^http://www\.amazon\.com/',
|
||||
'function detectWeb(doc, url) {
|
||||
var searchRe = new RegExp(''^http://www\.amazon\.com/(gp/search/|exec/obidos/search-handle-url/|s/)'');
|
||||
var searchRe = new RegExp(''^http://(?:www\.)?amazon\.com/(gp/search/|exec/obidos/search-handle-url/|s/)'');
|
||||
if(searchRe.test(doc.location.href)) {
|
||||
return "multiple";
|
||||
} else {
|
||||
|
@ -1704,9 +1704,9 @@ function doWeb(doc, url) {
|
|||
}
|
||||
}');
|
||||
|
||||
REPLACE INTO "translators" VALUES ('cf87eca8-041d-b954-795a-2d86348999d5', '2006-06-26 16:01:00', 4, 'Aleph', 'Simon Kornblith', '^http://[^/]+/F(?:/[A-Z0-9\-]+(?:\?.*)?$|\?func=find)',
|
||||
REPLACE INTO "translators" VALUES ('cf87eca8-041d-b954-795a-2d86348999d5', '2006-06-26 16:01:00', 4, 'Aleph', 'Simon Kornblith', '^http://[^/]+/F(?:/[A-Z0-9\-]+(?:\?.*)?$|\?func=find|\?func=scan)',
|
||||
'function detectWeb(doc, url) {
|
||||
var singleRe = new RegExp("^http://[^/]+/F/[A-Z0-9\-]+\?.*func=full-set-set.*\&format=[0-9]{3}");
|
||||
var singleRe = new RegExp("^http://[^/]+/F/[A-Z0-9\-]+\?.*(?:func=full-set-set.*\&format=[0-9]{3}|func=direct)");
|
||||
|
||||
if(singleRe.test(doc.location.href)) {
|
||||
return "book";
|
||||
|
@ -1720,36 +1720,41 @@ REPLACE INTO "translators" VALUES ('cf87eca8-041d-b954-795a-2d86348999d5', '2006
|
|||
}
|
||||
}',
|
||||
'function doWeb(doc, url) {
|
||||
var detailRe = new RegExp("^http://[^/]+/F/[A-Z0-9\-]+\?.*func=full-set-set.*\&format=[0-9]{3}");
|
||||
var detailRe = new RegExp("^http://[^/]+/F/[A-Z0-9\-]+\?.*(?:func=full-set-set.*\&format=[0-9]{3}|func=direct)");
|
||||
var uri = doc.location.href;
|
||||
var newUris = new Array();
|
||||
|
||||
if(detailRe.test(uri)) {
|
||||
newUris.push(uri.replace(/\&format=[0-9]{3}/, "&format=001"))
|
||||
} else {
|
||||
var items = Scholar.Utilities.getItemArray(doc, doc, ''^http://[^/]+/F/[A-Z0-9\-]+\?.*func=full-set-set.*\&format=999'', ''^[0-9]+$'');
|
||||
|
||||
// ugly hack to see if we have any items
|
||||
var haveItems = false;
|
||||
for(var i in items) {
|
||||
haveItems = true;
|
||||
break;
|
||||
}
|
||||
|
||||
// If we don''t have any items otherwise, let us use the numbers
|
||||
if(!haveItems) {
|
||||
var items = Scholar.Utilities.getItemArray(doc, doc, ''^http://[^/]+/F/[A-Z0-9\-]+\?.*func=full-set-set.*\&format=999'');
|
||||
}
|
||||
|
||||
items = Scholar.selectItems(items);
|
||||
|
||||
if(!items) {
|
||||
return true;
|
||||
}
|
||||
|
||||
for(var i in items) {
|
||||
newUris.push(i.replace("&format=999", "&format=001"));
|
||||
}
|
||||
var itemRegexp = ''^http://[^/]+/F/[A-Z0-9\-]+\?.*(?:func=full-set-set.*\&format=999|func=direct)''
|
||||
var items = Scholar.Utilities.getItemArray(doc, doc, itemRegexp, ''^[0-9]+$'');
|
||||
|
||||
// ugly hack to see if we have any items
|
||||
var haveItems = false;
|
||||
for(var i in items) {
|
||||
haveItems = true;
|
||||
break;
|
||||
}
|
||||
|
||||
// If we don''t have any items otherwise, let us use the numbers
|
||||
if(!haveItems) {
|
||||
var items = Scholar.Utilities.getItemArray(doc, doc, itemRegexp);
|
||||
}
|
||||
|
||||
items = Scholar.selectItems(items);
|
||||
|
||||
if(!items) {
|
||||
return true;
|
||||
}
|
||||
|
||||
for(var i in items) {
|
||||
var newUri = i.replace("&format=999", "&format=001");
|
||||
if(newUri == i) {
|
||||
newUri += "&format=001";
|
||||
}
|
||||
newUris.push(newUri);
|
||||
}
|
||||
}
|
||||
|
||||
var translator = Scholar.loadTranslator("import");
|
||||
|
@ -5728,6 +5733,7 @@ record.prototype.importBinary = function(record) {
|
|||
|
||||
// add a field to this record
|
||||
record.prototype.addField = function(field, indicator, value) {
|
||||
Scholar.Utilities.debug("adding field "+field+": "+value);
|
||||
field = parseInt(field, 10);
|
||||
// make sure indicator is the right length
|
||||
if(indicator.length > this.indicatorLength) {
|
||||
|
|
Loading…
Reference in New Issue
Block a user