Skip to content

Instantly share code, notes, and snippets.

@abdennour
Created July 6, 2018 18:14
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save abdennour/8a02e3fc4e942d4b2b037cd3290e1f31 to your computer and use it in GitHub Desktop.
Save abdennour/8a02e3fc4e942d4b2b037cd3290e1f31 to your computer and use it in GitHub Desktop.
Notify GOOOAL with Google World Cup 2018

Open Google

https://google.com

Search by name of teams

  • Example: Brazil vs Belgiun

Open JS console of browser

  • Put script "console.js"
// هدف
const goal = new Audio('https://www.w3schools.com/tags/horse.mp3');
const resultTeamA = () => parseInt(document.querySelector('.imso_mh__l-tm-sc.imso_mh__scr-it.imso-light-font').innerHTML);
const resultTeamB = () => parseInt(document.querySelector('.imso_mh__r-tm-sc.imso_mh__scr-it.imso-light-font').innerHTML);
let lastResults = [resultTeamA(), resultTeamB()]
setInterval(() => {
let newResultTeamA = resultTeamA();
let newResultTeamB = resultTeamB();
if (newResultTeamA !== lastResults[0] || newResultTeamB !== lastResults[1]) {
goal.play(); // GOOOOOOOOOAL!!!!!
}
lastResults = [newResultTeamA, newResultTeamB];
}, 3000); // each 3 seconds
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment