-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
92 lines (81 loc) · 3.2 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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta property="og:title" content="Quoteboard">
<meta property="og:description" content="IntelliTect's #quoteboard.">
<meta property="og:image" content="og_image.jpg">
<meta property="og:url" content="https://intellitect.github.io/Quoteboard/">
<meta name="twitter:card" content="summary_large_image">
<meta property="og:site_name" content="Quoteboard">
<meta name="twitter:image:alt" content='"Someone needs to do something with this. I am not sure what, but it needs a large font." -Kevin Bost'>
<link rel="shortcut icon" type="image/x-icon" href="favicon.ico">
<style>
#messages-container>div {
display: inline-block;
border: 1px solid grey;
padding: 4px;
margin: 8px;
box-shadow: 0 3px 1px -2px rgba(0, 0, 0, .2), 0 2px 2px 0 rgba(0, 0, 0, .14), 0 1px 5px 0 rgba(0, 0, 0, .12);
}
</style>
<script type="text/javascript" data-app-id="JOw4b7VGvHk6DB0RnRV2aQ"
src="https://c64.assets-yammer.com/assets/platform_js_sdk.js"></script>
<title>Quoteboard</title>
</head>
<body>
<span id="yammer-login"></span>
<div id="messages-container"></div>
<script>
function parseMessages(messages) {
messagesContainer = document.getElementById("messages-container");
messages.forEach(message => {
const plainBody = message.body.plain;
messagesContainer.innerHTML += `<div>${plainBody}</div>`;
})
}
function getMessages(data) {
yam.platform.request({
url: "messages.json",
method: "GET",
data: {
limit: 100,
...data,
},
success: (result) => {
console.log(result)
messageTypes = result.messages.map(message => message.message_type)
console.log(messageTypes)
const lastId = result.messages[result.messages.length - 1].id
// getMessages({ older_than: lastId })
},
error: (result) => {
console.error(result)
}
})
}
yam.connect.loginButton("#yammer-login", function (resp) {
if (resp.authResponse) {
document.getElementById("yammer-login").style.display = "none";
yam.platform.request({
url: "search.json",
method: "GET",
data: {
search: "quoteboard"
},
success: function (result) {
const messages = result.messages.messages;
parseMessages(messages)
},
error: function (result) {
console.error(result)
},
});
getMessages()
}
});
</script>
</body>
</html>