-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathrelay.html
96 lines (87 loc) · 2.25 KB
/
relay.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
<html>
<head>
<script>
function loadDataFromUrlThen(url, callback) {
let xmlhttp = null;
if (window.XMLHttpRequest)
{// code for IE7+, Firefox, Chrome, Opera, Safari
xmlhttp=new XMLHttpRequest();
}
else
{// code for IE6, IE5
xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
}
xmlhttp.onreadystatechange=function()
{
if (xmlhttp.readyState==4)
{
if (xmlhttp.status==200) {
callback(xmlhttp.responseText, null);
} else {
callback(null, { status: xmlhttp.status, text: xmlhttp.responseText });
}
return;
}
}
xmlhttp.open("GET", url, true);
xmlhttp.send();
}
window.addEventListener("load", function() {
let hash = document.location.hash;
if (!hash) {
document.location = "https://draw.io"
return;
}
loadDataFromUrlThen(hash.substring(1), function(data, error) {
if (error) {
document.body.className = "error";
document.getElementsByTagName("span")[0].innerHTML = "Error relaying to draw.io; status: " + error.status;
return;
}
let query = document.location.search;
document.location = "https://draw.io/" + query + "#R" + data;
});
});
</script>
<style>
body {
padding: 2px;
font-family: "Tahoma";
position: relative;
}
.error {
color: #ff0000;
}
body span {
padding-left: 40px;
line-height: 25px;
}
body:before{
content: "( )";
text-align: center;
display: block;
-webkit-animation:spin 2s linear infinite;
-moz-animation:spin 2s linear infinite;
animation:spin 2s linear infinite;
position: absolute;
font-size: 20px;
font-family: monospace;
line-height: 25px;
}
@-moz-keyframes spin { 100% { -moz-transform: rotate(360deg); } }
@-webkit-keyframes spin { 100% { -webkit-transform: rotate(360deg); } }
@keyframes spin { 100% { -webkit-transform: rotate(360deg); transform:rotate(360deg); } }
body.error:before{
-webkit-animation:initial;
-moz-animation:initial;
animation:initial;
-moz-transform: rotate(45deg);
-webkit-transform: rotate(45deg);
transform: rotate(45deg);
}
</style>
</head>
<body>
<span>Loading...</span>
</body>
</html>