Player controls for Mako

Adds player controls

Du musst eine Erweiterung wie Tampermonkey, Greasemonkey oder Violentmonkey installieren, um dieses Skript zu installieren.

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 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.

Sie müssten eine Skript Manager Erweiterung installieren damit sie dieses Skript installieren können

(Ich habe schon ein Skript Manager, Lass mich es installieren!)

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         Player controls for Mako
// @namespace    http://tampermonkey.net/
// @version      0.0
// @description  Adds player controls
// @author       Avi (https://avi12.com)
// @copyright    2025 Avi (https://avi12.com)
// @license      MIT
// @match        https://www.mako.co.il/mako-vod-keshet/*
// @match        https://www.mako.co.il/mako-vod-podcasts/*
// @icon         https://www.google.com/s2/favicons?sz=64&domain=mako.co.il
// @grant        none
// ==/UserScript==

(function () {
  "use strict";

  document.addEventListener("keydown", e => {
    switch (e.code) {
      // Playback speed
      case "Comma":
      case "Period": {
        if (!e.shiftKey) {
          return;
        }

        const elPlaybackSpeedLabel = [...document.querySelectorAll("#idButtonsWrapper span > span")].find(elSpan => elSpan.textContent === "מהירות ניגון");
        const elPlaybackSpeedButtonWrapper = elPlaybackSpeedLabel.closest("button");
        const elPlaybackSpeedMenuOpener = elPlaybackSpeedButtonWrapper.firstElementChild;
        const currentSpeed = elPlaybackSpeedMenuOpener.querySelector("path").getAttribute("d");
        elPlaybackSpeedMenuOpener.click();
        const elPlaybackSpeeds = elPlaybackSpeedButtonWrapper.firstElementChild.children;
        const elPlaybackSpeedLabels = [...elPlaybackSpeeds].map(elButton => elButton.querySelector("path"));
        const elPlaybackSpeedButtons = elPlaybackSpeedLabels.map(elPath => elPath.closest("div"));
        const playbackSpeeds = elPlaybackSpeedButtons.map(elDiv => elDiv.querySelector("path").getAttribute("d"));

        const iSpeedCurrent = playbackSpeeds.indexOf(currentSpeed);
        const keyToElementMapper = {
          Comma: iSpeedCurrent + 1,
          Period: iSpeedCurrent - 1
        };
        const elSpeedToChangeTo = elPlaybackSpeedButtons[keyToElementMapper[e.code]];
        if (elSpeedToChangeTo) {
          elSpeedToChangeTo.click();
          return;
        }

        elPlaybackSpeedButtons[iSpeedCurrent].click();
      }
        break;
    }
  })
})();