forked from xeolabs/scenejs
-
Notifications
You must be signed in to change notification settings - Fork 0
/
examples.html
108 lines (82 loc) · 3.05 KB
/
examples.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
<!DOCTYPE html>
<html lang="en" xmlns="http://www.w3.org/1999/html" xmlns="http://www.w3.org/1999/html">
<head>
<title>SceneJS Examples</title>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, user-scalable=no, minimum-scale=1.0, maximum-scale=1.0">
<script src="lib/jquery-1.8.3.min.js"></script>
<!--<script src="../examplejs/api/latest/tweakjs.js"></script>-->
<script src="http://xeolabs.github.io/examplejs/api/v0/tweakjs.js"></script>
</head>
<body>
<style>
html, body {
height: 100%;
}
body {
margin: 0px;
overflow: hidden;
}
</style>
<script>
jQuery(document).ready(
function ($) {
// Load examples index
$.getJSON("examples/ex/index.json",
function (index) {
var href = window.location.href;
// Create examples browser
var tweakjs = new TweakJS({
title:"SceneJS 3.0",
logo: "http://xeolabs.github.io/scenejs/images/scenejs.png",
caption:"Examples",
// Use built-in code viewer
editor:"html",
// JSON examples index
index:index,
// Location of example pages
pageBase:"http://xeolabs.github.io/scenejs/examples/ex/",
// Initially selected tags
tags:getURLTags(),
// Initially selected page
page:getURLPage(),
// Initially hide code
showCode:false
});
// Listen for home link click
tweakjs.once("home",
function () {
window.location = "http://scenejs.org"
});
});
});
function getURLTags() {
var tags = {};
var params = getSearchParams();
var tagListStr = params.tags;
if (tagListStr) {
var tagList = tagListStr.split(",");
for (var i = 0, len = tagList.length; i < len; i++) {
tags[tagList[i]] = true;
}
}
return tags;
}
function getURLPage() {
var params = getSearchParams();
return params.page;
}
function getSearchParams() {
var searchParams = {};
var search = window.location.search.slice(1);
var params = search.split('&');
var tokens;
for (var i = 0, len = params.length; i < len; i++) {
tokens = params[i].split("=");
searchParams[tokens[0]] = tokens[1];
}
return searchParams;
}
</script>
</body>
</html>