Public
Snippet $138 authored by Jérome Perrin

Gitlab collapse XML in diffs.user.js

Edited
Gitlab_collapse_XML_in_diffs.user.js
// ==UserScript==
// @name         Gitlab collapse XML in diffs
// @namespace    http://tampermonkey.net/
// @version      0.1
// @description  Collapse when viewing ERP5 diffs, because most of the time we are looking for python code.
// @author       Jérome Perrin
// @match        https://lab.nexedi.com/*
// @grant        none
// ==/UserScript==
(function() {
    'use strict';
    $('.file-title').each(function(idx, e) {
        if ($(e).find('span').text().indexOf('.xml\n') != -1) {
            $(e).parent().find(".diff-content").hide();
            $(e).click(function() {
                $(this).parent().find(".diff-content").toggle();
            });
        }
    } );
})();