您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
在发送评论时自动加上【】
当前为
// ==UserScript== // @name 不知道有没有用的同传man辅助 // @namespace http://tampermonkey.net/ // @version 0.2 // @author You // @match https://live.bilibili.com/* // @grant none // @require https://cdn.staticfile.org/jquery/3.4.1/jquery.min.js // @description 在发送评论时自动加上【】 // ==/UserScript== (function () { //debug用 function showVm() { return [document.getElementsByClassName('control-panel-ctnr')[0].__vue__] } function addBraket(){ let comment = window.translatorTool.vm.chatInput.match(/^[ 【]*(.*?)[ 】]*$/i)[1] window.translatorTool.vm.chatInput = '【' + comment + '】' } function removeBraket(){ let comment = window.translatorTool.vm.chatInput.match(/^(.*?)[ 】]*$/i)[1] window.translatorTool.vm.chatInput = comment } // 定义translatortools对象 window.translatorTool = {} window.translatorTool.showVm = showVm window.translatorTool.add = addBraket window.translatorTool.remove = removeBraket // 递归检索评论框存在性 ;(function init() { const el = $('#chat-control-panel-vm textarea') if (el.length > 0) { window.translatorTool.vm = document.getElementsByClassName('control-panel-ctnr')[0].__vue__ // 抬起按键添加括号 el.bind('keyup', function (e) { window.translatorTool.add() }) el.bind('keydown',function(){ // el.setSelectionRange(0,1) window.translatorTool.remove() }) } else { requestAnimationFrame(function () { init() }) } })(); })();