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

new gui, some other stuff

parent feb459b4
...@@ -22,6 +22,8 @@ ...@@ -22,6 +22,8 @@
}) })
.declareMethod("remove_css", function(body){ .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'); var regEx = new RegExp('(style="(.*?)"|style=&quot(.*?)&quot)', 'gi');
return body.replace(regEx, ""); return body.replace(regEx, "");
}); });
......
...@@ -9,8 +9,10 @@ ...@@ -9,8 +9,10 @@
<link rel="stylesheet" type="text/css" href="result.css"> <link rel="stylesheet" type="text/css" href="result.css">
</head> </head>
<body> <body>
<div id ="mynij"><img src="./logo.png"></div>
<ul id="mynij-results"> <ul id="mynij-results">
</ul> </ul>
<div id ="google"><img src="./logo_google.png"></div>
<ul id="searx-results"> <ul id="searx-results">
</ul> </ul>
</body> </body>
......
...@@ -10,7 +10,8 @@ ...@@ -10,7 +10,8 @@
title, title,
link, link,
link_par, link_par,
body; body,
gadget = this;
list = document.getElementById("mynij-results"); list = document.getElementById("mynij-results");
list_item = document.createElement("LI"); list_item = document.createElement("LI");
...@@ -21,21 +22,25 @@ ...@@ -21,21 +22,25 @@
title.href = item.link; title.href = item.link;
list_item.appendChild(title); list_item.appendChild(title);
return this.cut_link(item.link)
.push(function(cut_link){
link = document.createElement("a"); link = document.createElement("a");
link.appendChild(document.createTextNode(item.link)); link.appendChild(document.createTextNode(cut_link));
link.href = item.link; link.href = item.link;
link.className = "link"; link.className = "link";
link_par = document.createElement('p'); link_par = document.createElement('p');
link_par.appendChild(link); link_par.appendChild(link);
list_item.appendChild(link_par); list_item.appendChild(link_par);
})
.push(function(){
body = document.createElement('p'); body = document.createElement('p');
body.className = "body"; body.className = "body";
if (key === ""){ item.body = new DOMParser().parseFromString(item.body, "text/html").body.textContent || "";
if (key === "" || item.body === ""){
body.innerHTML = ""; body.innerHTML = "";
list.appendChild(list_item); list.appendChild(list_item);
} else { } else {
return this.cut_description(item.body, key) return gadget.cut_description(item.body, key)
.push(function (result){ .push(function (result){
var array = [...result.matchAll(key)], var array = [...result.matchAll(key)],
i; i;
...@@ -46,8 +51,10 @@ ...@@ -46,8 +51,10 @@
list_item.appendChild(body); list_item.appendChild(body);
list.appendChild(list_item); list.appendChild(list_item);
}); });
} }
});
}) })
.declareMethod("show_searx_result", function(item, key){ .declareMethod("show_searx_result", function(item, key){
...@@ -77,7 +84,7 @@ ...@@ -77,7 +84,7 @@
body = document.createElement("p"); body = document.createElement("p");
body.className = "body"; 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 = ""; else body.innerHTML = "";
list_item.appendChild(body); list_item.appendChild(body);
...@@ -96,14 +103,19 @@ ...@@ -96,14 +103,19 @@
}) })
.declareMethod("cut_description", function(body, key){ .declareMethod("cut_description", function(body, key){
var regEx, var result = new RegExp('[^.?!]*' + ' ' + key + ' ' + '[^.?!]*[.?!]', 'gm').exec(body);
result;
regEx = new RegExp('[^.?!]*' + ' ' + key + ' ' + '[^.?!]*[.?!]', 'gm');
result = regEx.exec(body);
if (result === null) { 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)); }(window, RSVP, rJS, jIO));
\ No newline at end of file
...@@ -4,12 +4,13 @@ body { ...@@ -4,12 +4,13 @@ body {
height: 100vh; height: 100vh;
width: 100%; width: 100%;
background: #fff; background: #fff;
font-family: arial,sans-serif;
} }
form{ form{
position: relative; position: relative;
top: 3%; top: 3%;
left: 10%; margin : auto;
width: 86%; width: 86%;
max-width: 50em; max-width: 50em;
height: 5%; height: 5%;
...@@ -96,27 +97,3 @@ input{ ...@@ -96,27 +97,3 @@ input{
padding-bottom:0.2%; 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 @@ ...@@ -3,7 +3,7 @@
} }
#mynij-results, #searx-results{ #mynij-results, #searx-results{
margin-top : 4%; margin-top : 10%;
text-align: left; text-align: left;
} }
...@@ -12,8 +12,8 @@ ...@@ -12,8 +12,8 @@
list-style-type: none; list-style-type: none;
position: relative; position: relative;
display: table; display: table;
margin-left: 10%; margin-left: 50%;
margin-top: 1%; margin-top: 2%;
padding-top: 1%; padding-top: 1%;
padding-bottom: 1%; padding-bottom: 1%;
padding-left : 1%; padding-left : 1%;
...@@ -46,8 +46,12 @@ ...@@ -46,8 +46,12 @@
#mynij-results > a, #searx-results > a { #mynij-results > a, #searx-results > a {
position: relative; position: relative;
}
.highlight {
font-weight: bold;
} }
#mynij-results > a:after , #searx-results > a:after{ #mynij-results > a:after , #searx-results > a:after{
content: ''; content: '';
position: absolute; position: absolute;
...@@ -74,3 +78,21 @@ ...@@ -74,3 +78,21 @@
font-weight: 100; font-weight: 100;
font-size: .8em; 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 @@ ...@@ -13,8 +13,6 @@
<link rel="stylesheet" type="text/css" href="mynij.css"> <link rel="stylesheet" type="text/css" href="mynij.css">
</head> </head>
<body> <body>
<!-- <div id ="mynij">Mynij</div> -->
<div id ="mynij"><img src="./logo.png" height="3em"></div>
<form id = "search_bar"> <form id = "search_bar">
<input type="search" required> <input type="search" required>
</form> </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