Skip to content

Commit 09fefe3

Browse files
authored
Merge pull request #35 from keithws/remove-hashchange-library-dependency
Remove hashchange library dependency
2 parents 539718a + 5ff3f34 commit 09fefe3

File tree

7 files changed

+6
-22
lines changed

7 files changed

+6
-22
lines changed

README.md

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,15 +23,13 @@ Requirements:
2323
Include 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

3029
All 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
```

bower.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@
2020
"tests"
2121
],
2222
"dependencies": {
23-
"jquery": ">=1.11.1",
24-
"jquery-hashchange": "latest"
23+
"jquery": ">=1.11.1"
2524
}
2625
}

custom.html

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
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'>

jquery.ba-hashchange.min.js

Lines changed: 0 additions & 12 deletions
This file was deleted.

jquery.swiftype.search.js

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@
128128
});
129129
};
130130

131-
$(window).hashchange(function () {
131+
function handleHashchange () {
132132
var params = $.hashParams();
133133
if (params.stq) {
134134
submitSearch(params.stq, {
@@ -141,7 +141,9 @@
141141
$contentCache.remove();
142142
}
143143
}
144-
});
144+
}
145+
146+
$(window).on("hashchange", handleHashchange);
145147

146148
var $containingForm = $this.parents('form');
147149
if ($containingForm) {
@@ -184,7 +186,7 @@
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

multiple_types.html

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
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'>

standard.html

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
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'>

0 commit comments

Comments
 (0)