mirror of
https://github.com/gryf/pentadactyl-pm.git
synced 2025-12-20 09:27:58 +01:00
Merge branch default.
--HG-- branch : bootstrapped
This commit is contained in:
@@ -161,6 +161,9 @@ const Buffer = Module("buffer", {
|
|||||||
},
|
},
|
||||||
|
|
||||||
_triggerLoadAutocmd: function _triggerLoadAutocmd(name, doc, uri) {
|
_triggerLoadAutocmd: function _triggerLoadAutocmd(name, doc, uri) {
|
||||||
|
if (!(uri || doc.location))
|
||||||
|
return;
|
||||||
|
|
||||||
uri = uri || util.newURI(doc.location.href);
|
uri = uri || util.newURI(doc.location.href);
|
||||||
let args = {
|
let args = {
|
||||||
url: { toString: function () uri.spec, valueOf: function () uri },
|
url: { toString: function () uri.spec, valueOf: function () uri },
|
||||||
@@ -248,12 +251,9 @@ const Buffer = Module("buffer", {
|
|||||||
|
|
||||||
buffer._triggerLoadAutocmd("PageLoadPre", webProgress.DOMWindow.document);
|
buffer._triggerLoadAutocmd("PageLoadPre", webProgress.DOMWindow.document);
|
||||||
|
|
||||||
// don't reset mode if a frame of the frameset gets reloaded which
|
if (document.commandDispatcher.focusedWindow == webProgress.DOMWindow && this.loadCount++)
|
||||||
// is not the focused frame
|
|
||||||
if (document.commandDispatcher.focusedWindow == webProgress.DOMWindow && this.loadCount++) {
|
|
||||||
util.timeout(function () { modes.reset(false); },
|
util.timeout(function () { modes.reset(false); },
|
||||||
dactyl.mode == modes.HINTS ? 500 : 0);
|
dactyl.mode == modes.HINTS ? 500 : 0);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else if (flags & Ci.nsIWebProgressListener.STATE_STOP) {
|
else if (flags & Ci.nsIWebProgressListener.STATE_STOP) {
|
||||||
// Workaround for bugs 591425 and 606877, dactyl bug #81
|
// Workaround for bugs 591425 and 606877, dactyl bug #81
|
||||||
@@ -292,8 +292,8 @@ const Buffer = Module("buffer", {
|
|||||||
onLocationChange.superapply(this, arguments);
|
onLocationChange.superapply(this, arguments);
|
||||||
statusline.updateUrl();
|
statusline.updateUrl();
|
||||||
statusline.updateProgress(webProgress.DOMWindow || content);
|
statusline.updateProgress(webProgress.DOMWindow || content);
|
||||||
for (let frame in values(buffer.allFrames()))
|
for (let frame in values(buffer.allFrames(webProgress.DOMWindow || content)))
|
||||||
frame.dactylFocusAllowed = false;
|
frame.document.dactylFocusAllowed = false;
|
||||||
|
|
||||||
// Workaround for bugs 591425 and 606877, dactyl bug #81
|
// Workaround for bugs 591425 and 606877, dactyl bug #81
|
||||||
let collapse = uri && uri.scheme === "dactyl" && webProgress.isLoadingDocument;
|
let collapse = uri && uri.scheme === "dactyl" && webProgress.isLoadingDocument;
|
||||||
@@ -372,9 +372,9 @@ const Buffer = Module("buffer", {
|
|||||||
* tab.
|
* tab.
|
||||||
*/
|
*/
|
||||||
get localStore() {
|
get localStore() {
|
||||||
if (!content.dactylStore)
|
if (!content.document.dactylStore)
|
||||||
content.dactylStore = {};
|
content.document.dactylStore = {};
|
||||||
return content.dactylStore;
|
return content.document.dactylStore;
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -524,8 +524,8 @@ const Buffer = Module("buffer", {
|
|||||||
focusAllowed: function (elem) {
|
focusAllowed: function (elem) {
|
||||||
if (elem instanceof Window && !Editor.getEditor(window))
|
if (elem instanceof Window && !Editor.getEditor(window))
|
||||||
return true;
|
return true;
|
||||||
let win = elem.ownerDocument && elem.ownerDocument.defaultView || elem;
|
let doc = elem.ownerDocument || elem.document || elem;
|
||||||
return !options["strictfocus"] || win.dactylFocusAllowed;
|
return !options["strictfocus"] || doc.dactylFocusAllowed;
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -537,11 +537,12 @@ const Buffer = Module("buffer", {
|
|||||||
*/
|
*/
|
||||||
focusElement: function (elem) {
|
focusElement: function (elem) {
|
||||||
let win = elem.ownerDocument && elem.ownerDocument.defaultView || elem;
|
let win = elem.ownerDocument && elem.ownerDocument.defaultView || elem;
|
||||||
win.dactylFocusAllowed = true;
|
win.document.dactylFocusAllowed = true;
|
||||||
|
|
||||||
if (isinstance(elem, [HTMLFrameElement, HTMLIFrameElement]))
|
if (isinstance(elem, [HTMLFrameElement, HTMLIFrameElement]))
|
||||||
elem = elem.contentWindow;
|
elem = elem.contentWindow;
|
||||||
elem.dactylFocusAllowed = true;
|
if (elem.document)
|
||||||
|
elem.document.dactylFocusAllowed = true;
|
||||||
|
|
||||||
if (elem instanceof HTMLInputElement && elem.type == "file") {
|
if (elem instanceof HTMLInputElement && elem.type == "file") {
|
||||||
Buffer.openUploadPrompt(elem);
|
Buffer.openUploadPrompt(elem);
|
||||||
|
|||||||
@@ -389,13 +389,14 @@ const Dactyl = Module("dactyl", XPCOM(Ci.nsISupportsWeakReference, ModuleBase),
|
|||||||
return res;
|
return res;
|
||||||
},
|
},
|
||||||
|
|
||||||
focus: function (elem, flags) {
|
focus: function focus(elem, flags) {
|
||||||
flags = flags || services.focus.FLAG_BYMOUSE;
|
flags = flags || services.focus.FLAG_BYMOUSE;
|
||||||
|
util.dumpStack();
|
||||||
try {
|
try {
|
||||||
if (elem instanceof Document)
|
if (elem instanceof Document)
|
||||||
elem = elem.defaultView;
|
elem = elem.defaultView;
|
||||||
if (elem instanceof Window)
|
if (elem instanceof Window)
|
||||||
services.focus.clearFocus(elem);
|
services.focus.focusedWindow = elem;
|
||||||
else
|
else
|
||||||
services.focus.setFocus(elem, flags);
|
services.focus.setFocus(elem, flags);
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
@@ -410,7 +411,7 @@ const Dactyl = Module("dactyl", XPCOM(Ci.nsISupportsWeakReference, ModuleBase),
|
|||||||
* @param {boolean} clearFocusedElement Remove focus from any focused
|
* @param {boolean} clearFocusedElement Remove focus from any focused
|
||||||
* element.
|
* element.
|
||||||
*/
|
*/
|
||||||
focusContent: function (clearFocusedElement) {
|
focusContent: function focusContent(clearFocusedElement) {
|
||||||
if (window != services.windowWatcher.activeWindow)
|
if (window != services.windowWatcher.activeWindow)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@@ -433,7 +434,8 @@ const Dactyl = Module("dactyl", XPCOM(Ci.nsISupportsWeakReference, ModuleBase),
|
|||||||
catch (e) {}
|
catch (e) {}
|
||||||
|
|
||||||
if (clearFocusedElement) {
|
if (clearFocusedElement) {
|
||||||
services.focus.clearFocus(window);
|
if (dactyl.focusedElement)
|
||||||
|
dactyl.focusedElement.blur();
|
||||||
if (win && Editor.getEditor(win)) {
|
if (win && Editor.getEditor(win)) {
|
||||||
win.blur();
|
win.blur();
|
||||||
if (win.frameElement)
|
if (win.frameElement)
|
||||||
@@ -450,6 +452,7 @@ const Dactyl = Module("dactyl", XPCOM(Ci.nsISupportsWeakReference, ModuleBase),
|
|||||||
|
|
||||||
/** @property {Element} The currently focused element. */
|
/** @property {Element} The currently focused element. */
|
||||||
get focusedElement() services.focus.getFocusedElementForWindow(window, true, {}),
|
get focusedElement() services.focus.getFocusedElementForWindow(window, true, {}),
|
||||||
|
set focusedElement(elem) dactyl.focus(elem),
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns whether this Dactyl extension supports *feature*.
|
* Returns whether this Dactyl extension supports *feature*.
|
||||||
|
|||||||
@@ -962,7 +962,7 @@ const Events = Module("events", {
|
|||||||
let elem = event.target;
|
let elem = event.target;
|
||||||
let win = elem.ownerDocument && elem.ownerDocument.defaultView || elem;
|
let win = elem.ownerDocument && elem.ownerDocument.defaultView || elem;
|
||||||
for (; win; win = win != win.parent && win.parent)
|
for (; win; win = win != win.parent && win.parent)
|
||||||
win.dactylFocusAllowed = true;
|
win.document.dactylFocusAllowed = true;
|
||||||
},
|
},
|
||||||
|
|
||||||
onPopupShown: function onPopupShown(event) {
|
onPopupShown: function onPopupShown(event) {
|
||||||
|
|||||||
@@ -286,6 +286,7 @@ const Modes = Module("modes", {
|
|||||||
},
|
},
|
||||||
|
|
||||||
push: function push(mainMode, extendedMode, params) {
|
push: function push(mainMode, extendedMode, params) {
|
||||||
|
util.dumpStack();
|
||||||
this.set(mainMode, extendedMode, params, { push: this.topOfStack });
|
this.set(mainMode, extendedMode, params, { push: this.topOfStack });
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|||||||
@@ -964,7 +964,7 @@ const Tabs = Module("tabs", {
|
|||||||
"See 'showtabline' option.");
|
"See 'showtabline' option.");
|
||||||
tabs.tabStyle.enabled = false;
|
tabs.tabStyle.enabled = false;
|
||||||
}
|
}
|
||||||
if (value != 1)
|
if (value != 1 || !dactyl.has("Gecko2"))
|
||||||
config.tabStrip.collapsed = false;
|
config.tabStrip.collapsed = false;
|
||||||
return value;
|
return value;
|
||||||
},
|
},
|
||||||
|
|||||||
Reference in New Issue
Block a user