Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
T
Testat RockPaperScissoirs
Manage
Activity
Members
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Package Registry
Operate
Terraform modules
Analyze
Contributor analytics
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
OST
WE1
Testat RockPaperScissoirs
Compare revisions
bb86681e267e1b90efefb5dbf2810febede2b01a to 06dfe29d71074abd9c79f401af55bf28bdbb024b
Compare revisions
Changes are shown as if the
source
revision was being merged into the
target
revision.
Learn more about comparing revisions.
Source
ost/we1/testat-rockpaperscissoirs
Select target project
No results found
06dfe29d71074abd9c79f401af55bf28bdbb024b
Select Git revision
Swap
Target
ost/we1/testat-rockpaperscissoirs
Select target project
ost/we1/testat-rockpaperscissoirs
1 result
bb86681e267e1b90efefb5dbf2810febede2b01a
Select Git revision
Show changes
Only incoming changes from source
Include changes to target since source was created
Compare
Commits on Source (3)
fixup! html peer review fixups
· e9dffcc4
Andri Joos
authored
2 years ago
e9dffcc4
fixup! main.js peer review fixups
· 8c7940db
Andri Joos
authored
2 years ago
8c7940db
fixup! css peer review fixups
· 06dfe29d
Andri Joos
authored
2 years ago
06dfe29d
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
TestatVorlage/schere-stein-papier.html
+1
-1
1 addition, 1 deletion
TestatVorlage/schere-stein-papier.html
TestatVorlage/scripts/main.js
+8
-1
8 additions, 1 deletion
TestatVorlage/scripts/main.js
TestatVorlage/styles/global.css
+8
-0
8 additions, 0 deletions
TestatVorlage/styles/global.css
with
17 additions
and
2 deletions
TestatVorlage/schere-stein-papier.html
View file @
06dfe29d
...
...
@@ -31,7 +31,7 @@
<div
id=
"game"
>
<label
id=
"username-display"
></label>
<div
id=
"options"
>
<div
id=
"options"
class=
"options-enabled"
>
<button
class=
"option"
id=
"rock"
>
Rock
</button>
<button
class=
"option"
id=
"paper"
>
Paper
</button>
<button
class=
"option"
id=
"scissors"
>
Scissors
</button>
...
...
This diff is collapsed.
Click to expand it.
TestatVorlage/scripts/main.js
View file @
06dfe29d
...
...
@@ -21,13 +21,16 @@ const historyTableBody = document.querySelector('#history');
const
usernameDisplay
=
document
.
querySelector
(
'
#username-display
'
);
let
username
=
''
;
const
notWonClass
=
'
lost-draw-color
'
;
const
wonClass
=
'
win-color
'
;
const
visibleClass
=
'
visible
'
;
const
hiddenClass
=
'
hidden
'
;
const
optionsDisabledClass
=
'
options-disabled
'
;
const
optionsEnabledClass
=
'
options-enabled
'
;
function
addToHistory
(
userHand
,
opponentHand
,
winText
)
{
historyTableBody
.
innerHTML
+
=
`<tr><td>
${
winText
}
</td>\t<td>
${
userHand
}
</td>\t<td>
${
opponentHand
}
\n</td></tr>`
;
historyTableBody
.
innerHTML
=
`<tr><td>
${
winText
}
</td>\t<td>
${
userHand
}
</td>\t<td>
${
opponentHand
}
\n</td></tr>
${
historyTableBody
.
innerHTML
}
`
;
}
function
handleOpponentPicked
(
userHand
,
opponentHand
,
gameEval
)
{
...
...
@@ -46,6 +49,8 @@ function handleOpponentPicked(userHand, opponentHand, gameEval) {
}
addToHistory
(
userHand
,
opponentHand
,
winText
);
options
.
classList
.
replace
(
optionsDisabledClass
,
optionsEnabledClass
);
}
function
showRankings
(
rankings
)
{
...
...
@@ -75,6 +80,8 @@ function onOptionClick(event) {
opponentHandLabel
.
classList
.
replace
(
wonClass
,
notWonClass
);
}
options
.
classList
.
replace
(
optionsEnabledClass
,
optionsDisabledClass
);
evaluateHand
(
username
,
userHand
,
({
systemHand
,
gameEval
,
...
...
This diff is collapsed.
Click to expand it.
TestatVorlage/styles/global.css
View file @
06dfe29d
...
...
@@ -60,3 +60,11 @@ td {
.visible
{
display
:
block
;
}
.options-disabled
{
pointer-events
:
none
;
}
.options-enabled
{
pointer-events
:
auto
;
}
This diff is collapsed.
Click to expand it.