Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Tampermonkey script to Show Total Number of Lines Modified in Phabricator Diff
// ==UserScript==
// @name Show Total Number of Lines Modified in Diff
// @namespace
// @version 0.1
// @description Show total number of lines modified in diff at bottom of table of contents
// @author lyahdav
// @match UPDATE HERE e.g.*
// @grant none
// ==/UserScript==
(function() {
'use strict';
var files = document.getElementsByClassName('differential-toc-file');
var totalLineCount = 0;
for (var i=1;i<files.length; i++) {
var file = files[i];
if (file.childNodes.length != 2) {
var lineText = file.childNodes[1].textContent;
lineText = lineText.match(/\((.+) /)[1];
var lineCount = parseInt(lineText);
totalLineCount += lineCount;
var countElementContent = document.createTextNode('Total number of lines modified: ' + totalLineCount);
var countElement = document.createElement('span');
countElement.className = 'differential-toc-file'; = 'font-size: 12px;';

This comment has been minimized.

Copy link

NicoHinderling commented Jan 31, 2019

legend!! 😛

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.