28
28
29
29
30
30
<!-- see: https://github.com/thybag/PJAX-Standalone -->
31
- < script src ='js/pjax-standalone.js '> </ script >
32
- < script type ='text/javascript '>
33
- // Debug output for pjax; replace with
34
- // pjax.connect('content') to silence console output
35
- if ( typeof console === 'undefined' ) console = { "log" :function ( m ) { } } ;
36
-
37
- // PJAX links!
38
- pjax . connect ( {
39
- 'container' : 'pj-content' ,
40
- 'parseJS' : true ,
41
- 'success' : function ( event ) {
42
- var url = ( typeof event . data !== 'undefined' ) ? event . data . url : '' ;
43
- console . log ( "Successfully pjaxed " + url ) ;
44
- } ,
45
- 'error' : function ( event ) {
46
- var url = ( typeof event . data !== 'undefined' ) ? event . data . url : '' ;
47
- console . log ( "Could not load " + url ) ;
48
- } ,
49
- 'ready' : function ( ) {
50
- console . log ( "PJAX loaded!" ) ;
51
- }
52
- } ) ;
31
+ < script src ="js/jquery-1.8.3.min.js "> </ script >
32
+ < script src ="js/jquery.pjax.js "> </ script >
33
+ < script >
34
+ // set all links inside pj-content to try pjax
35
+ $ ( document ) . pjax ( 'a' , '#pj-content' , { fragment : '#pj-content' } ) ;
36
+ // set explicit links in nav bar to use pjax
37
+ $ ( document ) . pjax ( 'a[data-pjax]' , '#pj-content' , { fragment : '#pj-content' } ) ;
53
38
</ script >
54
39
55
-
56
- <!-- pull in nav header with jquery in footer -->
40
+ <!-- pull in nav header with jquery script in footer -->
57
41
< div id ="head-nav "> </ div >
58
42
59
43
</ head >
@@ -367,7 +351,7 @@ <h2>Source code</h2>
367
351
< p >
368
352
All the code produced as part of the OpenWorm project is on < a
369
353
href ="http://docs.openworm.org/en/latest/Community/github.html#github "
370
- target ="_blank "> GitHub</ a >
354
+ target ="_blank "> GitHub</ a >
371
355
under < a href ="http://opensource.org/licenses/MIT " target ="_blank "> MIT</ a > licence. Different < a
372
356
href ="http://docs.openworm.org/en/latest/projects.html " target ="_blank "> sub-projects</ a > are
373
357
hosted in different repositories.
@@ -414,14 +398,6 @@ <h1>Meet with us</h1> <br>
414
398
</ div >
415
399
</ div >
416
400
< script >
417
- ( function ( d , s , id ) {
418
- var js , fjs = d . getElementsByTagName ( s ) [ 0 ] ;
419
- if ( d . getElementById ( id ) ) return ;
420
- js = d . createElement ( s ) ;
421
- js . id = id ;
422
- js . src = "//connect.facebook.net/en_US/all.js#xfbml=1" ;
423
- fjs . parentNode . insertBefore ( js , fjs ) ;
424
- } ( document , 'script' , 'facebook-jssdk' ) ) ;
425
401
// set active nav
426
402
$ ( '.nav li' ) . removeClass ( 'active' ) ;
427
403
$ ( '#home' ) . addClass ( 'active' ) ;
@@ -438,7 +414,6 @@ <h1>Meet with us</h1> <br>
438
414
================================================== -->
439
415
<!-- Placed at the end of the document so the pages load faster -->
440
416
< script type ="text/javascript " src ="http://platform.twitter.com/widgets.js "> </ script >
441
- < script src ="js/jquery-1.8.3.min.js "> </ script >
442
417
< script src ="js/bootstrap.js "> </ script >
443
418
< script type ="text/javascript " src ="js/jquery.parss.uncompressed.js "> </ script >
444
419
@@ -459,14 +434,32 @@ <h1>Meet with us</h1> <br>
459
434
_gaq . push ( [ '_setAccount' , 'UA-29668455-1' ] ) ;
460
435
_gaq . push ( [ '_trackPageview' ] ) ;
461
436
462
- ( function ( ) {
437
+ function loadGoogle ( ) {
463
438
var ga = document . createElement ( 'script' ) ;
464
439
ga . type = 'text/javascript' ;
465
440
ga . async = true ;
466
- ga . src = ( 'https:' == document . location . protocol ? 'https://ssl' : 'http://www' ) + '.google-analytics.com/ga.js' ;
441
+ ga . src = ( 'https:' == document . location . protocol ? 'https://ssl' : 'http://www' ) +
442
+ '.google-analytics.com/ga.js' ;
467
443
var s = document . getElementsByTagName ( 'script' ) [ 0 ] ;
468
444
s . parentNode . insertBefore ( ga , s ) ;
469
- } ) ( ) ;
445
+ }
446
+
447
+ function loadFacebook ( ) {
448
+ var js , fjs = document . getElementsByTagName ( 'script' ) [ 0 ] ;
449
+ if ( document . getElementById ( 'facebook-jssdk' ) ) return ;
450
+ js = document . createElement ( 'script' ) ;
451
+ js . id = 'facebook-jssdk' ;
452
+ js . src = "//connect.facebook.net/en_US/all.js#xfbml=1" ;
453
+ fjs . parentNode . insertBefore ( js , fjs ) ;
454
+ }
455
+
456
+ $ ( document ) . on ( 'pjax:complete' , function ( ) {
457
+ // do stuff when pjax finished
458
+ alert ( 'pjaxed that page!' ) ;
459
+ loadGoogle ( ) ;
460
+ loadFacebook ( ) ;
461
+ } )
462
+
470
463
</ script >
471
464
</ body >
472
465
0 commit comments