link 'browsing' links to specific matching table entries

pull/42/head
Zlatin Balevsky 2020-03-19 22:38:51 +00:00
parent 68bc0bbf30
commit a5fb824f71
3 changed files with 19 additions and 4 deletions

View File

@ -176,7 +176,7 @@ function refreshActive() {
if (currentBrowse != null) {
var newBrowse = browsesByHost.get(currentHost)
if (currentBrowse.revision < newBrowse.revision)
if (newBrowse == null || currentBrowse.revision < newBrowse.revision)
showResults(currentHost, currentBrowse.key, currentBrowse.descending)
} else {
document.getElementById("resultsTable").innerHTML = ""

View File

@ -88,7 +88,7 @@ class Sender {
if (this.browse == "false")
return ""
if (this.browsing == "true")
return "<a href='/MuWire/BrowseHost'>" + _t("Browsing") + "</a>"
return "<a href='/MuWire/BrowseHost?currentHost=" + this.b64 + "'>" + _t("Browsing") + "</a>"
var link = "<a href='#' onclick='window.browse(\"" + this.b64 + "\"); return false;'>" + _t("Browse") + "</a>"
var block = "<span id='browse-link-" + this.b64 + "'>" + link + "</span>"
return block
@ -632,7 +632,7 @@ function browse(host) {
xmlhttp.onreadystatechange = function() {
if (this.readyState == 4 && this.status == 200) {
var linkSpan = document.getElementById("browse-link-"+host)
linkSpan.innerHTML = "<a href='/MuWire/BrowseHost'>" + _t("Browsing") + "</a>"
linkSpan.innerHTML = "<a href='/MuWire/BrowseHost?currentHost=" + host+ "'>" + _t("Browsing") + "</a>"
}
}
xmlhttp.open("POST", "/MuWire/Browse", true)

View File

@ -1,11 +1,20 @@
<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
<%@ page import="com.muwire.webui.*" %>
<%@ page import="com.muwire.core.*" %>
<%@ page import="java.io.*" %>
<%@ page import="net.i2p.data.Base64" %>
<%@include file="initcode.jsi"%>
<%
String pagetitle=Util._t("Browse Host");
String pagetitle=Util._t("Browse Host");
String currentBrowse = null;
if (request.getParameter("currentHost") != null) {
Persona host = new Persona(new ByteArrayInputStream(Base64.decode(request.getParameter("currentHost"))));
currentBrowse = host.getHumanReadableName();
}
%>
@ -17,6 +26,12 @@ String pagetitle=Util._t("Browse Host");
<script src="js/tables.js?<%=version%> type="text/javascript"></script>
<script src="js/browse.js?<%=version%>" type="text/javascript"></script>
<% if (currentBrowse != null) { %>
<script>
currentHost="<%=currentBrowse%>"
</script>
<% } %>
</head>
<body onload="initTranslate(jsTranslations); initConnectionsCount(); initBrowse(); initCertificates();">
<%@ include file="header.jsi"%>