102 lines
2.4 KiB
JavaScript
102 lines
2.4 KiB
JavaScript
$(document).ready(function(){
|
|
var quoteSource=[
|
|
{
|
|
quote: "Crypte de Kardorim",
|
|
name:"Kardorim"
|
|
},
|
|
{
|
|
quote:"Grange du Tournesol Affamé",
|
|
name:"Tournesol Affamé"
|
|
},
|
|
{
|
|
quote:"Château Ensablé",
|
|
name:"Mob l'Éponge"
|
|
},
|
|
{
|
|
quote:"Cour du Bouftou Royal",
|
|
name:"Bouftou Royal"
|
|
},
|
|
{
|
|
quote:"Donjon des Scarafeuilles",
|
|
name:"Scarabosse Doré"
|
|
},
|
|
{
|
|
quote:"Donjon des Tofus",
|
|
name:"Botofu"
|
|
},
|
|
{
|
|
quote:"Maison Fantôme",
|
|
name:"Boostache"
|
|
},
|
|
{
|
|
quote:"Donjon des Squelettes",
|
|
name:"Chafer Rōnin"
|
|
},
|
|
{
|
|
quote:"Cache de Kankreblath",
|
|
name:"Kankreblath"
|
|
},
|
|
{
|
|
quote:"Donjon des Bworks",
|
|
name:"Bworkette"
|
|
},
|
|
{
|
|
quote:"Donjon des Forgerons",
|
|
name:"Coffre des Forgerons"
|
|
},
|
|
{
|
|
quote:"Donjon des Larves",
|
|
name:"Shin Larve"
|
|
},
|
|
{
|
|
quote:"Grotte Hesque",
|
|
name:"Corailleur Magistral"
|
|
},
|
|
{
|
|
quote:"Nid du Kwakwa",
|
|
name:"Kwakwa"
|
|
},
|
|
{
|
|
quote:"Caverne des Bulbes",
|
|
name:"Bulbig Brozeur"
|
|
},
|
|
{
|
|
quote:"Tu ne voudrais pas plutôt aller finir les quêtes que tu as en cours ?",
|
|
name:"La Voix de la Raison"
|
|
}
|
|
|
|
];
|
|
|
|
|
|
$('#quoteButton').click(function(evt){
|
|
//define the containers of the info we target
|
|
var quote = $('#quoteContainer p').text();
|
|
var quoteGenius = $('#quoteGenius').text();
|
|
//prevent browser's default action
|
|
evt.preventDefault();
|
|
//getting a new random number to attach to a quote and setting a limit
|
|
var sourceLength = quoteSource.length;
|
|
var randomNumber= Math.floor(Math.random()*sourceLength);
|
|
//set a new quote
|
|
for(i=0;i<=sourceLength;i+=1){
|
|
var newQuoteText = quoteSource[randomNumber].quote;
|
|
var newQuoteGenius = quoteSource[randomNumber].name;
|
|
//console.log(newQuoteText,newQuoteGenius);
|
|
var timeAnimation = 500;
|
|
var quoteContainer = $('#quoteContainer');
|
|
//fade out animation with callback
|
|
quoteContainer.fadeOut(timeAnimation, function(){
|
|
quoteContainer.html('');
|
|
quoteContainer.append('<p>'+newQuoteText+'</p>'+'<p id="quoteGenius">'+'- '+newQuoteGenius+'</p>');
|
|
|
|
//fadein animation.
|
|
quoteContainer.fadeIn(timeAnimation);
|
|
});
|
|
|
|
break;
|
|
};//end for loop
|
|
|
|
});//end quoteButton function
|
|
|
|
|
|
});//end document ready
|