-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathindex.html
97 lines (79 loc) · 3.21 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
<!DOCTYPE html>
<html>
<head>
<title>QmlWeb Demo</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<style>
body {
margin: 0;
-moz-user-select: -moz-none;
-khtml-user-select: none;
-webkit-user-select: none;
}
#qmlSpace {
width: 80vw !important;
height: 90vh !important;
bottom: 0px !important;
z-index: 10000;
left: 10% !important;
top: 30px !important;
border: 1px solid grey;
}
#qmlSrcLink {
right: 10% !important;
top: 10px !important;
position: absolute;
}
#qmlRunLink {
left: 10% !important;
top: 10px !important;
position: absolute;
}
#qmlRunGitLink {
right: 5px;
bottom: 2px;
font-size: 14px;
position: absolute;
}
</style>
<script type="text/javascript" src="qmlweb/src/parser.js"></script>
<script type="text/javascript" src="qmlweb/src/process.js"></script>
<script type="text/javascript" src="qmlweb/src/import.js"></script>
<script type="text/javascript" src="qmlweb/src/qtcore.js"></script>
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.4/jquery.min.js"></script>
<script type="text/javascript" src="github_raw_proxy.js"></script>
</head>
<body>
<div id="qmlSpace">Place for Qml scene</div>
<div id="qmlSrcLink"><a target="_blank" href="">open source</a></div>
<div id="qmlRunLink"><a target="_blank" href="javascript:window.location.href = window.location.href.split('?')[0];">qmlweb.run</a></div>
<div id="qmlRunGitLink"><a target="_blank" href="https://github.com/pavelvasev/qmlweb.run">qmlweb.run own repo</a></div>
<script>
function getParameterByName(name,separator) {
if (!separator) separator = "=";
name = name.replace(/[\[]/, "\\[").replace(/[\]]/, "\\]");
var regex = new RegExp("[\\?&]" + name + separator + "([^&#]*)"),
results = regex.exec(location.search);
//return results === null ? "" : decodeURIComponent(results[1].replace(/\+/g, " "));
return results === null ? null : decodeURIComponent(results[1].replace(/\+/g, " "));
}
var q = document.getElementById("qmlSpace");
var qmlEngine = new QMLEngine(q);
qmlEngine.addModulePath( "qmlweb.components","https://github.com/pavelvasev/qmlweb.components" );
//qmlEngine.addModulePath( "qmlweb.components","../qmlweb.components" );
//if (qmlEngine.addImportPath)
// qmlEngine.addImportPath(""); // for now we have to point to import dir directly
var src = getParameterByName("s","--") || getParameterByName("s") || "ChooseScene.qml";
jQuery("#qmlSrcLink a").attr("href",src);
try {
qmlEngine.loadFile( src );
} catch(e) {
jQuery("#qmlSpace").text( "QML parse error. Use browser console to see it.");
console.error(e);
qmlEngine.loadFile( "Error.qml" );
}
qmlEngine.start();
console.log("qml engine started")
</script>
</body>
</html>