This repository was archived by the owner on Mar 25, 2026. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathexamples.html
More file actions
269 lines (257 loc) · 11.8 KB
/
Copy pathexamples.html
File metadata and controls
269 lines (257 loc) · 11.8 KB
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
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
<!DOCTYPE html>
<head>
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<script type="text/javascript" src="http://code.jquery.com/jquery-1.6.1.js"></script>
<script type="text/javascript" src="https://raw.github.com/ryanjarvinen/Eventbrite.jquery.js/master/Eventbrite.jquery.js"> </script>
<script type="text/javascript">
var eb_events = {};
$(document).ready(function(){
// A helper for drawing lists based on API responses:
Eventbrite.prototype.utils.list = function( selector, content_html, header_html ){
var page = $( selector );
// Get the content area element for the page.
var content = page.children( ":jqmData(role=content)" );
content.html( content_html );
if( header_html !== undefined ){
// Get the header for the page.
var header = page.children( ":jqmData(role=header)" );
header.html( header_html );
}
// Pages are lazily enhanced. call page() to make sure it is
// enhanced before we attempt to enhance the listview markup.
// Subsequent calls to page() are ignored since a page/widget
// can only be enhanced once.
page.page();
// Enhance the listview we just injected.
content.find( ":jqmData(role=listview)" ).listview();
}
// Using the Eventbrite OAuth2.0 login Widget to display the user's state -
// for more information about how to use this widget see
// https://github.com/ryanjarvinen/Eventbrite.jquery.js/blob/master/OAUTH2-README.md
Eventbrite.prototype.widget.login({
'app_key': '6OYXYBBVI4NZANVJJE',
'renderer': 'disabled',
}, function(strings){
// A callback for work that needs to happen AFTER we know the state of the user's session:
// Place the resulting Eventbrite login widget code somewhere on your page.
// This example places the content into an element marked with class="eb_login_box"
$(".eb_login_loading").hide();
if( strings['user_name'] !== undefined &&
strings['user_email'] !== undefined ){
$(".eb_user_name").html(strings.user_name);
$(".eb_user_email").html(strings.user_email);
$(".eb_user_info").show();
$(".eb_logout").show();
}else{
$(".eb_login_btn").show();
if(strings['login_error'] !== undefined){
$(".eb_login_error").html(strings['login_error']);
$(".eb_login_error").show();
}
}
if( strings['oauth_link'] !== undefined ){
$(".eb_login_btn a").attr('href', strings.oauth_link );
}
//Set up a custom logout handler
$('.eb_logout a').bind('click', function(){
Eventbrite.prototype.data.deleteAccessToken();
$('.eb_user_info').hide();
$('.eb_login_btn').show();
});
//Pre-load some page content, this client will default to using the Eventbrite
// OAuth token located in localStorage if no other init parameters are supplied
Eventbrite(function(eb){
//Populate this user's event list -
eb.user_list_events( {'do_not_display': "style,password,box_header_text_color,category,tags,tickets,link_color,box_background_color,box_border_color,timezone,description,background_color,text_color"}, function(response){
var events_html = '<div>No events were found for this account</div>';
if(response['events'] !== undefined){
eb_events = response.events;
var num = response.events.length;
var evnt_list = ['<ul data-role="listview" data-theme="c">'];
for(var x = 0; x < num; x +=1){
evnt_list.push('<li><a href="' + response.events[x]['event'].url + '">' + response.events[x]['event'].title + '</a></li>');
}
evnt_list.push( '</ul>' );
evnts_html = evnt_list.join("\n");
}
eb.utils.list( '#events', evnts_html );
});
// Populate this user's list of organizer accounts -
eb.user_list_organizers( function(response){
var organizers_html = '<div>No organizer accounts were found for this user</div>';
if(response['organizers'] !== undefined){
var num = response.organizers.length;
var organizer_list = ['<ul data-role="listview" data-theme="c">'];
var org = {};
for(var x = 0; x < num; x +=1){
org = response.organizers[x]['organizer'];
if( org.name !== '' && org.name !== undefined ){
organizer_list.push('<li><a href="' + org.url + '">' + org.name + '</a></li>');
}else{
organizer_list.push('<li data-theme="d"><a href="'+ org.url +'"><i>Unnamed Organizer</i></a></li>');
}
}
organizer_list.push( '</ul>' );
organizers_html = organizer_list.join("\n");
}
eb.utils.list( '#organizers', organizers_html );
});
// Populate this users list of Tickets
eb.user_list_tickets( function(response){
var tickets_html = '<div>No tickets were found for this user</div>';
if(response['user_tickets'] !== undefined){
var num = response.user_tickets[1].orders.length;
var ticket_list = ['<ul data-role="listview" data-theme="c">'];
var tckt = {};
for(var x = 0; x < num; x +=1){
tckt = response.user_tickets[1].orders[x]['order'];
ticket_list.push('<li><a href="http://www.eventbrite.com/orderconfirmation/' + tckt['event'].id + '/' + tckt.id + '">' + tckt['event'].title + '</a></li>');
}
ticket_list.push( '</ul>' );
tickets_html = ticket_list.join("\n");
}
eb.utils.list( '#tickets', tickets_html );
});
});
});
});
//$( document ).delegate("#events", "pagebeforecreate", function() {
// alert('A page with an ID of "aboutPage" is about to be created by jQuery Mobile!');
//});
//$( document ).delegate("#events", "pagecreate", function() {
// alert('A page with an ID of "aboutPage" was just created by jQuery Mobile!');
//});
</script>
<script type="text/javascript" src="http://code.jquery.com/mobile/1.0/jquery.mobile-1.0.min.js"> </script>
<link rel="stylesheet" type="text/css" media="all" href="http://code.jquery.com/mobile/1.0/jquery.mobile-1.0.min.css" />
<link rel="shortcut icon" href="http://evbdn.eventbrite.com/s3-production/35362ce/django/images/icons/favicon.ico" />
<style type="text/css">
.eb_login_btn a{
width:162px;
height:24px;
display:block;
text-indent: -99999px;
background: url('http://evbdn.eventbrite.com/s3-s3/static/images/developer/oauth2/oauth-connect-btns.png') top;
}
.eb_login_btn a:hover { background-position: 0px 24px;}
.eb_logout {text-align: right;}
.eb_user_name {font-weight: bold;}
.eb_user_email {font-style: italic;}
.eb_login_box {
margin: 10px auto;
border: 1px solid lightGrey;
width: 162px;
padding: 0px 20px;
}
.eb_user_name{text-align:center;}
</style>
<title>Eventbrite Developer Examples</title>
</head>
<body>
<div id="home" data-role="page">
<div data-role="header">
<h1>Eventbrite API Tools</h1>
<a href="#setup" data-icon="gear" data-rel="dialog" class="ui-btn-right">Setup</a>
</div><!-- /header -->
<div data-role="content">
<ul data-role="listview" data-inset="true">
<li><a href="#events">Events</a></li>
<li><a href="#organizers">Organizer Profiles</a></li>
<li><a href="#tickets">Tickets</a></li>
<li><a href="#account">Account</a></li>
<li data-icon="search"><a href="#search">Find Events</a></li>
</ul>
</div>
<div style='text-align:right;' data-role="footer" data-theme="d">
<a href="http://developer.eventbrite.com/"><img src="http://evbdn.eventbrite.com/s3-s3/static/images/django/logos/eb_powered.png"/></a>
</div><!-- /footer -->
</div><!-- /page -->
<div id="events" data-role="page">
<div data-iconpos="right" data-role="header">
<a href="#home" data-rel="back" data-direction="reverse" data-role="button" data-theme="b" data-icon='arrow-l'>Back</a>
<h1>My Events</h1>
</div><!-- /header -->
<div data-role="content">
<div id='myevents'>Loading...</div>
</div><!-- /content -->
</div><!-- /page -->
<div id="organizers" data-role="page">
<div data-iconpos="right" data-role="header">
<a href="#home" data-rel="back" data-direction="reverse" data-role="button" data-theme="b" data-icon='arrow-l'>Back</a>
<h1>My Organizer Profiles</h1>
</div><!-- /header -->
<div data-role="content">
<p>Loading...</p>
</div><!-- /content -->
</div><!-- /page -->
<div id="tickets" data-role="page">
<div data-iconpos="right" data-role="header">
<a href="#home" data-rel="back" data-direction="reverse" data-role="button" data-theme="b" data-icon='arrow-l'>Back</a>
<h1>My Tickets</h1>
</div><!-- /header -->
<div data-role="content">
<p>Loading...</p>
</div><!-- /content -->
</div><!-- /page -->
<div id="setup" data-role="page">
<div data-theme="b" data-iconpos="right" data-role="header">
<h1>Account Setup</h1>
</div><!-- /header -->
<div data-role="content">
<div class='ui-body ui-body-c eb_login_box'>
<div class='eb_login_widget'>
<div class='eb_login_loading'> Loading... </div>
<div class='eb_user_info' style='display:none;'>
<p>
<span class='eb_user_name'>Anonymous</span><br/>
<span class='eb_user_email'>api@eventbrite.com</span>
</p>
<p class='eb_logout'>
<a data-role='button' data-icon='delete' href='#'>Logout</a>
</p>
</div>
<p class='eb_login_error' style='display:none;'>login error</p>
<p class='eb_login_btn' style='display:none;'>
<a href='#'>Connect to Eventbrite</a>
</p>
</div>
</div>
</div><!-- /content -->
</div><!-- /page -->
<div id="account" data-role="page">
<div data-role="header">
<a href="#home" data-rel="back" data-direction="reverse" data-role="button" data-theme="b" data-icon='arrow-l'>Back</a>
<h1>My Eventbrite Account</h1>
</div><!-- /header -->
<div data-role="content">
<div class='ui-body ui-body-c eb_login_box'>
<div class='eb_login_widget'>
<div class='eb_login_loading'> Loading... </div>
<div class='eb_user_info' style='display:none;'>
<p>
<span class='eb_user_name'>Anonymous</span><br/>
<span class='eb_user_email'>api@eventbrite.com</span>
</p>
<p class='eb_logout'>
<a data-role='button' data-icon='delete' href='#'>Logout</a>
</p>
</div>
<p class='eb_login_error' style='display:none;'>login error</p>
<p class='eb_login_btn' style='display:none;'>
<a href='#'>Connect to Eventbrite</a>
</p>
</div>
</div>
</div><!-- /content -->
</div><!-- /page -->
<div id="search" data-role="page">
<div data-icon="search" data-iconpos="right" data-role="header">
<a href="#home" data-rel="back" data-direction="reverse" data-role="button" data-theme="b" data-icon='arrow-l'>Back</a>
<h1>Find Events</h1>
</div><!-- /header -->
<div data-role="content">
<p><i>Coming Soon...</i></p>
</div><!-- /content -->
</div><!-- /page -->
</body>