dazn, media controls

allows forward/backwards with arrow keys and pause with space

您需要先安裝使用者腳本管理器擴展,如 TampermonkeyGreasemonkeyViolentmonkey 之後才能安裝該腳本。

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

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyViolentmonkey 後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyUserscripts 後才能安裝該腳本。

你需要先安裝一款使用者腳本管理器擴展,比如 Tampermonkey,才能安裝此腳本

您需要先安裝使用者腳本管理器擴充功能後才能安裝該腳本。

(我已經安裝了使用者腳本管理器,讓我安裝!)

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

(我已經安裝了使用者樣式管理器,讓我安裝!)

// ==UserScript==
// @name         dazn, media controls
// @description  allows forward/backwards with arrow keys and pause with space
// @version      1.1
// @author       Tobias L
// @include      *.dazn.com/*
// @license      GPL-3.0-only
// @namespace    https://github.com/WhiteG00se/User-Scripts
// ==/UserScript==
// goes well with this steam controller profile:
// steam://controllerconfig/413080/2807431315

function backward() {
	let button = document.querySelector('[data-test-id="PLAYER_BUTTON_REWIND"]')
	if (button == null)
		button = document.querySelector('[data-test-id="PLAYER_BUTTON_REWIND PLAYER_BUTTON_REWIND_VISIBLE"]')
	button.click()
}
function forward() {
	let button = document.querySelector('[data-test-id="PLAYER_BUTTON_FAST_FORWARD"]')
	if (button == null)
		button = document.querySelector('[data-test-id="PLAYER_BUTTON_FAST_FORWARD PLAYER_BUTTON_FAST_FORWARD_VISIBLE"]')
	button.click()
}
function pause() {
	let button = document.querySelector('[data-test-id="PLAYER_BUTTON_PAUSE"]')
	if (button == null) 
		button = document.querySelector('[data-test-id="PLAYER_BUTTON_PAUSE PLAYER_BUTTON_PAUSE_VISIBLE"]')
	if (button == null) 
		button = document.querySelector('[data-test-id="PLAYER_BUTTON_PLAY"]')
	if (button == null) 
		button = document.querySelector('[data-test-id="PLAYER_BUTTON_PLAY PLAYER_BUTTON_PLAY_VISIBLE"]')

	button.click()
}

document.body.addEventListener("keydown", function (e) {
	if (e.key === "ArrowLeft") {
		e.preventDefault()
		backward()
	}
	if (e.key === "ArrowRight") {
		e.preventDefault()
		forward()
	}
	if (e.key === " ") {
		e.preventDefault()
		pause()
	}
})