mirror of
https://github.com/anatolykopyl/vk-mute.git
synced 2026-03-26 04:45:15 +00:00
Перешел на domnodeinserted
This commit is contained in:
49
controls.css
Normal file
49
controls.css
Normal file
@@ -0,0 +1,49 @@
|
||||
.mute_message .mutetooltip {
|
||||
visibility: hidden;
|
||||
width: 120px;
|
||||
background-color: #555;
|
||||
color: #fff;
|
||||
text-align: center;
|
||||
padding: 5px 0;
|
||||
border-radius: 6px;
|
||||
|
||||
/* Position the tooltip text */
|
||||
position: absolute;
|
||||
z-index: 1;
|
||||
bottom: 125%;
|
||||
left: 50%;
|
||||
margin-left: -60px;
|
||||
|
||||
/* Fade in tooltip */
|
||||
opacity: 0;
|
||||
transition: opacity 0.3s;
|
||||
}
|
||||
|
||||
/* Tooltip arrow */
|
||||
.mute_message .mutetooltip::after {
|
||||
content: "";
|
||||
position: absolute;
|
||||
top: 100%;
|
||||
left: 50%;
|
||||
margin-left: -5px;
|
||||
border-width: 5px;
|
||||
border-style: solid;
|
||||
border-color: #555 transparent transparent transparent;
|
||||
}
|
||||
|
||||
/* Show the tooltip text when you mouse over the tooltip container */
|
||||
.mute_message:hover .mutetooltip {
|
||||
visibility: visible;
|
||||
opacity: 1;
|
||||
}
|
||||
|
||||
.mute_message {
|
||||
width: 16px;
|
||||
height: 16px;
|
||||
position: relative;
|
||||
display: inline-block;
|
||||
vertical-align: top;
|
||||
background: url('chrome-extension://__MSG_@@extension_id__/mute.png') no-repeat top left;
|
||||
background-repeat: no-repeat;
|
||||
padding: 6px;
|
||||
}
|
||||
10
controls.js
vendored
10
controls.js
vendored
@@ -1,11 +1,12 @@
|
||||
var showMembersBtn = document.getElementsByClassName("_im_chat_members im-page--members")[0];
|
||||
var controlsArea;
|
||||
|
||||
/*
|
||||
function isInt(value) {
|
||||
return !isNaN(value) && (function(x) { return (x | 0) === x; })(parseFloat(value))
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
showMembersBtn.addEventListener('click', function() {
|
||||
var checkExist = setInterval(function() {
|
||||
controlsArea = document.getElementsByClassName("ListItem__aside");
|
||||
@@ -29,7 +30,11 @@ showMembersBtn.addEventListener('click', function() {
|
||||
*/
|
||||
|
||||
function muteBtnHTML(id) {
|
||||
return '<span style="vertical-align:middle;" class="mute_message" id="mute' + id + '">🔇</span>'
|
||||
return `
|
||||
<span class="mute_message" id="mute` + id + `">
|
||||
🔇
|
||||
<span class="mutetooltip">Заглушить</span>
|
||||
</span>`
|
||||
}
|
||||
|
||||
function addControls() {
|
||||
@@ -55,6 +60,7 @@ function addControls() {
|
||||
var clicked_id = event.target.id.substr(event.target.id.length - 9);
|
||||
|
||||
chrome.storage.sync.set({idToHide: clicked_id}, function() {
|
||||
hidePeer(clicked_id);
|
||||
console.log('idToHide: ' + clicked_id);
|
||||
});
|
||||
});
|
||||
|
||||
@@ -18,4 +18,10 @@ function hidePeer(peer) {
|
||||
});
|
||||
}
|
||||
|
||||
var interval = window.setInterval(function(){ hidePeer(idToHide) }, 500);
|
||||
//var interval = window.setInterval(function(){ hidePeer(idToHide) }, 500);
|
||||
|
||||
var chatBody = document.getElementsByClassName("_im_peer_history im-page-chat-contain")[0];
|
||||
|
||||
chatBody.addEventListener('DOMNodeInserted', function() {
|
||||
hidePeer(idToHide);
|
||||
});
|
||||
|
||||
|
Before Width: | Height: | Size: 20 KiB After Width: | Height: | Size: 20 KiB |
|
Before Width: | Height: | Size: 22 KiB After Width: | Height: | Size: 22 KiB |
|
Before Width: | Height: | Size: 5.5 KiB After Width: | Height: | Size: 5.5 KiB |
@@ -1,11 +1,12 @@
|
||||
{
|
||||
"name": "Hide Cringe",
|
||||
"name": "VK Mute",
|
||||
"icons": {
|
||||
"128": "icon128.png",
|
||||
"48": "icon48.png"
|
||||
"140": "icons/icon140.png",
|
||||
"128": "icons/icon128.png",
|
||||
"48": "icons/icon48.png"
|
||||
},
|
||||
"version": "1.0",
|
||||
"description": "Hides cringe",
|
||||
"description": "Позволяет заглушить нежелаемых собеседников",
|
||||
"permissions": ["activeTab", "declarativeContent", "storage"],
|
||||
"background": {
|
||||
"scripts": [
|
||||
@@ -24,7 +25,8 @@
|
||||
},
|
||||
{
|
||||
"matches": ["https://*.vk.com/*"],
|
||||
"js": ["controls.js"]
|
||||
"js": ["controls.js"],
|
||||
"css": ["controls.css"]
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user