Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F103572678
Add Patch Link Button to Gitlab
No One
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Authored By
atsuko
Sep 18 2026, 10:00 AM
2026-09-18 10:00:36 (UTC+0)
Size
1 KB
Referenced Files
None
Subscribers
None
Add Patch Link Button to Gitlab
View Options
// ==UserScript==
// @name Add Patch Link Button to Gitlab
// @namespace http://tampermonkey.net/
// @version 2026-09-18
// @description Adds a button to Gitlab pages to create a markdown link with the patch name
// @match https://gitlab.wikimedia.org/*/-/merge_requests/*
// @grant none
// ==/UserScript==
// Based on "Add Patch Link Button to Gerrit"
(function() {
'use strict';
// Function to create the button element
function createSinglePatchButton() {
const singlePatchButton = document.createElement('button');
singlePatchButton.textContent = 'Patch';
singlePatchButton.style.cssText = `
position: fixed;
bottom: 3em;
right: 1em;
z-index: 1000;
background-color: #4CAF50;
color: white;
padding: 10px 15px;
border: none;
border-radius: 4px;
cursor: pointer;
`;
singlePatchButton.onclick = () => {
const mergeRequest = document.querySelector('.merge-request');
const patchName = mergeRequest.querySelector("h1.title").textContent.trim();
const repoName = window.location.href.split("https://gitlab.wikimedia.org/repos/")[1].split("/-/")[0]
const markdownLink = `[[${repoName}] ${patchName}](${window.location.href})`;
navigator.clipboard.writeText(markdownLink).then(() => {
console.log('copied!');
});
};
return singlePatchButton;
}
// Function to inject the button into the page
function injectButtons() {
document.body.appendChild(createSinglePatchButton());
}
injectButtons();
// Your code here...
})();
File Metadata
Details
Attached
Mime Type
text/plain; charset=utf-8
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
28324426
Default Alt Text
Add Patch Link Button to Gitlab (1 KB)
Attached To
Mode
P96471 Add Patch Link Button to Gitlab
Attached
Detach File
Event Timeline
Log In to Comment