-
Notifications
You must be signed in to change notification settings - Fork 13
/
Copy pathindex.html
100 lines (85 loc) · 3.46 KB
/
index.html
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
<!doctype html>
<html>
<head>
<!-- Global site tag (gtag.js) - Google Analytics -->
<script async src="https://www.googletagmanager.com/gtag/js?id=UA-176109454-1"></script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());
gtag('config', 'UA-176109454-1');
</script>
<title>Convert .Schem to .Schematic</title>
<!-- https://github.com/kpanuragh/zlib -->
<script src="zlib.js"></script>
<!-- https://github.com/sjmulder/nbt-js -->
<script src="nbt.js"></script>
<script src="schemtoschematic.js"></script>
<script>
function uploadFile(file) {
console.log('Processing ' + file.name);
var fr = new FileReader();
fr.onload = function() {
schemtoschematic(fr.result, function(data) {
var name = file.name;
if (~name.lastIndexOf('.')) {
name = name.substr(0, name.lastIndexOf('.'));
}
name += '.schematic';
var blob = new Blob([data], {type: 'application/nbt'});
var link = document.createElement('a');
link.href = window.URL.createObjectURL(blob);
link.download = name;
link.innerHTML = 'Download ' + name;
link.click();
var li = document.createElement('li');
li.appendChild(link);
document.querySelector('#downloads').appendChild(li);
});
};
fr.readAsArrayBuffer(file);
}
function upload(input) {
for (var i = 0; i < input.files.length; i++) {
uploadFile(input.files[i]);
}
}
</script>
<style>
* {
font-family: Arial, sans-serif;
}
html {
height: 100%;
}
body {
background: #ddd;
height: 100%;
margin: 0;
padding: 0;
}
section {
background: white;
box-shadow: 0 0 5px #aaa;
height: 100%;
margin: auto;
width: 600px;
padding: 25px;
}
h1 {
font-size: 20px;
}
</style>
</head>
<body>
<section>
<h1>Convert .schem files to .schematic files</h1>
<p>Convert the new worledit 1.13+ .schem files to the legacy 1.12- .schematic files</p>
<p>Blocks that didn't exist in 1.12 will be replaced with air</p>
<label for="file">Input your .schem file here</label>: <input id="file" type="file" onchange="upload(this)" multiple/><br/>
<small>Privacy notice: All schematics are processed by your local machine and aren't uploaded to any server</small>
<ul id="downloads"></ul>
<p id="error"></p>
</scetion>
</body>
</html>