fixes #119
This commit is contained in:
parent
9932ea2761
commit
90c6e1e165
2 changed files with 11 additions and 6 deletions
|
@ -50,6 +50,7 @@
|
|||
<div id="list" data-loading=true>
|
||||
<table>
|
||||
<colgroup>
|
||||
<col width="50">
|
||||
<col width="40">
|
||||
<col width="150">
|
||||
<col width="100">
|
||||
|
@ -57,6 +58,7 @@
|
|||
</colgroup>
|
||||
<template>
|
||||
<tr>
|
||||
<td></td>
|
||||
<td><input type="radio" name="select"></td>
|
||||
<td></td>
|
||||
<td></td>
|
||||
|
|
|
@ -144,29 +144,32 @@ function update(ua) {
|
|||
if (list) {
|
||||
const fragment = document.createDocumentFragment();
|
||||
let radio;
|
||||
for (const o of sort(list)) {
|
||||
list = sort(list);
|
||||
list.forEach((o, n) => {
|
||||
const clone = document.importNode(t.content, true);
|
||||
const second = clone.querySelector('td:nth-child(2)');
|
||||
const num = clone.querySelector('td:nth-child(1)');
|
||||
num.textContent = n + 1;
|
||||
const second = clone.querySelector('td:nth-child(3)');
|
||||
if (o.browser.name && o.browser.version) {
|
||||
second.title = second.textContent = o.browser.name + ' ' + (o.browser.version || ' ');
|
||||
}
|
||||
else {
|
||||
second.title = second.textContent = '-';
|
||||
}
|
||||
const third = clone.querySelector('td:nth-child(3)');
|
||||
const third = clone.querySelector('td:nth-child(4)');
|
||||
if (o.os.name && o.os.version) {
|
||||
third.title = third.textContent = o.os.name + ' ' + (o.os.version || ' ');
|
||||
}
|
||||
else {
|
||||
third.title = third.textContent = '-';
|
||||
}
|
||||
const forth = clone.querySelector('td:nth-child(4)');
|
||||
const forth = clone.querySelector('td:nth-child(5)');
|
||||
forth.title = forth.textContent = o.ua;
|
||||
if (o.ua === ua) {
|
||||
radio = clone.querySelector('input[type=radio]');
|
||||
}
|
||||
fragment.appendChild(clone);
|
||||
}
|
||||
});
|
||||
tbody.appendChild(fragment);
|
||||
if (radio) {
|
||||
radio.checked = true;
|
||||
|
@ -206,7 +209,7 @@ document.addEventListener('change', ({target}) => {
|
|||
}, prefs => update(prefs.ua || navigator.userAgent));
|
||||
}
|
||||
if (target.type === 'radio') {
|
||||
document.getElementById('ua').value = target.closest('tr').querySelector('td:nth-child(4)').textContent;
|
||||
document.getElementById('ua').value = target.closest('tr').querySelector('td:nth-child(5)').textContent;
|
||||
document.getElementById('ua').dispatchEvent(new Event('input'));
|
||||
}
|
||||
});
|
||||
|
|
Loading…
Reference in a new issue