Raw Source
pimhofman / GUA Dashboard style + ka-ching

// ==UserScript==
// @name         GUA Dashboard style + ka-ching
// @namespace  	 http://www.pimhofman.nl
// @version   	 1.0.4
// @description  Plays a sound when you get a new user on the Success page. Also styles the GUA dashboard.
// @match	     https://analytics.google.com/analytics/web/#dashboard/*
// @updateURL    https://openuserjs.org/meta/pimhofman/GUA_Dashboard_style_+_ka-ching.meta.js
// @downloadURL  https://openuserjs.org/meta/pimhofman/GUA_Dashboard_style_+_ka-ching.user.js
// ==/UserScript==

var soundData = 'https://dl.dropboxusercontent.com/u/9451345/ka-ching.mp3';

// Default no active users
mActiveUsers = 0;
setInterval(getActiveUsers, 1);
 
function getActiveUsers(){
    var count = parseInt(document.getElementById("ID-layout-1452075974199-counterValue").innerHTML);
    if(count > mActiveUsers){
	   var audio = document.createElement("audio");
       audio.src = soundData;
       audio.play(); 
       console.log("Ka-ching!");
    } 
    mActiveUsers = count;
}

function addGlobalStyle(css) {
    var head, style;
    head = document.getElementsByTagName('head')[0];
    if (!head) { return; }
    style = document.createElement('style');
    style.type = 'text/css';
    style.innerHTML = css;
    head.appendChild(style);
    console.log("CSS toegevoegd")
}

addGlobalStyle('#ID-navPanelContainer, #ID-header, #ID-headerBar, #ID-navToggle { display: none !important; }');
addGlobalStyle('._GAp8._GAUgb._GAXE { font-size: 75px !important; }');
addGlobalStyle('#ID-mainLayoutContainer { height: 100% !important; }');