@@ -302,6 +302,92 @@ <h4>they support us_</h4>
302
302
{% include js.html %}
303
303
304
304
<!-- SCRIPTS -->
305
+ < script >
306
+ $ ( document ) . ready ( function ( ) {
307
+ function randomCarousel ( id ) {
308
+ var num = $ ( id + ' .item' ) . length ;
309
+ var slide = Math . floor ( ( Math . random ( ) * num ) ) ;
310
+ $ ( id + ' .item' ) . each ( function ( index ) {
311
+ if ( index == slide ) {
312
+ $ ( this ) . addClass ( 'active' ) ;
313
+ } else {
314
+ $ ( this ) . removeClass ( 'active' ) ;
315
+ }
316
+ } ) ;
317
+ }
318
+
319
+ randomCarousel ( '#carousel-tweets' ) ;
320
+ randomCarousel ( '#carousel-companies' ) ;
321
+ } ) ;
322
+ </ script >
323
+
324
+ < script >
325
+ $ ( document ) . ready ( function ( ) {
326
+ var toc = $ ( '#toc' ) ;
327
+ if ( toc . length ) {
328
+ toc . toc ( {
329
+ 'selectors' : 'h2' ,
330
+ 'prefix' : 'toc' ,
331
+ 'container' : '#page' ,
332
+ 'anchorName' : function ( i , heading , prefix ) { //custom function for anchor name
333
+ return $ ( heading ) . text ( ) . replace ( / \s / g, '-' ) . replace ( / [ ^ \w - ] / g, '' ) ;
334
+ } ,
335
+ } ) ;
336
+ }
337
+ } ) ;
338
+ </ script >
339
+
340
+ < script >
341
+ $ ( document ) . ready ( function ( ) {
342
+ var cpContainer = $ ( ".cp:contains('<?php')" ) ;
343
+ var cpContains = $ ( ".cp:contains('?>')" ) ;
344
+ var page = $ ( '#page table' ) ;
345
+ var tocNext = $ ( '#toc' ) ;
346
+ var tocNextUl = $ ( '#toc > ul' ) ;
347
+ var tocNextUlLi = $ ( '#toc ul.list li a' ) ;
348
+
349
+ if ( cpContainer . length ) {
350
+ cpContainer . css ( { visibility : 'hidden' } ) ;
351
+ }
352
+
353
+ if ( cpContains . length ) {
354
+ cpContains . css ( { visibility : 'hidden' } ) ;
355
+ }
356
+
357
+ if ( page . length ) {
358
+ page . addClass ( 'table table-striped table-bordered' ) ;
359
+ }
360
+
361
+ if ( tocNext . length ) {
362
+ tocNext . toc ( {
363
+ 'selectors' : 'h2,h3,h4' ,
364
+ 'prefix' : 'toc' ,
365
+ 'container' : '#page' ,
366
+ //custom function for anchor name
367
+ 'anchorName' : function ( i , heading , prefix ) {
368
+ return $ ( heading ) . text ( ) . replace ( / \s / g, '-' ) . replace ( / [ ^ \w - ] / g, '' ) ;
369
+ } ,
370
+ } ) ;
371
+ }
372
+
373
+ // List.js
374
+ if ( tocNextUl . length ) {
375
+ tocNextUl . addClass ( 'list' ) ;
376
+ }
377
+
378
+ if ( tocNextUlLi . length ) {
379
+ tocNextUlLi . addClass ( 'searchitem' ) ;
380
+ }
381
+
382
+ var options = {
383
+ valueNames : [ 'searchitem' ]
384
+ } ;
385
+ var userList = new List ( 'searchable' , options ) ;
386
+ // end List.js
387
+
388
+ } ) ; // docrdy
389
+ </ script >
390
+
305
391
< script >
306
392
var _gaq = _gaq || [ ] ;
307
393
_gaq . push ( [ '_setAccount' , 'UA-1899308-9' ] ) ;
@@ -320,9 +406,12 @@ <h4>they support us_</h4>
320
406
< script >
321
407
// Adding this layout functionality for mobile views with the homepage hero
322
408
$ ( document ) . ready ( function ( ) {
323
- $ ( '.navbar-toggle' ) . click ( function ( ) {
324
- $ ( '.row.home' ) . toggleClass ( 'no-padding-top' ) ;
409
+ var navbarToggle = $ ( '.navbar-toggle' )
410
+ if ( navbarToggle . length ) {
411
+ navbarToggle . click ( function ( ) {
412
+ $ ( '.row.home' ) . toggleClass ( 'no-padding-top' ) ;
325
413
} ) ;
414
+ }
326
415
} ) ;
327
416
</ script >
328
417
0 commit comments