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

@ -1,84 +1,100 @@
@media screen and (max-width: 600px){
.lessmore {
right: 0px;
font-size: 20pt;
}
select {height: 50px}
.msg {
padding: 0;
margin: 0;
}
.lessmore {
right: 0px;
font-size: 20pt;
}
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;
color: #eeeeec;
text-decoration-style: dotted;
}
body {
background-color: #2E3436;
color: #eeeeec;
font: normal 1em Arial, sans-serif;
//font-family: "Arial", sans-serif;
//font-size: 1em;
background-color: #2E3436;
color: #eeeeec;
font: normal 1em Arial, sans-serif;
//font-family: "Arial", sans-serif;
//font-size: 1em;
}
#dropdown-content {
background-color:#2E3436;
display: none;
font-size: 0.5em;
position:absolute;
right: 0;
top: 70px;
width: 300px;
//z-index:1;
background-color:#2E3436;
display: none;
font-size: 0.5em;
position:absolute;
right: 0;
top: 70px;
width: 300px;
//z-index:1;
}
#dropdown-content>a {
border:1px solid #eeeeec;
display: block;
padding: 10px
border:1px solid #eeeeec;
display: block;
padding: 10px
}
#faq {
margin: 80px 0 0;
margin: 80px 0 0;
}
.lessmore {
background-color: #2E3436;
border-bottom: none;
color: #babdb6;
display: block;
font-size: 40pt;
height:70px;
position:fixed;
text-align: center;
text-decoration: none;
top: 0px;
margin-bottom: 5pt;
width:100%;
background-color: #2E3436;
border-bottom: none;
color: #babdb6;
display: block;
font-size: 40pt;
height:70px;
position:fixed;
text-align: center;
text-decoration: none;
top: 0px;
margin-bottom: 5pt;
width:100%;
}
#menu {
display: block;
font-size:0.7em;
position: absolute;
right: 10px;
top: 17px;
display: block;
font-size:0.7em;
position: absolute;
right: 10px;
top: 17px;
}
.msg {
background-color:#272C2D;
display: block; margin: 1em 0;
padding: 1.5em 3em 1.5em;
word-wrap: break-word;
background-color:#272C2D;
display: block; margin: 1em 0;
padding: 1.5em 3em 1.5em;
word-wrap: break-word;
}
select {
font-size: 1em;
margin: 80px 0 0;
padding:9px 0;
width: 100%;
font-size: 1em;
margin: 80px 0 0;
padding:9px 0;
width: 100%;
}

View File

@ -1,6 +1,6 @@
<!DOCTYPE html>
<html>
<head>
<head>
<title>dynamic|LESS</title>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=0.7">
@ -10,28 +10,31 @@
<script src="js/autolink.js"></Script>
<!-- <script src="https://unpkg.com/vue"></script> -->
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css">
</head>
<body>
</head>
<body>
<div class="lessmore">
<a id="menu" href="javascript:void(0)" onclick="showMenu()"><i class="fa fa-bars"></i></a>
<div id="dropdown-content">
<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>
<a href="" onclick="clearFilter()">Сбросить фильтр</a>
<a href="lessmorefaq.html">FAQ</a>
<a href="stats.html">Статистика</a>
</div>
<a href="/" style="text-decoration: none; color: #babdb6;"><u>dynamic</u> | <u>less</u></a>
</div>
<a href="/" style="text-decoration: none; color: #babdb6;"><u>dynamic</u> | <u>less</u></a>
</div>
<form><select id="echoSelector" multiple size="5"></select></form>
<div id="echoSelected"></div>
<form><select id="echoSelector" multiple size="5"></select></form>
<div id="echoSelected"></div>
<div id="mes"></div>
<div id="mes"></div>
<div id="preloader" align="center">
<img src="/img/preload.gif" onclick="showMore()" height="20em">
</div>
<div id="preloader" align="center">
<img src="/img/preload.gif" onclick="showMore()" height="20em">
</div>
</body>
</body>
</html>

View File

@ -41,31 +41,31 @@ $(function() {
$.ajax({
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']){
var msg = messages['aggregations']['my_fields']['buckets'][i]['key'];
var doc_count = messages['aggregations']['my_fields']['buckets'][i]['doc_count'];
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']) {
var msg = messages['aggregations']['my_fields']['buckets'][i]['key'];
var doc_count = messages['aggregations']['my_fields']['buckets'][i]['doc_count'];
msg_test = msg + " ";
echo_test = echo + " ";
if((echo_test).indexOf(msg_test) > -1 && echo != '') {
options += '<option value="' + msg + '" selected>' + msg + " (<b>" + doc_count + "</b>)</option>";
checks += '<span class="row"><input type="checkbox" class="echoes" name="ec" value="' + msg + '" checked><label>'
+ msg
+ '</label> <span style="color:#838784">('+ doc_count
+ ')</span><br></span>';
} else {
options += '<option value="' + msg + '" >' + msg + " (<b>" + doc_count + "</b>)</option>";
checks += '<span class="row"><input type="checkbox" class="echoes" name="ec" value="' + msg + '"><label>'
+ msg
+ '</label> <span style="color:#838784">('+ doc_count
+ ')</span><br></span>';}
}
msg_test = msg + " ";
echo_test = echo + " ";
if((echo_test).indexOf(msg_test) > -1 && echo != '') {
options += '<option value="' + msg + '" selected>' + msg + " (<b>" + doc_count + "</b>)</option>";
checks += '<span class="row"><input type="checkbox" class="echoes" name="ec" value="' + msg + '" checked><label>'
+ msg
+ '</label> <span style="color:#838784">('+ doc_count
+ ')</span><br></span>';
} else {
options += '<option value="' + msg + '" >' + msg + " (<b>" + doc_count + "</b>)</option>";
checks += '<span class="row"><input type="checkbox" class="echoes" name="ec" value="' + msg + '"><label>'
+ msg
+ '</label> <span style="color:#838784">('+ doc_count
+ ')</span><br></span>';}
}
$('#echoSelected').html("Выбранные эхи: " + document.cookie);
$('#echoSelector').html(options);
$('#echoCheckBox').html(checks);}
$('#echoSelected').html("Выбранные эхи: " + document.cookie);
$('#echoSelector').html(options);
$('#echoCheckBox').html(checks);}
})
$('.echoes:checked').each(function() {
@ -96,11 +96,11 @@ $(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() {
hash = parseLocationHash();
@ -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() {