forked from Talishar/Talishar
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathjsInclude.js
More file actions
71 lines (64 loc) · 2.31 KB
/
jsInclude.js
File metadata and controls
71 lines (64 loc) · 2.31 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
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();
}
event.stopPropagation();
}
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 =
"ProcessInput.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();
}