Commit bbc199d6 authored by Alain Takoudjou's avatar Alain Takoudjou

erp5_web_mynij_search: Add more results button for searx and hide "About Mynij" menu in result page

parent 0d83e39e
......@@ -156,18 +156,31 @@
this.element.querySelector("#search_input").value = "";
return this.state.result_gadget.clear()
.push(function () {
var topmenu,
more;
document.getElementById("logo-search").classList.remove('hide');
topmenu = gadget.element.querySelector(".search-mbar");
more = gadget.element.querySelector(".searx-more");
if (topmenu)
topmenu.classList.remove('hide');
if (more)
more.classList.add('hide');
return gadget.state.result_gadget.hideResultBox();
});
})
.declareJob("defer_search", function (search_text, index, limit) {
var gadget = this,
top = document.getElementById("logo-search");
top = document.getElementById("logo-search"),
topmenu = gadget.element.querySelector(".search-mbar"),
more = gadget.element.querySelector(".searx-more");;
if(top) {
if(top)
top.classList.add("hide");
}
if (topmenu)
topmenu.classList.add('hide');
if (more)
more.classList.add('hide');
return gadget.state.result_gadget.startLoading()
.push(function () {
return gadget.state.result_gadget.showResultBox();
......@@ -232,14 +245,14 @@
})
.declareMethod("add_searx_results", function (key) {
var gadget = this;
var gadget = this,
query = encodeURI(key);
return new RSVP.Queue()
.push(function () {
var count = gadget.state.proxies.length,
rng = Math.floor(Math.random() * Math.floor(count)),
proxy = gadget.state.proxies[rng],
query = encodeURI(key);
proxy = gadget.state.proxies[rng];
return jIO.util.ajax({
url : proxy + "?url=" + gadget.state.searx + "%3Fq%3D" +
query + "%26category_general%3Don%26theme%3Doscar"
......@@ -272,7 +285,17 @@
elements[i],
key));
}
return RSVP.all(promise_list);
return new RSVP.Queue()
.push(function () {
return RSVP.all(promise_list);
})
.push(function () {
var slink = gadget.state.searx +"?q="+ query + "&category_general=on",
more = gadget.element.querySelector(".searx-more");
if (more)
more.classList.remove('hide');
return gadget.state.result_gadget.setSearxMoreLink(slink);
});
});
})
......
......@@ -242,7 +242,7 @@
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>995.30660.45437.22203</string> </value>
<value> <string>995.36151.33301.32136</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -260,7 +260,7 @@
</tuple>
<state>
<tuple>
<float>1634243052.5</float>
<float>1634572335.06</float>
<string>UTC</string>
</tuple>
</state>
......
......@@ -31,7 +31,11 @@
<section class="section-result">
<ul id="searx-results">
</ul>
<div class="searx-more"><p><a class="searx-morelink" href="#">More results</a></p></div>
<div class="searx-more hide">
<p>
<a class="btn-link searx-morelink" href="#" target="_blank">More results...</a>
</p>
</div>
<div id="searx-loading" class="loading" style="display: none"><div class="loader"></div></div>
</section>
</div>
......
......@@ -242,7 +242,7 @@
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>991.47441.48178.21742</string> </value>
<value> <string>995.36137.28711.55790</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -260,7 +260,7 @@
</tuple>
<state>
<tuple>
<float>1619781040.08</float>
<float>1634572133.98</float>
<string>UTC</string>
</tuple>
</state>
......
......@@ -270,9 +270,10 @@
return short_url;
})
.declareMethod("setSearxMoreLink", function (query) {
var link = this.querySelector('searx-morelink');
link.href = "https://searx.info/search?q=" + query + "&category_general=on";
.declareMethod("setSearxMoreLink", function (query_url) {
var link = this.element.querySelector('.searx-morelink');
if (link)
link.href = query_url;
});
}(window, RSVP, rJS, document, DOMParser, URL));
\ No newline at end of file
......@@ -242,7 +242,7 @@
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>990.5192.14888.10222</string> </value>
<value> <string>995.36111.10544.48008</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -260,7 +260,7 @@
</tuple>
<state>
<tuple>
<float>1619793226.18</float>
<float>1634569900.92</float>
<string>UTC</string>
</tuple>
</state>
......
......@@ -149,7 +149,6 @@ div[data-gadget-scope='header'] .ui-header .ui-controlgroup-controls button[data
.searx-more {
margin: 20px 10px;
display: none;
}
.searx-morelink {
......@@ -790,7 +789,7 @@ button::-moz-focus-inner {
color: white;
font-weight: 600;
transition: background 0.25s ease-in-out;
border-top-right-radius: 5px;
border-top-right-radius: 2px;
border-bottom-right-radius: 5px;
width: 100%;
}
......@@ -807,6 +806,31 @@ button::-moz-focus-inner {
transform: translateY(1px);
}
.btn-link {
display: inline-block;
margin-bottom: 0;
font-weight: 400;
text-align: center;
vertical-align: middle;
cursor: pointer;
border: 1px solid #ccc;
white-space: nowrap;
padding: 6px 12px;
font-size: 14px;
line-height: 1.42857143;
border-radius: 4px;
user-select: none;
color: #333;
background-color: #fff;
}
.btn-link:hover, btn-link:active {
text-decoration: none;
color: #333;
background-color: #e6e6e6;
border-color: #ff1979;
}
@media screen and (max-width: 820px) {
.search-label {
border-radius: 0;
......
......@@ -242,7 +242,7 @@
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>995.30743.40827.28928</string> </value>
<value> <string>995.36127.30011.11366</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -260,7 +260,7 @@
</tuple>
<state>
<tuple>
<float>1634247970.27</float>
<float>1634572415.39</float>
<string>UTC</string>
</tuple>
</state>
......
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