Phabricator List Count

A Greasemonkey script to show list sizes on developer.blender.org

Blender developers use Phabricator to track tasks, bug reports, and patches. Powerful as Phabricator is, when listing the patches that are waiting to be reviewed, it doesn’t give you the total count. Since we have to report those counts, I got tired of manually counting them and created a little Greasemonkey script.

First download the GreaseMonkey add-on for your browser, then add the above script. Any list view should now show the number of items in that list. It also copies the next/previous page buttons to the top of the list, for easy access.

Update: I made another GM script, for copying MarkDown and MediaWiki compatible links from Phabricator.

// ==UserScript==
// @name     Phabricator Table Counts
// @version  1
// @include  https://developer.blender.org/*
// ==/UserScript==

function count_table_rows() {
  let listviews = document.getElementsByClassName('phui-oi-list-view');
  if (listviews.length == 0) {
    return;
  }
  let listview = listviews[0];
  let p = document.createElement('p');
  p.textContent = listview.children.length + " elements in this list.";

  let pagers = document.getElementsByClassName('application-search-pager');
  if (pagers.length > 0) {
    p.textContent += ' There are more pages: ';

    let buttons = pagers[0].getElementsByClassName('button');
    for (i=0; i<buttons.length; i++) {
      let button = buttons.item(i);
      p.appendChild(button);
    }
  }

  listview.parentElement.insertBefore(p, listview);
}

window.setTimeout(count_table_rows, 500);
dr. Sybren A. Stüvel
dr. Sybren A. Stüvel
Open Source software developer, photographer, drummer

Related