Skip to content
This repository was archived by the owner on Mar 10, 2019. It is now read-only.

Commit 2477e79

Browse files
committed
Merge branch 'develop'
2 parents fe56c03 + a4da47f commit 2477e79

80 files changed

Lines changed: 4879 additions & 516 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

WebContent/admin/index.html

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
<head>
4+
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
5+
<title>Admin panel - PYX-Reloaded</title>
6+
<link rel="icon" href="/css/images/favicon.ico">
7+
<link rel="icon" type="image/png" sizes="32x32" href="/css/images/icon-32x32.png">
8+
<link rel="icon" type="image/png" sizes="16x16" href="/css/images/icon-16x16.png">
9+
<link rel="stylesheet" href="//unpkg.com/material-components-web@0.32.0/dist/material-components-web.min.css">
10+
<link rel="stylesheet" href="//fonts.googleapis.com/icon?family=Material+Icons">
11+
<link rel="stylesheet" href="//fonts.googleapis.com/css?family=Roboto:300,400,500">
12+
<link rel="stylesheet" href="//cdnjs.cloudflare.com/ajax/libs/noty/3.1.4/noty.min.css"/>
13+
<link rel="stylesheet" href="/css/pyx-reloaded.css">
14+
<script src="//cdn.jsdelivr.net/npm/js-cookie@2/src/js.cookie.min.js"></script>
15+
<script src="/js/theming.js"></script>
16+
</head>
17+
<body class="mdc-typography">
18+
<div class="page-content">
19+
<header class="mdc-toolbar mdc-toolbar--fixed">
20+
<div class="mdc-toolbar__row">
21+
<section class="mdc-toolbar__section mdc-toolbar__section--align-start">
22+
<span class="mdc-toolbar__title">Admin panel - PYX Reloaded</span>
23+
</section>
24+
</div>
25+
</header>
26+
27+
<main class="mdc-toolbar-fixed-adjust" style="padding: 16px">
28+
<button class="mdc-button mdc-button--raised" id="prepareShutdown">Prepare server shutdown</button>
29+
</main>
30+
</div>
31+
32+
<script src="//code.jquery.com/jquery-latest.min.js"></script>
33+
<script src="//cdnjs.cloudflare.com/ajax/libs/list.js/1.5.0/list.min.js"></script>
34+
<script src="//unpkg.com/material-components-web@0.32.0/dist/material-components-web.min.js"></script>
35+
<script src="//cdnjs.cloudflare.com/ajax/libs/noty/3.1.4/noty.min.js"></script>
36+
<script src="/js/communication.helper.js"></script>
37+
<script src="/js/events.helper.js"></script>
38+
<script src="./index.js"></script>
39+
<script>
40+
mdc.autoInit();
41+
load();
42+
</script>
43+
44+
</body>
45+
</html>

WebContent/admin/index.js

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
class AdminPanel {
2+
constructor() {
3+
this.root = $('main');
4+
this.prepareShutdown = this.root.find('#prepareShutdown');
5+
this.prepareShutdown.on('click', () => {
6+
Requester.request("ps", {}, () => {
7+
Notifier.timeout(Notifier.SUCCESS, "Server is preparing for shutdown.");
8+
}, (error) => {
9+
Notifier.error("Failed preparing for shutdown.", error);
10+
})
11+
});
12+
}
13+
}
14+
15+
function load() {
16+
Requester.request("gme", {}, (data) => {
17+
if (data.a === undefined || !data.a.ia) {
18+
Notifier.debug("Not admin: " + JSON.stringify(data), true);
19+
window.location = "/";
20+
}
21+
22+
Notifier.debug(data);
23+
new AdminPanel();
24+
}, (error) => {
25+
Notifier.error("Failed loading!", error);
26+
})
27+
}

WebContent/cardcast/index.html

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,11 @@
11
<!DOCTYPE html>
2-
<html>
2+
<html lang="en">
33
<head>
44
<meta name="viewport" content="width=device-width, initial-scale=1.0">
55
<title>Cardcast - PYX-Reloaded</title>
6+
<link rel="icon" href="/css/images/favicon.ico">
7+
<link rel="icon" type="image/png" sizes="32x32" href="/css/images/icon-32x32.png">
8+
<link rel="icon" type="image/png" sizes="16x16" href="/css/images/icon-16x16.png">
69
<link rel="stylesheet" href="//unpkg.com/material-components-web@0.32.0/dist/material-components-web.min.css">
710
<link rel="stylesheet" href="//fonts.googleapis.com/icon?family=Material+Icons">
811
<link rel="stylesheet" href="//fonts.googleapis.com/css?family=Roboto:300,400,500">
@@ -14,7 +17,6 @@
1417
<link rel="stylesheet" href="./index.css"/>
1518
<script src="//cdn.jsdelivr.net/npm/js-cookie@2/src/js.cookie.min.js"></script>
1619
<script src="/js/theming.js"></script>
17-
<script>Theming.apply();</script>
1820
</head>
1921
<body class="mdc-typography">
2022
<div class="page-content">

WebContent/cardcast/index.js

Lines changed: 26 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -379,38 +379,37 @@ function changePage(page) {
379379
}
380380

381381
function addDeckToGame(code) {
382-
$.post("/AjaxServlet", "o=gme").fail(function (data) {
383-
if ("responseJSON" in data) {
384-
if (data.responseJSON.ec === "nr" || data.responseJSON.ec === "se") {
385-
Notifier.error("You are not registered to the game server.", data, false, true);
386-
return;
387-
}
388-
}
389-
390-
Notifier.error("Failed contacting the server.", data, false, true);
391-
}).done(function (data) {
382+
Requester.request("gme", {}, (data) => {
392383
if (data.gid === -1) {
393384
Notifier.timeout(Notifier.WARN, "You have to be in a game.");
394385
} else {
395-
$.post("/AjaxServlet", "o=cac&gid=" + data.gid + "&cci=" + code).fail(function (data) {
396-
if ("responseJSON" in data) {
397-
switch (data.responseJSON.ec) {
398-
case "ngh":
399-
Notifier.timeout(Notifier.WARN, "You have to be the game host to add the deck.");
400-
break;
401-
case "as":
402-
Notifier.timeout(Notifier.WARN, "The game must be in the lobby state to add the deck.");
403-
break;
404-
default:
405-
Notifier.error("Failed adding the deck.", data, false, true);
406-
break;
407-
}
408-
} else {
409-
Notifier.error("Failed adding the deck.", data, false, true);
410-
}
411-
}).done(function () {
386+
Requester.request("cac", {
387+
"gid": data.gid,
388+
"cci": code
389+
}, () => {
412390
Notifier.timeout(Notifier.SUCCESS, "Successfully added <b>" + code + "</b> to the current game.");
391+
}, (error) => {
392+
switch (error.ec) {
393+
case "ngh":
394+
Notifier.timeout(Notifier.WARN, "You have to be the game host to add the deck.");
395+
break;
396+
case "as":
397+
Notifier.timeout(Notifier.WARN, "The game must be in the lobby state to add the deck.");
398+
break;
399+
default:
400+
Notifier.error("Failed adding the deck.", data, false, true);
401+
break;
402+
}
413403
});
414404
}
405+
}, null, (error) => {
406+
if ("responseJSON" in error && "ec" in error.responseJSON) {
407+
if (error.responseJSON.ec === "nr" || error.responseJSON.ec === "se") {
408+
Notifier.error("You are not registered to the game server.", error, false, true);
409+
return;
410+
}
411+
}
412+
413+
Notifier.error("Failed contacting the server.", error, false, true);
415414
});
416415
}

WebContent/chat/index.html

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,9 @@
33
<head>
44
<meta name="viewport" content="width=device-width, initial-scale=1.0">
55
<title>Global chat - PYX-Reloaded</title>
6+
<link rel="icon" href="/css/images/favicon.ico">
7+
<link rel="icon" type="image/png" sizes="32x32" href="/css/images/icon-32x32.png">
8+
<link rel="icon" type="image/png" sizes="16x16" href="/css/images/icon-16x16.png">
69
<link rel="stylesheet" href="//unpkg.com/material-components-web@0.32.0/dist/material-components-web.min.css">
710
<link rel="stylesheet" href="//fonts.googleapis.com/icon?family=Material+Icons">
811
<link rel="stylesheet" href="//fonts.googleapis.com/css?family=Roboto:300,400,500">
@@ -11,7 +14,6 @@
1114
<link rel="stylesheet" href="./index.css">
1215
<script src="//cdn.jsdelivr.net/npm/js-cookie@2/src/js.cookie.min.js"></script>
1316
<script src="/js/theming.js"></script>
14-
<script>Theming.apply();</script>
1517
</head>
1618
<body class="mdc-typography">
1719
<div class="page-content">
@@ -43,7 +45,7 @@ <h1 class="mdc-typography--display1 message" style="margin-top: 48px">There are
4345

4446
<div style="display: none">
4547
<li class="mdc-list-item" id="chatMessageTemplate">
46-
<img class="mdc-list-item__graphic _img" src="/css/no-profile.svg"/>
48+
<img class="mdc-list-item__graphic _img" src="/css/images/no-profile.svg"/>
4749
<span class="mdc-list-item__text">
4850
<span class="_nick">{{Sender}}</span>
4951
<span class="mdc-list-item__secondary-text _text">{{Message}}</span>

WebContent/chat/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ class ChatManager {
3030
_handleChatMessage(data) {
3131
this.chat.add({
3232
'_nick': data.f,
33-
'_img': data.p === null ? "/css/no-profile.svg" : data.p,
33+
'_img': data.p === null ? "/css/images/no-profile.svg" : data.p,
3434
'_text': data.m
3535
});
3636

WebContent/css/images/favicon.ico

14.7 KB
Binary file not shown.
7.48 KB
Loading
8.85 KB
Loading
9.5 KB
Loading

0 commit comments

Comments
 (0)