NOTICE: By continued use of this site you understand and agree to the binding Terms of Service and Privacy Policy.
// ==UserScript==
// @name No Yawns!
// @namespace http://tampermonkey.net/
// @version v0.3
// @description Блокирует как саму картинку с действием, так и горячие клавиши. Данный мод нелегален, если вы его используете - вы автоматически плохой человек. Распространяется только среди доверенных лиц!
// @author Meltyawn / Трель [1304323]
// @match https://catwar.net/cw3/
// @match https://catwar.su/cw3/
// @icon https://i.postimg.cc/15pwWVyB/11.png
// @license MIT
// @grant none
// ==/UserScript==
(function() {
'use strict';
let blockedActionIndex = null;
let lastFoundIndex = null;
let isBlocked = false;
function ultraFastHide() {
const img = document.querySelector('img[src*="11.png"]');
if (img && !img.hasAttribute('data-blocked-11')) {
img.setAttribute('data-blocked-11', 'true');
img.style.display = 'none';
img.style.visibility = 'hidden';
img.style.opacity = '0';
img.style.width = '0';
img.style.height = '0';
img.style.margin = '0';
img.style.padding = '0';
const parentLink = img.closest('a');
if (parentLink && !parentLink.hasAttribute('data-blocked-11')) {
parentLink.setAttribute('data-blocked-11', 'true');
parentLink.style.display = 'none';
parentLink.style.visibility = 'hidden';
findActionNumber();
}
isBlocked = true;
}
}
function findActionNumber() {
const allActionElements = [];
const containers = ['#deys', '#block_deys', '.actions', '.action-buttons', '.action-container'];
containers.forEach(selector => {
const container = document.querySelector(selector);
if (container) {
const actions = container.querySelectorAll('a, button, [onclick*="action"]');
actions.forEach(el => allActionElements.push(el));
}
});
if (allActionElements.length === 0) {
document.querySelectorAll('a[href*="#"], button, [onclick]').forEach(el => {
if (el.querySelector('img') || el.textContent.trim()) {
allActionElements.push(el);
}
});
}
for (let i = 0; i < allActionElements.length; i++) {
const element = allActionElements[i];
const has11png = element.querySelector('img[src*="11.png"]') ||
element.innerHTML.includes('11.png');
if (has11png) {
blockedActionIndex = i + 1;
return;
}
}
if (lastFoundIndex !== blockedActionIndex) {
blockedActionIndex = null;
}
lastFoundIndex = blockedActionIndex;
}
function setupSmartHotkeyBlocking() {
document.addEventListener('keydown', function(event) {
if (blockedActionIndex === null) {
findActionNumber();
}
if (blockedActionIndex !== null) {
const key = event.key;
if (key >= '1' && key <= '9') {
const pressedNumber = parseInt(key);
if (pressedNumber === blockedActionIndex) {
event.stopPropagation();
event.preventDefault();
event.stopImmediatePropagation();
flashBlockedIndicator();
return false;
}
}
if (key.length === 1 && !isNaN(key) && key !== ' ') {
const pressedNumber = parseInt(key);
if (pressedNumber === blockedActionIndex) {
event.stopPropagation();
event.preventDefault();
event.stopImmediatePropagation();
return false;
}
}
}
}, true);
}
function startEverything() {
ultraFastHide();
setupSmartHotkeyBlocking();
startUltraFastLoop();
}
function startUltraFastLoop() {
let ultraChecks = 0;
const ultraInterval = setInterval(() => {
ultraFastHide();
ultraChecks++;
if (ultraChecks > 50) {
clearInterval(ultraInterval);
const fastInterval = setInterval(() => {
ultraFastHide();
if (Math.random() < 0.1) findActionNumber();
}, 100);
setTimeout(() => {
clearInterval(fastInterval);
}, 30000);
}
}, 10);
}
(function immediateStart() {
startEverything();
if (document.readyState === 'loading') {
document.addEventListener('DOMContentLoaded', startEverything);
}
window.addEventListener('load', () => {
setTimeout(startEverything, 1);
setTimeout(startEverything, 10);
});
})();
const observer = new MutationObserver((mutations) => {
for (const mutation of mutations) {
if (mutation.addedNodes.length > 0) {
setTimeout(ultraFastHide, 0);
}
}
});
observer.observe(document.body, {
childList: true,
subtree: true
});
document.addEventListener('DOMNodeInserted', ultraFastHide, true);
document.addEventListener('DOMSubtreeModified', () => {
setTimeout(ultraFastHide, 0);
}, true);
})();