Skip to content

Instantly share code, notes, and snippets.

@mephisto41
Last active May 17, 2016 03:06
Show Gist options
  • Save mephisto41/9e5f7c541bc3bb1c9b7e2c254a61d7da to your computer and use it in GitHub Desktop.
Save mephisto41/9e5f7c541bc3bb1c9b7e2c254a61d7da to your computer and use it in GitHub Desktop.
// ==UserScript==
// @name Get Wiki format for dashboard
// @namespace bugzilla
// @include https://bugzilla.mozilla.org/page.cgi?id=mydashboard.html
// @version 1
// @require http://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js
// @require https://gist.github.com/raw/2625891/waitForKeyElements.js
// @grant GM_setClipboard
// ==/UserScript==
$("#query_count_refresh").append("<span>|</span><input type=button value='To Wiki' id='to-wiki-button' />")
waitForKeyElements (".yui3-datatable-data tr", function(jNode) {
jNode.find(".yui3-datatable-col-short_desc").prepend("<input type=checkbox class='get-wiki-checkbox' />")
});
$("#to-wiki-button").on("click", function(e) {
var res = "";
$(".get-wiki-checkbox:checked").each(function(jNode) {
var trNode = this.closest("tr");
var bugid = $(trNode).find(".yui3-datatable-col-bug_id a").text();
var bugdesc = $(trNode).find(".yui3-datatable-col-short_desc").text();
res += "* {{Bug|" + bugid + "}} - " + bugdesc + "\n";
});
//console.log(res);
GM_setClipboard(res);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment