Created
September 8, 2014 01:27
-
-
Save rissole/cdd9037916b35b6cc7b5 to your computer and use it in GitHub Desktop.
Userscript for alerting new matches on steamep.com
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ==UserScript== | |
// @name Get me Wayto | |
// @namespace rissole | |
// @description Check for new people selling player cards. | |
// @include https://steamep.com/matches | |
// @version 1 | |
// @grant GM_getValue | |
// @grant GM_setValue | |
// ==/UserScript== | |
document.title = "Nothing new"; | |
unsafeWindow.jQuery(function() { | |
setTimeout(realBegin, 0); | |
}); | |
function realBegin() { | |
var idSet = []; | |
unsafeWindow.jQuery('p.well').each(function(i, p) { | |
idSet.push(p.id); | |
}); | |
var lastIdSet = JSON.parse(GM_getValue('lastIdSet', '[]')); | |
if (idSet.length > 0 && lastIdSet.length > 0 && idSet[0] != lastIdSet[0]) { | |
alertNew(); | |
GM_setValue('lastIdSet', JSON.stringify(idSet)); | |
return; | |
} | |
setTimeout(function() { | |
location.reload(); | |
}, 5000); | |
} | |
function alertNew() { | |
playDrop(); | |
flipTitle(); | |
} | |
function flipTitle() { | |
document.title = "NEW PERSON!"; | |
setTimeout(function() { | |
document.title = "ALERT!"; | |
setTimeout(flipTitle, 1000); | |
}, 1000); | |
} | |
var DROP_SOUND_SRC = "https://dl.dropboxusercontent.com/u/84590655/drop.ogg"; | |
function playDrop() { | |
var drop = document.getElementById("facebook_gags_drop"); | |
if (drop === null) { | |
drop = document.createElement("audio"); | |
drop.src = DROP_SOUND_SRC; | |
drop.id = "facebook_gags_drop"; | |
document.body.appendChild(drop); | |
} | |
drop.play(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment