Fix images retour

This commit is contained in:
alexandre-pereira 2015-03-21 16:38:15 +01:00
parent 63407ff378
commit 4915308709
3 changed files with 53 additions and 69 deletions

View File

@ -4,8 +4,7 @@
@section('content')
<div style="text-align:center">
<div id="imgRef" style="background-image:url('{{ $ref -> image }}');">
<span id="decompte"></span>
<div id="imgRef" style="background-image:url('{{ $ref -> image }}'); line-height:100px;font-weight:bold;">
</div>
<br>
@ -31,21 +30,13 @@
@section('page-scripts')
<script>
var redirect;
var i = 3;
var timer = null;
function decompte() {
//on affiche i secondes
document.getElementById("decompte").innerHTML =+i.toString()+" secondes";
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
}
i = i - 1; //on decremente
}
var redirectTimer;
imgRef.innerHTML = '&nbsp;';
function absorbEvent_(event) {
var e = event || window.event;
e.preventDefault && e.preventDefault();
@ -54,46 +45,27 @@
e.returnValue = false;
return false;
}
document.getElementById('imgRef').addEventListener("click", function(event) {
absorbEvent_(event);
return false;
});
document.getElementById('imgRef').addEventListener("mousedown", function(event) {
absorbEvent_(event);
timer = setInterval(function(){ decompte() } , 1000); //intervalle, decompte de 1 secondes
//redirect = setTimeout(function(){location.href="{{URL::to('choisirref')}}"}, 3000);
return false;
});
document.getElementById('imgRef').addEventListener("mouseup", function() {
clearTimeout(redirect);
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
return false;
});
// Gestion du tactile, debut du toucher
document.getElementById('imgRef').addEventListener("touchstart", function(event) {
absorbEvent_(event);
timer = setInterval(function(){ decompte() } , 1000); //intervalle, decompte de 1 secondes
//redirect = setTimeout(function(){location.href="{{URL::to('choisirref')}}"}, 3000);
return false;
});
// Gestion du tactile, fin du toucher
document.getElementById('imgRef').addEventListener("touchend", function() {
clearTimeout(redirect);
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
return false;
});
function startCounter(event) {
absorbEvent_(event);
imgRef.innerHTML = 3;
redirectTimer = setInterval(counter, 1000);
}
function counter() {
imgRef.innerHTML--;
if(imgRef.innerHTML == 0) location.href="{{URL::to('choisirref')}}";
}
function endCounter(event) {
imgRef.innerHTML = '&nbsp;';
clearInterval(redirectTimer);
}
document.getElementById('imgRef').addEventListener("mousedown", startCounter);
document.getElementById('imgRef').addEventListener("touchstart", startCounter);
window.addEventListener("mouseup", endCounter);
window.addEventListener("touchend", endCounter);
</script>
@endsection

View File

@ -63,15 +63,32 @@
}
dateDebut = new Date();
}
function drawGrid() {
pieces.forEach(function(item){
});
var graphics = game.add.graphics(0, 0);
graphics.lineStyle(1, 0xff0000, 1);
graphics.moveTo(800, 0);
graphics.lineTo(100, 0);
}
function create () {
var button = game.make.button(5, 5, 'previous', changePage, this, 2, 1, 0);
game.physics.startSystem(Phaser.Physics.ARCADE);
this.button3 = this.add.button(0, 0, 'previous', changePage);
this.button3.width = 50;
this.button3.height = 50;
this.physics.startSystem(Phaser.Physics.ARCADE);
createPiecesFor(1);
}
function changePage() {
alert("Confirmer ?");
if (confirm('Quitter le jeu ?')) {
location.href = "{{URL::to('/')}}";
} else {
// Do nothing!
}
}
function startDrag(elt) {
elt.placed = false;

View File

@ -7,20 +7,15 @@
</div>
<br>
<button class="level" onclick="location.href='{{ URL::to('puzzle/jouer/1') }}'">
<span style="color:gold;">
<span class="icon-star-full"></span>
</span>
<span class="icon-star-full"></span>
<span class="icon-star-full"></span>
</button>
<span style="color:gold;"><span class="icon-star-full"></span></span><span class="icon-star-full"></span><span class="icon-star-full"></span></button>
<button class="level" onclick="location.href='{{ URL::to('puzzle/jouer/2') }}'"><span style="color:gold;"><span class="icon-star-full"></span><span class="icon-star-full"></span></span><span class="icon-star-full"></span></button>
<button class="level" onclick="location.href='{{ URL::to('puzzle/jouer/3') }}'"><span style="color:gold;"><span class="icon-star-full"></span><span class="icon-star-full"></span><span class="icon-star-full"></span></span></button>
</div>
<div style="position: relative; left: 0; bottom: 400px; padding-left:1%; ">
<a href="/"><img style="height: 80px;" src="{{ URL::to('imgs/previouspage.png') }}"/></a>
<div style="position: fixed; left: 0;top:0;">
<a href="/"><img style="height: 50px; width:50px;" src="{{ URL::to('imgs/previouspage.png') }}"></a>
</div>
@endsection