From 095d5c79a63c51d971b5a3a6a73cfd47bbdb0a11 Mon Sep 17 00:00:00 2001 From: RainbowKey <113303649+Rainb0wKey@users.noreply.github.com> Date: Thu, 14 Aug 2025 10:33:07 +0300 Subject: [PATCH 0001/1179] Create editor.md --- src/tools/editor.md | 127 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 127 insertions(+) create mode 100644 src/tools/editor.md diff --git a/src/tools/editor.md b/src/tools/editor.md new file mode 100644 index 00000000000..e32d40a1405 --- /dev/null +++ b/src/tools/editor.md @@ -0,0 +1,127 @@ +# Text Editor +Here you can use the basic editor features to write codes more conveniently. + + + + +
Words: 0 | + Spaces: 0 | + Lines: 0 | + Characters: 0 +
[: 0 | ]: 0
+
+ + From a8d09ebcb4654f894d5ff6b9c97e096d7c9d11ff Mon Sep 17 00:00:00 2001 From: RainbowKey <113303649+Rainb0wKey@users.noreply.github.com> Date: Thu, 14 Aug 2025 10:34:33 +0300 Subject: [PATCH 0002/1179] Update SUMMARY.md --- src/SUMMARY.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/SUMMARY.md b/src/SUMMARY.md index 500d2659100..83f81210dca 100644 --- a/src/SUMMARY.md +++ b/src/SUMMARY.md @@ -42,6 +42,9 @@ - [Share Code](./guides/other/sharecode.md) - [Common BDFD Errors](./guides/other/commonErrors.md) +- [Tools]() + - [Editor](./tools/editor.md) + - [Resources]() - [Introduction](./resources/introduction.md) - [BDFD API](./resources/api.md) From 7702379a518a9f312eb170b355db23b689cfb925 Mon Sep 17 00:00:00 2001 From: RainbowKey <113303649+Rainb0wKey@users.noreply.github.com> Date: Thu, 14 Aug 2025 10:48:04 +0300 Subject: [PATCH 0003/1179] Update editor.md --- src/tools/editor.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/tools/editor.md b/src/tools/editor.md index e32d40a1405..6e723197d70 100644 --- a/src/tools/editor.md +++ b/src/tools/editor.md @@ -1,6 +1,9 @@ # Text Editor Here you can use the basic editor features to write codes more conveniently. + + + - - -Words: 0 | + margin-bottom: 10px; + } + + input { + width: 100%; + margin-bottom: 10px; + } + + .highlight { + background-color: yellow; + } + + #highlightedText { + white-space: pre-wrap; + word-break: break-word; + } + + #error-message { + color: red; + } + + #stats-container { + position: fixed; + top: 0; + left: 0; + background-color: white; + padding: 10px; + border-bottom: 1px solid #ccc; + z-index: 100; + } + + body { + padding-top: 60px; + } + + +
Words: 0 | Spaces: 0 | Lines: 0 | Characters: 0 -
[: 0 | ]: 0
-
- - - + } + From ab949be1a908179c9e51006bac6205a55c9e741c Mon Sep 17 00:00:00 2001 From: RainbowKey <113303649+Rainb0wKey@users.noreply.github.com> Date: Thu, 14 Aug 2025 11:21:18 +0300 Subject: [PATCH 0006/1179] Update chrome.css --- src/theme/css/chrome.css | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/theme/css/chrome.css b/src/theme/css/chrome.css index 6fb392253f0..3032cbdd10a 100644 --- a/src/theme/css/chrome.css +++ b/src/theme/css/chrome.css @@ -751,6 +751,7 @@ ul#searchresults span.teaser em { .sidebar-hidden .page-wrapper { transform: translateX(320px); + width: calc(100% - 320px); } } @@ -1008,3 +1009,4 @@ ul#searchresults span.teaser em { -webkit-animation-iteration-count: infinite; -webkit-animation-timing-function: ease-in; } + From 41aaee1fb395145ad18f570e8b039a8338f6a9e5 Mon Sep 17 00:00:00 2001 From: RainbowKey <113303649+Rainb0wKey@users.noreply.github.com> Date: Thu, 14 Aug 2025 11:24:00 +0300 Subject: [PATCH 0007/1179] Update editor.md --- src/tools/editor.md | 63 --------------------------------------------- 1 file changed, 63 deletions(-) diff --git a/src/tools/editor.md b/src/tools/editor.md index 0e7467bfed9..2ddaeec0481 100644 --- a/src/tools/editor.md +++ b/src/tools/editor.md @@ -59,66 +59,3 @@ Here you can use the basic editor features to write codes more conveniently.[: 0 | ]: 0
- - From f380d0f58e7e46ed6ab9e190b3f81aa60367d85a Mon Sep 17 00:00:00 2001 From: RainbowKey <113303649+Rainb0wKey@users.noreply.github.com> Date: Thu, 14 Aug 2025 11:26:07 +0300 Subject: [PATCH 0008/1179] Update playground.js --- src/theme/playground.js | 62 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 62 insertions(+) diff --git a/src/theme/playground.js b/src/theme/playground.js index 65d13525da8..2f84d3021d1 100644 --- a/src/theme/playground.js +++ b/src/theme/playground.js @@ -179,3 +179,65 @@ function editInputHeight() { playInputt.style.width = "fit-content"; } } + +// Editor tools +function updateStats() { + const text = document.getElementById("editor").value; + const words = text.trim().split(/\s+/).filter(word => word !== ""); + const wordCount = words.length; + let spaceCount = 0; + for (let i = 0; i < text.length; i++) { if (text[i] === ' ') { spaceCount++; } } + const lineCount = text.split('\n').length; + const charCount = text.length; + + document.getElementById("wordCount").textContent = wordCount; + document.getElementById("spaceCount").textContent = spaceCount; + document.getElementById("lineCount").textContent = lineCount; + document.getElementById("charCount").textContent = charCount; +} + +function replaceText() { + const searchText = document.getElementById("searchText").value; + const replaceText = document.getElementById("replaceText").value; + const editor = document.getElementById("editor"); + editor.value = editor.value.replaceAll(searchText, replaceText); + updateStats(); + checkBrackets(); +} + +function checkBrackets() { + const text = document.getElementById("editor").value; + let openBrackets = 0; + let closeBrackets = 0; + + for (let i = 0; i < text.length; i++) { + if (text[i] === '[') { openBrackets++; } + else if (text[i] === ']') { closeBrackets++; } + } + + document.getElementById("openCount").textContent = openBrackets; + document.getElementById("closeCount").textContent = closeBrackets; + const errorMessageElement = document.getElementById("error-message"); + + if (openBrackets > closeBrackets) { errorMessageElement.textContent = "Error: Brackets are closed."; } + else if (openBrackets < closeBrackets) { errorMessageElement.textContent = "Error: empty"; } + else { errorMessageElement.textContent = ""; } +} + +function toggleHighlight() { + const button = document.getElementById("highlightButton"); + const highlightedTextDiv = document.getElementById("highlightedText"); + const text = document.getElementById("editor").value; + const searchText = document.getElementById("searchText").value; + let highlighted = text; + if (button.textContent === "Highlighting found") { + if (searchText) { + highlighted = highlighted.replaceAll(searchText, `${searchText}`); + } + highlightedTextDiv.innerHTML = highlighted; + button.textContent = "Hide"; + } else { + highlightedTextDiv.innerHTML = ""; + button.textContent = "Highlighting found"; + } +} From 50104bf580b08ca7c7b4eda0da335b9709af5491 Mon Sep 17 00:00:00 2001 From: RainbowKey <113303649+Rainb0wKey@users.noreply.github.com> Date: Thu, 14 Aug 2025 11:29:06 +0300 Subject: [PATCH 0009/1179] Update editor.md --- src/tools/editor.md | 41 ----------------------------------------- 1 file changed, 41 deletions(-) diff --git a/src/tools/editor.md b/src/tools/editor.md index 2ddaeec0481..e280adea8d7 100644 --- a/src/tools/editor.md +++ b/src/tools/editor.md @@ -1,46 +1,5 @@ # Text Editor Here you can use the basic editor features to write codes more conveniently. - -
Words: 0 | From b9427e4b5bf6c3153eba4e068a7ccadd2089b84b Mon Sep 17 00:00:00 2001 From: RainbowKey <113303649+Rainb0wKey@users.noreply.github.com> Date: Thu, 14 Aug 2025 11:43:35 +0300 Subject: [PATCH 0010/1179] Update editor.md --- src/tools/editor.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/tools/editor.md b/src/tools/editor.md index e280adea8d7..03db2b8d94b 100644 --- a/src/tools/editor.md +++ b/src/tools/editor.md @@ -2,10 +2,10 @@ Here you can use the basic editor features to write codes more conveniently.
Words: 0 | - Spaces: 0 | - Lines: 0 | - Characters: 0 +
Words: 0
+Spaces: 0
+Lines: 0
+Characters: 0
Lines: 0
Characters: 0
[: 0 | ]: 0
From b69c2a7707d5b0e5ca870edb231e1915631f17d2 Mon Sep 17 00:00:00 2001 From: RainbowKey <113303649+Rainb0wKey@users.noreply.github.com> Date: Thu, 14 Aug 2025 12:29:22 +0300 Subject: [PATCH 0015/1179] Update editor.md --- src/tools/editor.md | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/src/tools/editor.md b/src/tools/editor.md index 73f248e2d76..30075bbbe74 100644 --- a/src/tools/editor.md +++ b/src/tools/editor.md @@ -9,11 +9,14 @@ Here you can use the basic editor features to write codes more conveniently.
[: 0 | ]: 0
From 3c00fbf1ffc92eff4aa035ddc3adcacb937ac465 Mon Sep 17 00:00:00 2001 From: RainbowKey <113303649+Rainb0wKey@users.noreply.github.com> Date: Thu, 14 Aug 2025 12:37:24 +0300 Subject: [PATCH 0016/1179] Update editor.md --- src/tools/editor.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/tools/editor.md b/src/tools/editor.md index 30075bbbe74..a7ddf289272 100644 --- a/src/tools/editor.md +++ b/src/tools/editor.md @@ -9,7 +9,7 @@ Here you can use the basic editor features to write codes more conveniently.
[: 0 | ]: 0
+
[: 0 | ]: 0
From ef71231d432b2ae4a26869b4044d00af526b7bff Mon Sep 17 00:00:00 2001 From: RainbowKey <113303649+Rainb0wKey@users.noreply.github.com> Date: Thu, 14 Aug 2025 13:33:11 +0300 Subject: [PATCH 0020/1179] Update playground.js --- src/theme/playground.js | 31 +++++++++++++++++++++++++------ 1 file changed, 25 insertions(+), 6 deletions(-) diff --git a/src/theme/playground.js b/src/theme/playground.js index 2f84d3021d1..f7a6cda9a79 100644 --- a/src/theme/playground.js +++ b/src/theme/playground.js @@ -209,19 +209,37 @@ function checkBrackets() { const text = document.getElementById("editor").value; let openBrackets = 0; let closeBrackets = 0; + let i = 0; - for (let i = 0; i < text.length; i++) { - if (text[i] === '[') { openBrackets++; } - else if (text[i] === ']') { closeBrackets++; } + while (i < text.length) { + if (text[i] === '[') { + openBrackets++; + i++; + } else if (text[i] === ']' && (i === 0 || text[i - 1] !== '\\')) { + closeBrackets++; + i++; + } else { + i++; + } } document.getElementById("openCount").textContent = openBrackets; document.getElementById("closeCount").textContent = closeBrackets; + const errorMessageElement = document.getElementById("error-message"); - if (openBrackets > closeBrackets) { errorMessageElement.textContent = "Error: Brackets are closed."; } - else if (openBrackets < closeBrackets) { errorMessageElement.textContent = "Error: empty"; } - else { errorMessageElement.textContent = ""; } + if (errorMessageElement) { + if (openBrackets > closeBrackets) { + errorMessageElement.textContent = "Error: Brackets are not closed.."; + errorMessageElement.style.color = "red"; + } else if (openBrackets < closeBrackets) { + errorMessageElement.textContent = "Warning: Different amounts of [ and ] are used"; + errorMessageElement.style.color = "orange"; + } else { + errorMessageElement.textContent = ""; + errorMessageElement.style.color = "black"; + } + } } function toggleHighlight() { @@ -241,3 +259,4 @@ function toggleHighlight() { button.textContent = "Highlighting found"; } } + From 7c3bcc7b56652366ab38306833b9f55178f2d17d Mon Sep 17 00:00:00 2001 From: RainbowKey <113303649+Rainb0wKey@users.noreply.github.com> Date: Thu, 14 Aug 2025 13:54:38 +0300 Subject: [PATCH 0021/1179] Update chrome.css --- src/theme/css/chrome.css | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/src/theme/css/chrome.css b/src/theme/css/chrome.css index a2b1208f64f..7b550ab8b46 100644 --- a/src/theme/css/chrome.css +++ b/src/theme/css/chrome.css @@ -1104,4 +1104,27 @@ ul#searchresults span.teaser em { transition: 0.4s; } +#error-message { + margin-top: -1rem; + margin-bottom: 3rem; + display: flex; + flex-direction: row; + justify-content: center; + align-items: center; +} + +#highlightedText span { + color: var(--color1); +} + +#highlightedText { + color: #bbb; + font-size: 1.5rem; + border-radius: 10px; + border-width: 0; + width: 100%; + padding: 10px; + height: 100%; + background: hsl(0deg 0% 100% / 7%); +} From 524e81a86c65a8e39dcbf8ed63951340210c7cf4 Mon Sep 17 00:00:00 2001 From: RainbowKey <113303649+Rainb0wKey@users.noreply.github.com> Date: Thu, 14 Aug 2025 14:22:30 +0300 Subject: [PATCH 0022/1179] Update playground.js --- src/theme/playground.js | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/src/theme/playground.js b/src/theme/playground.js index f7a6cda9a79..b96dd65b15f 100644 --- a/src/theme/playground.js +++ b/src/theme/playground.js @@ -248,11 +248,26 @@ function toggleHighlight() { const text = document.getElementById("editor").value; const searchText = document.getElementById("searchText").value; let highlighted = text; + let matches = 0; + if (button.textContent === "Highlighting found") { if (searchText) { - highlighted = highlighted.replaceAll(searchText, `${searchText}`); + const escapedSearchText = searchText.replace(/[.*+?^${}()|[\]\\]/g, '\\$&'); + const regex = new RegExp(escapedSearchText, 'gi'); + + highlighted = text.replace(regex, (match) => { + matches++; + return `${match}`; + }); + } + + const lines = highlighted.split('\n'); + let numberedText = ""; + for (let i = 0; i < lines.length; i++) { + numberedText += `${i + 1} ${lines[i]}
Results: ${matches}
`; button.textContent = "Hide"; } else { highlightedTextDiv.innerHTML = ""; @@ -260,3 +275,5 @@ function toggleHighlight() { } } + + From 1fde278b57bc8a51a5fdd42e7f0852f40bfd91fd Mon Sep 17 00:00:00 2001 From: RainbowKey <113303649+Rainb0wKey@users.noreply.github.com> Date: Thu, 14 Aug 2025 14:34:02 +0300 Subject: [PATCH 0023/1179] Update chrome.css --- src/theme/css/chrome.css | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/theme/css/chrome.css b/src/theme/css/chrome.css index 7b550ab8b46..ef61c5f6b40 100644 --- a/src/theme/css/chrome.css +++ b/src/theme/css/chrome.css @@ -1128,3 +1128,15 @@ ul#searchresults span.teaser em { background: hsl(0deg 0% 100% / 7%); } +.line-number { + border-right-width: 2px; + color: hsl(0deg 0% 100% / 30%) !important; + border-color: hsl(0deg 0% 100% / 30%); + border-right-style: solid; + display: inline-block; + width: 1.5rem; + margin-right: 1rem; + -webkit-user-select: none; + user-select: none; +} + From e63e83e742428715433304860f649a05bc5f9435 Mon Sep 17 00:00:00 2001 From: RainbowKey <113303649+Rainb0wKey@users.noreply.github.com> Date: Thu, 14 Aug 2025 14:37:03 +0300 Subject: [PATCH 0024/1179] Update playground.js --- src/theme/playground.js | 37 ++++++++++++++++--------------------- 1 file changed, 16 insertions(+), 21 deletions(-) diff --git a/src/theme/playground.js b/src/theme/playground.js index b96dd65b15f..4599f161016 100644 --- a/src/theme/playground.js +++ b/src/theme/playground.js @@ -250,30 +250,25 @@ function toggleHighlight() { let highlighted = text; let matches = 0; - if (button.textContent === "Highlighting found") { - if (searchText) { - const escapedSearchText = searchText.replace(/[.*+?^${}()|[\]\\]/g, '\\$&'); - const regex = new RegExp(escapedSearchText, 'gi'); - - highlighted = text.replace(regex, (match) => { - matches++; - return `${match}`; - }); - } - - const lines = highlighted.split('\n'); - let numberedText = ""; - for (let i = 0; i < lines.length; i++) { - numberedText += `${i + 1} ${lines[i]}Results: ${matches}
`; - button.textContent = "Hide"; - } else { - highlightedTextDiv.innerHTML = ""; - button.textContent = "Highlighting found"; + const lines = highlighted.split('\n'); + let numberedText = ""; + for (let i = 0; i < lines.length; i++) { + numberedText += `${i + 1} ${lines[i]}Results: ${matches}
`; } + From 0a4db042152ebabd67cebe6c57c7fa398495b13f Mon Sep 17 00:00:00 2001 From: RainbowKey <113303649+Rainb0wKey@users.noreply.github.com> Date: Thu, 14 Aug 2025 14:37:32 +0300 Subject: [PATCH 0025/1179] Update editor.md --- src/tools/editor.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/tools/editor.md b/src/tools/editor.md index 5943b79c5f5..78cbc6c68a2 100644 --- a/src/tools/editor.md +++ b/src/tools/editor.md @@ -15,7 +15,7 @@ Here you can use the basic editor features to write codes more conveniently.[: 0 | ]: 0
From e4889478ef45c944f6f9d7fa86c18e2c7df48bdb Mon Sep 17 00:00:00 2001
From: RainbowKey <113303649+Rainb0wKey@users.noreply.github.com>
Date: Thu, 14 Aug 2025 14:42:28 +0300
Subject: [PATCH 0026/1179] Update chrome.css
---
src/theme/css/chrome.css | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/src/theme/css/chrome.css b/src/theme/css/chrome.css
index ef61c5f6b40..88bbb3ad1ee 100644
--- a/src/theme/css/chrome.css
+++ b/src/theme/css/chrome.css
@@ -1125,6 +1125,7 @@ ul#searchresults span.teaser em {
width: 100%;
padding: 10px;
height: 100%;
+ word-break: break-all;
background: hsl(0deg 0% 100% / 7%);
}
@@ -1134,9 +1135,11 @@ ul#searchresults span.teaser em {
border-color: hsl(0deg 0% 100% / 30%);
border-right-style: solid;
display: inline-block;
- width: 1.5rem;
+ width: 4.2rem;
margin-right: 1rem;
+ white-space: nowrap;
-webkit-user-select: none;
user-select: none;
}
+
From bf8530c92de2a8a1621ed8d6bdf51a2ed79b8a7e Mon Sep 17 00:00:00 2001
From: RainbowKey <113303649+Rainb0wKey@users.noreply.github.com>
Date: Thu, 14 Aug 2025 14:43:25 +0300
Subject: [PATCH 0027/1179] Update editor.md
---
src/tools/editor.md | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/tools/editor.md b/src/tools/editor.md
index 78cbc6c68a2..43f8c7ac50d 100644
--- a/src/tools/editor.md
+++ b/src/tools/editor.md
@@ -14,7 +14,7 @@ Here you can use the basic editor features to write codes more conveniently.
-
+
From e2f60716cbdbfcdba0b726db5086d838e4ccb93e Mon Sep 17 00:00:00 2001
From: RainbowKey <113303649+Rainb0wKey@users.noreply.github.com>
Date: Thu, 14 Aug 2025 14:46:54 +0300
Subject: [PATCH 0028/1179] Update playground.js
---
src/theme/playground.js | 8 ++------
1 file changed, 2 insertions(+), 6 deletions(-)
diff --git a/src/theme/playground.js b/src/theme/playground.js
index 4599f161016..75297df0cdf 100644
--- a/src/theme/playground.js
+++ b/src/theme/playground.js
@@ -265,10 +265,6 @@ function toggleHighlight() {
for (let i = 0; i < lines.length; i++) {
numberedText += `${i + 1} ${lines[i]}
`;
}
-
- highlightedTextDiv.innerHTML = numberedText + `
Results: ${matches}
`; + const resultsString = `Results: ${matches}
`; + highlightedTextDiv.innerHTML = resultsString + numberedText; } - - - - From 6602f335243804bb84c151d73acc65d907eb23f0 Mon Sep 17 00:00:00 2001 From: RainbowKey <113303649+Rainb0wKey@users.noreply.github.com> Date: Thu, 14 Aug 2025 14:50:33 +0300 Subject: [PATCH 0029/1179] Update chrome.css --- src/theme/css/chrome.css | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/theme/css/chrome.css b/src/theme/css/chrome.css index 88bbb3ad1ee..077edef7f4b 100644 --- a/src/theme/css/chrome.css +++ b/src/theme/css/chrome.css @@ -1089,6 +1089,7 @@ ul#searchresults span.teaser em { border: none; border-radius: 10px; cursor: pointer; + margin-top: -1rem; font-size: 1.5rem; margin: 0.25%; color: #fff; @@ -1122,7 +1123,6 @@ ul#searchresults span.teaser em { font-size: 1.5rem; border-radius: 10px; border-width: 0; - width: 100%; padding: 10px; height: 100%; word-break: break-all; @@ -1143,3 +1143,4 @@ ul#searchresults span.teaser em { } + From 6a02612c44dcf8e9329aa2edae32110d7ae22024 Mon Sep 17 00:00:00 2001 From: RainbowKey <113303649+Rainb0wKey@users.noreply.github.com> Date: Thu, 14 Aug 2025 14:51:13 +0300 Subject: [PATCH 0030/1179] Update editor.md --- src/tools/editor.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/tools/editor.md b/src/tools/editor.md index 43f8c7ac50d..4839a18a3b0 100644 --- a/src/tools/editor.md +++ b/src/tools/editor.md @@ -12,7 +12,7 @@ Here you can use the basic editor features to write codes more conveniently.Words: 0
Spaces: 0
-Lines: 0
-Characters: 0
+Lines: 0
+Characters: 0
+Bytes: 0
[: 0 | ]: 0
+
[0
+]0
+Escaped Characters: 0
+Results: ${matches}
`; - highlightedTextDiv.innerHTML = resultsString + numberedText; +function toggleHighlight() { + const highlightedTextDiv = document.getElementById("highlightedText"); + const text = document.getElementById("editor").value; + const searchText = document.getElementById("searchText").value; + let highlighted = text; + let matches = 0; + + if (searchText) { + const escapedSearchText = searchText.replace(/[.*+?^${}()|[\]\\]/g, '\\$&'); + const regex = new RegExp(escapedSearchText, 'gi'); + + highlighted = text.replace(regex, (match) => { + matches++; + return `${match}`; + }); + } + + const mentionRegex = /<@(.*?)>/g; + highlighted = highlighted.replace(mentionRegex, (match, content) => { + return `@${content}`; + }); + + const channelRegex = /<#(.*?)>/g; + highlighted = highlighted.replace(channelRegex, (match, content) => { + return `#${content}`; + }); + + const boldRegex = /\*\*(.*?)\*\*/g; + highlighted = highlighted.replace(boldRegex, (match, content) => { + return `${content}`; + }); + + const lines = highlighted.split('\n'); + let numberedText = ""; + for (let i = 0; i < lines.length; i++) { + numberedText += `${i + 1} ${lines[i]}Results: ${matches}
`; + highlightedTextDiv.innerHTML = resultsString + numberedText; } From 123693f6a9090e26274858789836a8033254c82e Mon Sep 17 00:00:00 2001 From: RainbowKey <113303649+Rainb0wKey@users.noreply.github.com> Date: Fri, 15 Aug 2025 14:02:13 +0300 Subject: [PATCH 0037/1179] Update chrome.css --- src/theme/css/chrome.css | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/src/theme/css/chrome.css b/src/theme/css/chrome.css index ff45a3933c0..3e0e05853aa 100644 --- a/src/theme/css/chrome.css +++ b/src/theme/css/chrome.css @@ -1141,12 +1141,19 @@ ul#searchresults span.teaser em { border-right-style: solid; display: inline-block; width: 4.2rem; - margin-right: 1rem; - white-space: nowrap; - -webkit-user-select: none; - user-select: none; + margin-right: 1rem; + white-space: nowrap; + -webkit-user-select: none; + user-select: none; +} + +.channel, .mention { + border-radius: 10px; + color: #D5D7F9; + background-color: #3B4085 !important; + font-weight: bold; + padding: 2px; } - From 8f16d2cf041505aa62efa4c451f94f8cca327b75 Mon Sep 17 00:00:00 2001 From: RainbowKey <113303649+Rainb0wKey@users.noreply.github.com> Date: Fri, 15 Aug 2025 14:11:42 +0300 Subject: [PATCH 0038/1179] Update playground.js --- src/theme/playground.js | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/src/theme/playground.js b/src/theme/playground.js index b2108577692..c30ae5e3392 100644 --- a/src/theme/playground.js +++ b/src/theme/playground.js @@ -251,6 +251,7 @@ function toggleHighlight() { let highlighted = text; let matches = 0; + // Подсветка по поисковому запросу if (searchText) { const escapedSearchText = searchText.replace(/[.*+?^${}()|[\]\\]/g, '\\$&'); const regex = new RegExp(escapedSearchText, 'gi'); @@ -261,6 +262,7 @@ function toggleHighlight() { }); } + // Подсветка <@…> и <#…>, убираем скобки const mentionRegex = /<@(.*?)>/g; highlighted = highlighted.replace(mentionRegex, (match, content) => { return `@${content}`; @@ -271,11 +273,25 @@ function toggleHighlight() { return `#${content}`; }); + // Обработка жирного текста: **текст** -> текст const boldRegex = /\*\*(.*?)\*\*/g; highlighted = highlighted.replace(boldRegex, (match, content) => { return `${content}`; }); + // Обработка курсива: *текст* -> текст + const italicRegex = /\*(.*?)\*/g; + highlighted = highlighted.replace(italicRegex, (match, content) => { + return `${content}`; + }); + + // Обработка кода: `текст` ->текст
+ const codeRegex = /`(.*?)`/g; + highlighted = highlighted.replace(codeRegex, (match, content) => { + return `${content}
`; + }); + + // Добавление номеров строк const lines = highlighted.split('\n'); let numberedText = ""; for (let i = 0; i < lines.length; i++) { @@ -284,4 +300,4 @@ function toggleHighlight() { const resultsString = `Results: ${matches}
`; highlightedTextDiv.innerHTML = resultsString + numberedText; -} +} From 970460f6f9194e9ad864fbb0ab8c56d8f9b6dab8 Mon Sep 17 00:00:00 2001 From: RainbowKey <113303649+Rainb0wKey@users.noreply.github.com> Date: Fri, 15 Aug 2025 14:19:19 +0300 Subject: [PATCH 0039/1179] Update playground.js --- src/theme/playground.js | 54 ++++++++++++++++++++++++++++++++++++++++- 1 file changed, 53 insertions(+), 1 deletion(-) diff --git a/src/theme/playground.js b/src/theme/playground.js index c30ae5e3392..9ebc6b0ce85 100644 --- a/src/theme/playground.js +++ b/src/theme/playground.js @@ -285,12 +285,38 @@ function toggleHighlight() { return `${content}`; }); - // Обработка кода: `текст` ->текст
+ // Обработка кода: `текст` ->текст
const codeRegex = /`(.*?)`/g; highlighted = highlighted.replace(codeRegex, (match, content) => { return `${content}
`; }); + // Преобразование ссылок: автоматически распознает и создает теги + const linkRegex = /(https?:\/\/[^\s]+)/g; + highlighted = highlighted.replace(linkRegex, (url) => { + return `${url}`; + }); + + // Обработка timestamp меток + const timestampRegex = /Results: ${matches}
`; highlightedTextDiv.innerHTML = resultsString + numberedText; } + +// Функция для получения относительного времени (например, "5 minutes ago") +function getRelativeTime(date) { + const now = new Date(); + const diffInSeconds = Math.round((now - date) / 1000); + + const intervals = { + 'year': 31536000, + 'month': 2592000, + 'day': 86400, + 'hour': 3600, + 'minute': 60, + 'second': 1 + }; + + for (const interval in intervals) { + const secondsInInterval = intervals[interval]; + const quantity = Math.floor(diffInSeconds / secondsInInterval); + + if (quantity >= 1) { + return quantity + ' ' + interval + (quantity > 1 ? 's' : '') + ' ago'; + } + } + + return 'Just now'; +} From 54ae88ed6a834ae43c7dcf00ef5a9befc52357c0 Mon Sep 17 00:00:00 2001 From: RainbowKey <113303649+Rainb0wKey@users.noreply.github.com> Date: Fri, 15 Aug 2025 14:22:47 +0300 Subject: [PATCH 0040/1179] Update editor.md --- src/tools/editor.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/tools/editor.md b/src/tools/editor.md index f9abded7670..3f688d7690c 100644 --- a/src/tools/editor.md +++ b/src/tools/editor.md @@ -1,4 +1,4 @@ -# Text Editor +# Text Editor 14:22 last update Here you can use the basic editor features to write codes more conveniently.${content}
`; }); - // Преобразование ссылок: автоматически распознает и создает теги + // Преобразование ссылок: автоматически распознает и создает теги const linkRegex = /(https?:\/\/[^\s]+)/g; highlighted = highlighted.replace(linkRegex, (url) => { return `${url}`; }); - // Обработка timestamp меток + // Обработка timestamp меток const timestampRegex = /[0
]0
-Escaped Characters: 0
+Escaped Characters: 0
270°
From c5394a994958bf1e52d67ea8bf129e527ecd030a Mon Sep 17 00:00:00 2001 From: RainbowKey <113303649+Rainb0wKey@users.noreply.github.com> Date: Sat, 16 Aug 2025 10:27:44 +0300 Subject: [PATCH 0058/1179] Update index.js --- src/theme/settings/index.js | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/src/theme/settings/index.js b/src/theme/settings/index.js index 998fad3a552..342938f0bb9 100644 --- a/src/theme/settings/index.js +++ b/src/theme/settings/index.js @@ -233,14 +233,18 @@ let isLocked = true; // Used in status bar (iPhone). function setStatusBar(HueInput) { - if (HueInput != "dark") { + if (HueInput == "dark") { document .querySelector('meta[name="theme-color"]') - .setAttribute("content", `hsl(${HueInput}, 80%, 8%)`); + .setAttribute("content", `#000`); + } else if (HueInput) == "light") { + document + .querySelector('meta[name="theme-color"]') + .setAttribute("content", `#fff`); } else { document .querySelector('meta[name="theme-color"]') - .setAttribute("content", `#000`); + .setAttribute("content", `hsl(${HueInput}, 80%, 8%)`); } } @@ -385,6 +389,13 @@ function useDarkBackground() { updateJsonFile("theme-bg", document.body.style.background); } +function useLightBackground() { + document.body.style.background = `#fff`; + document.documentElement.style.scrollbarColor = `#000` + `#fff`; + setStatusBar("light"); + updateJsonFile("theme-bg", document.body.style.background); +} + function resetTheme() { const colorSlider = document.getElementById("themeSlider"); From 1c51af8f0860d18036297d2f705797ec5bcc9d09 Mon Sep 17 00:00:00 2001 From: RainbowKey <113303649+Rainb0wKey@users.noreply.github.com> Date: Sat, 16 Aug 2025 10:54:16 +0300 Subject: [PATCH 0059/1179] Update chrome.css --- src/theme/css/chrome.css | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/theme/css/chrome.css b/src/theme/css/chrome.css index c1ab4efd341..74be6abcd8d 100644 --- a/src/theme/css/chrome.css +++ b/src/theme/css/chrome.css @@ -1164,12 +1164,14 @@ ul#searchresults span.teaser em { background-color: hsl(0deg 0% 100% / 5%) !important; } -#hg-code { - border-radius: 5px; +.hg-code { + border-radius: 5px; border-width: 2px; border-style: solid; border-color: hsl(0deg 0% 100% / 10%) !important; color: hsl(0deg 0% 100% / 40%) !important; - background-color: hsl(0deg 0% 100% / 5%) !important; + background-color: hsl(0deg 0% 100% / 5%) !important; padding: 1px; -} + display: inline-block; +} + From 6ec7e75c5580c78d9d14668714dcf52ebd8b30e0 Mon Sep 17 00:00:00 2001 From: RainbowKey <113303649+Rainb0wKey@users.noreply.github.com> Date: Sat, 16 Aug 2025 11:42:07 +0300 Subject: [PATCH 0060/1179] Update playground.js --- src/theme/playground.js | 78 +++++++++++++++++++++++------------------ 1 file changed, 43 insertions(+), 35 deletions(-) diff --git a/src/theme/playground.js b/src/theme/playground.js index 0cd4fdec3ab..eeeb9c57eb0 100644 --- a/src/theme/playground.js +++ b/src/theme/playground.js @@ -237,42 +237,50 @@ function replaceText() { checkBrackets(); } -function checkBrackets() { - const text = document.getElementById("editor").value; - let openBrackets = 0; - let closeBrackets = 0; - let i = 0; - - while (i < text.length) { - if (text[i] === '[') { - openBrackets++; - i++; - } else if (text[i] === ']' && (i === 0 || text[i - 1] !== '\\')) { - closeBrackets++; - i++; - } else { - i++; - } - } - - document.getElementById("openCount").textContent = openBrackets; - document.getElementById("closeCount").textContent = closeBrackets; - - const errorMessageElement = document.getElementById("error-message"); +function checkBrackets() { + const text = document.getElementById("editor").value; + let openBrackets = 0; + let closeBrackets = 0; + let i = 0; + + // Считаем скобки, но только если перед ними есть $ + while (i < text.length) { + if (text[i] === '[' && i > 0 && text[i - 1] === '$') { // Проверяем, что перед '[' есть '$' + openBrackets++; + } else if (text[i] === ']' && i > 0 && (i === 1 || text[i - 1] !== '\\')) { // Проверяем ']' и экранирование + closeBrackets++; + } + i++; + } + + document.getElementById("openCount").textContent = openBrackets; + document.getElementById("closeCount").textContent = closeBrackets; + + const errorMessageElement = document.getElementById("error-message"); + + // Проверяем баланс скобок и выводим ошибку, только если были найдены скобки с '$' + if (openBrackets > 0 || closeBrackets > 0) { + if (errorMessageElement) { + if (openBrackets > closeBrackets) { + errorMessageElement.textContent = "Error: Brackets are not closed."; + errorMessageElement.style.color = "red"; + } else if (openBrackets < closeBrackets) { + errorMessageElement.textContent = "Warning: Different amounts of [ and ] are used."; + errorMessageElement.style.color = "orange"; + } else { + errorMessageElement.textContent = ""; + errorMessageElement.style.color = "black"; + } + } + } else { + // Если скобки с '$' не найдены, очищаем сообщение об ошибке + if (errorMessageElement) { + errorMessageElement.textContent = ""; + errorMessageElement.style.color = "black"; + } + } +} - if (errorMessageElement) { - if (openBrackets > closeBrackets) { - errorMessageElement.textContent = "Error: Brackets are not closed.."; - errorMessageElement.style.color = "red"; - } else if (openBrackets < closeBrackets) { - errorMessageElement.textContent = "Warning: Different amounts of [ and ] are used"; - errorMessageElement.style.color = "orange"; - } else { - errorMessageElement.textContent = ""; - errorMessageElement.style.color = "black"; - } - } -} function toggleHighlight() { From d83eccb27d152bcc1f468d34df754ca9e9c8267f Mon Sep 17 00:00:00 2001 From: RainbowKey <113303649+Rainb0wKey@users.noreply.github.com> Date: Sat, 16 Aug 2025 11:44:25 +0300 Subject: [PATCH 0061/1179] Update editor.md --- src/tools/editor.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/tools/editor.md b/src/tools/editor.md index dd2ed9c02a1..83ecc1883dd 100644 --- a/src/tools/editor.md +++ b/src/tools/editor.md @@ -1,4 +1,4 @@ -# Text Editor 10:19 last update +# Text Editor 11:44 last update Here you can use the basic editor features to write codes more conveniently.Lines: 0
Characters: 0
Bytes: 0
+[0
]0
Escaped Characters: 0
+Special Characters: 0
Bytes: 0
Name
+ + +**
+*
+`
+Words: 0
Spaces: 0
-Lines: 0
-Characters: 0
+Lines: 0
+Characters: 0
Bytes: 0
-Name
- -текст
+ const codeRegex = /`(.*?)`/g; + highlighted = highlighted.replace(codeRegex, (match, content) => { + return `${content}
`; + }); + + // Преобразование ссылок: автоматически распознает и создает теги + const linkRegex = /(https?:\/\/[^\s]+)/g; + highlighted = highlighted.replace(linkRegex, (url) => { + return `${url}`; + }); + + // Обработка timestamp меток + const timestampRegex = /Results: ${matches}
`; + highlightedTextDiv.innerHTML = resultsString + numberedText; +} + +// Функция для получения относительного времени (например, "5 minutes ago") +function getRelativeTime(date) { + const now = new Date(); + const diffInSeconds = Math.round((now - date) / 1000); + + const intervals = { + 'year': 31536000, + 'month': 2592000, + 'day': 86400, + 'hour': 3600, + 'minute': 60, + 'second': 1 + }; + + for (const interval in intervals) { + const secondsInInterval = intervals[interval]; + const quantity = Math.floor(diffInSeconds / secondsInInterval); + + if (quantity >= 1) { + return quantity + ' ' + interval + (quantity > 1 ? 's' : '') + ' ago'; + } + } + + return 'Just now'; +} + +function copyText() { + const textarea = document.getElementById("editor"); + textarea.select(); + + try { + document.execCommand("copy"); + } catch (err) { + console.error("Unable to copy text: ", err); + } + + window.getSelection().removeAllRanges(); +} + +function saveFile() { + const fileName = document.getElementById('name').value; + const finalFileName = fileName || "bdfdwikieditor"; + const fileContent = document.getElementById('editor').value; + + const blob = new Blob([fileContent], { type: 'text/plain' }); + const a = document.createElement('a'); + const url = URL.createObjectURL(blob); + + a.href = url; + a.download = finalFileName + '.txt'; + + document.body.appendChild(a); + a.click(); + document.body.removeChild(a); + + URL.revokeObjectURL(url); } - -function toggleHighlight() { - const highlightedTextDiv = document.getElementById("highlightedText"); - const text = document.getElementById("editor").value; - const searchText = document.getElementById("searchText").value; - let highlighted = text; - let matches = 0; - - // Подсветка по поисковому запросу - if (searchText) { - const escapedSearchText = searchText.replace(/[.*+?^${}()|[\]\\]/g, '\\$&'); - const regex = new RegExp(escapedSearchText, 'gi'); - - highlighted = text.replace(regex, (match) => { - matches++; - return `${match}`; - }); - } - - // Подсветка <@…> и <#…>, убираем скобки - const mentionRegex = /<@(.*?)>/g; - highlighted = highlighted.replace(mentionRegex, (match, content) => { - return `@${content}`; - }); - - const channelRegex = /<#(.*?)>/g; - highlighted = highlighted.replace(channelRegex, (match, content) => { - return `#${content}`; - }); - - // Обработка жирного текста: **текст** -> текст - const boldRegex = /\*\*(.*?)\*\*/g; - highlighted = highlighted.replace(boldRegex, (match, content) => { - return `${content}`; - }); - - // Обработка курсива: *текст* -> текст - const italicRegex = /\*(.*?)\*/g; - highlighted = highlighted.replace(italicRegex, (match, content) => { - return `${content}`; - }); - - // Обработка кода: `текст` ->текст
- const codeRegex = /`(.*?)`/g; - highlighted = highlighted.replace(codeRegex, (match, content) => { - return `${content}
`; - }); - - // Преобразование ссылок: автоматически распознает и создает теги - const linkRegex = /(https?:\/\/[^\s]+)/g; - highlighted = highlighted.replace(linkRegex, (url) => { - return `${url}`; - }); - - // Обработка timestamp меток - const timestampRegex = /Results: ${matches}
`; - highlightedTextDiv.innerHTML = resultsString + numberedText; -} - -// Функция для получения относительного времени (например, "5 minutes ago") -function getRelativeTime(date) { - const now = new Date(); - const diffInSeconds = Math.round((now - date) / 1000); - - const intervals = { - 'year': 31536000, - 'month': 2592000, - 'day': 86400, - 'hour': 3600, - 'minute': 60, - 'second': 1 - }; - - for (const interval in intervals) { - const secondsInInterval = intervals[interval]; - const quantity = Math.floor(diffInSeconds / secondsInInterval); - - if (quantity >= 1) { - return quantity + ' ' + interval + (quantity > 1 ? 's' : '') + ' ago'; - } - } - - return 'Just now'; -} - -function copyText() { - const textarea = document.getElementById("editor"); - textarea.select(); - - try { - document.execCommand("copy"); - } catch (err) { - console.error("Unable to copy text: ", err); - } - - window.getSelection().removeAllRanges(); -} - -function saveFile() { - const fileName = document.getElementById('name').value; - const finalFileName = fileName || "bdfdwikieditor"; - const fileContent = document.getElementById('editor').value; - - const blob = new Blob([fileContent], { type: 'text/plain' }); - const a = document.createElement('a'); - const url = URL.createObjectURL(blob); - - a.href = url; - a.download = finalFileName + '.txt'; - - document.body.appendChild(a); - a.click(); - document.body.removeChild(a); - - URL.revokeObjectURL(url); -} \ No newline at end of file From f2f35b3aba712b529163db3e13e5d56d921500ee Mon Sep 17 00:00:00 2001 From: RainbowKey <113303649+Rainb0wKey@users.noreply.github.com> Date: Tue, 19 Aug 2025 20:06:51 +0300 Subject: [PATCH 0096/1179] Update chrome.css --- src/theme/css/chrome.css | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/theme/css/chrome.css b/src/theme/css/chrome.css index f475f131dc9..df5fc849a3f 100644 --- a/src/theme/css/chrome.css +++ b/src/theme/css/chrome.css @@ -1237,3 +1237,7 @@ ul#searchresults span.teaser em { transition: 0.2s; } +#error-message { + display: block !important; + text-align: center; +} From 4736e99239696d25a4b9b15a5b51bb515f48e6b8 Mon Sep 17 00:00:00 2001 From: RainbowKey <113303649+Rainb0wKey@users.noreply.github.com> Date: Tue, 19 Aug 2025 20:28:50 +0300 Subject: [PATCH 0097/1179] Update chrome.css --- src/theme/css/chrome.css | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/theme/css/chrome.css b/src/theme/css/chrome.css index df5fc849a3f..399ea8123f5 100644 --- a/src/theme/css/chrome.css +++ b/src/theme/css/chrome.css @@ -1215,8 +1215,8 @@ ul#searchresults span.teaser em { .scriptdiv button { position: absolute; - top: 0; - right: 0; + top: .3rem; + right: .3rem; user-select: none; -webkit-user-select: none; touch-action: manipulation; @@ -1241,3 +1241,4 @@ ul#searchresults span.teaser em { display: block !important; text-align: center; } + From 08524fd281cc7cf230c4422108d8f09177a296a3 Mon Sep 17 00:00:00 2001 From: RainbowKey <113303649+Rainb0wKey@users.noreply.github.com> Date: Wed, 20 Aug 2025 12:14:26 +0300 Subject: [PATCH 0098/1179] Update chrome.css --- src/theme/css/chrome.css | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/src/theme/css/chrome.css b/src/theme/css/chrome.css index 399ea8123f5..b8d45264c87 100644 --- a/src/theme/css/chrome.css +++ b/src/theme/css/chrome.css @@ -1188,15 +1188,19 @@ ul#searchresults span.teaser em { display: inline-block; } - .close-btn { - background-color: hsl(0deg 0% 100% / 10%); + transition: .3s; color: hsl(0deg 0% 100% / 75%); ! important; padding: 1px 7px; + border-color: hsl(0deg 0% 100% / 15%); width: 25px; - cursor: pointer; border-radius: 60px; - border-color: hsl(0deg 0% 100% / 15%); + cursor: pointer; +} + +.close-btn:hover { + transition: .3s; + background-color: hsl(0deg 0% 100% / 10%); border-style: solid; border-width: 1px; } @@ -1242,3 +1246,4 @@ ul#searchresults span.teaser em { text-align: center; } + From 05eb5aa5448ca3658b41f61f3a7c70e472437b0b Mon Sep 17 00:00:00 2001 From: RainbowKey <113303649+Rainb0wKey@users.noreply.github.com> Date: Wed, 20 Aug 2025 12:15:14 +0300 Subject: [PATCH 0099/1179] Update editor.md --- src/tools/editor.md | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/tools/editor.md b/src/tools/editor.md index d15e58a4767..fb1cfcf44a9 100644 --- a/src/tools/editor.md +++ b/src/tools/editor.md @@ -20,6 +20,13 @@ Here you can use the basic editor features to write codes more conveniently.[0
+]0
+Escaped Characters: 0
+Special Characters: 0
+[0
-]0
-Escaped Characters: 0
-Special Characters: 0
-Name
- +Name
+ +Name
- -Name
+Name
текст
+ // Code const codeRegex = /`(.*?)`/g; highlighted = highlighted.replace(codeRegex, (match, content) => { return `${content}
`; }); - // Преобразование ссылок: автоматически распознает и создает теги + // Link const linkRegex = /(https?:\/\/[^\s]+)/g; highlighted = highlighted.replace(linkRegex, (url) => { return `${url}`; }); - // Обработка timestamp меток + // Unixtime const timestampRegex = /Name
- -${content}
`; + + // __ + const underRegex = /__(.*?)__/g; + highlighted = highlighted.replace(underRegex, (match, content) => { + return `${content}`; }); // Link From 3e14cd43ea0735e90796553321324b271003338a Mon Sep 17 00:00:00 2001 From: RainbowKey <113303649+Rainb0wKey@users.noreply.github.com> Date: Sun, 24 Aug 2025 00:04:27 +0300 Subject: [PATCH 0118/1179] Update playground.js --- src/theme/playground.js | 53 +++++++++++++++++++++++------------------ 1 file changed, 30 insertions(+), 23 deletions(-) diff --git a/src/theme/playground.js b/src/theme/playground.js index 62b810855d4..6c441fe4e52 100644 --- a/src/theme/playground.js +++ b/src/theme/playground.js @@ -419,29 +419,36 @@ function toggleHighlight() { highlightedTextDiv.innerHTML = resultsString + numberedText; } -function getRelativeTime(date) { - const now = new Date(); - const diffInSeconds = Math.round((now - date) / 1000); - - const intervals = { - 'year': 31536000, - 'month': 2592000, - 'day': 86400, - 'hour': 3600, - 'minute': 60, - 'second': 1 - }; - - for (const interval in intervals) { - const secondsInInterval = intervals[interval]; - const quantity = Math.floor(diffInSeconds / secondsInInterval); - - if (quantity >= 1) { - return quantity + ' ' + interval + (quantity > 1 ? 's' : '') + ' ago'; - } - } - - return 'Just now'; +function getRelativeTime(date) { + const now = new Date(); + const diffInSeconds = Math.round((date - now) / 1000); + + const intervals = { + 'year': 31536000, + 'month': 2592000, + 'day': 86400, + 'hour': 3600, + 'minute': 60, + 'second': 1 + }; + + const isFuture = diffInSeconds > 0; + + let prefix = isFuture ? 'in ' : ''; + let suffix = isFuture ? '' : ' ago'; + + let absDiffInSeconds = Math.abs(diffInSeconds); + + for (const interval in intervals) { + const secondsInInterval = intervals[interval]; + const quantity = Math.floor(absDiffInSeconds / secondsInInterval); + + if (quantity >= 1) { + return prefix + quantity + ' ' + interval + (quantity > 1 ? 's' : '') + suffix; + } + } + + return isFuture ? 'Soon' : 'Just now'; } function copyText() { From 80a276b5e211591eb85de3959803191fd067fa5d Mon Sep 17 00:00:00 2001 From: RainbowKey <113303649+Rainb0wKey@users.noreply.github.com> Date: Sun, 24 Aug 2025 13:30:50 +0300 Subject: [PATCH 0119/1179] Update chrome.css --- src/theme/css/chrome.css | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/theme/css/chrome.css b/src/theme/css/chrome.css index 94d67c4acc1..8c0566148de 100644 --- a/src/theme/css/chrome.css +++ b/src/theme/css/chrome.css @@ -1266,4 +1266,17 @@ ul#searchresults span.teaser em { border-style: solid; } +#nameScript { + position: relative; +} +#nameScript span { + user-select: none; + -webkit-user-select: none; + position: absolute; + top: 50%; + right: 1.5rem; + transform: translateY(-50%); + color: #888; + font-size: 0.8em; +} From 5b66f910cabfb4136d76333bff730c31a4623669 Mon Sep 17 00:00:00 2001 From: RainbowKey <113303649+Rainb0wKey@users.noreply.github.com> Date: Sun, 24 Aug 2025 13:37:29 +0300 Subject: [PATCH 0120/1179] Update playground.js --- src/theme/playground.js | 294 +++++++++++++++++++--------------------- 1 file changed, 138 insertions(+), 156 deletions(-) diff --git a/src/theme/playground.js b/src/theme/playground.js index 6c441fe4e52..514b5b485af 100644 --- a/src/theme/playground.js +++ b/src/theme/playground.js @@ -220,23 +220,37 @@ function updateStats() { document.getElementById("specialChars").textContent = specialChars; } -function replaceText() { - const searchText = document.getElementById("searchText").value; - const replaceText = document.getElementById("replaceText").value; - const editor = document.getElementById("editor"); - - try { - const regex = new RegExp(searchText, 'g'); - editor.value = editor.value.replace(regex, replaceText); - } catch (e) { - const escapedSearchText = searchText.replace(/[.*+?^${}()|[\]\\]/g, '\\$&'); - editor.value = editor.value.replaceAll(escapedSearchText, replaceText); - } - - updateStats(); - checkBrackets(); -} +function replaceText() { + const searchText = document.getElementById("searchText").value; + const replaceText = document.getElementById("replaceText").value; + const editor = document.getElementById("editor"); + + try { + const regex = new RegExp(searchText, 'g'); + editor.value = editor.value.replace(regex, replaceText); + } catch (e) { + const escapedSearchText = searchText.replace(/[.*+?^${}()|[\]\\]/g, '\\$&'); + editor.value = editor.value.replaceAll(escapedSearchText, replaceText); + } + + updateStats(); + checkBrackets(); +} + +function callError(message, type = 'error') { + const errorMessageElement = document.getElementById("error-message"); + errorMessageElement.style.color = "red"; + + const errorDiv = document.createElement("div"); + errorDiv.style.display = "block"; + if (type === 'warn') { + errorDiv.style.color = "orange"; + } + + errorDiv.innerHTML = `${message} ×`; + errorMessageElement.appendChild(errorDiv); +} function checkBrackets() { const text = document.getElementById("editor").value; @@ -244,14 +258,17 @@ function checkBrackets() { let dollarCount = 0; let openBrackets = 0; let closeBrackets = 0; - const errors = []; + + const errorMessageElement = document.getElementById("error-message"); + errorMessageElement.innerHTML = ""; + errorMessageElement.style.color = "black"; if (textBytes > 65536) { - errors.push({ message: "Error: Text exceeds the allowed size (65536 bytes).", id: errors.length }); + callError("Error: Text exceeds the allowed size (65536 bytes)."); } if (text.indexOf('$') === -1 && text.length > 2000) { - errors.push({ message: "Warning: Character limit exceeded (2000) for messages without functions.", id: errors.length }); + callError("Warning: Character limit exceeded (2000) for messages without functions.", 'warn'); } const lines = text.split('\n'); @@ -265,7 +282,7 @@ function checkBrackets() { } else if (line[j] === '[') { openBrackets++; if (j + 1 < line.length && line[j + 1] === ']') { - errors.push({ message: `Warning: Empty brackets [] detected on line ${i + 1}.`, id: errors.length }); + callError(`Warning: Empty brackets [] detected on line ${i + 1}.`, 'warn'); } } else if (line[j] === ']' && (j === 0 || line[j - 1] !== '\\')) { closeBrackets++; @@ -276,52 +293,13 @@ function checkBrackets() { document.getElementById("openCount").textContent = openBrackets; document.getElementById("closeCount").textContent = closeBrackets; - const errorMessageElement = document.getElementById("error-message"); - errorMessageElement.innerHTML = ""; - if (openBrackets <= dollarCount) { if (closeBrackets < openBrackets) { - errors.push({ message: "Error: Not all open brackets are closed.", id: errors.length }); + callError("Error: Not all open brackets are closed."); } } - - if (errors.length > 0) { - errorMessageElement.style.color = "red"; - - errors.forEach(error => { - const errorDiv = document.createElement("div"); - errorDiv.style.display = "block"; - - if (error.message.includes("Warning:")) { - errorDiv.style.color = "orange"; - } - - errorDiv.innerHTML = `${error.message} ×`; - errorMessageElement.appendChild(errorDiv); - }); - - errorMessageElement.addEventListener("click", function(event) { - if (event.target.classList.contains("close-btn")) { - const errorDiv = event.target.parentNode; - errorDiv.remove(); - } - }); - - if (errors.length > 3) { - const closeAllButton = document.createElement("button"); - closeAllButton.textContent = "Close All"; - closeAllButton.addEventListener("click", function() { - errorMessageElement.innerHTML = ""; - }); - errorMessageElement.appendChild(closeAllButton); - } - } else { - errorMessageElement.textContent = ""; - errorMessageElement.style.color = "black"; - } } - function toggleHighlight() { const highlightedTextDiv = document.getElementById("highlightedText"); const text = document.getElementById("editor").value; @@ -329,23 +307,23 @@ function toggleHighlight() { let highlighted = text; let matches = 0; - if (searchText) { - try { - const regex = new RegExp(searchText, 'gi'); - - highlighted = text.replace(regex, (match) => { - matches++; - return `${match}`; - }); - } catch (e) { - const escapedSearchText = searchText.replace(/[.*+?^${}()|[\]\\]/g, '\\$&'); - const regex = new RegExp(escapedSearchText, 'gi'); - - highlighted = text.replace(regex, (match) => { - matches++; - return `${match}`; - }); - } + if (searchText) { + try { + const regex = new RegExp(searchText, 'gi'); + + highlighted = text.replace(regex, (match) => { + matches++; + return `${match}`; + }); + } catch (e) { + const escapedSearchText = searchText.replace(/[.*+?^${}()|[\]\\]/g, '\\$&'); + const regex = new RegExp(escapedSearchText, 'gi'); + + highlighted = text.replace(regex, (match) => { + matches++; + return `${match}`; + }); + } } // Channel & User mentions @@ -369,18 +347,18 @@ function toggleHighlight() { const italicRegex = /\*(.*?)\*/g; highlighted = highlighted.replace(italicRegex, (match, content) => { return `${content}`; - }); - - // ~~ - const delRegex = /~~(.*?)~~/g; - highlighted = highlighted.replace(delRegex, (match, content) => { - return `Name