// ==UserScript== // @name Headlapse // @name:ru Шапкозакрывательство // @description Hide topic head with spoiler on all pages except first // @description:ru Каждой шапке по шапке! /Свернуть шапки тем под спойлер на всех страницах темы, кроме первой/ // @version 0.0.6 (mod 17.12.2019) // @date 23.12.2017 // @author Halibut // @include http*://forum.ru-board.com/topic.cgi?forum=* // ==/UserScript== if ((!/^https?:\/\/forum\.ru-board\.com\/topic\.cgi\?forum=\d+&topic=\d+(#\d+|#lt|&start=0|&start=0#lt)?$/.test(location.href)) &&(!/^https?:\/\/forum\.ru-board\.com\/topic\.cgi\?forum=\d+&topic=\d+&start=0&limit=\d?&m=\d?#\d$/.test(location.href)) &&(!/^https?:\/\/forum\.ru-board\.com\/topic\.cgi\?forum=\d+&bm=\d?&topic=\d+(#\d+|#lt|&start=0|&start=0#lt)?$/.test(location.href)) &&(!/^https?:\/\/forum\.ru-board\.com\/topic\.cgi\?forum=\d+&active=\d?&topic=\d+(#\d+|#lt|&start=0|&start=0#lt)?$/.test(location.href))) window.addEventListener('DOMContentLoaded', function headlapse() { "use strict"; this.removeEventListener('DOMContentLoaded', headlapse); var tpcHead = document.getElementsByClassName('tb')[0]; if (!tpcHead || tpcHead && !tpcHead.querySelector('a.tpc[href$="&postno=1"]')) return; tpcHead.hidden = true; var dummyNode = tpcHead.parentNode.insertBefore(document.createElement('div'), tpcHead), show = '\u25BA Показать шапку темы', hide = '\u25BC Скрыть шапку темы'; dummyNode.outerHTML = '<table width="95%" cellspacing="1" cellpadding="3" bgcolor="#999999" align="center" border="0"><tbody><tr><td valign="middle" bgcolor="#dddddd" align="left"></td></tr></tbody></table>'; var spoilerHead = tpcHead.previousElementSibling, spTitle = spoilerHead.getElementsByTagName('td')[0]; spoilerHead.style.cssText = '-moz-user-select: none !important;-webkit-user-select: none !important; -ms-user-select: none !important; user-select: none !important; cursor: pointer !important'; spTitle.textContent = show; spoilerHead.onclick = function(e) { if (e.button != 0) return; e.preventDefault(); e.stopPropagation(); e.stopImmediatePropagation(); tpcHead.hidden = !tpcHead.hidden; spTitle.textContent = tpcHead.hidden ? show : hide; }; }); |