3131 < img src ="./img/logo_pythonbooks.png " alt ="python tutorials " width ="300 " height ="50 ">
3232 < h1 > The best free Python resources</ h1 >
3333 < a href ="http://www.revolunet.com " target ="_blank " title ="revolunet " id ="headerlink "> by revolunet - rich web apps for desktop and mobile</ a >
34- < ul >
34+ < ul id =" social_buttons " >
3535 < li >
3636 < a href ="https://twitter.com/share " class ="twitter-share-button " data-text ="Here are the best Python ressources to learn #python for free ! #webdevelopment #python " data-via ="revolunet "> </ a >
3737 < script > ! function ( d , s , id ) { var js , fjs = d . getElementsByTagName ( s ) [ 0 ] ; if ( ! d . getElementById ( id ) ) { js = d . createElement ( s ) ; js . id = id ; js . src = "//platform.twitter.com/widgets.js" ; fjs . parentNode . insertBefore ( js , fjs ) ; } } ( document , "script" , "twitter-wjs" ) ; </ script >
@@ -54,7 +54,24 @@ <h1>The best free Python resources</h1>
5454 </div>
5555 </div>
5656 -->
57- < p > </ p >
57+ < div class ="row ">
58+ < div class ="pythonbooks span12 ">
59+ < p > See also :</ p >
60+ < a href ="http://jsbooks.revolunet.com/ " target ="_blank ">
61+ < img src ="./img/logo_jsbooks.png " alt ="JS Books " title ="Learn JS for free ! " width ="" height ="16 ">
62+ </ a >
63+ </ div >
64+
65+ < div class ="span12 row-fluid ">
66+ < p class ="span1 "> Filter by :</ p >
67+ < ul id ="filterBy ">
68+ < li > < a href ="# " data-level ="any " class ="active " title ="filter books by All "> All</ a > </ li >
69+ < li > < a href ="# " data-level ="Beginner " title ="filter books by Beginner "> Beginner</ a > </ li >
70+ < li > < a href ="# " data-level ="Intermediate " title ="filter books by Intermediate "> Intermediate</ a > </ li >
71+ < li > < a href ="# " data-level ="Advanced " title ="filter books by Advanced "> Advanced</ a > </ li >
72+ </ ul >
73+ </ div >
74+ </ div >
5875
5976 <!-- ///////// BOOKS -->
6077 < div class ="row " id ="issueswrap "> </ div >
@@ -85,12 +102,37 @@ <h1>The best free Python resources</h1>
85102 return ( Math . round ( Math . random ( ) ) - 0.5 ) ;
86103 }
87104
105+ function filterBy ( ) {
106+ var // var's sort by
107+ active = 'active' ,
108+ btFilterBy = $ ( '#filterBy' ) . find ( 'a' ) ,
109+ booksection = $ ( '.booksection' ) ;
110+
111+ // interaction filter by level
112+ btFilterBy . on ( 'click' , function ( e ) {
113+ e . preventDefault ( ) ;
114+ var level = $ ( this ) . data ( 'level' ) ;
115+ if ( level === 'any' ) {
116+ // restore all books
117+ booksection . show ( ) ;
118+ } else {
119+ booksection . not ( '.' + level ) . fadeOut ( 'fast' ) ;
120+ booksection . filter ( '.' + level ) . fadeIn ( 'fast' ) ;
121+ }
122+
123+ btFilterBy . removeClass ( active ) ;
124+ $ ( this ) . addClass ( active ) ;
125+ } ) ;
126+ }
127+
128+
88129 $ ( document ) . ready ( function ( ) {
89130 $ . getJSON ( './issues.json?' + Math . random ( ) , function ( data ) {
90131 var template = $ ( '#booktpl' ) . html ( ) ;
91132 data . books . sort ( randOrd ) ;
92133 var html = Mustache . to_html ( template , data ) ;
93134 $ ( '#issueswrap' ) . html ( html ) ;
135+ filterBy ( ) ;
94136 } ) ;
95137 $ ( '#mod_infos' ) . hide ( ) ;
96138 $ ( 'a.#infos' ) . on ( 'click' , function ( ) {
@@ -101,7 +143,7 @@ <h1>The best free Python resources</h1>
101143
102144 < script id ="booktpl " type ="text/template ">
103145 { { #books} }
104- < div class = "span4 booksection" >
146+ < div class = "span4 booksection {{ level }} " >
105147 < a target = "_blank" href = "{{url}}" >
106148 < div class = "view" > </ div >
107149 < div title = "{{ title }}" id = "cover" style = "background:black url('{{cover}}') no-repeat center;-webkit-background-size:cover;-moz-background-size:cover;background-size:cover;" >
0 commit comments