jira Plus

jira 统计页面新增快捷按钮

θα χρειαστεί να εγκαταστήσετε μια επέκταση όπως το Tampermonkey, το Greasemonkey ή το Violentmonkey για να εγκαταστήσετε αυτόν τον κώδικα.

You will need to install an extension such as Tampermonkey to install this script.

θα χρειαστεί να εγκαταστήσετε μια επέκταση όπως το Tampermonkey ή το Violentmonkey για να εγκαταστήσετε αυτόν τον κώδικα.

θα χρειαστεί να εγκαταστήσετε μια επέκταση όπως το Tampermonkey ή το Userscripts για να εγκαταστήσετε αυτόν τον κώδικα.

You will need to install an extension such as Tampermonkey to install this script.

Θα χρειαστεί να εγκαταστήσετε μια επέκταση διαχείρισης κώδικα χρήστη για να εγκαταστήσετε αυτόν τον κώδικα.

(Έχω ήδη έναν διαχειριστή κώδικα χρήστη, επιτρέψτε μου να τον εγκαταστήσω!)

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

(Έχω ήδη έναν διαχειριστή στυλ χρήστη, επιτρέψτε μου να τον εγκαταστήσω!)

// ==UserScript==
// @name         jira Plus
// @namespace    http://tampermonkey.net/
// @version      0.2
// @description  jira 统计页面新增快捷按钮
// @author       xueyixiao
// @match        http://*/secure/TimesheetReport.jspa?*
// @icon         https://www.google.com/s2/favicons?sz=64&domain=tongbaninfo.com
// @grant        none
// ==/UserScript==

(function() {
    'use strict';
    const boxList = document.querySelectorAll('.worklogLinkContainer')
    boxList.forEach(async box => {
        const link = box.querySelector('span a').getAttribute('href')
        const issueKey = link.match(/browse\/(.*)\?/)[1]
        const worklogId = link.match(/focusedWorklogId=(\d{0,})&/)[1]

        fetch(`${location.origin}/rest/api/2/issue/${issueKey}`).then(response => response.json()).then((issueData) => {
            const issueId = issueData.id;
            box.insertAdjacentHTML('beforeend', `<div class="worklog-operation-group">
  <span  title="新增" onclick="popupWindow('add',${issueId},${worklogId})"   class="icon-default aui-icon aui-icon-small aui-iconfont-add">新增</span>
  <span  title="删除" onclick="popupWindow('delete',${issueId},${worklogId})"   class="icon-default aui-icon aui-icon-small aui-iconfont-delete">删除</span>
  <span  title="编辑" onclick="popupWindow('update',${issueId},${worklogId})"   class="icon-default aui-icon aui-icon-small aui-iconfont-edit">编辑</span>
</div>`)
  }).catch((err) => {
      console.log(err);
  });


});
    document.body.insertAdjacentHTML('beforeend', `<style type="text/css">
img[alt="Medium"]{display:none;}
.worklog-operation-group{display:none;}
.worklogLinkContainer:hover .worklog-operation-group{display:flex;gap:12px;}
</style>`)

    window.popupWindow = (type, id, worklogId) => {
        const hrefs = {
            'add': `${location.origin}/secure/CreateWorklog!default.jspa?id=${id}`,
            'update': `${location.origin}/secure/UpdateWorklog!default.jspa?id=${id}&worklogId=${worklogId}`,
            'delete': `${location.origin}/secure/DeleteWorklog!default.jspa?id=${id}&worklogId=${worklogId}`
  }

  const windowFeatures = "width=1030,height=760,scrollbars=yes,resizable=yes";
    window.open(hrefs[type], "_blank", windowFeatures);
}




})();