Hébergeur de fichiers indépendant

scriptff.txt

À propos du fichier

Type de fichier
Fichier TXT de 14 Ko (text/plain)
Confidentialité
Fichier public, envoyé le 18 octobre 2015 à 20:49, depuis l'adresse IP 160.92.x.x (France)
Sécurité
Ne contient aucun Virus ou Malware connus - Dernière vérification: 3 jours
Statistiques
La présente page de téléchargement a été vue 705 fois depuis l'envoi du fichier
Page de téléchargement

Aperçu du fichier


// ==UserScript==
// @manifest_version 2.0
// @name        CapitaineEquipeHM FF
// @namespace   HM
// @description Meilleur capitaine avec equipement
// @include     http://*handball*playerobjectmarket.php
// @version     1.1
// @author      Séb
// ==/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 = 16; i <= 16; i++)
    
    for (var i = 1; i <= nbJoueur; 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
        ];
        // nom;intelligence;comment;xp;comment;%cap
        //alert (tabCalcul);    
        var tabCarac = tabJoueur[1].split('short');
        //alert (tabCarac);    
        var tabIntel = tabCarac[nIntel].split('>');
        tabIntel = tabIntel[1].split('+');
        //alert (tabIntel);
        var Intel = tabIntel[0].replace(/[^.0-9-]/g, '');
        //alert (Intel);
        tabCalcul[1] = parseInt(Intel);
        tabCalcul[2] = '	';
        var tabData = tabJoueur[0].split('rapidement');
      
       if(tabData[nXP]==undefined)
          tabData[nXP]='.,0.0</span><span class';
   
     
    
        tabData = tabData[nXP].split('>');
        //alert("------"+tabData[nXP]+"-----");
        var XP = tabData[nXP].replace(/[^.0-9-]/g, '');
       if(XP==undefined)
             XP="0";
     if(XP=='')
             XP="0";
       // alert (XP);
        tabCalcul[3] = Math.min(parseFloat(XP), 5000);
        //    tabCalcul[3]= Math.min(parseInt(XP),5000);
        //alert(tabCalcul[3]);
        tabCalcul[4] = '		';
        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] + '	';
        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 scriptff.txt sur le Web et les réseaux sociaux:


Télécharger le fichier scriptff.txt


Télécharger scriptff.txt