您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
Add row numbers to the user log
- // ==UserScript==
- // @name GGn Row Numbers in User Log
- // @namespace none
- // @version 2
- // @description Add row numbers to the user log
- // @author ingts
- // @match https://gazellegames.net/user.php?*action=userlog*
- // ==/UserScript==
- const table = document.querySelector('#content > div > table')
- const tbody = table.querySelector('tbody')
- const page = new URL(location.href).searchParams.get('page')
- const startIndex = page ? (page - 1) * 50 : 0
- tbody.firstElementChild.insertAdjacentHTML('afterbegin', `<td style="width: 1px;"><strong>#</strong></td>`)
- function number(tr) {
- tr.insertAdjacentHTML('afterbegin', `<td class="nobr"><span>${tr.rowIndex + startIndex}</span></td>`)
- }
- tbody.querySelectorAll('tr:not(.colhead)').forEach(tr => {
- number(tr)
- })
- new MutationObserver(mutations => {
- mutations.forEach(m => {
- number(m.addedNodes[0])
- })
- }).observe(table, {childList: true})