// ==UserScript== // @name Bet365 Goal Alert Sound (Favourites) // @namespace http://tampermonkey.net/ // @version 0.1.2 // @description Play a sound when a goal goes in for any match in your favourites list // @match https://www.bet365.com/ // @license MIT // @downloadURL none // ==/UserScript== (function () { 'use strict'; // Load a short sound (can be replaced with another URL or base64 inline audio) const audio = new Audio("https://actions.google.com/sounds/v1/cartoon/wood_plank_flicks.ogg"); // Main handler when a goal alert node is detected function handleGoal(node) { const fixture = node.closest(".ovm-FixtureDetailsTwoWay"); console.log(fixture) // Extract both team names in this fixture const teamNames = [...fixture.querySelectorAll(".ovm-FixtureDetailsTwoWay_TeamName")] .map(el => el.textContent.trim()); console.log("GOAL detected in favourite match:", teamNames); audio.play().catch(err => console.warn("Audio play failed:", err)); } // MutationObserver to detect when goal alerts appear const observer = new MutationObserver(mutations => { for (const mutation of mutations) { for (const node of mutation.addedNodes) { if (!(node instanceof HTMLElement)) continue; if (node.classList.contains("ovm-GoalEventAlert")) { handleGoal(node); } } } }); observer.observe(document.body, { childList: true, subtree: true }); })();