Sviluppo script info carte

« Older   Newer »
 
  Share  
.
  1.  
    .
    Avatar

    Group
    Supporter
    Posts
    10,643

    Status
    Anonymous
    vedo che la mia idea č stata utile :re:
     
    .
  2.  
    .
    Avatar

    "Da un semplice Uomo sono diventato un Possente Dio"


    Group
    Founder
    Posts
    2,264

    Status
    Offline
    nuova idea che fa risparmiare molto spazio e posso aggiungere un altra cosa utile:
    Ho rimosso la lista delle espansioni con una scritta Espansioni e Valori, se vai col cursore sopra quella scritta visualizzi i nomi delle varie espansioni con all'interno le rarita con i valori.
    Questa modifica oltre che a far risparmiare spazio mi ha permesso di poter aggiungere anche un link al ruling di quella carta.. guardate qui
     
    .
  3.  
    .
    Avatar

    "Da un semplice Uomo sono diventato un Possente Dio"


    Group
    Founder
    Posts
    2,264

    Status
    Offline
    aggiunte due nuove cose.. se la carta č bannata, limitata, semilimitata o illimitata e i suggerimenti sull'utilizzo della carta (combo e altro)
     
    .
  4.  
    .
    Avatar

    "Da un semplice Uomo sono diventato un Possente Dio"


    Group
    Founder
    Posts
    2,264

    Status
    Offline
    La nuvoletta con la lista delle espansioni, rarita e valori non la metto piu cosi dimezzo il lavoro ed i tempi di caricamento dello script.
    Al suo posto verra messo un link al sito dove avrei preso quelle informazioni.
     
    .
  5.  
    .
    Avatar

    "Da un semplice Uomo sono diventato un Possente Dio"


    Group
    Founder
    Posts
    2,264

    Status
    Offline
    A voi piacerebbe che le info fossero caricate alla fine del caricamento della pagina (quindi appesantendo le pagine) oppure soltanto quando col cursore andate sul nome della carta?
    La differenza č che nel primo caso la nuvoletta compare istantaneamente perche č gia stata caricata, mentre nel secondo caso bisogna attendere il caricamento della nuvoletta.
    Nel primo caso c'č anche il rischio di sovraccaricare il server ed il caricamento ad esempio di un topic di deck fixing termina anche dopo 1/3 minuti (anche se la pagina la vedete tutta fin dall'inizio ci mette cosi tanto per caricare le nuvolette)
     
    .
  6.  
    .
    Avatar

    "Da un semplice Uomo sono diventato un Possente Dio"


    Group
    Founder
    Posts
    2,264

    Status
    Offline
    Fatta la parte dello script per le carte mostro che prende: l'immagine, il tipo, l'effetto e lo stato nella banned attuale.

    CODICE
    <?php
    //$yugiohwikia_page = file_get_contents('http://yugioh.wikia.com/wiki/'.$_GET['n']);
    $yugiohwikia_page = 'ciao<title>Combo Master</title><th class="cardtable-header" colspan="3" style="font-size: 1.5em; line-height: 1.5em; background-color: #F93; color: #000;">';
    $mostro_normale = '<th class="cardtable-header" colspan="3" style="font-size: 1.5em; line-height: 1.5em; background-color: #FF3; color: #000;">';
    $mostro_effetto = '<th class="cardtable-header" colspan="3" style="font-size: 1.5em; line-height: 1.5em; background-color: #F93; color: #000;">';
    $mostro_rituale = '<th class="cardtable-header" colspan="3" style="font-size: 1.5em; line-height: 1.5em; background-color: #66F; color: #000;">';
    $mostro_fusione = '<th class="cardtable-header" colspan="3" style="font-size: 1.5em; line-height: 1.5em; background-color: #96C; color: #FFF;">';
    $mostro_synchro = '<th class="cardtable-header" colspan="3" style="font-size: 1.5em; line-height: 1.5em; background-color: #FFF; color: #000;">';
    $mostro_xyz = '<th class="cardtable-header" colspan="3" style="font-size: 1.5em; line-height: 1.5em; background-color: #000; color: #FFF;">';
    $mostro_pendulum = '<th class="cardtable-header" colspan="3" style="font-size: 1.5em; line-height: 1.5em; background-color: ; color: ;">';
    $magia = '<th class="cardtable-header" colspan="3" style="font-size: 1.5em; line-height: 1.5em; background-color: #396; color: #FFF;">';
    $trappola = '<th class="cardtable-header" colspan="3" style="font-size: 1.5em; line-height: 1.5em; background-color: #F36; color: #FFF;">';
    if (strpos($yugiohwikia_page, $mostro_normale) !== false) {
       $tipo = 'mostro_normale';
    }
    if (strpos($yugiohwikia_page, $mostro_effetto) !== false) {
       $tipo = 'mostro_effetto';
    }
    if (strpos($yugiohwikia_page, $mostro_rituale) !== false) {
       $tipo = 'mostro_rituale';
    }
    if (strpos($yugiohwikia_page, $mostro_fusione) !== false) {
       $tipo = 'mostro_fusione';
    }
    if (strpos($yugiohwikia_page, $mostro_synchro) !== false) {
       $tipo = 'mostro_synchro';
    }
    if (strpos($yugiohwikia_page, $mostro_xyz) !== false) {
       $tipo = 'mostro_xyz';
    }
    if (strpos($yugiohwikia_page, $mostro_pendulum) !== false) {
       $tipo = 'mostro_pendulum';
    }
    if (strpos($yugiohwikia_page, $magia) !== false) {
       $tipo = 'magia';
    }
    if (strpos($yugiohwikia_page, $trappola) !== false) {
       $tipo = 'trappola';
    }

    //SCRIPT PER I MOSTRI
    if ($tipo = 'mostro_normale' OR $tipo = 'mostro_effetto' OR $tipo = 'mostro_rituale' OR $tipo = 'mostro_fusione' OR $tipo = 'mostro_synchro' OR $tipo = 'mostro_xyz' OR $tipo = 'mostro_pendulum') {
       $immagine_carta_explode = explode('</tr><tr><td class="cardtable-cardimage" rowspan="91">', $yugiohwikia_page);
       $immagine_carta_explode_due = explode('</td></tr>', $immagine_carta_explode[1]);
       $bannedlist_carta_no_link = strip_tags($immagine_carta_explode_due[0], '<a>');
       $immagine_carta_explode_tre = explode('" src="', $bannedlist_carta_no_link);
       $immagine_carta_explode_quattro = explode('" width="', $immagine_carta_explode_tre[1]);
       $immagine_carta = $immagine_carta_explode_quattro[0];
       $nome_carta_explode =  explode(' - Yu-Gi-Oh!</title>', $yugiohwikia_page);
       $nome_carta_explode_due =  explode('<title>', $nome_carta_explode[0]);
       $nome_carta = $nome_carta_explode_due[1];
       $tipo_carta_explode = explode('<tr id="" class="cardtablerow" style=";"><th id="" class="cardtablerowheader" style=";" scope="row"><a href="/wiki/Type" title="Type">Types</a></th>
           <td id="" class="cardtablerowdata" style=";">', $yugiohwikia_page);
       $tipo_carta_explode_due = explode('</td></tr>', $tipo_carta_explode[1]);
       $tipo_carta = strip_tags($tipo_carta_explode_due[0]);
       $effetto_carta_explode = explode('<b>Card descriptions</b><br />', $yugiohwikia_page);
       $effetto_carta_explode_due = explode('English</span></div></th></tr>
         <tr style="height: 2px;"><td style="border: none;"></td></tr>
         <tr><td class="navbox-list" style="text-align: left; width: 100%; padding: 0px; border: none;">', $effetto_carta_explode[1]);
       $effetto_carta_explode_tre = explode('<b>Card descriptions</b><br />', $effetto_carta_explode_due[1]);
       $effetto_carta_explode_quattro = explode('</td></tr>', $effetto_carta_explode_tre[1]);
       $effetto_carta = strip_tags($effetto_carta_explode_quattro[0]);
       $bannedlist_carta_explode = explode('<tr><th class="cardtablestatusesgroupheader" colspan="8"><i>TCG</i>/<i>OCG</i> statuses</th></tr>', $yugiohwikia_page);
       $bannedlist_carta_explode_due = explode('TCG</a></i> <a href="/wiki/Advanced_Format" title="Advanced Format">Advanced</a></th>', $bannedlist_carta_explode[1]);
       $bannedlist_carta_explode_tre = explode('<th style="width: 12.5%;">', $bannedlist_carta_explode_due[1]);
       $bannedlist_carta = strip_tags($bannedlist_carta_explode_tre[0]);
       
    }

    //SCRIPT PER TRAPPOLE E MAGIE
    if ($tipo = 'magia' OR $tipo = 'trappola') {
       
    }
     
    .
  7.  
    .
    Avatar

    "Da un semplice Uomo sono diventato un Possente Dio"


    Group
    Founder
    Posts
    2,264

    Status
    Offline
    fixato un bug che faceva comparire la scritta English nell'effetto della carta e ora raccoglie le info anche per le magie e le trappole.
    Manca solo la parte grafica ma aspetto i grafici e la parte in javascript che non la so fare LOL

    CODICE
    <?php
    //$yugiohwikia_page = file_get_contents('http://yugioh.wikia.com/wiki/'.$_GET['n']);
    $yugiohwikia_page = 'ciao<title>Combo Master</title><th class="cardtable-header" colspan="3" style="font-size: 1.5em; line-height: 1.5em; background-color: #F93; color: #000;">';
    $mostro_normale = '<th class="cardtable-header" colspan="3" style="font-size: 1.5em; line-height: 1.5em; background-color: #FF3; color: #000;">';
    $mostro_effetto = '<th class="cardtable-header" colspan="3" style="font-size: 1.5em; line-height: 1.5em; background-color: #F93; color: #000;">';
    $mostro_rituale = '<th class="cardtable-header" colspan="3" style="font-size: 1.5em; line-height: 1.5em; background-color: #66F; color: #000;">';
    $mostro_fusione = '<th class="cardtable-header" colspan="3" style="font-size: 1.5em; line-height: 1.5em; background-color: #96C; color: #FFF;">';
    $mostro_synchro = '<th class="cardtable-header" colspan="3" style="font-size: 1.5em; line-height: 1.5em; background-color: #FFF; color: #000;">';
    $mostro_xyz = '<th class="cardtable-header" colspan="3" style="font-size: 1.5em; line-height: 1.5em; background-color: #000; color: #FFF;">';
    $mostro_pendulum = '<th class="cardtable-header" colspan="3" style="font-size: 1.5em; line-height: 1.5em; background-color: ; color: ;">';
    $magia = '<th class="cardtable-header" colspan="3" style="font-size: 1.5em; line-height: 1.5em; background-color: #396; color: #FFF;">';
    $trappola = '<th class="cardtable-header" colspan="3" style="font-size: 1.5em; line-height: 1.5em; background-color: #F36; color: #FFF;">';
    if (strpos($yugiohwikia_page, $mostro_normale) !== false) {
       $tipo = 'mostro_normale';
    }
    if (strpos($yugiohwikia_page, $mostro_effetto) !== false) {
       $tipo = 'mostro_effetto';
    }
    if (strpos($yugiohwikia_page, $mostro_rituale) !== false) {
       $tipo = 'mostro_rituale';
    }
    if (strpos($yugiohwikia_page, $mostro_fusione) !== false) {
       $tipo = 'mostro_fusione';
    }
    if (strpos($yugiohwikia_page, $mostro_synchro) !== false) {
       $tipo = 'mostro_synchro';
    }
    if (strpos($yugiohwikia_page, $mostro_xyz) !== false) {
       $tipo = 'mostro_xyz';
    }
    if (strpos($yugiohwikia_page, $mostro_pendulum) !== false) {
       $tipo = 'mostro_pendulum';
    }
    if (strpos($yugiohwikia_page, $magia) !== false) {
       $tipo = 'magia';
    }
    if (strpos($yugiohwikia_page, $trappola) !== false) {
       $tipo = 'trappola';
    }

    //SCRIPT PER I MOSTRI
    if ($tipo = 'mostro_normale' OR $tipo = 'mostro_effetto' OR $tipo = 'mostro_rituale' OR $tipo = 'mostro_fusione' OR $tipo = 'mostro_synchro' OR $tipo = 'mostro_xyz' OR $tipo = 'mostro_pendulum') {
       $immagine_carta_explode = explode('</tr><tr><td class="cardtable-cardimage" rowspan="91">', $yugiohwikia_page);
       $immagine_carta_explode_due = explode('</td></tr>', $immagine_carta_explode[1]);
       $bannedlist_carta_no_link = strip_tags($immagine_carta_explode_due[0], '<a>');
       $immagine_carta_explode_tre = explode('" src="', $bannedlist_carta_no_link);
       $immagine_carta_explode_quattro = explode('" width="', $immagine_carta_explode_tre[1]);
       $immagine_carta = $immagine_carta_explode_quattro[0];
       $nome_carta_explode =  explode(' - Yu-Gi-Oh!</title>', $yugiohwikia_page);
       $nome_carta_explode_due =  explode('<title>', $nome_carta_explode[0]);
       $nome_carta = $nome_carta_explode_due[1];
       $tipo_carta_explode = explode('<tr id="" class="cardtablerow" style=";"><th id="" class="cardtablerowheader" style=";" scope="row"><a href="/wiki/Type" title="Type">Types</a></th>
           <td id="" class="cardtablerowdata" style=";">', $yugiohwikia_page);
       $tipo_carta_explode_due = explode('</td></tr>', $tipo_carta_explode[1]);
       $tipo_carta = strip_tags($tipo_carta_explode_due[0]);
       $effetto_carta_explode = explode('<b>Card descriptions</b><br />', $yugiohwikia_page);
       $effetto_carta_explode_due = explode('English</span></div></th></tr>
         <tr style="height: 2px;"><td style="border: none;"></td></tr>
         <tr><td class="navbox-list" style="text-align: left; width: 100%; padding: 0px; border: none;">', $effetto_carta_explode[1]);
       $effetto_carta_explode_tre = explode('<b>Card descriptions</b><br />', $effetto_carta_explode_due[1]);
       $effetto_carta_explode_quattro = explode('English</span></div></th></tr>', $effetto_carta_explode_tre[1]);
       $effetto_carta_explode_cinque = explode('</td></tr>', $effetto_carta_explode_quattro[1]);
       $effetto_carta = strip_tags($effetto_carta_explode_cinque[0], '<br>');
       $bannedlist_carta_explode = explode('<tr><th class="cardtablestatusesgroupheader" colspan="8"><i>TCG</i>/<i>OCG</i> statuses</th></tr>', $yugiohwikia_page);
       $bannedlist_carta_explode_due = explode('TCG</a></i> <a href="/wiki/Advanced_Format" title="Advanced Format">Advanced</a></th>', $bannedlist_carta_explode[1]);
       $bannedlist_carta_explode_tre = explode('<th style="width: 12.5%;">', $bannedlist_carta_explode_due[1]);
       $bannedlist_carta = strip_tags($bannedlist_carta_explode_tre[0]);
    }

    //SCRIPT PER LE MAGIE E LE TRAPPOLE
    if ($tipo = 'magia' OR $tipo = 'trappola') {
       $immagine_carta_explode = explode('</tr><tr><td class="cardtable-cardimage" rowspan="91">', $yugiohwikia_page);
       $immagine_carta_explode_due = explode('</td></tr>', $immagine_carta_explode[1]);
       $bannedlist_carta_no_link = strip_tags($immagine_carta_explode_due[0], '<a>');
       $immagine_carta_explode_tre = explode('" src="', $bannedlist_carta_no_link);
       $immagine_carta_explode_quattro = explode('" width="', $immagine_carta_explode_tre[1]);
       $immagine_carta = $immagine_carta_explode_quattro[0];
       $nome_carta_explode =  explode(' - Yu-Gi-Oh!</title>', $yugiohwikia_page);
       $nome_carta_explode_due =  explode('<title>', $nome_carta_explode[0]);
       $nome_carta = $nome_carta_explode_due[1];
       $tipo_carta_explode = explode('<tr id="" class="cardtablerow" style=";"><th id="" class="cardtablerowheader" style=";" scope="row"><a href="/wiki/Property" title="Property">Property</a></th>
           <td id="" class="cardtablerowdata" style=";">', $yugiohwikia_page);
       $tipo_carta_explode_due = explode('</td></tr>', $tipo_carta_explode[1]);
       $tipo_carta = strip_tags($tipo_carta_explode_due[0]);
       $effetto_carta_explode = explode('<b>Card descriptions</b><br />', $yugiohwikia_page);
       $effetto_carta_explode_due = explode('English</span></div></th></tr>
         <tr style="height: 2px;"><td style="border: none;"></td></tr>
         <tr><td class="navbox-list" style="text-align: left; width: 100%; padding: 0px; border: none;">', $effetto_carta_explode[1]);
       $effetto_carta_explode_tre = explode('<b>Card descriptions</b><br />', $effetto_carta_explode_due[1]);
       $effetto_carta_explode_quattro = explode('English</span></div></th></tr>', $effetto_carta_explode_tre[1]);
       $effetto_carta_explode_cinque = explode('</td></tr>', $effetto_carta_explode_quattro[1]);
       $effetto_carta = strip_tags($effetto_carta_explode_cinque[0], '<br>');
       $bannedlist_carta_explode = explode('<tr><th class="cardtablestatusesgroupheader" colspan="8"><i>TCG</i>/<i>OCG</i> statuses</th></tr>', $yugiohwikia_page);
       $bannedlist_carta_explode_due = explode('TCG</a></i> <a href="/wiki/Advanced_Format" title="Advanced Format">Advanced</a></th>', $bannedlist_carta_explode[1]);
       $bannedlist_carta_explode_tre = explode('<th style="width: 12.5%;">', $bannedlist_carta_explode_due[1]);
       $bannedlist_carta = strip_tags($bannedlist_carta_explode_tre[0]);
    }
     
    .
  8.  
    .
    Avatar

    "Da un semplice Uomo sono diventato un Possente Dio"


    Group
    Founder
    Posts
    2,264

    Status
    Offline
    sto cercando di fare la parte in javascript ma non funziona niente -.-
    con questo script vorrei modificare tutte le scritte "Buco Nero" e "buco nero" che si trovano dentro alle classi .post in <a href="#">Buco Nero< /a> quando si clicca sul bottone "Prova"

    CODICE
    <!DOCTYPE html>
    <head>
    <meta charset="UTF-8">
    </head>
    <body>

    <div class="post">
    <p>prova Buco Nero</p>
    <p>Prova buco nero</p>
    <p>prova Dark Hole</p>
    <p>Prova dark hole</p>
    </div>
    <hr>
    <div class="post">
    <p>prova Buco Nero</p>
    <p>Prova buco nero</p>
    <p>prova Dark Hole</p>
    <p>Prova dark hole</p>
    </div>

    <button onclick="myFunction()">Prova</button>

    <script type="text/javascript">
    function myFunction()
    {
    var str = document.getElementsByClassName("post").innerHTML;
    var res = str.replace(/Buco Nero/gi,"<a href='#'>Buco Nero</a>");
    document.getElementsByClassName("post").innerHTML=res;
    </script>

    </body>
    </html>
     
    .
  9. Don Vicč
     
    .

    User deleted


    Sembra interessante questo script.
     
    .
  10.  
    .
    Avatar

    "Da un semplice Uomo sono diventato un Possente Dio"


    Group
    Founder
    Posts
    2,264

    Status
    Offline
    giuro che praticamente tutto quello che so sul javascript l'ho imparato oggi lol
    ecco lo script che cercherā se nei post ci sono dei nomi di carte, e se li trova li mette dentro uno span con la classe script-info-carta.

    potete scrivere: buco nero, Buco Nero; dark hole, Dark Hole, BuCo NeRo o qualsiasi altra combinazione di maiuscole e minuscole e troverā comunque la carta :D

    CODICE
    <script type="text/javascript">
       var nomi_carte = [
       {
       "ita": "Buco Nero",
       "en": "Dark Hole"},
    {
       "ita": "Giudizio Solenne",
       "en": "Solemn Warning"},
    {
       "ita": "Congegno Verde",
       "en": "Green Gadget"},
    {
       "ita": "Congegno Rosso",
       "en": "Red Gadget"}
    ];
       var list = document.getElementsByClassName('post');
       for (indexa = 0; indexa < nomi_carte.length; ++indexa) {
           var nome_carta_ita = nomi_carte[indexa].ita;
           var nome_carta_en = nomi_carte[indexa].en;
           var nome_carta_link = encodeURI(nomi_carte[indexa].en);
           var nome_carta_ita_regexp = new RegExp(nome_carta_ita, "gi");
           var nome_carta_en_regexp = new RegExp(nome_carta_en, "gi");
           for (indexb = 0; indexb < list.length; ++indexb) {
               element = list[indexb];
               element.innerHTML = element.innerHTML.replace(nome_carta_ita_regexp, '<span class="script-info-carta" val="' + nome_carta_link + '">' + nome_carta_ita + '</span>');
               element.innerHTML = element.innerHTML.replace(nome_carta_en_regexp, '<span class="script-info-carta" val="' + nome_carta_link + '">' + nome_carta_en + '</span>');
           }
       }
    </script>
     
    .
  11.  
    .
    Avatar

    "Da un semplice Uomo sono diventato un Possente Dio"


    Group
    Founder
    Posts
    2,264

    Status
    Offline
    la nuvoletta che compare passando il cursore sul nome delle carte verrā preso da questo sito visto che č una cosa complicata da fare (in modo corretto :asd:) e sara fatta in jquery visto che il software per forum ne garantisce la compatibilitā
     
    .
  12. Don Vicč
     
    .

    User deleted


    Vabč l'importante che da l'informazioni della carta,poi il resto č noia. :asd:
     
    .
  13.  
    .
    Avatar

    "Da un semplice Uomo sono diventato un Possente Dio"


    Group
    Founder
    Posts
    2,264

    Status
    Offline
    ecco lo script in jquery riadattato alle nostre esigenze che genera la nuvoletta con dentro le informazioni: eccovi l'esempio funzionante (le info della carta non le carica)
    CODICE
    <link rel="stylesheet" type="text/css" href="http://qtip2.com/v/nightly/jquery.qtip.css">
    <script type="text/javascript" src="http://code.jquery.com/jquery.min.js"></script>
    <script type="text/javascript" src="http://qtip2.com/v/nightly/jquery.qtip.js"></script>
    <script type="text/javascript">
    $(document).ready(function()
    {
        $('span.script-info-carte').each(function() {
            $(this).qtip({
               content: {
                   text: function(event, api) {
                       $.ajax({
                           url: 'http://mastrozappa.altervista.org/info_carta.php?n=' + encodeURIComponent(api.elements.target.attr('title'))
                       })
                       .then(function(content) {
                           api.set('content.text', content);
                       }, function(xhr, status, error) {
                           return 'Errore nel caricamento';
                           api.set('content.text', status + ': ' + error);
                       });
           
                       return 'Caricamento in corso...';
                   }
               },
               show: {
                  event: 'click'
               },
               hide: {
                  event: 'unfocus'
               },
               position: {
                   viewport: $(window)
               },
               style: 'qtip-dark'
            });
        });
    });
    </script>
     
    .
  14.  
    .
    Avatar

    "Da un semplice Uomo sono diventato un Possente Dio"


    Group
    Founder
    Posts
    2,264

    Status
    Offline
    fixato un bug e unito il tooltip allo script che ricerca i nomi delle carte nei post eccovi lo script funzionante qui (non carica ancora le info delle carte)

    CODICE
    <link rel="stylesheet" type="text/css" href="http://qtip2.com/v/nightly/jquery.qtip.css">
    <script type="text/javascript" src="http://code.jquery.com/jquery-2.1.0.min.js"></script>
    <script type="text/javascript" src="http://qtip2.com/v/nightly/jquery.qtip.js"></script>
    <script type="text/javascript">
       var nomi_carte = [
       {
       "ita": "Buco Nero",
       "en": "Dark Hole"},
    {
       "ita": "Giudizio Solenne",
       "en": "Solemn Warning"},
    {
       "ita": "Congegno Verde",
       "en": "Green Gadget"},
    {
       "ita": "Congegno Rosso",
       "en": "Red Gadget"}
    ];
    //CERCA I NOMI DELLE CARTE NEI POST
       var list = document.getElementsByClassName('post');
       for (indexa = 0; indexa < nomi_carte.length; ++indexa) {
           var nome_carta_ita = nomi_carte[indexa].ita;
           var nome_carta_en = nomi_carte[indexa].en;
           var nome_carta_ita_regexp = new RegExp(nome_carta_ita, "gi");
           var nome_carta_en_regexp = new RegExp(nome_carta_en, "gi");
           for (indexb = 0; indexb < list.length; ++indexb) {
               element = list[indexb];
               element.innerHTML = element.innerHTML.replace(nome_carta_en_regexp, '<span class="script-info-carta" title="' + nome_carta_en + '">' + nome_carta_en + '</span>');
               element.innerHTML = element.innerHTML.replace(nome_carta_ita_regexp, '<span class="script-info-carta" title="' + nome_carta_en + '">' + nome_carta_ita + '</span>');
           }
       }

    //TOOLTIP + AJAX
    $(document).ready(function()
    {
        $('.post .script-info-carta').each(function() {
            $(this).qtip({
               content: {
                   text: function(event, api) {
                       $.ajax({
                           url: 'http://mastrozappa.altervista.org/info_carta.php?n=' + encodeURIComponent(api.elements.target.attr('title'))
                       })
                       .then(function(content) {
                           api.set('content.text', content);
                       }, function(xhr, status, error) {
                           return 'Errore nel caricamento';
                           api.set('content.text', status + ': ' + error);
                       });
           
                       return 'Caricamento in corso...';
                   }
               },
               show: {
                  event: 'click'
               },
               hide: {
                  event: 'unfocus'
               },
               position: {
                   viewport: $(window)
               },
               style: 'qtip-dark'
            });
        });
    });
    </script>
     
    .
  15. Don Vicč
     
    .

    User deleted


    Ottimo ora cosa ti manca?
     
    .
48 replies since 24/4/2014, 21:06   735 views
  Share  
.
Top