Skip to content

Commit

Permalink
Merge pull request #664 from XMOJ-Script-dev/boomzero/reply
Browse files Browse the repository at this point in the history
fix reply infinite looping
  • Loading branch information
boomzero authored Aug 8, 2024
2 parents d98e36d + d42647b commit a0723bf
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 6 deletions.
11 changes: 11 additions & 0 deletions Update.json
Original file line number Diff line number Diff line change
Expand Up @@ -2252,6 +2252,17 @@
}
],
"Notes": "No release notes were provided for this release."
},
"1.2.43": {
"UpdateDate": 1723097609941,
"Prerelease": true,
"UpdateContents": [
{
"PR": 664,
"Description": "fix reply infinite looping"
}
],
"Notes": "No release notes were provided for this release."
}
}
}
8 changes: 3 additions & 5 deletions XMOJ.user.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// ==UserScript==
// @name XMOJ
// @version 1.2.42
// @version 1.2.43
// @description XMOJ增强脚本
// @author @XMOJ-Script-dev, @langningchen and the community
// @namespace https://github/langningchen
Expand Down Expand Up @@ -4756,11 +4756,9 @@ int main()
ReplyButton.innerText = "回复";
ReplyButton.addEventListener("click", () => {
let Content = Replies[i].Content;
while (Content.startsWith(">")) {
Content = Content.substring(Content.indexOf("\n") + 1);
}
Content = Content.trim();
Content = Content.split("\n").map((Line) => {
return Line.startsWith(">") ? Line.substring(1).trim() : Line.trim();
}).join("\n").split("\n").map((Line) => {
return "> " + Line;
}).join("\n");
ContentElement.value += Content + `\n\n@${Replies[i].UserID} `;
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "xmoj-script",
"version": "1.2.42",
"version": "1.2.43",
"description": "an improvement script for xmoj.tech",
"main": "AddonScript.js",
"scripts": {
Expand Down

0 comments on commit a0723bf

Please sign in to comment.