summaryrefslogtreecommitdiff
path: root/irclog/search
diff options
context:
space:
mode:
authorMistivia <i@mistivia.com>2025-11-04 22:34:33 +0800
committerMistivia <i@mistivia.com>2025-11-04 22:34:33 +0800
commit6c66b7c72013f8e335d93b28e743101883f30bb9 (patch)
tree38d257a068361bb31456f5cd85bb69e4b4538783 /irclog/search
parentcb63d6de3d3e8b747bf1b178190a183b9ab4a506 (diff)
add scroll to log line
Diffstat (limited to 'irclog/search')
-rw-r--r--irclog/search/index.html18
-rw-r--r--irclog/search/search1.js (renamed from irclog/search/search.js)13
2 files changed, 27 insertions, 4 deletions
diff --git a/irclog/search/index.html b/irclog/search/index.html
index 066b30d..a31414b 100644
--- a/irclog/search/index.html
+++ b/irclog/search/index.html
@@ -45,6 +45,22 @@
color: blue;
text-decoration: underline;
}
+ .logline {
+ color: black;
+ text-decoration: none;
+ }
+ .logline:link {
+ color: black;
+ text-decoration: none;
+ }
+ .logline:hover {
+ color: black;
+ text-decoration: underline;
+ }
+ .logline:visited {
+ color: black;
+ text-decoration: none;
+ }
</style>
</head>
<body>
@@ -57,6 +73,6 @@
<br>
</div>
<div id="log-container"></div>
- <script src="./search.js"></script>
+ <script src="./search1.js"></script>
</body>
</html>
diff --git a/irclog/search/search.js b/irclog/search/search1.js
index 9a574d6..cf59f90 100644
--- a/irclog/search/search.js
+++ b/irclog/search/search1.js
@@ -59,9 +59,11 @@ function aggrLog(data) {
month = date.substring(5, 7);
day = date.substring(8, 10);
url = '../view/?chan=main&y=' + year + '&m=' + month + '&d=' + day;
- ret = ret + '\n=== <a href=' + url + ' target=\'_blank\'>' + date + '</a> ===' + '\n';
+ ret = ret + '\n=== ' + date + ' ===' + '\n';
logsByDate[date].forEach(log => {
- ret = ret + log + '\n';
+ let time = log.substring(1,9);
+ let logurl = url + '#' + time;
+ ret = ret + '<a class="logline" target="_blank" href="' + logurl + '">' + log + '</a>\n';
});
});
return ret;
@@ -86,7 +88,12 @@ function loadLog() {
return response.text();
})
.then(text => {
- logContainer.innerHTML = `<pre>${logProcess(text.trim())}</pre>`;
+ try {
+ logContainer.innerHTML = `<pre>${logProcess(text.trim())}</pre>`;
+ } catch (e) {
+ console.log(e);
+ }
+
})
.catch(error => {
console.error('Fetch error:', error);