From 6cca6f2d90cb41f22485ea5f9fe25b2fc88816ed Mon Sep 17 00:00:00 2001 From: "you@example.com" Date: Wed, 24 Jul 2024 08:12:54 +0900 Subject: [PATCH] s --- src/Tray.js | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/src/Tray.js b/src/Tray.js index 7ad4388..4481303 100644 --- a/src/Tray.js +++ b/src/Tray.js @@ -1,3 +1,11 @@ +function getRandomColor() { + const letters = '0123456789ABCDEF'; + let color = '#'; + for (let i = 0; i < 6; i++) { + color += letters[Math.floor(Math.random() * 16)]; + } + return color; +} function getTrayFromId(Id) { return document.querySelector(`[data-tray-id="${Id}"]`).__trayInstance; } @@ -554,7 +562,6 @@ formatCreatedTime() { } else { foldButton.style.display = 'inline-block'; foldButtonRight.style.display = 'inline-block'; - if (this.isFolded) { content.style.display = 'none'; foldButton.textContent = '▶'; @@ -847,6 +854,11 @@ formatCreatedTime() { childTray.parent = this; childTray.parentId = this.id; this.element.querySelector('.tray-content').appendChild(childTray.element) + if (this.children.length==1){ + const color = getRandomColor(); + this.borderColor = color; + this.updateBorderColor() + } } onContextMenu(event) { event.preventDefault();