-
Notifications
You must be signed in to change notification settings - Fork 23
/
index.html
79 lines (63 loc) · 2.8 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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<title>Librarie.js sample page</title>
<style>
body {
padding: 0;
margin: 0;
}
</style>
</style>
</head>
<body>
<div id="libraryContainerPlaceholder"></div>
<!-- The main library view compoment -->
<script src='./dist/build/librarie.js'></script>
<!-- uncomment to debug in IE11 (polyfill fetch and promise)
<script src="//cdn.jsdelivr.net/npm/bluebird@3.7.2/js/browser/bluebird.min.js"></script>
<script src='https://unpkg.com/whatwg-fetch@3.6.2/dist/fetch.umd.js'></script>
-->
<script>
let jsonUrls = ["loadedTypes", "layoutSpecs"];
let downloader = LibraryEntryPoint.CreateJsonDownloader(jsonUrls, function (jsonUrl, jsonObject) {
let downloaded = downloader.getDownloadedJsonObjects();
let loadedTypesJson = downloaded["loadedTypes"];
let layoutSpecsJson = downloaded["layoutSpecs"];
if (!loadedTypesJson || (!layoutSpecsJson)) {
return; // Not fully downloaded yet, bail.
}
let libController = LibraryEntryPoint.CreateLibraryController();
libController.on(libController.ItemClickedEventName, function (item) {
console.log(item);
});
libController.on(libController.ItemMouseEnterEventName, function (arg) {
console.log("Data: " + arg.data);
console.log("Rect(top, left, bottom, right): " + arg.rect.top + "," + arg.rect.left + "," + arg.rect.bottom + "," + arg.rect.right);
});
libController.on(libController.ItemMouseLeaveEventName, function (arg) {
console.log("Data: " + arg.data);
console.log("Rect(top, left, bottom, right): " + arg.rect.top + "," + arg.rect.left + "," + arg.rect.bottom + "," + arg.rect.right);
});
libController.on(libController.ItemSummaryExpandedEventName, function (arg) {
console.log(arg.data);
});
libController.on(libController.SearchTextUpdatedEventName, function (searchText) {
console.log(searchText);
return null;
});
libController.on(libController.SectionIconClickedEventName, function (sectionText) {
console.log(sectionText, "icon clicked");
return null;
});
libController.on(libController.FilterCategoryEventName, function (item) {
console.log(item);
});
libController.createLibraryByElementId(
"libraryContainerPlaceholder", layoutSpecsJson, loadedTypesJson);
});
</script>
</body>
</html>