-
Notifications
You must be signed in to change notification settings - Fork 0
/
debug.html
131 lines (116 loc) · 5.02 KB
/
debug.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
120
121
122
123
124
125
126
127
128
129
130
131
<!DOCTYPE HTML>
<html>
<head>
<meta charset='utf-8'>
<link rel="stylesheet" href="css/webfonts.css">
<link rel="stylesheet" href="css/document-text.css">
<link rel="stylesheet" href="css/document-transcript.css">
<link rel="stylesheet" href="css/document-transcript-highlight-hands.css">
<link rel="stylesheet" href="css/document-transcript-interaction.css">
<link rel="stylesheet" href="css/pure-custom.css">
<link rel="stylesheet" href="css/basic_layout.css">
<script type="text/javascript" src="./js-gen/webfontloader.js"></script>
<script type="text/javascript" src="./js-gen/Y_extract.js"></script>
<script type="text/javascript" src="./js-gen/svg-utils.js"></script>
<script type="text/javascript" src="./js-gen/faust.js"></script>
<script type="text/javascript" src="./js-gen/materialunit.js"></script>
<script type="text/javascript" src="./js-gen/transcript-adhoc-tree.js"></script>
<script type="text/javascript" src="./js-gen/text-index.js"></script>
<script type="text/javascript" src="./js-gen/text-annotation.js"></script>
<script type="text/javascript" src="./js-gen/transcript.js"></script>
<script type="text/javascript" src="./js-gen/transcript-svg.js"></script>
<script type="text/javascript" src="./js-gen/adhoc-tree.js"></script>
<script type="text/javascript" src="./js-gen/transcript-configuration-faust.js"></script>
<script type="text/javascript" src="./js-gen/transcript-generation.js"></script>
<style>
*, *:before, *:after {
-webkit-box-sizing: border-box;
-moz-box-sizing: border-box;
box-sizing: border-box;
}
html, body {
height: 100%;
margin: 0px 0px 0px 0px;
padding: 5px;
/* background-color: lightgray; */
}
/*
#container {
border: 1px solid black;
background-color: white;
}
*/
</style>
</head>
<body>
<div id="container">
</div>
<section id="debughelp">
<h1>Transcript Generation Debugging</h1>
<p>This page helps in debugging the generation of the transcript generation. Just replace the <code>documentViewer</code> URL with the one to this HTML, retaining at least the faustUri and page parameters, and use the developer tools (F12).</p>
<p>Note this will work (1) only if served by a server and (2) only when the json files are there, i.e. generation has run at least once.</p>
</section>
<footer class="pure-noprint pure-right">
<div class="pure-g-r">
<div class="pure-u-1-2">
<a id="documentViewer">Edition</a>
<a id="debug2">Einbindung debuggen</a>
</div>
</div>
</footer>
<script type="text/javascript">
document.getElementById("documentViewer").href = 'documentViewer' + window.location.search;
document.getElementById("debug2").href = 'debug2' + window.location.search;
</script>
<script type="text/javascript">
var parseQueryString = function( queryString ) {
var params = {}, queries, temp, i, l;
// Split into key/value pairs
queries = queryString.split("&");
// Convert the array of strings into an object
for ( i = 0, l = queries.length; i < l; i++ ) {
temp = queries[i].split('=');
params[temp[0]] = temp[1];
}
return params;
};
var params = parseQueryString(window.location.search.substring(1));
console.log(params);
var json = params.faustUri.replace(/^faust:\/\/xml\/document/, 'json') + '/page_' + params.page + '.json';
console.log(json);
var help = document.getElementById("debughelp");
help.parentNode.removeChild(help);
var fontError = false;
var webFontConfig = {
custom: {
families: ['Ubuntu', 'Ubuntu Monospace', 'Gentium Plus'],
// we don not need to specify urls as they are specified in the css files
urls: ['/css/webfonts.css']
},
// do not time out if font can't be loaded
timeout: 10, //Number.MAX_VALUE,
active: function() {
// if we made it this far without 'fontinactive' occurring, then all
// fonts have been loaded
if (!Faust.TranscriptConfiguration.forceFontLoading || !fontError) {
Faust.io(json, transcriptGeneration.createDiplomaticSvg);
} else {
// do not try to render page
}
},
fontinactive: function(familyName, fvd) {
// font could not be loaded, abort
if (Faust.TranscriptConfiguration.forceFontLoading) {
fontError = true;
var message = "Error: web font could not be loaded: " + familyName + " " + fvd;
var htmlMessage = document.createElement('div');
htmlMessage.innerHTML = message;
document.body.append(htmlMessage);
throw(message);
}
}
};
WebFont.load(webFontConfig);
</script>
</body>
</html>