Jira 工具

2021/2/9下午3:12:17

คุณจะต้องติดตั้งส่วนขยาย เช่น Tampermonkey, Greasemonkey หรือ Violentmonkey เพื่อติดตั้งสคริปต์นี้

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

คุณจะต้องติดตั้งส่วนขยาย เช่น Tampermonkey หรือ Violentmonkey เพื่อติดตั้งสคริปต์นี้

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

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

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

(I already have a user script manager, let me install it!)

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.

(I already have a user style manager, let me install it!)

// ==UserScript==
// @name        Jira 工具
// @namespace   Violentmonkey Scripts
// @match       https://jira.zhenguanyu.com/secure/*
// @match       https://jira.zhenguanyu.com/browse/*
// @grant       none
// @version     1.1.3
// @author      -
// @description 2021/2/9下午3:12:17
// ==/UserScript==

;(async function () {
  window.addEventListener('load', async () => {
  const loadScript = (url) => {
    const script = document.createElement('script')
    script.src = url;
    document.head.appendChild(script)

    return new Promise((resolve, reject) => {
      script.onload = resolve;
      script.onerror = reject;
    })
  }
  
  const loadStyle = (url) => {
    const link = document.createElement('link')
    link.href = url;
    link.rel = 'stylesheet';
    document.head.appendChild(link)

    return new Promise((resolve, reject) => {
      link.onload = resolve;
      link.onerror = reject;
    })
  }
  const isDebug = location.search.indexOf('jira-extension-script-debug=true') >= 0;

  const jsUrl = isDebug ? 'http://localhost:8080/index.js' : 'https://unpkg.com/jira-extension-script@latest';
  const cssUrl = isDebug ? 'http://localhost:8080/index.css' : 'https://unpkg.com/jira-extension-script@latest/dist/index.css';
  await Promise.all([
    loadScript(jsUrl),
    loadStyle(cssUrl)
  ]);
  
  const div = document.createElement('div');
  div.id = 'jira-ext';
  document.body.appendChild(div);
  JiraExtensionScript.render(div);
    
    

  JiraExtensionScript.polyfillRender && JiraExtensionScript.polyfillRender();
 })
})()