Posted by Thomas Sun, 20 May 2012 20:00:58 +0000
If ever you want to filter your queue by some min/max rating, and possibly look only for a specific genre. YMMV. Class names subject to change. Void where prohibited.
function getstbrMaskFgSpan(element) {
var spans = element.getElementsByTagName("span");
for (var span, k = 0; span = spans[k]; k++) {
if (span.className.match(/stbrMaskFg/)) {
return span;
}
}
return null;
}
var minRating = 3.7;
var maxRating = 5.0;
var tables = document.getElementsByTagName('table');
for (var table, i = 0; table = tables[i]; i++) {
if (table.className != "qtbl") {
continue;
}
var rows = table.getElementsByTagName('tr');
for (var row, j = 0; row = rows[j]; j++) {
// filter out tv shows
if (row.innerHTML.match(/series_only/)) {
row.style.display = "none";
continue;
}
// possibly filter for just action movies
if (!row.innerHTML.match(/Action/)) {
row.style.display = "none";
continue;
}
var span = getstbrMaskFgSpan(row);
if (span != undefined) {
var rating = span.className.replace(/.*sbmf-([0-9]+).*/g, "$1");
rating = parseFloat(rating) / 10.;
if (minRating < rating && rating <= maxRating) {
row.style.display = "";
} else {
row.style.display = "none";
}
}
}
}