jira Plus

jira 统计页面新增快捷按钮

Dovrai installare un'estensione come Tampermonkey, Greasemonkey o Violentmonkey per installare questo script.

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

Dovrai installare un'estensione come Tampermonkey o Violentmonkey per installare questo script.

Dovrai installare un'estensione come Tampermonkey o Userscripts per installare questo script.

Dovrai installare un'estensione come ad esempio Tampermonkey per installare questo script.

Dovrai installare un gestore di script utente per installare questo script.

(Ho già un gestore di script utente, lasciamelo installare!)

Dovrai installare un'estensione come ad esempio Stylus per installare questo stile.

Dovrai installare un'estensione come ad esempio Stylus per installare questo stile.

Dovrai installare un'estensione come ad esempio Stylus per installare questo stile.

Dovrai installare un'estensione per la gestione degli stili utente per installare questo stile.

Dovrai installare un'estensione per la gestione degli stili utente per installare questo stile.

Dovrai installare un'estensione per la gestione degli stili utente per installare questo stile.

(Ho già un gestore di stile utente, lasciamelo installare!)

// ==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);
}




})();