diff --git a/chrome.manifest b/chrome.manifest
index 1c0e851..22b74b6 100644
--- a/chrome.manifest
+++ b/chrome.manifest
@@ -1,8 +1,6 @@
content hocr-edit chrome/content/
-overlay chrome://browser/content/browser.xul chrome://hocr-edit/content/browser-overlay.xul
-overlay chrome://browser/content/navigator.xul chrome://hocr-edit/content/browser-overlay.xul
-
+overlay chrome://browser/content/browser.xul chrome://hocr-edit/content/browser-overlay.xul application={ec8030f7-c20a-464f-9b0e-13a3a9e97384}
+overlay chrome://navigator/content/navigator.xul chrome://hocr-edit/content/browser-overlay.xul application={92650c4d-4b8e-4d2a-b7eb-24ecf4f6b63a}
locale hocr-edit en-US chrome/locale/en-US/
-
-component {66124ee4-0939-11de-9057-00e04cf8693a} components/handler.js
-contract @mozilla.org/network/protocol;1?name=hocr-edit {66124ee4-0939-11de-9057-00e04cf8693a}
+component {66124ee4-0939-11de-9057-00e04cf8693a} components/handler.js application={ec8030f7-c20a-464f-9b0e-13a3a9e97384}
+contract @mozilla.org/network/protocol;1?name=hocr-edit {66124ee4-0939-11de-9057-00e04cf8693a} application={ec8030f7-c20a-464f-9b0e-13a3a9e97384}
diff --git a/chrome/content/browser-overlay.js b/chrome/content/browser-overlay.js
index feef907..fb21196 100644
--- a/chrome/content/browser-overlay.js
+++ b/chrome/content/browser-overlay.js
@@ -1,5 +1,9 @@
var hocr_edit = function () {
+ const kWindowMediatorContractID = "@mozilla.org/appshell/window-mediator;1";
+ const kWindowMediatorIID = Components.interfaces.nsIWindowMediator;
+ const kWindowMediator = Components.classes[kWindowMediatorContractID].getService(kWindowMediatorIID);
+
function is_hocr_document(doc) {
// determine if there's an element with class "ocr_page"
var xpe = new XPathEvaluator();
@@ -20,9 +24,10 @@ var hocr_edit = function () {
},
open_with_current_document: function () {
- var browser = top.document.getElementById("content");
+ var browserWindow = kWindowMediator.getMostRecentWindow("navigator:browser");
+ var browser = browserWindow.getBrowser();
var url = 'hocr-edit:' + window.content.document.baseURI;
- browser.loadOneTab(url, null, null, null, false, false);
+ browser.selectedTab = browser.addTab(url);
},
open_with_current_image: function () {
diff --git a/chrome/content/jquery.js b/chrome/content/jquery.js
index 9263574..037a6ac 100644
--- a/chrome/content/jquery.js
+++ b/chrome/content/jquery.js
@@ -372,6 +372,7 @@ jQuery.fn = jQuery.prototype = {
cur = cur.parentNode;
closer++;
}
+ return null;
});
},
@@ -1751,6 +1752,7 @@ var Expr = Sizzle.selectors = {
var m = context.getElementById(match[1]);
return m ? [m] : [];
}
+ return [];
},
NAME: function(match, context, isXML){
if ( typeof context.getElementsByName !== "undefined" ) {
@@ -1764,6 +1766,7 @@ var Expr = Sizzle.selectors = {
return ret.length === 0 ? null : ret;
}
+ return null;
},
TAG: function(match, context){
return context.getElementsByTagName(match[1]);
@@ -1946,8 +1949,8 @@ var Expr = Sizzle.selectors = {
} else if ( name === "not" ) {
var not = match[3];
- for ( var i = 0, l = not.length; i < l; i++ ) {
- if ( not[i] === elem ) {
+ for ( var j = 0, l = not.length; j < l; i++ ) {
+ if ( not[j] === elem ) {
return false;
}
}
--
1.7.0.4
I may ask you to put the jQuery changes in a separate patch, or I may
apply them separately.
In particular,
> - for ( var i = 0, l = not.length; i < l; i++ ) {
> - if ( not[i] === elem ) {
> + for ( var j = 0, l = not.length; j < l; i++ ) {
> + if ( not[j] === elem ) {
should be j++.
I will look through the remaining patches soon. Thanks again. I really
appreciate it.
- Jim
> Thank you for the patch series. What is the reason for patching jQuery?
> Does Seamonkey actively complain about things, or are the warnings
> coming from somewhere else?
Sorry, I should have put in a separate, not-seamonkey related branch
or something. Those small nitpicks are result of running the browser
with https://developer.mozilla.org/en/Setting_up_extension_development_environment#Development_preferences
enabled, "javascript.options.script" in particualr.
> should be j++.
Aaargh ...
>
> I will look through the remaining patches soon. Thanks again. I really
> appreciate it.
moz-hocr-edit still does not work 100% properly with my cuneiform hOCR files,
but I think it's no longer Seamonkey-related.
//Marcin
If you send me a test document, I can try to see what is wrong. So far
I have only tested with hocr files generated by ocropus and saved from
moz-hocr-edit itself.
In fact, if you send a document that is freely licensed, I can include
it in the test-documents/ directory of moz-hocr-edit.
- Jim