Is it possible to use GreaseMonkey (or similar) to add the IssueCollector trigger to a webpage?

Alex Taylor
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
February 5, 2012

We're looking into whether we can make use of the IssueCollector plugin (https://plugins.atlassian.com/583856), but I've been told that modifying our product to include the required JS is not an option. I have been trying to get GreaseMonkey to run the scripts without any success.

Can anyone tell me whether it's actually possible to add the trigger in this way? Thanks!

1 answer

1 accepted

0 votes
Answer accepted
Alex Taylor
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
February 6, 2012

Ah-ha :-) The answer is 'yes'.

The Issue Collector JS code comes in two parts: a script downloaded from the JIRA server, and a small bit of inlined code. The trick is to use a @require statement in your GreaseMonkey script to handle the former:

// ==UserScript==
// @name           Report a Bug
// @namespace      asda
// @include        *
// @require        http://jira:8080/s/en_UK6a5s4d/664/14/1.0.14-beta/_/download/batch/com.atlassian.jira.collector.plugin.jira-issue-collector-plugin:issuecollector/com.atlassian.jira.collector.plugin.jira-issue-collector-plugin:issuecollector.js
// ==/UserScript==

if(window.ATL_JQ !== undefined) {
    ATL_JQ(function() {
        new ATL_JQ.IssueDialog({
            collectorId:"1fde3e24",
            collectFeedback:function() {
                return {
                    "Location":window.location,
                    "User-Agent":navigator.userAgent,
                    "Referrer":document.referrer,
                    "Screen Resolution":screen.width + " x " + screen.height
                };
            },
                triggerText: "Raise a Bug",
            triggerPosition: "TOP"
            });
    });
}

GreaseMonkey's getting a tad over-eager and is putting the trigger on everything that moves, but that should be easy enough to fix :-)

Suggest an answer

Log in or Sign up to answer