Last active
May 27, 2022 16:08
-
-
Save SakuraKoi/8c670836dfed4ade1b0a4f9af4358a02 to your computer and use it in GitHub Desktop.
Bilibili直播 弹幕反和谐
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ==UserScript== | |
// @name BiliLive-AntiCensor | |
// @namespace https://www.sakurakooi.cyou/ | |
// @version 0.1 | |
// @description try to take over the world! | |
// @author SakuraKooi | |
// @match https://live.bilibili.com/* | |
// @icon https://www.google.com/s2/favicons?sz=64&domain=bilibili.com | |
// @grant none | |
// ==/UserScript== | |
(function() { | |
'use strict'; | |
window.addEventListener('load', function() { | |
setTimeout(function() { // too lazy to fix this, so just some delay is ok :) | |
let inputBox; | |
inputBox = Array.from(document.getElementsByClassName('chat-input')).filter(element => element.tagName === "TEXTAREA")[0] | |
let container = document.getElementsByClassName("right-action p-absolute live-skin-coloration-area")[0]; | |
let btn = document.createElement('button'); | |
container.insertBefore(btn, container.children[0]); | |
btn.outerHTML = '<button ' + container.children[1].attributes[0].name + ' class="bl-button live-skin-highlight-button-bg live-skin-button-text bl-button--primary bl-button--small" style="min-width: 4em;margin-right: 0.5em; background-color: #ff9800;" id="sakura-fuckwords-btn"><span class="txt" id="sakura-fuckwords-display">反和谐</span></button>'; | |
btn = document.getElementById("sakura-fuckwords-btn"); | |
let display = document.getElementById("sakura-fuckwords-display"); | |
function fuckWords() { | |
let text = inputBox.value; | |
let arr = text.split(""); | |
text = ""; | |
for (let c of arr) { | |
text += c; | |
text += '\u200B'; | |
} | |
inputBox.value = text.substr(0, text.length-1); | |
display.innerText = "好耶喵"; | |
setTimeout(() => display.innerText = "反和谐", 300); | |
} | |
btn.addEventListener("click", fuckWords); | |
}, 2000); | |
}, false); | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment