Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Mathieu Loiseau
GameOfWords
Commits
6e55fefc
Commit
6e55fefc
authored
May 08, 2017
by
Mathieu Loiseau
Browse files
can time stuff as well as count down
parent
4f8fc93c
Changes
2
Hide whitespace changes
Inline
Side-by-side
controllersJS/timer.js
View file @
6e55fefc
...
...
@@ -13,6 +13,8 @@ function MyTimer(render, duration, callback, pressure, pressuriser, onStart){
this
.
render
=
render
;
this
.
timer
=
{};
this
.
running
=
false
;
this
.
startTime
=
0
;
this
.
endTime
=
0
;
if
(
isNaN
(
pressure
)){
this
.
pressure
=
0
;
...
...
@@ -70,6 +72,7 @@ function MyTimer(render, duration, callback, pressure, pressuriser, onStart){
}
self
.
nextClick
=
false
;
self
.
running
=
true
;
self
.
startTime
=
Date
.
now
();
if
(
self
.
clickDuration
%
self
.
clickUnderPressureDuration
===
0
){
self
.
secondPassed
();
}
...
...
@@ -79,8 +82,18 @@ function MyTimer(render, duration, callback, pressure, pressuriser, onStart){
};
this
.
stop
=
function
(){
self
.
endTime
=
Date
.
now
();
self
.
running
=
false
;
window
.
clearTimeout
(
self
.
timer
);
self
.
callback
();
};
this
.
getElapsedTime
=
function
(){
if
(
!
self
.
running
){
return
self
.
endTime
-
self
.
startTime
;
}
else
{
return
Date
.
now
()
-
self
.
startTime
;
}
}
}
views/oracle.alea.html
View file @
6e55fefc
...
...
@@ -21,13 +21,13 @@ include('./views/page.header.html');
<?php } ?>
<fieldset>
<legend
class=
"form-jr-heading"
>
<?php echo $lang['card_creation']; ?>
</legend>
<dl>
<dt><label
for=
"mot"
>
<?php echo $lang['word_to_find']; ?>
</label></dt>
<dd><input
type=
"text"
id=
"mot"
name=
"mot"
required=
"required"
readonly
value=
"<?php echo $this->res['mot']; ?>"
/></dd>
<h3><span
id=
"countdown"
class=
"timer"
></span></h3>
</br><select
id=
"nivcarte"
name=
"nivcarte"
>
<option
value =
"A1"
>
A1
</option>
<option
value =
"A2"
>
A2
</option>
...
...
@@ -36,19 +36,19 @@ include('./views/page.header.html');
<option
value =
"C1"
>
C1
</option>
<option
value =
"C2"
>
C2
</option>
</select>
</br><dt><label
for=
"tabou1"
>
<?php echo $lang['taboo_1']; ?>
</label></dt>
<dd><input
type=
"text"
id=
"tabou1"
name=
"tabou1"
required=
"required"
readonly
value=
"<?php echo $this->res['tabou1']; ?>"
/></dd>
</br><dt><label
for=
"tabou2"
>
<?php echo $lang['taboo_2']; ?>
</label></dt>
<dd><input
type=
"text"
id=
"tabou2"
name=
"tabou2"
required=
"required"
readonly
value=
"<?php echo $this->res['tabou2']; ?>"
/></dd>
</br><dt><label
for=
"tabou3"
>
<?php echo $lang['taboo_3']; ?>
</label></dt>
<dd><input
type=
"text"
id=
"tabou3"
name=
"tabou3"
required=
"required"
readonly
value=
"<?php echo $this->res['tabou3']; ?>"
/></dd>
</br><dt><label
for=
"tabou4"
>
<?php echo $lang['taboo_4']; ?>
</label></dt>
<dd><input
type=
"text"
id=
"tabou4"
name=
"tabou4"
required=
"required"
readonly
value=
"<?php echo $this->res['tabou4']; ?>"
/></dd>
</br><dt><label
for=
"tabou5"
>
<?php echo $lang['taboo_5']; ?>
</label></dt>
<dd><input
type=
"text"
id=
"tabou5"
name=
"tabou5"
required=
"required"
readonly
value=
"<?php echo $this->res['tabou5']; ?>"
/></dd>
...
...
@@ -56,10 +56,10 @@ include('./views/page.header.html');
<div
id=
"form-cmd"
>
<input
class=
"btn btn-primary"
type=
"button"
id=
"random"
name=
"random"
onclick=
"document.location.reload(false)"
value=
"<?php echo $lang['random']; ?>"
/><br/><br/>
<input
class=
"btn btn-lg btn-primary btn-block"
type=
"submit"
id=
"submit_form"
name=
"submit_form"
value=
"<?php echo $lang['validate']; ?>"
class=
"submit_buttons"
/>
<input
type=
"hidden"
name=
"mode"
value=
"<?php echo $this->mode; ?>"
/>
<!-- Informations cachées pour l'enregistrement dans la BDD
<!-- Informations cachées pour l'enregistrement dans la BDD
<input type="hidden" name="userlang" value="<?php// echo $this->userlang; ?>"/>
<input type="hidden" name="userid" value="<?php// echo $this->userid; ?>"/>
<input type="hidden" name="niveau" value="<?php// echo $this->niveau; ?>"/> -->
...
...
@@ -77,7 +77,7 @@ include('./views/page.header.html');
function
renders
(
minutes
,
seconds
){
if
(
seconds
==
Math
.
floor
(
seconds
)){
if
(
seconds
<
10
){
seconds
=
"
0
"
+
seconds
;
seconds
=
"
0
"
+
seconds
;
}
$
(
'
#countdown
'
).
html
(
minutes
+
"
:
"
+
seconds
);
}
...
...
@@ -99,40 +99,40 @@ var monChrono = new MyTimer(renders,<?php echo $this->time; ?>, finChrono, 10,pr
monChrono
.
start
();
</script>
<script
language=
"Javascript"
>
<script
language=
"Javascript"
>
// fonction pour n'afficher que les champs de 3 mots tabous (facile)
function
basculef
(
elem
)
{
document
.
getElementById
(
'
facile
'
).
style
.
visibility
=
"
visible
"
;
document
.
getElementById
(
'
moyen
'
).
style
.
visibility
=
"
hidden
"
;
document
.
getElementById
(
'
difficile
'
).
style
.
visibility
=
"
hidden
"
;
function
basculef
(
elem
)
{
document
.
getElementById
(
'
facile
'
).
style
.
visibility
=
"
visible
"
;
document
.
getElementById
(
'
moyen
'
).
style
.
visibility
=
"
hidden
"
;
document
.
getElementById
(
'
difficile
'
).
style
.
visibility
=
"
hidden
"
;
document
.
getElementById
(
'
tabou4
'
).
value
=
""
;
document
.
getElementById
(
'
tabou5
'
).
value
=
""
;
document
.
getElementById
(
'
tabou4
'
).
required
=
""
;
document
.
getElementById
(
'
tabou5
'
).
required
=
""
;
}
}
// fonction pour n'afficher que les champs de 4 mots tabous (facile+moyen)
function
basculem
(
elem
)
{
document
.
getElementById
(
'
facile
'
).
style
.
visibility
=
"
visible
"
;
document
.
getElementById
(
'
moyen
'
).
style
.
visibility
=
"
visible
"
;
document
.
getElementById
(
'
difficile
'
).
style
.
visibility
=
"
hidden
"
;
function
basculem
(
elem
)
{
document
.
getElementById
(
'
facile
'
).
style
.
visibility
=
"
visible
"
;
document
.
getElementById
(
'
moyen
'
).
style
.
visibility
=
"
visible
"
;
document
.
getElementById
(
'
difficile
'
).
style
.
visibility
=
"
hidden
"
;
document
.
getElementById
(
'
tabou5
'
).
value
=
""
;
document
.
getElementById
(
'
tabou4
'
).
required
=
"
required
"
;
document
.
getElementById
(
'
tabou5
'
).
required
=
""
;
}
// fonction pour afficher les champs de 5 mots tabous (facile+moyen+difficile)
function
basculed
(
elem
)
{
document
.
getElementById
(
'
facile
'
).
style
.
visibility
=
"
visible
"
;
document
.
getElementById
(
'
moyen
'
).
style
.
visibility
=
"
visible
"
;
document
.
getElementById
(
'
difficile
'
).
style
.
visibility
=
"
visible
"
;
function
basculed
(
elem
)
{
document
.
getElementById
(
'
facile
'
).
style
.
visibility
=
"
visible
"
;
document
.
getElementById
(
'
moyen
'
).
style
.
visibility
=
"
visible
"
;
document
.
getElementById
(
'
difficile
'
).
style
.
visibility
=
"
visible
"
;
document
.
getElementById
(
'
tabou4
'
).
required
=
"
required
"
;
document
.
getElementById
(
'
tabou5
'
).
required
=
"
required
"
;
}
</script>
</script>
<?php
include('./views/page.footer.html');
?>
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment