summaryrefslogtreecommitdiff
path: root/irclog/view
diff options
context:
space:
mode:
authorMistivia <i@mistivia.com>2025-11-17 01:26:24 +0800
committerMistivia <i@mistivia.com>2025-11-17 01:26:24 +0800
commit0a012e1f97cc66e7b9d76a8eb3febad1d37312d8 (patch)
tree043f9ba2a199be74528c205d4a928e8d8b38eac3 /irclog/view
parent07f98d9aecb6998cdc1dd649c12d6e49bed67f67 (diff)
Diffstat (limited to 'irclog/view')
-rw-r--r--irclog/view/index.html14
-rw-r--r--irclog/view/view9.js (renamed from irclog/view/view8.js)10
2 files changed, 18 insertions, 6 deletions
diff --git a/irclog/view/index.html b/irclog/view/index.html
index ceee973..55232b2 100644
--- a/irclog/view/index.html
+++ b/irclog/view/index.html
@@ -56,6 +56,18 @@
color: black;
text-decoration: none;
}
+ .logimg {
+ vertical-align: top;
+ display: inline-block;
+ max-width: 300px;
+ max-height: 300px
+ }
+ .logvid {
+ vertical-align: top;
+ display: inline-block;
+ max-width: 300px;
+ max-height: 300px
+ }
</style>
</head>
<body>
@@ -73,6 +85,6 @@
<div id="log-container"></div>
<button onclick="setPreviousDay()">上一天</button>
<button onclick="setNextDay()">下一天</button>
- <script src="./view8.js"></script>
+ <script src="./view9.js"></script>
</body>
</html>
diff --git a/irclog/view/view8.js b/irclog/view/view9.js
index c8cdad0..bc2c158 100644
--- a/irclog/view/view8.js
+++ b/irclog/view/view9.js
@@ -86,7 +86,7 @@ function isPic(url) {
'.gif'
];
for (let s of pics) {
- if (url.endsWith(s)) {
+ if (url.toLowerCase().endsWith(s)) {
return true;
}
}
@@ -97,10 +97,10 @@ function isVideo(url) {
const vids = [
'.webm',
'.ogv',
- 'mp4'
+ '.mp4'
];
for (let s of vids) {
- if (url.endsWith(s)) {
+ if (url.toLowerCase().endsWith(s)) {
return true;
}
}
@@ -111,10 +111,10 @@ function linkify(text) {
const urlRegex = /(\b(https?):\/\/[-A-Z0-9+&@#\/%?=~_|!:,.;]*[-A-Z0-9+&@#\/%=~_|])/ig;
return text.replace(urlRegex, function(url) {
if (isPic(url)) {
- return `<a href="${url}" target="_blank"><img style="vertical-align:top;display:inline-block;max-width:300px;max-height:300px" src="${url}"></a>`;
+ return `<a href="${url}" target="_blank"><img class="logimg" src="${url}"></a>`;
}
if (isVideo(url)) {
- return `<video style="vertical-align:top;display:inline-block;max-width:300px;max-height:300px" src="${url}" controls></video>`
+ return `<video class="logvid" src="${url}" controls></video>`
}
return `<a href="${url}" target="_blank">${url}</a>`;
});