Commit 2646f9aa authored by Alexandra Rogova's avatar Alexandra Rogova

new gui, some other stuff

parent feb459b4
......@@ -22,6 +22,8 @@
})
.declareMethod("remove_css", function(body){
/*var doc = new DOMParser().parseFromString(body, "text/html");
return doc.body.textContent || "";*/
var regEx = new RegExp('(style="(.*?)"|style=&quot(.*?)&quot)', 'gi');
return body.replace(regEx, "");
});
......
......@@ -9,8 +9,10 @@
<link rel="stylesheet" type="text/css" href="result.css">
</head>
<body>
<div id ="mynij"><img src="./logo.png"></div>
<ul id="mynij-results">
</ul>
<div id ="google"><img src="./logo_google.png"></div>
<ul id="searx-results">
</ul>
</body>
......
......@@ -10,7 +10,8 @@
title,
link,
link_par,
body;
body,
gadget = this;
list = document.getElementById("mynij-results");
list_item = document.createElement("LI");
......@@ -21,21 +22,25 @@
title.href = item.link;
list_item.appendChild(title);
return this.cut_link(item.link)
.push(function(cut_link){
link = document.createElement("a");
link.appendChild(document.createTextNode(item.link));
link.appendChild(document.createTextNode(cut_link));
link.href = item.link;
link.className = "link";
link_par = document.createElement('p');
link_par.appendChild(link);
list_item.appendChild(link_par);
})
.push(function(){
body = document.createElement('p');
body.className = "body";
if (key === ""){
item.body = new DOMParser().parseFromString(item.body, "text/html").body.textContent || "";
if (key === "" || item.body === ""){
body.innerHTML = "";
list.appendChild(list_item);
} else {
return this.cut_description(item.body, key)
return gadget.cut_description(item.body, key)
.push(function (result){
var array = [...result.matchAll(key)],
i;
......@@ -46,8 +51,10 @@
list_item.appendChild(body);
list.appendChild(list_item);
});
}
});
})
.declareMethod("show_searx_result", function(item, key){
......@@ -77,7 +84,7 @@
body = document.createElement("p");
body.className = "body";
if (item.querySelector('p.result-content') !== null) body.innerHTML = item.querySelector('p.result-content').textContent;
if (item.querySelector('p.result-content') !== null) body.innerHTML = item.querySelector('p.result-content').outerHTML;
else body.innerHTML = "";
list_item.appendChild(body);
......@@ -96,14 +103,19 @@
})
.declareMethod("cut_description", function(body, key){
var regEx,
result;
regEx = new RegExp('[^.?!]*' + ' ' + key + ' ' + '[^.?!]*[.?!]', 'gm');
result = regEx.exec(body);
var result = new RegExp('[^.?!]*' + ' ' + key + ' ' + '[^.?!]*[.?!]', 'gm').exec(body);
if (result === null) {
return new RegExp('[^.?!]*[.?!]').exec(body)[0];
result = new RegExp('[^.?!]*[.?!]').exec(body);
if (result === null) return "";
else return result[0];
}
else return result[0].slice(1);
else return result[0];
})
.declareMethod("cut_link", function(link){
if (link === undefined) return "";
if (link.length > 70) return link.slice(0,70) + "...";
else return link;
});
}(window, RSVP, rJS, jIO));
\ No newline at end of file
......@@ -4,12 +4,13 @@ body {
height: 100vh;
width: 100%;
background: #fff;
font-family: arial,sans-serif;
}
form{
position: relative;
top: 3%;
left: 10%;
margin : auto;
width: 86%;
max-width: 50em;
height: 5%;
......@@ -96,27 +97,3 @@ input{
padding-bottom:0.2%;
}
/*
#mynij{
position: fixed;
left: 1.5%;
top: 3.5%;
font-size: 250%;
font-family: "Roboto", Geneva, "Lucida Console", sans-serif;
font-weight: 500;
color: #485a67;
line-height: 38px;
letter-spacing: -1px;
}
*/
#mynij{
position: fixed;
left: 1.5%;
top: 1.5%;
}
#mynij img {
height: 5em;
}
......@@ -3,7 +3,7 @@
}
#mynij-results, #searx-results{
margin-top : 4%;
margin-top : 10%;
text-align: left;
}
......@@ -12,8 +12,8 @@
list-style-type: none;
position: relative;
display: table;
margin-left: 10%;
margin-top: 1%;
margin-left: 50%;
margin-top: 2%;
padding-top: 1%;
padding-bottom: 1%;
padding-left : 1%;
......@@ -46,8 +46,12 @@
#mynij-results > a, #searx-results > a {
position: relative;
}
.highlight {
font-weight: bold;
}
#mynij-results > a:after , #searx-results > a:after{
content: '';
position: absolute;
......@@ -74,3 +78,21 @@
font-weight: 100;
font-size: .8em;
}
#mynij, #google {
margin-top : 4%;
margin-left : 30%;
position: absolute;
}
#google {
margin-left : 65%;
}
#mynij img {
height: 5em;
}
#google img {
height : 5em;
}
\ No newline at end of file
......@@ -13,8 +13,6 @@
<link rel="stylesheet" type="text/css" href="mynij.css">
</head>
<body>
<!-- <div id ="mynij">Mynij</div> -->
<div id ="mynij"><img src="./logo.png" height="3em"></div>
<form id = "search_bar">
<input type="search" required>
</form>
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment