From 2fb46bb2f559ebfd7064c057a28ffc0ff17c6722 Mon Sep 17 00:00:00 2001 From: GermanCodeEngineer Date: Sun, 9 Nov 2025 14:00:45 +0100 Subject: [PATCH 1/2] jwArrayHandler and dogeiscutObjectHandler now work for both strings and HTML --- .../extensions/DogeisCut/dogeiscutObject.js | 22 ++++++++++--------- static/extensions/DogeisCut/dogeiscutSet.js | 8 +++---- static/extensions/Fruits555000/PaintUtils.js | 4 +++- .../ddededodediamante/dateFormat.js | 11 +++++----- .../ddededodediamante/dateFormatV2.js | 11 +++++----- 5 files changed, 31 insertions(+), 25 deletions(-) diff --git a/static/extensions/DogeisCut/dogeiscutObject.js b/static/extensions/DogeisCut/dogeiscutObject.js index 001727dc0..9e6db0e7b 100644 --- a/static/extensions/DogeisCut/dogeiscutObject.js +++ b/static/extensions/DogeisCut/dogeiscutObject.js @@ -89,13 +89,15 @@ return new ObjectType({ value: x }) } - jwArrayHandler() { + jwArrayHandler(expectsPlainString, context) { // not sure how i feel about this - return this.toVisualContent().outerHTML + if (expectsPlainString) return this.toString() + else return this.toVisualContent().outerHTML } - dogeiscutObjectHandler() { - return this.toString() + dogeiscutObjectHandler(expectsPlainString, context) { + if (expectsPlainString) return this.toString() + else return this.toVisualContent().outerHTML } static convertIfNeeded(x) { @@ -122,10 +124,10 @@ } if (obj !== null && typeof obj === "object") { if (typeof obj.dogeiscutObjectHandler == "function") { - return obj.dogeiscutObjectHandler() + return obj.dogeiscutObjectHandler(true, "string") } if (typeof obj.jwArrayHandler == "function") { - return obj.jwArrayHandler() + return obj.jwArrayHandler(true, "string") } const entries = Object.entries(obj) .map(([key, value]) => `"${key.replace(/\\/g, "\\\\").replace(/"/g, '\\"')}":${stringify(value)}`) @@ -178,9 +180,9 @@ } else if (RENDER_ARRAYS_VISUALLY && (isArray(value) || (jwArray && value instanceof jwArray.Type))) { valueCell.appendChild(renderArray(isArray(value) ? value : (value.array || []))); } else if (typeof value.dogeiscutObjectHandler === "function") { - valueCell.innerHTML = value.dogeiscutObjectHandler(); + valueCell.innerHTML = value.dogeiscutObjectHandler(false, "object"); } else if (typeof value.jwArrayHandler === "function") { - valueCell.innerHTML = value.jwArrayHandler(); + valueCell.innerHTML = value.jwArrayHandler(false, "object"); } else { valueCell.appendChild(renderObject(value)); } @@ -247,9 +249,9 @@ } else if (RENDER_ARRAYS_VISUALLY && (isArray(item) || (jwArray && item instanceof jwArray.Type))) { valCell.appendChild(renderArray(isArray(item) ? item : (item.array || []))); } else if (typeof item.dogeiscutObjectHandler === "function") { - valCell.innerHTML = item.dogeiscutObjectHandler(); + valCell.innerHTML = item.dogeiscutObjectHandler(false, "array"); } else if (typeof item.jwArrayHandler === "function") { - valCell.innerHTML = item.jwArrayHandler(); + valCell.innerHTML = item.jwArrayHandler(false, "array"); } else { valCell.appendChild(renderObject(item)); } diff --git a/static/extensions/DogeisCut/dogeiscutSet.js b/static/extensions/DogeisCut/dogeiscutSet.js index 6d359bde3..cb020bc07 100644 --- a/static/extensions/DogeisCut/dogeiscutSet.js +++ b/static/extensions/DogeisCut/dogeiscutSet.js @@ -84,10 +84,10 @@ case "object": if (x === null) return "null" if (typeof x.jwArrayHandler == "function") { - return x.jwArrayHandler() + return x.jwArrayHandler(false, "set") } if (typeof x.dogeiscutSetHandler == "function") { - return x.dogeiscutSetHandler() + return x.dogeiscutSetHandler(false, "set") } return "Object" case "undefined": @@ -103,11 +103,11 @@ return "?" } - dogeiscutSetHandler() { + dogeiscutObjectHandler(expectsPlainString, context) { return `Set<${formatNumber(this.set.size)}>` } - jwArrayHandler() { + jwArrayHandler(expectsPlainString, context) { return `Set<${formatNumber(this.set.size)}>` } diff --git a/static/extensions/Fruits555000/PaintUtils.js b/static/extensions/Fruits555000/PaintUtils.js index 34af44ab2..ef58fc0c2 100644 --- a/static/extensions/Fruits555000/PaintUtils.js +++ b/static/extensions/Fruits555000/PaintUtils.js @@ -88,7 +88,9 @@ return this.fromRGB(r, g, b) } - jwArrayHandler() { + jwArrayHandler(expectsPlainString, context) { + if (expectsPlainString) return this.toString() + let colour = document.createElement('div') colour.style.width = "16px" colour.style.height = "16px" diff --git a/static/extensions/ddededodediamante/dateFormat.js b/static/extensions/ddededodediamante/dateFormat.js index 26446c318..1f2b7b1b3 100644 --- a/static/extensions/ddededodediamante/dateFormat.js +++ b/static/extensions/ddededodediamante/dateFormat.js @@ -118,12 +118,13 @@ return `${y}-${m}-${d} ${hh}:${mm}`; } - jwArrayHandler() { - return this.isValid() ? this._prettyShort() : "Invalid Date"; + jwArrayHandler(expectsPlainString, context) { + return this.isValid() ? this._prettyShort() : "Invalid Date"; // always a string anyway } - - dogeiscutObjectHandler() { - return this.toListItem(); + + dogeiscutObjectHandler(expectsPlainString, context) { + if (expectsPlainString) return this.toString(); + else return this.toListItem(); } } diff --git a/static/extensions/ddededodediamante/dateFormatV2.js b/static/extensions/ddededodediamante/dateFormatV2.js index 204150718..54dc34a6d 100644 --- a/static/extensions/ddededodediamante/dateFormatV2.js +++ b/static/extensions/ddededodediamante/dateFormatV2.js @@ -131,12 +131,13 @@ return `${y}-${m}-${d} ${hh}:${mm}`; } - jwArrayHandler() { - return this.isValid() ? this._prettyShort() : "Invalid Date"; + jwArrayHandler(expectsPlainString, context) { + return this.isValid() ? this._prettyShort() : "Invalid Date"; // always a string anyway } - - dogeiscutObjectHandler() { - return this.toListItem(); + + dogeiscutObjectHandler(expectsPlainString, context) { + if (expectsPlainString) return this.toString(); + else return this.toListItem(); } } From b8123e339be4821435ca562cb1657dbb3bc3b356 Mon Sep 17 00:00:00 2001 From: GermanCodeEngineer Date: Sun, 9 Nov 2025 18:10:42 +0100 Subject: [PATCH 2/2] fixed tiny mistake in dogeiscutSet --- static/extensions/DogeisCut/dogeiscutSet.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/static/extensions/DogeisCut/dogeiscutSet.js b/static/extensions/DogeisCut/dogeiscutSet.js index cb020bc07..dd10d16ec 100644 --- a/static/extensions/DogeisCut/dogeiscutSet.js +++ b/static/extensions/DogeisCut/dogeiscutSet.js @@ -103,6 +103,10 @@ return "?" } + dogeiscutSetHandler(expectsPlainString, context) { + return `Set<${formatNumber(this.set.size)}>` + } + dogeiscutObjectHandler(expectsPlainString, context) { return `Set<${formatNumber(this.set.size)}>` }