Skip to content

Instantly share code, notes, and snippets.

@eserte
Created April 21, 2016 09:46
Show Gist options
  • Save eserte/4156531b67bc95dccbbd168fcad08e37 to your computer and use it in GitHub Desktop.
Save eserte/4156531b67bc95dccbbd168fcad08e37 to your computer and use it in GitHub Desktop.
// ==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);
}
@eserte
Copy link
Author

eserte commented Apr 21, 2016

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment