2016-07-17 08:27:59 +00:00
|
|
|
<?php define('__ROOT__', dirname(dirname(dirname(__FILE__))) );
|
|
|
|
require_once __ROOT__.'/manager/autoloader.php';
|
2016-07-15 14:09:49 +00:00
|
|
|
|
|
|
|
$_SESSION['history'] = [];
|
|
|
|
|
2016-07-17 08:27:59 +00:00
|
|
|
if( !isset($_COOKIE['mac_password']) || !isset($_COOKIE['mac_count']) ){
|
2016-07-17 16:22:04 +00:00
|
|
|
$_COOKIE['mac_count'] = 10;
|
2016-07-17 08:27:59 +00:00
|
|
|
$_COOKIE['mac_password'] = 'macPassword';
|
|
|
|
|
|
|
|
setcookie('mac_count', $_COOKIE['mac_count'], time()+3600*24*365, '/');
|
|
|
|
setcookie('mac_password', $_COOKIE['mac_password'], time()+3600*24*365, '/');
|
|
|
|
|
|
|
|
header('Refresh: 0');
|
|
|
|
}
|
|
|
|
|
2016-07-15 14:09:49 +00:00
|
|
|
?>
|
2016-07-18 08:28:18 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2016-07-15 14:09:49 +00:00
|
|
|
<!DOCTYPE html>
|
|
|
|
<html>
|
|
|
|
<head>
|
|
|
|
<meta charset="utf-8">
|
|
|
|
<title>Virtual Client</title>
|
|
|
|
|
|
|
|
|
2016-07-18 14:11:58 +00:00
|
|
|
<script type='text/javascript' src='/js/lib/reset.js' ></script> <!-- Corrections Javascript natif (ajouts) -->
|
|
|
|
<script type='text/javascript' src='/js/lib/api.js' ></script> <!-- Gestion des transactions avec le serveur -->
|
|
|
|
<script type='text/javascript' src='/js/lib/page-manager.js' ></script> <!-- Gestion réseau/chargement/liens/URL -->
|
|
|
|
<script type='text/javascript' src='/js/lib/form-deflater.js' ></script> <!-- Gestion des formulaires (Object) -->
|
|
|
|
<script type='text/javascript' src='/js/lib/local-storage-interface.js' ></script> <!-- Interface pour le 'localStorage' -->
|
2016-07-18 22:15:25 +00:00
|
|
|
<script type='text/javascript' src='/test/client/lib.js' ></script> <!-- Dépendance Directe -->
|
2016-07-17 16:22:04 +00:00
|
|
|
<style type='text/css'>
|
|
|
|
body{
|
|
|
|
background: #1c384b;
|
|
|
|
font-size: 16px;
|
|
|
|
font-family: 'Roboto';
|
|
|
|
}
|
2016-07-15 14:09:49 +00:00
|
|
|
|
2016-07-17 16:22:04 +00:00
|
|
|
#machine-box{
|
|
|
|
position: absolute;
|
|
|
|
top: 40%;
|
|
|
|
left: 60%;
|
|
|
|
width: 20em;
|
|
|
|
height: 35em;
|
2016-07-15 14:09:49 +00:00
|
|
|
|
2016-07-17 16:22:04 +00:00
|
|
|
border-radius: 10px;
|
|
|
|
border: 2px solid #1a1a1a;
|
|
|
|
box-shadow: 0 0 2em #172e3d;
|
2016-07-15 14:09:49 +00:00
|
|
|
|
2016-07-17 16:22:04 +00:00
|
|
|
background: #222;
|
2016-07-15 14:09:49 +00:00
|
|
|
|
2016-07-17 16:22:04 +00:00
|
|
|
transform: translateX(-50%) translateY(-50%);
|
2016-07-15 14:09:49 +00:00
|
|
|
|
2016-07-17 16:22:04 +00:00
|
|
|
cursor: pointer;
|
|
|
|
}
|
2016-07-15 14:09:49 +00:00
|
|
|
|
2016-07-17 16:22:04 +00:00
|
|
|
#machine-box > #led{
|
|
|
|
position: absolute;
|
|
|
|
top: calc( 20% - 1.5em/2 - 2px/2 );
|
|
|
|
left: calc( 75% - 1.5em/2 - 2px/2 );
|
|
|
|
width: 1.5em;
|
|
|
|
height: 1.5em;
|
2016-07-15 14:09:49 +00:00
|
|
|
|
2016-07-17 16:22:04 +00:00
|
|
|
border-radius: 50% / 50%;
|
|
|
|
border: 2px solid #111;
|
2016-07-15 14:09:49 +00:00
|
|
|
|
2016-07-18 09:54:08 +00:00
|
|
|
background: #000;
|
|
|
|
}
|
|
|
|
|
|
|
|
#machine-box > #r1,
|
|
|
|
#machine-box > #r2{
|
|
|
|
position: absolute;
|
|
|
|
top: calc( 25% - 3em/2 );
|
|
|
|
left: 100%;
|
|
|
|
width: 4em;
|
|
|
|
height: 3em;
|
|
|
|
|
|
|
|
background: #000;
|
|
|
|
|
|
|
|
color: #ccc;
|
|
|
|
text-align: center;
|
|
|
|
line-height: 3em;
|
|
|
|
}
|
|
|
|
#machine-box > #r2{
|
|
|
|
top: calc( 50% - 3em/2 );
|
2016-07-17 16:22:04 +00:00
|
|
|
}
|
2016-07-15 14:09:49 +00:00
|
|
|
|
2016-07-18 13:44:43 +00:00
|
|
|
|
|
|
|
#machine-box > #r1.active,
|
|
|
|
#machine-box > #r2.active{
|
2016-07-18 13:47:04 +00:00
|
|
|
font-weight: bold;
|
2016-07-18 13:44:43 +00:00
|
|
|
color: #18eea9;
|
|
|
|
}
|
|
|
|
|
2016-07-17 16:22:04 +00:00
|
|
|
#card-stack{
|
|
|
|
position: absolute;
|
|
|
|
top: 50%;
|
|
|
|
left: 20%;
|
|
|
|
width: 20em;
|
|
|
|
height: 35em;
|
2016-07-15 14:09:49 +00:00
|
|
|
|
2016-07-17 16:22:04 +00:00
|
|
|
transform: translateX(-50%) translateY(-50%);
|
|
|
|
}
|
2016-07-15 14:09:49 +00:00
|
|
|
|
2016-07-17 16:22:04 +00:00
|
|
|
#card-stack > .card{
|
|
|
|
display: inline-block;
|
|
|
|
position: relative;
|
|
|
|
width: 100%;
|
|
|
|
height: 4em;
|
|
|
|
margin-bottom: .2em;
|
2016-07-15 14:09:49 +00:00
|
|
|
|
2016-07-17 16:22:04 +00:00
|
|
|
border-radius: 10px 10px 0 0;
|
|
|
|
box-shadow: 0 2px 10px #111;
|
2016-07-15 14:09:49 +00:00
|
|
|
|
2016-07-17 16:22:04 +00:00
|
|
|
background: #eee;
|
2016-07-15 14:09:49 +00:00
|
|
|
|
2016-07-17 16:22:04 +00:00
|
|
|
color: #333;
|
|
|
|
font-weight: bold;
|
|
|
|
line-height: 4em;
|
|
|
|
text-align: center;
|
2016-07-15 14:09:49 +00:00
|
|
|
|
2016-07-17 16:22:04 +00:00
|
|
|
transition: all .2s ease-in-out;
|
2016-07-15 14:09:49 +00:00
|
|
|
|
2016-07-17 16:22:04 +00:00
|
|
|
cursor: pointer;
|
|
|
|
}
|
2016-07-15 14:09:49 +00:00
|
|
|
|
2016-07-17 16:22:04 +00:00
|
|
|
#card-stack > .card:hover{
|
|
|
|
background: #fff;
|
|
|
|
color: #000;
|
|
|
|
}
|
2016-07-15 14:09:49 +00:00
|
|
|
|
2016-07-18 13:44:43 +00:00
|
|
|
#card-stack > .card.active{
|
|
|
|
background: #aaa;
|
|
|
|
color: #000;
|
|
|
|
}
|
|
|
|
|
2016-07-18 08:28:18 +00:00
|
|
|
#card-stack > input{
|
|
|
|
display: inline-block;
|
|
|
|
position: relative;
|
|
|
|
width: calc( 100% - 1em*2 );
|
|
|
|
height: calc( 3em - 1em*2 );
|
|
|
|
padding: 1em;
|
|
|
|
margin-bottom: 2em;
|
|
|
|
|
|
|
|
border-radius: 3px;
|
|
|
|
border: 0;
|
|
|
|
|
|
|
|
background: #eee;
|
|
|
|
}
|
|
|
|
|
|
|
|
#sync-button,
|
|
|
|
#card-pass{
|
2016-07-17 16:22:04 +00:00
|
|
|
position: absolute;
|
2016-07-18 08:28:18 +00:00
|
|
|
top: calc( 50% + 29em );
|
2016-07-17 16:22:04 +00:00
|
|
|
left: 60%;
|
|
|
|
padding: 1.5em;
|
2016-07-15 14:09:49 +00:00
|
|
|
|
2016-07-17 16:22:04 +00:00
|
|
|
border-radius: 3px;
|
|
|
|
border: 2px solid #fff;
|
2016-07-15 14:09:49 +00:00
|
|
|
|
2016-07-17 16:22:04 +00:00
|
|
|
background: #1ee18e;
|
2016-07-15 14:09:49 +00:00
|
|
|
|
2016-07-17 16:22:04 +00:00
|
|
|
color: #fff;
|
|
|
|
font-weight: bold;
|
2016-07-18 08:28:18 +00:00
|
|
|
letter-spacing: .15em;
|
2016-07-17 16:22:04 +00:00
|
|
|
text-transform: uppercase;
|
2016-07-15 14:09:49 +00:00
|
|
|
|
2016-07-17 16:22:04 +00:00
|
|
|
transition: all .2s ease-in-out;
|
2016-07-15 14:09:49 +00:00
|
|
|
|
2016-07-17 16:22:04 +00:00
|
|
|
transform: translateX(-50%) translateY(-50%);
|
2016-07-15 14:09:49 +00:00
|
|
|
|
2016-07-17 16:22:04 +00:00
|
|
|
cursor: pointer;
|
|
|
|
}
|
2016-07-15 14:09:49 +00:00
|
|
|
|
2016-07-18 08:28:18 +00:00
|
|
|
#card-pass{
|
|
|
|
top: calc( 40% + 29em );
|
|
|
|
background: #3595ce;
|
|
|
|
}
|
|
|
|
|
2016-07-17 16:22:04 +00:00
|
|
|
#sync-button:hover{
|
|
|
|
background: #1ac47c;
|
|
|
|
}
|
2016-07-15 14:09:49 +00:00
|
|
|
|
2016-07-18 08:28:18 +00:00
|
|
|
#card-pass:hover{
|
|
|
|
background: #2d7dad;
|
|
|
|
}
|
|
|
|
|
2016-07-15 14:09:49 +00:00
|
|
|
|
2016-07-17 16:22:04 +00:00
|
|
|
</style>
|
2016-07-15 14:09:49 +00:00
|
|
|
|
2016-07-17 16:22:04 +00:00
|
|
|
</head>
|
|
|
|
<body>
|
2016-07-15 14:09:49 +00:00
|
|
|
|
|
|
|
|
2016-07-17 16:22:04 +00:00
|
|
|
<div id='machine-box'>
|
|
|
|
<div id='led'></div>
|
2016-07-18 09:54:08 +00:00
|
|
|
<div id='r1'>r1</div>
|
|
|
|
<div id='r2'>r2</div>
|
2016-07-17 16:22:04 +00:00
|
|
|
</div>
|
2016-07-15 14:09:49 +00:00
|
|
|
|
|
|
|
|
2016-07-17 16:22:04 +00:00
|
|
|
<div id='card-stack'>
|
2016-07-18 08:28:18 +00:00
|
|
|
<input id='add-card' placeholder='Code RFID' type='text'>
|
2016-07-17 16:22:04 +00:00
|
|
|
<div class='card'>AB-CD-EF-GH</div>
|
2016-07-19 16:01:16 +00:00
|
|
|
<div class='card'>10-FE-BD-61</div>
|
|
|
|
<div class='card'>92-55-B9-B3</div>
|
2016-07-17 16:22:04 +00:00
|
|
|
</div>
|
2016-07-15 14:09:49 +00:00
|
|
|
|
|
|
|
|
2016-07-18 08:28:18 +00:00
|
|
|
<input type='button' id='card-pass' value='Passer la carte'>
|
2016-07-17 16:22:04 +00:00
|
|
|
<input type='button' id='sync-button' value='Synchronisation'>
|
2016-07-15 14:09:49 +00:00
|
|
|
|
2016-07-17 08:27:59 +00:00
|
|
|
|
|
|
|
|
2016-07-15 14:09:49 +00:00
|
|
|
|
2016-07-17 16:22:04 +00:00
|
|
|
<script type='text/javascript'>
|
|
|
|
/* [0] Initialisation et éléments
|
|
|
|
=========================================================*/
|
2016-07-18 08:28:18 +00:00
|
|
|
/* (1) Etats du système */
|
2016-07-19 10:26:18 +00:00
|
|
|
var STATE = [ 0, 0, 0 ];
|
2016-07-17 16:22:04 +00:00
|
|
|
|
2016-07-18 08:28:18 +00:00
|
|
|
/* (2) Elements du DOM */
|
2016-07-17 16:22:04 +00:00
|
|
|
var mBox = document.getElementById('machine-box');
|
|
|
|
var led = document.getElementById('led');
|
2016-07-18 09:54:08 +00:00
|
|
|
var r1 = document.getElementById('r1');
|
|
|
|
var r2 = document.getElementById('r2');
|
2016-07-17 16:22:04 +00:00
|
|
|
var cBox = document.getElementById('card-stack');
|
2016-07-18 08:28:18 +00:00
|
|
|
var cAdd = document.getElementById('add-card');
|
2016-07-17 16:22:04 +00:00
|
|
|
var sync = document.getElementById('sync-button');
|
2016-07-18 08:28:18 +00:00
|
|
|
var pass = document.getElementById('card-pass');
|
2016-07-17 16:22:04 +00:00
|
|
|
|
2016-07-18 08:28:18 +00:00
|
|
|
/* (3) Variables de suivi */
|
2016-07-19 16:01:16 +00:00
|
|
|
var CARD = null;
|
2016-07-18 08:28:18 +00:00
|
|
|
var lastCard = null;
|
2016-07-18 14:11:58 +00:00
|
|
|
var lsi = new localStorageInterface();
|
|
|
|
lsi.createDataset('STATES.CNF' );
|
|
|
|
lsi.createDataset('ACTIONS.CNF');
|
2016-07-19 09:31:37 +00:00
|
|
|
lsi.createDataset('CHIPS.CNF');
|
2016-07-19 16:01:16 +00:00
|
|
|
lsi.createDataset('PERMISSIONS.CNF' );
|
2016-07-18 14:11:58 +00:00
|
|
|
lsi.createDataset('SERVER.CNF' );
|
|
|
|
lsi.createDataset('HISTORY.LOG');
|
|
|
|
lsi.createDataset('STATES.LOG' );
|
2016-07-18 08:28:18 +00:00
|
|
|
|
|
|
|
/* (4) Récupération des données de fonctionnement */
|
|
|
|
var api = new APIClass('/api/');
|
|
|
|
|
2016-07-19 16:01:16 +00:00
|
|
|
var ACTIONS, STATES, CHIPS, PERMISSIONS;
|
|
|
|
api.send({path: 'machineDefault/init', id_machine: 1}, function(response){
|
|
|
|
lsi.import('ACTIONS.CNF', response.actions);
|
|
|
|
lsi.import('STATES.CNF', response.states);
|
|
|
|
lsi.import('CHIPS.CNF', response.chips);
|
|
|
|
lsi.import('PERMISSIONS.CNF', response.permissions);
|
|
|
|
|
|
|
|
ACTIONS = lsi.export('ACTIONS.CNF');
|
|
|
|
STATES = lsi.export('STATES.CNF');
|
|
|
|
CHIPS = lsi.export('CHIPS.CNF');
|
|
|
|
PERMISSIONS = lsi.export('PERMISSIONS.CNF');
|
|
|
|
}, '643405e1004845c2291c244faab192e3ad493b9dec147c8030475794b0f2fa23');
|
2016-07-17 16:22:04 +00:00
|
|
|
|
2016-07-19 08:33:30 +00:00
|
|
|
/* (5) On initialise la carte + les puces */
|
|
|
|
var board = new Board(50);
|
|
|
|
|
2016-07-19 10:52:14 +00:00
|
|
|
var CHIP = {
|
2016-07-19 08:52:06 +00:00
|
|
|
led: new LedInterface( new Chip('serial', [1, 2, 3]), led ),
|
|
|
|
r1: new RelayInterface( new Chip('serial', [4]), r1 ),
|
|
|
|
r2: new RelayInterface( new Chip('serial', [5]), r2 )
|
2016-07-18 22:15:25 +00:00
|
|
|
};
|
|
|
|
|
2016-07-19 10:52:14 +00:00
|
|
|
var chipList = Object.keys(CHIP);
|
2016-07-19 08:52:06 +00:00
|
|
|
|
|
|
|
// Branchement des puces
|
|
|
|
for( var i = 0 ; i < chipList.length ; i++ )
|
2016-07-19 10:52:14 +00:00
|
|
|
board.plug( CHIP[chipList[i]] );
|
2016-07-19 08:33:30 +00:00
|
|
|
|
2016-07-18 14:46:06 +00:00
|
|
|
|
2016-07-17 16:22:04 +00:00
|
|
|
/* [1] Fonctions
|
|
|
|
=========================================================*/
|
2016-07-18 08:28:18 +00:00
|
|
|
/* (1) Gestion de mise à jour de la led en fonction de l'état
|
|
|
|
---------------------------------------------------------*/
|
2016-07-18 13:44:43 +00:00
|
|
|
function updateChips(){
|
2016-07-19 10:26:18 +00:00
|
|
|
var STATES = lsi.export('STATES.CNF');
|
2016-07-19 10:52:14 +00:00
|
|
|
var CHIPS = lsi.export('CHIPS.CNF');
|
2016-07-19 10:26:18 +00:00
|
|
|
|
2016-07-19 10:52:14 +00:00
|
|
|
/* (1) On vérifie quel état correspond */
|
2016-07-19 10:26:18 +00:00
|
|
|
for( var s in STATES ){
|
|
|
|
|
2016-07-19 10:52:14 +00:00
|
|
|
/* (2) Si l'état correspond */
|
|
|
|
if( previous(STATES[s].global_state, STATE) ){
|
2016-07-19 10:26:18 +00:00
|
|
|
|
2016-07-19 12:55:51 +00:00
|
|
|
console.log('STATE', STATE.join(''), 'matches', STATES[s].global_state);
|
2016-07-19 10:26:18 +00:00
|
|
|
|
2016-07-19 10:52:14 +00:00
|
|
|
/* (3) On applique l'état à chaque CHIP */
|
|
|
|
for( var c in CHIPS ){
|
2016-07-17 16:22:04 +00:00
|
|
|
|
2016-07-19 10:52:14 +00:00
|
|
|
/* (4) Si la puce a bien cet été de défini */
|
|
|
|
if( !CHIPS[c].states.hasOwnProperty(STATES[s].chips[c]) )
|
|
|
|
break;
|
2016-07-18 08:28:18 +00:00
|
|
|
|
2016-07-19 10:52:14 +00:00
|
|
|
/* (5) On récupère les PIN + les VALUES */
|
|
|
|
var pins = CHIPS[c].pins;
|
|
|
|
var values = CHIPS[c].states[STATES[s].chips[c]];
|
2016-07-18 08:28:18 +00:00
|
|
|
|
2016-07-19 10:52:14 +00:00
|
|
|
/* (6) On applique les valeurs */
|
2016-07-19 13:00:52 +00:00
|
|
|
for( var p in pins )
|
2016-07-19 10:52:14 +00:00
|
|
|
board.set( parseInt(pins[p]), parseInt(values[p]) );
|
2016-07-18 08:28:18 +00:00
|
|
|
|
2016-07-19 10:52:14 +00:00
|
|
|
}
|
2016-07-18 08:28:18 +00:00
|
|
|
|
2016-07-19 10:52:14 +00:00
|
|
|
break;
|
|
|
|
}
|
2016-07-18 13:44:43 +00:00
|
|
|
|
2016-07-19 10:52:14 +00:00
|
|
|
}
|
2016-07-17 16:22:04 +00:00
|
|
|
}
|
2016-07-15 14:09:49 +00:00
|
|
|
|
2016-07-18 08:28:18 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* [2] Gestion de l'ajout de carte
|
|
|
|
=========================================================*/
|
|
|
|
cAdd.addEventListener('keyup', function(e){
|
|
|
|
if( e.keyCode == 13 ) cBox.innerHTML += "<div class='card'>"+e.target.value+"</div>";
|
|
|
|
}, false);
|
|
|
|
|
2016-07-19 16:01:16 +00:00
|
|
|
|
2016-07-18 08:28:18 +00:00
|
|
|
/* [3] Gestion de la sélection de carte
|
|
|
|
=========================================================*/
|
|
|
|
cBox.addEventListener('click', function(e){
|
|
|
|
if( e.target.className == 'card' ){
|
2016-07-19 16:01:16 +00:00
|
|
|
CARD = e.target.innerHTML;
|
2016-07-18 13:44:43 +00:00
|
|
|
|
|
|
|
var allCards = document.querySelectorAll('#card-stack .card');
|
|
|
|
for( var i = 0 ; i < allCards.length ; i++ )
|
|
|
|
allCards[i].remClass('active');
|
|
|
|
|
|
|
|
e.target.addClass('active');
|
2016-07-18 08:28:18 +00:00
|
|
|
}
|
|
|
|
}, false);
|
2016-07-19 16:01:16 +00:00
|
|
|
CARD = document.querySelector('#card-stack .card').innerHTML;
|
2016-07-18 13:44:43 +00:00
|
|
|
document.querySelector('#card-stack .card').addClass('active');
|
2016-07-18 08:28:18 +00:00
|
|
|
|
2016-07-19 16:01:16 +00:00
|
|
|
|
2016-07-18 08:28:18 +00:00
|
|
|
/* [4] Passage de carte
|
|
|
|
=========================================================*/
|
2016-07-19 10:26:18 +00:00
|
|
|
var INTERVAL = null;
|
|
|
|
var COUNT = 0;
|
2016-07-19 16:01:16 +00:00
|
|
|
|
2016-07-18 13:44:43 +00:00
|
|
|
|
|
|
|
/* (0) Routine de comptage de temps
|
|
|
|
---------------------------------------------------------*/
|
|
|
|
function countRoutine(){
|
2016-07-19 10:26:18 +00:00
|
|
|
/* (1) Si le TIMEOUT actuel n'est pas défini, on quitte */
|
|
|
|
var exists = false;
|
|
|
|
for( var t in Object.keys(ACTIONS) )
|
|
|
|
if( t == COUNT ) exists = true;
|
|
|
|
|
|
|
|
// Si aucune action pour ce timeout, on quitte
|
|
|
|
if( !exists ) return;
|
|
|
|
|
|
|
|
/* (2) Pour chaque action de ce timeout */
|
|
|
|
for( var a in Object.keys(ACTIONS[COUNT]) ){
|
2016-07-18 13:44:43 +00:00
|
|
|
|
2016-07-19 16:01:16 +00:00
|
|
|
/* (3) On vérifie que l'utilisateur a la permissions d'effectuer l'action */
|
|
|
|
var hasPermission = false;
|
|
|
|
|
|
|
|
// On vérifie parmis toutes les permissions de cette CARTE
|
|
|
|
if( PERMISSIONS.hasOwnProperty(CARD) )
|
|
|
|
for( var i = 0 ; i < PERMISSIONS[CARD].length ; i++ )
|
|
|
|
if( PERMISSIONS[CARD][i] == ACTIONS[COUNT][a].id_action ){
|
|
|
|
hasPermission = true;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
// Si on a pas la permission, on quitte
|
|
|
|
if( !hasPermission ) return;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
console.log( CARD, PERMISSIONS[CARD], ACTIONS[COUNT][a].id_action);
|
|
|
|
|
|
|
|
// Si pas la permission, on fait rien
|
|
|
|
if( !hasPermission ) break;
|
|
|
|
|
|
|
|
/* (4) Si la condition est correcte, On applique la modification de l'état */
|
2016-07-19 10:26:18 +00:00
|
|
|
if( previous(ACTIONS[COUNT][a].previous, STATE) ){
|
|
|
|
action(ACTIONS[COUNT][a].action, STATE);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
2016-07-18 13:44:43 +00:00
|
|
|
|
|
|
|
updateChips();
|
2016-07-19 10:26:18 +00:00
|
|
|
COUNT++;
|
2016-07-18 13:44:43 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/* (1) Appui carte
|
|
|
|
---------------------------------------------------------*/
|
|
|
|
pass.addEventListener('mousedown', function(e){
|
|
|
|
COUNT = 0;
|
|
|
|
|
|
|
|
countRoutine();
|
|
|
|
INTERVAL = setInterval( countRoutine, 1000 );
|
|
|
|
|
|
|
|
}, false);
|
|
|
|
|
|
|
|
/* (2) Levé carte
|
|
|
|
---------------------------------------------------------*/
|
2016-07-18 14:46:06 +00:00
|
|
|
window.addEventListener('mouseup', function(e){
|
2016-07-18 13:47:04 +00:00
|
|
|
clearInterval(INTERVAL);
|
2016-07-18 13:44:43 +00:00
|
|
|
}, false);
|
2016-07-18 08:28:18 +00:00
|
|
|
|
2016-07-15 14:09:49 +00:00
|
|
|
</script>
|
|
|
|
</body>
|
|
|
|
</html>
|