Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Add some buttons to Gitlab instance of GHC
// ==UserScript==
// @name Gitlab discussion helper
// @version 1
// @grant none
// @description This script let you toggle all discussions in Gitlab
// @include https://gitlab.haskell.org/*
// @run-at document-idle
// @require https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js
// ==/UserScript==
(function() {
$('div#diff-notes-app > div:nth-child(1)').prepend('<div style="padding-top:5px"><div class="btn" onclick="$(\'.discussion-toggle-button\').click();">Toggle all</div><div class="btn" onclick="$(\'.discussion-toggle-button:has(i[class ~= fa-chevron-down])\').click()">Show all</div><div class="btn" onclick="$(\'.discussion-toggle-button:has(i[class ~= fa-chevron-up])\').click()">Hide all</div></div>');
$('div#diff-notes-app > div:nth-child(4)').prepend('<div style="padding-top:5px"><div class="btn" onclick="$(\'.click-to-expand\')[0].click();$(\'.js-btn-vue-toggle-comments\').filter(\':not(.active)\').click();">Show all comments</div></div>');
})();
@hsyl20
Copy link
Author

hsyl20 commented Jan 15, 2019

This script for GreaseMonkey (Firefox) / TamperMonkey (Chrome/Chromium) adds the following buttons to Gitlab merge request UI:

Discussions tab:
screenshot-20190114 171150

Changes tab:
screenshot-20190114 171141

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