您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
Bump requests from the list page
- // ==UserScript==
- // @name GGn Quick Bump Requests
- // @namespace none
- // @version 1
- // @description Bump requests from the list page
- // @author ingts
- // @match https://gazellegames.net/requests.php*
- // @exclude https://gazellegames.net/requests.php?action=new*
- // ==/UserScript==
- const submit = document.querySelector('div.submit')
- const rows = document.querySelectorAll("#requests_list > tbody > tr:not(.colhead_dark)")
- const button = document.createElement('button')
- button.textContent = 'Show bump buttons'
- button.type = 'button'
- button.style.marginTop = '10px'
- submit.append(button)
- button.onclick = () => {
- button.remove()
- rows.forEach(row=> {
- const voteButton = row.querySelector('a[href*="IndexVote"]')
- const bump = document.createElement('button')
- bump.textContent = 'Bump'
- bump.style.margin = '3px auto 0 auto'
- bump.style.display = 'block'
- bump.onclick = () => {
- bump.disabled = true
- fetch(`requests.php?action=bumprequest&id=${/\d+/.exec(voteButton.href)[0]}`)
- .then(r => {
- if (r.status === 200) bump.textContent = 'Bumped'
- })
- }
- voteButton.after(bump)
- })
- }