Created
April 21, 2016 09:46
-
-
Save eserte/4156531b67bc95dccbbd168fcad08e37 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ==UserScript== | |
// @name filter_with_comment | |
// @namespace www.rezic.de | |
// @include http://analysis.cpantesters.org/beforemaintrelease* | |
// @version 1 | |
// @grant none | |
// ==/UserScript== | |
var filtered = false; | |
var t = document.getElementById("beforemaintrelease_main"); | |
if (!t) { | |
alert("Cannot find main table") | |
} else { | |
var btn = document.createElement("button"); | |
btn.innerHTML = 'Hide with comments'; | |
btn.onclick = function() { | |
console.debug("clicked"); | |
var trNodes = t.getElementsByTagName("tr"); | |
console.debug("found " + trNodes.length + " tr nodes"); | |
if (!filtered) { | |
console.debug("currently not filtered"); | |
for(var i = 0; i < trNodes.length; i++) { | |
var trNode = trNodes[i]; | |
var tdNodes = trNode.getElementsByTagName("td"); | |
if (tdNodes[3] && tdNodes[3].innerHTML.match(/\w/)) { | |
trNode.style.visibility = 'collapse'; | |
console.debug("collapse node"); | |
} | |
} | |
} else { | |
for(var i = 0; i < trNodes.length; i++) { | |
var trNode = trNodes[i]; | |
trNode.style.visibility = 'visible'; | |
} | |
} | |
filtered = !filtered; | |
if (filtered) { | |
btn.innerHTML = 'Show with comments'; | |
} else { | |
btn.innerHTML = 'Hide with comments'; | |
} | |
} | |
t.parentNode.insertBefore(btn, t); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This is a greasemonkey script which provides a button to hide/show rows on the beforemaintrelease page without a comment entry. Useful to find CPAN distributions which are possible regression candidates and don't have already a bug report or another comment.