Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
G
Go Game Streaming WebApp
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
go-project
Go Game Streaming WebApp
Commits
88144fbf
Unverified
Commit
88144fbf
authored
1 year ago
by
Antoine
Committed by
GitHub
1 year ago
Browse files
Options
Downloads
Patches
Plain Diff
bug fixes
parent
676277fd
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
Historique_test_js.html
+58
-0
58 additions, 0 deletions
Historique_test_js.html
historiquejs.js
+142
-0
142 additions, 0 deletions
historiquejs.js
with
200 additions
and
0 deletions
Historique_test_js.html
0 → 100644
+
58
−
0
View file @
88144fbf
<!DOCTYPE html>
<html
lang=
"fr"
>
<head>
<meta
charset=
"utf-8"
>
<title>
Historique
</title>
<link
href=
"bootstrap/css/bootstrap.css"
rel=
"stylesheet"
>
<link
rel=
"stylesheet"
type=
"text/css"
href=
"styles_test.css"
>
</head>
<body>
<script>
var
longueurHistorique
=
0
;
</script>
<div
class=
"container-fluid text-center bg custom-fond"
>
<div
class=
"row text-danger"
>
<div
class=
"col-5 custom-fond"
>
<a
href =
"Sommaire_test.html"
><button
class=
"btn bg custom-button btn-grand"
>
Retour
</button></a>
</div>
<div
class=
"col-2"
>
<h1><u><b>
Historique
</b></u></h1>
</div>
<div
class=
"col-5 custom-color"
>
<img
src=
"Logo-Tanuki_bleu_ciel.png"
class=
"logo logo-Tenuki"
alt=
"Logo de l'association"
id=
"logo"
>
</div>
</div>
</div>
<div
class=
"container-md text-center bg custom-fond"
>
<div
class=
"row"
>
<h2>
Parties disponibles :
<span
id=
"nbParties"
></span></h2>
<button
onclick=
"actualiser()"
>
Actualiser
</button></br>
<button
onclick=
"reset()"
>
Reset
</button></br>
</div>
<div
class=
"row"
>
<table
id =
"historique"
>
<thead>
<tr>
<th>
Date de réalisation
</th>
<th>
Joueur 1
</th>
<th>
Joueur 2
</th>
<th>
Description
</th>
<th>
Détails
</th>
<th>
Modifier
</th>
</tr>
</thead>
<tbody>
<!-- Lignes existantes (si nécessaire) -->
</tbody>
</table>
</div>
<script
src=
"historiquejs.js"
></script>
</body>
</html>
\ No newline at end of file
This diff is collapsed.
Click to expand it.
historiquejs.js
0 → 100644
+
142
−
0
View file @
88144fbf
var
historique
=
document
.
getElementById
(
'
historique
'
);
if
(
sessionStorage
.
getItem
(
"
key
"
)
!=
null
){
document
.
getElementById
(
"
historique
"
).
innerHTML
=
sessionStorage
.
getItem
(
'
key
'
);
historique
=
document
.
getElementById
(
'
historique
'
);
}
var
urls
=
[];
var
longueurHistorique
=
sessionStorage
.
getItem
(
"
longueurHistorique
"
);
var
nbParties
=
document
.
getElementById
(
"
nbParties
"
);
nbParties
.
textContent
=
longueurHistorique
;
creation
();
function
ajout
(
texte1
,
texte2
,
texte3
)
{
var
table
=
document
.
getElementById
(
"
historique
"
).
getElementsByTagName
(
'
tbody
'
)[
0
];
var
newRow
=
table
.
insertRow
(
longueurHistorique
);
var
dateCell
=
newRow
.
insertCell
(
0
);
var
text1Cell
=
newRow
.
insertCell
(
1
);
var
text2Cell
=
newRow
.
insertCell
(
2
);
var
text3Cell
=
newRow
.
insertCell
(
3
);
var
actionCell
=
newRow
.
insertCell
(
4
);
var
currentDate
=
new
Date
();
dateCell
.
innerHTML
=
currentDate
.
toLocaleDateString
();
text1Cell
.
innerHTML
=
texte1
;
text2Cell
.
innerHTML
=
texte2
;
text3Cell
.
innerHTML
=
texte3
;
urls
.
push
(
"
https://www.example1.com
"
);
var
linkButton
=
document
.
createElement
(
"
button
"
);
linkButton
.
innerHTML
=
"
Détails
"
;
linkButton
.
onclick
=
function
()
{
// Obtenir l'indice de la ligne pour déterminer l'URL correspondante
var
rowIndex
=
newRow
.
rowIndex
-
1
;
// Soustrayez 1 pour gérer l'en-tête
if
(
rowIndex
>=
0
&&
rowIndex
<
urls
.
length
)
{
var
newTab
=
window
.
open
(
urls
[
rowIndex
],
"
_blank
"
);
// Ouvre dans un nouvel onglet
newTab
.
focus
();
}
};
actionCell
.
appendChild
(
linkButton
);
var
longueurHistorique
=
document
.
getElementById
(
"
historique
"
).
getElementsByTagName
(
'
tbody
'
)[
0
].
rows
.
length
;
var
nbParties
=
document
.
getElementById
(
"
nbParties
"
);
nbParties
.
textContent
=
longueurHistorique
;
sessionStorage
.
setItem
(
"
longueurHistorique
"
,
longueurHistorique
.
toString
());
}
function
creation
()
{
var
longueurTab
=
document
.
getElementById
(
"
historique
"
).
getElementsByTagName
(
'
tbody
'
)[
0
].
rows
.
length
;
for
(
i
=
0
;
i
<
longueurTab
;
i
++
)
{
supprimerLigne
(
1
);
}
var
longueurHistorique
=
sessionStorage
.
getItem
(
"
longueurHistorique
"
);
for
(
var
i
=
parseInt
(
longueurHistorique
)
-
1
;
i
>=
0
;
i
--
)
{
var
table
=
document
.
getElementById
(
"
historique
"
).
getElementsByTagName
(
'
tbody
'
)[
0
];
var
newRow
=
table
.
insertRow
(
parseInt
(
longueurHistorique
)
-
1
-
i
);
var
dateCell
=
newRow
.
insertCell
(
0
);
var
text1Cell
=
newRow
.
insertCell
(
1
);
var
text2Cell
=
newRow
.
insertCell
(
2
);
var
text3Cell
=
newRow
.
insertCell
(
3
);
var
actionCell1
=
newRow
.
insertCell
(
4
);
var
actionCell2
=
newRow
.
insertCell
(
5
);
var
currentDate
=
new
Date
();
dateCell
.
innerHTML
=
currentDate
.
toLocaleDateString
();
var
i1
=
3
*
i
;
var
i2
=
3
*
i
+
1
;
var
i3
=
3
*
i
+
2
;
text1Cell
.
innerHTML
=
sessionStorage
.
getItem
(
i1
.
toString
());
text2Cell
.
innerHTML
=
sessionStorage
.
getItem
(
i2
.
toString
());
text3Cell
.
innerHTML
=
sessionStorage
.
getItem
(
i3
.
toString
());
urls
.
push
(
"
https://www.example1.com
"
);
var
linkButton1
=
document
.
createElement
(
"
button
"
);
linkButton1
.
innerHTML
=
"
Détails
"
;
var
linkButton2
=
document
.
createElement
(
"
button
"
);
linkButton2
.
innerHTML
=
"
Modifier
"
;
linkButton1
.
onclick
=
function
()
{
// Obtenir l'indice de la ligne pour déterminer l'URL correspondante
var
rowIndex
=
newRow
.
rowIndex
-
1
;
// Soustrayez 1 pour gérer l'en-tête
if
(
rowIndex
>=
0
&&
rowIndex
<
urls
.
length
)
{
var
newTab
=
window
.
open
(
urls
[
rowIndex
],
"
_blank
"
);
// Ouvre dans un nouvel onglet
newTab
.
focus
();
}
};
linkButton2
.
onclick
=
function
(
index
)
{
return
function
()
{
modifier
(
index
);
};
}(
i
);
actionCell1
.
appendChild
(
linkButton1
);
actionCell2
.
appendChild
(
linkButton2
);
var
longueurHistorique
=
sessionStorage
.
getItem
(
"
longueurHistorique
"
)
var
nbParties
=
document
.
getElementById
(
"
nbParties
"
);
nbParties
.
textContent
=
longueurHistorique
;
}
}
function
actualiser
(){
creation
()
var
longueurHistorique
=
sessionStorage
.
getItem
(
"
longueurHistorique
"
);
var
nbParties
=
document
.
getElementById
(
"
nbParties
"
);
nbParties
.
textContent
=
longueurHistorique
;
}
function
modifier
(
k
){
const
j1
=
window
.
prompt
(
"
Quel est le nom du premier joueur ?
"
);
const
j2
=
window
.
prompt
(
"
Quel est le nom du second joueur ?
"
);
const
desc
=
window
.
prompt
(
"
Description de la partie
"
);
var
key1
=
k
*
3
;
var
key2
=
k
*
3
+
1
;
var
key3
=
k
*
3
+
2
;
if
(
j1
!=
null
){
sessionStorage
.
setItem
(
key1
.
toString
(),
j1
);
}
if
(
j2
!=
null
){
sessionStorage
.
setItem
(
key2
.
toString
(),
j2
);
}
if
(
desc
!=
null
){
sessionStorage
.
setItem
(
key3
.
toString
(),
desc
);
}
creation
();
}
function
supprimerLigne
(
i
){
historique
.
deleteRow
(
i
);
}
function
save
(){
sessionStorage
.
setItem
(
'
key
'
,
document
.
getElementById
(
'
historique
'
).
innerHTML
)
alert
(
"
Sauvegarde effectuée !
"
);
}
function
reset
(){
if
(
window
.
confirm
(
"
Voulez-vous vraiment supprimer la sauvegarde ?
"
)){
longueurHistorique
=
sessionStorage
.
getItem
(
"
longueurHistorique
"
);
for
(
var
i
=
0
;
i
<
3
*
parseInt
(
longueurHistorique
);
i
++
)
{
sessionStorage
.
removeItem
(
i
.
toString
());
};
sessionStorage
.
setItem
(
"
longueurHistorique
"
,
"
0
"
);
actualiser
();
}
}
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment