forked from One-Piece-Online/OPOnline
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathjsInclude.js
More file actions
109 lines (100 loc) · 3.51 KB
/
jsInclude.js
File metadata and controls
109 lines (100 loc) · 3.51 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
var _openPopup = null;
function OnLoadCallback(lastUpdate) {
var log = document.getElementById("gamelog");
if (log !== null) log.scrollTop = log.scrollHeight;
reload();
}
function ShowCardDetail(e, that) {
ShowDetail(e, that.getElementsByTagName("IMG")[0].src);
}
function ShowDetail(e, imgSource) {
imgSource = imgSource.replace("_cropped", "");
imgSource = imgSource.replace("/crops/", "/WebpImages/");
imgSource = imgSource.replace("_concat", "");
imgSource = imgSource.replace("/concat/", "/WebpImages/");
imgSource = imgSource.replace(".png", ".webp");
var el = document.getElementById("cardDetail");
el.innerHTML =
"<img style='height:523px; width:375px;' src='" + imgSource + "' />";
el.style.left =
e.clientX < window.innerWidth / 2 ? e.clientX + 30 : e.clientX - 400;
el.style.top =
e.clientY > window.innerHeight / 2 ? e.clientY - 523 - 20 : e.clientY + 30;
if (parseInt(el.style.top) + 523 >= window.innerHeight) {
el.style.top = window.innerHeight - 530;
el.style.left =
e.clientX < window.innerWidth / 2 ? e.clientX + 30 : e.clientX - 400;
} else if (parseInt(el.style.top) <= 0) {
el.style.top = 5;
el.style.left =
e.clientX < window.innerWidth / 2 ? e.clientX + 30 : e.clientX - 400;
}
el.style.zIndex = 100000;
el.style.display = "inline";
}
function HideCardDetail() {
var el = document.getElementById("cardDetail");
el.style.display = "none";
}
function ChatKey(event) {
if (event.keyCode === 13) {
event.preventDefault();
SubmitChat();
}
event.stopPropagation();
}
function SubmitChat() {
var chatBox = document.getElementById("chatText");
if (chatBox.value == "") return;
var xmlhttp = new XMLHttpRequest();
xmlhttp.onreadystatechange = function () {
if (this.readyState == 4 && this.status == 200) {
}
};
var ajaxLink =
"SubmitChat.php?gameName=" + document.getElementById("gameName").value;
ajaxLink +=
"&playerID=" + document.getElementById("playerID").value +
"&chatText=" + encodeURI(chatBox.value) +
"&authKey=" + document.getElementById("authKey").value;
xmlhttp.open("GET", ajaxLink, true);
xmlhttp.send();
chatBox.value = "";
}
function AddCardToHand() {
var card = document.getElementById("manualAddCardToHand").value;
SubmitInput(10011, "&cardID=" + card);
}
function SubmitInput(mode, params, fullRefresh = false) {
var xmlhttp = new XMLHttpRequest();
xmlhttp.onreadystatechange = function () {
if (this.readyState == 4 && this.status == 200) {
if (fullRefresh) location.reload();
}
};
var ajaxLink =
"ProcessInput2.php?gameName=" + document.getElementById("gameName").value;
ajaxLink += "&playerID=" + document.getElementById("playerID").value;
ajaxLink += "&authKey=" + document.getElementById("authKey").value;
ajaxLink += "&mode=" + mode;
ajaxLink += params;
xmlhttp.open("GET", ajaxLink, true);
xmlhttp.send();
}
function ShowPopup(name) {
var xmlhttp = new XMLHttpRequest();
xmlhttp.onreadystatechange = function () {
if (this.readyState == 4 && this.status == 200) {
document.getElementById("popupContainer").innerHTML = this.responseText;
document.getElementById(name).style.display = "inline";
}
};
var ajaxLink =
"./GetPopupContent.php?gameName=" +
document.getElementById("gameName").value;
ajaxLink += "&playerID=" + document.getElementById("playerID").value;
ajaxLink += "&authKey=" + document.getElementById("authKey").value;
ajaxLink += "&popupType=" + name;
xmlhttp.open("GET", ajaxLink, true);
xmlhttp.send();
}