mirror of
https://github.com/gryf/pentadactyl-pm.git
synced 2025-12-20 14:27:59 +01:00
Treat XUL Tree and TextBox elements as input elements.
This commit is contained in:
@@ -118,7 +118,7 @@ var Buffer = Module("buffer", {
|
|||||||
}
|
}
|
||||||
|
|
||||||
yield ["Title", doc.title];
|
yield ["Title", doc.title];
|
||||||
yield ["URL", template.highlightURL(doc.location.toString(), true)];
|
yield ["URL", template.highlightURL(doc.location.href, true)];
|
||||||
|
|
||||||
let ref = "referrer" in doc && doc.referrer;
|
let ref = "referrer" in doc && doc.referrer;
|
||||||
if (ref)
|
if (ref)
|
||||||
@@ -171,7 +171,7 @@ var Buffer = Module("buffer", {
|
|||||||
if (!(uri || doc.location))
|
if (!(uri || doc.location))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
uri = uri || util.newURI(doc.location.href);
|
uri = uri || doc.documentURIObject;
|
||||||
let args = {
|
let args = {
|
||||||
url: { toString: function () uri.spec, valueOf: function () uri },
|
url: { toString: function () uri.spec, valueOf: function () uri },
|
||||||
title: doc.title
|
title: doc.title
|
||||||
@@ -224,7 +224,7 @@ var Buffer = Module("buffer", {
|
|||||||
else {
|
else {
|
||||||
// code which should happen for all (also background) newly loaded tabs goes here:
|
// code which should happen for all (also background) newly loaded tabs goes here:
|
||||||
if (doc != config.browser.contentDocument)
|
if (doc != config.browser.contentDocument)
|
||||||
dactyl.echomsg({ domains: [util.getHost(doc.location.href)], message: "Background tab loaded: " + doc.title || doc.location.href }, 3);
|
dactyl.echomsg({ domains: [doc.location.host], message: "Background tab loaded: " + (doc.title || doc.location.href) }, 3);
|
||||||
|
|
||||||
this._triggerLoadAutocmd("PageLoad", doc);
|
this._triggerLoadAutocmd("PageLoad", doc);
|
||||||
}
|
}
|
||||||
@@ -911,7 +911,7 @@ var Buffer = Module("buffer", {
|
|||||||
showPageInfo: function (verbose, sections) {
|
showPageInfo: function (verbose, sections) {
|
||||||
// Ctrl-g single line output
|
// Ctrl-g single line output
|
||||||
if (!verbose) {
|
if (!verbose) {
|
||||||
let file = content.document.location.pathname.split("/").pop() || "[No Name]";
|
let file = content.location.pathname.split("/").pop() || "[No Name]";
|
||||||
let title = content.document.title || "[No Title]";
|
let title = content.document.title || "[No Title]";
|
||||||
|
|
||||||
let info = template.map("gf",
|
let info = template.map("gf",
|
||||||
@@ -1009,9 +1009,7 @@ var Buffer = Module("buffer", {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
let url = isString(doc) ? doc : doc.location.href;
|
let url = isString(doc) ? util.newURI(doc) : doc.documentURIObject;
|
||||||
let uri = util.newURI(url, charset);
|
|
||||||
let charset = isString(doc) ? null : doc.characterSet;
|
|
||||||
|
|
||||||
if (!isString(doc))
|
if (!isString(doc))
|
||||||
return io.withTempFiles(function (temp) {
|
return io.withTempFiles(function (temp) {
|
||||||
@@ -1357,7 +1355,7 @@ var Buffer = Module("buffer", {
|
|||||||
|
|
||||||
dactyl.assert(args.bang || !file.exists(), "E13: File exists (add ! to override)");
|
dactyl.assert(args.bang || !file.exists(), "E13: File exists (add ! to override)");
|
||||||
|
|
||||||
chosenData = { file: file, uri: window.makeURI(doc.location.href, doc.characterSet) };
|
chosenData = { file: file, uri: doc.documentURIObject };
|
||||||
}
|
}
|
||||||
|
|
||||||
// if browser.download.useDownloadDir = false then the "Save As"
|
// if browser.download.useDownloadDir = false then the "Save As"
|
||||||
|
|||||||
@@ -798,9 +798,12 @@ var Events = Module("events", {
|
|||||||
if (elem && elem.readOnly)
|
if (elem && elem.readOnly)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (elem instanceof HTMLInputElement && set.has(util.editableInputs, elem.type) ||
|
if (isinstance(elem, [HTMLEmbedElement, HTMLEmbedElement])) {
|
||||||
elem instanceof HTMLSelectElement ||
|
modes.push(modes.EMBED);
|
||||||
elem instanceof Window && Editor.getEditor(elem)) {
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (Events.isInputElem(elem)) {
|
||||||
if (!(modes.main & (modes.INSERT | modes.TEXT_EDIT | modes.VISUAL)))
|
if (!(modes.main & (modes.INSERT | modes.TEXT_EDIT | modes.VISUAL)))
|
||||||
modes.push(modes.INSERT);
|
modes.push(modes.INSERT);
|
||||||
|
|
||||||
@@ -809,11 +812,6 @@ var Events = Module("events", {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isinstance(elem, [HTMLEmbedElement, HTMLEmbedElement])) {
|
|
||||||
dactyl.mode = modes.EMBED;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (elem instanceof HTMLTextAreaElement || (elem && util.computedStyle(elem).MozUserModify == "read-write")
|
if (elem instanceof HTMLTextAreaElement || (elem && util.computedStyle(elem).MozUserModify == "read-write")
|
||||||
|| elem == null && win && Editor.getEditor(win)) {
|
|| elem == null && win && Editor.getEditor(win)) {
|
||||||
|
|
||||||
@@ -1183,12 +1181,17 @@ var Events = Module("events", {
|
|||||||
let (key = isString(event) ? event : events.toString(event))
|
let (key = isString(event) ? event : events.toString(event))
|
||||||
key === "<Esc>" || key === "<C-[>",
|
key === "<Esc>" || key === "<C-[>",
|
||||||
|
|
||||||
isInputElemFocused: function isInputElemFocused() {
|
isInputElem: function isInputElem(elem) {
|
||||||
let elem = dactyl.focusedElement;
|
|
||||||
return elem instanceof HTMLInputElement && set.has(util.editableInputs, elem.type) ||
|
return elem instanceof HTMLInputElement && set.has(util.editableInputs, elem.type) ||
|
||||||
isinstance(elem, [HTMLIsIndexElement, HTMLEmbedElement,
|
isinstance(elem, [HTMLIsIndexElement, HTMLEmbedElement,
|
||||||
HTMLObjectElement, HTMLTextAreaElement]);
|
HTMLObjectElement, HTMLSelectElement,
|
||||||
}
|
HTMLTextAreaElement,
|
||||||
|
Ci.nsIDOMXULTreeElement, Ci.nsIDOMXULTextBoxElement]) ||
|
||||||
|
elem instanceof Window && Editor.getEditor(elem);
|
||||||
|
},
|
||||||
|
|
||||||
|
isInputElemFocused: function isInputElemFocused() this.isInputElem(dactyl.focusedElement)
|
||||||
|
|
||||||
}, {
|
}, {
|
||||||
commands: function () {
|
commands: function () {
|
||||||
commands.add(["delmac[ros]"],
|
commands.add(["delmac[ros]"],
|
||||||
|
|||||||
@@ -315,7 +315,7 @@ var Styles = Module("Styles", {
|
|||||||
else if (/[\/:]/.test(filter))
|
else if (/[\/:]/.test(filter))
|
||||||
function test(uri) uri.spec === filter;
|
function test(uri) uri.spec === filter;
|
||||||
else
|
else
|
||||||
function test(uri) { try { return uri.host === filter } catch (e) { return false } };
|
function test(uri) { try { return util.isSubdomain(uri.host, filter); } catch (e) { return false; } };
|
||||||
test.toString = function toString() filter;
|
test.toString = function toString() filter;
|
||||||
if (arguments.length < 2)
|
if (arguments.length < 2)
|
||||||
return test;
|
return test;
|
||||||
|
|||||||
Reference in New Issue
Block a user