CapitainEquipeChrome.js
À propos du fichier
- Type de fichier
- Fichier JS de 13 Ko (text/plain)
- Confidentialité
- Fichier public, envoyé le 30 septembre 2013 à 15:21, depuis l'adresse IP 88.161.x.x (France)
- Sécurité
- Ne contient aucun Virus ou Malware connus - Dernière vérification: 12 heures
- Statistiques
- La présente page de téléchargement a été vue 964 fois depuis l'envoi du fichier
- Page de téléchargement
-
Aperçu du fichier
// ==UserScript==
// @manifest_version 2.0
// @name CapitaineEquipe
// @namespace Football Master
// @description Meilleur capitaine avec equipement
// @include http://*football*player*.php
// @version 1.1
// @author Arixo
// ==/UserScript==
// declarations
var nIntel = 5;
var nXP = 1;
var nName = 1;
var joueurs;
var tabCap = new Array();
var tabCalcul = new Array();
var newDiv = new Array();
var footDiv = new Array();
var fiches = [];
var barreVide;
var titreBarre;
var valeurJoueur;
var valeurBarre;
var val;
var caracCourte;
var caracLongue;
var choixAffichage = "FOOTER"; /* LONG ou COURT ou FOOTER */
/*****************************************************************************/
Array.prototype.max = function ()
{
return Math.max.apply(Math, this);
};
function insertAfter(newElement,targetElement)
{
//target is what you want it to go after. Look for this elements parent.
var parent = targetElement.parentNode;
//if the parents lastchild is the targetElement...
if(parent.lastchild == targetElement)
{
//add the newElement after the target element.
parent.appendChild(newElement);
}
else
{
// else the target has siblings, insert the new element between the target and it's next sibling.
parent.insertBefore(newElement, targetElement.nextSibling);
}
} ;
function getJoueurs(e,attr)
{
var tab = [];
if (e.getAttribute && e.hasAttribute(attr))
tab.push(e);
var n = e.firstChild;
if (n==null) return tab;
do
{
tab = tab.concat(getJoueurs(n,attr));
}while((n = n.nextSibling)!=null)
return tab;
}
function electionCapitaine()
{
var Capitaine;
/* selection du bonus maximum */
var max = [tabCap[1][5],tabCap[2][5],tabCap[3][5],tabCap[4][5],
tabCap[5][5],tabCap[6][5],tabCap[7][5],tabCap[8][5],
tabCap[9][5],tabCap[10][5],tabCap[11][5]].max();
/* recherche du nom joueur correspondant a la valeur max */
if (max == tabCap[1][5]) Capitaine = tabCap[1][0];
else if (max == tabCap[2][5]) Capitaine = tabCap[2][0];
else if (max == tabCap[3][5]) Capitaine = tabCap[3][0];
else if (max == tabCap[4][5]) Capitaine = tabCap[4][0];
else if (max == tabCap[5][5]) Capitaine = tabCap[5][0];
else if (max == tabCap[6][5]) Capitaine = tabCap[6][0];
else if (max == tabCap[7][5]) Capitaine = tabCap[7][0];
else if (max == tabCap[8][5]) Capitaine = tabCap[8][0];
else if (max == tabCap[9][5]) Capitaine = tabCap[9][0];
else if (max == tabCap[10][5]) Capitaine = tabCap[10][0];
else if (max == tabCap[11][5]) Capitaine = tabCap[11][0];
var pourCent = Math.round (max * 1000) / 1000;
var selection = "Meilleur capitaine pour les 11 joueurs sélectionnés : " + Capitaine + " ==> " + pourCent + "%";
//alert (selection);
/* creation du noeud */
var newSpan = document.createElement("span");
newSpan.setAttribute("id","meilleurCapitaine");
newSpan.setAttribute("class", "button button-black");
var resultat = document.createTextNode(selection);
newSpan.appendChild(resultat);
/* affichage */
var table = document.getElementById("column");
var refEquipe = table.parentNode;
refEquipe.insertBefore(newSpan,table);
};
/*****************************************************************************/
/*******************************/
/* configuration selon la page */
/*******************************/
var page1 = "objetsJoueursOnglet";
var page2 = "encheresJoueursOnglet";
var page3 = "marcheJoueursOnglet";
if(document.getElementById(page1))
{
var page = page1;
var nb_child = 1; /* no child premier joueur */
}
else
{
//alert("page 1 inconnue ...");
if(document.getElementById(page2))
{
var page = page2;
var nb_child = 5; /* no child premier joueur */
}
else
{
//alert("page 2 inconnue ...");
if(document.getElementById(page3))
{
var page = page3;
var nb_child = 3; /* no child premier joueur */
}
else
{
//alert("page 3 inconnue !");
var page = "?";
var nb_child = -1;
}
}
}
if (nb_child > 0)
{
var listeNoeud = document.getElementById(page);
fiches = getJoueurs(listeNoeud,"playerid");
//alert(fiches[0].innerHTML);
nbJoueur = (fiches.length) ;
//alert("Page:" + page + ", Nb Joueur: " + nbJoueur);
//joueurs = fiches.children;
joueurs = fiches;
// ajout pub A&S
var colonne = document.getElementById("column");
var lienPub = document.createElement("a");
var imagePub = document.createElement("img")
lienPub.setAttribute("href","http://w-game.net");
lienPub.setAttribute("target","_blank");
lienPub.setAttribute("alt","Assaut&Stratégie, contactez arixo !");
imagePub.setAttribute("src","http://w-game.net/template/standard/wg.fr.jpg");
imagePub.setAttribute("height","40");
imagePub.setAttribute("width","296");
lienPub.appendChild(imagePub);
//insertAfter(lienPub,colonne.children[1].children[3].children[0].children[1]);
/***********************************/
/* recuperation des valeurs utiles */
/***********************************/
for(var i = 1; i <= nbJoueur; i++)
//for(var i = 1; i <= 1; i++)
{
/*************************************/
/* recuperation des elements joueurs */
/*************************************/
var ficheJoueur = fiches[i-1].innerHTML;
//alert(ficheJoueur);
var tabJoueur = ficheJoueur.split("characteristics");
//alert(tabJoueur);
var tabCalcul = ["",1,"",1.0,"",0.0]; // nom;intelligence;comment;xp;comment;%cap
//alert (tabCalcul);
var tabCarac = tabJoueur[1].split("short");
//alert (tabCarac);
var tabIntel = tabCarac[nIntel].split(">");
// for(var k = 1; k <= 5; k++)
//{
// alert(k + "----- " + tabIntel[k]);
//}
//alert("tabIntel ====" + tabIntel);
//tabIntel = tabIntel[2].split("(");
//alert (tabIntel);
// var Intel = tabIntel[0].replace (/[^.0-9-]/g,"");
var Intel = tabIntel[2].split("(");
//alert(Intel);
tabCalcul[1]= parseInt(Intel[0]);
//alert ("Intelligence : " + tabCalcul[1]);
tabCalcul[2]= "\t";
var tabData = tabJoueur[0].split("rapidement");
tabData = tabData[0].split("experience");
tabData = tabData[1].split("<");
//alert("tabData 1 ===== " + tabData[1]);
var XP = tabData[0].replace (/[^.0-9-]/g,"");
//alert (XP);
tabCalcul[3]= Math.min(parseFloat(XP),5000);
// tabCalcul[3]= Math.min(parseInt(XP),5000);
//alert(tabCalcul[3]);
tabCalcul[4]= "\t\t";
tabCalcul[5]= (tabCalcul[3] / 500 + tabCalcul[1] / 100);
tabCalcul[5] = Math.round (tabCalcul[5] * 1000) / 1000; /* arrondi a 0.001 */
//alert(tabCalcul[5]);
var tabNameJoueur = ficheJoueur.split("pays"); ///// PB :::
var name = tabNameJoueur[2].split('>');
var nameTxt = name[1].split('<');
tabCalcul[0]= nameTxt[0]+"\t";
tabCap[i] = tabCalcul;
//alert (tabCap[i]);
/* affichage */
newDiv[i] = document.createElement("div");
if (choixAffichage == "FOOTER")
{
/* A TESTER apres div InnerElement meme niveau que extra name content state
<div class="extra-footer">
<div class="characteristic long" style="margin-top: 10px; padding-top: 5px; border-top: 1px solid #666;">
<span class="value">Position 1/6</span>
<span class="title">Chances de sélection</span>
<span class="bar player">
<span class="natural" style="background-position: -102px -12px;"></span>
</span>
</div>
</div>
*/
footDiv[i] = document.createElement("div");
footDiv[i].setAttribute("class", "extra-footer");
footDiv[i].appendChild(newDiv[i]);
caracLongue = joueurs[i-1].children[0].children[0].children[0].children[2];
newDiv[i].setAttribute("class",("characteristic long"));
/* changement taille carte joueur */
joueurs[i-1].style.height="280px";
joueurs[i-1].children[0].style.height="280px";
joueurs[i-1].children[1].style.height="276px";
/* creation titre de la barre */
titreBarre = document.createElement("span");
titreBarre.setAttribute("class", "title");
newDiv[i].appendChild(titreBarre);
valeurJoueur = document.createTextNode("Bonus capitaine");
titreBarre.appendChild(valeurJoueur);
/* creation bar player */
barreVide = document.createElement("span");
barreVide.setAttribute("class", "bar player");
newDiv[i].appendChild(barreVide);
/* creation natural */
valeurBarre = document.createElement("span");
valeurBarre.setAttribute("class", "natural");
valeurBarre.setAttribute("style",("background-position: "+(-300+Math.round(2*tabCalcul[5]))+"px -36px;"));
valeurBarre.setAttribute("data-energy",Math.round(tabCalcul[5]));
barreVide.appendChild(valeurBarre);
barreVide = document.createElement("span");
barreVide.setAttribute("class", "natural-time");
valeurBarre.appendChild(barreVide);
valeurJoueur = document.createTextNode(tabCalcul[5]+"%");
barreVide.appendChild(valeurJoueur);
/* accrochage objet */
refJoueur = caracLongue.children[1];
insertAfter(footDiv[i],refJoueur);
}
if (choixAffichage == "LONG")
{
caracLongue = joueurs[i-1].children[0].children[0].children[0].children[2];
newDiv[i].setAttribute("class",("characteristic long"));
/* changement taille carte joueur */
joueurs[i-1].style.height="280px";
joueurs[i-1].children[0].style.height="280px";
joueurs[i-1].children[1].style.height="276px";
/* creation titre de la barre */
titreBarre = document.createElement("span");
titreBarre.setAttribute("class", "title");
newDiv[i].appendChild(titreBarre);
valeurJoueur = document.createTextNode("Bonus capitaine");
titreBarre.appendChild(valeurJoueur);
/* creation bar player */
barreVide = document.createElement("span");
barreVide.setAttribute("class", "bar player");
newDiv[i].appendChild(barreVide);
/* creation natural */
valeurBarre = document.createElement("span");
valeurBarre.setAttribute("class", "natural");
valeurBarre.setAttribute("style",("background-position: "+(-300+Math.round(2*tabCalcul[5]))+"px -36px;"));
valeurBarre.setAttribute("data-energy",Math.round(tabCalcul[5]));
barreVide.appendChild(valeurBarre);
barreVide = document.createElement("span");
barreVide.setAttribute("class", "natural-time");
valeurBarre.appendChild(barreVide);
valeurJoueur = document.createTextNode(tabCalcul[5]+"%");
barreVide.appendChild(valeurJoueur);
/* accrochage objet */
refJoueur = caracLongue.children[1];
insertAfter(newDiv[i],refJoueur);
}
if (choixAffichage == "COURT")
{
caracCourte = joueurs[i-1].children[0].children[0].children[0].children[1].children[1].children[0];
newDiv[i].setAttribute("class",("characteristic short"));
/* changement taille carte joueur */
joueurs[i-1].style.height="278px";
joueurs[i-1].children[0].style.height="278px";
joueurs[i-1].children[1].style.height="272px";
/* creation titre de la barre */
titreBarre = document.createElement("span");
titreBarre.setAttribute("class", "title");
newDiv[i].appendChild(titreBarre);
valeurJoueur = document.createTextNode("Bonus capitaine");
titreBarre.appendChild(valeurJoueur);
/* creation valeur du titre */
valeurBarre = document.createElement("span");
valeurBarre.setAttribute("class", "value");
newDiv[i].appendChild(valeurBarre);
valeurJoueur = document.createTextNode(tabCalcul[5]+"%");
valeurBarre.appendChild(valeurJoueur);
/* creation bar player */
barreVide = document.createElement("span");
barreVide.setAttribute("id",("bonusCap"+i));
barreVide.setAttribute("class", "bar player");
barreVide.setAttribute("style",("background-position: -182px -108px;"));
newDiv[i].appendChild(barreVide);
/* creation bar bonus */
valeurBarre = document.createElement("span");
valeurBarre.setAttribute("class", "bonus");
valeurBarre.setAttribute("style",("background-position: -300px -12px;"));
barreVide.appendChild(valeurBarre);
/* creation natural */
barreVide = document.createElement("span");
barreVide.setAttribute("class", "natural");
if (tabCalcul[3] == 5000)
barreVide.setAttribute("style",("background-position: "+(-300+Math.round(tabCalcul[5]*118/100))+"px -24px;"));
else
barreVide.setAttribute("style",("background-position: "+(-300+Math.round(tabCalcul[5]*118/100))+"px -36px;"));
valeurBarre.appendChild(barreVide);
/* accrochage objet */
refJoueur = caracCourte.children[4];
insertAfter(newDiv[i],refJoueur);
}
}
electionCapitaine();
}
Partager le fichier CapitainEquipeChrome.js sur le Web et les réseaux sociaux:
Télécharger le fichier CapitainEquipeChrome.js
Télécharger CapitainEquipeChrome.js