-
Notifications
You must be signed in to change notification settings - Fork 1
/
run.html
119 lines (92 loc) · 3.68 KB
/
run.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
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>FooWiki</title>
<link rel="stylesheet" href="css/columns.css" />
<link rel="stylesheet" type="text/css" href="css/jquery-ui.min.css" />
<!-- link rel="stylesheet" href="css/normalize.css" -->
<link rel="stylesheet" href="css/common.css">
<script src="js/lib/marked.js"></script>
<!-- mustache template compiler -->
<script src="js/lib/hogan-3.0.2.js"></script>
<script src="js/lib/jquery-1.10.2.js"></script>
<!-- date formatting -->
<script src="js/lib/moment.js"></script>
<!-- FooWiki scripts -->
<script src="js/foowiki/config.js"></script>
<script src="js/foowiki/sparql-templates.js"></script>
<script src="js/foowiki/html-templates.js"></script>
<script src="js/foowiki/utils.js"></script>
<script src="js/foowiki/core.js"></script>
<script src="js/foowiki/sparql-connector.js"></script>
<script type="text/javascript" language="javascript">
$(function () {
setupErrorHandling();
spinner();
var uri = queryString["uri"];
uri = encodeURI(uri);
var map = {
"uri": uri,
"FooWiki.graphURI": FooWiki.graphURI
};
var doneCallback = function (entryJSON) {
// var entry = xmlToEntry(xml, uri);
// var entryJSON = sparqlXMLtoJSON(xml);
if (!entryJSON) {
/*
entryJSON = {
content: "",
date: "",
title: "",
nick: ""
};
*/
window.location.href = window.location.href.replace("page.html", "edit.html");
return;
}
// "uri": "page.html?uri=" + uri
console.log("entryJSON[0] = " + JSON.stringify(entryJSON[0]));
var entry = entryJSON[0];
var params = "";
// console.log(JSON.stringify(queryString));
var script = document.createElement('script');
script.type = 'text/javascript';
script.async = true;
script.text = entry.content;
var s = document.getElementsByTagName('script')[0];
s.parentNode.insertBefore(script, s);
var toRun = entry.title + "(" + JSON.stringify(queryString) + ");"
console.log(toRun);
eval(toRun);
};
var getPageSparql = sparqlTemplater(getPageSparqlTemplate, map);
var getPageURL = FooWiki.sparqlQueryEndpoint + encodeURIComponent(getPageSparql) + "&output=xml";
getJsonForSparqlURL(getPageURL, doneCallback);
// getDataForURL(doneCallback, getPageURL);
$('#editButton').click(function () {
window.location.href = window.location.href.replace("run.html", "edit.html");
return false;
});
});
function formatEntry(entry) {
entry.content = marked(entry.content);
entry.date = moment(entry.date).format("dddd, MMMM Do YYYY, h:mm:ss a");
return templater(runEntryTemplate, entry);
}
</script>
</head>
<body>
<div id="container">
<div id="errorbox"></div>
<div><a href="index.html">Page Index</a>
</div>
<div id="entry"></div>
<p class="center" id="buttons">
<button id="editButton">Edit</button>
</p>
<div id="spinner" class="spinner"></div>
<div id="target"></div>
</div>
</body>
</html>