Imagine
Not using spaces for indents
This commit is contained in:
parent
e7dc9f2e94
commit
52b5a57bde
1 changed files with 51 additions and 51 deletions
102
index.html
102
index.html
|
@ -1,61 +1,61 @@
|
|||
|
||||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta http-equiv="content-type" content="text/html; charset=utf-8">
|
||||
<head>
|
||||
<meta http-equiv="content-type" content="text/html; charset=utf-8">
|
||||
<link rel="stylesheet" href="~style~/style.css">
|
||||
<title>GCT Generator</title>
|
||||
|
||||
<script language="javascript">
|
||||
<title>GCT Generator</title>
|
||||
|
||||
<script language="javascript">
|
||||
|
||||
function downloadGCT(data, filename) {
|
||||
var rawData = new Uint8Array(data.length/2);
|
||||
|
||||
for (var x = 0; x < rawData.length; x++) {
|
||||
rawData[x] = parseInt(data.substr(x*2, 2), 16);
|
||||
}
|
||||
|
||||
var file = new Blob([rawData], {type: "application/octet-stream"});
|
||||
|
||||
if (window.navigator.msSaveOrOpenBlob)
|
||||
window.navigator.msSaveOrOpenBlob(file, filename);
|
||||
else {
|
||||
var a = document.createElement("a"),
|
||||
url = window.URL.createObjectURL(file);
|
||||
a.href = url;
|
||||
a.download = filename;
|
||||
a.click();
|
||||
window.URL.revokeObjectURL(url);
|
||||
}
|
||||
}
|
||||
function downloadGCT(data, filename) {
|
||||
var rawData = new Uint8Array(data.length/2);
|
||||
|
||||
for (var x = 0; x < rawData.length; x++) {
|
||||
rawData[x] = parseInt(data.substr(x*2, 2), 16);
|
||||
}
|
||||
|
||||
var file = new Blob([rawData], {type: "application/octet-stream"});
|
||||
|
||||
if (window.navigator.msSaveOrOpenBlob)
|
||||
window.navigator.msSaveOrOpenBlob(file, filename);
|
||||
else {
|
||||
var a = document.createElement("a"),
|
||||
url = window.URL.createObjectURL(file);
|
||||
a.href = url;
|
||||
a.download = filename;
|
||||
a.click();
|
||||
window.URL.revokeObjectURL(url);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function generateGCT() {
|
||||
var data = "00D0C0DE00D0C0DE";
|
||||
data += document.getElementById("gctData").value.replace(/[\s\n\r\t]+/gm,"");
|
||||
if (!/^[a-fA-F0-9]+$/.test(data) || (data.length % 16 != 0)) {
|
||||
alert("Not a valid code");
|
||||
return;
|
||||
};
|
||||
data += "FF00000000000000";
|
||||
|
||||
var fileName = document.getElementById("gameID").value;
|
||||
fileName += ".gct";
|
||||
|
||||
downloadGCT(data, fileName);
|
||||
}
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
<div>
|
||||
Game ID:<br />
|
||||
<textarea id="gameID" rows="1" cols="50"></textarea><br />
|
||||
Code:<br />
|
||||
<textarea id="gctData" rows="20" cols="50"></textarea><br />
|
||||
<button onclick="generateGCT()">Download</button>
|
||||
</div>
|
||||
</body>
|
||||
|
||||
function generateGCT() {
|
||||
var data = "00D0C0DE00D0C0DE";
|
||||
data += document.getElementById("gctData").value.replace(/[\s\n\r\t]+/gm,"");
|
||||
if (!/^[a-fA-F0-9]+$/.test(data) || (data.length % 16 != 0)) {
|
||||
alert("Not a valid code");
|
||||
return;
|
||||
};
|
||||
data += "FF00000000000000";
|
||||
|
||||
var fileName = document.getElementById("gameID").value;
|
||||
fileName += ".gct";
|
||||
|
||||
downloadGCT(data, fileName);
|
||||
}
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
<div>
|
||||
Game ID:<br />
|
||||
<textarea id="gameID" rows="1" cols="50"></textarea><br />
|
||||
Code:<br />
|
||||
<textarea id="gctData" rows="20" cols="50"></textarea><br />
|
||||
<button onclick="generateGCT()">Download</button>
|
||||
</div>
|
||||
</body>
|
||||
|
||||
|
||||
</html>
|
||||
|
||||
|
|
Loading…
Reference in a new issue