This repository has been archived on 2023-08-02. You can view files and clone it, but cannot push or open issues or pull requests.
vk-messages-tooltip/script.js

48 lines
1.3 KiB
JavaScript
Raw Permalink Normal View History

2023-01-05 22:09:16 +03:00
const styles = `
span.nim-dialog--preview._dialog_body {
pointer-events: auto;
}
span.nim-dialog--preview._dialog_body:hover {
background: white;
position: absolute;
white-space: normal;
z-index: 130;
border-radius: 6px;
box-shadow: 0 1px 3px var(--black_alpha12);
color: var(--text_primary);
background: var(--modal_card_background);
border: 1px solid var(--separator_common);
padding: 5px;
transform: translate(-6px, -6px);
}
.nim-dialog--text-preview:has(span.nim-dialog--preview._dialog_body:hover):before {
content: ' ';
display: inline-block;
vertical-align: middle;
height: 100%;
}
.nim-dialog:not(.nim-dialog_deleted):not(.nim-dialog_classic).nim-dialog_selected .nim-dialog--preview._dialog_body:hover {
color: var(--white);
background: var(--dynamic_blue);
}
li.nim-dialog:has(span.nim-dialog--preview._dialog_body:hover) {
pointer-events:none;
}
`
document.addEventListener('click', function(event) {
var t = event.target.closest('li.nim-dialog')
if (t?.querySelector('span.nim-dialog--preview._dialog_body:hover')) {
event.stopPropagation()
}
}, { capture: true })
const css = document.createElement('style');
2023-05-14 00:04:52 +03:00
css.id = "vk-message-tooltip-style"
2023-01-05 22:09:16 +03:00
css.appendChild(document.createTextNode(styles));
document.getElementsByTagName("body")[0].appendChild(css);