-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathindex.html
155 lines (142 loc) · 4.36 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
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
<!DOCTYPE html>
<html>
<head>
<title>StreamHub SDK Example</title>
<script src="lib/requirejs/require.js" type="text/javascript"></script>
<script src="requirejs.conf.js" type="text/javascript"></script>
<link rel="stylesheet" type="text/css" href="lib/streamhub-sdk/src/css/style.css">
<style>
body {
color: #222;
font: 14px sans-serif;
line-height: 1.25;
background-color: #eee;
}
.hub-item {
padding:0;
margin: 0;
cursor: pointer;
width:215px;
display:inline-block;
vertical-align:bottom;
white-space:normal;
}
.hub-item .item-feed-view {
height:400px;
width:200px;
overflow-y:hidden;
overflow-x:hidden;
position:relative;
}
.hub-item .item-content-view {
height:100px;
width:200px;
overflow:hidden;
background-color:white;
padding:0;
margin:0;
vertical-align:top;
}
.hub-feed-item {
height:100px;
width:100px;
overflow:hidden;
background-color:white;
padding:0;
margin:0;
vertical-align:top;
position:relative;
}
.hub-feed-item-holder {
max-height:400px;
width:200px;
position:absolute;
bottom:0px;
overflow-y:scroll;
overflow-x:hidden;
}
.content {
position:relative;
}
.sort-links a, .filter-links a {
cursor: pointer;
text-decoration: underline;
}
#example {
white-space:nowrap;
height:515px;
overflow-x:scroll;
overflow-y:hidden;
}
#tickerHolder {
height:500px;
overflow:hidden;
}
</style>
</head>
<body>
<div id="container">
<h3>StreamHub Ticker</h3>
<div>
<button id='pauseButton'>Pause</button><br/>
User token: <input id='userToken' value='eyJhbGciOiAiSFMyNTYiLCAidHlwIjogIkpXVCJ9.eyJkb21haW4iOiAibGFicy10NDAyLmZ5cmUuY28iLCAiZXhwaXJlcyI6IDEzNTkzNzM4NDkuNzUyMzY0LCAidXNlcl9pZCI6ICJzeXN0ZW0ifQ.S7uGf48ufOQ9wkwSk-SLlNt8SMJpNPHLFp9X4u4mHUE'></input>
Message: <input id='newMessage' /><br/>
<input type="radio" name="colSelect" value="main" checked="checked">Main</input>
<input type="radio" name="colSelect" value="feed">Feed</input>
<button id='postMessage'>Post</button><br/>
<span id='status'>NA</span>
</div>
<div id="tickerHolder">
<div id="example"></div>
</div>
</div>
<script type="text/javascript">
// Now to load the example
require(['streamhub-sdk', 'streamhub-ticker/views/TickerView', 'jquery'],
function(Hub, View, $) {
var opts = {
network: "labs-t402.fyre.co",
siteId: "303827",
articleId: "labs_tumblr_demo",
environment: "t402.livefyre.com"
};
var feedOpts = {
network: "labs-t402.fyre.co",
siteId: "303827",
articleId: "labs_demo_fire",
environment: "t402.livefyre.com"
};
var streams = Hub.StreamManager.create.livefyreStreams(opts);
var feedStreams = Hub.StreamManager.create.livefyreStreams(feedOpts);
var tickerView = window.view = new View({
el: document.getElementById("example")
});
streams.bind(tickerView.main).start();
feedStreams.bind(tickerView.feed).start();
$('#postMessage').click(function() {
$('#status').text('Submitting...');
var stream = $('input[name=colSelect]:checked').val() == "feed" ? feedStreams : streams;
stream.get('main').write(
$('#newMessage').val(),
{
lftoken: $('#userToken').val()
},
function(err, data) {
if (err) {
$('#status').text('Failed: ' + JSON.stringify(data));
} else {
$('#status').text('Success: ' + JSON.stringify(data));
$('#newMessage').val('');
}
}
);
return false;
});
$('#pauseButton').click(function() {
view.paused = !view.paused;
$('#pauseButton').text(view.paused ? 'Start': 'Pause');
});
});
</script>
</body>
</html>