Skip to content

Commit 01de432

Browse files
tweak & tidy (#296)
1 parent 2f0b05c commit 01de432

33 files changed

+1120
-563
lines changed

css/index.css

+8-3
Original file line numberDiff line numberDiff line change
@@ -86,9 +86,13 @@ code {
8686
}
8787
#overlaybuttons {
8888
position: fixed;
89-
right: 25px;
90-
z-index: 1010;
89+
float: right;
90+
right: 45px;
91+
width: fit-content;
92+
text-align: right;
9193
}
94+
95+
9296
div.pad {
9397
padding: 0px 25px 15px /* top left+right bottom */
9498
}
@@ -118,6 +122,7 @@ a.return {color: var(--link); text-decoration: none; font-size: 14px; line-heig
118122
.monobigger {font-family: monospace, "Courier New"; font-size: 12px;}
119123
.strike {text-decoration: line-through;}
120124
.spaces {white-space: pre-wrap;}
125+
.nospaces {white-space: normal;}
121126
.perf {font-family: monospace, "Courier New"; font-size: 12px; white-space: pre-wrap;}
122127
.lies {
123128
color: var(--test99);
@@ -162,7 +167,7 @@ a.return {color: var(--link); text-decoration: none; font-size: 14px; line-heig
162167
display: inline-block;
163168
font-size: 12px;
164169
font-family: monospace, "Courier New";
165-
font-weight: bold;
170+
/*font-weight: bold;*/ /* bold looks out of place on macs */
166171
padding-left: 6px;
167172
padding-right: 6px;
168173
cursor: pointer;

js/css.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@ function get_computed_styles() {
137137
type == 0 ? document.styleSheets[0].cssRules[0].style :
138138
type == 1 ? getComputedStyle(document.body) :
139139
type == 2 ? document.body.style :
140-
type == 3 ? ((new DOMParser).parseFromString("<p></p>", "text/html")).body.style :
140+
type == 3 ? ((new DOMParser).parseFromString("", "text/html")).body.style :
141141
undefined
142142
)
143143
if (!cssStyleDeclaration) {

js/devices.js

+8-4
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ const get_maxtouch = () => new Promise(resolve => {
4343
if (runSE) {foo++} else if (runST) {value = undefined
4444
} else if (runSL && isSmart) {sData[SECT99].push("Navigator.maxTouchPoints")}
4545
display = value
46-
if (typeof value !== "number") {
46+
if (typeof value !== "number" || Number.isNaN(value)) {
4747
display = log_error(SECT7, METRIC, zErrType + typeof value)
4848
value = zErr
4949
} else if (!Number.isInteger(value) || value < 0) {
@@ -336,11 +336,15 @@ function get_pointer_event(event) {
336336
}
337337
for (const k of Object.keys(oList).sort()) {
338338
try {
339-
let value = event[k],expected = oList[k]
339+
let value = event[k],
340+
expected = oList[k]
340341
if (typeof value !== expected) {
341-
value = zErr // zErrType + typeof value
342+
value = "err" // zErrType + typeof value
343+
} else if ("number" == expected && Number.isNaN(value)) {
344+
value = "NaN" // zErrType + typeof value
345+
} else {
346+
value = cleanFn(value)
342347
}
343-
value = cleanFn(value)
344348
oData[k] = value
345349
oDisplay.push(value)
346350
} catch(e) {

js/elements.js

+12-7
Original file line numberDiff line numberDiff line change
@@ -86,13 +86,14 @@ const get_lh = () => new Promise(resolve => {
8686
} else if (isDomRect == 2) {height = range.getBoundingClientRect().height
8787
} else if (isDomRect > 2) {height = range.getClientRects()[0].height
8888
}
89-
if (runST) {height = true}
90-
if ("number" === typeof height) {
89+
if (runSE) {foo++} else if (runST) {height = []}
90+
let hType = typeFn(height)
91+
if ("number" === hType) {
9192
if (oLine[fontfamily] == undefined) {oLine[fontfamily] = {}}
9293
oLine[fontfamily][size] = height
9394
} else {
9495
isLine = false
95-
isErr = log_error(SECT15, METRIC, zErrType + typeof height)
96+
isErr = log_error(SECT15, METRIC, zErrType + hType)
9697
}
9798
}
9899
})
@@ -173,6 +174,7 @@ const get_mathml = () => new Promise(resolve => {
173174
let rangeC, rangeW, rangeH
174175
let targetC = dom["mathmldivctrl"], targetH, targetW
175176
let oMath = {}, isMath = true, errMath = "", isDiff
177+
let wType, hType
176178
sizes.forEach(function(size) {
177179
if (isMath) {
178180
targetH = dom["mathmldiv"+size]
@@ -208,12 +210,15 @@ const get_mathml = () => new Promise(resolve => {
208210
height = rangeH.getClientRects()[0].height
209211
width = rangeW.getClientRects()[0].width
210212
}
211-
if ("number" !== typeof height) {
212-
isMath = false
213-
errMath = log_error(SECT15, METRIC, zErrType + typeof control)
214-
} else {
213+
if (runST) {width = {}, height = ' '}
214+
wType = typeFn(width)
215+
hType = typeFn(height)
216+
if ("number" === wType && "number" === hType) {
215217
if (isCtrlSize) {isDiff = height - control}
216218
oMath[size] = [width, height]
219+
} else {
220+
isMath = false
221+
errMath = log_error(SECT15, METRIC, zErrType + (wType == hType ? wType : wType +" x "+ hType))
217222
}
218223
}
219224
})

0 commit comments

Comments
 (0)