Skip to content

Instantly share code, notes, and snippets.

@958
Created May 31, 2011 01:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save 958/999712 to your computer and use it in GitHub Desktop.
Save 958/999712 to your computer and use it in GitHub Desktop.
[keysnail]XUL/Migemo を KeySnail から叩く
key.setViewKey('/', function (ev, arg) {
window.XMigemoFind.target = document.getElementById('content');
window.XMigemoFind.clear(false);
window.XMigemoFind.isLinksOnly = false;
window.XMigemoFind.isQuickFind = false;
window.XMigemoFind.findMode = window.XMigemoFind.FIND_MODE_MIGEMO;
window.XMigemoFind.caseSensitive = false;
prompt.reader({
message : 'Find:',
onChange: function (arg) window.XMigemoFind.find(false, arg.textbox.value, false),
callback: function (text) {}
});
}, 'Migemo 検索', true);
key.setViewKey('n', function (ev, arg) {
window.XMigemoFind.findNext(true);
}, 'Migemo 検索 - 次へ', true);
key.setViewKey('N', function (ev, arg) {
window.XMigemoFind.findPrevious(true);
}, 'Migemo 検索 - 前へ', true);
--- a/components/xmXMigemoTextUtils.js
+++ b/components/xmXMigemoTextUtils.js
@@ -538,9 +538,11 @@
var lastNode;
+ var isGet = false;
var utils = w.QueryInterface(Ci.nsIInterfaceRequestor)
.getInterface(Ci.nsIDOMWindowUtils);
if ('nodesFromRect' in utils) { // Firefox 3.6-
+try {
let nodes = utils.nodesFromRect(
0,
0,
@@ -568,8 +570,11 @@
}
while (this.visibleNodeFilter.acceptNode(nodes[i]) != this.visibleNodeFilter.kACCEPT && i > -1);
}
+ isGet = true;
+}catch(e){}
}
- else { // -Firefox 3.5
+// else { // -Firefox 3.5
+ if (!isGet) {
let walker = aDocument.createTreeWalker(
aDocument.documentElement,
Ci.nsIDOMNodeFilter.SHOW_ELEMENT,
@958
Copy link
Author

958 commented Jun 1, 2011

とりあえずこれでうごいたからいいや

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment