Search initial

This commit is contained in:
Denis Zheleztsov 2017-12-05 22:18:14 +03:00
parent 98b021e27b
commit 3d12d99fdb
3 changed files with 125 additions and 98 deletions

View File

@ -3,13 +3,29 @@
right: 0px;
font-size: 20pt;
}
select {height: 50px}
select {
height: 50px
}
.msg {
padding: 0;
margin: 0;
}
}
#searchButton {
position: absolute;
font-size: 20pt;
left: 0;
top: 14pt;
}
#searchInput {
display: none;
position: absolute;
left: 25pt;
top: 14pt;
}
a, a:visited, a:active {
color: #eeeeec;
text-decoration-style: dotted;

View File

@ -14,6 +14,9 @@
<body>
<div class="lessmore">
<a id="searchButton" href="javascript:void(0)" onclick="showSearch()"><i class="fa fa-search"></i></a>
<input type="text" id="searchInput">
<a id="menu" href="javascript:void(0)" onclick="showMenu()"><i class="fa fa-bars"></i></a>
<div id="dropdown-content">
<a href="filter.html">Настроить фильтр</a>

View File

@ -42,8 +42,8 @@ $(function() {
url: "https://dynamic.lessmore.pw/search",
type: "POST",
data: '{"sort": [{ "date": { "order": "desc" }}, { "_score": { "order": "desc" }}],"aggs": {"my_fields": { "terms": { "field": "echo","size": 1000}}}}}',
success:function(messages){for (i in messages['aggregations']['my_fields']['buckets']){
success:function(messages) {
for (i in messages['aggregations']['my_fields']['buckets']) {
var msg = messages['aggregations']['my_fields']['buckets'][i]['key'];
var doc_count = messages['aggregations']['my_fields']['buckets'][i]['doc_count'];
@ -96,10 +96,10 @@ $(function() {
if (echo == "") requestEmptyEcho();
});
// $('#searchInput').on('change', function() {
// text = $(this).val();
// simpleTextSearch(text);
// })
$('#searchInput').on('change', function() {
text = $(this).val();
simpleTextSearch(text);
})
//scroll to show more messages
$(window).scroll(function() {
@ -289,6 +289,14 @@ function showMenu() {
}
}
function showSearch() {
if ($("#searchInput").css("display") == "none") {
$("#searchInput").css("display","block");
} else {
$("#searchInput").css("display","none");
}
}
// Parsing functions
function parseLocationHash() {