正文
增加 51 行删除 35 行
12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758## 前言在洛谷私信发一大段消息的时候,由于无法自动聚焦输入框,经常要点击,极大地影响了我们水谷的速度,所以做了这个插件(本插件简称 `lgcb`,来源于名称缩写。## 效果图## 使用左键点击消息会弹出菜单,有复制和回复消息功能。给出正确的图片 `Markdown` 可以在私信中显示图片。其他大部分为样式优化。## 设置整个脚本最前端,有一块代码(已经标识出)。你可以修改参数的值来实现不同的效果。| 配置项 | 类型 | 默认值 | 作用 ||--------|------|--------|------|| `enableOwnColor` | bool | `true` | 是否启用自己消息的颜色修改 || `ownBgColor` | string | `"#d9f0ff"` | 自己消息气泡的背景色 || `ownTextColor` | string | `"#000000"` | 自己消息的文字颜色 || `enableOwnRadius` | bool | `true` | 是否为自己消息应用圆角化 || `enableOtherColor` | bool | `false` | 是否启用对方消息的颜色修改 || `otherBgColor` | string | `""`(洛谷默认) | 对方消息气泡的背景色 || `otherTextColor` | string | `""`(洛谷默认) | 对方消息的文字颜色 || `enableOtherRadius` | bool | `true` | 是否为对方消息应用圆角 || `enableQuoteReply` | bool | `true` | 是否启用消息点击弹出菜单功能 || `quoteSeparator` | string | `" \|\|"` | 引用时插入到输入框前的分隔符 |## 安装你可以通过下面的方法安装:1. https://mine.xo.je/Forever_Rain/lgcb.user.js2. https://www.luogu.com.cn/paste/nm978jz9 (备用):::info[MIT License]{open}Luogu Chat BetterCopyright 2026 Forever_RainPermission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.:::1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374# Luogu-Chat-Better## IntroductionLuogu Chat Better! is a userscript designed to improve the messaging experience.When sending messages, users may need to manually click the input box to focus it. This script solves this problem by automatically focusing the chat input box when appropriate, making conversations smoother and more convenient.The script is abbreviated as `LGCB`, derived from the initials of its name.## Features- **Automatic Input Focus**:Automatically focuses the chat input box when the chat page loads, when a chat input box appears, and after sending a message.- **Quote Reply**: Left-clicking a message opens a menu with quote and copy options. Quoting converts the message content into MarkDown and inserts it into the chat input box.- **Message Copying**: Quickly copies the text content of a message.- **Image Display**: Supports displaying images in private chats when they are written using valid Markdown image syntax.- **Message Styling**: Customizes message bubble colors, text colors, and rounded corners.## Screenshot## DownloadGo to [releases](https://github.com/Kevin20121107/Luogu-Chat-Better/releases) to download the newest version.## Usage1. Open the Luogu private chat page.2. Select a conversation and start messaging.3. The input box will automatically receive focus when appropriate.4. Left-click a message to open the action menu:- **Quote**: Inserts the message as a Markdown quote into the input box.- **Copy**: Copies the message's text content.5. To display images, use Markdown image syntax:```markdown```## SettingsAt the beginning of the script, you can find the `CONFIG` object. Modify its values to customize the plugin's behavior.| Configuration Item | Type | Default Value | Description || --- | --- | --- | --- || `enableOwnColor` | `boolean` | `true` | Whether to customize the background and text colors of your own messages || `ownBgColor` | `string` | `"#d9f0ff"` | Background color of your message bubbles || `ownTextColor` | `string` | `"#000000"` | Text color of your messages || `enableOwnRadius` | `boolean` | `true` | Whether to enable rounded corners for your messages || `enableOtherColor` | `boolean` | `false` | Whether to customize the other person's message colors || `otherBgColor` | `string` | `""` | Background color of the other person's message bubbles || `otherTextColor` | `string` | `""` | Text color of the other person's messages || `enableOtherRadius` | `boolean` | `true` | Whether to enable rounded corners for the other person's messages || `enableQuoteReply` | `boolean` | `true` | Whether to enable the message action menu, including quote and copy || `quoteSeparator` | `string` | `" \|\|"` | Separator inserted before quoted content |### Notes- Color values must use the hexadecimal format `#RRGGBB`.- Setting `enableQuoteReply` to `false` disables the message action menu.- Automatic input focus works independently of the quote and reply settings.## FeedbackThanks for using **Luogu Chat Better!**If you encounter a bug or have a feature request, please create an [Issue](https://github.com/Kevin20121107/Luogu-Chat-Better/issues) on GitHub.Contributions and suggestions are welcome!---Translated to English by ChatGPT.