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
KSZK
Schönherz Mátrix
games
Aggregator Backend
Commits
662f1357
Commit
662f1357
authored
Sep 29, 2021
by
Miklós Tóth
🤷
Browse files
Add sounds and hunglify
parent
981f7d0f
Pipeline
#8845
passed with stages
in 1 minute and 23 seconds
Changes
5
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
static/index.html
View file @
662f1357
...
...
@@ -13,6 +13,7 @@
}
.btn
{
transition
:
color
0.5s
,
opacity
0.5s
;
margin
:
.5em
;
}
.cnt
{
position
:
relative
;
...
...
@@ -50,6 +51,10 @@
background
:
#ff0
;
}
.center
{
text-align
:
center
;
}
</style>
<link
rel=
"icon"
type=
"image/png"
href=
"/favicon.png"
/>
...
...
@@ -67,7 +72,10 @@
</table>
</div>
</div>
<button
id=
"vote"
type=
"submit"
class=
"btn btn-primary"
disabled
>
Beküldés
</button>
<div
class=
"center"
>
<button
id=
"vote"
type=
"submit"
class=
"btn btn-primary"
disabled
>
Beküldés
</button>
<button
id=
"snd"
type=
"submit"
class=
"btn btn-primary"
>
Nyomd meg, ha nincsenek hangok
</button>
</div>
</div>
</main>
<script
src=
"https://code.jquery.com/jquery-3.5.1.slim.min.js"
integrity=
"sha384-DfXdz2htPH0lsSSs5nCTpuj/zy4C+OGpamoFVy38MVBnE+IbbVYUew+OrCXaRkfj"
crossorigin=
"anonymous"
></script>
...
...
static/main.js
View file @
662f1357
let
joinAttempts
=
0
const
startSound
=
new
Audio
(
'
start.mp3
'
)
const
stopSound
=
new
Audio
(
'
stop.mp3
'
)
const
sndBtn
=
document
.
getElementById
(
"
snd
"
)
sndBtn
.
onclick
=
()
=>
{
startSound
.
play
()
stopSound
.
play
()
sndBtn
.
style
.
display
=
"
none
"
}
function
loginOrRegister
(
force
){
if
(
joinAttempts
>
5
)
{
throw
lastError
||
"
failed to join
"
throw
lastError
||
"
nem sikerült csatlakozni
"
}
joinAttempts
++
...
...
@@ -74,6 +83,7 @@ function doOnAllRadio(f) {
}
function
start
(){
startSound
.
play
()
voteBtn
.
disabled
=
false
if
(
lastSent
)
lastSent
.
style
.
background
=
""
...
...
@@ -84,11 +94,12 @@ function start(){
}
function
stop
(){
stopSound
.
play
()
voteBtn
.
disabled
=
true
}
function
connect
(){
changeTeamName
(
"
Joining
...
"
)
changeTeamName
(
"
Csatlakozás
...
"
)
}
function
handleResponse
(
action
,
response
){
...
...
@@ -162,7 +173,7 @@ function createSocket() {
sock
.
onclose
=
function
()
{
console
.
log
(
'
close
'
);
changeTeamName
(
"
Disconnected, reconnecting
...
"
);
changeTeamName
(
"
Újracsatlakozás
...
"
);
sock
.
broken
=
true
intervalId
=
setInterval
(()
=>
{
createSocket
()
...
...
static/start.mp3
0 → 100644
View file @
662f1357
File added
static/stop.mp3
0 → 100644
View file @
662f1357
File added
web/socket.go
View file @
662f1357
...
...
@@ -106,7 +106,7 @@ func joinTeam(joinTeamId string, session sockjs.Session, teamId *string, userId
return
}
if
name
==
""
{
handleError
(
session
,
errors
.
New
(
"
team does not exis
t"
),
false
,
"join"
)
handleError
(
session
,
errors
.
New
(
"
nincs ilyen csapa
t"
),
false
,
"join"
)
}
else
{
*
teamId
=
joinTeamId
e
=
logic
.
JoinTeam
(
session
.
Context
(),
userId
,
*
teamId
)
...
...
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