NOTICE: By continued use of this site you understand and agree to the binding Terms of Service and Privacy Policy.
/**
* MIT License
*
* Copyright (c) 2021 jonas
*
* 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.
*
*/
// ==UserScript==
// @name Jira assignee toggler
// @version 0.3
// @copyright 2021, jonas (https://openuserjs.org/users/jonas)
// @description auto-toggle (conflicting) assignee filters from JIRA quickfilters
// @downloadURL https://openuserjs.org/install/jonas/Jira_assignee_toggler.user.js
// @updateURL https://openuserjs.org/meta/jonas/Jira_assignee_toggler.meta.js
// @author Jonas De Kegel
// @match https://jira.*.*/secure/RapidBoard.jspa*
// @icon https://www.google.com/s2/favicons?domain=jira.atlassian.com
// @grant none
// @license MIT
// @require https://git.io/waitForKeyElements.js
// ==/UserScript==
// ==OpenUserScript==
// @author jonas
// @collaborator jonas
// ==/OpenUserScript==
let handlingClick = false;
function quickFilterButtonHandler(button) {
'use strict';
console.log('##qf button handler loaded');
button.onclick = (e) => {
if(handlingClick) return; // we need to simulate clicks, avoid triggering ourselves
if(e.target.title.startsWith('assignee')) {
handlingClick = true;
Array.from(document.getElementsByClassName('js-quickfilter-button ghx-active')).forEach((el) => {
if(el.title !== e.target.title && el.title.startsWith('assignee')) { // only toggle other assignee fields
el.click();
}
})
setTimeout(() => { handlingClick = false; }, 0);
}
}
}
waitForKeyElements (
".js-quickfilter-button",
quickFilterButtonHandler,
);