├── icon.png ├── src ├── preload.js ├── main.js ├── renderer.js └── settings │ └── main.html ├── .github └── workflows │ └── upload-to-release.yml ├── README.md ├── manifest.json └── LICENSE /icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hacker-frok/LiteLoaderQQNT-Plugin-Brevity-btn/HEAD/icon.png -------------------------------------------------------------------------------- /src/preload.js: -------------------------------------------------------------------------------- 1 | const { contextBridge, ipcRenderer } = require('electron') 2 | 3 | //on 监听主进程发来的消息 4 | //send 用于向主进程发送消息 5 | //invoke 发起异步调用到主进程,并等待返回结果 6 | contextBridge.exposeInMainWorld('btnBrevity', { 7 | 8 | updateSettings: (callback) => ipcRenderer.on("LiteLoader.btnBrevity.updateSettings", callback), 9 | getSettings: () => ipcRenderer.invoke("LiteLoader.btnBrevity.getSettings"), 10 | setSettings: content => ipcRenderer.invoke("LiteLoader.btnBrevity.setSettings", content), 11 | }) 12 | -------------------------------------------------------------------------------- /.github/workflows/upload-to-release.yml: -------------------------------------------------------------------------------- 1 | name: LiteLoaderQQNT-Plugin-Brevity-btn Release 2 | 3 | on: 4 | push: 5 | branches: 6 | - "main" 7 | tags: 8 | - "v*.*.*" 9 | workflow_dispatch: 10 | 11 | jobs: 12 | pre-release: 13 | name: "Pre Release" 14 | runs-on: "ubuntu-latest" 15 | 16 | steps: 17 | # ... 18 | - name: "Build & test" 19 | run: | 20 | echo "done!" 21 | - uses: "marvinpinto/action-automatic-releases@latest" 22 | with: 23 | repo_token: "${{ secrets.GAYHUB_TOKEN }}" 24 | automatic_release_tag: "test" 25 | prerelease: true 26 | title: "预构建版本" 27 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # LiteLoaderQQNT-Plugin-Brevity-btn 2 | 3 | ### 隐藏QQNT整个侧栏部位,并在顶部添加快速显示/隐藏按钮,带来纯纯的聊天模式 4 | ### 目前仅支持LiteLoaderQQNT1.0.0及以上版本 5 | 6 | 7 | ## 用法 8 | 9 | 1. 安装 [LiteLoaderQQNT](https://github.com/mo-jinran/LiteLoaderQQNT) 本体 10 | 2. 在 LiteLoaderQQNT 插件目录克隆本仓库(或下载仓库源码放入插件目录) 11 | 3. 启动/重启 QQNT 12 | 4. 在右上角会出现图标 13 | 5. 点击开关图标 14 | 15 | ## 截图 16 |  17 | 18 |  19 |  20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /manifest.json: -------------------------------------------------------------------------------- 1 | { 2 | "manifest_version": 4, 3 | "type": "extension", 4 | "name": "QQ纯享模式", 5 | "slug": "brevity-btn", 6 | "description": "完全隐藏QQNT整个左边侧栏部位,并在顶部添加快速显示/隐藏按钮,不用再烦恼左边杂乱的图标了,带来纯纯的聊天模式.", 7 | "version": "1.0.7", 8 | "icon": "./icon.png", 9 | "thumbnail": "./icon.png", 10 | "authors": [ 11 | { 12 | "name": "hacker", 13 | "link": "https://github.com/hacker-frok" 14 | } 15 | ], 16 | "repository": { 17 | "repo": "hacker-frok/LiteLoaderQQNT-Plugin-Brevity-btn", 18 | "branch": "main", 19 | "release": { 20 | "tag": "1.0.7" 21 | } 22 | }, 23 | "platform": [ 24 | "win32", 25 | "linux", 26 | "darwin" 27 | ], 28 | "injects": { 29 | "renderer": "./src/renderer.js", 30 | "main": "./src/main.js", 31 | "preload": "./src/preload.js" 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2023 wintrue 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /src/main.js: -------------------------------------------------------------------------------- 1 | 2 | const { BrowserWindow, ipcMain, webContents } = require('electron') 3 | const fs = require('fs') 4 | const path = require('path') 5 | 6 | let mainWindow 7 | const pluginDataPath = LiteLoader.plugins["brevity-btn"].path.data; 8 | const settingsPath = path.join(pluginDataPath, "settings.json"); 9 | function log(...args) { 10 | console.log(`\x1b[31m[QQ纯享模式]\x1b[0m`, ...args); 11 | } 12 | // fs判断插件路径是否存在,如果不存在则创建(同时创建父目录(如果不存在的话)) 13 | if (!fs.existsSync(pluginDataPath)) { 14 | fs.mkdirSync(pluginDataPath, { recursive: true }); 15 | } 16 | // 判断settings.json是否存在,如果不存在则创建 17 | const defaultIcon = '' 18 | if (!fs.existsSync(settingsPath)) { 19 | fs.writeFileSync(settingsPath, JSON.stringify({ 20 | "mini": false, 21 | "icon": defaultIcon, 22 | })); 23 | } else { 24 | const data = fs.readFileSync(settingsPath, "utf-8"); 25 | const config = JSON.parse(data); 26 | if (config.mini == undefined || config.mini == null) { 27 | config.mini = false; 28 | } 29 | if (config.icon) { 30 | config.icon = defaultIcon 31 | } 32 | 33 | } 34 | ipcMain.handle( 35 | "LiteLoader.btnBrevity.getSettings", 36 | (event, message) => { 37 | try { 38 | const data = fs.readFileSync(settingsPath, "utf-8"); 39 | const config = JSON.parse(data); 40 | return config; 41 | } catch (error) { 42 | log(error); 43 | return {}; 44 | } 45 | } 46 | ); 47 | 48 | ipcMain.handle( 49 | "LiteLoader.btnBrevity.setSettings", 50 | (event, content) => { 51 | try { 52 | const new_config = JSON.stringify(content); 53 | fs.writeFileSync(settingsPath, new_config, "utf-8"); 54 | 55 | if (mainWindow) { 56 | mainWindow.webContents.send( 57 | "LiteLoader.btnBrevity.updateSettings", 58 | content 59 | ); 60 | } else { 61 | webContents.getAllWebContents().forEach((webContent) => { 62 | webContent.send( 63 | "LiteLoader.btnBrevity.updateSettings", 64 | content 65 | ); 66 | }); 67 | } 68 | 69 | 70 | } catch (error) { 71 | log(error); 72 | } 73 | } 74 | ); 75 | 76 | // 防抖函数 77 | function debounce(fn, time) { 78 | let timer = null; 79 | return function (...args) { 80 | timer && clearTimeout(timer); 81 | timer = setTimeout(() => { 82 | fn.apply(this, args); 83 | }, time); 84 | } 85 | } 86 | 87 | 88 | // 创建窗口时触发 89 | exports.onBrowserWindowCreated = (window) => { 90 | window.webContents.on("did-stop-loading", () => { 91 | if (window.webContents.getURL().indexOf("#/main/message") !== -1) { 92 | mainWindow = window; 93 | } 94 | }); 95 | 96 | } 97 | -------------------------------------------------------------------------------- /src/renderer.js: -------------------------------------------------------------------------------- 1 | const plugin_path = LiteLoader.plugins["brevity-btn"].path.plugin; 2 | function log(...args) { 3 | console.log(`\x1b[31m[QQ纯享模式]\x1b[0m`, ...args); 4 | } 5 | let settingsConfig = await btnBrevity.getSettings(); 6 | 7 | let macOSstyle = `right: 12px!important;left: inherit;top: 4px!important;position: fixed;app-region: no-drag;z-index: 99;cursor: pointer;pointer-events: all;right: 12px !important;` 8 | if (LiteLoader.os.platform != "darwin") { 9 | macOSstyle = '' 10 | } 11 | const BTN_HTML = ` 12 |