0

We have a plugin that generates a JavaScript file. We want to run/execute this js file from within a html button, e.g.:

<input type=button value="Open js" onclick="javascript:window.open('http://jira.bltelecoms.net:8080/s/en_UScyxsyn/664/8/1.0.23-beta/_/download/batch/com.atlassian.jira.collector.plugin.jira-issue-collector-plugin:issuecollector/com.atlassian.jira.collector.plugin.jira-issue-collector-plugin:issuecollector.js?collectorId=e125274b','_self')" />

We use an third party web application called Jira and Confluence, part of the Atlassian suite. It's issue tracking software and it uses a plugin to create this JavaScript file which pops up a window, similar to a lightbox, in which you can fill in data and send it. By default it makes a trigger on the side of the page, how ever we want to execute this from a standard html button. Is there a way do do this?

4
  • What does the script do? Commented Sep 13, 2012 at 9:20
  • I just tried, and it opens the .js (what did you expect?). Is the question in how to include this script on an HTML page? Commented Sep 13, 2012 at 9:21
  • We use an third party web application called jira and confluence, part of the atlassian suite. it's issue tracking software and it uses a plugin to create this javascript file which pops up a window, similar to a lightbox, in which you can fill in data and send it. by default it makes a trigger on the side of the page, how ever we want to execute this from a standard html button if this makes sense? Commented Sep 13, 2012 at 9:26
  • Warren, please put your comment into the question, and clarify what you mean by "not coming out right". Do you mean to say "it loads the javascript file, but we want it to execute the code in the javascript file?" Commented Sep 26, 2012 at 15:22

2 Answers 2

1

You could make a new page which includes the script and open this page on click.

Or how about this:

function loadScript() {
  var s = document.createElement('script');
  s.src = "http://jira.bltelecoms.net:8080/s/en_UScyxsyn/664/8/1.0.23-beta/_/download/batch/com.atlassian.jira.collector.plugin.jira-issue-collector-plugin:issuecollector/com.atlassian.jira.collector.plugin.jira-issue-collector-plugin:issuecollector.js?collectorId=e125274b";
  document.body.appendChild(s);
}

onclick="loadScript();"
Sign up to request clarification or add additional context in comments.

6 Comments

how? because no matter what i do can't get this .js file to execute from a button?
fine, but then how can i run this code var s = document.createElement('script'); s.src = "http://jira.bltelecoms.net:8080/s/en_UScyxsyn/664/8/1.0.23-beta/_/download/batch/com.atlassian.jira.collector.plugin.jira-issue-collector-plugin:issuecollector/com.atlassian.jira.collector.plugin.jira-issue-collector-plugin:issuecollector.js?collectorId=e125274b"; document.body.appendChild(s); to run from a html button?
add the function in a <script> tag on you page and the onclick to your button.
Gimme a sec, let me just check
Ok, that works thanks, your code is perfect, the problem is with the http://jira.bltelecoms.net:8080/s/en_UScyxsyn/664/8/1.0.23-beta/_/download/batc‌​h/com.atlassian.jira.collector.plugin.jira-issue-collector-plugin:issuecollector/‌​com.atlassian.jira.collector.plugin.jira-issue-collector-plugin:issuecollector.js‌​?collectorId=e125274b js file, so within this js file the code still tells it to render the trigger on the side of the page, i was hoping that by running the js file directly from the button it would render the form as if we clicked in the trigger button generated by the plugin?
|
0

I know that this is an old topic, but please see the following link:

https://confluence.atlassian.com/display/JIRA/Advanced+Use+of+the+JIRA+Issue+Collector#AdvancedUseoftheJIRAIssueCollector-Addingthecustomtriggerfunctionmanually

This shows how to set custom triggers for JIRA issue collectors. You will need a function to extend the global object ATL_JQ_PAGE_PROPS like below (jquery must be available).

    window.ATL_JQ_PAGE_PROPS = $.extend(window.ATL_JQ_PAGE_PROPS, {


    // ==== custom trigger function ====
    triggerFunction : function( showCollectorDialog ) {
        $('#feedback-button').on( 'click', function(e) {
            e.preventDefault();
            showCollectorDialog();
        });

        // add any other custom triggers for the issue collector here
    }

});

So clicking on a DOM element with id="feedback-button" (or whatever other id you want to give it) will trigger your issue collector script.

Bear in mind the issue collector will need to specify a "Custom" trigger. You can do this by editing it in JIRA.

Hope this helps

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.