9
9
10
10
< link href ="css/basic-styles.css " rel ="stylesheet " />
11
11
< link href ="css/slide.css " rel ="stylesheet " />
12
- < link href ='http://fonts.googleapis.com/css?family=Libre+Baskerville :400,700,400italic ' rel ='stylesheet ' type ='text/css '>
12
+ < link href ='http://fonts.googleapis.com/css?family=Cabin+Condensed :400,700 ' rel ='stylesheet ' type ='text/css '>
13
13
< link rel ="shortcut icon " href ="favicon.ico " />
14
14
</ head >
15
15
< body >
16
+ < script >
17
+ // To use this demo on your own, you should change these values.
18
+ var settings = {
19
+ APP_ID : '410001752413776' ,
20
+ EVENT_ID : '314881508624057'
21
+ } ;
22
+ </ script >
23
+
24
+ < img src ="images/loading.gif " class ="preload " />
16
25
17
26
<!-- This contains all the slides -->
18
27
< div id ="impress ">
@@ -215,11 +224,6 @@ <h1 class="center">the "graph"</h1>
215
224
Demo:
216
225
< strong > Attendees of the PennApps FB event</ strong >
217
226
</ p >
218
- < input
219
- type ="button "
220
- onclick ="fillAttendeesOfPennApps(); "
221
- value ="Show me attendees! "
222
- />
223
227
< pre > FB.api(
224
228
'< b > /314881508624057?fields=attending.fields(picture,name)</ b > ',
225
229
function(< b > response</ b > ) {
@@ -229,6 +233,11 @@ <h1 class="center">the "graph"</h1>
229
233
*/
230
234
}
231
235
);</ pre >
236
+ < input
237
+ type ="button "
238
+ onclick ="fillAttendeesOfPennApps(); "
239
+ value ="Run API Call "
240
+ />
232
241
< div id ="event-attendees-results " class ="results "> </ div >
233
242
< script >
234
243
var returnIsErrorAndAlertIfNeeded = function ( response ) {
@@ -246,18 +255,21 @@ <h1 class="center">the "graph"</h1>
246
255
https://developers.facebook.com/tools/explorer?method=GET&path=me%2Fevents
247
256
!!! make sure you add user_events to your access token !!!
248
257
*/
249
- FB . api ( '/314881508624057?fields=attending.fields(picture,name)' , function ( response ) {
258
+ $ ( '#event-attendees-results' ) . html ( '' ) . addClass ( 'loading' ) ;
259
+ FB . api ( '/' + settings . EVENT_ID + '?fields=attending.fields(picture,name)' , function ( response ) {
250
260
if ( returnIsErrorAndAlertIfNeeded ( response ) )
251
261
return ;
252
- var results = $ ( '#event-attendees-results' ) . html ( '' ) ;
262
+ var results = $ ( '#event-attendees-results' ) . html ( '' ) . removeClass ( 'loading' ) ;
253
263
var attendees = response . attending . data ;
254
264
var numAdded = 0 ;
255
265
for ( var i = 0 ; numAdded < 60 && i < attendees . length ; i ++ ) {
256
266
var person = attendees [ i ] ;
257
- if ( person . picture . data . is_silhouette )
267
+ var picture_data = person . picture . data ;
268
+ if ( picture_data . is_silhouette ) {
258
269
continue ;
270
+ }
259
271
numAdded ++ ;
260
- appendImg ( results , person . picture . data . url ) ;
272
+ appendImg ( results , picture_data . url ) ;
261
273
}
262
274
} ) ;
263
275
} ;
@@ -281,11 +293,6 @@ <h1 class="center">the "graph"</h1>
281
293
Demo:
282
294
< strong > Recent Music Listens</ strong >
283
295
</ p >
284
- < input
285
- type ="button "
286
- onclick ="fillMusicListens(); "
287
- value ="Reveal my music! "
288
- />
289
296
290
297
< pre > FB.api(
291
298
'< b > /me/music.listens</ b > ',
@@ -296,14 +303,20 @@ <h1 class="center">the "graph"</h1>
296
303
*/
297
304
}
298
305
);</ pre >
306
+ < input
307
+ type ="button "
308
+ onclick ="fillMusicListens(); "
309
+ value ="Run API Call "
310
+ />
299
311
< div id ='music-listens-results ' class ="results "> </ div >
300
312
< script >
301
313
var fillMusicListens = function ( ) {
314
+ $ ( '#music-listens-results' ) . html ( '' ) . addClass ( 'loading' ) ;
302
315
FB . api ( '/me/music.listens' , function ( response ) {
303
316
if ( returnIsErrorAndAlertIfNeeded ( response ) )
304
317
return ;
305
- var results = $ ( '#music-listens-results' ) . html ( '' ) ;
306
- for ( var i = 0 ; i < response . data . length && i < 24 ; i ++ ) {
318
+ var results = $ ( '#music-listens-results' ) . html ( '' ) . removeClass ( 'loading' ) ;
319
+ for ( var i = 0 ; i < response . data . length && i < 22 ; i ++ ) {
307
320
FB . api ( '/' + response . data [ i ] . data . song . id , function ( response ) {
308
321
if ( response && response . image && response . image [ 0 ] && response . image [ 0 ] . url )
309
322
appendImg ( results , response . image [ 0 ] . url ) ;
@@ -327,12 +340,17 @@ <h1 class="center">the "graph"</h1>
327
340
< div class ="caption fl ">
328
341
< h1 > plugins</ h1 >
329
342
< h2 > copy and paste widgets for easy interaction</ h2 >
343
+
344
+ < h2 class ="live ">
345
+ this is live btw, not a screenshot.< br />
346
+ go on and add a comment →
347
+ </ h2 >
330
348
</ div >
331
349
< div
332
350
class ="fb-comments fr "
333
351
data-href ="http://ldvchen.github.com/fbapidemo "
334
352
data-width ="470 "
335
- data-num-posts ="4 "
353
+ data-num-posts ="3 "
336
354
data-order-by ="reverse_time ">
337
355
</ div >
338
356
</ div >
@@ -366,7 +384,7 @@ <h1>tl;dr</h1>
366
384
< a href ="https://developers.facebook.com/docs/concepts/login/ ">
367
385
< b class ="accent-yellow "> Facebook Login</ b >
368
386
</ a >
369
- = easily rig up a login system
387
+ = quickly & easily rig up a login system
370
388
</ p >
371
389
< p >
372
390
< a href ="https://developers.facebook.com/docs/reference/api/ ">
@@ -461,7 +479,7 @@ <h2>p.s.</h2>
461
479
window . fbAsyncInit = function ( ) {
462
480
update_html_from_login_state ( false , { } ) ;
463
481
FB . init ( {
464
- appId : '410001752413776' , // App ID
482
+ appId : settings . APP_ID , // App ID
465
483
status : true , // check login status
466
484
cookie : true , // enable cookies to allow the server to access the session
467
485
xfbml : true // parse XFBML
0 commit comments