Slim JIRA issue search

Adds a button to hide the JIRA issue browser

Aby zainstalować ten skrypt, wymagana jest instalacje jednego z następujących rozszerzeń: Tampermonkey, Greasemonkey lub Violentmonkey.

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

Aby zainstalować ten skrypt, wymagana jest instalacje jednego z następujących rozszerzeń: Tampermonkey, Violentmonkey.

Aby zainstalować ten skrypt, wymagana będzie instalacja rozszerzenia Tampermonkey lub Userscripts.

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

Aby zainstalować ten skrypt, musisz zainstalować rozszerzenie menedżera skryptów użytkownika.

(Mam już menedżera skryptów użytkownika, pozwól mi to zainstalować!)

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.

Będziesz musiał zainstalować rozszerzenie menedżera stylów użytkownika, aby zainstalować ten styl.

Będziesz musiał zainstalować rozszerzenie menedżera stylów użytkownika, aby zainstalować ten styl.

Musisz zainstalować rozszerzenie menedżera stylów użytkownika, aby zainstalować ten styl.

(Mam już menedżera stylów użytkownika, pozwól mi to zainstalować!)

// ==UserScript==
// @name        Slim JIRA issue search
// @description Adds a button to hide the JIRA issue browser
// @namespace   https://www.pietz.me/
// @match       https://*.atlassian.net/browse/*
// @run-at      document-idle
// @grant       GM_addStyle
// @version     1.0
// @license     MIT
// ==/UserScript==

GM_addStyle(`
.toggle-search {
    background: none;
    border: none;
    height: 0.5rem;
    display: flex;
    flex-direction: row;
    align-items: center;
    cursor: pointer;
    box-shadow: none;
}

.toggle-search-line {
    height: 1px;
    display: block;
    background-color: #e5e5e5;
    transition: all 0.2s ease-out;
    flex: 1;
}

.toggle-search:hover .toggle-search-line {
    background-color: #448ae5;
    height: 2px;
}
`)

const contentElement = document.querySelector('#global-issue-navigator-container .contained-content');
const savedSearchSelectorElement = contentElement.querySelector('.saved-search-selector');
const searchElement = contentElement.querySelector('.navigator-search');

const toggleButton = document.createElement('button');
toggleButton.classList.add('toggle-search');

const indicatorLine = document.createElement('span');
indicatorLine.classList.add('toggle-search-line');
toggleButton.appendChild(indicatorLine);

let visible = true;
toggleButton.addEventListener('click', () => {
    visible = !visible;
    if (visible) {
        savedSearchSelectorElement.style.removeProperty('display');
        searchElement.style.removeProperty('display');
    } else {
        savedSearchSelectorElement.style.display = 'none';
        searchElement.style.display = 'none';
    }
})


contentElement.insertBefore(toggleButton, searchElement.nextSibling)