mirror of
https://github.com/gryf/pentadactyl-pm.git
synced 2026-02-25 23:15:45 +01:00
objectToString stuff.
This commit is contained in:
@@ -1013,13 +1013,18 @@ var ConfigBase = Class("ConfigBase", {
|
|||||||
HelpWarning /* The indicator for a warning */ \
|
HelpWarning /* The indicator for a warning */ \
|
||||||
color: red; font-weight: bold;
|
color: red; font-weight: bold;
|
||||||
|
|
||||||
HelpXML;;;FontCode /* Highlighted XML */ \
|
HelpXML;;;FontCode {
|
||||||
color: #C5F779; background-color: #444444; font-family: Terminus, Fixed, monospace;
|
/* Highlighted XML */
|
||||||
HelpXMLBlock { white-space: pre; color: #C5F779; background-color: #444444;
|
white-space: pre;
|
||||||
|
display: inline-block;
|
||||||
|
color: #C5F779;
|
||||||
|
background-color: #444444;
|
||||||
border: 1px dashed #aaaaaa;
|
border: 1px dashed #aaaaaa;
|
||||||
|
font-family: Terminus, Fixed, monospace;
|
||||||
|
}
|
||||||
|
HelpXMLBlock;;;HelpXML {
|
||||||
display: block;
|
display: block;
|
||||||
margin-left: 2em;
|
margin-left: 2em;
|
||||||
font-family: Terminus, Fixed, monospace;
|
|
||||||
}
|
}
|
||||||
HelpXMLAttribute color: #C5F779;
|
HelpXMLAttribute color: #C5F779;
|
||||||
HelpXMLAttribute::after color: #E5E5E5; content: "=";
|
HelpXMLAttribute::after color: #E5E5E5; content: "=";
|
||||||
|
|||||||
@@ -464,7 +464,7 @@ var DOM = Class("DOM", {
|
|||||||
try {
|
try {
|
||||||
let hasChildren = elem.firstChild && (!/^\s*$/.test(elem.firstChild) || elem.firstChild.nextSibling)
|
let hasChildren = elem.firstChild && (!/^\s*$/.test(elem.firstChild) || elem.firstChild.nextSibling)
|
||||||
if (color)
|
if (color)
|
||||||
res.push(<span highlight="HelpXMLBlock"><span highlight="HelpXMLTagStart"><{
|
res.push(<span highlight="HelpXML"><span highlight="HelpXMLTagStart"><{
|
||||||
namespaced(elem)} {
|
namespaced(elem)} {
|
||||||
template.map(array.iterValues(elem.attributes),
|
template.map(array.iterValues(elem.attributes),
|
||||||
function (attr)
|
function (attr)
|
||||||
@@ -724,7 +724,15 @@ var DOM = Class("DOM", {
|
|||||||
let force = false;
|
let force = false;
|
||||||
if (rect)
|
if (rect)
|
||||||
for (let parent in this.ancestors.items) {
|
for (let parent in this.ancestors.items) {
|
||||||
|
if (!parent[0].clientWidth || !parent[0].clientHeight)
|
||||||
|
continue;
|
||||||
|
|
||||||
let isect = util.intersection(rect, parent.viewport);
|
let isect = util.intersection(rect, parent.viewport);
|
||||||
|
|
||||||
|
if (parent[0].clientWidth < rect.width && isect.width ||
|
||||||
|
parent[0].clientHeight < rect.height && isect.height)
|
||||||
|
continue;
|
||||||
|
|
||||||
force = Math.round(isect.width - rect.width) || Math.round(isect.height - rect.height);
|
force = Math.round(isect.width - rect.width) || Math.round(isect.height - rect.height);
|
||||||
if (force)
|
if (force)
|
||||||
break;
|
break;
|
||||||
|
|||||||
@@ -302,7 +302,7 @@ var Template = Module("Template", {
|
|||||||
return <span highlight="Null">{arg}</span>;
|
return <span highlight="Null">{arg}</span>;
|
||||||
case "object":
|
case "object":
|
||||||
if (arg instanceof Ci.nsIDOMElement)
|
if (arg instanceof Ci.nsIDOMElement)
|
||||||
return util.objectToString(arg, false);
|
return util.objectToString(arg, true);
|
||||||
// for java packages value.toString() would crash so badly
|
// for java packages value.toString() would crash so badly
|
||||||
// that we cannot even try/catch it
|
// that we cannot even try/catch it
|
||||||
if (/^\[JavaPackage.*\]$/.test(arg))
|
if (/^\[JavaPackage.*\]$/.test(arg))
|
||||||
|
|||||||
@@ -885,8 +885,10 @@ var Util = Module("Util", XPCOM([Ci.nsIObserver, Ci.nsISupportsWeakReference]),
|
|||||||
if (!hasValue) {
|
if (!hasValue) {
|
||||||
if (isArray(i) && i.length == 2)
|
if (isArray(i) && i.length == 2)
|
||||||
[i, value] = i;
|
[i, value] = i;
|
||||||
else
|
else {
|
||||||
var noVal = true;
|
var noVal = true;
|
||||||
|
value = i;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
value = template.highlight(value, true, 150);
|
value = template.highlight(value, true, 150);
|
||||||
@@ -895,7 +897,7 @@ var Util = Module("Util", XPCOM([Ci.nsIObserver, Ci.nsISupportsWeakReference]),
|
|||||||
i = parseInt(i);
|
i = parseInt(i);
|
||||||
else if (/^[A-Z_]+$/.test(i))
|
else if (/^[A-Z_]+$/.test(i))
|
||||||
i = "";
|
i = "";
|
||||||
keys.push([i, <>{key}{noVal ? "" : <>: {value}</>}
</>]);
|
keys.push([i, noVal ? value : <>{key}: {value}
</>]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (e) {
|
catch (e) {
|
||||||
|
|||||||
Reference in New Issue
Block a user