Roulette-a-donjons/051-100/js/index.js

122 lines
2.8 KiB
JavaScript
Raw Permalink Normal View History

2018-07-22 16:03:36 +00:00
$(document).ready(function(){
var quoteSource=[
{
quote: "Château du Wa Wabbit",
name:"Wa Wabbit"
},
{
quote:"Village kanniboul",
name:"Kanniboul Ebil"
},
{
quote:"Clos des Blops",
name:"Blops Royaux"
},
{
quote:"Gelaxième Dimension",
name:"Gelées Royales"
},
{
quote:"Laboratoire de Brumen Tinctorias",
name:"Nelween"
},
{
quote:"Cale de l'Arche d'Otomaï",
name:"Gourlo le Terrible"
},
{
quote:"Donjon des Craqueleurs",
name:"Craqueleur Légendaire"
},
{
quote:"Repaire de Daïgoro",
name:"Daïgoro"
},
{
quote:"Terrier du Wa Wabbit",
name:"Wa Wobot"
},
{
quote:"Cimetière des Mastodontes",
name:"Mantiscore"
},
{
quote:"Antre de la Reine Nyée",
name:"Reine Nyée"
},
{
quote:"Domaine Ancestral",
name:"Abraknyde Ancestral"
},
{
quote:"Bateau du Chouque",
name:"Chouque"
},
{
quote:"Chapiteau des Magik Riktus",
name:"Choudini"
},
{
quote:"Antre du Dragon Cochon",
name:"Dragon Cochon"
},
{
quote:"Caverne du Koulosse",
name:"Koulosse"
},
{
quote:"Tanière du Meulou",
name:"Meulou"
},
{
quote:"Arbre de Moon",
name:"Moon"
},
{
quote:"Théâtre de Dramak",
2018-07-25 13:17:05 +00:00
name:"Maître des Pantins"
2018-07-22 16:03:36 +00:00
},
{
quote:"Fabrique de Malléfisk",
name:"Malléfisk"
},
{
quote:"Tu mérites un peu de repos non ? Reste glander au zaap aujourd'hui.",
name:"La Voix de la Raison"
2018-07-22 16:03:36 +00:00
}
];
$('#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