Compare commits
No commits in common. "master" and "threads" have entirely different histories.
|
@ -199,8 +199,8 @@ body {
|
|||
content: "";
|
||||
height: 19px;
|
||||
width: 19px;
|
||||
left: 1px;
|
||||
bottom: 1px;
|
||||
left: 2px;
|
||||
bottom: 2px;
|
||||
background-color: white;
|
||||
-webkit-transition: .4s;
|
||||
transition: .4s;
|
||||
|
@ -222,7 +222,7 @@ input:checked + .slider:before {
|
|||
|
||||
/* Rounded sliders */
|
||||
.slider.round {
|
||||
border-radius: 13px;
|
||||
border-radius: 14px;
|
||||
}
|
||||
|
||||
.slider.round:before {
|
||||
|
|
|
@ -6,12 +6,9 @@
|
|||
<meta name="viewport" content="width=device-width, initial-scale=0.7">
|
||||
<link rel="stylesheet" href="css/style.css">
|
||||
<script src="https://code.jquery.com/jquery-2.1.1.min.js"></script>
|
||||
<script src="js/js.cookie.js"></script>
|
||||
<script src="js/multiple-select.js"></script>
|
||||
<script src="js/helpers.js"></script>
|
||||
<script src="js/threads.js"></script>
|
||||
<script src="js/script.js"></script>
|
||||
<script src="js/autolink.js"></Script>
|
||||
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css">
|
||||
</head>
|
||||
<body>
|
||||
|
@ -19,6 +16,9 @@
|
|||
<div class="lessmore">
|
||||
<a id="menu" href="javascript:void(0)" onclick="showMenu()"><i class="fa fa-bars"></i></a>
|
||||
<div id="dropdown-content">
|
||||
<a href="/">На главную</a>
|
||||
<a href="/" onclick="clearFilter()">Сбросить фильтр</a>
|
||||
<a href="lessmorefaq.html">FAQ</a>
|
||||
</div>
|
||||
<a href = "/" style="text-decoration: none; color: #babdb6;"><u>dynamic</u> | <u>less</u></a>
|
||||
</div>
|
||||
|
|
|
@ -28,88 +28,3 @@ function checkViewMode() {
|
|||
return false
|
||||
}
|
||||
}
|
||||
|
||||
// Make message HTML
|
||||
function makeMessageHTML(msgItem, total) {
|
||||
var t = new Date(msgItem['date'] * 1000);
|
||||
var t_formatted = t.getFullYear() + "/" + (t.getMonth() + 1) + "/" + t.getDate() + " " + t.getHours() + ":" + t.getMinutes() + ":" + t.getSeconds();
|
||||
|
||||
var msg = msgItem['message'].replace(/&/g, '&').replace(/</g, '<').replace(/>/g, '>').replace(/"/g, '"').replace(new RegExp("\n",'g'), "<br>\n");
|
||||
|
||||
var html = '<div class="msg">'
|
||||
+ '<p align="left"><i class="fa fa-hourglass-half"></i> ' + t_formatted + '<i class="fa fa-angle-right"></i> <!--/p-->'
|
||||
|
||||
// Author to receiver
|
||||
+ '<a name="' + msgItem["msgid"] + '" style="text-decoration:underline; text-decoration-style:dotted;" title="' + msgItem["address"] + '" "href="javascript:void(0)" onclick="requestAuthorMessages(\'' + msgItem['author'] + '\');">' + msgItem['author'] + '</a>'
|
||||
+ ' <i class="fa fa-mail-forward"></i> ';
|
||||
|
||||
if (msgItem['repto'] != "" ) {
|
||||
html += '<a href="#' + msgItem['repto'] + '">' + msgItem['to'] + '</a></p>';
|
||||
} else {
|
||||
html += msgItem['to'] + '</p>';
|
||||
}
|
||||
|
||||
// Header
|
||||
html += ' <p style="color:#0099cc;font: 1.5em Open Sans, sans-serif;">'
|
||||
+ '<a class="headerLink" href="/?j=' + msgItem['msgid'] + '">'
|
||||
+ msgItem['subg'] + '</a>'
|
||||
+ ' <i class="fa fa-at"></i> <i><a class="headerLink" href="javascript:void(0)" onclick="requestTmpEcho(\'' + msgItem['echo'] + '\')">' + msgItem['echo']
|
||||
+ '</a></i></p></p>'
|
||||
+ '<p>' + msg.autoLink()
|
||||
+ '</p><p align="right">'
|
||||
|
||||
// Msgid
|
||||
+ '<a href="?' + msgItem['msgid'] +'" onclick="requestMessage(\'' + msgItem['msgid'] + '\');"><i class="fa fa-link"></i>' + msgItem['msgid'] + '</a>';
|
||||
|
||||
// End message <div> block
|
||||
html += '</p></div>';
|
||||
|
||||
return html
|
||||
}
|
||||
|
||||
function makeThreadMessage(msgItem, total) {
|
||||
var t = new Date(msgItem['date'] * 1000);
|
||||
var t_formatted = t.getFullYear() + "/" + (t.getMonth() + 1) + "/" + t.getDate() + " " + t.getHours() + ":" + t.getMinutes() + ":" + t.getSeconds();
|
||||
|
||||
console.log(total);
|
||||
|
||||
if (hash.matched && msgItem['msgid'] == hash.hash) {
|
||||
html += '<div class="hsMessage">';
|
||||
}
|
||||
|
||||
msg = msgItem['message'].replace(/&/g, '&').replace(/</g, '<').replace(/>/g, '>').replace(/"/g, '"').replace(new RegExp("\n",'g'), "<br>\n");
|
||||
|
||||
var to =
|
||||
html += '<div class="msg">'
|
||||
+ '<p align="left"><i class="fa fa-hourglass-half"></i> ' + t_formatted + '<i class="fa fa-angle-right"></i> <!--/p-->'
|
||||
|
||||
// Author to receiver
|
||||
+ '<a style="text-decoration:underline; text-decoration-style:dotted;" title="' + msgItem["address"] + '" "href="javascript:void(0)" onclick="requestAuthorMessages(\'' + msgItem['author'] + '\');">' + msgItem['author'] + '</a>'
|
||||
+ ' <i class="fa fa-mail-forward"></i> ';
|
||||
|
||||
if (msgItem['repto'] != "" ) {
|
||||
html += '<a href="/?' + msgItem['repto'] + '">' + msgItem['to'] + '</a></p>';
|
||||
} else {
|
||||
html += msgItem['to'] + '</p>';
|
||||
}
|
||||
|
||||
// Header
|
||||
html += ' <p style="color:#0099cc;font: 1.5em Open Sans, sans-serif;">'
|
||||
+ '<a class="headerLink" href="/?j=' + msgItem['msgid'] + '">'
|
||||
+ msgItem['subg'] + '</a>'
|
||||
+ ' <i class="fa fa-at"></i> <i><a class="headerLink" href="javascript:void(0)" onclick="requestTmpEcho(\'' + msgItem['echo'] + '\')">' + msgItem['echo']
|
||||
+ '</a></i></p></p>'
|
||||
+ '<p>' + msg.autoLink()
|
||||
+ '</p><p>';
|
||||
|
||||
// Answers
|
||||
html += '<a style="align:left !important; left: 13%; position: absolute;" href="?j=' + msgItem['msgid'] +'"">[' + total + ']</a>';
|
||||
|
||||
// Msgid
|
||||
html += '<a style="align:right !important; right: 13%; position: absolute;" href="?' + msgItem['msgid'] +'" onclick="requestMessage(\'' + msgItem['msgid'] + '\');"><i class="fa fa-link"></i>' + msgItem['msgid'] + '</a>';
|
||||
|
||||
// End message <div> block
|
||||
html += '</p></div>';
|
||||
|
||||
return html;
|
||||
}
|
||||
|
|
104
js/script.js
104
js/script.js
|
@ -163,7 +163,7 @@ function ajaxRequest(data) {
|
|||
type:"POST",
|
||||
data: data,
|
||||
contentType: "application/json",
|
||||
success: function(messages) {
|
||||
success:function(messages){
|
||||
callback(messages);
|
||||
$("#mes").html(html);
|
||||
}
|
||||
|
@ -178,17 +178,7 @@ function requestEmptyEcho() {
|
|||
function requestEcho() {
|
||||
var data = '';
|
||||
if (checkViewMode()) {
|
||||
var echoes = '(';
|
||||
for (e in echo.split(" ")) {
|
||||
if (echo.split(" ")[e] != "") {
|
||||
echoes += "echo:" + echo.split(" ")[e];
|
||||
}
|
||||
if (e < echo.split(" ").length - 2) {
|
||||
echoes += " OR ";
|
||||
}
|
||||
}
|
||||
echoes += ')';
|
||||
data = '{"sort": [{"date": {"order": "desc"}}, {"_score": { "order": "desc" }}], "query": {"bool": { "must": [ { "query_string" : {"fields": ["echo", "repto"], "query": "' + echoes +' AND repto.keyword:\\"\\""}}]}}, "size":5}';
|
||||
data = '{"sort": [{"date": {"order": "desc"}}, {"_score": { "order": "desc" }}], "query": {"bool": { "must": [ { "query_string" : {"fields": ["echo", "repto"], "query": "' + echo +' AND repto.keyword:\\"\\""}}]}}, "size":5}';
|
||||
} else {
|
||||
data = '{"sort": [{"date": {"order": "desc"}}, {"_score": { "order": "desc" }}], "query": {"query_string" : {"fields": ["echo"], "query": "' + echo + '"}}, "size":' + 5 + '}';
|
||||
}
|
||||
|
@ -216,17 +206,7 @@ function requestEmptyEchoOffset() {
|
|||
function requestEchoOffset() {
|
||||
var data = '';
|
||||
if (checkViewMode()) {
|
||||
var echoes = '(';
|
||||
for (e in echo.split(" ")) {
|
||||
if (echo.split(" ")[e] != "") {
|
||||
echoes += "echo:" + echo.split(" ")[e];
|
||||
}
|
||||
if (e < echo.split(" ").length - 2) {
|
||||
echoes += " OR ";
|
||||
}
|
||||
}
|
||||
echoes += ')';
|
||||
data = '{"sort": [{"date": {"order": "desc"}}, {"_score": { "order": "desc" }}], "query": {"bool": { "must": [ { "query_string" : {"fields": ["echo", "repto"], "query": "' + echoes +' AND repto.keyword:\\"\\""}}]}}, "size":' + show_rows + ', "from":' + from + '}';
|
||||
data = '{"sort": [{"date": {"order": "desc"}}, {"_score": { "order": "desc" }}], "query": {"bool": { "must": [ { "query_string" : {"fields": ["echo", "repto"], "query": "' + echo +' AND repto.keyword:\\"\\""}}]}}, "size":' + show_rows + ', "from":' + from + '}';
|
||||
} else {
|
||||
data = '{"sort": [{"date": {"order": "desc"}}, {"_score": { "order": "desc" }}], "query": {"query_string" : {"fields": ["echo"], "query": "' + echo + '"}}, "size":' + show_rows + ', "from":' + from + '}';
|
||||
}
|
||||
|
@ -283,23 +263,11 @@ function searchRequest(data) {
|
|||
})
|
||||
}
|
||||
|
||||
function answersRequest(msgid) {
|
||||
$.ajax({
|
||||
url:"https://dynamic.lessmore.pw/search",
|
||||
type:"POST",
|
||||
data: '{"sort": [ { "date": { "order": "desc" }}, { "_score": { "order": "desc" }}], "query": {"query_string" : {"fields" : ["msgid"], "query" :"' + msgid + '"}}, "size": 0 }',
|
||||
contentType: "application/json",
|
||||
success: function(messages){
|
||||
answers[msgid] = messages["hits"]["total"];
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
//show messages
|
||||
function callbackHS(messages) {
|
||||
var msgArray = messages["hits"]["hits"];
|
||||
// console.log(msgArray);
|
||||
|
||||
|
||||
for (hit in msgArray) {
|
||||
hash = parseLocationHash();
|
||||
var msgItem = msgArray[hit]['_source'];
|
||||
|
@ -355,65 +323,11 @@ function callbackHS(messages) {
|
|||
}
|
||||
}
|
||||
|
||||
function threadMessage(msgItem) {
|
||||
$.ajax({
|
||||
url:"https://dynamic.lessmore.pw/search",
|
||||
type:"POST",
|
||||
data: '{"sort": [ { "date": { "order": "desc" }}, { "_score": { "order": "desc" }}], "query": {"query_string" : {"fields" : ["repto"], "query": "' + msgItem["_source"]["msgid"] + '"}}, "size": 0 }',
|
||||
contentType: "application/json",
|
||||
success: function(answer) {
|
||||
total = 0;
|
||||
total = answer["hits"]["total"];
|
||||
msgItem["total"] = total;
|
||||
threadsCallback(false, msgItem);
|
||||
$("#mes").html(html);
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
//show messages
|
||||
function threadsCallback(messages) {
|
||||
var getAnswers = function(msgItem, callback) {
|
||||
$.when(
|
||||
$.ajax({
|
||||
url:"https://dynamic.lessmore.pw/search",
|
||||
type:"POST",
|
||||
data: '{"sort": [ { "date": { "order": "desc" }}, { "_score": { "order": "desc" }}], "query": {"query_string" : {"fields" : ["repto"], "query": "' + msgItem["_source"]["msgid"] + '"}}, "size": 0 }',
|
||||
contentType: "application/json",
|
||||
success: function(answer) { callback(answer, msgItem); }
|
||||
})).then(function(data) {
|
||||
console.log(data);
|
||||
})
|
||||
};
|
||||
|
||||
var getTotal = function(answer, msgItem) {
|
||||
var total = answer["hits"]["total"];
|
||||
msg = makeThreadMessage(msgItem["_source"], total);
|
||||
console.log(msgItem["_source"]["msgid"])
|
||||
Cookies.set(msgItem["_source"]["msgid"], total);
|
||||
};
|
||||
|
||||
function callback(messages) {
|
||||
var msgArray = messages["hits"]["hits"];
|
||||
for (hit in msgArray) {
|
||||
getAnswers(msgArray[hit], getTotal);
|
||||
}
|
||||
|
||||
for (hit in msgArray) {
|
||||
count = Cookies.get(msgArray[hit]["_source"]["msgid"]);
|
||||
msg = makeThreadMessage(msgArray[hit]["_source"], count);
|
||||
html += msg;
|
||||
}
|
||||
}
|
||||
|
||||
//show messages
|
||||
function callback(messages) {
|
||||
var msgArray = messages["hits"]["hits"];
|
||||
|
||||
// if (checkViewMode() && !parseLocation().matched) {
|
||||
// threadsCallback(messages);
|
||||
// return;
|
||||
// }
|
||||
|
||||
// console.log(msgArray);
|
||||
|
||||
for (hit in msgArray) {
|
||||
hash = parseLocationHash();
|
||||
var msgItem = msgArray[hit]['_source'];
|
||||
|
@ -449,10 +363,10 @@ function callback(messages) {
|
|||
+ ' <i class="fa fa-at"></i> <i><a class="headerLink" href="javascript:void(0)" onclick="requestTmpEcho(\'' + msgItem['echo'] + '\')">' + msgItem['echo']
|
||||
+ '</a></i></p></p>'
|
||||
+ '<p>' + msg.autoLink()
|
||||
+ '</p><p>';
|
||||
+ '</p><p align="right">'
|
||||
|
||||
// Msgid
|
||||
html += '<a style="align:right !important; right: 13%; display:block; position: absolute;" href="?' + msgItem['msgid'] +'" onclick="requestMessage(\'' + msgItem['msgid'] + '\');"><i class="fa fa-link"></i>' + msgItem['msgid'] + '</a>';
|
||||
+ '<a href="?' + msgItem['msgid'] +'" onclick="requestMessage(\'' + msgItem['msgid'] + '\');"><i class="fa fa-link"></i>' + msgItem['msgid'] + '</a>';
|
||||
|
||||
// End message <div> block
|
||||
html += '</p></div>';
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
var thread_html = "";
|
||||
var top_id = "";
|
||||
var answers = {};
|
||||
|
||||
$(function() {
|
||||
var jumpLocation = parseLocation();
|
||||
|
@ -92,4 +91,42 @@ function parseLocation() {
|
|||
}
|
||||
}
|
||||
|
||||
// Make message HTML
|
||||
function makeMessageHTML(msgItem) {
|
||||
var t = new Date(msgItem['date'] * 1000);
|
||||
// console.log(msgItem['date']);
|
||||
// console.log(t);
|
||||
var t_formatted = t.getFullYear() + "/" + (t.getMonth() + 1) + "/" + t.getDate() + " " + t.getHours() + ":" + t.getMinutes() + ":" + t.getSeconds();
|
||||
|
||||
var msg = msgItem['message'].replace(/&/g, '&').replace(/</g, '<').replace(/>/g, '>').replace(/"/g, '"').replace(new RegExp("\n",'g'), "<br>\n");
|
||||
|
||||
var html = '<div class="msg">'
|
||||
+ '<p align="left"><i class="fa fa-hourglass-half"></i> ' + t_formatted + '<i class="fa fa-angle-right"></i> <!--/p-->'
|
||||
|
||||
// Author to receiver
|
||||
+ '<a name="' + msgItem["msgid"] + '" style="text-decoration:underline; text-decoration-style:dotted;" title="' + msgItem["address"] + '" "href="javascript:void(0)" onclick="requestAuthorMessages(\'' + msgItem['author'] + '\');">' + msgItem['author'] + '</a>'
|
||||
+ ' <i class="fa fa-mail-forward"></i> ';
|
||||
|
||||
if (msgItem['repto'] != "" ) {
|
||||
html += '<a href="#' + msgItem['repto'] + '">' + msgItem['to'] + '</a></p>';
|
||||
} else {
|
||||
html += msgItem['to'] + '</p>';
|
||||
}
|
||||
|
||||
// Header
|
||||
html += ' <p style="color:#0099cc;font: 1.5em Open Sans, sans-serif;">'
|
||||
+ '<a class="headerLink" href="/?j=' + msgItem['msgid'] + '">'
|
||||
+ msgItem['subg'] + '</a>'
|
||||
+ ' <i class="fa fa-at"></i> <i><a class="headerLink" href="javascript:void(0)" onclick="requestTmpEcho(\'' + msgItem['echo'] + '\')">' + msgItem['echo']
|
||||
+ '</a></i></p></p>'
|
||||
+ '<p>' + msg.autoLink()
|
||||
+ '</p><p align="right">'
|
||||
|
||||
// Msgid
|
||||
+ '<a href="?' + msgItem['msgid'] +'" onclick="requestMessage(\'' + msgItem['msgid'] + '\');"><i class="fa fa-link"></i>' + msgItem['msgid'] + '</a>';
|
||||
|
||||
// End message <div> block
|
||||
html += '</p></div>';
|
||||
|
||||
return html
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user