This repository has been archived on 2021-09-15. You can view files and clone it, but cannot push or open issues or pull requests.

100 lines
3.5 KiB
PHP
Raw Normal View History

2015-03-17 12:07:18 +01:00
@extends('frontend/template')
@section('content')
2015-03-17 17:21:37 +01:00
<div style="text-align:center">
2015-03-20 20:02:26 +01:00
<div id="imgRef" style="background-image:url('{{ $ref -> image }}');">
<span id="decompte"></span>
</div>
<br>
2015-03-17 17:21:37 +01:00
2015-03-17 19:24:29 +01:00
<div class="game" onclick="location.href='{{ URL::to('memo') }}'"><img src="imgs/memo/memo2.png"></div>
2015-03-18 11:44:19 +01:00
<div class="game" onclick="location.href='{{ URL::to('puzzle') }}'"><img src="imgs/puzzle/puzzle.png"></div>
2015-03-18 19:47:36 +01:00
2015-03-20 18:38:41 +01:00
<br>
<div style="display:inline-block;">
<img style="height:100px; vertical-align:middle;width:100px" src="{{ URL::to('imgs/trophees/bronze.png') }}"><br>
{{$nbBronze}}
</div>
<div style="display:inline-block;">
<img style="height:100px; vertical-align:middle;width:100px" src="{{ URL::to('imgs/trophees/argent.png') }}"><br>
{{$nbArgent}}
</div>
<div style="display:inline-block;">
<img style="height:100px; vertical-align:middle;width:100px" src="{{ URL::to('imgs/trophees/or.png') }}"><br>
{{$nbOr}}
</div>
</div>
@endsection
2015-03-17 19:35:31 +01:00
@section('page-scripts')
<script>
var redirect;
2015-03-20 20:34:08 +01:00
var i = 3;
2015-03-20 21:10:18 +01:00
var timer = null;
2015-03-20 20:34:08 +01:00
function decompte() {
2015-03-20 20:29:46 +01:00
//on affiche i secondes
2015-03-20 23:47:19 +01:00
document.getElementById("decompte").innerHTML =+i.toString()+" secondes";
2015-03-20 21:03:37 +01:00
if (i == 0)
{
document.getElementById("decompte").innerHTML = "Redirection..."; // quand i atteint 0 on affiche redirection
location.href="{{URL::to('choisirref')}}"; // on redirige
clearInterval(timer); // on stop le timer
}
2015-03-20 20:34:08 +01:00
i = i - 1; //on decremente
2015-03-20 20:29:46 +01:00
}
2015-03-18 12:13:56 +01:00
function absorbEvent_(event) {
var e = event || window.event;
e.preventDefault && e.preventDefault();
e.stopPropagation && e.stopPropagation();
e.cancelBubble = true;
e.returnValue = false;
return false;
}
document.getElementById('imgRef').addEventListener("click", function(event) {
absorbEvent_(event);
2015-03-18 12:03:11 +01:00
return false;
});
2015-03-20 20:22:28 +01:00
2015-03-20 20:29:46 +01:00
2015-03-20 20:22:28 +01:00
2015-03-18 12:13:56 +01:00
document.getElementById('imgRef').addEventListener("mousedown", function(event) {
absorbEvent_(event);
2015-03-20 21:10:18 +01:00
timer = setInterval(function(){ decompte() } , 1000); //intervalle, decompte de 1 secondes
2015-03-20 21:03:37 +01:00
//redirect = setTimeout(function(){location.href="{{URL::to('choisirref')}}"}, 3000);
2015-03-18 11:50:14 +01:00
return false;
2015-03-17 19:35:31 +01:00
2015-03-18 12:09:00 +01:00
});
2015-03-20 20:29:46 +01:00
2015-03-17 19:35:31 +01:00
document.getElementById('imgRef').addEventListener("mouseup", function() {
clearTimeout(redirect);
2015-03-20 21:10:18 +01:00
document.getElementById("decompte").innerHTML =""; //on efface le contenu
i = 3; //on reset le compteur
2015-03-20 20:34:08 +01:00
clearInterval(timer); // on stop le decompte si on relache la souris
2015-03-18 12:00:00 +01:00
return false;
2015-03-17 19:35:31 +01:00
});
2015-03-20 21:58:10 +01:00
// Gestion du tactile, debut du toucher
2015-03-18 12:13:56 +01:00
document.getElementById('imgRef').addEventListener("touchstart", function(event) {
absorbEvent_(event);
2015-03-20 21:39:23 +01:00
timer = setInterval(function(){ decompte() } , 1000); //intervalle, decompte de 1 secondes
2015-03-20 21:03:37 +01:00
//redirect = setTimeout(function(){location.href="{{URL::to('choisirref')}}"}, 3000);
2015-03-18 12:09:00 +01:00
return false;
2015-03-20 20:02:26 +01:00
});
2015-03-18 12:09:00 +01:00
2015-03-20 21:58:10 +01:00
// Gestion du tactile, fin du toucher
2015-03-18 12:09:00 +01:00
document.getElementById('imgRef').addEventListener("touchend", function() {
clearTimeout(redirect);
2015-03-20 21:39:23 +01:00
document.getElementById("decompte").innerHTML =""; //on efface le contenu
i = 3; //on reset le compteur
clearInterval(timer); // on stop le decompte si on relache la souris
2015-03-18 12:09:00 +01:00
return false;
2015-03-20 21:58:10 +01:00
});
2015-03-17 19:35:31 +01:00
</script>
@endsection