File tree Expand file tree Collapse file tree 5 files changed +19
-0
lines changed
Expand file tree Collapse file tree 5 files changed +19
-0
lines changed Original file line number Diff line number Diff line change 1+ # Contributors
Original file line number Diff line number Diff line change @@ -156,6 +156,10 @@ impl Renderer for HtmlHandlebars {
156156 let mut css_file = try!( File :: create ( book. get_dest ( ) . join ( "book.css" ) ) ) ;
157157 try!( css_file. write_all ( & theme. css ) ) ;
158158
159+ // JQuery
160+ let mut jquery = try!( File :: create ( book. get_dest ( ) . join ( "jquery.js" ) ) ) ;
161+ try!( jquery. write_all ( & theme. jquery ) ) ;
162+
159163 // syntax highlighting
160164 let mut highlight_css = try!( File :: create ( book. get_dest ( ) . join ( "highlight.css" ) ) ) ;
161165 try!( highlight_css. write_all ( & theme. highlight_css ) ) ;
Original file line number Diff line number Diff line change 7171
7272 </div >
7373
74+ <!-- Fetch JQuery from CDN but have a local fallback -->
7475 <script src =" http://code.jquery.com/jquery-2.1.4.min.js" ></script >
76+ <script >
77+ if (typeof jQuery == ' undefined' ) {
78+ document .write (unescape (" %3Cscript src='jquery.js'%3E%3C/script%3E" ));
79+ }
80+ </script >
81+
7582 <script src =" highlight.js" ></script >
7683 <script src =" book.js" ></script >
7784 </body >
Original file line number Diff line number Diff line change @@ -9,6 +9,7 @@ pub static CSS: &'static [u8] = include_bytes!("book.css");
99pub static JS : & ' static [ u8 ] = include_bytes ! ( "book.js" ) ;
1010pub static HIGHLIGHT_JS : & ' static [ u8 ] = include_bytes ! ( "highlight.js" ) ;
1111pub static HIGHLIGHT_CSS : & ' static [ u8 ] = include_bytes ! ( "highlight.css" ) ;
12+ pub static JQUERY : & ' static [ u8 ] = include_bytes ! ( "jquery-2.1.4.min.js" ) ;
1213
1314/// The `Theme` struct should be used instead of the static variables because the `new()` method
1415/// will look if the user has a theme directory in his source folder and use the users theme instead
@@ -22,6 +23,7 @@ pub struct Theme {
2223 pub js : Vec < u8 > ,
2324 pub highlight_css : Vec < u8 > ,
2425 pub highlight_js : Vec < u8 > ,
26+ pub jquery : Vec < u8 > ,
2527}
2628
2729impl Theme {
@@ -34,6 +36,7 @@ impl Theme {
3436 js : JS . to_owned ( ) ,
3537 highlight_css : HIGHLIGHT_CSS . to_owned ( ) ,
3638 highlight_js : HIGHLIGHT_JS . to_owned ( ) ,
39+ jquery : JQUERY . to_owned ( ) ,
3740 } ;
3841
3942 // Check if the given path exists
You can’t perform that action at this time.
0 commit comments