ZDF Player With Keyboard

Press cursor to skip some seconds back and forth, f fullscreen, p play

ही स्क्रिप्ट इंस्टॉल करण्यासाठी तुम्हाला Tampermonkey, Greasemonkey किंवा Violentmonkey यासारखे एक्स्टेंशन इंस्टॉल करावे लागेल.

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

ही स्क्रिप्ट इंस्टॉल करण्यासाठी तुम्हाला Tampermonkey किंवा Violentmonkey यासारखे एक्स्टेंशन इंस्टॉल करावे लागेल..

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

ही स्क्रिप्ट इंस्टॉल करण्यासाठी तुम्हाला Tampermonkey यासारखे एक्स्टेंशन इंस्टॉल करावे लागेल..

ही स्क्रिप्ट इंस्टॉल करण्यासाठी तुम्हाला एक युझर स्क्रिप्ट व्यवस्थापक एक्स्टेंशन इंस्टॉल करावे लागेल.

(माझ्याकडे आधीच युझर स्क्रिप्ट व्यवस्थापक आहे, मला इंस्टॉल करू द्या!)

ही स्टाईल इंस्टॉल करण्यासाठी तुम्हाला Stylus सारखे एक्स्टेंशन इंस्टॉल करावे लागेल.

ही स्टाईल इंस्टॉल करण्यासाठी तुम्हाला Stylus सारखे एक्स्टेंशन इंस्टॉल करावे लागेल.

ही स्टाईल इंस्टॉल करण्यासाठी तुम्हाला Stylus सारखे एक्स्टेंशन इंस्टॉल करावे लागेल.

ही स्टाईल इंस्टॉल करण्यासाठी तुम्हाला एक युझर स्टाईल व्यवस्थापक इंस्टॉल करावे लागेल.

ही स्टाईल इंस्टॉल करण्यासाठी तुम्हाला एक युझर स्टाईल व्यवस्थापक इंस्टॉल करावे लागेल.

ही स्टाईल इंस्टॉल करण्यासाठी तुम्हाला एक युझर स्टाईल व्यवस्थापक इंस्टॉल करावे लागेल.

(माझ्याकडे आधीच युझर स्टाईल व्यवस्थापक आहे, मला इंस्टॉल करू द्या!)

// ==UserScript==
// @name         ZDF Player With Keyboard
// @namespace    ZDF
// @version      0.3
// @description  Press cursor to skip some seconds back and forth, f fullscreen, p play
// @match        https://www.zdf.de/show/*
// @match        https://www.zdf.de/comedy/*
// @match        https://www.zdf.de/gesellschaft/*
// @match        https://www.zdf.de/play/*
// @license      MIT
// @grant        none
// ==/UserScript==

(function() {
  'use strict';

  var toggleFullScreen = 0;
  var togglePlay = 0;

  window.addEventListener('keydown', function(e) {

    var buttonElement;

    if (e.key === 'ArrowLeft') {
      buttonElement = document.querySelector("button[aria-label='10s rückwärts']");
      // console.log("key <- was pressed " + buttonElement);
      buttonElement.click();
    } else if (e.key === 'ArrowRight') {
      buttonElement = document.querySelector("button[aria-label='10s vorwärts']");
      // console.log("key -> was pressed " + buttonElement);
      buttonElement.click();
    } else if (e.key === 'f') {
      buttonElement = document.querySelector("button.button-fullscreen");
      if (toggleFullScreen == 0) {
        toggleFullScreen = 1;
      } else {
        toggleFullScreen = 0;
        buttonElement = document.querySelector("button.button-fullscreen-exit");
      }
      buttonElement.click();
    } else if (e.key === 'p') {
      buttonElement = document.querySelector("button[aria-label='Abspielen']");
      if (togglePlay == 0) {
        togglePlay = 1;
      } else {
        togglePlay = 0;
        buttonElement = document.querySelector("button[aria-label='Anhalten']");
      }
      buttonElement.click();
    }

  });

})();