From e136ccd6636155e3c7857bf1eeebece9a883339a Mon Sep 17 00:00:00 2001 From: Leclerc Gwendal Date: Wed, 6 Jul 2016 10:15:55 +0200 Subject: [PATCH 1/5] feat: add search support --- layouts/partials/footer.html | 1 - layouts/partials/header.html | 2 + layouts/partials/menu.html | 6 +- layouts/partials/search.html | 114 +++ static/css/horsey.css | 32 + static/css/theme.css | 5 +- static/js/horsey.js | 1571 ++++++++++++++++++++++++++++++++++ static/js/lunr.min.js | 7 + static/json/search.json | 1 + 9 files changed, 1732 insertions(+), 7 deletions(-) create mode 100644 layouts/partials/search.html create mode 100644 static/css/horsey.css create mode 100644 static/js/horsey.js create mode 100644 static/js/lunr.min.js create mode 100644 static/json/search.json diff --git a/layouts/partials/footer.html b/layouts/partials/footer.html index bb8c2dbaaae..5d2cca955e9 100644 --- a/layouts/partials/footer.html +++ b/layouts/partials/footer.html @@ -14,7 +14,6 @@
- diff --git a/layouts/partials/header.html b/layouts/partials/header.html index 533ad0f55dc..4cb03f8f895 100644 --- a/layouts/partials/header.html +++ b/layouts/partials/header.html @@ -13,8 +13,10 @@ + + {{ partial "style.html" . }} diff --git a/layouts/partials/menu.html b/layouts/partials/menu.html index ae65bb0f3ce..729e558d870 100644 --- a/layouts/partials/menu.html +++ b/layouts/partials/menu.html @@ -3,11 +3,7 @@ diff --git a/layouts/partials/search.html b/layouts/partials/search.html new file mode 100644 index 00000000000..a0fbd603c80 --- /dev/null +++ b/layouts/partials/search.html @@ -0,0 +1,114 @@ + + + + \ No newline at end of file diff --git a/static/css/horsey.css b/static/css/horsey.css new file mode 100644 index 00000000000..c4d3eb024f3 --- /dev/null +++ b/static/css/horsey.css @@ -0,0 +1,32 @@ +.sey-list { + display: none; + position: absolute; + padding: 0; + margin: 0; + list-style-type: none; + box-shadow: 1px 2px 6px; + background-color: #fff; + color: #333; + transition: left 0.1s ease-in-out; +} +.sey-show { + display: block; +} +.sey-hide { + display: none; +} +.sey-item { + cursor: pointer; + overflow: hidden; + white-space: nowrap; + text-overflow: ellipsis; + padding: 7px; +} +.sey-item:hover { + background-color: #444; + color: #fff; +} +.sey-selected { + background-color: #333; + color: #fff; +} \ No newline at end of file diff --git a/static/css/theme.css b/static/css/theme.css index fa7d6539b8b..631e7a4575a 100644 --- a/static/css/theme.css +++ b/static/css/theme.css @@ -988,7 +988,6 @@ pre .copy-to-clipboard:hover { transform-style: preserve-3d; } -/* Add checkmark icon align to right and color*/ #sidebar ul.topics > li > a .read-icon { margin-top: 9px; } @@ -1005,4 +1004,8 @@ pre .copy-to-clipboard:hover { display: inline; } +#searchResults { + text-align: left; +} + /*# sourceMappingURL=theme.css.map */ diff --git a/static/js/horsey.js b/static/js/horsey.js new file mode 100644 index 00000000000..a22a115ed02 --- /dev/null +++ b/static/js/horsey.js @@ -0,0 +1,1571 @@ +!function(e){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{var f;"undefined"!=typeof window?f=window:"undefined"!=typeof global?f=global:"undefined"!=typeof self&&(f=self),f.horsey=e()}}(function(){var define,module,exports;return (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o