🏠 返回首頁 

Greasy Fork is available in English.

Отключение безопасного просмотра ВК

Добавляет кнопку для отключения безопасного поиска видео = можно искать порно

// ==UserScript==
// @name         Отключение безопасного просмотра ВК
// @version      1.3
// @description  Добавляет кнопку для отключения безопасного поиска видео = можно искать порно
// @author       awaw
// @match        https://vk.com/*
// @grant        none
// @license      MIT
// @namespace awaw
// ==/UserScript==
(function() {
'use strict';
function addButton() {
if (window.location.href.includes('/video') && !document.querySelector('#notsafeButton')) {
const button = document.createElement('button');
button.id = 'notsafeButton';
button.innerText = 'Вкл 18+';
button.style.position = 'fixed';
button.style.top = '6px';
button.style.right = '6px';
button.style.padding = '6px';
button.style.color = 'white';
button.style.border = 'none';
button.style.borderRadius = '6px';
button.style.cursor = 'pointer';
button.style.zIndex = '9999';
document.body.appendChild(button);
button.addEventListener('click', function() {
let currentUrl = window.location.href;
if (currentUrl.includes('?')) {
currentUrl += '&notsafe=1';
} else {
currentUrl += '?notsafe=1';
}
window.location.href = currentUrl;
});
}
}
function removeButton() {
const button = document.querySelector('#notsafeButton');
if (button) {
button.remove();
}
}
function checkPage() {
if (window.location.href.includes('/video')) {
addButton();
} else {
removeButton();
}
}
checkPage();
const observer = new MutationObserver(() => {
checkPage();
});
observer.observe(document.body, { childList: true, subtree: true });
})();