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>
|
<div id="list" data-loading=true>
|
||||||
<table>
|
<table>
|
||||||
<colgroup>
|
<colgroup>
|
||||||
|
<col width="50">
|
||||||
<col width="40">
|
<col width="40">
|
||||||
<col width="150">
|
<col width="150">
|
||||||
<col width="100">
|
<col width="100">
|
||||||
|
@ -57,6 +58,7 @@
|
||||||
</colgroup>
|
</colgroup>
|
||||||
<template>
|
<template>
|
||||||
<tr>
|
<tr>
|
||||||
|
<td></td>
|
||||||
<td><input type="radio" name="select"></td>
|
<td><input type="radio" name="select"></td>
|
||||||
<td></td>
|
<td></td>
|
||||||
<td></td>
|
<td></td>
|
||||||
|
|
|
@ -144,29 +144,32 @@ function update(ua) {
|
||||||
if (list) {
|
if (list) {
|
||||||
const fragment = document.createDocumentFragment();
|
const fragment = document.createDocumentFragment();
|
||||||
let radio;
|
let radio;
|
||||||
for (const o of sort(list)) {
|
list = sort(list);
|
||||||
|
list.forEach((o, n) => {
|
||||||
const clone = document.importNode(t.content, true);
|
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) {
|
if (o.browser.name && o.browser.version) {
|
||||||
second.title = second.textContent = o.browser.name + ' ' + (o.browser.version || ' ');
|
second.title = second.textContent = o.browser.name + ' ' + (o.browser.version || ' ');
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
second.title = second.textContent = '-';
|
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) {
|
if (o.os.name && o.os.version) {
|
||||||
third.title = third.textContent = o.os.name + ' ' + (o.os.version || ' ');
|
third.title = third.textContent = o.os.name + ' ' + (o.os.version || ' ');
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
third.title = third.textContent = '-';
|
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;
|
forth.title = forth.textContent = o.ua;
|
||||||
if (o.ua === ua) {
|
if (o.ua === ua) {
|
||||||
radio = clone.querySelector('input[type=radio]');
|
radio = clone.querySelector('input[type=radio]');
|
||||||
}
|
}
|
||||||
fragment.appendChild(clone);
|
fragment.appendChild(clone);
|
||||||
}
|
});
|
||||||
tbody.appendChild(fragment);
|
tbody.appendChild(fragment);
|
||||||
if (radio) {
|
if (radio) {
|
||||||
radio.checked = true;
|
radio.checked = true;
|
||||||
|
@ -206,7 +209,7 @@ document.addEventListener('change', ({target}) => {
|
||||||
}, prefs => update(prefs.ua || navigator.userAgent));
|
}, prefs => update(prefs.ua || navigator.userAgent));
|
||||||
}
|
}
|
||||||
if (target.type === 'radio') {
|
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'));
|
document.getElementById('ua').dispatchEvent(new Event('input'));
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in a new issue