jhult / Jira - apps - hide (paid and incompatible) updates

// ==UserScript==

// @name          Jira - apps - hide (paid and incompatible) updates
// @namespace     https://jonathanhult.com
// @description   Hide Jira app updates which are now paid (when the prior version was free) and those which are incompatible

// @version       1.1.0
// @license       MIT; https://opensource.org/licenses/MIT

// @icon          data:image/svg+xml;charset=utf-8;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiIHN0YW5kYWxvbmU9Im5vIj8+DQo8c3ZnDQogICB4bWxuczpkYz0iaHR0cDovL3B1cmwub3JnL2RjL2VsZW1lbnRzLzEuMS8iDQogICB4bWxuczpjYz0iaHR0cDovL2NyZWF0aXZlY29tbW9ucy5vcmcvbnMjIg0KICAgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIg0KICAgeG1sbnM6c3ZnPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyINCiAgIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyINCiAgIHhtbG5zOnhsaW5rPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5L3hsaW5rIg0KICAgeG1sbnM6c29kaXBvZGk9Imh0dHA6Ly9zb2RpcG9kaS5zb3VyY2Vmb3JnZS5uZXQvRFREL3NvZGlwb2RpLTAuZHRkIg0KICAgeG1sbnM6aW5rc2NhcGU9Imh0dHA6Ly93d3cuaW5rc2NhcGUub3JnL25hbWVzcGFjZXMvaW5rc2NhcGUiDQogICB2aWV3Qm94PSIwIDAgMTMxLjY5Mjk5IDEzMS42OTM5MyINCiAgIHZlcnNpb249IjEuMSINCiAgIGlkPSJzdmc0ODkiDQogICBzb2RpcG9kaTpkb2NuYW1lPSJqaXJhLWJsdWUtdmVydGljYWwuc3ZnIg0KICAgd2lkdGg9IjEzMS42OTI5OSINCiAgIGhlaWdodD0iMTMxLjY5MzkyIg0KICAgaW5rc2NhcGU6dmVyc2lvbj0iMC45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TkyIC0zLjEyODcwMSwtNy45NTE2NTcgLTYuNzc2OTc3LC03Ljk1MTY1NyAtNC44MjI5NSwwIC03LjMwNzg0MywzLjE3OTUzMyAtNy4zMDc4NDMsOC45NDU2MTQgMC4wMjI1OSw1Ljk2Mzc0NCAyLjQwNTgyOCw4Ljk0NTYxNCA2LjgzMzQ1NCw4Ljk0NTYxNCB6Ig0KICAgICAgIGNsYXNzPSJjbHMtMSIgLz4NCiAgPC9nPg0KPC9zdmc+

// @require       https://gistcdn.githack.com/BrockA/2625891/raw/waitForKeyElements.js

// @match         *://*/plugins/servlet/upm*
// @run-at        document-end
// @grant         none

// ==/UserScript==

waitForKeyElements('.upm-manage-plugin-list', jiraHideInvalidAppUpdates);

function jiraHideInvalidAppUpdates() {
  // hide incompatible add-ons where we have already requested an upate
  AJS.$('span.aui-lozenge:contains("INCOMPATIBLE - UPDATE REQUESTED")').parents('div.upm-plugin').css('display', 'none');

  // hide this warning about incompatible apps - "Some installed apps are incompatible with your JIRA instance. Learn more or disable incompatible apps."
  AJS.$('#upm-incompatible-plugins-msg').css('display', 'none');

  // hide paid
  AJS.$('a[data-action="UPDATE"]:contains("Paid update")').parents('div.upm-plugin').css('display', 'none');
}