Skip to content

Instantly share code, notes, and snippets.

@agateau
Last active December 25, 2015 21:19
Show Gist options
  • Save agateau/7042234 to your computer and use it in GitHub Desktop.
Save agateau/7042234 to your computer and use it in GitHub Desktop.
Greasemonkey script to make it easier to copy'n'paste review id
// ==UserScript==
// @name ReviewBoard - easy-to-copy review id
// @namespace http://agateau.com/
// @description Insert the review id in a readonly input field next to the star image, making it easier to copy
// @include https://*/r/*
// @grant none
// @version 1
// ==/UserScript==
var elements = document.getElementsByClassName("star");
var star = elements[0];
var reviewId = star.getAttribute("data-object-id");
var label = document.createElement("span");
label.innerHTML = "Review <u>I</u>D:";
label.style = "padding-left: 1em";
var input = document.createElement("input");
input.type = "text";
input.value = reviewId;
input.readOnly = true;
input.accessKey = "i";
input.onfocus = function() { this.select() };
star.parentElement.appendChild(label);
star.parentElement.appendChild(input);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment