您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
Convert assignee Quick Filters into dropdown menu with an "Any" option to clear assignee filter
当前为
// ==UserScript== // @name JIRA Assignee Quick Filter Menu // @namespace http://tampermonkey.net/ // @version 0.2 // @description Convert assignee Quick Filters into dropdown menu with an "Any" option to clear assignee filter // @author Jake Savin // @copyright Copyright (c) 2023 Jake Savin // @license MIT // @source https://github.com/jsavin/userscripts/ // @match https://*/secure/RapidBoard.jspa?* // @grant none // ==/UserScript== (function() { 'use strict'; const waitUntilJiraIsLoaded = setInterval(() => { if(document.querySelector('.ghx-controls-filters')) { clearInterval(waitUntilJiraIsLoaded); createQuickFiltersDropdown(); } }, 500); // Make a dropdown menu with options for all the filters that appear to be for assignees, // including an option at the top called "Any" to clear the assignee filter. Only one // assignee filter can be active at a time. function createQuickFiltersDropdown() { const filtersDiv = document.querySelector('.ghx-controls-filters'); const filters = Array.from(filtersDiv.querySelectorAll('.js-quickfilter-button')); // Create dropdown and add 'Clear' option const select = document.createElement('select'); select.addEventListener('change', () => clearAndSetFilter(select)); const clearOption = document.createElement('option'); clearOption.text = 'Any'; select.appendChild(clearOption); // Create label const label = document.createElement('label'); label.textContent = 'Assignee:'; label.style.marginRight = '0.3em'; // Add each filter to the dropdown let firstFilterContainer; filters.forEach((filter) => { if (/assigned|assignee/i.test(filter.title) && /[a-zA-Z]{2,}/.test(filter.innerText)) { const option = document.createElement('option'); option.text = filter.textContent; option.value = filter.dataset.filterId; select.appendChild(option); // Hide the original filter link only, not the entire dd element const container = document.createElement('span'); container.style.display = 'none'; filter.parentNode.replaceChild(container, filter); container.appendChild(filter); // Remember the first filter and replace it with the dropdown if (!firstFilterContainer) { firstFilterContainer = filter.parentElement; let filtersParent = firstFilterContainer.parentNode; filtersParent.insertBefore(label, firstFilterContainer); filtersParent.insertBefore(select, firstFilterContainer); } } }); } // Activate the selected filter and deactivate any other assignee filter that was previously active function clearAndSetFilter(select) { const filtersDiv = document.querySelector('.ghx-controls-filters'); const activeFilters = Array.from(filtersDiv.querySelectorAll('.js-quickfilter-button.ghx-active')); // Clear active filters activeFilters.forEach((filter) => { filter.click(); }); // Set new filter const selectedFilterId = select.value; if (selectedFilterId) { const filterToClick = filtersDiv.querySelector(`.js-quickfilter-button[data-filter-id="${selectedFilterId}"]`); filterToClick.click(); } } })();
QingJ © 2025
镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址