31
31
< img src ="./img/logo_pythonbooks.png " alt ="python tutorials " width ="300 " height ="50 ">
32
32
< h1 > The best free Python resources</ h1 >
33
33
< 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 " >
35
35
< li >
36
36
< 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 >
37
37
< 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>
54
54
</div>
55
55
</div>
56
56
-->
57
- < p > </ p >
57
+ < div class ="row ">
58
+ < div class ="jsbooks span12 ">
59
+ < p > See also :</ p >
60
+ < a href ="http://jsbooks.revolunet.com/ " target ="_blank ">
61
+ < img src ="./img/logo_jsbooks.png " alt ="Javascript Books " title ="Learn Javascript for free ! " width ="" height ="14 ">
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 >
58
75
59
76
<!-- ///////// BOOKS -->
60
77
< div class ="row " id ="issueswrap "> </ div >
@@ -85,12 +102,37 @@ <h1>The best free Python resources</h1>
85
102
return ( Math . round ( Math . random ( ) ) - 0.5 ) ;
86
103
}
87
104
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
+
88
129
$ ( document ) . ready ( function ( ) {
89
130
$ . getJSON ( './issues.json?' + Math . random ( ) , function ( data ) {
90
131
var template = $ ( '#booktpl' ) . html ( ) ;
91
132
data . books . sort ( randOrd ) ;
92
133
var html = Mustache . to_html ( template , data ) ;
93
134
$ ( '#issueswrap' ) . html ( html ) ;
135
+ filterBy ( ) ;
94
136
} ) ;
95
137
$ ( '#mod_infos' ) . hide ( ) ;
96
138
$ ( 'a.#infos' ) . on ( 'click' , function ( ) {
@@ -101,7 +143,7 @@ <h1>The best free Python resources</h1>
101
143
102
144
< script id ="booktpl " type ="text/template ">
103
145
{ { #books} }
104
- < div class = "span4 booksection" >
146
+ < div class = "span4 booksection {{ level }} " >
105
147
< a target = "_blank" href = "{{url}}" >
106
148
< div class = "view" > </ div >
107
149
< 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