Skip to content

Instantly share code, notes, and snippets.

@rokam
Forked from yvenscolbert/fifa.js
Created July 8, 2014 09:47
Show Gist options
  • Save rokam/48ff404a8a041696458d to your computer and use it in GitHub Desktop.
Save rokam/48ff404a8a041696458d to your computer and use it in GitHub Desktop.
/*
Monitor ticket availability at Fifa.com Ticketing System site
Run this code at https://fwctickets.fifa.com/ticketingsystem.aspx?l=en#Tck2
(use the console available in any browser developer inspector)
- configure the timeout between refreshes and the matches you want to monitor
- when any available ticket is found a beep sound is played and the refresh stops
*/
function checkTicket() {
/* configure the timeout in miliseconds */
var timeout = 3000;
/* configure the matches you want to monitor */
var matches = ['61','63','64'];
/* beep url */
var beepUrl = "https://www.proxy-service.de/proxy-service.php?u=http%3A%2F%2Fsoundbible.com%2Fmp3%2FMorse%2520Code-SoundBible.com-810471357.mp3&b=0&f=norefer";
function isAvailable() {
for(var i =0; i < matches.length; i++) {
var match = matches[i];
if ($('#IMT' + match + ' span[data-content~="badge"]').size() > 0) {
return true;
}
}
return false;
}
function playSound() {
var snd = new Audio(beepUrl);
snd.play();
}
function check() {
if (isAvailable()) {
playSound();
console.log('Some ticket is available!');
} else {
checkTicket();
}
}
dL0D=new Date().getTime() - 120000;
nextValue = nextValue + (299-nextValue);
setTimeout(check, timeout);
}
checkTicket();
@Adriian21
Copy link

Hello! Will you have the same function available for the current FIFA website for the 2018 world cup?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment