// ==UserScript==
// @name Satori embeddage
// @description highlights explicit, amends embedder
// @author szy
// @match https://chat.flashii.net/
// @grant none
// ==/UserScript==
(function() {
'use strict';
function hoverage(ev) {
if (ev.target.dataset['hovered'] != 'yes') {
ev.target.dataset['hovered'] = 'yes';
ev.target.click();
console.log(ev.target);
}
}
window.addEventListener('umi:ui:message_add', function(ev) {
const el = ev.detail.element;
if (!el.classList.contains('message--user-11'))
return;
const text = el.querySelector('.message__text').textContent;
if (!/tako\.zone/.test(text))
return;
const embedButton = el.querySelector('a[onclick^="Umi.Parser.SockChatBBcode.Embed"]');
if (/\(explicit\)/.test(text)) {
el.querySelectorAll('b').forEach(x=>(/explicit/.test(x.textContent)&&(x.style.color="red")));
var code = embedButton.getAttribute('onclick');
embedButton.setAttribute('onclick', '(this.innerText == "Remove" || confirm("warning, nsfw"))&&'+code);
return;
}
embedButton.addEventListener("mousemove", hoverage);
embedButton.innerText = "Hover...";
});
})();
.sidebar {
box-shadow: none !important;
margin: 0 !important;
}
.sidebar__menus {
background: #2b2d31 !important;
margin: 0 !important;
width: 240px !important;
}
.sidebar__selector {
background: #1e1f22 !important;
margin: 0 !important;
width: 72px !important;
}
.sidebar__selector-top, .sidebar__selector-bottom {
padding: 0.3em 0 0.3em 0 !important;
display: flex !important;
flex-flow: column nowrap !important;
align-items: center !important;
}
.sidebar__selector-mode {
margin-bottom: 4px !important;
margin-top: 4px !important;
background-color: #313338 !important;
background-repeat: no-repeat !important;
border-radius: 50% !important;
width: 48px !important;
height: 48px !important;
display: flex !important;
justify-content: center !important;
align-items: center !important;
transition: border-radius 0.3s, background-color 0.2s !important;
}
.sidebar__selector-mode:hover, .sidebar__selector-mode:active {
background-color: #5865f2 !important;
border-radius: 35% !important;
transition: border-radius 0.3s, background-color 0.2s !important;
}
.sidebar__selector-mode:active {
transform: translateY(1px) !important;
}
.chat {
background: #313338 !important;
scrollbar-width: none !important;
margin: 0 !important;
box-shadow: none !important;
padding-bottom: 24px !important;
}
.umi {
background: #313338 !important;
}
.main {
margin: 0 !important;
}
.sidebar__user {
background: #2b2d31 !important;
margin: 2px 8px 2px 8px !important;
}
.sidebar__user-details {
height: 42px !important;
padding: 4px 8px 4px 8px !important;
border-radius: 4px !important;
}
.sidebar__user-details:hover {
background-color: #35373c !important;
}
.sidebar__user-details:hover::after {
content: "" !important;
background-color: #b5bac1 !important;
width: 12px !important;
height: 12px !important;
position: absolute !important;
transform: translateX(-5px) !important;
clip-path: polygon(10% 0%, 0% 10%, 40% 50%, 0% 90%, 10% 100%, 50% 60%, 90% 100%, 100% 90%, 60% 50%, 100% 10%, 90% 0%, 50% 40%) !important;
}
.sidebar__user-details:hover .sidebar__user-avatar::after {
border-color: #35373c !important;
}
.sidebar__user-details:active .sidebar__user-avatar::after {
border-color: #3f4248 !important;
}
.sidebar__user-details:active {
background: #3f4248 !important;
}
.sidebar__user-avatar, .message__avatar {
border-radius: 50% !important;
margin: 0 !important;
}
.sidebar__user-avatar {
width: 32px !important;
height: 32px !important;
}
.message__avatar {
width: 40px !important;
height: 40px !important;
}
.message {
border: none !important;
margin: 0 !important;
padding: 3px 72px 3px 0 !important;
}
.message:hover {
background-color: #2e3035 !important;
}
.message--first {
margin-top: 23px !important;
padding-left: 16px !important;
}
.message--first>.message__container {
transform: translateX(-8px) !important;
}
.message__container {
margin-left: 24px !important;
}
.input__main, .input, .input__menus, .input__text, .input__button {
box-shadow: none !important;
background: #383a40 !important;
border: none !important;
}
.input__button {
background: transparent !important;
}
.input {
margin: 0 !important;
padding: 0 !important;
background: transparent !important;
}
.input__main {
margin: 0 16px 24px 16px !important;
min-height: 44px !important;
height: 44px !important;
border-radius: 8px !important;
}
.input__text {
margin-top: 12px !important;
font-size: 14px !important;
font-family: inherit !important;
}
.sidebar__user-details, .sidebar, .umi {
flex-direction: row-reverse !important;
}
.sidebar__user-name {
padding-left: 0.8em !important;
}
.sidebar__user-avatar::after {
content: "" !important;
width: 10px !important;
height: 10px !important;
position: absolute !important;
border: 3px solid #2b2d31 !important;
border-radius: 50% !important;
transform: translateX(19px) translateY(19px) !important;
background-color: #23a55a !important;
}
.message__text img, video {
border-radius: 10px !important;
}
.input__button {
color: #b5bac1 !important;
}
.input__menus {
max-width: 500px !important;
max-height: 500px !important;
background: transparent !important;
position: fixed !important;
right: 16px !important;
bottom: 76px !important;
}
.input__menus .emoticon {
width: 40px !important;
height: 40px !important;
padding: 0 !important;
margin: 0 !important;
}
.input__menu--active {
background: #2b2d31 !important;
width: 500px !important;
height: 500px !important;
border-radius: 8px;
border: 1px solid #282a2e !important;
display: flex !important;
flex-flow: row wrap !important;
justify-content: center !important;
align-items: center !important;
}
.input__button--upload {
order: -1 !important;
padding: 0 !important;
width: 20px !important;
height: 20px !important;
margin: 12px 18px 12px 18px !important;
display: flex !important;
justify-content: center;
align-items: center;
background-color: #b5bac1 !important;
border-radius: 50% !important;
}
.input__buton--upload:hover {
background: #dbdee1 !important;
}
.input__button--upload::before {
content: "" !important;
width: 10px !important;
height: 10px !important;
background: #383a40 !important;
clip-path: polygon(0% 40%, 40% 40%, 40% 0%, 60% 0%, 60% 40%, 100% 40%, 100% 60%, 60% 60%, 60% 100%, 40% 100%, 40% 60%, 0% 60%) !important;
}
szy I'm pretty sure you have a userscript that adds a button to the input box thing but I don't think you reported Umi.UI.InputMenus.AddButton(id, title, onClick) for backwards compat, is there another way you're using to add that? Would really recommend you switch to that if you're just shoving HTML in/tell me how I can add to the mention method to facilitate what you're missing because the HTML is Gonna change and the IDs will probably get nuked entirely. You'd then have to use Umi.UI.InputMenus.Get(id, true) to retrieve it, they come in pairs!!!
ahh, i thought that was the thing you used for converting the console syntax highlighting to bbcode, but good to know then