1
0
mirror of https://github.com/gryf/pentadactyl-pm.git synced 2026-01-06 17:44:11 +01:00

Petty makefile changes.

This commit is contained in:
Kris Maglione
2009-06-06 23:40:17 -04:00
parent f33100d579
commit 83d7e30b5d
5 changed files with 51 additions and 55 deletions

View File

@@ -1054,13 +1054,9 @@ function Buffer() //{{{
focusElement: function (elem)
{
let doc = window.content.document;
let elemTagName = elem.localName.toLowerCase();
if (elemTagName == "frame" || elemTagName == "iframe")
{
elem.contentWindow.focus();
return;
}
else if (elemTagName == "input" && elem.type == "file")
if (elem instanceof HTMLFrameElement || elem instanceof HTMLIFrameElement)
return void elem.contentWindow.focus();
else if (elem instanceof HTMLInputElement && elem.type == "file")
{
openUploadPrompt(elem);
buffer.lastInputField = elem;
@@ -1069,14 +1065,17 @@ function Buffer() //{{{
elem.focus();
let x = 0;
let y = 0;
// for imagemap
if (elemTagName == "area")
[x, y] = elem.getAttribute("coords").split(",").map(Number);
if (elem instanceof HTMLAreaElement)
{
try
{
let [x, y] = elem.getAttribute("coords").split(",").map(parseFloat);
let evt = events.create(doc, "mouseover", { screenX: x, screenY: y });
elem.dispatchEvent(evt);
elem.dispatchEvent(events.create(doc, "mouseover", { screenX: x, screenY: y }));
}
catch (e) {}
}
},
/**
@@ -1197,11 +1196,10 @@ function Buffer() //{{{
options.withContext(function () {
options.setPref("browser.tabs.loadInBackground", true);
["mousedown", "mouseup", "click"].forEach(function (event) {
let evt = events.create(doc, event, {
elem.dispatchEvent(events.create(doc, event, {
screenX: offsetX, screenY: offsetY,
ctrlKey: ctrlKey, shiftKey: shiftKey, metaKey: ctrlKey
});
elem.dispatchEvent(evt);
}));
});
});
},

View File

@@ -562,26 +562,8 @@ function Events() //{{{
}
}
function wrapListener(method)
{
return function (event) {
try
{
self[method](event);
}
catch (e)
{
if (e.message == "Interrupted")
liberator.echoerr("Interrupted");
else
liberator.echoerr("Processing " + event.type + " event: " + (e.echoerr || e));
liberator.reportError(e);
}
};
}
// return true when load successful, or false otherwise
function waitForPageLoaded() events.waitForPageLoad();
function waitForPageLoad() events.waitForPageLoad();
// load all macros
// setTimeout needed since io. is loaded after events.
@@ -1011,7 +993,7 @@ function Events() //{{{
break;
// Stop feeding keys if page loading failed.
if (modes.isReplaying && !waitForPageLoaded())
if (modes.isReplaying && !waitForPageLoad())
break;
}
}
@@ -1560,7 +1542,7 @@ function Events() //{{{
input.pendingArgMap = null;
if (key != "<Esc>" && key != "<C-[>")
{
if (modes.isReplaying && !waitForPageLoaded())
if (modes.isReplaying && !waitForPageLoad())
return;
map.execute(null, input.count, key);
}
@@ -1593,7 +1575,7 @@ function Events() //{{{
}
else
{
if (modes.isReplaying && !waitForPageLoaded())
if (modes.isReplaying && !waitForPageLoad())
return void killEvent();
let ret = map.execute(null, input.count);
@@ -1771,10 +1753,25 @@ function Events() //{{{
}
catch (e) {}
liberator.registerObserver("shutdown", function () {
self.destroy();
});
liberator.registerObserver("shutdown", function () { self.destroy(); });
function wrapListener(method)
{
return function (event) {
try
{
self[method](event);
}
catch (e)
{
if (e.message == "Interrupted")
liberator.echoerr("Interrupted");
else
liberator.echoerr("Processing " + event.type + " event: " + (e.echoerr || e));
liberator.reportError(e);
}
};
}
window.addEventListener("keypress", wrapListener("onKeyPress"), true);
window.addEventListener("keydown", wrapListener("onKeyUpOrDown"), true);
window.addEventListener("keyup", wrapListener("onKeyUpOrDown"), true);