Momentaneamente uso questo spazio in attesa di sistemare i link:
1- installare TAMPERMONKEY per il browser prescelto (testato e funzionante su FIREFOX (anche sulla versione android, OPERA, CHROME)
2- copiare tutte le stringhe del secondo post su TAMPERMONKEY in "aggiungi nuovo script"
3- selezionare il tasto "file" in alto a sinistra dentro TAMPERMONKEY e premere "salva"
AGGIORNAMENTO:
- Eliminate le ridondanze
- Aggiunti i movimenti, capitano, punizioni, rigori
WSMEDIE 2.0
Moderatore: rccrzz
Re: WSMEDIE 2.0
// ==UserScript==
// @name WSMedie
// @namespace https://www.worldsoccermanager.it/
// @version 2.0
// @description Calcolatore Medie
// @author rccrzz
// @include https://www.worldsoccermanager.it/wsm/vp.php*
// ==/UserScript==
var DOCU = window.document;
var bm = DOCU.getElementsByTagName('BUTTMEDIE');
var gta = DOCU.getElementsByTagName('table');
if (bm.length == 0) {
var button = DOCU.createElement('buttmedie');
var buttext = DOCU.createTextNode('Medie');
button.appendChild(buttext);
button.style.cursor = 'pointer';
button.style.width = '50px';
button.style.height = '10px';
button.addEventListener('click', mostraskill, false);
if (gta.length == 3) {
gta[1].appendChild(button);
} else {
gta[0].appendChild(button);
}
}
function mostraskill()
{
var DOCU = window.document;
var ifr = DOCU.getElementsByTagName('iframe');
//se esiste l'iframe
if (ifr.length > 0)
{
var fi = ifr[0];
if (fi.name == 'main')
{
var ifrInt = fi.contentWindow.document.getElementsByTagName('iframe');
fi = ifrInt[0];
}
creaTool(fi);
}
else
{
creaTool(DOCU);
}
}
function creaTool(fi)
{
var DOCU = window.document;
var skills = new Array();
var nski = 0;
//se è un giocatore delle giovanili o se non è una pagina valida
if (DOCU == fi)
{
var framePlayer = fi;
}
else
{
var framePlayer = fi.contentWindow.document;
}
var immagini = framePlayer.getElementsByTagName('img');
for (var i = 0; i < immagini.length; i++)
{
if (endsWith(immagini[i].src, 'a.gif'))
{
skills[nski] = parseInt(immagini[i].alt);
nski = nski + 1;
}
}
//se non è una pagina valida per assenza skill
if (nski > 0)
{
var tool = DOCU.createElement('table');
//tool.setAttribute("id", "WSM Calcolatore medie");
var tbodyTool = DOCU.createElement('tbody');
var riga = DOCU.createElement('tr');
var ruoli = DOCU.createElement('td');
var stili = DOCU.createElement('td');
stili.align = 'left';
stili.style.backgroundColor = 'black';
riga.appendChild(ruoli);
riga.appendChild(stili);
tbodyTool.appendChild(riga);
tool.appendChild(tbodyTool);
var table = DOCU.createElement('table');
var tbody = DOCU.createElement('tbody');
table.appendChild(tbody);
var rowOff = DOCU.createElement('tr');
creaCella('A L:' + media(new Array(skills[0], skills[1], skills[3], skills[5], skills[7], skills[9]), 1), rowOff);
creaCella('A C:' + media(new Array(skills[0], skills[1], skills[5], skills[6], skills[7], skills[8], skills[9], skills[12]), 1), rowOff);
creaCella('', rowOff);
var rowOff2 = DOCU.createElement('tr');
creaCella('', rowOff2);
creaCella('T C:' + media(new Array(skills[1], skills[3], skills[5], skills[7], skills[9]), 1), rowOff2);
creaCella('T L:' + media(new Array(skills[0], skills[3], skills[7], skills[9]), 1), rowOff2);
var rowMid = DOCU.createElement('tr');
creaCella('C L:' + media(new Array(skills[0], skills[1], skills[3], skills[16], skills[5], skills[9]), 1), rowMid);
creaCella('C C:' + media(new Array(skills[0], skills[1], skills[2], skills[3], skills[4], skills[5], skills[16], skills[12], skills[14]), 1), rowMid);
creaCella('', rowMid);
var rowMid2 = DOCU.createElement('tr');
creaCella('', rowMid2);
creaCella('M C:' + media(new Array(skills[2], skills[3], skills[4], skills[10], skills[12], skills[14]), 1), rowMid2);
creaCella('M L:' + media(new Array(skills[0], skills[3], skills[4], skills[10]), 1), rowMid2);
var rowDef = DOCU.createElement('tr');
creaCella('D L:' + media(new Array(skills[0], skills[4], skills[10], skills[12]), 1), rowDef);
creaCella('D C:' + media(new Array(skills[0], skills[4], skills[6], skills[8], skills[10], skills[12]), 1), rowDef);
creaCella('', rowDef);
var rowDef2 = DOCU.createElement('tr');
creaCella('', rowDef2);
creaCella('L:' + media(new Array(skills[4], skills[6], skills[12], skills[14], skills[16]), 1), rowDef2);
creaCella('', rowDef2);
var rowPor = DOCU.createElement('tr');
creaCella('', rowPor);
creaCella('P:' + media(new Array(skills[0], skills[1], skills[4], skills[6], skills[12]), 1), rowPor);
creaCella('', rowPor);
rowOff.style.backgroundColor = 'darkgreen';
rowOff2.style.backgroundColor = 'green';
rowMid.style.backgroundColor = 'darkgreen';
rowMid2.style.backgroundColor = 'green';
rowDef.style.backgroundColor = 'darkgreen';
rowDef2.style.backgroundColor = 'green';
rowPor.style.backgroundColor = 'darkgreen';
tbody.appendChild(rowOff);
tbody.appendChild(rowOff2);
tbody.appendChild(rowMid);
tbody.appendChild(rowMid2);
tbody.appendChild(rowDef);
tbody.appendChild(rowDef2);
tbody.appendChild(rowPor);
ruoli.appendChild(table);
//ruoli particolari
creaDivRuoliPart('Marcatore:' + media(new Array(skills[0], skills[4], skills[6], skills[8], skills[10], skills[12], skills[14]), 0), ruoli);
creaDivRuoliPart('Fluidificante:' + media(new Array(skills[0], skills[3], skills[5], skills[7], skills[2], skills[16], skills[9]), 0), ruoli);
creaDivRuoliPart('Interditore:' + media(new Array(skills[0], skills[2], skills[4], skills[12], skills[14]), 0), ruoli);
creaDivRuoliPart('Regista:' + media(new Array(skills[3], skills[5], skills[7], skills[9], skills[14], skills[16]), 0), ruoli);
creaDivRuoliPart('Interno:' + media(new Array(skills[0], skills[1], skills[5], skills[6], skills[7], skills[9]), 0), ruoli);
creaDivRuoliPart('Ala:' + media(new Array(skills[0], skills[3], skills[5], skills[4], skills[2], skills[16], skills[12], skills[9]), 0), ruoli);
creaDivRuoliPart('Fantasista:' + media(new Array(skills[1], skills[3], skills[5], skills[7], skills[9]), 0), ruoli);
creaDivRuoliPart('Seconda Punta:' + media(new Array(skills[0], skills[1], skills[3], skills[5], skills[7], skills[2], skills[12], skills[9]), 0), ruoli);
creaDivRuoliPart('Pivot:' + media(new Array(skills[3], skills[4], skills[2], skills[6], skills[8], skills[16], skills[12]), 0), ruoli);
creaDivStili('-------------', ruoli);
creaDivRuoliPart('Capitano:' + media(new Array(skills[18], skills[19]), 0), ruoli);
creaDivRuoliPart('Punizioni:' + media(new Array(skills[11], skills[11]), 0), ruoli);
creaDivRuoliPart('Rigori:' + media(new Array(skills[13], skills[13]), 0), ruoli);
creaDivRuoliPart('Rigori Finali:' + media(new Array(skills[13], skills[19]), 0), ruoli);
creaDivStili('Zona P:' + media(new Array(skills[14], skills[14]), 0), stili);
creaDivStili('Fuorig. P:' + media(new Array(skills[4], skills[5], skills[14]), 0), stili);
creaDivStili('Caten. P:' + media(new Array(skills[6], skills[7], skills[10]), 0), stili);
creaDivStili('Controp. P:' + media(new Array(skills[3], skills[3]), 0), stili);
creaDivStili('Lanci P:' + media(new Array(skills[3], skills[3]), 0), stili);
creaDivStili('-------------', stili);
creaDivZona('Zona LD:' + MedCol((skills[14] * 4 + skills[16] * 4 + skills[10] * 2) / 10, 0), stili);
creaDivStili('Uomo:' + media(new Array(skills[2], skills[4]), 0), stili);
creaDivStili('Fuorig. LD:' + media(new Array(skills[0], skills[2], skills[14], skills[16], skills[12]), 0), stili);
creaDivStili('Raddoppio LD:' + media(new Array(skills[0], skills[2], skills[4], skills[10], skills[12]), 0), stili);
creaDivCatenaccio('Caten. LDM:' + MedCol((skills[0] * 2 + skills[4] * 1) / 3, 0), stili);
creaDivStili('Pressing:' + media(new Array(skills[2], skills[4], skills[16]), 0), stili);
creaDivStili('Controp. C:' + media(new Array(skills[3], skills[7], skills[9], skills[16]), 0), stili);
creaDivStili('Controp. TA:' + media(new Array(skills[9], skills[0], skills[3], skills[7], skills[2], skills[14], skills[16]), 0), stili);
creaDivPrima('Prima MCT:' + MedCol((skills[7] * 2 + skills[3] * 2 + skills[5] * 2 + skills[9] + skills[2]) / 8, 0), stili);
creaDivStili('Possesso DMC:' + media(new Array(skills[9], skills[3], skills[5]), 0), stili);
creaDivStili('Lanci LDM CL:' + media(new Array(skills[7], skills[3]), 0), stili);
creaDivStili('Lanci A CL:' + media(new Array(skills[0], skills[2], skills[6]), 0), stili);
creaDivStili('Fasce DMCTA L:' + media(new Array(skills[3], skills[7], skills[5], skills[9], skills[2], skills[16]), 0), stili);
creaDivStili('Fasce TA C:' + media(new Array(skills[6], skills[8]), 0), stili);
creaDivStili('Vie Centr MCT C:' + media(new Array(skills[1], skills[3], skills[4], skills[7], skills[9], skills[14]), 0), stili);
creaDivStili('Vie Centr A C:' + media(new Array(skills[5], skills[12]), 0), stili);
creaDivStili('-------------', stili);
creaDivStili('Movimento in avanti:' + media(new Array(skills[1], skills[7], skills[2], skills[16], skills[12]), 0), stili);;
creaDivStili('Movimento indietro:' + media(new Array(skills[4], skills[2], skills[14], skills[16], skills[12], skills[10]), 0), stili);
creaDivStili('Movimento laterale:' + media(new Array(skills[2], skills[14], skills[16], skills[12] ), 0), stili);
var giovanili = 'S';
for (var i = 0; i < immagini.length; i++)
{
if (endsWith(immagini[i].src, 'add.png'))
{
giovanili = 'N';
}
}
if (giovanili == 'N')
{
var scripts = framePlayer.getElementsByTagName('script');
var ultimoScript = scripts[scripts.length - 2];
ultimoScript.parentNode.insertBefore(tool, ultimoScript);
}
else
{
var tabelle = framePlayer.getElementsByTagName('tbody');
ultimaTabella = tabelle[tabelle.length - 1];
righe = ultimaTabella.getElementsByTagName('tr');
var cell = DOCU.createElement('td');
cell.rowSpan = '11';
cell.appendChild(tool);
righe[0].appendChild(cell);
}
}
//riquadro zona
var zona = DOCU.createElement('div');
zona.id = 'zona';
zona.setAttribute('align', 'right');
zona.innerHTML = '<font size=1 color=white>Zona LD Senza Mar:' + media(new Array(skills[14], skills[16]), 0) + ' </font>';
tool.appendChild(zona);
zona.style.display = 'none';
zona.style.backgroundColor = 'black';
//riquadro pass prima
var prima = DOCU.createElement('div');
prima.id = 'prima';
prima.setAttribute('align', 'right');
prima.innerHTML = '<font size=1 color=white>Prima MCT Senza Dri e Res:' + media(new Array(skills[7], skills[3], skills[5]), 0) + ' </font>';
tool.appendChild(prima);
prima.style.display = 'none';
prima.style.backgroundColor = 'black';
//riquadro catenaccio
var cate = DOCU.createElement('div');
cate.id = 'cate';
cate.setAttribute('align', 'right');
cate.innerHTML = '<font size=1 color=white>Catenaccio LDM Senza Vel:' + media(new Array(skills[4], skills[4]), 0) + ' </font>';
tool.appendChild(cate);
cate.style.display = 'none';
cate.style.backgroundColor = 'black';
}
function creaDivRuoliPart(testo, cella)
{
var DOCU = window.document;
var div = DOCU.createElement('div');
div.style.backgroundColor = 'black';
div.innerHTML = '<font size=1 color=white>' + testo + '</font>';
div.setAttribute('align', 'right');
cella.appendChild(div);
return div;
}
function creaDivCatenaccio(testo, cella)
{
var DOCU = window.document;
var div = DOCU.createElement('div');
div.innerHTML = '<font size=1 color=white><u><i>' + testo + '</u></i></font>';
div.setAttribute('onclick', 'document.getElementById(\'cate\').style.display = \'block\';');
div.setAttribute('align', 'right');
cella.appendChild(div);
return div;
}
function creaDivPrima(testo, cella)
{
var DOCU = window.document;
var div = DOCU.createElement('div');
div.innerHTML = '<font size=1 color=white><u><i>' + testo + '</u></i></font>';
div.setAttribute('onclick', 'document.getElementById(\'prima\').style.display = \'block\';');
div.setAttribute('align', 'right');
cella.appendChild(div);
return div;
}
function creaDivZona(testo, cella)
{
var DOCU = window.document;
var div = DOCU.createElement('div');
div.innerHTML = '<font size=1 color=white><u><i>' + testo + '</u></i></font>';
div.setAttribute('onclick', 'document.getElementById(\'zona\').style.display = \'block\';');
div.setAttribute('align', 'right');
cella.appendChild(div);
return div;
}
function creaDivStili(testo, cella)
{
var DOCU = window.document;
var div = DOCU.createElement('div');
div.innerHTML = '<font size=1 color=white>' + testo + '</font>';
div.setAttribute('align', 'right');
cella.appendChild(div);
return div;
}
function creaCellaStili(testo, row)
{
var DOCU = window.document;
var cell = DOCU.createElement('td');
cell.innerHTML = '<font size=1 color=white>' + testo + '</font>';
row.appendChild(cell);
return cell;
}
function creaCella(testo, row)
{
var DOCU = window.document;
var cell = DOCU.createElement('td');
cell.innerHTML = '<font size=2 color=white>' + testo + '</font>';
row.appendChild(cell);
return cell;
}
function media(ski, tipoblu)
{
var somma = 0;
for (var i = 0; i < ski.length; i++)
{
somma += ski[i];
}
var med = (somma / ski.length);
return MedCol(med, tipoblu);
}
function MedCol(med, tipoblu)
{
med = med.toFixed(1);
var font = '#FF0000';
if (med < 80)
{
if (med < 70)
{
if (med < 60)
{
font = '#FF0000';
}
else
{
font = '#FFAA00';
}
}
else
{
font = '#00DD00';
}
}
else
{
if (tipoblu == 1)
{
font = '#000066';
}
else
{
font = '#4444FF';
}
}
var mediaColorata = '<font color=' + font + '> ' + med + ' </font>';
return mediaColorata;
}
function getFrame()
{
var DOCU = window.document;
var fi = DOCU.getElementsByTagName('iframe');
return fi[0];
}
function endsWith(testString, endingString)
{
if (endingString.length > testString.length) return false;
return testString.indexOf(endingString) == (testString.length - endingString.length);
}
// @name WSMedie
// @namespace https://www.worldsoccermanager.it/
// @version 2.0
// @description Calcolatore Medie
// @author rccrzz
// @include https://www.worldsoccermanager.it/wsm/vp.php*
// ==/UserScript==
var DOCU = window.document;
var bm = DOCU.getElementsByTagName('BUTTMEDIE');
var gta = DOCU.getElementsByTagName('table');
if (bm.length == 0) {
var button = DOCU.createElement('buttmedie');
var buttext = DOCU.createTextNode('Medie');
button.appendChild(buttext);
button.style.cursor = 'pointer';
button.style.width = '50px';
button.style.height = '10px';
button.addEventListener('click', mostraskill, false);
if (gta.length == 3) {
gta[1].appendChild(button);
} else {
gta[0].appendChild(button);
}
}
function mostraskill()
{
var DOCU = window.document;
var ifr = DOCU.getElementsByTagName('iframe');
//se esiste l'iframe
if (ifr.length > 0)
{
var fi = ifr[0];
if (fi.name == 'main')
{
var ifrInt = fi.contentWindow.document.getElementsByTagName('iframe');
fi = ifrInt[0];
}
creaTool(fi);
}
else
{
creaTool(DOCU);
}
}
function creaTool(fi)
{
var DOCU = window.document;
var skills = new Array();
var nski = 0;
//se è un giocatore delle giovanili o se non è una pagina valida
if (DOCU == fi)
{
var framePlayer = fi;
}
else
{
var framePlayer = fi.contentWindow.document;
}
var immagini = framePlayer.getElementsByTagName('img');
for (var i = 0; i < immagini.length; i++)
{
if (endsWith(immagini[i].src, 'a.gif'))
{
skills[nski] = parseInt(immagini[i].alt);
nski = nski + 1;
}
}
//se non è una pagina valida per assenza skill
if (nski > 0)
{
var tool = DOCU.createElement('table');
//tool.setAttribute("id", "WSM Calcolatore medie");
var tbodyTool = DOCU.createElement('tbody');
var riga = DOCU.createElement('tr');
var ruoli = DOCU.createElement('td');
var stili = DOCU.createElement('td');
stili.align = 'left';
stili.style.backgroundColor = 'black';
riga.appendChild(ruoli);
riga.appendChild(stili);
tbodyTool.appendChild(riga);
tool.appendChild(tbodyTool);
var table = DOCU.createElement('table');
var tbody = DOCU.createElement('tbody');
table.appendChild(tbody);
var rowOff = DOCU.createElement('tr');
creaCella('A L:' + media(new Array(skills[0], skills[1], skills[3], skills[5], skills[7], skills[9]), 1), rowOff);
creaCella('A C:' + media(new Array(skills[0], skills[1], skills[5], skills[6], skills[7], skills[8], skills[9], skills[12]), 1), rowOff);
creaCella('', rowOff);
var rowOff2 = DOCU.createElement('tr');
creaCella('', rowOff2);
creaCella('T C:' + media(new Array(skills[1], skills[3], skills[5], skills[7], skills[9]), 1), rowOff2);
creaCella('T L:' + media(new Array(skills[0], skills[3], skills[7], skills[9]), 1), rowOff2);
var rowMid = DOCU.createElement('tr');
creaCella('C L:' + media(new Array(skills[0], skills[1], skills[3], skills[16], skills[5], skills[9]), 1), rowMid);
creaCella('C C:' + media(new Array(skills[0], skills[1], skills[2], skills[3], skills[4], skills[5], skills[16], skills[12], skills[14]), 1), rowMid);
creaCella('', rowMid);
var rowMid2 = DOCU.createElement('tr');
creaCella('', rowMid2);
creaCella('M C:' + media(new Array(skills[2], skills[3], skills[4], skills[10], skills[12], skills[14]), 1), rowMid2);
creaCella('M L:' + media(new Array(skills[0], skills[3], skills[4], skills[10]), 1), rowMid2);
var rowDef = DOCU.createElement('tr');
creaCella('D L:' + media(new Array(skills[0], skills[4], skills[10], skills[12]), 1), rowDef);
creaCella('D C:' + media(new Array(skills[0], skills[4], skills[6], skills[8], skills[10], skills[12]), 1), rowDef);
creaCella('', rowDef);
var rowDef2 = DOCU.createElement('tr');
creaCella('', rowDef2);
creaCella('L:' + media(new Array(skills[4], skills[6], skills[12], skills[14], skills[16]), 1), rowDef2);
creaCella('', rowDef2);
var rowPor = DOCU.createElement('tr');
creaCella('', rowPor);
creaCella('P:' + media(new Array(skills[0], skills[1], skills[4], skills[6], skills[12]), 1), rowPor);
creaCella('', rowPor);
rowOff.style.backgroundColor = 'darkgreen';
rowOff2.style.backgroundColor = 'green';
rowMid.style.backgroundColor = 'darkgreen';
rowMid2.style.backgroundColor = 'green';
rowDef.style.backgroundColor = 'darkgreen';
rowDef2.style.backgroundColor = 'green';
rowPor.style.backgroundColor = 'darkgreen';
tbody.appendChild(rowOff);
tbody.appendChild(rowOff2);
tbody.appendChild(rowMid);
tbody.appendChild(rowMid2);
tbody.appendChild(rowDef);
tbody.appendChild(rowDef2);
tbody.appendChild(rowPor);
ruoli.appendChild(table);
//ruoli particolari
creaDivRuoliPart('Marcatore:' + media(new Array(skills[0], skills[4], skills[6], skills[8], skills[10], skills[12], skills[14]), 0), ruoli);
creaDivRuoliPart('Fluidificante:' + media(new Array(skills[0], skills[3], skills[5], skills[7], skills[2], skills[16], skills[9]), 0), ruoli);
creaDivRuoliPart('Interditore:' + media(new Array(skills[0], skills[2], skills[4], skills[12], skills[14]), 0), ruoli);
creaDivRuoliPart('Regista:' + media(new Array(skills[3], skills[5], skills[7], skills[9], skills[14], skills[16]), 0), ruoli);
creaDivRuoliPart('Interno:' + media(new Array(skills[0], skills[1], skills[5], skills[6], skills[7], skills[9]), 0), ruoli);
creaDivRuoliPart('Ala:' + media(new Array(skills[0], skills[3], skills[5], skills[4], skills[2], skills[16], skills[12], skills[9]), 0), ruoli);
creaDivRuoliPart('Fantasista:' + media(new Array(skills[1], skills[3], skills[5], skills[7], skills[9]), 0), ruoli);
creaDivRuoliPart('Seconda Punta:' + media(new Array(skills[0], skills[1], skills[3], skills[5], skills[7], skills[2], skills[12], skills[9]), 0), ruoli);
creaDivRuoliPart('Pivot:' + media(new Array(skills[3], skills[4], skills[2], skills[6], skills[8], skills[16], skills[12]), 0), ruoli);
creaDivStili('-------------', ruoli);
creaDivRuoliPart('Capitano:' + media(new Array(skills[18], skills[19]), 0), ruoli);
creaDivRuoliPart('Punizioni:' + media(new Array(skills[11], skills[11]), 0), ruoli);
creaDivRuoliPart('Rigori:' + media(new Array(skills[13], skills[13]), 0), ruoli);
creaDivRuoliPart('Rigori Finali:' + media(new Array(skills[13], skills[19]), 0), ruoli);
creaDivStili('Zona P:' + media(new Array(skills[14], skills[14]), 0), stili);
creaDivStili('Fuorig. P:' + media(new Array(skills[4], skills[5], skills[14]), 0), stili);
creaDivStili('Caten. P:' + media(new Array(skills[6], skills[7], skills[10]), 0), stili);
creaDivStili('Controp. P:' + media(new Array(skills[3], skills[3]), 0), stili);
creaDivStili('Lanci P:' + media(new Array(skills[3], skills[3]), 0), stili);
creaDivStili('-------------', stili);
creaDivZona('Zona LD:' + MedCol((skills[14] * 4 + skills[16] * 4 + skills[10] * 2) / 10, 0), stili);
creaDivStili('Uomo:' + media(new Array(skills[2], skills[4]), 0), stili);
creaDivStili('Fuorig. LD:' + media(new Array(skills[0], skills[2], skills[14], skills[16], skills[12]), 0), stili);
creaDivStili('Raddoppio LD:' + media(new Array(skills[0], skills[2], skills[4], skills[10], skills[12]), 0), stili);
creaDivCatenaccio('Caten. LDM:' + MedCol((skills[0] * 2 + skills[4] * 1) / 3, 0), stili);
creaDivStili('Pressing:' + media(new Array(skills[2], skills[4], skills[16]), 0), stili);
creaDivStili('Controp. C:' + media(new Array(skills[3], skills[7], skills[9], skills[16]), 0), stili);
creaDivStili('Controp. TA:' + media(new Array(skills[9], skills[0], skills[3], skills[7], skills[2], skills[14], skills[16]), 0), stili);
creaDivPrima('Prima MCT:' + MedCol((skills[7] * 2 + skills[3] * 2 + skills[5] * 2 + skills[9] + skills[2]) / 8, 0), stili);
creaDivStili('Possesso DMC:' + media(new Array(skills[9], skills[3], skills[5]), 0), stili);
creaDivStili('Lanci LDM CL:' + media(new Array(skills[7], skills[3]), 0), stili);
creaDivStili('Lanci A CL:' + media(new Array(skills[0], skills[2], skills[6]), 0), stili);
creaDivStili('Fasce DMCTA L:' + media(new Array(skills[3], skills[7], skills[5], skills[9], skills[2], skills[16]), 0), stili);
creaDivStili('Fasce TA C:' + media(new Array(skills[6], skills[8]), 0), stili);
creaDivStili('Vie Centr MCT C:' + media(new Array(skills[1], skills[3], skills[4], skills[7], skills[9], skills[14]), 0), stili);
creaDivStili('Vie Centr A C:' + media(new Array(skills[5], skills[12]), 0), stili);
creaDivStili('-------------', stili);
creaDivStili('Movimento in avanti:' + media(new Array(skills[1], skills[7], skills[2], skills[16], skills[12]), 0), stili);;
creaDivStili('Movimento indietro:' + media(new Array(skills[4], skills[2], skills[14], skills[16], skills[12], skills[10]), 0), stili);
creaDivStili('Movimento laterale:' + media(new Array(skills[2], skills[14], skills[16], skills[12] ), 0), stili);
var giovanili = 'S';
for (var i = 0; i < immagini.length; i++)
{
if (endsWith(immagini[i].src, 'add.png'))
{
giovanili = 'N';
}
}
if (giovanili == 'N')
{
var scripts = framePlayer.getElementsByTagName('script');
var ultimoScript = scripts[scripts.length - 2];
ultimoScript.parentNode.insertBefore(tool, ultimoScript);
}
else
{
var tabelle = framePlayer.getElementsByTagName('tbody');
ultimaTabella = tabelle[tabelle.length - 1];
righe = ultimaTabella.getElementsByTagName('tr');
var cell = DOCU.createElement('td');
cell.rowSpan = '11';
cell.appendChild(tool);
righe[0].appendChild(cell);
}
}
//riquadro zona
var zona = DOCU.createElement('div');
zona.id = 'zona';
zona.setAttribute('align', 'right');
zona.innerHTML = '<font size=1 color=white>Zona LD Senza Mar:' + media(new Array(skills[14], skills[16]), 0) + ' </font>';
tool.appendChild(zona);
zona.style.display = 'none';
zona.style.backgroundColor = 'black';
//riquadro pass prima
var prima = DOCU.createElement('div');
prima.id = 'prima';
prima.setAttribute('align', 'right');
prima.innerHTML = '<font size=1 color=white>Prima MCT Senza Dri e Res:' + media(new Array(skills[7], skills[3], skills[5]), 0) + ' </font>';
tool.appendChild(prima);
prima.style.display = 'none';
prima.style.backgroundColor = 'black';
//riquadro catenaccio
var cate = DOCU.createElement('div');
cate.id = 'cate';
cate.setAttribute('align', 'right');
cate.innerHTML = '<font size=1 color=white>Catenaccio LDM Senza Vel:' + media(new Array(skills[4], skills[4]), 0) + ' </font>';
tool.appendChild(cate);
cate.style.display = 'none';
cate.style.backgroundColor = 'black';
}
function creaDivRuoliPart(testo, cella)
{
var DOCU = window.document;
var div = DOCU.createElement('div');
div.style.backgroundColor = 'black';
div.innerHTML = '<font size=1 color=white>' + testo + '</font>';
div.setAttribute('align', 'right');
cella.appendChild(div);
return div;
}
function creaDivCatenaccio(testo, cella)
{
var DOCU = window.document;
var div = DOCU.createElement('div');
div.innerHTML = '<font size=1 color=white><u><i>' + testo + '</u></i></font>';
div.setAttribute('onclick', 'document.getElementById(\'cate\').style.display = \'block\';');
div.setAttribute('align', 'right');
cella.appendChild(div);
return div;
}
function creaDivPrima(testo, cella)
{
var DOCU = window.document;
var div = DOCU.createElement('div');
div.innerHTML = '<font size=1 color=white><u><i>' + testo + '</u></i></font>';
div.setAttribute('onclick', 'document.getElementById(\'prima\').style.display = \'block\';');
div.setAttribute('align', 'right');
cella.appendChild(div);
return div;
}
function creaDivZona(testo, cella)
{
var DOCU = window.document;
var div = DOCU.createElement('div');
div.innerHTML = '<font size=1 color=white><u><i>' + testo + '</u></i></font>';
div.setAttribute('onclick', 'document.getElementById(\'zona\').style.display = \'block\';');
div.setAttribute('align', 'right');
cella.appendChild(div);
return div;
}
function creaDivStili(testo, cella)
{
var DOCU = window.document;
var div = DOCU.createElement('div');
div.innerHTML = '<font size=1 color=white>' + testo + '</font>';
div.setAttribute('align', 'right');
cella.appendChild(div);
return div;
}
function creaCellaStili(testo, row)
{
var DOCU = window.document;
var cell = DOCU.createElement('td');
cell.innerHTML = '<font size=1 color=white>' + testo + '</font>';
row.appendChild(cell);
return cell;
}
function creaCella(testo, row)
{
var DOCU = window.document;
var cell = DOCU.createElement('td');
cell.innerHTML = '<font size=2 color=white>' + testo + '</font>';
row.appendChild(cell);
return cell;
}
function media(ski, tipoblu)
{
var somma = 0;
for (var i = 0; i < ski.length; i++)
{
somma += ski[i];
}
var med = (somma / ski.length);
return MedCol(med, tipoblu);
}
function MedCol(med, tipoblu)
{
med = med.toFixed(1);
var font = '#FF0000';
if (med < 80)
{
if (med < 70)
{
if (med < 60)
{
font = '#FF0000';
}
else
{
font = '#FFAA00';
}
}
else
{
font = '#00DD00';
}
}
else
{
if (tipoblu == 1)
{
font = '#000066';
}
else
{
font = '#4444FF';
}
}
var mediaColorata = '<font color=' + font + '> ' + med + ' </font>';
return mediaColorata;
}
function getFrame()
{
var DOCU = window.document;
var fi = DOCU.getElementsByTagName('iframe');
return fi[0];
}
function endsWith(testString, endingString)
{
if (endingString.length > testString.length) return false;
return testString.indexOf(endingString) == (testString.length - endingString.length);
}