File tree Expand file tree Collapse file tree 7 files changed +6
-22
lines changed
Expand file tree Collapse file tree 7 files changed +6
-22
lines changed Original file line number Diff line number Diff line change @@ -23,15 +23,13 @@ Requirements:
2323Include the following in the header of your webpage:
2424
2525* the latest version of jQuery
26- * the [ hashchange] ( https://github.com/cowboy/jquery-hashchange ) jQuery plugin (version included)
2726* the Swiftype Search jQuery plugin
2827* (optional) the Swiftype Search stylesheet
2928
3029All together it should look like this:
3130
3231``` html
3332<script type =" text/javascript" src =" https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js" ></script >
34- <script type =" text/javascript" src =" jquery.ba-hashchange.min.js" ></script >
3533<script type =" text/javascript" src =" jquery.swiftype.search.js" ></script >
3634<link type =" text/css" rel =" stylesheet" href =" search.css" media =" all" />
3735```
Original file line number Diff line number Diff line change 2020 " tests"
2121 ],
2222 "dependencies" : {
23- "jquery" : " >=1.11.1" ,
24- "jquery-hashchange" : " latest"
23+ "jquery" : " >=1.11.1"
2524 }
2625}
Original file line number Diff line number Diff line change 1010 </ style >
1111 < script type ='text/javascript ' src ="http://twitter.github.com/hogan.js/builds/3.0.1/hogan-3.0.1.js "> </ script >
1212 < script type ='text/javascript ' src ="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js "> </ script >
13- < script type ='text/javascript ' src ='jquery.ba-hashchange.min.js '> </ script >
1413 < script type ='text/javascript ' src ='jquery.swiftype.search.js '> </ script >
1514 < link type ='text/css ' rel ='stylesheet ' href ='search.css ' media ='all ' />
1615 < script type ='text/javascript '>
Load Diff This file was deleted.
Original file line number Diff line number Diff line change 128128 } ) ;
129129 } ;
130130
131- $ ( window ) . hashchange ( function ( ) {
131+ function handleHashchange ( ) {
132132 var params = $ . hashParams ( ) ;
133133 if ( params . stq ) {
134134 submitSearch ( params . stq , {
141141 $contentCache . remove ( ) ;
142142 }
143143 }
144- } ) ;
144+ }
145+
146+ $ ( window ) . on ( "hashchange" , handleHashchange ) ;
145147
146148 var $containingForm = $this . parents ( 'form' ) ;
147149 if ( $containingForm ) {
184186 } ;
185187 } ;
186188
187- $ ( window ) . hashchange ( ) ; // if the swiftype query hash is present onload (maybe the user is pressing the back button), submit a query onload
189+ handleHashchange ( ) ; // if the swiftype query hash is present onload (maybe the user is pressing the back button), submit a query onload
188190 } ) ;
189191 } ;
190192
Original file line number Diff line number Diff line change 33 < head >
44 < script type ='text/javascript ' src ="http://twitter.github.com/hogan.js/builds/3.0.1/hogan-3.0.1.js "> </ script >
55 < script type ='text/javascript ' src ="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js "> </ script >
6- < script type ='text/javascript ' src ='jquery.ba-hashchange.min.js '> </ script >
76 < script type ='text/javascript ' src ='jquery.swiftype.search.js '> </ script >
87 < link type ='text/css ' rel ='stylesheet ' href ='search.css ' media ='all ' />
98 < script type ='text/javascript '>
Original file line number Diff line number Diff line change 22< html >
33 < head >
44 < script type ='text/javascript ' src ="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js "> </ script >
5- < script type ='text/javascript ' src ='jquery.ba-hashchange.min.js '> </ script >
65 < script type ='text/javascript ' src ='jquery.swiftype.search.js '> </ script >
76 < link type ='text/css ' rel ='stylesheet ' href ='search.css ' media ='all ' />
87 < script type ='text/javascript '>
You can’t perform that action at this time.
0 commit comments