-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathindex.html
45 lines (41 loc) · 1.2 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
<html>
<head>
<meta charset="UTF-8" />
<script src="receivers.js"></script>
<script src="pavlova.js"></script>
<script>
// Pavlova dispatcher UI
// Copyright 2017 Pierre Ynard
// Licensed under GPLv3+
var xml_escape = function(text) {
var xml_entities = {
'&': '&',
'<': '<',
'>': '>',
'"': '"',
"'": ''',
};
return text.replace(/[&<>"']/g, function(c) {
return xml_entities[c];
});
};
var redirect = function(url, description) {
if (url) {
description = description ?
'"' + xml_escape(description) + '" ' :
'';
document.body.innerHTML = 'Redirecting to ' + description + '<' + xml_escape(url) + '> ...';
window.location.href = url;
} else
document.body.innerHTML = '<span style="color:red;font-weight:bold">No receiver available! Sorry, try again later; or browse by yourself more receivers at <a href="http://rx.linkfanel.net/">rx.linkfanel.net</a></span>';
};
var dispatch = function() {
var res = Pavlova.handle(null, redirect);
document.body.innerHTML = res ?
'Probing available receivers...' :
'Welcome to the pavlova dispatcher! Please call with valid redirection parameters.';
};
</script>
</head>
<body onload="dispatch()" />
</html>