forked from admonkey/targeted-activity
-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
84 lines (74 loc) · 3.39 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
<!DOCTYPE html>
<html>
<head>
<!-- This title is not used. -->
<title>Gadget Starter</title>
<!-- Use Bootstrap to match the look of OU Campus. -->
<link rel="stylesheet" href="lib/bootstrap.min.css">
<style type="text/css">
body {
margin: 10px;
background-color: transparent;
}
</style>
<!-- jQuery IS REQUIRED for gadgetlib.js to work. -->
<script type="text/javascript" src="lib/jquery-2.1.3.min.js"></script>
<!--
gadgetlib.js is a library of basic functions that gadgets can use. It creates a global
`gadget` object that has a few useful methods. (See comments in gadgetlib.js.)
-->
<script type="text/javascript" src="lib/gadgetlib.min.js"></script>
<script type="text/javascript">
$(document).ready(function () {
/*
First, call `gadget.ready()` to make sure the gadget has obtained an API token
to use for making OU Campus API calls. If your gadget will not make any API calls,
you can dispense with this method. This asynchronous method returns a jQuery
Promise object.
Then, call `gadget.fetch()` to get the gadget's config data from the system. This
method, which also returns a jQuery Promise object, uses the API, which is why it
needs to follow the call to `gadget.ready()`.
If you don't need the config data, you don't need to call gadget.fetch().
*/
gadget.ready().then(gadget.fetch).then(function () {
$('#main').css({ 'font-size': gadget.getConfig('font_size') });
});
});
$(gadget).on({
'expanded': function (evt) {
// This event is triggered when the user expands (makes visible) a sidebar gadget.
console.log('Gadget expanded.');
},
'collapsed': function (evt) {
// This event is triggered when the user collapses (hides) a sidebar gadget.
console.log('Gadget collapsed.');
},
'configuration': function (evt, config) {
// If the user changes the gadget's configuration through the configuration modal,
// the gadget will hear about it and get the new config in the data argument here.
console.log('New config:', config);
$('#main').css({ 'font-size': config.font_size });
},
'notification': function (evt, notification) {
// If the gadget's config.xml contains a "notification" entry, any notifications
// of the specified type(s) generated by OU Campus will trigger 'notification'
// events that can be handled here.
console.log('Notification received:', notification);
}
});
</script>
</head>
<body>
<div id="main">
Gadget content goes here.
</div>
<!--
The following hidden div is only needed if you'll be editing your gadget in
OU Campus's source code editor. OU Campus automatically adds a DirectEdit link
to HTML files that you edit in OU Campus. This div hides the DirectEdit link.
-->
<div style="display:none">
<!-- ouc:ob --><!-- /ouc:ob -->
</div>
</body>
</html>