chat ui fix f
This commit is contained in:
@@ -349,18 +349,6 @@
|
|||||||
stroke: currentColor !important;
|
stroke: currentColor !important;
|
||||||
}
|
}
|
||||||
|
|
||||||
html:not(.politictalk-direct-access-blocked) .politictalk-chat-recipient-control,
|
|
||||||
html:not(.politictalk-direct-access-blocked) .politictalk-chat-recipient-control *,
|
|
||||||
html:not(.politictalk-direct-access-blocked) [data-politictalk-chat-recipient],
|
|
||||||
html:not(.politictalk-direct-access-blocked) [data-politictalk-chat-recipient] *,
|
|
||||||
html:not(.politictalk-direct-access-blocked) #chat-recipient-selector,
|
|
||||||
html:not(.politictalk-direct-access-blocked) #chat-recipient-selector *,
|
|
||||||
html:not(.politictalk-direct-access-blocked) [data-testid*="recipient" i],
|
|
||||||
html:not(.politictalk-direct-access-blocked) [data-testid*="recipient" i] * {
|
|
||||||
color: #ffffff !important;
|
|
||||||
fill: currentColor !important;
|
|
||||||
stroke: currentColor !important;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
html.politictalk-direct-access-blocked,
|
html.politictalk-direct-access-blocked,
|
||||||
@@ -829,120 +817,6 @@
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function isChatRecipientControl(element) {
|
|
||||||
var label = [
|
|
||||||
element.getAttribute('aria-label'),
|
|
||||||
element.getAttribute('title'),
|
|
||||||
element.textContent
|
|
||||||
].join(' ').replace(/\s+/g, ' ').trim().toLowerCase();
|
|
||||||
|
|
||||||
return label.indexOf('everyone') !== -1
|
|
||||||
|| label.indexOf('alle') !== -1
|
|
||||||
|| label.indexOf('الجميع') !== -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
function markChatRecipientElement(element) {
|
|
||||||
if (!element || element.nodeType !== 1) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
element.classList.add('politictalk-chat-recipient-control');
|
|
||||||
element.setAttribute('data-politictalk-chat-recipient', 'true');
|
|
||||||
|
|
||||||
var icons = element.querySelectorAll('svg, path');
|
|
||||||
|
|
||||||
icons.forEach(function(icon) {
|
|
||||||
icon.style.color = '#ffffff';
|
|
||||||
icon.style.fill = 'currentColor';
|
|
||||||
icon.style.stroke = 'currentColor';
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
function markChatRecipientTextNode(textNode) {
|
|
||||||
var element = textNode && textNode.parentElement;
|
|
||||||
var depth = 0;
|
|
||||||
|
|
||||||
while (element && depth < 5) {
|
|
||||||
var text = (element.textContent || '').replace(/\s+/g, ' ').trim();
|
|
||||||
|
|
||||||
if (text.length > 0 && text.length <= 60 && isChatRecipientControl(element)) {
|
|
||||||
markChatRecipientElement(element);
|
|
||||||
}
|
|
||||||
|
|
||||||
element = element.parentElement;
|
|
||||||
depth += 1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function markChatRecipientLabels() {
|
|
||||||
var roots = document.querySelectorAll('#sideToolbarContainer, .sideToolbarContainer, .chat-panel, .chat-panel-container, .chat-container, [class*="chatPanel"]');
|
|
||||||
|
|
||||||
roots.forEach(function(root) {
|
|
||||||
var walker = document.createTreeWalker(root, NodeFilter.SHOW_TEXT, {
|
|
||||||
acceptNode: function(node) {
|
|
||||||
var text = (node.nodeValue || '').replace(/\s+/g, ' ').trim().toLowerCase();
|
|
||||||
|
|
||||||
if (!text || text.length > 60) {
|
|
||||||
return NodeFilter.FILTER_REJECT;
|
|
||||||
}
|
|
||||||
|
|
||||||
return text.indexOf('everyone') !== -1
|
|
||||||
|| text.indexOf('alle') !== -1
|
|
||||||
|| text.indexOf('الجميع') !== -1
|
|
||||||
? NodeFilter.FILTER_ACCEPT
|
|
||||||
: NodeFilter.FILTER_REJECT;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
var node = walker.nextNode();
|
|
||||||
|
|
||||||
while (node) {
|
|
||||||
markChatRecipientTextNode(node);
|
|
||||||
node = walker.nextNode();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
function markChatRecipientControls() {
|
|
||||||
if (!document.body) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
var controls = document.querySelectorAll('button, [role="button"], [aria-haspopup], [data-testid*="recipient" i], #chat-recipient-selector');
|
|
||||||
|
|
||||||
controls.forEach(function(control) {
|
|
||||||
if (!isChatRecipientControl(control)) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
markChatRecipientElement(control);
|
|
||||||
});
|
|
||||||
|
|
||||||
markChatRecipientLabels();
|
|
||||||
}
|
|
||||||
|
|
||||||
function mountChatRecipientStyling() {
|
|
||||||
if (!document.body) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
markChatRecipientControls();
|
|
||||||
|
|
||||||
if (window.politicTalkChatRecipientObserver) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
window.politicTalkChatRecipientObserver = new MutationObserver(function() {
|
|
||||||
window.requestAnimationFrame(markChatRecipientControls);
|
|
||||||
});
|
|
||||||
window.politicTalkChatRecipientObserver.observe(document.body, {
|
|
||||||
attributes: true,
|
|
||||||
attributeFilter: [ 'aria-label', 'title', 'class' ],
|
|
||||||
childList: true,
|
|
||||||
characterData: true,
|
|
||||||
subtree: true
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
function mountPoliticTalkLogo() {
|
function mountPoliticTalkLogo() {
|
||||||
if (!document.body || document.getElementById('politictalk-room-logo')) {
|
if (!document.body || document.getElementById('politictalk-room-logo')) {
|
||||||
return;
|
return;
|
||||||
@@ -1019,14 +893,12 @@
|
|||||||
mountPoliticTalkLogo();
|
mountPoliticTalkLogo();
|
||||||
mountDirectAccessMessage();
|
mountDirectAccessMessage();
|
||||||
mountHostHangupPolicy();
|
mountHostHangupPolicy();
|
||||||
mountChatRecipientStyling();
|
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
mountPoliticTalkDocumentTitle();
|
mountPoliticTalkDocumentTitle();
|
||||||
mountPoliticTalkLogo();
|
mountPoliticTalkLogo();
|
||||||
mountDirectAccessMessage();
|
mountDirectAccessMessage();
|
||||||
mountHostHangupPolicy();
|
mountHostHangupPolicy();
|
||||||
mountChatRecipientStyling();
|
|
||||||
}
|
}
|
||||||
}());
|
}());
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
Reference in New Issue
Block a user