1
0
mirror of https://github.com/gryf/pentadactyl-pm.git synced 2025-12-20 06:07:59 +01:00

Treat XUL Tree and TextBox elements as input elements.

This commit is contained in:
Kris Maglione
2010-12-28 22:54:36 -05:00
parent 2f701ac96a
commit eef79f2ba8
3 changed files with 22 additions and 21 deletions

View File

@@ -118,7 +118,7 @@ var Buffer = Module("buffer", {
}
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;
if (ref)
@@ -171,7 +171,7 @@ var Buffer = Module("buffer", {
if (!(uri || doc.location))
return;
uri = uri || util.newURI(doc.location.href);
uri = uri || doc.documentURIObject;
let args = {
url: { toString: function () uri.spec, valueOf: function () uri },
title: doc.title
@@ -224,7 +224,7 @@ var Buffer = Module("buffer", {
else {
// code which should happen for all (also background) newly loaded tabs goes here:
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);
}
@@ -911,7 +911,7 @@ var Buffer = Module("buffer", {
showPageInfo: function (verbose, sections) {
// Ctrl-g single line output
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 info = template.map("gf",
@@ -1009,9 +1009,7 @@ var Buffer = Module("buffer", {
return true;
}
let url = isString(doc) ? doc : doc.location.href;
let uri = util.newURI(url, charset);
let charset = isString(doc) ? null : doc.characterSet;
let url = isString(doc) ? util.newURI(doc) : doc.documentURIObject;
if (!isString(doc))
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)");
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"

View File

@@ -798,9 +798,12 @@ var Events = Module("events", {
if (elem && elem.readOnly)
return;
if (elem instanceof HTMLInputElement && set.has(util.editableInputs, elem.type) ||
elem instanceof HTMLSelectElement ||
elem instanceof Window && Editor.getEditor(elem)) {
if (isinstance(elem, [HTMLEmbedElement, HTMLEmbedElement])) {
modes.push(modes.EMBED);
return;
}
if (Events.isInputElem(elem)) {
if (!(modes.main & (modes.INSERT | modes.TEXT_EDIT | modes.VISUAL)))
modes.push(modes.INSERT);
@@ -809,11 +812,6 @@ var Events = Module("events", {
return;
}
if (isinstance(elem, [HTMLEmbedElement, HTMLEmbedElement])) {
dactyl.mode = modes.EMBED;
return;
}
if (elem instanceof HTMLTextAreaElement || (elem && util.computedStyle(elem).MozUserModify == "read-write")
|| elem == null && win && Editor.getEditor(win)) {
@@ -1183,12 +1181,17 @@ var Events = Module("events", {
let (key = isString(event) ? event : events.toString(event))
key === "<Esc>" || key === "<C-[>",
isInputElemFocused: function isInputElemFocused() {
let elem = dactyl.focusedElement;
isInputElem: function isInputElem(elem) {
return elem instanceof HTMLInputElement && set.has(util.editableInputs, elem.type) ||
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.add(["delmac[ros]"],

View File

@@ -315,7 +315,7 @@ var Styles = Module("Styles", {
else if (/[\/:]/.test(filter))
function test(uri) uri.spec === filter;
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;
if (arguments.length < 2)
return test;