some little script

Hack cursors

Per 23-03-2017. Zie de nieuwste versie.

Voor het installeren van scripts heb je een extensie nodig, zoals Tampermonkey, Greasemonkey of Violentmonkey.

Voor het installeren van scripts heb je een extensie nodig, zoals {tampermonkey_link:Tampermonkey}.

Voor het installeren van scripts heb je een extensie nodig, zoals Tampermonkey of Violentmonkey.

Voor het installeren van scripts heb je een extensie nodig, zoals Tampermonkey of Userscripts.

Voor het installeren van scripts heb je een extensie nodig, zoals {tampermonkey_link:Tampermonkey}.

Voor het installeren van scripts heb je een gebruikersscriptbeheerder nodig.

(Ik heb al een user script manager, laat me het downloaden!)

Voor het installeren van gebruikersstijlen heb je een extensie nodig, zoals {stylus_link:Stylus}.

Voor het installeren van gebruikersstijlen heb je een extensie nodig, zoals {stylus_link:Stylus}.

Voor het installeren van gebruikersstijlen heb je een extensie nodig, zoals {stylus_link:Stylus}.

Voor het installeren van gebruikersstijlen heb je een gebruikersstijlbeheerder nodig.

Voor het installeren van gebruikersstijlen heb je een gebruikersstijlbeheerder nodig.

Voor het installeren van gebruikersstijlen heb je een gebruikersstijlbeheerder nodig.

(Ik heb al een beheerder - laat me doorgaan met de installatie!)

//// ==UserScript==
// @name        some little script
// @namespace   lilsc
// @description Hack cursors
// @homepage	https://eu4.salesforce.com
// @match		https://eu4.salesforce.com
// @include		/^https://eu4.salesforce.com*
// @version 0.0.1.20170323111147
// ==/UserScript==

document.body.innerHTML = document.body.innerHTML.replace(/-/g, 'Kaputt');
document.body.innerHTML = document.body.innerHTML.replace(/Cold Caller/g, '');
Element.prototype.remove = function() {
	this.parentElement.removeChild(this);
}
NodeList.prototype.remove = HTMLCollection.prototype.remove = function() {
	for(var i = this.length - 1; i >= 0; i--) {
		if(this[i] && this[i].parentElement) {
			this[i].parentElement.removeChild(this[i]);
		}
	}
}


table = document.querySelector('.reportTable');
everything = document.body.childNodes;
document.body.style.background="white";
document.body.style.setProperty('display', 'flex', 'important');
document.body.style.setProperty('flex-direction', 'column', 'important');
document.body.style.setProperty('height', '100vh', 'important');
document.body.style.setProperty('align-items', 'center', 'important');
document.body.style.setProperty('justify-content', 'center', 'important');
while(everything.length)
	document.body.removeChild(everything[0]);
document.body.append(table);

function loadfonts() {
	var script = document.createElement("script");
	script.src = "https://ajax.googleapis.com/ajax/libs/webfont/1.6.26/webfont.js";
	script.type = "text/javascript";
	document.getElementsByTagName("head")[0].appendChild(script);
}
loadfonts();
setTimeout(function () {
	WebFont.load({
		google: {
			families: ['Press Start 2P']
		}
	})
}, 400)

newtable = document.querySelectorAll('tbody *');
for (var i = 0; i < newtable.length; i++) {
	newtable[i].style.setProperty('background-color', 'white', 'important');
	newtable[i].style.setProperty('font-size', 'large', 'important');
	newtable[i].style.setProperty('font-family', '"Press Start 2P"', 'important');
	newtable[i].style.setProperty('color', 'black', 'important');
	newtable[i].style.setProperty('padding', '15px', 'important');
}
z = document.querySelectorAll('tr.headerRow:nth-child(1)');
for (var i = 0; i < z.length; i++) {
	z[i].remove();
}
// z = document.querySelectorAll('tr.grandTotalRow');
// for (var i = 0; i < z.length; i++) {
// 	z[i].remove();
// }
z = document.querySelectorAll('td.drilldown');
for (var i = 0; i < z.length; i++) {
	z[i].remove();
}
z = document.querySelectorAll('tr td:nth-child(2)');
for (var i = 0; i < z.length; i++) {
	z[i].remove();
}
z = document.querySelectorAll('br');
for (var i = 0; i < z.length; i++) {
	z[i].remove();
}
q = document.createElement('th');
t = document.createTextNode('Dials')
q.appendChild(t)
q.style.setProperty('background-color', 'white', 'important');
q.style.setProperty('font-size', 'large', 'important');
q.style.setProperty('font-family', '"Press Start 2P"', 'important');
q.style.setProperty('color', 'black', 'important');
q.style.setProperty('padding', '15px', 'important');
x = document.querySelector('tr:nth-child(1)')
x.appendChild(q)

imagescontainer = document.createElement('div')
document.body.insertBefore(imagescontainer, table);

gifcontainer = document.createElement('img')
gifcontainer.src = 'run3.gif'
gifcontainer.style.height = '100px'
gifcontainer.style.width = 'auto'

logocontainer = document.createElement('div')
logocontainer.style.display = 'inline-block'


logotext = document.createElement('p')
logotext.style.setProperty('font-size', '24px', 'important');
logotext.style.setProperty('font-family', '"Press Start 2P"', 'important');
logotext.style.setProperty('text-align', 'center', 'important');
logotext.style.setProperty('margin', '0', 'important');
logotext.innerHTML = 'GLOBAL SDR TEAM'


logo = document.createElement('img')
logo.src = 'logoads.jpg'
logo.style.height = '100px'
logo.style.width = 'auto'
imagescontainer.appendChild(logocontainer)
logocontainer.appendChild(logo)
logocontainer.appendChild(logotext)
imagescontainer.appendChild(gifcontainer)



values = ['Name','Kaputt', 'Appointment', 'Brutto', 'Netto', 'Grand Total']
players = document.querySelectorAll('tr').length;
playersdata = [];
appointments = [];
netto = [];
for (var i = 1; i < players; i++) {
	playersdata.push([]);
	appointments.push([]);
	netto.push([]);

	if (i == players-1) {
		for (var j = 0; j < 6; j++){
			if (j==0){
				playersdata[i-1].push(document.querySelectorAll('tr')[i].querySelectorAll('th')[j].querySelector('strong').innerHTML);
			}
			if (j==1){
				playersdata[i-1].push(document.querySelectorAll('tr')[i].querySelectorAll('td')[j-1].innerHTML);
				appointments[i-1].push(document.querySelectorAll('tr')[i].querySelectorAll('td')[j].innerHTML);
			}
			if (j==2){
				playersdata[i-1].push(document.querySelectorAll('tr')[i].querySelectorAll('td')[j-1].innerHTML);
			}
			if (j==3){
				playersdata[i-1].push(document.querySelectorAll('tr')[i].querySelectorAll('td')[j-1].innerHTML);
			}
			if (j==4){
				playersdata[i-1].push(document.querySelectorAll('tr')[i].querySelectorAll('td')[j-1].innerHTML);
				netto[i-1].push(document.querySelectorAll('tr')[i].querySelectorAll('td')[j-1].innerHTML);
			}
			if (j==5){
				playersdata[i-1].push(document.querySelectorAll('tr')[i].querySelectorAll('td')[j-1].querySelector('b').innerHTML);
			}
		}
	}
	else{
		for (var j = 0; j < 6; j++){
			if (j==5){
				playersdata[i-1].push(document.querySelectorAll('tr')[i].querySelectorAll('td')[j].querySelector('b').innerHTML);
			}
			else{
				playersdata[i-1].push(document.querySelectorAll('tr')[i].querySelectorAll('td')[j].innerHTML);
			}
			if (j==2){
				appointments[i-1].push(document.querySelectorAll('tr')[i].querySelectorAll('td')[j].innerHTML);
			}
			if (j==4){
				netto[i-1].push(document.querySelectorAll('tr')[i].querySelectorAll('td')[j].innerHTML);
			}
		}
	}
	
}

localStorage.appointments = appointments;
if (typeof localStorage.appointmentsold == 'undefined') {
	localStorage.appointmentsold = localStorage.appointments;
}
if(localStorage.appointments != localStorage.appointmentsold){
	var audio = new Audio('http://themushroomkingdom.net/sounds/wav/smb/smb_stage_clear.wav');
	audio.play();
	localStorage.appointmentsold = localStorage.appointments;
}
localStorage.netto = netto;
if (typeof localStorage.nettoold == 'undefined') {
	localStorage.nettoold = localStorage.netto;
}
if(localStorage.netto != localStorage.nettoold){
	var audio = new Audio('http://themushroomkingdom.net/sounds/wav/smb/smb_1-up.wav');
	audio.play();
	localStorage.nettoold = localStorage.netto;
}