Skip to content

Instantly share code, notes, and snippets.

@MaienM
Last active July 20, 2018 08:29
Show Gist options
  • Save MaienM/d6131f286942e530f4b4267162178d80 to your computer and use it in GitHub Desktop.
Save MaienM/d6131f286942e530f4b4267162178d80 to your computer and use it in GitHub Desktop.
GitLab Utils
// ==UserScript==
// @name GitLab Utils
// @namespace https://gist.github.com/MaienM/d6131f286942e530f4b4267162178d80
// @updateUrl https://gist.githubusercontent.com/MaienM/d6131f286942e530f4b4267162178d80/raw/
// @version 0.1
// @description GitLab Utilities
// @author MaienM
// @require https://cdnjs.cloudflare.com/ajax/libs/babel-standalone/6.18.2/babel.js
// @require https://cdnjs.cloudflare.com/ajax/libs/babel-polyfill/6.16.0/polyfill.js
// @require https://cdnjs.cloudflare.com/ajax/libs/lodash.js/4.17.4/lodash.min.js
// @require https://cdnjs.cloudflare.com/ajax/libs/jquery/3.2.1/jquery.min.js
// @match https://gitlab.waxd.nl/*
// ==/UserScript==
var inline_src = (<><![CDATA[
$('body[data-page="admin:users:index"] .content .flex-row .controls').each(function() {
const $this = $(this);
const $btnEdit = $this.find('.btn[href$="/edit"]');
const $btnImpersonate = $btnEdit.clone();
$btnImpersonate.attr('href', $btnImpersonate.attr('href').replace('/edit', '/impersonate'));
$btnImpersonate.html('Impersonate');
$btnImpersonate.attr('data-method', 'post');
$btnEdit.before($btnImpersonate);
});
]]></>).toString();
var c = Babel.transform(inline_src, { presets: [ "es2015", "es2016" ] });
eval(c.code);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment