Skip to content

Instantly share code, notes, and snippets.

@mephisto41
Last active January 16, 2017 09:06
Show Gist options
  • Save mephisto41/bc5cc50ccb21fafc8fc353a88375b1cc to your computer and use it in GitHub Desktop.
Save mephisto41/bc5cc50ccb21fafc8fc353a88375b1cc to your computer and use it in GitHub Desktop.
// ==UserScript==
// @name Get Wiki format
// @namespace bugzilla
// @include https://bugzilla.mozilla.org/show_bug.cgi?id=*
// @version 1
// @grant GM_setClipboard
// ==/UserScript==
var title = document.getElementById("mode-container");
var button = document.createElement("button");
button.type = "button";
button.innerHTML = "Copy for Wiki"
button.className = "major";
title.insertBefore(button, title.firstChild);
button.onclick = function(e) {
var bugid = document.getElementById("this-bug").innerText;
var bugdesc = document.getElementById("field-value-short_desc").innerText;
bugid = bugid.replace(/\s/g, '|')
var res = "* {{" + bugid + "}} - " + bugdesc;
// console.log(res)
GM_setClipboard (res);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment