Browse Source

Set max-height of user information in ranklist to one line

pull/6/head
Menci 7 years ago
parent
commit
185745aa02
  1. 15
      views/index.ejs
  2. 15
      views/ranklist.ejs

15
views/index.ejs

@ -32,6 +32,18 @@
<th>个性签名</th>
</tr>
</thead>
<script>
var lineHeight = 0;
(function () {
var div = document.createElement('div');
div.style.position = 'fixed';
div.style.left = -10000;
div.style.visibility = 'hidden';
div.innerText = '测试,Test.';
document.body.appendChild(div);
lineHeight = div.clientHeight;
})();
</script>
<tbody>
<%
let i = 0;
@ -46,7 +58,8 @@
(function () {
var html = <%- JSON.stringify(user.information) %>;
var elem = document.createElement('div');
elem.style = 'max-height: 50px; overflow: hidden; width: 100%; max-width: 480px; ';
elem.style = 'overflow: hidden; width: 100%; max-width: 480px; ';
elem.style.maxHeight = lineHeight + 'px';
elem.innerHTML = html;
var imgs = Array.from(elem.getElementsByTagName('img'));
for (var i in imgs) imgs[i].parentNode.removeChild(imgs[i]);

15
views/ranklist.ejs

@ -16,6 +16,18 @@
<th>通过数量</th>
</tr>
</thead>
<script>
var lineHeight = 0;
(function () {
var div = document.createElement('div');
div.style.position = 'fixed';
div.style.left = -10000;
div.style.visibility = 'hidden';
div.innerText = '测试,Test.';
document.body.appendChild(div);
lineHeight = div.clientHeight;
})();
</script>
<tbody>
<%
let i = (paginate.currPage - 1) * paginate.perPage;
@ -30,7 +42,8 @@
(function () {
var html = <%- JSON.stringify(user.information) %>;
var elem = document.createElement('div');
elem.style = 'max-height: 50px; overflow: hidden; width: 100%; max-width: 840px; ';
elem.style = 'overflow: hidden; width: 100%; max-width: 840px; ';
elem.style.maxHeight = lineHeight + 'px';
elem.innerHTML = html;
var imgs = Array.from(elem.getElementsByTagName('img'));
for (var i in imgs) imgs[i].parentNode.removeChild(imgs[i]);

Loading…
Cancel
Save