Skip to content

Instantly share code, notes, and snippets.

@Leandros
Last active November 26, 2015 14:50
Show Gist options
  • Save Leandros/4b33463b0be2bc999f1e to your computer and use it in GitHub Desktop.
Save Leandros/4b33463b0be2bc999f1e to your computer and use it in GitHub Desktop.
Postly Victory
// ==UserScript==
// @name Postly Victory Sound
// @namespace Postly App, LLC
// @version 0.1
// @description try to take over the world!
// @author Arvid Gerstmann
// @match https://api.getpostly.com/*
// @match http://127.0.0.1:5000/*
// @grant none
// @require http://code.jquery.com/jquery-2.1.4.min.js
// ==/UserScript==
/* jshint -W097 */
'use strict';
var getTodaysCardsSent = function() {
var span = $("span:contains('Daily Cards Sent')").parent().children().eq(3);
var cardsSent = parseInt(span.text().trim().replace('.',''));
if (!localStorage.getItem('postly-cards-sent')) {
localStorage.setItem('postly-cards-sent', cardsSent);
}
var cardsSentSaved = parseInt(localStorage.getItem('postly-cards-sent'));
if (cardsSent > cardsSentSaved) {
localStorage.setItem('postly-cards-sent', cardsSent);
// Play Sound!
var audio = new Audio('https://s3.amazonaws.com/postly-assets-staging/victory.mp3');
audio.play();
}
};
setTimeout(getTodaysCardsSent, 5 * 1000);
setTimeout(location.reload.bind(location), 60000);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment