Last active
August 10, 2018 06:35
-
-
Save NanoAi/404207d0f118f620f3a2c2cc91ec87d2 to your computer and use it in GitHub Desktop.
DiscordModification.js
This file contains hidden or 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
var imageBlur = document.createElement('style'); | |
var headStyle = document.createElement('style'); | |
var imgCSS = ".da-container img,.da-container video{filter:brightness(-1);-webkit-filter:brightness(-1)}" | |
imgCSS += ".da-container img:hover,.da-container video:hover{filter:brightness(1)!important;-webkit-filter:brightness(1)!important}" | |
var injCSS = ".da-messageGroupBlocked{display:none!important;}.emoji-picker .scroller .emoji-item.disabled{opacity:0.2;}"; | |
/* injCSS += ".avatar-large{background-size: 50px 50px;height: 50px;width: 50px;}.emoji.jumboable{height: 48px;width: 48px;}"; */ | |
headStyle.innerHTML = injCSS; | |
Element.prototype.remove = function () { | |
this.parentElement.removeChild(this); | |
} | |
NodeList.prototype.remove = HTMLCollection.prototype.remove = function () { | |
for (var i = this.length - 1; i >= 0; i--) { | |
if (this[i] && this[i].parentElement) { | |
this[i].parentElement.removeChild(this[i]); | |
} | |
} | |
} | |
function BindCustom() { | |
setTimeout(function () { | |
var button; | |
var menu = document.MenuOption; | |
var data = document.ImageCensoring; | |
var context = document.querySelector("[class^=contextMenu]"); | |
if (menu == [] || menu.option == null) { | |
button = (context.querySelector("[class^=itemGroup]")).cloneNode(true); | |
var option = button.querySelector("div:not([class^=itemToggle]").cloneNode(true); | |
var junk = button.querySelectorAll("[class^=item]"); | |
if( junk ){ junk.remove(); } | |
button.appendChild(option); | |
function toggleState() { | |
if (data.state == 0) { | |
data.state = 1; | |
imageBlur.innerHTML = imgCSS; | |
button.querySelector("input[type='checkbox']").checked = true; | |
} else { | |
data.state = 0; | |
imageBlur.innerHTML = ""; | |
button.querySelector("input[type='checkbox']").checked = false; | |
} | |
} | |
if( typeof(data.state) == "undefined" ){ toggleState(); } | |
button.onclick = toggleState; | |
button.span = button.querySelector("[class^=label]"); | |
button.span.textContent = "Image Censoring"; | |
menu.button = button; | |
menu.option = option; | |
} else { | |
button = menu.button; | |
button.appendChild(menu.option); | |
} | |
button.querySelector("input[type='checkbox']").checked = (data.state == 1 && true || false); | |
context.appendChild(button); | |
}, 1) | |
} | |
var checkArea = setInterval(function(){ | |
var textarea = document.getElementsByTagName("textarea")[0]; | |
if (textarea && textarea.oncontextmenu === null) { | |
textarea.oncontextmenu = BindCustom; | |
console.log("Textfield - Bound!"); | |
} | |
},500); | |
function clearMods(){ | |
var textarea = document.getElementsByTagName("textarea")[0]; | |
imageBlur.remove(); | |
headStyle.remove(); | |
textarea.oncontextmenu = null; | |
clearTimeout(checkArea); | |
document.ImageCensoring = null; | |
document.MenuOption = null; | |
checkArea = null; | |
BindCustom = null; | |
injCSS = null; | |
imgCSS = null; | |
headStyle = null; | |
imageBlur = null; | |
console.log("Modifications Cleared!"); | |
} | |
document.body.appendChild(imageBlur); | |
document.head.appendChild(headStyle); | |
document.ImageCensoring = []; | |
document.MenuOption = []; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This should work on Windows, OSX and Linux!
HOW TO USE
clearMods();
in console.PLEASE NOTE
It is highly unlikely that you will get banned or punished in any way for using the code above. However, if something goes wrong and Discord threatens your family by name, or sends a representative to remove your reproductive organs, or if the script has any other undesirable effect. Don't blame the author of this script!
tl;dr Use at your own risk!