Slim JIRA issue search

Adds a button to hide the JIRA issue browser

You will need to install an extension such as Tampermonkey, Greasemonkey or Violentmonkey to install this script.

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

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

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

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

You will need to install a user script manager extension to install this script.

(I already have a user script manager, let me install it!)

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.

ستحتاج إلى تثبيت إضافة مثل Stylus لتثبيت هذا النمط.

ستحتاج إلى تثبيت إضافة لإدارة أنماط المستخدم لتتمكن من تثبيت هذا النمط.

ستحتاج إلى تثبيت إضافة لإدارة أنماط المستخدم لتثبيت هذا النمط.

ستحتاج إلى تثبيت إضافة لإدارة أنماط المستخدم لتثبيت هذا النمط.

(لدي بالفعل مثبت أنماط للمستخدم، دعني أقم بتثبيته!)

// ==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)