2
// @name LP_DetailedDescription
3
// @namespace http://murraytwins.com/greasemonkey/
4
// @description (Launchpad) Prefill bug description
5
// @include https://launchpad.net/*
6
// @include https://*.launchpad.net/*
7
// @include https://*.edge.launchpad.net/*
9
// @creator Brian Murray <brian@ubuntu.com>
11
// This would be more awesome if worked like buttontags
12
// and you could have different descriptions for different
16
// ------ User settable data -------------
18
var description = "Release of Ubuntu:\nPackage Version:\nExpected Results:\nActual Results:\n"
20
// ------- End of User settable data -------
22
function xpath(query, context) {
23
context = context ? context : document;
24
return document.evaluate(query, context, null,
25
XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE, null);
30
// grab the part after bugs.launchpad.net - pathname looks like /ubuntu/+source/pkgname/+bug/1
31
var pathname = window.location.pathname;
32
// find the project name
33
var project_name = pathname.split('/')[1]
34
// project for the description to apply to
35
if ( project_name == 'ubuntu' ) {
36
if (xpath('//form[contains(@action,"filebug")]').snapshotItem(0)) {
37
xpath('//textarea[@id="field.comment"]').snapshotItem(0).value = description;