diff options
Diffstat (limited to 'irclog')
| -rw-r--r-- | irclog/view/index.html | 14 | ||||
| -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>`; }); |
