Skip to content

Commit

Permalink
Merge pull request #20 from brokenhandsio/search-highlight-fix
Browse files Browse the repository at this point in the history
Search highlight fix
  • Loading branch information
0xTim committed Dec 13, 2017
2 parents f57eda2 + 15e1fbd commit dcb1970
Show file tree
Hide file tree
Showing 4 changed files with 38 additions and 36 deletions.
60 changes: 30 additions & 30 deletions Package.resolved
Expand Up @@ -60,17 +60,17 @@
"repositoryURL": "https://github.com/vapor/console.git",
"state": {
"branch": null,
"revision": "11c0694857d1be6c7b8b30d8db8b1162b73f2a2b",
"version": "2.2.0"
"revision": "df9eb9a6afd03851abcb3d8204d04c368729776e",
"version": "2.3.0"
}
},
{
"package": "Core",
"repositoryURL": "https://github.com/vapor/core.git",
"state": {
"branch": null,
"revision": "b8330808f4f6b69941961afe8ad6b015562f7b7c",
"version": "2.1.2"
"revision": "f9f3a585ab0ea5764b46d7a36d9c0d9d508b9c63",
"version": "2.2.0"
}
},
{
Expand Down Expand Up @@ -105,26 +105,26 @@
"repositoryURL": "https://github.com/vapor/fluent.git",
"state": {
"branch": null,
"revision": "9f94af35b177b5a5fdc40a81703e68c072c5013d",
"version": "2.4.1"
"revision": "2c66e5c6c99dac19554e1cb8957e6de256009efc",
"version": "2.4.2"
}
},
{
"package": "FluentProvider",
"repositoryURL": "https://github.com/vapor/fluent-provider.git",
"state": {
"branch": null,
"revision": "3bb67ad0be2df74367087e90391436b4336e7962",
"version": "1.2.0"
"revision": "425d973f7cad7bfa987409b9e4a8659c14c6f0e0",
"version": "1.3.0"
}
},
{
"package": "JSON",
"repositoryURL": "https://github.com/vapor/json.git",
"state": {
"branch": null,
"revision": "5c2a62771cefdb04b1f96f4ccc52b581fe20cfb1",
"version": "2.2.0"
"revision": "735800d8f2e75ebe3be25559eb6a781f4666dcfc",
"version": "2.2.1"
}
},
{
Expand Down Expand Up @@ -159,35 +159,35 @@
"repositoryURL": "https://github.com/vapor-community/markdown-provider.git",
"state": {
"branch": null,
"revision": "bd3820af8bd6b0ffd2b279f105e5df0850f58edd",
"version": "1.1.0"
"revision": "554143db48dc1e1fb3ebceb83eb501a39966db08",
"version": "1.1.1"
}
},
{
"package": "Multipart",
"repositoryURL": "https://github.com/vapor/multipart.git",
"state": {
"branch": null,
"revision": "f32d0952b8d4dfcef5ea194e85c1968d90f97bf0",
"version": "2.1.0"
"revision": "8e541b2e6fc64a3741eca2aa48ee2c3f23cbe17c",
"version": "2.1.1"
}
},
{
"package": "MySQL",
"repositoryURL": "https://github.com/vapor/mysql.git",
"state": {
"branch": null,
"revision": "45d6c07a1715a2a1f52e27be918b860dfda5a198",
"version": "2.0.2"
"revision": "22f7cc1cb060f1e749a5d8feebb1803148744975",
"version": "2.0.3"
}
},
{
"package": "MySQLDriver",
"repositoryURL": "https://github.com/vapor/mysql-driver.git",
"state": {
"branch": null,
"revision": "bf16cc056a57a1d8c4fb25add22666112c1206e4",
"version": "2.0.2"
"revision": "2f6eead84aabb265a4dae3e07083dd1b7eaa262b",
"version": "2.0.3"
}
},
{
Expand Down Expand Up @@ -222,8 +222,8 @@
"repositoryURL": "https://github.com/vapor/routing.git",
"state": {
"branch": null,
"revision": "66750975f5e5abaacf4bfa4d37ec85dd20c89312",
"version": "2.1.0"
"revision": "cb9d78aca2540c1a6b45b0ab43e5b0c50f29d216",
"version": "2.2.0"
}
},
{
Expand All @@ -240,17 +240,17 @@
"repositoryURL": "https://github.com/vapor/sockets.git",
"state": {
"branch": null,
"revision": "f6b06982e94db71227e99c56fec5899a8526e8ad",
"version": "2.1.0"
"revision": "70d14c0e223257176f5ef69a595f7cad5de7a88b",
"version": "2.2.1"
}
},
{
"package": "SteamPress",
"repositoryURL": "https://github.com/brokenhandsio/SteamPress.git",
"state": {
"branch": null,
"revision": "23a31792e9f8da03bd6a7e07bbf0c5a51df57b32",
"version": "0.16.0"
"revision": "c0253ba08a91b285bdbc4fff65d339a206884b89",
"version": "0.16.1"
}
},
{
Expand All @@ -267,8 +267,8 @@
"repositoryURL": "https://github.com/scinfu/SwiftSoup.git",
"state": {
"branch": null,
"revision": "4a4ab9534be3f9a7f52bbc3862427300e45b8124",
"version": "1.5.1"
"revision": "cebd4851bcc8a0d0fedebdafca820303073280a9",
"version": "1.5.9"
}
},
{
Expand All @@ -285,17 +285,17 @@
"repositoryURL": "https://github.com/vapor/validation.git",
"state": {
"branch": null,
"revision": "22004efe55060bb707fda0cac0508506c7730533",
"version": "1.0.1"
"revision": "e5a7e54ef7a611b168806191df5d6b6782fd43ed",
"version": "1.1.1"
}
},
{
"package": "Vapor",
"repositoryURL": "https://github.com/vapor/vapor.git",
"state": {
"branch": null,
"revision": "59bde985edbdf6480c541485317c8d41cc5fefb7",
"version": "2.2.2"
"revision": "63768e7f56e58dbfa4288e16ad2e4003bfd8dcde",
"version": "2.4.0"
}
},
{
Expand Down
3 changes: 2 additions & 1 deletion Public/static/css/style.css
Expand Up @@ -287,6 +287,7 @@ h1.lead-title-blog {
width: 50%;
}

.highlight {
mark {
background-color: rgba(223, 127, 129, 0.5);
padding: 0px;
}
10 changes: 5 additions & 5 deletions Public/static/js/search.js
@@ -1,9 +1,9 @@
var term = $("#search-data").data("searchTerm");

if(term.length !== 0){
$('.blog-post').each(function(){
var search_value = term;
var search_regexp = new RegExp(search_value, "gi");
$(this).html($(this).html().replace(search_regexp, "<span class = 'highlight'>" + term + "</span>"));
});
var options = {
"separateWordSearch": false,

};
$('.card-body').mark(term, options);
}
1 change: 1 addition & 0 deletions Resources/Views/blog/search.leaf
Expand Up @@ -33,6 +33,7 @@
<div id="google-analytics-data" data-identifier="#(google_analytics_identifier)"></div>
<script src="/static/js/analytics.js"></script>
}
<script src="https://cdn.jsdelivr.net/npm/mark.js@8.11.0/dist/jquery.mark.es6.min.js" integrity="sha256-JD1hL6vpVBtkR8DhzXoWBh40DpSCwrvHsZLgbeRTgsk= sha384-yJZr0Gj9WqrJtN9WboBW5j1foKZAwiRvZ8BMUUvdYaoJyzxj7XSxOmCL1/THs6Gq sha512-9nYqM9eBjvsME/qdnlpi+jJo5WiwqS0NN3JVYaJlKjyYhMHNkzLWAABMFmH5kIxROXisCVx9QUBPzzBWTXg2zw==" crossorigin="anonymous"></script>
<script src="/static/js/search.js"></script>
}

Expand Down

0 comments on commit dcb1970

Please sign in to comment.