diff --git a/controls.css b/controls.css
new file mode 100644
index 0000000..30f6f0f
--- /dev/null
+++ b/controls.css
@@ -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;
+}
\ No newline at end of file
diff --git a/controls.js b/controls.js
index 4416e23..5ade809 100644
--- a/controls.js
+++ b/controls.js
@@ -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 '🔇'
+ return `
+
+ 🔇
+ Заглушить
+ `
}
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);
});
});
diff --git a/hide_element.js b/hide_element.js
index 3523322..9ba35d2 100644
--- a/hide_element.js
+++ b/hide_element.js
@@ -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);
+});
diff --git a/icon128.png b/icons/icon128.png
similarity index 100%
rename from icon128.png
rename to icons/icon128.png
diff --git a/icon140.png b/icons/icon140.png
similarity index 100%
rename from icon140.png
rename to icons/icon140.png
diff --git a/icon48.png b/icons/icon48.png
similarity index 100%
rename from icon48.png
rename to icons/icon48.png
diff --git a/manifest.json b/manifest.json
index db0305b..1ad8f75 100644
--- a/manifest.json
+++ b/manifest.json
@@ -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"]
}
]
}
diff --git a/mute.png b/mute.png
new file mode 100644
index 0000000..b5c14a3
Binary files /dev/null and b/mute.png differ