From b388079da6e879cec48ca876f1bfa9990b2f37be Mon Sep 17 00:00:00 2001 From: Maxim Slipenko Date: Thu, 5 Jan 2023 22:09:16 +0300 Subject: [PATCH] =?UTF-8?q?=D0=B4=D0=BE=D0=B1=D0=B0=D0=B2=D0=BB=D1=8F?= =?UTF-8?q?=D0=B5=D1=82=20=D1=84=D0=B0=D0=B9=D0=BB=D1=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- LICENSE | 2 +- manifest.json | 15 +++++++++++++++ script.js | 48 ++++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 64 insertions(+), 1 deletion(-) create mode 100644 manifest.json create mode 100644 script.js diff --git a/LICENSE b/LICENSE index 2071b23..2fefe8b 100644 --- a/LICENSE +++ b/LICENSE @@ -1,6 +1,6 @@ MIT License -Copyright (c) +Copyright (c) 2023 Maxim Slipenko Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: diff --git a/manifest.json b/manifest.json new file mode 100644 index 0000000..366d6fa --- /dev/null +++ b/manifest.json @@ -0,0 +1,15 @@ +{ + "name": "VK Messages Tooltip", + "version": "1.2", + "manifest_version": 3, + "content_scripts": [ + { + "js": [ + "script.js" + ], + "matches": [ + "https://vk.com/im*" + ] + } + ] +} \ No newline at end of file diff --git a/script.js b/script.js new file mode 100644 index 0000000..f0a4ba6 --- /dev/null +++ b/script.js @@ -0,0 +1,48 @@ +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'); +css.id = "my-custom-super-id" +css.appendChild(document.createTextNode(styles)); +document.getElementsByTagName("body")[0].appendChild(css); \ No newline at end of file