11function getNav ( ) {
22 var mobileNav = $ ( 'nav[role=navigation] fieldset[role=search]' ) . after ( '<fieldset class="mobile-nav"></fieldset>' ) . next ( ) . append ( '<select></select>' ) ;
33 mobileNav . children ( 'select' ) . append ( '<option value="">Navigate…</option>' ) ;
4+ $ ( 'ul[role=main-navigation]' ) . addClass ( 'main-navigation' ) ;
45 $ ( 'ul.main-navigation a' ) . each ( function ( link ) {
56 mobileNav . children ( 'select' ) . append ( '<option value="' + link . href + '">• ' + link . text + '</option>' ) ;
67 } ) ;
78 mobileNav . children ( 'select' ) . bind ( 'change' , function ( event ) {
8- if ( event . target . value ) window . location . href = event . target . value ;
9+ if ( event . target . value ) { window . location . href = event . target . value ; }
910 } ) ;
1011}
1112
1213function addSidebarToggler ( ) {
13- $ ( '#content' ) . append ( '<span class="toggle-sidebar"></span>' ) ;
14- $ ( '.toggle-sidebar' ) . bind ( 'click' , function ( e ) {
15- e . preventDefault ( ) ;
16- if ( $ ( 'body' ) . hasClass ( 'collapse-sidebar' ) ) {
17- $ ( 'body' ) . removeClass ( 'collapse-sidebar' ) ;
18- } else {
19- $ ( 'body' ) . addClass ( 'collapse-sidebar' ) ;
20- }
21- } ) ;
14+ if ( ! $ ( 'body' ) . hasClass ( 'sidebar-footer' ) ) {
15+ $ ( '#content' ) . append ( '<span class="toggle-sidebar"></span>' ) ;
16+ $ ( '.toggle-sidebar' ) . bind ( 'click' , function ( e ) {
17+ e . preventDefault ( ) ;
18+ if ( $ ( 'body' ) . hasClass ( 'collapse-sidebar' ) ) {
19+ $ ( 'body' ) . removeClass ( 'collapse-sidebar' ) ;
20+ } else {
21+ $ ( 'body' ) . addClass ( 'collapse-sidebar' ) ;
22+ }
23+ } ) ;
24+ }
2225 var sections = $ ( 'aside.sidebar > section' ) ;
2326 if ( sections . length > 1 ) {
2427 sections . each ( function ( section , index ) {
@@ -49,13 +52,13 @@ function testFeatures() {
4952}
5053
5154function addCodeLineNumbers ( ) {
52- if ( navigator . appName == 'Microsoft Internet Explorer' ) { return ; }
55+ if ( navigator . appName === 'Microsoft Internet Explorer' ) { return ; }
5356 $ ( 'div.gist-highlight' ) . each ( function ( code ) {
5457 var tableStart = '<table><tbody><tr><td class="gutter">' ,
5558 lineNumbers = '<pre class="line-numbers">' ,
5659 tableMiddle = '</pre></td><td class="code">' ,
5760 tableEnd = '</td></tr></tbody></table>' ,
58- count = $ ( 'span .line' , code ) . length ;
61+ count = $ ( '.line' , code ) . length ;
5962 for ( var i = 1 ; i <= count ; i ++ ) {
6063 lineNumbers += '<span class="line-number">' + i + '</span>\n' ;
6164 }
@@ -69,7 +72,7 @@ function flashVideoFallback(){
6972 flashplayerskin = "/assets/jwplayer/glow/glow.xml" ;
7073 $ ( 'video' ) . each ( function ( video ) {
7174 video = $ ( video ) ;
72- if ( ! Modernizr . video . h264 && swfobject . getFlashPlayerVersion ( ) || window . location . hash . indexOf ( "flash-test" ) != - 1 ) {
75+ if ( ! Modernizr . video . h264 && swfobject . getFlashPlayerVersion ( ) || window . location . hash . indexOf ( "flash-test" ) !== - 1 ) {
7376 video . children ( 'source[src$=mp4]' ) . first ( ) . map ( function ( source ) {
7477 var src = $ ( source ) . attr ( 'src' ) ,
7578 id = 'video_' + Math . round ( 1 + Math . random ( ) * ( 100000 ) ) ,
@@ -89,7 +92,7 @@ function flashVideoFallback(){
8992function wrapFlashVideos ( ) {
9093 $ ( 'object' ) . each ( function ( object ) {
9194 object = $ ( object ) ;
92- if ( object . children ( 'param[name=movie]' ) ) {
95+ if ( $ ( 'param[name=movie]' , object ) . length ) {
9396 var wrapper = object . before ( '<div class="flash-video"><div>' ) . previous ( ) ;
9497 $ ( wrapper ) . children ( ) . append ( object ) ;
9598 }
@@ -101,6 +104,15 @@ function wrapFlashVideos() {
101104 } ) ;
102105}
103106
107+ function renderDeliciousLinks ( items ) {
108+ var output = "<ul>" ;
109+ for ( var i = 0 , l = items . length ; i < l ; i ++ ) {
110+ output += '<li><a href="' + items [ i ] . u + '" title="Tags: ' + items [ i ] . t . join ( ', ' ) + '">' + items [ i ] . d + '</a></li>' ;
111+ }
112+ output += "</ul>" ;
113+ $ ( '#delicious' ) . html ( output ) ;
114+ }
115+
104116$ . domReady ( function ( ) {
105117 testFeatures ( ) ;
106118 wrapFlashVideos ( ) ;
0 commit comments