// ==UserScript== // @name Jira: Pull Request Link Improver // @namespace https://github.com/rybak/atlassian-tweaks // @version 10 // @license MIT // @description Adds more convenient pull request links to Jira tickets. // @author Andrei Rybak // @match https://jira.example.com/browse/* // @include https://*jira*/browse/* // @icon https://jira.atlassian.com/favicon.ico // @homepageURL https://github.com/rybak/atlassian-tweaks // @grant none // @downloadURL https://update.greasyfork.icu/scripts/456692/Jira%3A%20Pull%20Request%20Link%20Improver.user.js // @updateURL https://update.greasyfork.icu/scripts/456692/Jira%3A%20Pull%20Request%20Link%20Improver.meta.js // ==/UserScript== /* * Copyright (c) 2022-2023 Andrei Rybak * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in all * copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ (function() { 'use strict'; const PANEL_ID = 'PrLinksImproverPanel'; const LIST_ID = 'PrLinksImproverList'; var loadInProgress = false; function log(...toLog) { console.log('[PR Link Improver]:', ...toLog); } function warn(...toLog) { console.warn('[PR Link Improver]:', ...toLog); } function getJiraMajorVersion() { return document.querySelector('meta[name="application-name"]').attributes.getNamedItem("data-version").value.split(".")[0]; } function createPanel() { var header; const jiraMajorVersion = getJiraMajorVersion(); switch (jiraMajorVersion) { case "7": header = '
Could not load from Bitbucket. Got: ${errors}
`)); } function addPrLinks(pullRequests) { $(`#${PANEL_ID}`).append($(`