mirror of
https://github.com/gryf/pentadactyl-pm.git
synced 2025-12-21 23:27:58 +01:00
Fix link listing in :hi output.
This commit is contained in:
@@ -106,10 +106,10 @@ var Browser = Module("browser", XPCOM(Ci.nsISupportsWeakReference, ModuleBase),
|
|||||||
onStateChange: util.wrapCallback(function onStateChange(webProgress, request, flags, status) {
|
onStateChange: util.wrapCallback(function onStateChange(webProgress, request, flags, status) {
|
||||||
const L = Ci.nsIWebProgressListener;
|
const L = Ci.nsIWebProgressListener;
|
||||||
|
|
||||||
|
if (flags & (L.STATE_IS_DOCUMENT | L.STATE_IS_WINDOW)) {
|
||||||
if (request)
|
if (request)
|
||||||
dactyl.applyTriggerObserver("browser.stateChange", arguments);
|
dactyl.applyTriggerObserver("browser.stateChange", arguments);
|
||||||
|
|
||||||
if (flags & (L.STATE_IS_DOCUMENT | L.STATE_IS_WINDOW)) {
|
|
||||||
// This fires when the load event is initiated
|
// This fires when the load event is initiated
|
||||||
// only thrown for the current tab, not when another tab changes
|
// only thrown for the current tab, not when another tab changes
|
||||||
if (flags & L.STATE_START) {
|
if (flags & L.STATE_START) {
|
||||||
@@ -148,13 +148,14 @@ var Browser = Module("browser", XPCOM(Ci.nsISupportsWeakReference, ModuleBase),
|
|||||||
|
|
||||||
let win = webProgress.DOMWindow;
|
let win = webProgress.DOMWindow;
|
||||||
if (win && uri) {
|
if (win && uri) {
|
||||||
let oldURI = win.document.dactylURI;
|
let oldURI = overlay.getData(win.document)["uri"];
|
||||||
if (win.document.dactylLoadIdx === webProgress.loadedTransIndex
|
if (overlay.getData(win.document)["load-idx"] === webProgress.loadedTransIndex
|
||||||
|| !oldURI || uri.spec.replace(/#.*/, "") !== oldURI.replace(/#.*/, ""))
|
|| !oldURI || uri.spec.replace(/#.*/, "") !== oldURI.replace(/#.*/, ""))
|
||||||
for (let frame in values(buffer.allFrames(win)))
|
for (let frame in values(buffer.allFrames(win)))
|
||||||
frame.document.dactylFocusAllowed = false;
|
overlay.setData(frame.document, "focus-allowed", false);
|
||||||
win.document.dactylURI = uri.spec;
|
|
||||||
win.document.dactylLoadIdx = webProgress.loadedTransIndex;
|
overlay.setData(win.document, "uri", uri.spec);
|
||||||
|
overlay.setData(win.document, "load-idx", webProgress.loadedTransIndex);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Workaround for bugs 591425 and 606877, dactyl bug #81
|
// Workaround for bugs 591425 and 606877, dactyl bug #81
|
||||||
|
|||||||
@@ -429,9 +429,11 @@ var Buffer = Module("buffer", {
|
|||||||
let doc = elem.ownerDocument || elem.document || elem;
|
let doc = elem.ownerDocument || elem.document || elem;
|
||||||
switch (options.get("strictfocus").getKey(doc.documentURIObject || util.newURI(doc.documentURI), "moderate")) {
|
switch (options.get("strictfocus").getKey(doc.documentURIObject || util.newURI(doc.documentURI), "moderate")) {
|
||||||
case "despotic":
|
case "despotic":
|
||||||
return elem.dactylFocusAllowed || elem.frameElement && elem.frameElement.dactylFocusAllowed;
|
return overlay.getData(elem)["focus-allowed"]
|
||||||
|
|| elem.frameElement && overlay.getData(elem.frameElement)["focus-allowed"];
|
||||||
case "moderate":
|
case "moderate":
|
||||||
return doc.dactylFocusAllowed || elem.frameElement && elem.frameElement.ownerDocument.dactylFocusAllowed;
|
return overlay.getData(doc, "focus-allowed")
|
||||||
|
|| elem.frameElement && overlay.getData(elem.frameElement.ownerDocument)["focus-allowed"];
|
||||||
default:
|
default:
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@@ -446,13 +448,13 @@ var Buffer = Module("buffer", {
|
|||||||
*/
|
*/
|
||||||
focusElement: function focusElement(elem) {
|
focusElement: function focusElement(elem) {
|
||||||
let win = elem.ownerDocument && elem.ownerDocument.defaultView || elem;
|
let win = elem.ownerDocument && elem.ownerDocument.defaultView || elem;
|
||||||
elem.dactylFocusAllowed = true;
|
overlay.setData(elem, "focus-allowed", true);
|
||||||
win.document.dactylFocusAllowed = true;
|
overlay.setData(win.document, "focus-allowed", true);
|
||||||
|
|
||||||
if (isinstance(elem, [HTMLFrameElement, HTMLIFrameElement]))
|
if (isinstance(elem, [HTMLFrameElement, HTMLIFrameElement]))
|
||||||
elem = elem.contentWindow;
|
elem = elem.contentWindow;
|
||||||
if (elem.document)
|
if (elem.document)
|
||||||
elem.document.dactylFocusAllowed = true;
|
overlay.setData(elem.document, "focus-allowed", true);
|
||||||
|
|
||||||
if (elem instanceof HTMLInputElement && elem.type == "file") {
|
if (elem instanceof HTMLInputElement && elem.type == "file") {
|
||||||
Buffer.openUploadPrompt(elem);
|
Buffer.openUploadPrompt(elem);
|
||||||
|
|||||||
@@ -801,8 +801,8 @@ var Events = Module("events", {
|
|||||||
|
|
||||||
for (; win; win = win != win.parent && win.parent) {
|
for (; win; win = win != win.parent && win.parent) {
|
||||||
for (; elem instanceof Element; elem = elem.parentNode)
|
for (; elem instanceof Element; elem = elem.parentNode)
|
||||||
elem.dactylFocusAllowed = true;
|
overlay.setData(elem, "focus-allowed", true);
|
||||||
win.document.dactylFocusAllowed = true;
|
overlay.setData(win.document, "focus-allowed", true);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|||||||
@@ -120,6 +120,10 @@ var DOM = Class("DOM", {
|
|||||||
},
|
},
|
||||||
|
|
||||||
eachDOM: function eachDOM(val, fn, self) {
|
eachDOM: function eachDOM(val, fn, self) {
|
||||||
|
XML.prettyPrinting = XML.ignoreWhitespace = false;
|
||||||
|
if (isString(val))
|
||||||
|
val = XML(val);
|
||||||
|
|
||||||
if (typeof val == "xml")
|
if (typeof val == "xml")
|
||||||
return this.each(function (elem, i) {
|
return this.each(function (elem, i) {
|
||||||
fn.call(this, DOM.fromXML(val, elem.ownerDocument), elem, i);
|
fn.call(this, DOM.fromXML(val, elem.ownerDocument), elem, i);
|
||||||
@@ -127,13 +131,16 @@ var DOM = Class("DOM", {
|
|||||||
|
|
||||||
let dom = this;
|
let dom = this;
|
||||||
function munge(val) {
|
function munge(val) {
|
||||||
|
if (val instanceof Ci.nsIDOMRange)
|
||||||
|
return val.extractContents();
|
||||||
|
|
||||||
if (typeof val == "xml")
|
if (typeof val == "xml")
|
||||||
val = dom.constructor(val, dom.document);
|
val = dom.constructor(val, dom.document);
|
||||||
|
|
||||||
if (isObject(val) && "length" in val) {
|
if (isObject(val) && "length" in val) {
|
||||||
let frag = dom.document.createDocumentFragment();
|
let frag = dom.document.createDocumentFragment();
|
||||||
for (let i = 0; i < val.length; i++)
|
for (let i = 0; i < val.length; i++)
|
||||||
frag.appendChild(val[i]);
|
frag.appendChild(munge(val[i]));
|
||||||
return frag;
|
return frag;
|
||||||
}
|
}
|
||||||
return val;
|
return val;
|
||||||
|
|||||||
@@ -348,7 +348,7 @@ var Highlights = Module("Highlight", {
|
|||||||
"text-align: center"],
|
"text-align: center"],
|
||||||
([h.class,
|
([h.class,
|
||||||
<span style={"text-align: center; line-height: 1em;" + h.value + style}>XXX</span>,
|
<span style={"text-align: center; line-height: 1em;" + h.value + style}>XXX</span>,
|
||||||
template.map(h.extends, template.highlight),
|
template.map(h.extends, function (s) template.highlight(s)),
|
||||||
template.highlightRegexp(h.value, /\b[-\w]+(?=:)|\/\*.*?\*\//g,
|
template.highlightRegexp(h.value, /\b[-\w]+(?=:)|\/\*.*?\*\//g,
|
||||||
function (match) <span highlight={match[0] == "/" ? "Comment" : "Key"}>{match}</span>)
|
function (match) <span highlight={match[0] == "/" ? "Comment" : "Key"}>{match}</span>)
|
||||||
]
|
]
|
||||||
|
|||||||
@@ -153,6 +153,9 @@ var Overlay = Module("Overlay", XPCOM([Ci.nsIObserver, Ci.nsISupportsWeakReferen
|
|||||||
if (!(id in obj && obj[id]))
|
if (!(id in obj && obj[id]))
|
||||||
obj[id] = {};
|
obj[id] = {};
|
||||||
|
|
||||||
|
if (arguments.length == 1)
|
||||||
|
return obj[id];
|
||||||
|
|
||||||
if (obj[id][key] === undefined)
|
if (obj[id][key] === undefined)
|
||||||
if (constructor === undefined || callable(constructor))
|
if (constructor === undefined || callable(constructor))
|
||||||
obj[id][key] = (constructor || Array)();
|
obj[id][key] = (constructor || Array)();
|
||||||
|
|||||||
Reference in New Issue
Block a user