Skip to content

Commit

Permalink
Merge pull request #35 from keithws/remove-hashchange-library-dependency
Browse files Browse the repository at this point in the history
Remove hashchange library dependency
  • Loading branch information
JasonStoltz authored Feb 13, 2019
2 parents 539718a + 5ff3f34 commit 09fefe3
Show file tree
Hide file tree
Showing 7 changed files with 6 additions and 22 deletions.
2 changes: 0 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,15 +23,13 @@ Requirements:
Include the following in the header of your webpage:

* the latest version of jQuery
* the [hashchange](https://github.com/cowboy/jquery-hashchange) jQuery plugin (version included)
* the Swiftype Search jQuery plugin
* (optional) the Swiftype Search stylesheet

All together it should look like this:

```html
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
<script type="text/javascript" src="jquery.ba-hashchange.min.js"></script>
<script type="text/javascript" src="jquery.swiftype.search.js"></script>
<link type="text/css" rel="stylesheet" href="search.css" media="all" />
```
Expand Down
3 changes: 1 addition & 2 deletions bower.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
"tests"
],
"dependencies": {
"jquery": ">=1.11.1",
"jquery-hashchange": "latest"
"jquery": ">=1.11.1"
}
}
1 change: 0 additions & 1 deletion custom.html
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
</style>
<script type='text/javascript' src="http://twitter.github.com/hogan.js/builds/3.0.1/hogan-3.0.1.js"></script>
<script type='text/javascript' src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
<script type='text/javascript' src='jquery.ba-hashchange.min.js'></script>
<script type='text/javascript' src='jquery.swiftype.search.js'></script>
<link type='text/css' rel='stylesheet' href='search.css' media='all' />
<script type='text/javascript'>
Expand Down
12 changes: 0 additions & 12 deletions jquery.ba-hashchange.min.js

This file was deleted.

8 changes: 5 additions & 3 deletions jquery.swiftype.search.js
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@
});
};

$(window).hashchange(function () {
function handleHashchange () {
var params = $.hashParams();
if (params.stq) {
submitSearch(params.stq, {
Expand All @@ -141,7 +141,9 @@
$contentCache.remove();
}
}
});
}

$(window).on("hashchange", handleHashchange);

var $containingForm = $this.parents('form');
if ($containingForm) {
Expand Down Expand Up @@ -184,7 +186,7 @@
};
};

$(window).hashchange(); // if the swiftype query hash is present onload (maybe the user is pressing the back button), submit a query onload
handleHashchange(); // if the swiftype query hash is present onload (maybe the user is pressing the back button), submit a query onload
});
};

Expand Down
1 change: 0 additions & 1 deletion multiple_types.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
<head>
<script type='text/javascript' src="http://twitter.github.com/hogan.js/builds/3.0.1/hogan-3.0.1.js"></script>
<script type='text/javascript' src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
<script type='text/javascript' src='jquery.ba-hashchange.min.js'></script>
<script type='text/javascript' src='jquery.swiftype.search.js'></script>
<link type='text/css' rel='stylesheet' href='search.css' media='all' />
<script type='text/javascript'>
Expand Down
1 change: 0 additions & 1 deletion standard.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
<html>
<head>
<script type='text/javascript' src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
<script type='text/javascript' src='jquery.ba-hashchange.min.js'></script>
<script type='text/javascript' src='jquery.swiftype.search.js'></script>
<link type='text/css' rel='stylesheet' href='search.css' media='all' />
<script type='text/javascript'>
Expand Down

0 comments on commit 09fefe3

Please sign in to comment.