javascript 将msgs插入JIRA评论

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了javascript 将msgs插入JIRA评论相关的知识,希望对你有一定的参考价值。

// ==UserScript==
// @name        Insert msgs into JIRA comment
// @namespace   https://jira.ontrq.com/browse/
// @include     https://jira.ontrq.com/browse/*
// @version     1
// @grant       none
// ==/UserScript==

var nfxpnk = {
    ge: function(elementId) {
        return document.getElementById(elementId);
    },
    author: 'Thanks,\n[~eac_RudchSer]',
    comments: [
        {
            name: 'Add the comment for the BE team',
            msg: 'Hi [~hbpt-be], please have a look at the issue.\n'
        },
        {
            name: 'Add the comment for the QA team',
            msg: 'Hi [~hbpt-qa], .\n'
        }
    ],
    addLink: function (name, msg) {
        var newElement = document.createElement('a');
        newElement.setAttribute('href', '#');
        newElement.setAttribute('style', 'margin:0 5px;');
        newElement.onclick = function(e) {
            return nfxpnk.addComment(msg);
        };
        newElement.appendChild(document.createTextNode(name));
        return newElement;
    },
    addComment: function(msg) {
        var commentTextBlock = this.ge('comment');
        commentTextBlock.value = msg + this.author;
        return false;
    },
    main: function() {
        var i, commentLink,
            iLength = this.comments.length,
            fieldTools = document.getElementsByClassName('field-tools')[0];

        for(i = 0; i < iLength; i++) {
            commentLink = this.addLink(this.comments[i].name, this.comments[i].msg)
            fieldTools.append(commentLink);
        };
    }
};
nfxpnk.main();

以上是关于javascript 将msgs插入JIRA评论的主要内容,如果未能解决你的问题,请参考以下文章

如何将自定义复选框组件添加到 JIRA 评论?

如何使用 JIRA Cloud REST API 创建对 jira 问题的内部评论

获取问题评论 JIRA python

如何从 Jira 中的状态更改触发 Jenkins 作业

python3.5 jira网站实现用户的批量插入

Python操作Jira