Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
// ==UserScript==
// @name uscisNotifier
// @namespace uscis
// @include about:addons
// @include https://egov.uscis.gov/casestatus/mycasestatus.do?appReceiptNum=*
// @version 0.1
// @grant none
// ==/UserScript==
var notifPlayer = document.createElement('AUDIO')
notifPlayer.src = 'https://dl.dropbox.com/u/7079101/coin.mp3'
notifPlayer.preload = 'auto'
var date = new Date,
weekDays = ["Sunday", "Monday", "Tuesday", "Wednsday", "Thursday", "Friday", "Saturday"]
dateValues = weekDays[date.getDay()] + " - " + date.getHours()
+ ":" + date.getMinutes() + ":" + date.getSeconds()
function notifyMe (newMessage) {
var notif = true
if (Notification.permission !== "denied")
Notification.requestPermission(function (permit) {
if (permit === "granted") var notif = new Notification(newMessage)
})
else if (Notification.permission === "granted")
var notif = new Notification(newMessage)
if (notif) {
notifPlayer.play()
setTimeout(setInterval(function() {
notifPlayer.play()
}, 30000), 2* 60 * 60 * 1000)
}
}
var $status = $('.appointment-sec h1').html()
if ($status != 'Fingerprint Fee Was Received') notifyMe ($status)
else {
var timeOut = Math.random() * (300000 - 60000) + 60000
console.log(dateValues + "-- going for reload in " + timeOut)
setTimeout(function() {document.location.reload()}, timeOut)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.