Skip to content

Instantly share code, notes, and snippets.

@yvenscolbert
Forked from renatosnrg/fifa.js
Last active August 29, 2015 14:03
Show Gist options
  • Save yvenscolbert/977dbd37ceb26b453ae9 to your computer and use it in GitHub Desktop.
Save yvenscolbert/977dbd37ceb26b453ae9 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 = ['62'];
/* 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();
}
}
nextValue = nextValue + (299-nextValue);
setTimeout(check, timeout);
}
checkTicket();
@jrenzi
Copy link

jrenzi commented Jul 7, 2014

Hey, thanks for the code! It was working fine till today, but after this morning it stopped working. I tried to get it fixed but wasn't succesfull, would you mind taking a look?

Thanks!

@rokam
Copy link

rokam commented Jul 8, 2014

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