Skip to content

Commit

Permalink
fix: lint
Browse files Browse the repository at this point in the history
  • Loading branch information
swsoyee committed May 30, 2024
1 parent ac899d6 commit ccd4e73
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions psnineplus.js
Original file line number Diff line number Diff line change
Expand Up @@ -414,7 +414,7 @@
const hdElement = document.querySelector('.hd');
if (hdElement && hdElement.textContent.trim() === '游戏列表') {
// 创建新的 span 元素
let spanElement = document.createElement('span');
const spanElement = document.createElement('span');
spanElement.className = 'btn';
spanElement.textContent = '按难度排列';
// 添加 span 元素到 .hd 元素中
Expand Down Expand Up @@ -442,7 +442,7 @@
// 为 span 元素添加点击排序功能
spanElement.addEventListener('click', () => {
const tdElements = document.querySelectorAll('table.list tbody > tr');
const tdArray = Array.from(tdElements).map(td => {
const tdArray = Array.from(tdElements).map((td) => {
const valueElement = td.querySelector('td.twoge > em');
const value = valueElement ? parseFloat(valueElement.textContent) : null;
return { td, value };
Expand All @@ -452,12 +452,12 @@
tdArray.sort((a, b) => {
if (a.value === null) return 1; // a 为空则放到最后
if (b.value === null) return -1; // b 为空则放到最后
return ascending ? a.value - b.value : b.value - a.value;
return ascending ? a.value - b.value : b.value - a.value;
});

const tbody = document.querySelector('table.list tbody');
tbody.innerHTML = '';
tdArray.forEach(item => {
tdArray.forEach((item) => {
tbody.appendChild(item.td);
});

Expand Down

0 comments on commit ccd4e73

Please sign in to comment.