JSFiddle - React, Tailwind, and code Playground
JavaScript
// ==UserScript==
// @name Opennet Unfold Comments
// @namespace My Scripts
// @match *://*.opennet.ru/*
// @version 1
// @grant none
// ==/UserScript==
window.addEventListener('DOMContentLoaded', unfoldComments);
function unfoldComments() {
const $btn = document.querySelector('#openlnk');
const isUnfoldMode = getCookie('ajaxmode') === '1';
// eslint-disable-next-line no-eval
if (!isUnfoldMode) $btn.click();
}
function getCookie(name) {
const matches = document.cookie.match(
new RegExp(
// eslint-disable-next-line no-useless-escape
`(?:^|; )${name.replace(/([\.$?*|{}\(\)\[\]\\\/\+^])/g, '\\$1')}=([^;]*)`,
),
);
return matches ? decodeURIComponent(matches[1]) : undefined;
}