Better Zendesk for BandLab

Zendesk enhancements for BandLab support team

K instalaci tototo skriptu si budete muset nainstalovat rozšíření jako Tampermonkey, Greasemonkey nebo Violentmonkey.

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

K instalaci tohoto skriptu si budete muset nainstalovat rozšíření jako Tampermonkey nebo Violentmonkey.

K instalaci tohoto skriptu si budete muset nainstalovat rozšíření jako Tampermonkey nebo Userscripts.

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

K instalaci tohoto skriptu si budete muset nainstalovat manažer uživatelských skriptů.

(Už mám manažer uživatelských skriptů, nechte mě ho nainstalovat!)

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.

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

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

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

(Už mám manažer uživatelských stylů, nechte mě ho nainstalovat!)

// ==UserScript==
// @name         Better Zendesk for BandLab
// @namespace    https://www.bandlab.com/
// @version      0.2
// @description  Zendesk enhancements for BandLab support team
// @author       Gilles
// @match        https://*.zendesk.com/agent/*
// @icon         https://www.google.com/s2/favicons?sz=64&domain=zendesk.com
// @grant        none
// @license MIT
// ==/UserScript==

(function () {
  "use strict";

  // Use ALT+Number to switch between panel on Zendesk
  document.addEventListener("keydown", function (event) {
    if (event.altKey) {
      switch (event.code) {
        case "Digit1":
          document
            .querySelector('[data-cy-test-element="customer-context"]')
            .click();
          event.preventDefault();
          break;
        case "Digit2":
          document
            .querySelector('[data-cy-test-element="guide-suggestions"]')
            .click();
          event.preventDefault();
          break;
        case "Digit3":
          document
            .querySelector('[data-cy-test-element="smart-assist"]')
            .click();
          event.preventDefault();
          break;
        case "Digit4":
          document.querySelector('[data-cy-test-element="apps"]').click();
          event.preventDefault();
          break;
        default:
          break;
      }
    }
  });

  // Uncheck "Requester can see this comment"
  const observer = new MutationObserver(function (mutationsList, observer) {
    for (const mutation of mutationsList) {
      if (mutation.type === "childList" && mutation.addedNodes.length > 0) {
        const newCheckboxes = document.querySelectorAll(
          'input[type="checkbox"][name$="_is_public"]',
        );
        newCheckboxes.forEach(function (checkbox) {
          checkbox.checked = false;
        });
      }
    }
  });
  observer.observe(document.body, { childList: true, subtree: true });
})();