// ==UserScript==
// @name root.cz - show new reports only
// @description Nazory a zpravicky - zobrazeni pouze jeste nezobrazenych prispevku
// @include http://*root.cz/*/nazory/*
// @include http://*root.cz/zpravicky/*/#*
// ==/UserScript==
var opacity = '0.3';
function display(element) {
// pozice
var nodediv1 = 0;
var nodediv2 = 0;
var nodediv3 = 0;
var nodediv = 0;
for (var i = 0; i < element.parentNode.childNodes.length; i++) {
if (element.parentNode.childNodes[i].nodeName.toLowerCase() == 'div') {
nodediv++;
if (nodediv == 1)
nodediv1 = i;
if (nodediv == 2)
nodediv2 = i;
if (nodediv == 3) {
nodediv3 = i;
break;
}
}
}
// zobrazit/skryt
if (element.parentNode.childNodes[nodediv2].style.display == 'none') {
element.parentNode.childNodes[nodediv2].style.setProperty('display', 'block', 'important');
element.parentNode.childNodes[nodediv3].style.setProperty('display', 'block', 'important');
}
else {
element.parentNode.childNodes[nodediv2].style.setProperty('display', 'none', 'important');
element.parentNode.childNodes[nodediv3].style.setProperty('display', 'none', 'important');
}
// style
if (opacity != '')
element.parentNode.childNodes[nodediv1].style.opacity = opacity;
// onclick
element.parentNode.setAttribute('onclick', 'if (this.childNodes[' + nodediv2 + '].style.display == \'none\') { this.childNodes[' + nodediv2 + '].style.setProperty(\'display\', \'block\', \'important\'); this.childNodes[' + nodediv3 + '].style.setProperty(\'display\', \'block\', \'important\'); this.childNodes[' + nodediv1 + '].style.opacity = \'1\'; } else { this.childNodes[' + nodediv2 + '].style.setProperty(\'display\', \'none\', \'important\'); this.childNodes[' + nodediv3 + '].style.setProperty(\'display\', \'none\', \'important\'); this.childNodes[' + nodediv1 + '].style.opacity = \'' + opacity + '\'; }');
}
var divs = document.getElementsByTagName("div");
for (var i = 0; i < divs.length; i++) {
var div = divs.item(i);
if ((div.className == 'text') && (div.parentNode.parentNode.className.indexOf('new') == -1))
display(div);
}
// scrollovani na zacatek
window.scroll(0, 0);