Better Zendesk for BandLab

Zendesk enhancements for BandLab support team

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.

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.

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

// ==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 });
})();